def __setitem__(self, key, value): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: self.__map[key] = link = _Link() root = self.__root last = root.prev link.prev, link.next, link.key = last, root, key last.next = root.prev = _proxy(link) dict.__setitem__(self, key, value)
def __init__(self, *args, **kwds): if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self._OrderedDict__root except AttributeError: self._OrderedDict__hardroot = _Link() self._OrderedDict__root = root = _proxy(self._OrderedDict__hardroot) root.prev = root.next = root self._OrderedDict__map = {} self._OrderedDict__update(*args, **kwds)
def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__hardroot = _Link() self.__root = root = _proxy(self.__hardroot) root.prev = root.next = root self.__map = {} self.__update(*args, **kwds)
def __init__(self, receiver, number): assert receiver self.receiver = _proxy(receiver) assert number > 0 and number <= receiver.max_devices self.number = number self._unifying = receiver.max_devices > 1 self._protocol = None self._wpid = None self._power_switch = None self._polling_rate = None self._codename = None self._name = None self._kind = None self._serial = None self._firmware = None self._keys = None self.features = _hidpp20.FeaturesArray(self) if self._unifying else None self._registers = None self._settings = None
def add_parent(self_, parent): self_.parent = _proxy(parent)
def wrapper_setattr(self_, key, value): if inspect.isfunction(value): self_.__dict__[key] = _proxy(value) else: self_.__dict__[key] = value
def __init__(self, device, count): assert device is not None self.device = _proxy(device) self.keys = [None] * count
def __init__(self, device): assert device is not None self.device = _proxy(device) self.supported = True self.features = None
def __call__(self, device): o = _copy(self) o._value = None o._device = _proxy(device) return o