taukit/base/metacls.py
def _getattr(self, attr):
    """Attribute lookup for composable classes."""
    components_attr = '_'+self.__class__.__name__+'__components'
    components = [
        *(getattr(self, '__components').items() if '__components' in dir(self) else []),
        *(getattr(self, components_attr).items() if components_attr in dir(self) else [])
    ]
    bases = (self.__class__, *self.__class__.__bases__)
    for base in bases:
        components_attr = '_'+base.__name__+'__components'
        components = [ *components, *getattr(base, components_attr, {}).items() ]
    for nm, component in components:
        if nm == attr:
            return component
        try:
            return getattr(component, attr)
        except AttributeError:
            pass
    cn = self.__class__.__name__
    raise AttributeError(f"'{cn}' does not have attribute '{attr}'")
Attribute lookup for composable classes.
Attribute lookup for composable classes.
Attribute lookup for composable classes .
def _getattr(self, attr):
    components_attr = '_'+self.__class__.__name__+'__components'
    components = [
        *(getattr(self, '__components').items() if '__components' in dir(self) else []),
        *(getattr(self, components_attr).items() if components_attr in dir(self) else [])
    ]
    bases = (self.__class__, *self.__class__.__bases__)
    for base in bases:
        components_attr = '_'+base.__name__+'__components'
        components = [ *components, *getattr(base, components_attr, {}).items() ]
    for nm, component in components:
        if nm == attr:
            return component
        try:
            return getattr(component, attr)
        except AttributeError:
            pass
    cn = self.__class__.__name__
    raise AttributeError(f"'{cn}' does not have attribute '{attr}'")
def _getattr ( self , attr ) : components_attr = '_' + self . __class__ . __name__ + '__components' components = [ * ( getattr ( self , '__components' ) . items ( ) if '__components' in dir ( self ) else [ ] ) , * ( getattr ( self , components_attr ) . items ( ) if components_attr in dir ( self ) else [ ] ) ] bases = ( self . __class__ , * self . __class__ . __bases__ ) for base in bases : components_attr = '_' + base . __name__ + '__components' components = [ * components , * getattr ( base , components_attr , { } ) . items ( ) ] for nm , component in components : if nm == attr : return component try : return getattr ( component , attr ) except AttributeError : pass cn = self . __class__ . __name__ raise AttributeError ( f"'{cn}' does not have attribute '{attr}'" )
Attribute lookup for composable classes.
Attribute lookup for composable classes .
"""Attribute lookup for composable classes."""
self
attr