Legal module names are dotted strings where each part
           is a valid Python identifier.
           (and not a keyword, and support unicode identifiers in
           Python3, ..)
430174
def legal_module_name(self, name):
        
        if name in self._legal_mnames:
            return self._legal_mnames[name]

        for part in name.split('.'):
            try:
                exec("%s = 42" % part, {}, {})
            except:  # pragma: nocover
                self._legal_mnames[name] = False
                return False
        self._legal_mnames[name] = True
        return True
1238395
def p_identifier_name_string(self, p):
        
        p[0] = asttypes.PropIdentifier(p[1].value)
        # manually clone the position attributes.
        for k in ('_token_map', 'lexpos', 'lineno', 'colno'):
            setattr(p[0], k, getattr(p[1], k))
46242
def module2uri(self, module_name):
        """"""
        assert module_name.startswith(self.module_prefix), 'incompatible module name'
        path = module_name[len(self.module_prefix):]
        path = path.replace('&#DOT', '.')
        return path.replace('&#SEP', os.sep)
1139275
def geometry_identifiers(self):
        
        identifiers = {mesh.identifier_md5: name
                       for name, mesh in self.geometry.items()}
        return identifiers
231694
function module (options) {
  options.hash.kind = 'module'
  var result = _identifiers(options)[0]
  return result ? options.fn(result) : 'ERROR, Cannot find module.'
}
889983
function _identifiers (options) {
  var query = {}

  for (var prop in options.hash) {
    if (/^-/.test(prop)) {
      query[prop.replace(/^-/, '!')] = options.hash[prop]
    } else if (/^_/.test(prop)) {
      query[prop.replace(/^_/, '')] = new RegExp(options.hash[prop])
    } else {
      query[prop] = options.hash[prop]
    }
  }
  return arrayify(options.data.root).filter(where(query)).filter(function (doclet) {
    return !doclet.ignore && (state.options.private ? true : doclet.access !== 'private')
  })
}
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
963584
def nonpresent_module_filename():
    """"""
    while True:
        module_name = get_random_name()
        loader = pkgutil.find_loader(module_name)
        if loader is not None:
            continue
        importlib.invalidate_caches()
        return "{}.py".format(module_name)
432136
def solidity_names(code):  # pylint: disable=too-many-branches
    
    names = []
    in_string = None
    backslash = False
    comment = None

    # "parse" the code by hand to handle the corner cases:
    #  - the contract or library can be inside a comment or string
    #  - multiline comments
    #  - the contract and library keywords could not be at the start of the line
    for pos, char in enumerate(code):
        if in_string:
            if not backslash and in_string == char:
                in_string = None
                backslash = False

            if char == '\\':  # pylint: disable=simplifiable-if-statement
                backslash = True
            else:
                backslash = False

        elif comment == '//':
            if char in ('\n', '\r'):
                comment = None

        elif comment == '/*':
            if char == '*' and code[pos + 1] == '/':
                comment = None

        else:
            if char == '"' or char == "'":
                in_string = char

            if char == '/':
                if code[pos + 1] == '/':
                    comment = '//'
                if code[pos + 1] == '*':
                    comment = '/*'

            if char == 'c' and code[pos: pos + 8] == 'contract':
                result = re.match(
                    '^contract[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])

                if result:
                    names.append(('contract', result.groups()[0]))

            if char == 'i' and code[pos: pos + 9] == 'interface':
                result = re.match(
                    '^interface[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])

                if result:
                    names.append(('contract', result.groups()[0]))

            if char == 'l' and code[pos: pos + 7] == 'library':
                result = re.match(
                    '^library[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])

                if result:
                    names.append(('library', result.groups()[0]))

    return names
349533
def identify_modules(*args, **kwargs):
    
    if len(args) == 1:
        path_template = "%(file)s"
        error_template = "Module '%(mod)s' not found (%(error)s)"
    else:
        path_template = "%(mod)s: %(file)s"
        error_template = "%(mod)s: not found (%(error)s)"

    for modulename in args:
        try:
            filepath = identify_filepath(modulename, **kwargs)
        except ModuleNotFound:
            exc = sys.exc_info()[1]
            sys.stderr.write(error_template % {
                'mod': modulename,
                'error': str(exc),
            })
            sys.stderr.write('\n')
        else:
            print(path_template % {
                'mod': modulename,
                'file': filepath
            })
1268261
def construct_evm_runtime_identifier() -> str:
    
    return "Py-EVM/{0}/{platform}/{imp.name}{v.major}.{v.minor}.{v.micro}".format(
        __version__,
        platform=sys.platform,
        v=sys.version_info,
        # mypy Doesn't recognize the `sys` module as having an `implementation` attribute.
        imp=sys.implementation,
    )
712483
def _get_package_name(module):
    
    try:
        # if __package__ is defined, use it
        package_name = module.__package__
    except AttributeError:
        package_name = None  
        
    if package_name is None:
        # if __path__ is defined, the package name is the module name
        package_name = module.__name__
        if not hasattr(module, '__path__'):
            # if __path__ is not defined, the package name is the
            # string before the last "." of the fully-qualified module name
            package_name = package_name.rpartition('.')[0]
           
    return package_name
165775
def is_identifier(string):
    
    matched = PYTHON_IDENTIFIER_RE.match(string)
    return bool(matched) and not keyword.iskeyword(string)
1008196
function _identifiers (options) {
  var query = {}

  for (var prop in options.hash) {
    if (/^-/.test(prop)) {
      query[prop.replace(/^-/, '!')] = options.hash[prop]
    } else if (/^_/.test(prop)) {
      query[prop.replace(/^_/, '')] = new RegExp(options.hash[prop])
    } else {
      query[prop] = options.hash[prop]
    }
  }
  return arrayify(options.data.root).filter(where(query))
}
904066
def _decode_module_id(self, module_id):
        
        name = [''] * 9
        module_id >>= 10
        for i in reversed(range(9)):
            name[i] = self.charset[module_id & 63]
            module_id >>= 6
        return ''.join(name)
77557
def identifier(self, camelsplit=False, ascii=True):
        """"""
        return self.nameify(camelsplit=camelsplit, ascii=ascii, sep='_')
671401
def qualified_name(self):
        ''''''
        return '{0}.{1}#{2}'.format(self.module.name, self.enum.name, self.name)