Checks if the provided name fits Linode's labeling parameters.

    .. versionadded:: 2015.5.6

    name
        The VM name to validate
167150
def _validate_name(name):
    '''
    
    '''
    name = six.text_type(name)
    name_length = len(name)
    regex = re.compile(r'^[a-zA-Z0-9][A-Za-z0-9_-]*[a-zA-Z0-9]$')

    if name_length < 3 or name_length > 48:
        ret = False
    elif not re.match(regex, name):
        ret = False
    else:
        ret = True

    if ret is False:
        log.warning(
            'A Linode label may only contain ASCII letters or numbers, dashes, and '
            'underscores, must begin and end with letters or numbers, and be at least '
            'three characters in length.'
        )

    return ret
1033170
def valid(self, name):
    
    name = re.sub('[^0-9a-zA-Z_]', '', name)
    if re.match('[0-9]', name):
      name = '_' + name
    return name
9660
def name_valid?(profile_name, profile_base_path)
      unless valid_puppet_class_name?(profile_name)
        error _('wizard.profile.invalid_name')%{words: Bebox::RESERVED_WORDS.join(', ')}
        return false
      end
      return true if profile_base_path.empty?
      # Check if the path name is valid
      unless Bebox::Profile.valid_pathname?(profile_base_path)
        error _('wizard.profile.invalid_path')%{words: Bebox::RESERVED_WORDS.join(', ')}
        return false
      end
      true
    end
1275627
def _init_pval_name(self, **kws):
        """"""
        if 'pval_name' in kws:
            return kws['pval_name']
        # If go2res contains GO Terms
        if self.is_goterm:
            return "p_{M}".format(M=next(iter(self.go2res.values())).get_method_name())
        # If go2res contains GO namedtuples
        for fld in next(iter(self.go2res.values()))._fields:
            if fld[:2] == 'p_' and fld != 'p_uncorrected':
                return fld
1144589
def _validate_names(self, name=None, names=None, deep=False):
        
        from copy import deepcopy
        if names is not None and name is not None:
            raise TypeError("Can only provide one of `names` and `name`")
        elif names is None and name is None:
            return deepcopy(self.names) if deep else self.names
        elif names is not None:
            if not is_list_like(names):
                raise TypeError("Must pass list-like as `names`.")
            return names
        else:
            if not is_list_like(name):
                return [name]
            return name
546747
def with_name(self, name):
        """"""
        if not self.name:
            raise ValueError("%r has an empty name" % (self,))
        drv, root, parts = self._flavour.parse_parts((name,))
        if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
                or drv or root or len(parts) != 1):
            raise ValueError("Invalid name %r" % (name))
        return self._from_parsed_parts(self._drv, self._root,
                                       self._parts[:-1] + [name])
1372190
function toBindingIdentifierName(name) {
  name = toIdentifier(name);
  if (name === "eval" || name === "arguments") name = "_" + name;
  return name;
}
1252107
public void validateNamedParameters() {
      if (namedParameters != null) {
         for (Map.Entry<String, Object> e : namedParameters.entrySet()) {
            if (e.getValue() == null) {
               throw log.queryParameterNotSet(e.getKey());
            }
         }
      }
   }
987660
def name(self, value):
        

        if isinstance(value, string_types):

            match = Parameter._PARAM_NAME_COMPILER_MATCHER(value)

            if match is None or match.group() != value:
                value = re_compile(value)

        self._name = value
482331
def name_check(self, original, loc, tokens):
        """"""
        internal_assert(len(tokens) == 1, "invalid name tokens", tokens)
        if self.strict:
            self.unused_imports.discard(tokens[0])
        if tokens[0] == "exec":
            return self.check_py("3", "exec function", original, loc, tokens)
        elif tokens[0].startswith(reserved_prefix):
            raise self.make_err(CoconutSyntaxError, "variable names cannot start with reserved prefix " + reserved_prefix, original, loc)
        else:
            return tokens[0]
1196481
def _parse_name(name):
    
    required = False

    if name[-1] == '*':
        name = name[0:-1]
        required = True

    return name, required
1240113
def _validate_nodes_with_data(self, names):
        """"""
        names = names if isinstance(names, list) else [names]
        if not names:
            raise RuntimeError("Argument `nodes` is not valid")
        for ndict in names:
            if (not isinstance(ndict, dict)) or (
                isinstance(ndict, dict) and (set(ndict.keys()) != set(["name", "data"]))
            ):
                raise RuntimeError("Argument `nodes` is not valid")
            name = ndict["name"]
            if (not isinstance(name, str)) or (
                isinstance(name, str)
                and (
                    (" " in name)
                    or any(
                        [
                            element.strip() == ""
                            for element in name.strip().split(self._node_separator)
                        ]
                    )
                )
            ):
                raise RuntimeError("Argument `nodes` is not valid")
711918
def name_match(self, elt):
        '''
        '''
        return self.pname == elt.localName and \
                    self.nspname in [None, '', elt.namespaceURI]
1286357
def valid_name(name):
    ""
    if isinstance(name, bytes):
        name = name.decode('ascii')
    if not Definitions.COOKIE_NAME_RE.match(name):
        return False
    # This module doesn't support $identifiers, which are part of an obsolete
    # and highly complex standard which is never used.
    if name[0] == "$":
        return False
    return True
1298977
private boolean isValidMsgName(Node nameNode) {
    if (nameNode.isName() || nameNode.isStringKey()) {
      return nameNode.getString().startsWith("MSG_");
    } else if (nameNode.isQualifiedName()) {
      return nameNode.getLastChild().getString().startsWith("MSG_");
    } else {
      return false;
    }
  }
1249359
def valid_puppet_class_name?(name)
      valid_name = (name =~ /\A[a-z][a-z0-9_]*\Z/).nil? ? false : true
      valid_name && !Bebox::RESERVED_WORDS.include?(name)
    end
693732
def validate_name(name)
      raise InvalidIntrospectionData if name.bytesize > 255
      raise InvalidIntrospectionData if name =~ /^\./ || name =~ /\.$/
      raise InvalidIntrospectionData if name =~ /\.\./
      raise InvalidIntrospectionData if name !~ /\./
      name.split(".").each do |element|
        raise InvalidIntrospectionData if element !~ INTERFACE_ELEMENT_RE
      end
    end