Get a class from it's full path.

    Example:

    some.path.module.MyClass
199774
def get_class_from_settings_full_path(settings_key):
    
    cls_path = getattr(settings, settings_key, None)

    if not cls_path:
        raise NotImplementedError()

    try:
        module_name, class_name = cls_path.rsplit('.', 1)
    except ValueError:
        raise ImproperlyConfigured("{0} must be of the form "
                                   "'some.path.module.MyClass'".format(
                                                                settings_key))

    manager_module = importlib.import_module(module_name)

    if not manager_module:
        raise ImproperlyConfigured("{0} refers to a module that has not been "
                                   "installed".format(settings_key))

    return getattr(manager_module, class_name)
469295
def _load_module(path):
    ''

    module_name = os.path.splitext(os.path.basename(path))[0]

    module = None
    if sys.version_info.minor < 5:
        loader = importlib.machinery.SourceFileLoader(module_name, path)
        module = loader.load_module()
    else:
        spec = importlib.util.spec_from_file_location(module_name, path)
        module = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(module)

    return module
30053
def import_class(import_str):
    """"""
    mod_str, _sep, class_str = import_str.rpartition('.')
    try:
        __import__(mod_str)
        return getattr(sys.modules[mod_str], class_str)
    except (ValueError, AttributeError):
        raise ImportError('Class %s cannot be found (%s)' %
                          (class_str,
                           traceback.format_exception(*sys.exc_info())))
1210674
def path_from_pythonpath(pythonpath):
    """"""
    path = fs.Path()
    for p in pythonpath.split(os.pathsep):
        path.add_path(utils.expand_path(p), 'os')
    return path
719083
def get_finder(import_path):
    """"""
    finder_class = import_string(import_path)
    if not issubclass(finder_class, BaseProcessesFinder):
        raise ImproperlyConfigured(
            'Finder "{}" is not a subclass of "{}"'.format(finder_class, BaseProcessesFinder))
    return finder_class()
520221
def _get_class_path(self, klass_or_instance):
        
        if inspect.isclass(klass_or_instance):
            klass = '{}.{}'.format(klass_or_instance.__module__, klass_or_instance.__name__)
        elif not isinstance(klass_or_instance, str):
            klass = klass_or_instance.__class__
            klass = '{}.{}'.format(klass.__module__, klass.__name__)
        else:
            klass = klass_or_instance

        return klass
846277
def find_module(cls, fullname, path=None):
        
        spec = cls.find_spec(fullname, path)
        if spec is None:
            return None
        elif spec.loader is None and spec.submodule_search_locations:
            # Here we need to create a namespace loader to handle namespaces since python2 doesn't...
            return NamespaceLoader2(spec.name, spec.submodule_search_locations)
        else:
            return spec.loader
442698
def for_name(modpath, classname):
    '''
    
    '''
    module = __import__(modpath, fromlist=[classname])
    classobj = getattr(module, classname)
    return classobj()
442519
def get_object(self, path):
        """"""
        key = self.native_container.get_key(path)
        return self.obj_cls.from_key(self, key)
1077516
def classes_from_path(dir_path)
      Dir["#{dir_path}/*.rb"].sort.inject({ }) do |memo, file_path|
        klass = File.basename(file_path, '.rb').camelize.constantize

        if !memo[klass.kind].nil?
          raise "Kind #{klass.kind} already used by class #{memo[klass.kind]} so can't use it for class #{klass}"
        end

        memo[klass.kind] = klass

        memo
      end
    end
458599
def import_by_path(path: str) -> Callable:
    

    module_path, _, class_name = path.rpartition('.')
    return getattr(import_module(module_path), class_name)
270677
def get_path(self, path):
        
        mapping = self.get_path_mapping(path)
        return self.path_class(api=self, path=path, mapping=mapping)
1027483
def import_from_path(path):
    
    module_name, class_name = path.rsplit('.', 1)
    try:
        return getattr(__import__(module_name, fromlist=[class_name]), class_name)
    except AttributeError:
        raise ImportError('Unable to import %s' % path)
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
1029041
def get_class(import_path=None):
    
    from django.core.exceptions import ImproperlyConfigured
    if import_path is None:
        raise ImproperlyConfigured('No class path specified.')
    try:
        dot = import_path.rindex('.')
    except ValueError:
        raise ImproperlyConfigured("%s isn't a module." % import_path)
    module, classname = import_path[:dot], import_path[dot+1:]
    try:
        mod = import_module(module)
    except ImportError as e:
        raise ImproperlyConfigured('Error importing module %s: "%s"' % (module, e))
    try:
        return getattr(mod, classname)
    except AttributeError:
        raise ImproperlyConfigured('Module "%s" does not define a "%s" class.' % (module, classname))
275259
def import_class(import_path, setting_name=None):
    
    mod_name, class_name = import_path.rsplit('.', 1)

    # import module
    mod = import_module_or_none(mod_name)
    if mod is not None:
        # Loaded module, get attribute
        try:
            return getattr(mod, class_name)
        except AttributeError:
            pass

    # For ImportError and AttributeError, raise the same exception.
    if setting_name:
        raise ImproperlyConfigured("{0} does not point to an existing class: {1}".format(setting_name, import_path))
    else:
        raise ImproperlyConfigured("Class not found: {0}".format(import_path))
1163589
def full_path(self):
        """"""

        if self.parent:
            return os.path.join(self.parent.full_path, self.name)
        return self.name