Maps xml configs to their respective key names
in the file config.materialized_JSON
761950
public String xmlToThrift(String name) {
    name = name.replace("-custom.xml", "");
    name = name.replace(".xml", "");
    name = name.replace("-", "_");
    return name;
  }
593731
private List<CmsMetaMapping> parseMetaMappings(I_CmsXmlContentLocation formatterLoc) {

        List<CmsMetaMapping> mappings = new ArrayList<CmsMetaMapping>();
        for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_META_MAPPING)) {
            String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY));
            String element = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ELEMENT));
            String defaultValue = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_DEFAULT));
            String orderStr = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ORDER));
            int order = 1000;
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(orderStr)) {
                try {
                    order = Integer.parseInt(orderStr);
                } catch (NumberFormatException e) {
                    // nothing to do
                }
            }
            CmsMetaMapping mapping = new CmsMetaMapping(key, element, order, defaultValue);
            mappings.add(mapping);
        }
        return mappings;
    }
841995
def setConfigKey(key, value):
		
		configFile = ConfigurationManager._configFile()
		return JsonDataManager(configFile).setKey(key, value)
111949
function expandMapping(config, options) {
  var len = config.files.length, i = -1;
  var res = [];

  while (++i < len) {
    var raw = config.files[i];
    var node = new RawNode(raw, config, this);
    this.emit('files', 'rawNode', node);
    this.emit('rawNode', node);
    if (node.files.length) {
      res.push.apply(res, node.files);
    }
  }
  config.files = res;
  return config;
}
226695
def as_json_partial(options = {})
      options ||= {}
      if options[:properties] && !all_json_properties.member?(options[:properties])
        fail ArgumentError.new("Unknown properties option: #{options[:properties]}")
      end
      # partial, unmaterialized JSON
      keys, partial_json = self.class.materialize_json({
        properties: :short, is_top_level_json: true, version: Mongoid::CachedJson.config.default_version
      }.merge(options), object: self)
      [keys, partial_json]
    end
275570
def schema_digest(self) -> str:
        
        res = self.schema._node_digest()
        res["config"] = True
        return json.dumps(res)
967997
private static Dictionary<String, Object> massageNewConfig(Dictionary<String, Object> oldProps, Dictionary<String, Object> newProps) {
        ConfigurationDictionary ret = new ConfigurationDictionary();

        if (oldProps != null) {
            for (Enumeration<String> keyItr = oldProps.keys(); keyItr.hasMoreElements();) {
                String key = keyItr.nextElement();
                if (((key.startsWith(XMLConfigConstants.CFG_CONFIG_PREFIX) && !(key.equals(XMLConfigConstants.CFG_PARENT_PID)))
                     || key.startsWith(XMLConfigConstants.CFG_SERVICE_PREFIX))) {
                    ret.put(key, oldProps.get(key));
                }

            }
        }

        if (newProps != null) {
            for (Enumeration<String> keyItr = newProps.keys(); keyItr.hasMoreElements();) {
                String key = keyItr.nextElement();
                ret.put(key, newProps.get(key));
            }
        }

        if (ret.isEmpty()) {
            ret = null;
        } else {
            // must add config.source, else things may not process properly
            ret.put(XMLConfigConstants.CFG_CONFIG_SOURCE, XMLConfigConstants.CFG_CONFIG_SOURCE_FILE);
        }
        return ret;
    }
736808
def get_configuration_dict(self, secret_attrs=False):
        """"""
        cd = {'repo_nexml2json': self.repo_nexml2json,
              'number_of_shards': len(self._shards),
              'initialization': self._filepath_args,
              'shards': [],
              }
        for i in self._shards:
            cd['shards'].append(i.get_configuration_dict(secret_attrs=secret_attrs))
        return cd
735446
def get_document_models():
    """"""
    mappings = {}
    for i in get_index_names():
        for m in get_index_models(i):
            key = "%s.%s" % (i, m._meta.model_name)
            mappings[key] = m
    return mappings
