获取 preset 信息

@param {string} presetName preset name
@returns {null|PresetInfo} 结果
772799
function getPresetInfo () {
  const presetName = tryRequire(/elint-preset-/)[0]

  debug(`preset name: ${presetName}`)

  if (!presetName) {
    return null
  }

  const presetInfo = getInfoFromPackageLock(presetName) || getInfoFromNodeModules(presetName)

  debug('preset info: %o', presetInfo)

  // 数据不全
  if (!presetInfo || !presetInfo.name || !presetInfo.version || !presetInfo.registryUrl) {
    return null
  }

  return presetInfo
}
601440
public GetPresetResponse getPreset(GetPresetRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getPresetName(), "The parameter presetName should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PRESET, request.getPresetName());

        return invokeHttpClient(internalRequest, GetPresetResponse.class);
    }
355948
function (name) {
            var self = this, dot = '.', path, attrVals = getAttrVals(self), attrConfig, getter, ret;
            if (name.indexOf(dot) !== -1) {
                path = name.split(dot);
                name = path.shift();
            }
            attrConfig = ensureNonEmpty(self.getAttrs(), name, 1);
            getter = attrConfig.getter;    // get user-set value or default value
                                           //user-set value takes privilege
            // get user-set value or default value
            //user-set value takes privilege
            ret = name in attrVals ? attrVals[name] : getDefAttrVal(self, name);    // invoke getter for this attribute
            // invoke getter for this attribute
            if (getter && (getter = normalFn(self, getter))) {
                ret = getter.call(self, ret, name);
            }
            if (!(name in attrVals) && ret !== undefined) {
                attrVals[name] = ret;
            }
            if (path) {
                ret = getValueByPath(ret, path);
            }
            return ret;
        }
1031006
function getConfigElement(name) {
    checkIsString('name', name);
    if (config.has(name)) {
        return config.get(name);
    }
}
1166704
async def check_presets(cls):
        '''
        
        '''
        rqst = Request(cls.session, 'POST', '/resource/check-presets')
        async with rqst.fetch() as resp:
           return await resp.json()
607244
function () {
    var str = '{';
    for (var i in this.schema){
      if (i == 'preset') continue;
      str += i + ': ';
      var type = this.schema[i].type;
      if (type == 'vec3') {
        str += '{ x: ' + this.data[i].x + ', y: ' + this.data[i].y + ', z: ' + this.data[i].z + '}';
      }
      else if (type == 'string' || type == 'color') {
        str += '"' + this.data[i] + '"';
      }
      else {
        str += this.data[i];
      }
      str += ', ';
    }
    str += '}';
    console.log(str);
  }
466957
function processOptions(options) {
  // Parse preset names
  const presets = (options.presets || []).map(presetName => {
    if (typeof presetName === 'string') {
      var preset = availablePresets[presetName];
      if (!preset) {
        throw new Error(`Invalid preset specified in Babel options: "${presetName}"`);
      }
      return preset;
    } else {
      // Could be an actual preset module
      return presetName;
    }
  });

  // Parse plugin names
  const plugins = (options.plugins || []).map(pluginName => {
    if (typeof pluginName === 'string') {
      var plugin = availablePlugins[pluginName];
      if (!plugin) {
        throw new Error(`Invalid plugin specified in Babel options: "${pluginName}"`);
      }
      return plugin;
    } else {
      // Could be an actual plugin module
      return pluginName;
    }
  });

  return {
    ...options,
    presets,
    plugins,
  }
}
841810
def preset(name):
    
    def decorator(func):
        registry.register_preset(func, name)
        return func
    return decorator
