Default filter for filenames.

    Returns either a normalized filename or None.
    You can pass your own filter to init_types_collection().
321234
def default_filter_filename(filename):
    # type: (Optional[str]) -> Optional[str]
    
    if filename is None:
        return None
    elif filename.startswith(TOP_DIR):
        if filename.startswith(TOP_DIR_DOT):
            # Skip subdirectories starting with dot (e.g. .vagrant).
            return None
        else:
            # Strip current directory and following slashes.
            return filename[TOP_DIR_LEN:].lstrip(os.sep)
    elif filename.startswith(os.sep):
        # Skip absolute paths not under current directory.
        return None
    else:
        return filename
611352
def filename(self):
        """"""
        if self.value and 'value' in self._json_data and self._json_data['value']:
            return self._json_data['value'].split('/')[-1]
        return None
259804
def get_file_extension_type(filename):
    
    ext = get_file_extension(filename)
    if ext:
        for name, group in EXTENSIONS.items():
            if ext in group:
                return name
    return "OTHER"
54892
def type_name(self) -> T.Optional[str]:
        """"""
        return self.args[1] if len(self.args) > 1 else None
732633
def _get_imagesave_wildcards(self):
        ''
        default_filetype = self.get_default_filetype()
        filetypes = self.get_supported_filetypes_grouped()
        sorted_filetypes = filetypes.items()
        sorted_filetypes.sort()
        wildcards = []
        extensions = []
        filter_index = 0
        for i, (name, exts) in enumerate(sorted_filetypes):
            ext_list = ';'.join(['*.%s' % ext for ext in exts])
            extensions.append(exts[0])
            wildcard = '%s (%s)|%s' % (name, ext_list, ext_list)
            if default_filetype in exts:
                filter_index = i
            wildcards.append(wildcard)
        wildcards = '|'.join(wildcards)
        return wildcards, extensions, filter_index
1203202
def _getPFilename(self,native,prompt):
        
        return self.get(native=native,prompt=prompt)
1330715
def default_filter_out(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "default_filter_out", value)
            assert os.path.exists(value), "'{0}' attribute: '{1}' file doesn't exists!".format(
                "default_filter_out", value)
        self.__default_filter_out = value
533324
def get_config_type(filename):
    
    if is_json_file(filename):
        return("json")
    elif is_ini_file(filename):
        return("ini")
    elif is_yaml_file(filename):
        return("yaml")
    elif is_toml_file(filename):
        return("toml")
    else:
        return(False)
347238
def search_filename(self, searchterm):
        
        return self.__search(type_attribute=self.__mispfilenametypes(), value=searchterm)
1244022
def Filter(self, filename_spec):
    """"""
    if "@" in filename_spec:
      file_path, package_name = filename_spec.split("@")
    else:
      file_path, package_name = filename_spec, Resource.default_package

    resource_path = package.ResourcePath(package_name, file_path)
    if resource_path is not None:
      return resource_path


    # pylint: disable=unreachable
    raise FilterError(
        "Unable to find resource %s while interpolating: " % filename_spec)
119842
def normalize(filename):
        """"""
        # Default value means we do not resolve a model file.
        if filename == "default":
            return filename
        filename = expanduser(filename)
        if isabs(filename):
            return filename
        else:
            return join(os.getcwd(), filename)
885309
def _file_filter(cls, filename, include_patterns, exclude_patterns):
    """"""
    logger.debug('filename: {}'.format(filename))
    for exclude_pattern in exclude_patterns:
      if exclude_pattern.match(filename):
        return False
    if include_patterns:
      found = False
      for include_pattern in include_patterns:
        if include_pattern.match(filename):
          found = True
          break
      if not found:
        return False
    return True
887589
def get_filters(self):
        
        if self._filters:
            filters_list = self._filters
            if isinstance(filters_list[-1], Enum):
                filters_list = filters_list[:-1]
            return ' '.join(
                [fs.value if isinstance(fs, Enum) else fs[1] for fs in
                 filters_list]).strip()
        else:
            return None
916170
function getFileNames(fileNames = [], componentName) {
  const defaultFileNames = {
    testFileName: `${defaultOptions.testFileName}.${componentName}`,
    componentFileName: componentName,
    styleFileName: componentName,
  }

  const formattedFileNames = Object.keys(fileNames).reduce(
    (acc, curr) => {
      acc[curr] = replaceKeys(fileNames[curr], componentName)
      return acc
    },
    { ...defaultFileNames }
  )

  return formattedFileNames
}
701367
def register(filetypes):
    
    def decorator(clazz):
        for ext in filetypes:
            checkers.setdefault(ext, []).append(clazz)
        return clazz
    return decorator
416047
def _filter_filepaths(self, filepaths):
        
        if self.file_filters:
            plugin_filepaths = set()
            for file_filter in self.file_filters:
                plugin_paths = file_filter(filepaths)
                plugin_filepaths.update(plugin_paths)
        else:
            plugin_filepaths = filepaths

        return plugin_filepaths
513775
def files_type(fs0, fs1, files):
    """"""
    for file_meta in files['deleted_files']:
        file_meta['type'] = fs0.file(file_meta['path'])
    for file_meta in files['created_files'] + files['modified_files']:
        file_meta['type'] = fs1.file(file_meta['path'])

    return files