Strip name of builtin module from start of name.
438529
def _remove_builtin_prefix(name):
    """"""
    if name.startswith('builtins.'):
        return name[len('builtins.'):]
    elif name.startswith('__builtin__.'):
        return name[len('__builtin__.'):]
    return name
1096796
def get_module_name(self, path_args):
        """"""
        controller_prefix = self.controller_prefix
        cset = self.module_names
        module_name = controller_prefix
        mod_name = module_name
        while path_args:
            mod_name += "." + path_args[0]
            if mod_name in cset:
                module_name = mod_name
                path_args.pop(0)
            else:
                break

        return module_name, path_args
1128824
function stripLoaderPrefix(str) {
	if (typeof str === 'string') {
		str = str.replace(
			/(?:(\()|(^|\b|@))(\.\/~|\.{0,2}\/(?:[^\s]+\/)?node_modules)\/\w+-loader(\/[^?!]+)?(\?\?[\w_.-]+|\?({[\s\S]*?})?)?!/g,
			'$1'
		);
		str = str.replace(/(\.?\.?(?:\/[^/ ]+)+)\s+\(\1\)/g, '$1');
		str = replaceAll(str, process.cwd(), '.');
		return str;
	}
	return str;
}
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
1352579
def name(value, known_modules=[]):
    ''''''
    if value is None:
        return 'None'
    if not isinstance(value, type):  # Get the class name first
        value = type(value)
    tname = value.__name__
    if hasattr(builtins, tname):
        return tname
    modname = value.__module__
    if modname == '__main__':
        return tname
    if known_modules and modname in known_modules:
        return tname
    for kmod in known_modules:
        if not kmod:
            continue
        module = importlib.import_module(kmod)
        if hasattr(module, tname):
            return tname
    return '{}.{}'.format(modname, tname)
893172
def _get_module_name(module):
    
    name = module.__name__[:-6] if module.__name__.endswith('Module') else module.__name__
    return name.lower()
937563
def _sanitize_windows_name(cls, arcname, pathsep):
        """"""
        table = cls._windows_illegal_name_trans_table
        if not table:
            illegal = ':<>|"?*'
            table = str.maketrans(illegal, '_' * len(illegal))
            cls._windows_illegal_name_trans_table = table
        arcname = arcname.translate(table)
        # remove trailing dots
        arcname = (x.rstrip('.') for x in arcname.split(pathsep))
        # rejoin, removing empty parts.
        arcname = pathsep.join(x for x in arcname if x)
        return arcname
1239129
def get_name(value) -> str:
    
    if value.__module__ == '__builtin__':
        return value.__name__
    else:
        return '.'.join((value.__module__, value.__name__))
789335
def qualname(thing):
    
    parts = []

    # Add the module, unless it's a builtin
    mod = inspect.getmodule(thing)
    if mod and mod.__name__ not in ('__main__', '__builtin__', 'builtins'):
        parts.append(mod.__name__)

    # If there's a __qualname__, use that
    if hasattr(thing, '__qualname__'):
        parts.append(thing.__qualname__)
        return '.'.join(parts)

    # If it's a module
    if inspect.ismodule(thing):
        return '.'.join(parts)

    # If it's a class
    if inspect.isclass(thing):
        parts.append(thing.__name__)
        return '.'.join(parts)

    # If it's a function
    if isinstance(thing, (types.FunctionType, types.MethodType)):
        # If it's a method or function
        if inspect.ismethod(thing):
            if thing.im_class is type:
                # This is a class method
                parts.append(thing.im_self.__name__)
            else:
                # This is an bound/instance method
                parts.append(thing.im_class.__name__)
            parts.append(thing.__name__)

        elif inspect.isfunction(thing):
            parts.append(thing.__name__)

        return '.'.join(parts)

    # It's an instance, so ... let's call repr on it
    return repr(thing)
1307526
def _clean_up_name(self, name):
        
        for n in self.naughty: name = name.replace(n, '_')
        return name
946395
def _get_module_name_from_fname(fname):
    """"""
    fname = fname.replace(".pyc", ".py")
    for mobj in sys.modules.values():
        if (
            hasattr(mobj, "__file__")
            and mobj.__file__
            and (mobj.__file__.replace(".pyc", ".py") == fname)
        ):
            module_name = mobj.__name__
            return module_name
    raise RuntimeError("Module could not be found")
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)
644529
def source_debianize_name(name):
    ""
    name = name.replace('_','-')
    name = name.replace('.','-')
    name = name.lower()
    return name
178917
def _process_name(name):
    """"""

    # Unescape HTML entities
    name = unescape(name)

    # Remove bracketed stuff on the end
    name = NG_RE.sub('', name).strip()  # Nomenclature groups
    name = END_RE.sub('', name).strip(', ')  # Words
    name = RATIO_RE.sub('', name).strip(', ')  # Ratios

    # Remove stuff off start
    name = START_RE.sub('', name).strip()

    # Remove balanced start and end brackets if none in between
    name = BRACKET_RE.sub('\g<1>', name)

    # Un-invert CAS style names
    comps = name.split(', ')
    if len(comps) == 2:
        if comps[1].endswith('-'):
            name = comps[0]
            name = '%s%s' % (comps[1], name)
    elif len(comps) > 2:
        name = comps[0]
        for i in range(1, len(comps)):
            if comps[i].endswith('-'):
                name = '%s%s' % (comps[i], name)
            else:
                name = '%s %s' % (name, comps[i])
    return name
1052348
def fully_qualified_name(obj, sep='.'):
    """"""
    if inspect.isclass(obj):
        return obj.__module__ + sep + obj.__name__
    else:
        return obj.__module__ + sep + obj.__class__.__name__
1092826
def mark_module_reloadable(self, module_name):
        """"""
        try:
            del self.skip_modules[module_name]
        except KeyError:
            pass
        self.modules[module_name] = True
558102
def remove_value(self, name):
        """"""
        code = u"get_ipython().kernel.remove_value('%s')" % name
        if self._reading:
            self.kernel_client.input(u'!' + code)
        else:
            self.silent_execute(code)