{ "Type": "<driver_name>", "Config": {"key1": "val1"}}
970126
def log_config(self, value):
        
        if not isinstance(value, dict):
            raise TypeError("log_config must be a dict. {0} was passed".format(value))

        config      = value.get('config')
        driver_type = value.get('type')

        if driver_type not in VALID_LOG_DRIVER_TYPES:
            raise ValueError("type must be one of the support drivers {0}".format(", ".join(VALID_LOG_DRIVER_TYPES)))

        if config and not isinstance(config, dict):
            raise ValueError("log_config.config must be a dict.")

        if driver_type == 'syslog':
            config = {
                'syslog-facility': config.get('syslog_facility', config.get('syslog-facility')),
                'syslog-tag': config.get('syslog_tag', config.get('syslog-tag'))
            }

        self._log_config = {'type': driver_type, 'config': config or {}}
332813
def set_(key, value, profile=None):
    '''
    
    '''
    if not profile:
        return False
    redis_kwargs = profile.copy()
    redis_kwargs.pop('driver')
    redis_conn = redis.StrictRedis(**redis_kwargs)
    return redis_conn.set(key, value)
1125816
def to_json_format(conf):
    ''''''
    if 'fmode' in conf:
        conf['fmode'] = oct(conf['fmode'])[-3:]
    if 'dmode' in conf:
        conf['dmode'] = oct(conf['dmode'])[-3:]
448197
function getKey(obj, key, fn) {
  if (typeof obj === 'object') return fn(null, obj[key]);
  if (typeof obj === 'undefined') return fn(null, {});
  if (typeof obj !== 'function') return fn(new Error('cannot read conf:\n' + obj));
  if (obj.length === 2) return obj(key, fn);
  var val;
  try {
    val = obj(key);
  } catch(err) {
    return fn(err);
  }
  fn(null, val);
}
1141021
function(me) {
        var results = {
            'deviceType': me.deviceType,
            'deviceTypeNum': me.devType,
            'connectionType': me.connectionType,
            'connectionTypeNum': me.connType,
        };

        // Parse the successfully opened devices.
        var numOpened = me.numOpened.deref();
        var handles = [];
        for(var i = 0; i < numOpened; i++) {
            var handle = me.aHandles.readInt32LE(i * ARCH_INT_NUM_BYTES);
            handles.push(handle);
        }
        results.numOpened = numOpened;
        results.handles = handles;

        // Parse the errors...
        var numErrors = me.numErrors.deref();
        var failedOpens = [];
        results.numErrors = numErrors;
        results.failedOpens = failedOpens;

        // Parse the errorHandle
        var errorHandle = me.errorHandle.readInt32LE(0);

        // Read the errors string
        var pointerToCharStar = ref.readPointer(me.errors, 0, ARCH_POINTER_SIZE);
        var parsedCharStar = ref.readCString(pointerToCharStar, 0);
        var errorsString = parsedCharStar;
        var errorsObj = {};
        try {
            errorsObj = JSON.parse(errorsString);
        } catch(err) {
            errorsObj = {
                'exceptions': [],
                'networkInterfaces': [],
                'returnedDevices': [],
                'specificIPs': [],
            };
        }

        // console.log('Parsed Data', errorHandle, errorsObj);
        // Save the errors to the results.
        results.errorHandle = errorHandle;
        results.errors = errorsObj;

        return results;
    }
1258770
def config(self) -> dict:
        """"""
        # Check that the key exists
        self._check_object_exists()
        config_dict = DB.get_hash_dict(self.key)
        for _, value in config_dict.items():
            for char in ['[', '{']:
                if char in value:
                    value = ast.literal_eval(value)
        return config_dict
871363
def get_key(cls, key):
        ""
        return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None))
