Read list of countries from specified country file or default file.
356170
def _read_country_names(self, countries_file=None):
        """"""
        if not countries_file:
            countries_file = os.path.join(os.path.dirname(__file__), self.COUNTRY_FILE_DEFAULT)
        with open(countries_file) as f:
            countries_json = f.read()

        return json.loads(countries_json)
589198
def _read_linguas_from_files(env, linguas_files=None):
    
    import SCons.Util
    import SCons.Environment
    global _re_comment
    global _re_lang
    if not SCons.Util.is_List(linguas_files) \
            and not SCons.Util.is_String(linguas_files) \
            and not isinstance(linguas_files, SCons.Node.FS.Base) \
            and linguas_files:
        # If, linguas_files==True or such, then read 'LINGUAS' file.
        linguas_files = ['LINGUAS']
    if linguas_files is None:
        return []
    fnodes = env.arg2nodes(linguas_files)
    linguas = []
    for fnode in fnodes:
        contents = _re_comment.sub("", fnode.get_text_contents())
        ls = [l for l in _re_lang.findall(contents) if l]
        linguas.extend(ls)
    return linguas
1097711
def read_records(file):
    """"""
    records = []
    for record_data in read_recordio(file):
        record = Record()
        record.ParseFromString(record_data)
        records.append(record)
    return records
1058365
def read_items(group, version='1.1', check=False):
    """"""
    if version == '0.1':
        # parse unicode to strings
        return ''.join(
            [unichr(int(c)) for c in group['files'][...]]
        ).replace('/-', '/').split('/\\')
    elif version == '1.0':
        return Items(list(group['files'][...]), check)
    else:
        return Items(list(group['items'][...]), check)
348992
def read(config_file, configspec, server_mode=False, default_section='default_settings', list_values=True):
    '''
    
    '''
#    configspec = ConfigObj(path.join(path.abspath(path.dirname(__file__)), configspec),
#                           encoding='UTF8',
#                           interpolation='Template',
#                           list_values=False,
#                           _inspec=True)
    config = ConfigObj(config_file,
                       configspec=path.join(path.abspath(path.dirname(__file__)),
                                            configspec),
                                            list_values=list_values)
    validation = config.validate(validate.Validator(), preserve_errors=True)

    if validation == True:
        config = dict(config)
        for section in config:
            if section != default_section:
                if server_mode: # When it's a servers config file, retrieve the correct fqdn
                    config[section]['availability'] = True
                    if config[section]['custom_fqdn'] == None:
                        config[section]['custom_fqdn'] = socket.getfqdn()
                for option in config[section]:  # retrieve default configuration for missing values
                    if config[section][option] == None:
                        config[section][option] = config[default_section][option]

        del(config[default_section])

        return config
    else:
        raise ConfiguratorException(config_file, validation)
217696
public static CountryList getCountries(Context context) {
        if (mCountries != null) {
            return mCountries;
        }
        mCountries = new CountryList();
        try {
            JSONArray countries = new JSONArray(getJsonFromRaw(context, R.raw.countries));
            for (int i = 0; i < countries.length(); i++) {
                try {
                    JSONObject country = (JSONObject) countries.get(i);
                    mCountries.add(new Country(country.getString("name"), country.getString("iso2"), country.getInt("dialCode")));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return mCountries;
    }
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
1363047
def __load_countries(self, db):
        """"""

        try:
            countries = self.__read_countries_file()
        except IOError as e:
            raise LoadError(str(e))

        try:
            with db.connect() as session:
                for country in countries:
                    session.add(country)
        except Exception as e:
            raise LoadError(str(e))
1155783
def country_list_nlp(cts):
    """"""
    ct_nlp = []
    for i in cts.keys():
        nlped = nlp(i)
        ct_nlp.append(nlped)
    return ct_nlp
244316
def read_files(filenames, with_name=False):
    """"""
    text = [read_file(filename) for filename in filenames]
    if with_name:
        return dict(zip(filenames, text))
    return text
355137
def _get_file_list(orig_files, out_file, regions, ref_file, config):
    
    sorted_files = _sort_by_region(orig_files, regions, ref_file, config)
    exist_files = [(c, x) for c, x in sorted_files if os.path.exists(x) and vcf_has_variants(x)]
    if len(exist_files) == 0:  # no non-empty inputs, merge the empty ones
        exist_files = [x for c, x in sorted_files if os.path.exists(x)]
    elif len(exist_files) > 1:
        exist_files = _fix_gatk_header(exist_files, out_file, config)
    else:
        exist_files = [x for c, x in exist_files]
    ready_files = run_multicore(p_bgzip_and_index, [[x, config] for x in exist_files], config)
    input_file_list = "%s-files.list" % utils.splitext_plus(out_file)[0]
    with open(input_file_list, "w") as out_handle:
        for fname in ready_files:
            out_handle.write(fname + "\n")
    return input_file_list
338175
def read_files(*files):
    """"""
    text = ""
    for single_file in files:
        content = read(single_file)
        text = text + content + "\n"
    return text
47307
def _load_regions(target):
    """"""
    regions = []
    with open(target) as in_handle:
        for line in in_handle:
            if not line.startswith("#"):
                c, s, e = line.strip().split("\t")
                regions.append((c, s, e))
    return regions
1356530
def init(filename=ConfigPath):
    """"""
    section, parts = "DEFAULT", filename.rsplit(":", 1)
    if len(parts) > 1 and os.path.isfile(parts[0]): filename, section = parts
    if not os.path.isfile(filename): return

    vardict, parser = globals(), configparser.RawConfigParser()
    parser.optionxform = str # Force case-sensitivity on names
    try:
        def parse_value(raw):
            try: return json.loads(raw) # Try to interpret as JSON
            except ValueError: return raw # JSON failed, fall back to raw
        txt = open(filename).read() # Add DEFAULT section if none present
        if not re.search("\\[\\w+\\]", txt): txt = "[DEFAULT]\n" + txt
        parser.readfp(StringIO.StringIO(txt), filename)
        for k, v in parser.items(section): vardict[k] = parse_value(v)
    except Exception:
        logging.warn("Error reading config from %s.", filename, exc_info=True)
1052045
def from_file(cls, path, encoding, dialect, fields, converters, field_index):
        """"""

        return cls(open(path, 'r', encoding=encoding), dialect, fields, converters, field_index)
204094
def from_file(cls, h5_file):
        
        return cls({
            country: HDF5DailyBarReader.from_file(h5_file, country)
            for country in h5_file.keys()
        })
1069368
def poll_open_file_languages(self):
        """"""
        languages = []
        for index in range(self.get_stack_count()):
            languages.append(
                self.tabs.widget(index).language.lower())
        return set(languages)