Get a record for the registered name, which will be a set of
        matching desired "module names" for the given path.
550442
def get_record(self, name):
        

        return set().union(self.records.get(name, set()))
406194
def get_module_names(p):
    '''
    '''
    mods = list()
    mods = [f.split('.')[0] for f in listdir(p)
            if isfile(join(p, f)) and not f.endswith('.pyc') and not f.startswith('__')]
    print len(mods)
    return mods
415652
def resolve_name(name):
    

    parts = name.split('.')
    cursor = len(parts) - 1
    module_name = parts[:cursor]
    attr_name = parts[-1]

    while cursor > 0:
        try:
            ret = __import__('.'.join(module_name), fromlist=[attr_name])
            break
        except ImportError:
            if cursor == 0:
                raise
            cursor -= 1
            module_name = parts[:cursor]
            attr_name = parts[cursor]
            ret = ''

    for part in parts[cursor:]:
        try:
            ret = getattr(ret, part)
        except AttributeError:
            raise ImportError(name)

    return ret
711499
def module_name(self, jamfile_location):
        """"""
        assert isinstance(jamfile_location, basestring)
        module = self.location2module.get(jamfile_location)
        if not module:
            # Root the path, so that locations are always umbiguious.
            # Without this, we can't decide if '../../exe/program1' and '.'
            # are the same paths, or not.
            jamfile_location = os.path.realpath(
                os.path.join(os.getcwd(), jamfile_location))
            module = "Jamfile<%s>" % jamfile_location
            self.location2module[jamfile_location] = module
        return module
660224
def find_spec(self, fullname, path, target=None):
        ''''''
        if not path:
            path = [os.getcwd()]
        if "." in fullname:
            name = fullname.split(".")[-1]
        else:
            name = fullname
        for entry in path:
            if os.path.isdir(os.path.join(entry, name)):
                # this module has child modules
                filename = os.path.join(entry, name, "__init__.py")
                submodule_locations = [os.path.join(entry, name)]
            else:
                filename = os.path.join(entry, name + ".py")
                submodule_locations = None
            if not os.path.exists(filename):
                continue

            return spec_from_file_location(fullname, filename,
                                           loader=MyLoader(filename),
                                           submodule_search_locations=submodule_locations)
        return None
1072130
def findModuleOfName(self, dotted_name, level, filename, extrapath=None):
        """"""
        if dotted_name.endswith('.*'):
            return dotted_name[:-2]
        name = dotted_name

        # extrapath is None only in a couple of test cases; in real life it's
        # always present
        if level and level > 1 and extrapath:
            # strip trailing path bits for each extra level to account for
            # relative imports
            # from . import X has level == 1 and nothing is stripped (the level > 1 check accounts for this case)
            # from .. import X has level == 2 and one trailing path component must go
            # from ... import X has level == 3 and two trailing path components must go
            extrapath = extrapath.split(os.path.sep)
            level -= 1
            extrapath = extrapath[0:-level]
            extrapath = os.path.sep.join(extrapath)

        while name:
            candidate = self.isModule(name, extrapath)
            if candidate:
                return candidate
            candidate = self.isPackage(name, extrapath)
            if candidate:
                return candidate
            name = name[:name.rfind('.')]
        self.warn(dotted_name, '%s: could not find %s', filename, dotted_name)
        return dotted_name
755637
def relation_path_for(from_name, to_name, identifier_type, identifier_key=None):
    
    return "/{}/<{}:{}>/{}".format(
        name_for(from_name),
        identifier_type,
        identifier_key or "{}_id".format(name_for(from_name)),
        name_for(to_name),
    )
1346676
function getNameFromPath (path) {
  path = _(path).toString();
  let lastSlash = path.substring(0, path.length - 1).lastIndexOf("/");
  if (lastSlash === -1) {
    return normalizeName(path);
  }
  else {
    return normalizeName(path.substring(lastSlash));
  }
}
447556
def _get_module_path(name, fail=False, install_path=None):
    
    import imp

    module = imp.find_module(name)
    if not module and fail:
        raise RuntimeError("can't find module '" + name + "'")
    path = module[1]
    if not path and fail:
        raise RuntimeError("module '" + name + "' is missing a file path")
    
    if install_path:
        return os.path.join(install_path, os.path.split(path)[1])

    return path
150961
def find_module_registrations(c_file):
    
    global pattern

    if c_file is None:
        # No c file to match the object file, skip
        return set()

    with io.open(c_file, encoding='utf-8') as c_file_obj:
        return set(re.findall(pattern, c_file_obj.read()))
