Checks if `schema_name` is a valid file, if not
    searches in `data_path` for it.
545030
def _find_schema(data_path, schema_name):
    

    path = glob.glob(schema_name)
    for p in path:
        if os.path.isfile(p):
            return p

    return _find_data_path_schema(data_path, schema_name)
559291
def find_schema_paths(schema_files_path=DEFAULT_SCHEMA_FILES_PATH):
    
    paths = []
    for path in schema_files_path:
        if os.path.isdir(path):
            paths.append(path)
    if paths:
        return paths
    raise SchemaFilesNotFound("Searched " + os.pathsep.join(schema_files_path))
1371978
def ValidateVfsPath(path):
  """"""

  components = (path or "").lstrip("/").split("/")
  if not components:
    raise ValueError("Empty path is not a valid path: %s." %
                     utils.SmartStr(path))

  if components[0] not in ROOT_FILES_WHITELIST:
    raise ValueError(
        "First path component was '%s', but has to be one of %s" %
        (utils.SmartStr(components[0]), ", ".join(ROOT_FILES_WHITELIST)))

  return True
1130241
def CheckFile(self, path):
    
    print('Checking: {0:s}'.format(path))

    definitions_registry = registry.DataTypeDefinitionsRegistry()
    definitions_reader = reader.YAMLDataTypeDefinitionsFileReader()
    result = False

    try:
      definitions_reader.ReadFile(definitions_registry, path)
      result = True

    except KeyError as exception:
      logging.warning((
          'Unable to register data type definition in file: {0:s} with '
          'error: {1:s}').format(path, exception))

    except errors.FormatError as exception:
      logging.warning(
          'Unable to validate file: {0:s} with error: {1:s}'.format(
              path, exception))

    return result
925216
def find_resource_paths(schema_dir):
    
    def not_api_doc_file(filename):
        return not filename.endswith(API_DOCS_FILENAME)

    def not_swagger_dot_json(filename):
        # Exclude a Swagger 2.0 schema file if it happens to exist.
        return not os.path.basename(filename) == 'swagger.json'

    def filename_to_path(filename):
        filename, _ext = os.path.splitext(os.path.basename(filename))
        return '/' + filename

    filenames = glob.glob('{0}/*.json'.format(schema_dir))
    return map(filename_to_path,
               filter(not_swagger_dot_json,
                      filter(not_api_doc_file, sorted(filenames))))
1365449
function isValidFile(file) {
    var fs = require("fs");
    try {
        return fs.statSync(file).isFile();
    } catch (err) {
        return false;
    }
}
1316007
def has_files(the_path):
    """"""
    the_path = Path(the_path)
    try:
        for _ in the_path.walkfiles():
            return True
        return False
    except OSError as ex:
        if ex.errno == errno.ENOENT:
            # ignore
            return False
        else:
            raise
973296
def valid_file(cls, filename):
        
        return not os.path.isdir(filename) \
            and os.path.basename(filename).startswith('Session ') \
            and filename.endswith('.mqo')
41588
def is_valid_file(parser, arg):
    """"""
    arg = os.path.abspath(arg)
    if not os.path.exists(arg):
        parser.error("The file %s does not exist!" % arg)
    else:
        return arg
1303670
def _is_valid_file(self, path):
        """"""
        return isinstance(path, basestring) and os.path.isfile(path)
936865
def __verify_db_file_existence(self, database_path):
        

        self.__validate_db_path(database_path)
        if not os.path.isfile(os.path.realpath(database_path)):
            raise IOError("file not found: " + database_path)

        try:
            connection = sqlite3.connect(database_path)
        except sqlite3.OperationalError as e:
            raise OperationalError(e)

        connection.close()
1193932
def ensure_schema(self):
        """"""
        self._ensure_filename()
        if not os.path.isfile(self.filename):
            self.create_schema()
986176
def checkASN(filename):
    
    # Extract the file extn type:
    extnType = filename[filename.rfind('_')+1:filename.rfind('.')]

    # Determine if this extn name is valid for an assocation file
    if isValidAssocExtn(extnType):
        return True
    else:
        return False
850871
def datadir_exists(name):
    '''
    
    '''
    _version_file = os.path.join(name, 'PG_VERSION')
    _config_file = os.path.join(name, 'postgresql.conf')

    return os.path.isfile(_version_file) and os.path.isfile(_config_file)
784497
def is_file(self):
        
        try:
            return S_ISREG(self.stat().st_mode)
        except OSError as e:
            if e.errno not in (ENOENT, ENOTDIR):
                raise
            # Path doesn't exist or is a broken symlink
            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
            return False
232117
def _validate_source_data(self):
        

        try:
            jsonschema.validate(self._buffer, self._schema)
        except jsonschema.ValidationError as e:
            raise ValidationError(e)
1216063
def isValid( self ):
        
        check = nativestring(self._filepathEdit.text()).split(os.path.pathsep)[0]
        if ( self.filepathMode() == XFilepathEdit.Mode.SaveFile ):
            check = os.path.dirname(check)
        
        return os.path.exists(check)