Returns a build config matching the given label selectors, filtering against
        another predetermined value. This method will raise OsbsException
        if not exactly one build config is found after filtering.
335857
def get_build_config_by_labels_filtered(self, label_selectors, filter_key, filter_value):
        
        items = self.get_all_build_configs_by_labels(label_selectors)

        if filter_value is not None:
            build_configs = []
            for build_config in items:
                match_value = graceful_chain_get(build_config, *filter_key.split('.'))
                if filter_value == match_value:
                    build_configs.append(build_config)
            items = build_configs

        if not items:
            raise OsbsException(
                "Build config not found for labels: %r" %
                (label_selectors, ))
        if len(items) > 1:
            raise OsbsException(
                "More than one build config found for labels: %r" %
                (label_selectors, ))
        return items[0]
752930
def find_config():
    """"""
    previous = ""
    current = os.getcwd()
    while previous != current:
        check_path = os.path.join(current, "build.cache")
        if os.path.isfile(check_path):
            return check_path
        else:
            previous = current
            current = os.path.dirname(current)
    raise Exception("Can't find build cache")
247636
public static AlbumConfig getAlbumConfig() {
        if (sAlbumConfig == null) {
            sAlbumConfig = AlbumConfig.newBuilder(null).build();
        }
        return sAlbumConfig;
    }
539723
public static Builder getSettingsBuilder(String nodeName,
            boolean clientTransportSniff, String clusterName) {
        boolean isNullClusterName = Objects.isNull(clusterName);
        Builder builder = Settings.builder().put(NODE_NAME, nodeName)
                .put(CLIENT_TRANSPORT_SNIFF, clientTransportSniff)
                .put(CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME,
                        isNullClusterName);
        if (!isNullClusterName)
            builder.put(CLUSTER_NAME, clusterName);
        return builder;
    }
540376
public static ns_ns_savedconfig[] get_filtered(nitro_service service, String filter) throws Exception
	{
		ns_ns_savedconfig obj = new ns_ns_savedconfig();
		options option = new options();
		option.set_filter(filter);
		ns_ns_savedconfig[] response = (ns_ns_savedconfig[]) obj.getfiltered(service, option);
		return response;
	}
458593
def get_build_configuration_by_name(name):
    
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all', q='name==' + name).content
    if not response:
        return None
    return response[0]
890298
def get_platform_node_selector(self, platform):
        
        nodeselector = {}
        if platform:
            nodeselector_str = self._get_value("node_selector." + platform, self.conf_section,
                                               "node_selector." + platform)
            nodeselector = self.generate_nodeselector_dict(nodeselector_str)

        return nodeselector
443274
public PatternElementMatch getFirstLabeledMatch(String label) {
        PatternElementMatch cur = this, result = null;
        while (cur != null) {
            String elementLabel = cur.patternElement.getLabel();
            if (elementLabel != null && elementLabel.equals(label)) {
                result = cur;
            }
            cur = cur.prev;
        }
        return result;
    }
593218
protected ILaunchConfiguration findLaunchConfiguration(String projectName,
			ILaunchConfigurationType configType)
	{
		List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
		try
		{
			ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
			candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
			for (int i = 0; i < configs.length; i++)
			{
				ILaunchConfiguration config = configs[i];

				// String defaultModule = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_DEFAULT, "");
				String pName = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PROJECT, "");
				// String operation = config.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_OPERATION, "");

				if (// defaultModule.equals(getModuleName(type).toString())
					// &&
				pName.equalsIgnoreCase(projectName)
				// && operation.equals(getOperationName(type) + "()")
				)
				{ //$NON-NLS-1$
					candidateConfigs.add(config);
				}
			}

		} catch (CoreException e)
		{
			// JDIDebugUIPlugin.log(e);
		}
		int candidateCount = candidateConfigs.size();
		if (candidateCount == 1)
		{
			return (ILaunchConfiguration) candidateConfigs.get(0);
		} else if (candidateCount > 1)
		{
			return chooseConfiguration(candidateConfigs);
			// return candidateConfigs.get(0);
		}
		return null;
	}