727649
def _module_name(filename):
        

        absfile = os.path.abspath(filename)
        match = filename

        for base in [''] + sys.path:
            base = os.path.abspath(base)
            if absfile.startswith(base):
                match = absfile[len(base):]
                break

        return SUFFIX_RE.sub('', match).lstrip('/').replace('/', '.')
484341
def getModulePath(project_path,module_name,verbose):
    ''''''
    if not module_name:
        return None
    sys.path.append(project_path)
    try:
        package = pkgutil.get_loader(module_name)
    except ImportError:
        if verbose:
            print("Parent module for "+module_name+" not found.")
        return None
    except:
        if verbose:
            print(module_name+" not loaded for bizarre reasons")
    try:
        if package: 
                if package.get_code(module_name):
                    filename = package.get_code(module_name).co_filename
                    return filename
                elif package.find_spec(module_name).has_location==False:
                    return None #built-in module such as itertools
                else:
                    pass #perhaps filename is in package.find_spec(module_name).origin?
                    pass #a good reference is https://www.python.org/dev/peps/pep-0302/
    except ImportError:
        if verbose:
            print("Code object unavailable for "+module_name)
        return None
    except AttributeError:
        if verbose:
            print(module_name+" is an ExtensionFileLoader object")
        return None
    except:
        if verbose:
            print(module_name+" not loaded for bizarre reasons")
        return None
    else:
        if verbose:
            print ("Module "+module_name+" not found.")
        return None
522454
def get_alias(path):
    
    # pylint:disable=too-many-return-statements

    record = model.PathAlias.get(path=path)

    if not record:
        return None, None

    template = record.template if record.template != 'index' else None

    if record.entry and record.entry.visible:
        if record.template:
            # a template was requested, so we go to the category page
            category = (record.category.category
                        if record.category else record.entry.category)
            return url_for('category',
                           start=record.entry.id,
                           template=template,
                           category=category), True

        from . import entry  # pylint:disable=cyclic-import
        outbound = entry.Entry(record.entry).get('Redirect-To')
        if outbound:
            # The entry has a Redirect-To (soft redirect) header
            return outbound, False

        return url_for('entry',
                       entry_id=record.entry.id,
                       category=record.entry.category,
                       slug_text=record.entry.slug_text), True

    if record.category:
        return url_for('category',
                       category=record.category.category,
                       template=template), True

    if record.url:
        # This is an outbound URL that might be changed by the user, so
        # we don't do a 301 Permanently moved
        return record.url, False

    return None, None
558099
def _modname(path):
    """"""
    base = os.path.basename(path)
    filename, ext = os.path.splitext(base)
    return filename
828921
def find_module(self, fullname, path=None):
        
        root, base, target = fullname.partition(self.root_name + '.')
        if root:
            return
        if not any(map(target.startswith, self.vendored_names)):
            return
        return self
118784
def load_steps_impl(self, registry, path, module_names=None):
        

        if not module_names:
            module_names = ['steps']

        path = os.path.abspath(path)

        for module_name in module_names:
            mod = self.modules.get((path, module_name))

            if mod is None:
                #log.debug("Looking for step def module '%s' in %s" % (module_name, path))
                cwd = os.getcwd()
                if cwd not in sys.path:
                    sys.path.append(cwd)

                try:
                    actual_module_name = os.path.basename(module_name)
                    complete_path = os.path.join(path, os.path.dirname(module_name))
                    info = imp.find_module(actual_module_name, [complete_path])
                except ImportError:
                    #log.debug("Did not find step defs module '%s' in %s" % (module_name, path))
                    return
                
                try:
                    # Modules have to be loaded with unique names or else problems arise
                    mod = imp.load_module("stepdefs_" + str(self.module_counter), *info)
                except:
                    exc = sys.exc_info()
                    raise StepImplLoadException(exc)

                self.module_counter += 1
                self.modules[(path, module_name)] = mod

            for item_name in dir(mod):
                item = getattr(mod, item_name)
                if isinstance(item, StepImpl):
                    registry.add_step(item.step_type, item)
                elif isinstance(item, HookImpl):
                    registry.add_hook(item.cb_type, item)
                elif isinstance(item, NamedTransformImpl):
                    registry.add_named_transform(item)
                elif isinstance(item, TransformImpl):
                    registry.add_transform(item)
515533
def get_project_name():
    
    setup_py_content = helpers.get_file_content('setup.py')
    ret = helpers.value_of_named_argument_in_function(
        'name', 'setup', setup_py_content, resolve_varname=True
    )
    if ret and ret[0] == ret[-1] in ('"', "'"):
        ret = ret[1:-1]
    return ret