Return the python representation of the class represented by this object
978516
def as_python(self, name: str) -> str:
        
        if self._map_valuetype:
            return self.map_as_python(name)
        else:
            return self.obj_as_python(name)
449660
def get_class(cls, name_or_sl):
        """"""
        try:
            return cls.sl_map[int(name_or_sl)]

        except TypeError as e:
            raise TypeError("Bad name or sl: {} : {}".format(name_or_sl, e))
        except ValueError:
            try:
                return cls.class_map[name_or_sl.lower()]
            except (KeyError, ValueError):
                raise NotASummaryName("Value '{}' is not a valid summary level".format(name_or_sl))
457181
def to_dict(self):
        

        input_dict = super(Add, self)._save_to_input_dict()
        input_dict["class"] = str("GPy.kern.Add")
        return input_dict
683148
def response_class(self, cls):
        
        ubq = self._clone()
        ubq._response_class = cls
        return ubq
558858
def vars_class(cls):
    
    return dict(chain.from_iterable(
        vars(cls).items() for cls in reversed(cls.__mro__)))
574453
def as_dict(self):
        
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "frequencies": list(self.frequencies),
                "densities": list(self.densities)}
561979
def repr_def_class(self, class_data):
        
        classname = self.formatted_classname(class_data["classname"])
        if classname not in self.classes:
            self.lines.append("")
            self.lines.append("class %s(%s):" % (classname, self.basename))
            
            kwargs = list()
            setattr_arguments = list()
            for attr in self._classes[classname]:
                kwargs.append("%s=None" % attr)
                setattr_arguments.append(
                    self.Tab2 + "self.%s = %s" % (attr, attr))
            if len(kwargs):
                line = self.Tab + "def __init__(self, %s):" % ", ".join(kwargs)
            else:
                line = self.Tab + "def __init__(self):"
            self.lines.append(line)
            for setattr_argument in setattr_arguments:
                self.lines.append(setattr_argument)
            if len(setattr_arguments):
                self.lines.append("")
            self.classes.add(classname)
1006612
def get_class(self, name):
        
        for i in self.classes.class_def:
            if i.get_name() == name:
                return i
        return None
871366
def as_dict(self):
        
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "element": self.symbol}
191754
def str_to_class(s):
    """"""
    lst = s.split(".")
    klass = lst[-1]
    mod_list = lst[:-1]
    module = ".".join(mod_list)
    try:
        mod = __import__(module)
        if hasattr(mod, klass):
            return getattr(mod, klass)
        else:
            return None
    except ImportError:
        return None
476621
def _get_classes_to_inspect(self):
        
        return tuple(filter(lambda c:
                      SerializableMixIn._get_version(c, require=False) or
                      (SerializableMixIn._get_serialize_fields(c) or
                       SerializableMixIn._get_interpolation_map(c)),
                      self.__class__.__mro__))
859086
def _full_class_name(obj):
    
    module = obj.__class__.__module__
    if module is None or module == str.__class__.__module__:
        return obj.__class__.__name__
    return module + "." + obj.__class__.__name__
169391
def get_model(self):
        '''
        
        '''
        class Model(object):
            def __init__(self, cnn):
                self.cnn = cnn

        return Model(self.__cnn)
1169956
def get_module_class(self):
        
        pkg, cname = self.parse_module_class()
        logger.debug(f'pkg: {pkg}, class: {cname}')
        pkg = pkg.split('.')
        mod = reduce(lambda m, n: getattr(m, n), pkg[1:], __import__(pkg[0]))
        logger.debug(f'mod: {mod}')
        if self.reload:
            importlib.reload(mod)
        cls = getattr(mod, cname)
        logger.debug(f'class: {cls}')
        return mod, cls
186849
def getPyClassDefinition(self):
        '''
        '''
        kw = KW.copy()
        
        # --> EXTENDED
        if self.hasExtPyClass():
            classInfo = self.extPyClasses[self.name]
            kw['classInfo'] = classInfo[0]
            return ["%(ID3)simport %(classInfo)s" %kw ]
        # <--
        
        kw['pyclass'] = self.getPyClass()
        definition = []
        definition.append('%(ID3)sclass %(pyclass)s:' %kw)
        if self.metaclass is not None:
            kw['type'] = self.metaclass
            definition.append('%(ID4)s__metaclass__ = %(type)s' %kw)
        definition.append('%(ID4)stypecode = self' %kw)
        
        #TODO: Remove pyclass holder __init__ -->
        definition.append('%(ID4)sdef __init__(self):' %kw)
        definition.append('%(ID5)s# pyclass' %kw)

        # JRB HACK need to call _setElements via getElements
        self._setUpElements()
        
        # JRB HACK need to indent additional one level
        for el in self.elementAttrs:
            kw['element'] = el
            definition.append('%(ID2)s%(element)s' %kw)
        definition.append('%(ID5)sreturn' %kw)
        # <--
        
        # pyclass descriptive name
        if self.name is not None:
            kw['name'] = self.name
            definition.append(\
                '%(ID3)s%(pyclass)s.__name__ = "%(name)s_Holder"' %kw
                )

        return definition
1096975
def str_def(self):
        
        return "classname={!r}; connect_retries={!r}; message={!r};". \
            format(self.__class__.__name__, self.connect_retries, self.args[0])
289498
def as_dict(self):
        
        if hasattr(self, 'cust_dict'):
            return self.cust_dict
        if hasattr(self, 'attr_check'):
            self.attr_check()
        cls_bltns = set(dir(self.__class__))
        return {a: getattr(self, a) for a in dir(self) if a not in cls_bltns}