587772
function getInfoFromPackageLock (presetName) {
  debug('get preset info from package-lock.json')

  const baseDir = getBaseDir()
  const lockPath = path.join(baseDir, 'package-lock.json')

  if (!fs.existsSync(lockPath)) {
    debug('package-lock.json not exist')
    return null
  }

  debug(`package-lock.json path: ${lockPath}`)

  const lockInfo = _.get(require(lockPath), `dependencies.${presetName}`)

  debug('lock info: %o', lockInfo)

  if (!lockInfo) {
    return null
  }

  return {
    name: presetName,
    version: lockInfo.version,
    registryUrl: getRegistryUrl(lockInfo.resolved)
  }
}
384769
public T setSubtitlePreset(String preset) {
    this.subtitle_enabled = true;
    this.subtitle_preset = checkNotEmpty(preset, "subtitle preset must not be empty");
    return getThis();
  }
880233
function(name, value) {
			var prefs = name;
			if (typeof name === 'string') {
				prefs = {};
				prefs[name] = value;
			}
			
			Object.keys(prefs).forEach(function(k) {
				var v = prefs[k];
				if (!(k in defaults)) {
					throw new Error('Property "' + k + '" is not defined. You should define it first with `define` method of current module');
				}
				
				// do not set value if it equals to default value
				if (v !== defaults[k].value) {
					// make sure we have value of correct type
					switch (typeof defaults[k].value) {
						case 'boolean':
							v = toBoolean(v);
							break;
						case 'number':
							v = parseInt(v + '', 10) || 0;
							break;
						default: // convert to string
							if (v !== null) {
								v += '';
							}
					}

					preferences[k] = v;
				} else if (k in preferences) {
					delete preferences[k];
				}
			});
		}
16598
def use_plugin_preset(self, preset):
        
        if isinstance(preset, str):
            try:
                preset = self._presets[preset]
            except (AttributeError, KeyError):
                raise AngrNoPluginError("There is no preset named %s" % preset)

        elif not isinstance(preset, PluginPreset):
            raise ValueError("Argument must be an instance of PluginPreset: %s" % preset)

        if self._active_preset:
            l.warning("Overriding active preset %s with %s", self._active_preset, preset)
            self.discard_plugin_preset()

        preset.activate(self)
        self._active_preset = preset
808869
function(inst, name) {
		return inst.settings[name] !== undefined ?
			inst.settings[name] : this._defaults[name];
	}
240285
function (settings) {
    this.key = settings && settings.key;
    this.userId = settings && settings.userId;
    this.username = settings && settings.username;
    return this;
  }
230862
function applyPresets(scope, defaults, presets) {
        if (!scope || !presets) { return; }

        // presets come from either scope (i.e. passed in directly) or get from the ui part presets
        var opts = scope.presets || (scope.item && scope.item.type && presets[scope.item.type]) || presets[scope.preset] ||
            (scope.preset && presets[scope.type + '.' + scope.preset]) || presets[scope.type];
        if (!opts) { return; }

        for (var name in opts) {
            if (opts.hasOwnProperty(name)) {
                if (!defaults || defaults[name] === undefined) {
                    throw new Error('No defaults value for ' + name + ' but in options.' + scope.preset);
                }
                else {
                    scope[name] = opts[name];
                }
            }
        }
    }
114247
function getPresetsString(presetArray) {
  if (!presetArray.includes("react-app")) {
    presetArray.push("react-app");
  }
  return presetArray.map(attachRequestResolve("preset")).join(",");
}
1296619
function getPropInfo (name, prop) {
  if (!prop) {
    return null;
  }

  var hasProps = 'properties' in prop;

  var valueType = 'type' in prop ? 'type' :
                  'arrayType' in prop ? 'arrayType' :
                  'keyType' in prop ? 'keyType' :
                  hasProps ? 'type' :
                  null;

  var type = hasProps ? Object : prop[valueType];

  if (!type) {
    return null;
  }

  var description = prop.description;
  if (typeof description === 'string') {
    description = description.split(EOL);
  }

  var info = {
    name: name,
    type: type,
    hasProps: hasProps,
    valueType: valueType,
    valueTypeText: VALUE_TYPE_TEXT[valueType],
    description: description || []
  };

  Object.keys(prop).reduce(function(x, key){
    if (!~SKIP_COPY.indexOf(key)) {
      x[key] = prop[key];
    }
    return x;
  }, info);

  return info;
}