1348785
private JSONObject getConfiguration() throws JSONException {
    JSONObject configuration = new JSONObject();

    configuration.put("port", config.getPort());
    configuration.put("register", true);

    if (config.getProxy() != null) {
      configuration.put("proxy", config.getProxy());
    } else {
      configuration.put("proxy", "org.openqa.grid.selenium.proxy.DefaultRemoteProxy");
    }
    configuration.put("role", "node");
    configuration.put("registerCycle", config.getRegisterCycle());
    if (config.getMaxSession() == 0) {
      configuration.put("maxSession", driver.getSupportedDevices().length());
    } else {
      configuration.put("maxSession", config.getMaxSession());
    }
    configuration.put("browserTimeout", config.getSessionTimeoutMillis() / 1000);
    configuration.put("cleanupCycle", config.getCleanupCycle());
    configuration.put("timeout", config.getTimeout());
    configuration.put("nodePolling", config.getNodePolling());
    configuration.put("unregisterIfStillDownAfter", config.getUnregisterIfStillDownAfter());
    configuration.put("downPollingLimit", config.getDownPollingLimit());
    configuration.put("nodeStatusCheckTimeout", config.getNodeStatusCheckTimeout());

    // adding hub details
    configuration.put("hubHost", hub.getHost());
    configuration.put("hubPort", hub.getPort());

    // adding driver details
    configuration.put("seleniumProtocol", "WebDriver");
    configuration.put("host", config.getServerHost());
    configuration.put("remoteHost", "http://" + config.getServerHost() + ":" + config.getPort());
    return configuration;
  }
67684
private void writeDriverJsonInformation(final HttpServletResponse response) throws IOException {

    LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverJsonInformation invoked.");

    try {
      final DriverInfoSerializer serializer =
          Tang.Factory.getTang().newInjector().getInstance(DriverInfoSerializer.class);
      final AvroDriverInfo driverInfo = serializer.toAvro(
          this.reefStateManager.getDriverEndpointIdentifier(), this.reefStateManager.getStartTime(),
          this.reefStateManager.getServicesInfo());
      writeResponse(response, serializer.toString(driverInfo));
    } catch (final InjectionException e) {
      LOG.log(Level.SEVERE, "Error in injecting DriverInfoSerializer.", e);
      writeResponse(response, "Error in injecting DriverInfoSerializer: " + e);
    }
  }
1334675
def set_key(key: str, value: str) -> dict:
    
    if not _conf.path:
        return {}

    if "toml" in _conf.path:
        with open(_conf.path, "r") as f:
            parser = parse(f.read())
        parser["tool"]["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            f.write(parser.as_string())
    else:
        parser = configparser.ConfigParser()
        parser.read(_conf.path)
        parser["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            parser.write(f)

    return _conf.config
669973
function(type, driverName)
        {
            var d, i;
            driverName = (driverName? driverName : _self.defaultDriver).toLowerCase();

            if(driverName in _drivers[type])
            {
                d = _drivers[type][driverName];
                i = new d();
                i.driverName = driverName;
                return i;
            }
            throw 'Driver ' + name + ' not found';
        }
261718
def _to_key(d):
        """"""
        as_str = json.dumps(d, sort_keys=True)
        return as_str.replace('"{{', '{{').replace('}}"', '}}')
144777
JsonObject toDockerPortBindingsJson() {
        Map<String, Integer> portMap = getContainerPortToHostPortMap();
        if (!portMap.isEmpty()) {
            JsonObject portBindings = new JsonObject();
            Map<String, String> bindToMap = getBindToHostMap();

            for (Map.Entry<String, Integer> entry : portMap.entrySet()) {
                String containerPortSpec = entry.getKey();
                Integer hostPort = entry.getValue();

                JsonObject o = new JsonObject();
                o.addProperty("HostPort", hostPort != null ? hostPort.toString() : "");

                if (bindToMap.containsKey(containerPortSpec)) {
                    o.addProperty("HostIp", bindToMap.get(containerPortSpec));
                }

                JsonArray array = new JsonArray();
                array.add(o);

                portBindings.add(containerPortSpec, array);
            }
            return portBindings;
        } else {
            return null;
        }
    }
1061026
function checkKeyCodes (
  eventKeyCode,
  key,
  builtInAlias
) {
  var keyCodes = config.keyCodes[key] || builtInAlias;
  if (Array.isArray(keyCodes)) {
    return keyCodes.indexOf(eventKeyCode) === -1
  } else {
    return keyCodes !== eventKeyCode
  }
}
1271406
function getDriver(name) {
  if (!this.drivers[name]) {
    log.error(new Error('Driver "' + name + '" is not registered.'));
    return null;
  }
  return this.drivers[name];
}
715899
def get_authentication_mdata():
    """"""
    return {
        'agent': {
            'element_label': {
                'text': 'agent',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
1060362
def parse_config(config, key, options):
        """"""
        conf = {}
        for source, destination, opt_type in options:
            opt_value = _get_opt(config, key, source, opt_type)
            if opt_value is not None:
                _set_opt(conf, destination, opt_value)
        return conf