Get a python class object from its name
16273
def class_from_string(name):
    '''
    
    '''
    module_name, class_name = name.rsplit('.', 1)
    __import__(module_name)
    module = sys.modules[module_name]
    return getattr(module, class_name)
1217747
def fetch_class(full_class_name):
    
    (module_name, class_name) = full_class_name.rsplit('.', 1)
    module = importlib.import_module(module_name)
    return getattr(module, class_name)
617976
def load_object_by_name(object_name):
    """"""
    mod_name, attr = object_name.rsplit('.', 1)
    mod = import_module(mod_name)
    return getattr(mod, attr)
708921
def get_class_by_name!(name , super_class = :Object)
      c = get_class_by_name(name)
      return c if c
      create_class( name ,super_class)
    end
1173378
def _get_object(objname, objtype):
    '''
    
    '''
    ret = None
    if objname is None:
        return ret

    if isinstance(objname, string_types):
        if objname in __opts__:
            ret = __opts__[objname]
        master_opts = __pillar__.get('master', {})
        if objname in master_opts:
            ret = master_opts[objname]
        if objname in __pillar__:
            ret = __pillar__[objname]
    elif isinstance(objname, objtype):
        ret = objname

    if not isinstance(ret, objtype):
        ret = None

    return ret
785929
def get_qualified_name(_object):
    """"""
    module = _object.__module__
    if hasattr(_object, '__name__'):
        _class = _object.__name__

    else:
        _class = _object.__class__.__name__

    return module + '.' + _class
336030
def named_object(name):
    """"""
    name_parts = name.split('.')
    module = named_module('.'.join(name_parts[:-1]))
    return getattr(module, name_parts[-1])
1240858
def _isdictclass(obj):
    '''
    '''
    c = getattr(obj, '__class__', None)
    return c and c.__name__ in _dict_classes.get(c.__module__, ())
637545
def obj_classes_from_module(module):
    """"""
    for name in dir(module):
        if not name.startswith('_'):
            cls = getattr(module, name)
            if getattr(cls, 'classID', None):
                yield (name, cls)
391948
def GetParserObjectByName(cls, parser_name):
    
    parser_class = cls._parser_classes.get(parser_name, None)
    if parser_class:
      return parser_class()
    return None
490814
def _import_class(self, module2cls):
        """"""
        d = module2cls.rfind(".")
        classname = module2cls[d + 1: len(module2cls)]
        m = __import__(module2cls[0:d], globals(), locals(), [classname])
        return getattr(m, classname)
1245639
def load_from_object(self, object_name):
        
        for key in dir(object_name):
            if key.isupper():
                self[key] = getattr(object_name, key)
1039791
def from_object(updates):
    ""
    import sys
    config = sys.modules[__name__]
    
    prefix = config.__name__.split('.')[0].upper()
    keys = [k for k in config.__dict__ if \
        k != from_object.__name__ and not k.startswith('_')]
    get_value = lambda c, k: hasattr(c, k) and getattr(c, k) or None
    for key in keys:
        prefix_key = '%s_%s' % (prefix, key)
        value = get_value(updates, prefix_key) or get_value(updates, key)
        if value: setattr(config, key, value)
727988
def load_object(name):
    """"""

    if "." not in name:
        raise Exception('load object need module.object')

    module_name, object_name = name.rsplit('.', 1)
    if six.PY2:
        module = __import__(module_name, globals(), locals(), [utf8(object_name)], -1)
    else:
        module = __import__(module_name, globals(), locals(), [object_name])
    return getattr(module, object_name)
325193
def import_object_by_string(namespace):
    """"""
    segments = namespace.split('.')
    module = importlib.import_module('.'.join(segments[:-1]))
    return getattr(module, segments[-1])
317433
def extract_class(jar, name):
    

    with jar.open(name) as entry:
        return LinkableClass(javatools.unpack_class(entry))
1004538
def load_class(full_class_string):
    
    class_parts = full_class_string.split(".")
    module_path = ".".join(class_parts[:-1])
    class_name = class_parts[-1]

    module = importlib.import_module(module_path)

    return getattr(module, class_name)