319902
def find_or_build(cls, **kwargs):
        
        keys = kwargs.pop('keys') if 'keys' in kwargs else []
        return cls.first(**subdict(kwargs, keys)) or cls.build(**kwargs)
991871
@SuppressWarnings("unchecked")
  private ConfigStoreFactory<ConfigStore> getConfigStoreFactory(URI configKeyUri)
      throws ConfigStoreFactoryDoesNotExistsException {
    @SuppressWarnings("rawtypes")
    ConfigStoreFactory csf = this.configStoreFactoryRegister.getConfigStoreFactory(configKeyUri.getScheme());
    if (csf == null) {
      throw new ConfigStoreFactoryDoesNotExistsException(configKeyUri.getScheme(), "scheme name does not exists");
    }

    return csf;
  }
1048689
public InstructionHandle getLabeledInstruction(String label) {
        PatternElementMatch first = getFirstLabeledMatch(label);
        return first != null ? first.getMatchedInstructionInstructionHandle() : null;
    }
160438
public static sdx_network_config[] get_filtered(nitro_service service, String filter) throws Exception
	{
		sdx_network_config obj = new sdx_network_config();
		options option = new options();
		option.set_filter(filter);
		sdx_network_config[] response = (sdx_network_config[]) obj.getfiltered(service, option);
		return response;
	}
1308813
def select_configuration(self, obresult):
        """"""

        logger = logging.getLogger(__name__)
        logger.debug('calling default configuration selector')

        # get first possible image
        ref = obresult.get_sample_frame()
        extr = self.datamodel.extractor_map['fits']
        if ref:
            # get INSCONF configuration
            result = extr.extract('insconf', ref)
            if result:
                # found the keyword, try to match
                logger.debug('found insconf config uuid=%s', result)
                # Use insconf as uuid key
                if result in self.configurations:
                    return self.configurations[result]
                else:
                    # Additional check for conf.name
                    for conf in self.configurations.values():
                        if conf.name == result:
                            return conf
                    else:
                        raise KeyError('insconf {} does not match any config'.format(result))

            # If not, try to match by DATE
            date_obs = extr.extract('observation_date', ref)
            for key, conf in self.configurations.items():
                if key == 'default':
                    # skip default
                    continue
                if conf.date_end is not None:
                    upper_t = date_obs < conf.date_end
                else:
                    upper_t = True
                if upper_t and (date_obs >= conf.date_start):
                    logger.debug('found date match, config uuid=%s', key)
                    return conf
        else:
            logger.debug('no match, using default configuration')
            return self.configurations['default']
444916
def get_embedded_config(filename):
    
    def check_option(self, section, name):
        return (self.has_section(section) and
               (self.has_option(section, name) or (name in self.defaults())))

    try:
        cp = pycbc.results.load_metadata_from_file(filename)
    except TypeError:
        cp = ConfigParser()

    cp.check_option = types.MethodType(check_option, cp)

    return cp
1333106
public static ConfigurationElement getConfigurationElement(Configuration config, String... names) {
        if (config != null && names.length > 0) {
            String first = names[0];
            ConfigurationElement root = findConfigurationElement(config, first);
            if (root != null) {
                if (names.length == 1) {
                    return root;
                } else {
                    int remainingLength = names.length - 1;
                    String[] remaining = new String[remainingLength];
                    System.arraycopy(names, 1, remaining, 0, remainingLength);
                    return getConfigurationElement(root, remaining);
                }
            }
        }
        return null;
    }
358478
private ValueDescriptor<?> getConfigChildNodes(Xpp3Dom node, Store store) {
        Xpp3Dom[] children = node.getChildren();
        if (children.length == 0) {
            PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
            propertyDescriptor.setName(node.getName());
            propertyDescriptor.setValue(node.getValue());
            return propertyDescriptor;
        }
        ArrayValueDescriptor childDescriptor = store.create(ArrayValueDescriptor.class);
        childDescriptor.setName(node.getName());
        for (Xpp3Dom child : children) {
            childDescriptor.getValue().add(getConfigChildNodes(child, store));
        }
        return childDescriptor;
    }