Read a gmt file at the path specified by file_path.

    Args:
        file_path (string): path to gmt file

    Returns:
        gmt (GMT object): list of dicts, where each dict corresponds to one
            line of the GMT file
434540
def read(file_path):
    
    # Read in file
    actual_file_path = os.path.expanduser(file_path)
    with open(actual_file_path, 'r') as f:
        lines = f.readlines()
    
    # Create GMT object
    gmt = []
    
    # Iterate over each line
    for line_num, line in enumerate(lines):
        # Separate along tabs
        fields = line.split('\t')

        assert len(fields) > 2, (
            "Each line must have at least 3 tab-delimited items. " +
            "line_num: {}, fields: {}").format(line_num, fields)
        
        # Get rid of trailing whitespace
        fields[-1] = fields[-1].rstrip()
        
        # Collect entries
        entries = fields[2:]
        
        # Remove empty entries
        entries = [x for x in entries if x]

        assert len(set(entries)) == len(entries), (
            "There should not be duplicate entries for the same set. " +
            "line_num: {}, entries: {}").format(line_num, entries)

        # Store this line as a dictionary
        line_dict = {SET_IDENTIFIER_FIELD: fields[0],
                     SET_DESC_FIELD: fields[1],
                     SET_MEMBERS_FIELD: entries}
        gmt.append(line_dict)

    verify_gmt_integrity(gmt)

    return gmt
1151445
def read_file(self, file_path):
        
        try:
            with open(self.p(file_path)) as fd:
                return fd.read()
        except IOError as ex:
            logger.error("error while accessing file %s: %r", file_path, ex)
            raise ConuException("There was an error while accessing file %s: %r", file_path, ex)
292444
def read_txt_file(filepath):
    
    if sys.version > '3':
        with open(filepath,'r',encoding='utf-8') as txt_file:
            return txt_file.readlines()
    else:
        with open(filepath) as txt_file:
            return txt_file.readlines()
882820
def _read_syncmap_file(self, path, extension, text=False):
        
        syncmap = SyncMap(logger=self.logger)
        syncmap.read(extension, path, parameters=None)
        if text:
            return [(f.begin, f.end, u" ".join(f.text_fragment.lines)) for f in syncmap.fragments]
        return [(f.begin, f.end, f.text_fragment.identifier) for f in syncmap.fragments]
824680
def read_file(self, path, **kwargs):
        
        try:
            with open(path, "r") as handle:
                parsed_data = yaml.safe_load(handle)
                return parsed_data
        except IOError:
            LOGGER.warning("Error reading file: {0}".format(path))
        except TypeError:
            LOGGER.warning("Error reading file: {0}".format(path))
        return None
510631
def read_file(cls, filepath):
        
        with open(filepath, mode='rb') as f:
            contents = f.read()
        return cls.decode(contents)
749720
def get_files(self, path):
        

        if os.path.isfile(path):
            self.logger.debug('Called with single file as target: {0}'.format(path))
            yield path
            return

        self.logger.debug('Getting list of files in {0}'.format(path))

        try:
            for f in os.listdir(path):
                cur_file = os.path.join(path, f)
                if f[0] != '.' and os.path.isfile(cur_file):
                    yield cur_file
        except OSError:
            self.logger.error('Could not read files from {0}'.format(path))
            raise
321152
def read_file(file_path, default_content=''):
    
    if not os.path.exists(file_path):
        write_file(file_path, default_content)

    handler = open(file_path, 'r')
    content = handler.read()
    handler.close()
    return content or default_content
1163335
def get_dates_file(path):
    
    with open(path) as f:
        dates = f.readlines()
    return [(convert_time_string(date_string.split(" ")[0]), float(date_string.split(" ")[1]))
            for date_string in dates]
251974
def read_file(paths):
    

    if isinstance(paths, str):
        paths = [paths]

    re = {}
    for path in paths:
        cfg = yaml.load(open(path))
        merge(re, cfg)

    return re
1017073
def read(self, path, wrap_ttl=None):
        
        try:
            return self._adapter.get('/v1/{0}'.format(path), wrap_ttl=wrap_ttl).json()
        except exceptions.InvalidPath:
            return None
1123460
def read(self, path, encoding=None):
        
        b = common.read(path)

        if encoding is None:
            encoding = self.file_encoding

        return self.unicode(b, encoding)
473082
def read(path):
    
    # This function implementation was chosen to be compatible across Python 2/3.
    f = open(path, 'rb')
    # We avoid use of the with keyword for Python 2.4 support.
    try:
        b = f.read()
    finally:
        f.close()

    return b.decode(FILE_ENCODING)
846260
def __read_file(usr_path, file_type):
    
    global files

    # no path provided. start gui browse
    if not usr_path:
        # src files could be a list of one, or a list of many. depending how many files the user selects
        src_dir, src_files = get_src_or_dst("read", "file")
        # check if src_files is a list of multiple files
        if src_files:
            for file_path in src_files:
                __universal_read(file_path, file_type)
        else:
            print("No file(s) chosen")
    else:
        __universal_read(usr_path, file_type)

    return
1224690
def get_file(self, file_path, mode="r"):
        
        return open(self.cont_path(file_path), mode=mode)
1348832
def safe_read_file(file_path: Path) -> str:
    
    for encoding in FILE_ENCODINGS:
        try:
            return file_path.read_text(encoding=encoding)
        except UnicodeError:
            pass  # Ignore encoding error

    raise GuesslangError('Encoding not supported for {!s}'.format(file_path))
755817
def load(self, path):
        
        self.dct = wrapper.Dictionary()
        self.guide = wrapper.Guide()

        with open(path, 'rb') as f:
            self.dct.read(f)
            self.guide.read(f)

        return self