Gets the configuration file either from the repository or the default.
979178
def get_config(repo_root):
    """"""
    config = os.path.join(os.path.dirname(__file__), 'configs', 'config.yaml')

    if repo_root:
        repo_config = os.path.join(repo_root, '.gitlint.yaml')
        if os.path.exists(repo_config):
            config = repo_config

    with open(config) as f:
        # We have to read the content first as yaml hangs up when reading from
        # MockOpen
        content = f.read()
        # Yaml.load will return None when the input is empty.
        if not content:
            yaml_config = {}
        else:
            yaml_config = yaml.load(content)

    return linters.parse_yaml_config(yaml_config, repo_root)
999276
def get_repository_configuration(id):
    

    response = utils.checked_api_call(pnc_api.repositories, 'get_specific', id=id)
    if response:
        return response.content
567604
def find_config_file(self, project=None, extension='.conf'):
        
        cfg_dirs = self._get_config_dirs()
        config_files = self._search_dirs(cfg_dirs, project, extension)

        return config_files
25625
def getInstalledConfig(installDir, configFile):
    
    configPath = os.path.join(installDir, configFile)
    if not os.path.exists(configPath):
        raise FileNotFoundError("No file found at location {}".
                                format(configPath))
    spec = spec_from_file_location(configFile, configPath)
    config = module_from_spec(spec)
    spec.loader.exec_module(config)
    return config
1156543
def get_project_configuration():
    """"""
    home = os.path.expanduser("~")
    rcfile = os.path.join(home, ".hwrtrc")
    if not os.path.isfile(rcfile):
        create_project_configuration(rcfile)
    with open(rcfile, 'r') as ymlfile:
        cfg = yaml.load(ymlfile)
    return cfg
485395
def defaultFile(self):
        """"""
        filename = self.curframe.f_code.co_filename
        if filename == '<string>' and self.mainpyfile:
            filename = self.mainpyfile
        return filename
547045
def config(self):
        '''  '''
        if self.__config is None:
            config_path = self.locate_config()
            if config_path:
                self.__config = self.read_file(config_path)
                self.__config_path = config_path
        return self.__config
1288345
function getDefaultConfigPath () {
  let filePath
  let i
  let k

  for (k = 0; k < DEFAULT_CONFIG_DIRS.length; k++) {
    for (i = 0; i < SUPPORTED_EXTENSIONS.length; i++) {
      filePath = DEFAULT_CONFIG_DIRS[k] + SUPPORTED_EXTENSIONS[i]
      if (fileUtils.fileExistsSync(filePath)) {
        return filePath
      }
    }
  }

  throw new Error('No config file found')
}
671969
def get_config_file():
    
    import os
    from os.path import abspath, expanduser, join, exists

    __lib_name = get_library_name()

    assert __lib_name in ["sframe", "turicreate"]

    __default_config_path = join(expanduser("~"), ".%s" % __lib_name, "config")

    if "TURI_CONFIG_FILE" in os.environ:
        __default_config_path = abspath(expanduser(os.environ["TURI_CONFIG_FILE"]))

        if not exists(__default_config_path):
            print(("WARNING: Config file specified in environment variable "
                   "'TURI_CONFIG_FILE' as "
                   "'%s', but this path does not exist.") % __default_config_path)

    return __default_config_path
44469
def get_config():
    
    if session.config is None:
        path = session.default_config_path
        if os.path.isfile(path):
            logging.info("LOADING FROM: {}".format(path))
            session.config = load_config(path)
        else:
            session.config = Config()
            logging.info("using default session: {}, path does not exist: {}".format(session, path))
    else:
        logging.info("Using pre-loaded object: {}".format(session.config))
    return session.config
1165792
def get_config(self):
        
        if not self._config:
            namespace = {}
            if os.path.exists(self.config_path):
                execfile(self.config_path, namespace)
            self._config = namespace.get('config') or Configuration()
        return self._config
574475
def get_config():
    
    configpath = get_configpath()
    if not configpath.exists():
        raise IOError("Config file {} not found.".format(str(configpath)))
    else:
        config = configparser.ConfigParser()
        config.read(str(configpath))
        return config
243761
def get_config(item, default=None):
    
    import giotto
    return getattr(giotto._config, item, default) or default
739154
def get_config(self, configfile):
        
        with open(configfile) as config_file:
            config = json.load(config_file)
        return config
483272
def get_config(ini_path=None, rootdir=None):
    
    config = Namespace()
    config.default_section = 'pylama'

    if not ini_path:
        path = get_default_config_file(rootdir)
        if path:
            config.read(path)
    else:
        config.read(ini_path)

    return config
255894
def get_config(self, ):
        
        # get the module of the plugin class
        mod = sys.modules[self.__module__]
        # get the file from where it was imported
        modfile = mod.__file__
        # get the module directory
        specdir = os.path.dirname(modfile)
        # get the classname
        cname = self.__class__.__name__
        # add the extension
        confname = os.extsep.join((cname, CONFIG_EXT))

        specpath = os.path.join(specdir, confname)
        if not os.path.exists(specpath):
            return None
        confpath = os.path.join(PLUGIN_CONFIG_DIR, confname)
        return load_config(confpath, specpath)
706646
def get_configuration(config_file=None):
    
    parser = configparser.ConfigParser()
    if config_file is None:
        # fallback to default user config file
        config_file = os.path.join(os.getenv("HOME"), DEFAULT_USER_INI)
        if not os.path.isfile(config_file):
            config_file = None
    else:
        if not os.path.isfile(config_file):
            raise ValueError("%s is not a file" % config_file)

    configs = [get_filename(PRESETS_INI)]
    if config_file:
        configs.append(config_file)
    LOG.debug("Attempting to read configuration from %r", configs)
    read_configs = parser.read(configs)
    LOG.debug("Successfully read configuration from %r", read_configs)
    LOG.debug("config file sections: %r", parser.sections())
    return parser