Parse a v1 module_settings.json file.

        V1 is the older file format that requires a modules dictionary with a
        module_name and modules key that could in theory hold information on
        multiple modules in a single directory.
509395
def _find_v1_settings(self, settings):
        

        if 'module_name' in settings:
            modname = settings['module_name']
        if 'modules' not in settings or len(settings['modules']) == 0:
            raise DataError("No modules defined in module_settings.json file")
        elif len(settings['modules']) > 1:
            raise DataError("Multiple modules defined in module_settings.json file",
                            modules=[x for x in settings['modules']])
        else:
            modname = list(settings['modules'])[0]

        if modname not in settings['modules']:
            raise DataError("Module name does not correspond with an entry in the modules directory",
                            name=modname, modules=[x for x in settings['modules']])

        release_info = self._load_release_info(settings)
        modsettings = settings['modules'][modname]
        architectures = settings.get('architectures', {})

        target_defs = settings.get('module_targets', {})
        targets = target_defs.get(modname, [])

        return TileInfo(modname, modsettings, architectures, targets, release_info)
37892
function (requestV1) {
        if (!requestV1) { return; }
        if (requestV1.headers && _.isEmpty(requestV1.headerData)) {
            // this converts a newline concatenated string of headers to an array, so there are no descriptions
            return v1Common.parseHeaders(requestV1.headers, true);
        }

        // however, if non empty headerData already exists, sanitize it.
        return normalizeEntities(requestV1.headerData, this.options);
    }
1187085
def parse_config_file(config_file_path):
  
  extension = os.path.splitext(config_file_path)[1]
  if extension == '.pyc':
    raise ValueError("Skipping .pyc file as config")
  if extension == '.json':
    with open(config_file_path) as config_file:
      try:
        mapping = json.load(config_file)
      except ValueError as e:
        logger.error("Did not load json configs", e)
        raise SyntaxError('Unable to parse config file:%s due to malformed JSON. Aborting' %(config_file_path))
  elif extension == '.py':
    mapping = {}
    file_dict = load_module(config_file_path)
    for attr_name in dir(file_dict):
      if not (attr_name.startswith('_') or attr_name.startswith('__')):
        attr = getattr(file_dict, attr_name)
        if type(attr) is dict:
          mapping.update(attr)
  else:
    with open(config_file_path) as config_file:
      lines = [line.rstrip() for line in config_file if line.rstrip() != "" and not line.startswith("#")]
      mapping = parse_config_list(lines)

  return mapping
153741
function default_1(opts = {}) {
    return Object.assign({}, ['get', 'head'].reduce((prev, cur) => (prev[cur] = ({ name, meta, url, options }) => request(Object.assign({}, opts, { url, method: cur.toUpperCase(), options })), prev), {}), ['post', 'put', 'patch', 'delete', 'options'].reduce((prev, cur) => (prev[cur] = ({ name, meta, url, body, options, type }) => request(Object.assign({}, opts, { url,
        type,
        options, method: cur.toUpperCase(), data: body })), prev), {}));
}
393968
def version(modfile):
    '''
    
    '''
    import re
    with open(modfile) as fh:
        for line in fh:
            m = re.search(r"^__version__ = '([^']+)'$", line)
            if m:
                return m.group(1)
    raise Exception('No __version__ string found in {fn}'.format(fn=modfile))
68200
def collect_modules(self):
        
        try:
            res = {}
            m = sys.modules
            for k in m:
                # Don't report submodules (e.g. django.x, django.y, django.z)
                # Skip modules that begin with underscore
                if ('.' in k) or k[0] == '_':
                    continue
                if m[k]:
                    try:
                        d = m[k].__dict__
                        if "version" in d and d["version"]:
                            res[k] = self.jsonable(d["version"])
                        elif "__version__" in d and d["__version__"]:
                            res[k] = self.jsonable(d["__version__"])
                        else:
                            res[k] = get_distribution(k).version
                    except DistributionNotFound:
                        pass
                    except Exception:
                        logger.debug("collect_modules: could not process module: %s" % k)

        except Exception:
            logger.debug("collect_modules", exc_info=True)
        else:
            return res
749230
private function cleanModuleJsonFile()
    {
        $path = $this->module->getModulePath($this->getName()) . 'module.json';

        $content = $this->filesystem->get($path);
        $namespace = $this->getModuleNamespaceReplacement();
        $studlyName = $this->getStudlyNameReplacement();

        $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"';

        $content = str_replace($provider, '', $content);

        $this->filesystem->put($path, $content);
    }
