Return initialized fetcher capable of processing given conf.
422472
def fetcher_factory(conf):
    """"""
    global PROMOTERS
    applicable = []
    if not PROMOTERS:
        PROMOTERS = load_promoters()
    for promoter in PROMOTERS:
        if promoter.is_applicable(conf):
            applicable.append((promoter.PRIORITY, promoter))
    if applicable:
        best_match = sorted(applicable, reverse=True)[0][1]
        return best_match(conf)
    else:
        raise ConfigurationError(
            'No fetcher is applicable for "{0}"'.format(conf['name'])
        )
248288
def fetch(cls, id, service=None, endpoint=None, *args, **kwargs):
        """"""
        if service is None and endpoint is None:
            raise InvalidArguments(service, endpoint)

        if endpoint is None:
            sid = service['id'] if isinstance(service, Entity) else service
            endpoint = 'services/{0}/integrations'.format(sid)

        return getattr(Entity, 'fetch').__func__(cls, id, endpoint=endpoint,
                                                 *args, **kwargs)
1306217
def _get_initial_returning(self):
        

        hooker = None
        if self.is_syscall:
            hooker = self.project.simos.syscall_from_addr(self.addr)
        elif self.is_simprocedure:
            hooker = self.project.hooked_by(self.addr)
        if hooker and hasattr(hooker, 'NO_RET'):
            return not hooker.NO_RET

        # Cannot determine
        return None
1347674
def usingCurl():
    """"""
    fetcher = getDefaultFetcher()
    if isinstance(fetcher, ExceptionWrappingFetcher):
        fetcher = fetcher.fetcher
    return isinstance(fetcher, CurlHTTPFetcher)
1049326
def fetch(url, body=None, headers=None):
    
    fetcher = getDefaultFetcher()
    return fetcher.fetch(url, body, headers)
221777
def _fetch(self):
        """"""
        if 'uri' in self._meta_data:
            error = "There was an attempt to assign a new uri to this "\
                    "resource, the _meta_data['uri'] is %s and it should"\
                    " not be changed." % (self._meta_data['uri'])
            raise URICreationCollision(error)
        # Make convenience variable with short names for this method.
        _create_uri = self._meta_data['container']._meta_data['uri']
        session = self._meta_data['bigip']._meta_data['icr_session']
        # Invoke the REST operation on the device.
        response = session.post(_create_uri, json={})
        # Make new instance of self
        return self._produce_instance(response)
908497
def fetch(name)
      name = name.to_sym

      if @seen.include?(name)
        path = [*@seen, name].join(' -> ')
        raise Wireless::CycleError, "cycle detected: #{path}"
      end

      unless (resolver = @registry[name])
        raise Wireless::KeyError.new(
          "dependency not found: #{name}",
          key: name,
          receiver: self
        )
      end

      fetcher = lambda do
        seen = @seen.dup
        seen.add(name)
        Fetcher.new(registry: @registry, seen: seen)
      end

      resolver.resolve(fetcher)
    end
280784
def get_preparer(mixed: Union[SQLCompiler, Engine,
                              Dialect]) -> IdentifierPreparer:
    
    dialect = get_dialect(mixed)
    # noinspection PyUnresolvedReferences
    return dialect.preparer(dialect)
681782
public static String jpaFetch(PackageImportAdder adder, FetchTypeGetter... fetchTypeGetters) {
        Assert.notNull(adder);

        if (fetchTypeGetters == null) {
            return "";
        }

        // we look for the first non empty conf.
        // not that it could be a NONE conf => user does not want any fetch type.

        for (FetchTypeGetter fetchTypeGetter : fetchTypeGetters) {
            if (fetchTypeGetter != null) {
                if (fetchTypeGetter.getFetch() != null) {
                    if (fetchTypeGetter.getFetch().isJpaType()) {
                        FetchType fetchType = fetchTypeGetter.getFetch().asJpaType();
                        adder.addImport("static javax.persistence.FetchType." + fetchType.name());
                        return "fetch = " + fetchType.name();
                    } else { // NONE
                        return ""; // user explicitly said he does not want any fetch type.
                    }
                }
            }
        }

        return "";
    }
