Sanitizes a network name.

 @param name [String] the name of the network
 @param conf [Hash] the configuration containing all networks
 @return [Network, nil] the corresponding network or +nil+ on error
481048
def valid_network(name, conf)
      return if name.nil?

      conf[:networks].find { |net| net.name_eql? name }
    end
1358322
def canonicalize_name(name)
      if name == nil or name == SEP
        return name
      elsif name[0] == SEP[0]
        return name.split(/\/+/).join(SEP)
      else
        return SEP + name.split(/\/+/).join(SEP)
      end
    end
386908
def _conv_name(x):
    '''
    
    '''
    if '}' in x:
        comps = x.split('}')
        name = comps[1]
        return name
    return x
609250
public void expectDomainName(String name) {
        expectDomainName(name, messages.get(Validation.IPV4_KEY.name(), name));
    }
947612
function requireValidName (name) {
    // require a non-zero length string for name
    if (!(name && typeof name === 'string' && name.length > 0)) {
        throw new Error('name error: name must be string with non-zero length')
    }
    // do not allow dot in name
    if (name.includes('.')) {
        throw new Error('name error: name may not contain dot (.)')
    }
    // do not allow reserved names
    if (reservedNames[name]) {
        throw new Error(`name error: ${name} is a reserved name`)
    }
}
508807
def const_name
      components = name.gsub(/\W/,' ').split.collect {|word| word.strip.upcase }
      components.join '_'
    end
673440
private String normalize(String name) {
        return Normalizer.normalize(name, Normalizer.Form.NFKD);
    }
1242365
def corba_name_to_string(name):
    ''''''
    parts = []
    if type(name) is not list and type(name) is not tuple:
        raise NotCORBANameError(name)
    if len(name) == 0:
        raise NotCORBANameError(name)

    for nc in name:
        if not nc.kind:
            parts.append(nc.id)
        else:
            parts.append('{0}.{1}'.format(nc.id, nc.kind))
    return '/'.join(parts)
611240
def break_name=(break_name)
      if break_name.nil?
        fail ArgumentError, "break_name cannot be nil"
      end

      if break_name.to_s.length < 1
        fail ArgumentError, "invalid value for 'break_name', the character length must be great than or equal to 1."
      end

      @break_name = break_name
    end
547094
def secure
    insecure_settings = to_settings.insecure.to_flattened_name_hash
    secure_settings   = to_settings.insecure.secure.to_flattened_name_hash
    file_contents     = read

    insecure_settings.each_pair do |name_pieces, value|
      secure_value  = secure_settings[name_pieces]

      escaped_name  = Regexp.escape(name_pieces.last)
      escaped_value = Regexp.escape(value)

      file_contents.
        sub!(
          /^(\s*)#{secure_prefix_pattern}#{escaped_name}(\s*):(\s*)['"]?#{escaped_value}['"]?$/,
          "\\1#{secure_prefix}#{name_pieces.last}\\2:\\3#{secure_value}",
      )

      file_contents.
        sub!(
          /^(\s*)#{secure_prefix_pattern}#{escaped_name}(\s*):(\s*)\|((?:\n\1\s{2}.*)+)/,
          "\\1#{secure_prefix}#{name_pieces.last}\\2:\\3#{secure_value}",
      )
    end

    write(file_contents)
  end
46138
def show_network(network) # rubocop:disable Metrics/AbcSize
      puts "Network: #{network.name}"
      security = "#{network.secure ? 'secure' : 'insecure'} connection"
      password = network.server_password
      puts "\tServer:     #{network.host}:#{network.real_port} (#{security})"
      puts "\tPassword:   #{'*' * password.length}" unless password.to_s.empty?
      puts "\tNickname:   #{network.nick}"
      puts "\tBind to:    #{network.bind}" unless network.bind.to_s.empty?
      puts "\tUser modes: #{network.modes}" unless network.modes.to_s.empty?
      show_network_sasl(network)
      show_network_nickserv(network)
    end
764374
public static boolean isValidName(String name) {
    return Utils.isNotNullOrEmpty(name) &&
      name.length() < KUBERNETES_DNS1123_LABEL_MAX_LENGTH &&
      KUBERNETES_DNS1123_LABEL_REGEX.matcher(name).matches();
  }
885011
def const_lookup(mod, name)
      name.to_s.split('::').map(&:to_sym).each do |component|
        begin
          mod = mod.const_get(component, false)
        rescue NameError
          return nil
        end
      end
      mod
    end
1042698
def ss(name):
    '''
    

    '''
    sanitize_name = six.text_type(name)
    ss_infos = __salt__['cmd.run']("ss -neap")
    found_infos = []
    ret = []
    for info in ss_infos.splitlines():
        if info.find(sanitize_name) != -1:
            found_infos.append(info)
    ret.extend([sanitize_name, found_infos])
    return ret
52039
def get_by_name(config=None, name=None, name_label='name'):
        

        if name is None:
            raise SyntaxError(
                'Deployment: name: [ {0} ] cannot be None.'.format(name))
        if not isinstance(name, str):
            raise SyntaxError(
                'Deployment: name: [ {0} ] must be a string.'.format(name))

        if config is not None and not isinstance(config, K8sConfig):
            raise SyntaxError(
                'Deployment: config: [ {0} ] must be a K8sConfig'.format(config))

        deps = K8sDeployment(config=config, name=name).list(labels={
            name_label: name
        })

        return deps
1149324
def wf_name?(name)
      return true if name.is_a?(String) && name.size < 1024 && name =~ /^\w+$/
      raise Wavefront::Exception::InvalidName
    end
432670
def _sanatize_network_params(self, kwargs):
        '''
        
        '''
        params = [
            'label', 'bridge', 'bridge_interface', 'cidr', 'cidr_v6', 'dns1',
            'dns2', 'fixed_cidr', 'gateway', 'gateway_v6', 'multi_host',
            'priority', 'project_id', 'vlan_start', 'vpn_start'
        ]

        for variable in six.iterkeys(kwargs):  # iterate over a copy, we might delete some
            if variable not in params:
                del kwargs[variable]
        return kwargs