Get the metadata for a path or file descriptor
504012
function getAttr(fs, pathOrFd, attr, isFd, callback) {
  var getFn = 'fgetxattr';

  if(isFd !== true) {
    callback = isFd;
    getFn = 'getxattr';
  }

  fs[getFn](pathOrFd, attr, function(err, value) {
    if(err && err.code !== 'ENOATTR') {
      return callback(err);
    }

    callback(null, value);
  });
}
231260
def get_metadata(self):
        

        if self._metadata is None:
            self._metadata = self._source.get_metadata(self._handle)
        return self._metadata
346029
def get_os_filename (path):
    """"""
    if os.name == 'nt':
        path = prepare_urlpath_for_nt(path)
    res = urllib.url2pathname(fileutil.pathencode(path))
    if os.name == 'nt' and res.endswith(':') and len(res) == 2:
        # Work around http://bugs.python.org/issue11474
        res += os.sep
    return res
1240659
def _get_metadata_path(self, key):
        
        return "{group}/meta/{key}/meta".format(group=self.group._v_pathname,
                                                key=key)
655095
def get_metadata_as_dict(fname):
    
    imgdict = {}
    try:
        imgdict['filename'] = fname
        imgdict['size'] = str(os.path.getsize(fname)) 
        imgdict['basename'] = os.path.basename(fname)
        imgdict['path'] = os.path.dirname(fname)
        img = Image.open(fname)
        # get the image's width and height in pixels
        width, height = img.size
        imgdict['width'] = str(width)
        imgdict['height'] = str(height)
        imgdict['format'] = str(img.format) 
        imgdict['palette'] = str(img.palette)
        stat = ImageStat.Stat(img)
         
        #res = res + q + str(stat.extrema) + q + d
        imgdict['count'] =  List2String(stat.count, ",")
        imgdict['sum'] =  List2String(stat.sum, ",")
        imgdict['sum2'] =  List2String(stat.sum2, ",")
        imgdict['mean'] =  List2String(stat.mean, ",") 
        imgdict['median'] =  List2String(stat.median, ",") 
        imgdict['rms'] =  List2String(stat.rms, ",") 
        imgdict['var'] =  List2String(stat.var, ",")
        imgdict['stddev'] =  List2String(stat.stddev, ",") 

        exif_data = get_exif_data(img)
        print('exif_data = ', exif_data)
        (lat, lon) = get_lat_lon(exif_data)
        print('(lat, lon)', (lat, lon))
        imgdict['lat'] =  str(lat)
        imgdict['lon'] =  str(lon)
    except Exception as ex:
        print('problem reading image file metadata in ', fname, str(ex))
        imgdict['lat'] =  'ERROR'
        imgdict['lon'] =  'ERROR'
    return imgdict
782799
def collect_metadata_file(full_path):
    
    fne = os.path.basename(full_path)
    fn = os.path.splitext(fne)[0]
    obj = {"full_path": full_path, "filename_ext": fne, "filename_no_ext": fn, "dir": os.path.dirname(full_path)}
    return obj
20145
def get_archive_type(path):
    
    if not is_directory_archive(path):
        raise TypeError('Unable to determine the type of archive at path: %s' % path)

    try:
        ini_path = '/'.join([_convert_slashes(path), 'dir_archive.ini'])
        parser = _ConfigParser.SafeConfigParser()
        parser.read(ini_path)

        contents = parser.get('metadata', 'contents')
        return contents
    except Exception as e:
        raise TypeError('Unable to determine type of archive for path: %s' % path, e)
766661
def _GetFileNames(self):
    """"""
    if self._zip:
      return self._zip.namelist()
    else:
      return os.listdir(self._path)
93379
def _from_metadata(self, urlpath):
        """"""
        md = self.get_metadata(urlpath)
        if md is not None:
            return [e['cache_path'] for e in md]
484199
def _get_metadata(self):
        """"""
        self.metadata = self.fetch_header()
        self.variables = {g.name for g in self.metadata.grids}
492006
def get_name(path_name, *, ext=True, override=None, identity=None):
    
    if identity is None:
        identity = identify(path_name, override=override)

    if identity == ISFILE:
        if ext:
            r = os.path.basename(path_name)
        else:
            r = os.path.splitext(os.path.basename(path_name))[NAME]
    else:
        r = ''
    return r
517977
def _GetFilePaths(self, path, pathtype, kb):
    """"""

    environ_vars = artifact_utils.GetWindowsEnvironmentVariablesMap(kb)
    path_guesses = path_detection_windows.DetectExecutablePaths([path],
                                                                environ_vars)

    if not path_guesses:
      # TODO(user): yield a ParserAnomaly object
      return []

    return [
        rdf_paths.PathSpec(path=path, pathtype=pathtype)
        for path in path_guesses
    ]
562725
function getUserMetadataFileName(options, user) {
	let userId;
	if(typeof user === "string") {
		userId = user;
	} else if(user && typeof user.username === 'string') {
		userId = user.username;
	} else {
		return null;
	}
	return nodePath.join(getUserRootLocation(options, userId), FILENAME_USER_METADATA);
}
747536
def display_path_info(descriptor, class_, namespace):
    
    paths = CONN.EnumerateInstanceNames(class_, namespace=interop)  # noqa: F821
    print('%ss: count=%s' % (descriptor, len(paths)))
    for path in paths:
        print('%s: %s' % (descriptor, path))
    return paths
72033
def get_temporary_link(path)
      resp = request('/files/get_temporary_link', path: path)
      return FileMetadata.new(resp['metadata']), resp['link']
    end
279705
def copy_metadata(src_path, dest_path, **options)
      stats = ::File.lstat(src_path)
      ::File.utime(stats.atime, stats.mtime, dest_path)
      chmod(dest_path, stats.mode, options)
    end
952922
def get_file_meta(filepath):
    
    meta = {}
    meta['filepath'] = os.path.abspath(filepath)
    meta['creation_datetime'] = get_creation_datetime(filepath)
    meta['last_access_datetime'] = get_access_datetime(filepath)
    meta['modification_datetime'] = get_modification_datetime(filepath)
    try:
        import magic
        f_mime = magic.Magic(mime=True, uncompress=True)
        f_other = magic.Magic(mime=False, uncompress=True)
        meta['mime'] = f_mime.from_file(meta['filepath'])
        meta['magic-type'] = f_other.from_file(meta['filepath'])
    except ImportError:
        pass
    return meta