1229873
def get_config(path=os.getcwd()):
    """"""
    config = default
    tries = 0
    current_dir = path
    while current_dir and tries < MAX_CONFIG_SEARCH_DEPTH:
        potential_path = os.path.join(current_dir, ".fonduer-config.yaml")
        if os.path.exists(potential_path):
            with open(potential_path, "r") as f:
                config = _merge(config, yaml.safe_load(f))
            logger.debug(f"Loading Fonduer config from {potential_path}.")
            break

        new_dir = os.path.split(current_dir)[0]
        if current_dir == new_dir:
            logger.debug("Unable to find config file. Using defaults.")
            break
        current_dir = new_dir
        tries += 1

    return config
934955
def getConf(self, conftype):
        '''
        
        '''
        zooconf={}
        if conftype not in [ZooConst.CLIENT, ZooConst.WORKER, ZooConst.BROKER]:
            raise Exception('Zooborg.getConf: invalid type')

        self.initconn()
        if conftype in [ZooConst.CLIENT, ZooConst.WORKER]:
            zooconf={'broker': {'connectionstr': None}}
            zoopath='/distark/' + conftype + '/conf/broker/connectionstr'
            zooconf['broker']['connectionstr'], stat = self.zk.get(zoopath)

        if conftype in [ZooConst.BROKER]:
            zooconf={'bindstr': None}
            zoopath='/distark/' + conftype + '/conf/bindstr'
            zooconf['bindstr'], stat = self.zk.get(zoopath)

        return zooconf
552325
def fetch(self, R, pk, depth=1):
        ""
        d, e = self._fetcher.fetch(R, pk, depth)
        if e: raise e
        return d
191072
def getOrCreate(cls, conf=None):
        
        with SparkContext._lock:
            if SparkContext._active_spark_context is None:
                SparkContext(conf=conf or SparkConf())
            return SparkContext._active_spark_context
513270
def _init_net_specs(conf):
        
        for net_name, net_spec in conf.get('nets', {}).items():
            net_spec['name'] = net_name
            net_spec['mapping'] = {}
            net_spec.setdefault('type', 'nat')

        return conf
407402
def from_config(cls, config, prefix='depot.'):
        
        config = config or {}

        # Get preferred storage backend
        backend = config.get(prefix + 'backend', 'depot.io.local.LocalFileStorage')

        # Get all options
        prefixlen = len(prefix)
        options = dict((k[prefixlen:], config[k]) for k in config.keys() if k.startswith(prefix))

        # Backend is already passed as a positional argument
        options.pop('backend', None)
        return cls._new(backend, **options)
183251
def _get(self, name, interval, config, timestamp, **kws):
    '''
    
    '''
    i_bucket, r_bucket, i_key, r_key = self._calc_keys(config, name, timestamp)
    fetch = kws.get('fetch') or self._type_get
    process_row = kws.get('process_row') or self._process_row

    rval = OrderedDict()
    if config['coarse']:
      data = process_row( fetch(self._client, i_key) )
      rval[ config['i_calc'].from_bucket(i_bucket) ] = data
    else:
      # First fetch all of the resolution buckets for this set.
      resolution_buckets = sorted(map(int,self._client.smembers(i_key)))

      # Create a pipe and go fetch all the data for each.
      # TODO: turn off transactions here?
      pipe = self._client.pipeline(transaction=False)
      for bucket in resolution_buckets:
        r_key = '%s:%s'%(i_key, bucket)   # TODO: make this the "resolution_bucket" closure?
        fetch(pipe, r_key)
      res = pipe.execute()

      for idx,data in enumerate(res):
        data = process_row(data)
        rval[ config['r_calc'].from_bucket(resolution_buckets[idx]) ] = data

    return rval
995405
def gatherInput(**Config):
  
  """
  _type = Config.get('type')

  while True:
    try:
      got = raw_input('%s: ' % getLabel(Config))

    except EOFError:
      got = None

    if not got and 'default' in Config:
      return Config['default']

    try:
      return _type(got) if _type else got

    except ValueError as e:
      err(str(e) or '<invalid value>')

    except TypeError:
      err(str(e) or '<invalid value>')