try to match a class and load it from the graph
        NOTE: the g.get_class(pattern) method does the heavy lifting
358193
def _select_class(self, line):
        
        g = self.current['graph']
        if not line:
            out = g.all_classes
            using_pattern = False
        else:
            using_pattern = True
            if line.isdigit():
                line = int(line)
            out = g.get_class(line)
        if out:
            if type(out) == type([]):
                choice = self._selectFromList(out, using_pattern, "class")
                if choice:
                    self.currentEntity = {'name': choice.locale or choice.uri,
                                          'object': choice, 'type': 'class'}
            else:
                self.currentEntity = {'name': out.locale or out.uri, 'object': out, 'type': 'class'}
            # ..finally:
            if self.currentEntity:
                self._print_entity_intro(entity=self.currentEntity)

        else:
            print("not found")
529865
def get_subclass(cls, name):
        
        for subclass in cls.__subclasses__():
            if subclass.name == name:
                return subclass
        raise NameError("Not a valid Benchmark class: " + name)
889129
def load_class(full_class_string, verbose=False, silent=False):
    
    if not isinstance(full_class_string, str):
        if not silent:
            print("Error, loadClass: input not a string: %s" % str(full_class_string))
        return None
    if len(full_class_string) == 0:  # pylint: disable=len-as-condition
        if not silent:
            print("Error, loadClass: empty string")
        return None
    class_data = full_class_string.split(".")
    module_path = ".".join(class_data[:-1])
    class_str = class_data[-1]
    try:
        module_ = importlib.import_module(module_path)
        # Finally, we retrieve the Class
        return getattr(module_, class_str)
    except AttributeError:
        return None
    except Exception:
        raise
722033
def load_class(module_name, class_name):
    
    try:
        plugmod = import_module(module_name)
    except Exception as exc:
        warn("Importing built-in plugin %s.%s raised an exception: %r" %
             (module_name, class_name, repr(exc)), ImportWarning)
        return None
    else:
        return getattr(plugmod, class_name)
987732
def parse(cls, gvid, exception=True):
        

        if gvid == 'invalid':
            return cls.get_class('null')(0)

        if not bool(gvid):
            return None

        if not isinstance(gvid, six.string_types):
            raise TypeError("Can't parse; not a string. Got a '{}' ".format(type(gvid)))

        try:
            if not cls.sl:
                # Civick and ACS include the SL, so can call from base type.
                if six.PY3:
                    fn = cls.decode
                else:
                    fn = cls.decode.__func__

                sl = fn(gvid[0:cls.sl_width])
            else:
                sl = cls.sl  # Otherwise must use derived class.

        except ValueError as e:
            if exception:
                raise ValueError("Failed to parse gvid '{}': {}".format(gvid, str(e)))
            else:
                return cls.get_class('null')(0)

        try:
            cls = cls.sl_map[sl]
        except KeyError:
            if exception:
                raise ValueError("Failed to parse gvid '{}': Unknown summary level '{}' ".format(gvid, sl))
            else:
                return cls.get_class('null')(0)

        m = cls.regex.match(gvid)

        if not m:
            raise ValueError("Failed to match '{}' to '{}' ".format(gvid, cls.regex_str))

        d = m.groupdict()

        if not d:
            return None

        if six.PY3:
            fn = cls.decode
        else:
            fn = cls.decode.__func__

        d = {k: fn(v) for k, v in d.items()}

        try:
            del d['sl']
        except KeyError:
            pass

        return cls(**d)
704495
def load(param):
    
    return (
        Pattern(param) if isinstance(param, str)
        else param if param is not None
        else Null()
    )
999313
def get_collection_for_cls_name(self, cls_name):
        
        for cls in self.classes:
            if cls.__name__ == cls_name:
                return self.classes[cls]['collection']
        raise AttributeError("Unknown class name: %s" % cls_name)
535082
def match(match_expr, exc_type, exc_value, exc_traceback):
    
    # Emulate standard behavior when match_expr is an exception subclass.
    if isinstance(match_expr, type) and issubclass(match_expr, BaseException):
        return issubclass(exc_type, match_expr)

    # Match on type and args when match_expr is an exception instance.
    return (
        issubclass(exc_type, type(match_expr))
        and
        match_expr.args == exc_value.args
    )
127798
@Override
    public Class<?> loadClass(String classname) throws ClassNotFoundException {
        return getClass().getClassLoader().loadClass(classname);
    }
1155973
def get_class(classname, all=False):
    
    try:
        classes = _registry[classname]
    except KeyError:
        raise RegistryError('Class with name {!r} was not found. You may need '
            'to import the class.'.format(classname))
    if len(classes) > 1:
        if all:
            return _registry[classname]
        raise RegistryError('Multiple classes with name {!r} '
            'were found. Please use the full, '
            'module-qualified path.'.format(classname))
    else:
        return _registry[classname][0]
1109863
@SuppressWarnings("unchecked")
    public Class<Object> matchCaller(String className) {
        // Walk the stack backwards to find the calling class: don't
        // want to use Class.forName, because we want the class as loaded
        // by it's original classloader
        Class<Object> stack[] = (Class<Object>[]) this.getClassContext();
        for (Class<Object> bClass : stack) {
            // See if any class in the stack contains the following string
            if (bClass.getName().equals(className))
                return bClass;
        }

        return null;
    }
1188053
public static Class<?> loadClass(String classname, DataFormat<?> dataFormat) {

    // first try context classoader
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if(cl != null) {
      LOG.tryLoadingClass(classname, cl);
      try {
        return cl.loadClass(classname);
      }
      catch(Exception e) {
        // ignore
      }
    }

    // else try the classloader which loaded the dataformat
    cl = dataFormat.getClass().getClassLoader();
    try {
      LOG.tryLoadingClass(classname, cl);
      return cl.loadClass(classname);
    }
    catch (ClassNotFoundException e) {
      throw LOG.classNotFound(classname, e);
    }

  }
1362710
public MatchInfo getCtlMatchInfo(final String className) {
    MatchInfo match = cache.get(className);
    if (null == match) {
      match = getMatchInfo(patternSegs, className);
      if (-1 != match.startIndex) {
        cache.put(className, match);
      }
    }
    return match;
  }
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)
31281
def get_suitable_vis_classes(obj):
    """"""

    ret = []
    for class_ in classes_vis():
        if isinstance(obj, class_.input_classes):
            ret.append(class_)
    return ret
1129179
def lookup_class(fully_qualified_name):
    
    module_name, class_name = str(fully_qualified_name).rsplit(".", 1)
    module = __import__(module_name, globals(), locals(), [class_name], 0)
    Class = getattr(module, class_name)

    if not inspect.isclass(Class):
        raise TypeError(
            "%s is not of type class: %s" % (class_name, type(Class)))

    return Class
1224587
def getIndex(self, indexName, indexClass):
        """"""
        if indexClass == "vertex":
            try:
                return Index(indexName, indexClass, "manual",
                        self.neograph.nodes.indexes.get(indexName))
            except client.NotFoundError:
                return None
        elif indexClass == "edge":
            try:
                return Index(indexName, indexClass, "manual",
                        self.neograph.relationships.indexes.get(indexName))
            except client.NotFoundError:
                return None
        else:
            raise KeyError("Unknown Index Class (%s). Use vertex or edge"\
                    % indexClass)