Make prefix string based on configuration parameters.
183824
def make_prefix(api_version, manipulator, auth_type):
    """"""
    prefix = "%s_%s" % (api_version, manipulator)
    if (auth_type and auth_type != 'none'):
        prefix += '_' + auth_type
    return prefix
1141813
def prefix(self, prefix):
        
        original_prefix = self._prefix
        self._prefix += prefix
        yield self
        self._prefix = original_prefix
138139
public void setPrefix(String prefix)
  {
    _prefix = prefix;
    
    if (prefix != null)
      _pathPrefix = prefix.replace('.', '/');
  }
180437
def with_prefix(self, root_path):
        """"""
        return Conflict(self.conflict_type, root_path + self.path, self.body)
759340
def from_prefix(cls, container, prefix):
        """"""
        if cls._is_gs_folder(prefix):
            name, suffix, extra = prefix.name.partition(cls._gs_folder_suffix)
            if (suffix, extra) == (cls._gs_folder_suffix, ''):
                # Patch GS specific folder to remove suffix.
                prefix.name = name

        return super(GsObject, cls).from_prefix(container, prefix)
802722
private String fixPrefix(String prefix) {
		String fixedPrefix = prefix.startsWith("/") ? prefix : "/" + prefix;
		return fixedPrefix.endsWith("/") ? fixedPrefix : fixedPrefix + "/";
	}
76597
def get_linter_config(self, name):
        """"""
        prefix = name + ' '
        return {k[len(prefix):]: v
                for k, v in self._config.items()
                if k.startswith(prefix)}
1052286
private Map<String, String> getConfigMapFromProperties(String prefix) {
        Map<String, String> rval = new HashMap<>();
        getKeys(prefix).forEach(pair -> {
            if (!pair.getKey().equals(prefix)) {
                String shortKey = pair.getKey().substring(prefix.length() + 1);
                rval.put(shortKey, pair.getValue());
            }
        });
        return rval;
    }
1354436
def create_config(cls, params, prefix=None, name=None):
        
        if isinstance(cls.cfg, Config):
            cfg = cls.cfg.copy(name=name, prefix=prefix)
        else:
            cfg = cls.cfg.copy()
            if name:
                cfg[name] = name
            if prefix:
                cfg[prefix] = prefix
            cfg = Config(**cfg)
        cfg.update_settings()
        cfg.update(params, True)
        return cfg
439639
public static String encodeParameterStringWithPrefix(final Map<String, Object> params, final String prefix) {
		StringBuilder queryStringBuilder = new StringBuilder();

		for (Map.Entry<String, Object> entry : params.entrySet()) {
			queryStringBuilder.append(prefix).append(entry.getKey()).append('=').append(entry.getValue());
			queryStringBuilder.append('&');
		}
		if (queryStringBuilder.length() > 0) {
			queryStringBuilder.setLength(queryStringBuilder.length() - 1);
		}

		return queryStringBuilder.toString();
	}
1190772
def _remove_prefix(name):
    """"""
    if isinstance(name, str):
        return _do_remove_prefix(name)
    return [_do_remove_prefix(nm) for nm in name]
668651
public static String applyPrefixSuffix(String uriSource, 
            Configuration conf) {
        if (uriSource == null) return null;
        String prefix = conf.get(OUTPUT_URI_PREFIX);
        String suffix = conf.get(OUTPUT_URI_SUFFIX);
        if (prefix == null && suffix == null) {
            return uriSource;
        }
        int len = uriSource.length() +
                (prefix != null ? prefix.length() : 0) +
                (suffix != null ? suffix.length() : 0);
        StringBuilder uriBuf = new StringBuilder(len);
        if (prefix != null) {
            uriBuf.append(prefix);
        }
        uriBuf.append(uriSource);
        if (suffix != null) {
            uriBuf.append(suffix);
        }
        return uriBuf.toString();
    }
990787
def channel_parameters(parameter_prefix, channel_names, configuration_entry):
    

    if configuration_entry in (True, False):
        return ([], [parameter_prefix])[configuration_entry]

    parameters = []
    if isinstance(configuration_entry, dict):
        for name in set(channel_names).intersection(configuration_entry):
            if configuration_entry[name] is True:
                parameters.append(parameter_prefix + "_" + name)
    else:
        raise TypeError("incorrect type")

    return parameters
1186775
def host_port_prefix(host, port, prefix):
    """"""
    uri = "http://" + host
    if (port != 80):
        uri += ':' + str(port)
    if (prefix):
        uri += '/' + prefix
    return uri
198057
function pickPrefix(prefix, object) {
    var length = prefix.length;
    var sub;
    return foldl(
      function(acc, val, key) {
        if (key.substr(0, length) === prefix) {
          sub = key.substr(length);
          acc[sub] = val;
        }
        return acc;
      },
      {},
      object
    );
  }
789329
public Configuration prefixedWith(String... prefixes) {
        if (prefixes == null || prefixes.length == 0) {
            return this;
        }
        Map<String, String> filteredConfig = implementationConfiguration.entrySet().stream()
                .filter(e -> Arrays.stream(prefixes).anyMatch(p -> e.getKey()
                        .startsWith(p))).collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
        return new Configuration(feedIdStrategy, resultFilter, filteredConfig);
    }
1317596
def build_default_endpoint_prefixes(records_rest_endpoints):
    """"""
    pid_types = set()
    guessed = set()
    endpoint_prefixes = {}

    for key, endpoint in records_rest_endpoints.items():
        pid_type = endpoint['pid_type']
        pid_types.add(pid_type)
        is_guessed = key == pid_type
        is_default = endpoint.get('default_endpoint_prefix', False)

        if is_default:
            if pid_type in endpoint_prefixes and pid_type not in guessed:
                raise ValueError('More than one "{0}" defined.'.format(
                    pid_type
                ))
            endpoint_prefixes[pid_type] = key
            guessed -= {pid_type}
        elif is_guessed and pid_type not in endpoint_prefixes:
            endpoint_prefixes[pid_type] = key
            guessed |= {pid_type}

    not_found = pid_types - set(endpoint_prefixes.keys())
    if not_found:
        raise ValueError('No endpoint-prefix for {0}.'.format(
            ', '.join(not_found)
        ))

    return endpoint_prefixes