Esempio n. 1
0
 def __init__(self, obj=None):
     # type: (T) -> None
     if obj is None:
         self.__ref = _ref(
             type("Dead", (object, ), {"__slots__": ("__weakref__", )})())
     else:
         self.__ref = _ref(obj)
Esempio n. 2
0
    def __init__(self, data=None, dataset=None):
        '''Initializes a data row with data and a dataset, from which
        it gets the fields and other important information and to
        which it keeps a weak reference.

        In many ways, this is supposed to look like a non-mutable
        list, except you can index it also on field names (if the
        dataset is provided).

        >>> row = DataRow(('Eric', 'Rochester', 31))
        >>> row.fields = ('fname', 'lname', 'age')
        >>> row[0]
        'Eric'
        >>> row['age']
        31

        '''
        if data:
            self.data = tuple(data)
        else:
            self.data = ()

        if dataset:
            self.dataset = _ref(dataset)
            self.fields = dataset.fields
        else:
            self.dataset = lambda: None
            self.fields = ()
Esempio n. 3
0
    def __init__(self, ty, svc, handler):
        if not self.is_validate_handler_type(ty):
            raise llbc.error('invalidate handler type: {}'.format(ty))
        elif svc is None or (handler is None or not callable(handler)):
            raise llbc.error('service[{}] invalidate or handler[{}] invalidate'.format(svc, handler))

        self._ty = ty
        self._svc = _ref(svc)
        self._handler = handler
Esempio n. 4
0
    def __init__(self, ty, svc, handler):
        if not self.is_validate_handler_type(ty):
            raise llbc.error('invalidate handler type: {}'.format(ty))
        elif svc is None or (handler is None or not callable(handler)):
            raise llbc.error(
                'service[{}] invalidate or handler[{}] invalidate'.format(
                    svc, handler))

        self._ty = ty
        self._svc = _ref(svc)
        self._handler = handler
Esempio n. 5
0
 def __init__(self, obj):
     self.__component_list = ComponentList()
     self.__obj = _ref(obj)
     self.__original_methods = {}
Esempio n. 6
0
 def __init__(self, obj):
     self.__component_list = ComponentList()
     self.__obj = _ref(obj)
     self.__original_methods = {}