Parse entire file and return a :class:`Catchment` object.

        :param file_name: File path
        :type file_name: str
        :return: Parsed object
        :rtype: :class:`Catchment`
507308
def parse(self, file_name):
        
        root = ET.parse(file_name).getroot()
        return self._parse(root)
661726
def read_config_file(self, file_name):
        
        with open(os.path.join(self.__path(), os.path.basename(file_name)),
                  'rt') as file_config:
            return self._parser.parseString(file_config.read())
643962
def FindFileByName(self, file_name):
    

    try:
      return self._file_descriptors[file_name]
    except KeyError:
      pass

    try:
      file_proto = self._internal_db.FindFileByName(file_name)
    except KeyError as error:
      if self._descriptor_db:
        file_proto = self._descriptor_db.FindFileByName(file_name)
      else:
        raise error
    if not file_proto:
      raise KeyError('Cannot find a file named %s' % file_name)
    return self._ConvertFileProtoToFileDescriptor(file_proto)
404090
def read(file, name, ext)
      contents = File.read(file)           # Read the contents from the file.
      contents = ERB.new(contents).result  # Evaluate any ruby code using ERB.
      parse(contents, name, ext)           # Parse the contents based on the file type
    end
662488
def _resolve_file(file_name):
    
    if not file_name:
        return None

    path = os.path.realpath(file_name)
    if os.path.isfile(path):
        return path

    return None
307012
def parse_file_path(filepath):
    # type: (pathlib.Path) -> Tuple[str, str, str]
    
    if not isinstance(filepath, pathlib.Path):
        filepath = pathlib.Path(filepath)
    dirname = '/'.join(filepath.parts[:len(filepath.parts) - 1])
    if len(dirname) == 0:
        dirname = None
    if len(filepath.parts) > 0:
        fname = filepath.parts[-1]
    else:
        fname = None
    fname, snapshot = blobxfer.util.parse_fileshare_or_file_snapshot_parameter(
        fname)
    return (dirname, fname, snapshot)
12852
def file_name(self, file_name):
        
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        self._data['fileName'] = file_name
        request = {'fileName': file_name}
        return self.tc_requests.update(self.api_type, self.api_sub_type, self.unique_id, request)
841562
def load(cls, filename, name=None):
        
        if not os.path.exists(filename):
            return {}
        name = name or filename

        if name not in cls._conffiles:
            with open(filename) as fdesc:
                content = yaml.load(fdesc, YAMLLoader)
                # in case the file is empty
                if content is None:
                    content = {}
                cls._conffiles[name] = content

        return cls._conffiles[name]
376685
def simple_parse_file(filename: str) -> Feed:
    """"""
    pairs = (
        (rss.parse_rss_file, _adapt_rss_channel),
        (atom.parse_atom_file, _adapt_atom_feed),
        (json_feed.parse_json_feed_file, _adapt_json_feed)
    )
    return _simple_parse(pairs, filename)
527447
def read_file(filename):
   

   infile = open(filename, 'r')
   lines = infile.readlines()
   infile.close()

   return lines
687276
def readfile(filename):
    
    with open(path_expand(filename), 'r') as f:
        content = f.read()
    return content
1138165
def parse_file(file_or_path, encoding='utf-8', validate=False):
    
    try:
        is_string = isinstance(file_or_path, basestring)
    except NameError:
        is_string = isinstance(file_or_path, str)
    if is_string:
        with codecs.open(file_or_path, 'r', encoding) as file_:
            result = pattern.parseFile(file_)[0]
    else:
        result = pattern.parseFile(file_or_path)[0]
    if validate:
        result.validate()
    return result
259381
def _parse(self):
        
        with open(self.path, "rt") as reader:
            return ast.parse(reader.read(), filename=self.path)
884667
def _ParseFile(self, file_obj, line_parser):
    
    lines = [
        l.strip() for l in utils.ReadFileBytesAsUnicode(file_obj).splitlines()
    ]
    try:
      for index, line in enumerate(lines):
        if line:
          line_parser(line)
    except (IndexError, KeyError) as e:
      raise parser.ParseError("Invalid file at line %d: %s" % (index + 1, e))
1277789
def parse_file(self, filename=None, buffer=None, fileobj=None):
        """"""
        if filename:
            self.file = GzipFile(filename, 'rb')
        elif buffer:
            if hasattr(buffer, 'name'):
                self.filename = buffer.name
            self.file = buffer
        elif fileobj:
            if hasattr(fileobj, 'name'):
                self.filename = fileobj.name
            self.file = GzipFile(fileobj=fileobj)
        if self.file:
            try:
                type = TAG_Byte(buffer=self.file)
                if type.value == self.id:
                    name = TAG_String(buffer=self.file).value
                    self._parse_buffer(self.file)
                    self.name = name
                    self.file.close()
                else:
                    raise MalformedFileError(
                        "First record is not a Compound Tag")
            except StructError as e:
                raise MalformedFileError(
                    "Partial File Parse: file possibly truncated.")
        else:
            raise ValueError(
                "NBTFile.parse_file(): Need to specify either a "
                "filename or a file object"
            )
436535
def from_file(filename_or_file_object):
    
    if isinstance(filename_or_file_object, basestring):
        file_ = open(filename_or_file_object, 'r')
        we_opened = True
    else:
        we_opened = False
        file_ = filename_or_file_object

    try:
        data = load(file_.read())
    finally:
        if we_opened:
            file_.close()

    return data
815576
def _read_file(self, filename):
        
        with open(filename, 'r') as stream:
            return self._read_stream(stream=stream)