1072877
function (yamlJson, cb) {
		
		let all_apis = {};
		let all_errors = {};
		
		let paths = reformatPaths(yamlJson.paths);
		let definitions = yamlJson.definitions;
		let parameters = yamlJson.parameters;
		
		let convertedDefinitions = {};
		let convertedParameters = {};
		
		// convert definitions first
		if (definitions) {
			let definitionsKeys = Object.keys(definitions);
			definitionsKeys.forEach(function (eachDef) {
				convertedDefinitions[eachDef] = convertItem(null, definitions[eachDef], 1); // 1 ??? definitions should never have schema -=-=-=-=-=
			});
		}
		
		// convert parameters then
		if (parameters) {
			let parametersKeys = Object.keys(parameters);
			parametersKeys.forEach(function (eachParam) {
				convertedParameters[eachParam] = convertItem(convertedDefinitions, parameters[eachParam], 1);
			});
			all_apis.commonFields = convertedParameters;
		}
		
		let pathsKeys = Object.keys(paths);
		pathsKeys.forEach(function (eachPath) {
			let methods = paths[eachPath];
			let methodsKeys = Object.keys(methods);
			
			methodsKeys.forEach(function (eachMethod) {
				let apiData = methods[eachMethod];
				
				if (!all_apis[eachMethod]) {
					all_apis[eachMethod] = {};
				}
				
				var mwFile = eachPath.replace(/\\/g, "_").replace(/:/g, "_").replace(/\//g, "_").replace(/[_]{2,}/g, "_").replace(/{/g, "").replace(/}/g, "");
				mwFile = mwFile.toLowerCase();
				if (mwFile[0] === "_") {
					mwFile = mwFile.substring(1);
				}
				mwFile += "_" + eachMethod.toLowerCase() + ".js";
				
				all_apis[eachMethod][eachPath] = {
					_apiInfo: {},
					"mw": '%dirname% + "/lib/mw/' + mwFile + '"'
				};
				let newSoajsApi = all_apis[eachMethod][eachPath];
				
				let params = apiData.parameters;
				
				let group = apiData.tags ? apiData.tags[0] : "";
				newSoajsApi._apiInfo.group = group && group !== '' ? group : "general";
				newSoajsApi._apiInfo.l = apiData.summary;
				newSoajsApi.imfv = convertParams(convertedDefinitions, convertedParameters, params);
			});
		});
		
		// todo: convert errors
		
		return cb({"schema": all_apis, "errors": all_errors});
	}
710751
def _map_arguments(self, input_dict):
        

        config_yaml = input_dict['config']
        config_dict = load_yaml(config_yaml)

        data = config_dict.get('data')
        comp = config_dict.get('comp')
        sourcekeys = config_dict.get('sourcekeys')

        mktimefilter = config_dict.get('mktimefilter')

        self._set_link('expcube2', Gtexpcube2wcs_SG,
                       comp=comp, data=data,
                       mktimefilter=mktimefilter)

        self._set_link('exphpsun', Gtexphpsun_SG,
                       comp=comp, data=data,
                       mktimefilter=mktimefilter)

        self._set_link('suntemp', Gtsuntemp_SG,
                       comp=comp, data=data,
                       mktimefilter=mktimefilter,
                       sourcekeys=sourcekeys)
508498
def _schema_to_json_file_object(self, schema_list, file_obj):
        
        json.dump(schema_list, file_obj, indent=2, sort_keys=True)
383824
def get_index_mapping(index):
    
    # app_path = apps.get_app_config('elasticsearch_django').path
    mappings_dir = get_setting("mappings_dir")
    filename = "%s.json" % index
    path = os.path.join(mappings_dir, filename)
    with open(path, "r") as f:
        return json.load(f)
129614
private static void loadMappings(ConfigServerImpl configServer, ConfigImpl config, Document doc, int mode, Log log) throws IOException {
	try {
	    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAPPING);
	    Element el = getChildByName(doc.getDocumentElement(), "mappings");
	    Element[] _mappings = getChildren(el, "mapping");

	    Map<String, Mapping> mappings = MapFactory.<String, Mapping>getConcurrentMap();
	    Mapping tmp;

	    boolean finished = false;

	    if (configServer != null && config instanceof ConfigWeb) {
		Mapping[] sm = configServer.getMappings();
		if (sm != null) {
		    for (int i = 0; i < sm.length; i++) {
			if (!sm[i].isHidden()) {
			    if ("/".equals(sm[i].getVirtual())) finished = true;
			    if (sm[i] instanceof MappingImpl) {
				tmp = ((MappingImpl) sm[i]).cloneReadOnly(config);
				mappings.put(tmp.getVirtualLowerCase(), tmp);

			    }
			    else {
				tmp = sm[i];
				mappings.put(tmp.getVirtualLowerCase(), tmp);
			    }
			}
		    }
		}
	    }

	    if (hasAccess) {
		boolean hasServerContext = false;
		for (int i = 0; i < _mappings.length; i++) {
		    el = _mappings[i];

		    String physical = el.getAttribute("physical");
		    String archive = el.getAttribute("archive");
		    String virtual = getAttr(el, "virtual");
		    String listType = getAttr(el, "listener-type");
		    String listMode = getAttr(el, "listener-mode");

		    boolean readonly = toBoolean(getAttr(el, "readonly"), false);
		    boolean hidden = toBoolean(getAttr(el, "hidden"), false);
		    boolean toplevel = toBoolean(getAttr(el, "toplevel"), true);

		    if (config instanceof ConfigServer && (virtual.equalsIgnoreCase("/lucee-server/") || virtual.equalsIgnoreCase("/lucee-server-context/"))) {
			hasServerContext = true;
		    }

		    // lucee
		    if (virtual.equalsIgnoreCase("/lucee/")) {
			if (StringUtil.isEmpty(listType, true)) listType = "modern";
			if (StringUtil.isEmpty(listMode, true)) listMode = "curr2root";
			toplevel = true;
		    }

		    int listenerMode = ConfigWebUtil.toListenerMode(listMode, -1);
		    int listenerType = ConfigWebUtil.toListenerType(listType, -1);
		    ApplicationListener listener = ConfigWebUtil.loadListener(listenerType, null);
		    if (listener != null || listenerMode != -1) {
			// type
			if (mode == ConfigImpl.MODE_STRICT) listener = new ModernAppListener();
			else if (listener == null) listener = ConfigWebUtil.loadListener(ConfigWebUtil.toListenerType(config.getApplicationListener().getType(), -1), null);
			if (listener == null)// this should never be true
			    listener = new ModernAppListener();

			// mode
			if (listenerMode == -1) {
			    listenerMode = config.getApplicationListener().getMode();
			}
			listener.setMode(listenerMode);

		    }

		    // physical!=null &&
		    if ((physical != null || archive != null)) {

			short insTemp = inspectTemplate(el);
			if ("/lucee/".equalsIgnoreCase(virtual) || "/lucee".equalsIgnoreCase(virtual) || "/lucee-server/".equalsIgnoreCase(virtual)
				|| "/lucee-server-context".equalsIgnoreCase(virtual))
			    insTemp = ConfigImpl.INSPECT_ONCE;

			String primary = getAttr(el, "primary");
			boolean physicalFirst = primary == null || !primary.equalsIgnoreCase("archive");

			tmp = new MappingImpl(config, virtual, physical, archive, insTemp, physicalFirst, hidden, readonly, toplevel, false, false, listener, listenerMode,
				listenerType);
			mappings.put(tmp.getVirtualLowerCase(), tmp);
			if (virtual.equals("/")) {
			    finished = true;
			    // break;
			}
		    }
		}

		// set default lucee-server-context
		if (config instanceof ConfigServer && !hasServerContext) {
		    ApplicationListener listener = ConfigWebUtil.loadListener(ApplicationListener.TYPE_MODERN, null);
		    listener.setMode(ApplicationListener.MODE_CURRENT2ROOT);

		    tmp = new MappingImpl(config, "/lucee-server", "{lucee-server}/context/", null, ConfigImpl.INSPECT_ONCE, true, false, true, true, false, false, listener,
			    ApplicationListener.MODE_CURRENT2ROOT, ApplicationListener.TYPE_MODERN);
		    mappings.put(tmp.getVirtualLowerCase(), tmp);
		}
	    }

	    if (!finished) {

		if ((config instanceof ConfigWebImpl) && ResourceUtil.isUNCPath(config.getRootDirectory().getPath())) {

		    tmp = new MappingImpl(config, "/", config.getRootDirectory().getPath(), null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}
		else {

		    tmp = new MappingImpl(config, "/", "/", null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}

		mappings.put("/", tmp);
	    }

	    Mapping[] arrMapping = new Mapping[mappings.size()];
	    int index = 0;
	    Iterator it = mappings.keySet().iterator();
	    while (it.hasNext()) {
		arrMapping[index++] = mappings.get(it.next());
	    }
	    config.setMappings(arrMapping);
	    // config.setMappings((Mapping[]) mappings.toArray(new
	    // Mapping[mappings.size()]));
	}
	catch (Exception e) {
	    log(config, log, e);
	}
    }
1039293
function writeJSONConfigFile(config, filePath) {
    debug(`Writing JSON config file: ${filePath}`);

    const content = stringify(config, { cmp: sortByKey, space: 4 });

    fs.writeFileSync(filePath, content, "utf8");
}
1121008
def _FetchCustomMappings(descriptor_ls):
    """"""
    custom_mappings = []
    for descriptor in descriptor_ls:
        if isinstance(descriptor, ExtendedEnumDescriptor):
            custom_mappings.extend(
                _FormatCustomJsonMapping('Enum', m, descriptor)
                for m in descriptor.enum_mappings)
        elif isinstance(descriptor, ExtendedMessageDescriptor):
            custom_mappings.extend(
                _FormatCustomJsonMapping('Field', m, descriptor)
                for m in descriptor.field_mappings)
            custom_mappings.extend(
                _FetchCustomMappings(descriptor.enum_types))
            custom_mappings.extend(
                _FetchCustomMappings(descriptor.message_types))
    return custom_mappings
941425
def configs_in(src_dir):
    """"""
    for filename in files_in_dir(src_dir, 'json'):
        with open(os.path.join(src_dir, filename), 'rb') as in_f:
            yield json.load(in_f)