1372475
function determineWMSTitle(json, version) {
	var ret = '';

	if (version == '1.3.0') {
		if (json.WMS_Capabilities.Service) {
			if (json.WMS_Capabilities.Service[0]) {
				if (json.WMS_Capabilities.Service[0].Title) {
					if (json.WMS_Capabilities.Service[0].Title[0]) {
						ret = json.WMS_Capabilities.Service[0].Title[0];
					}
				}
			}
		}
	} else {
		if (version == '1.1.1' || version == '1.1.0' || version == '1.0.0') {
			if (json.WMT_MS_Capabilities.Service) {
				if (json.WMT_MS_Capabilities.Service[0]) {
					if (json.WMT_MS_Capabilities.Service[0].Title) {
						if (json.WMT_MS_Capabilities.Service[0].Title[0]) {
							ret = json.WMT_MS_Capabilities.Service[0].Title[0];
						}
					}
				}
			}
		}
	}

	return ret;
}
911130
function determineVersion(json) {
	var version = 'unknown';
	if (json) {
		if (json.WMS_Capabilities) {
			if (json.WMS_Capabilities.$) {
				if (json.WMS_Capabilities.$.version) {
					version = json.WMS_Capabilities.$.version;
				}
			}
		} else {
			if (json.WMT_MS_Capabilities) {
				if (json.WMT_MS_Capabilities.$) {
					if (json.WMT_MS_Capabilities.$.version) {
						version = json.WMT_MS_Capabilities.$.version;
					}
				}
			}
		}
	}
	return version;
}
1205318
def get_version(module):
    
    init_py = open('{0}.py'.format(module)).read()
    return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
542061
function parse(src, module, makeModule, options) {
		// Find the first valid parser :
		debug('Find a parser for :', module.path)
		var result = _.find(parsers, function(def) {
			// debug('    Check parser match :', def.match)
			if(def.match instanceof RegExp) {
				return def.match.test(module.path);
			} else if ('string'   == typeof def.match) {
				return minimatch(module.path, def.match);
			} else if ('function' == typeof def.match) {
				return def.match(src, module, makeModule, options);
			} else {
				return false;
			}
		});
		if(!result) {
			debug('Warning: No valid parser found for %s. Json string is exported', module.path)
			return 'module.exports = ' + JSON.stringify(src);
		} else {
			debug('Ok parser match :', result.match);
			return result.parse(src, module, makeModule, options);
		}
	}
960805
def parse(file_path):
    ''''''

    _, ext = path.splitext(file_path)

    if ext in ('.yaml', '.yml'):
        func = yaml.load

    elif ext == '.json':
        func = json.load

    else:
        raise ValueError("Unrecognized config file type %s" % ext)

    with open(file_path, 'r') as f:
        return func(f)
695085
function (file)
		{
			if (!_.isString(file))
				return false;

			var file = file+'';
			this.e.log&&this.e.log('Loading module configuration from file: '+file,'system');
			if (fs.statSync(file).isFile() && path.extname(file) == '.json')
			{
				var _data = (fs.readFileSync(file,'utf8').toString())
							.replace(/\\/g,function () { return "\\"+arguments[0]; })
							.replace(/\/\/.+?(?=\n|\r|$)|\/\*[\s\S]+?\*\//g,'');
				if(_data = JSON.parse(_data))
				{
					this.setConfig(_data,true);
					return true;
				}
			}
			return false;
		
		}
1015047
def version(rest):
	""
	pkg = rest.strip() or 'pmxbot'
	if pkg.lower() == 'python':
		return sys.version.split()[0]
	return importlib_metadata.version(pkg)
677512
def getJsonPath(name, moduleFile):
    
    currentFolder = os.getcwd()
    currentJsonPath = os.path.join(currentFolder, name)
    if os.path.isfile(currentJsonPath):
        return currentJsonPath
    else:
        moduleFolder = os.path.abspath(os.path.dirname(moduleFile))
        moduleJsonPath = os.path.join(moduleFolder, '.', name)
        return moduleJsonPath
1353365
def parse(self):
        
        try:
            data = json.loads(self.obj.content, object_pairs_hook=OrderedDict)
            if data:
                for package_type in ['default', 'develop']:
                    if package_type in data:
                        for name, meta in data[package_type].items():
                            # skip VCS dependencies
                            if 'version' not in meta:
                                continue
                            specs = meta['version']
                            hashes = meta['hashes']
                            self.obj.dependencies.append(
                                Dependency(
                                    name=name, specs=SpecifierSet(specs),
                                    dependency_type=filetypes.pipfile_lock,
                                    hashes=hashes,
                                    line=''.join([name, specs]),
                                    section=package_type
                                )
                            )
        except ValueError:
            pass
820381
function getVersionInfo(machineName, versionKey) {
        let route = getVersionInfoRoute(machineName, versionKey);
        return jsonfile.readFileSync(repositoryPath + "/" + route);
    }