Return all the possible guesses from the magic library about
    the content of the file.

    @param fullpath: location of the file
    @type fullpath: string
    @return: guesses about content of the file
    @rtype: tuple
12074
def get_magic_guesses(fullpath):
    
    if CFG_HAS_MAGIC == 1:
        magic_cookies = _get_magic_cookies()
        magic_result = []
        for key in magic_cookies.keys():
            magic_result.append(magic_cookies[key].file(fullpath))
        return tuple(magic_result)
    elif CFG_HAS_MAGIC == 2:
        magic_result = []
        for key in ({'mime': False, 'mime_encoding': False},
                    {'mime': True, 'mime_encoding': False},
                    {'mime': False, 'mime_encoding': True}):
            magic_result.append(_magic_wrapper(fullpath, **key))
        return tuple(magic_result)
1348458
def GetExtAttrs(filepath):
  
  path = CanonicalPathToLocalPath(filepath)

  try:
    attr_names = xattr.listxattr(path)
  except (IOError, OSError, UnicodeDecodeError) as error:
    msg = "Failed to retrieve extended attributes for '%s': %s"
    logging.error(msg, path, error)
    return

  # `xattr` (version 0.9.2) decodes names as UTF-8. Since we (and the system)
  # allows for names and values to be arbitrary byte strings, we use `bytes`
  # rather than `unicode` objects here. Therefore we have to re-encode what
  # `xattr` has decoded. Additionally, because the decoding that `xattr` does
  # may fail, we additionally guard against such exceptions.
  def EncodeUtf8(attr_name):
    if isinstance(attr_name, Text):
      return attr_name.encode("utf-8")
    if isinstance(attr_name, bytes):
      return attr_name
    raise TypeError("Unexpected type `%s`" % type(attr_name))

  for attr_name in attr_names:
    attr_name = EncodeUtf8(attr_name)
    try:
      attr_value = xattr.getxattr(path, attr_name)
    except (IOError, OSError) as error:
      msg = "Failed to retrieve attribute '%s' for '%s': %s"
      logging.error(msg, attr_name, path, error)
      continue

    yield rdf_client_fs.ExtAttr(name=attr_name, value=attr_value)
190905
public static String getFileName(String fullPath) {
        Preconditions.checkNotNull(fullPath, "path can not be null");
        int winDelimiterPos = fullPath.lastIndexOf(WINDOWS_DELIMITER);
        int linDelimiterPos = fullPath.lastIndexOf(LINUX_DELIMITER);
        int pos = Math.max(winDelimiterPos, linDelimiterPos);
        return fullPath.substring(pos + 1, fullPath.length());
    }
1139895
def get_suggestion(self, front_path):
        
        if '/' in front_path:
            # transverse the manifest, return the new manifest, then
            # get those suggestions with the remaining word
            splitted = front_path.split('/')
            new_manifest = self.manifest
            pre_path = ''
            for item in splitted:
                try:
                    new_manifest = new_manifest[item]
                except KeyError:
                    partial_word = item
                    break
                else:
                    pre_path += item + '/'

            if isinstance(new_manifest, Program):
                return []
            matches = new_manifest._get_suggestions(partial_word)
            return [pre_path + match for match in matches]
        else:
            return self._get_suggestions(front_path or None)
846277
def find_module(cls, fullname, path=None):
        
        spec = cls.find_spec(fullname, path)
        if spec is None:
            return None
        elif spec.loader is None and spec.submodule_search_locations:
            # Here we need to create a namespace loader to handle namespaces since python2 doesn't...
            return NamespaceLoader2(spec.name, spec.submodule_search_locations)
        else:
            return spec.loader
781410
def read_magic_file(self, path, sort_by_this_name):
        
        DATA = {}
        try:
            with open(path, 'r') as finput:
                lines = list(finput.readlines()[1:])
        except FileNotFoundError:
            return []
        # fin=open(path,'r')
        # fin.readline()
        line = lines[0]
        header = line.strip('\n').split('\t')
        error_strings = []
        for line in lines[1:]:
            tmp_data = {}
            tmp_line = line.strip('\n').split('\t')
            for i in range(len(tmp_line)):
                tmp_data[header[i]] = tmp_line[i]
            if tmp_data[sort_by_this_name] in list(DATA.keys()):
                error_string = "-E- ERROR: magic file %s has more than one line for %s %s" % (
                    path, sort_by_this_name, tmp_data[sort_by_this_name])
                # only print each error message once
                if error_string not in error_strings:
                    print(error_string)
                    error_strings.append(error_string)
            DATA[tmp_data[sort_by_this_name]] = tmp_data
        # fin.close()
        finput.close()
        return(DATA)
847153
def fullpath(self, **kwargs):
        
        kwargs_copy = self.base_dict.copy()
        kwargs_copy.update(**kwargs)
        self._replace_none(kwargs_copy)        
        return NameFactory.fullpath_format.format(**kwargs_copy)
761365
def _match_magic(self, full_path):
        """"""
        for magic in self.magics:
            if magic.matches(full_path):
                return magic
777140
public static Properties readPropertiesFromClasspathFile(String fullPath) {
        Properties properties = new Properties();
        try (InputStream inputStream = readClasspathFileIntoStream(fullPath)) {
            properties.load(new InputStreamReader(inputStream));
        } catch (IOException e) {
            throw new RuntimeException("加载配置文件" + fullPath + "出错");
        }
        return properties;
    }
319157
def full_path(self):
        ''''''
        with self._mutex:
            if self._parent:
                return self._parent.full_path + [self._name]
            else:
                return [self._name]
632743
def find_module(self, fullname, path=None):
        '''
        
        '''

        loader = None
        if self.__filter is None or self.__filter(fullname):
            loader = ModuleLoader(self, fullname, path)

        return loader
222624
def full_path(path):
    """"""
    return os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
515772
def xml_path_completion(xml_path):
    
    if xml_path.startswith("/"):
        full_path = xml_path
    else:
        full_path = os.path.join(robosuite.models.assets_root, xml_path)
    return full_path
1037365
def get_repo_content(path):
    
    path = Path(path)

    if zipfile.is_zipfile(str(path)):
        with zipfile.ZipFile(str(path)) as zz:
            filelist = [info.filename for info in zz.infolist()]
        iszip = True
    else:
        iszip = False
        filelist = [str(f) for f in path.glob('**/*') if f.is_file()]
    return namedtuple('repocontent', ['iszip', 'filelist'])(iszip, filelist)
1259654
def get_wf_from_path(self, path):
        
        with open(path) as fp:
            content = fp.read()
        return [(os.path.basename(os.path.splitext(path)[0]), content), ]
1287734
def open(self, filepath):
        
        with io.open(filepath, 'r', encoding='utf-8') as fp:
            content = fp.read()
        return content
122025
def _find_tpl(self):
        
        for tpl_possibility in self.tpl_possibilities:
            if os.path.isfile(tpl_possibility):
                return tpl_possibility

        return None