Lines Matching refs:self

19     def __init__(self, func):
20 self.func = func
21 self.cache = {}
23 def __call__(self, *args):
25 return self.cache[args]
27 result = self.func(*args)
28 self.cache[args] = result
349 def __init__(self):
360 tmp_fd, self.tmp_path = tempfile.mkstemp(
366 self.tmp_file = os.fdopen(tmp_fd, "wb")
369 os.unlink(self.tmp_path)
372 def __getattr__(self, attrname):
373 # Delegate everything else to self.tmp_file
374 return getattr(self.tmp_file, attrname)
376 def close(self):
379 self.tmp_file.close()
383 same = filecmp.cmp(self.tmp_path, filename, False)
391 os.unlink(self.tmp_path)
407 os.chmod(self.tmp_path, 0o666 & ~umask)
413 os.rename(self.tmp_path, filename)
416 os.unlink(self.tmp_path)
419 def write(self, s):
420 self.tmp_file.write(s.encode("utf-8"))
521 def __init__(self, iterable=None):
522 self.end = end = []
524 self.map = {} # key --> [key, prev, next]
526 self |= iterable
528 def __len__(self):
529 return len(self.map)
531 def __contains__(self, key):
532 return key in self.map
534 def add(self, key):
535 if key not in self.map:
536 end = self.end
538 curr[2] = end[1] = self.map[key] = [key, curr, end]
540 def discard(self, key):
541 if key in self.map:
542 key, prev_item, next_item = self.map.pop(key)
546 def __iter__(self):
547 end = self.end
553 def __reversed__(self):
554 end = self.end
561 def pop(self, last=True): # pylint: disable=W0221
562 if not self:
564 key = self.end[1][0] if last else self.end[2][0]
565 self.discard(key)
568 def __repr__(self):
569 if not self:
570 return f"{self.__class__.__name__}()"
571 return f"{self.__class__.__name__}({list(self)!r})"
573 def __eq__(self, other):
575 return len(self) == len(other) and list(self) == list(other)
576 return set(self) == set(other)
579 def update(self, iterable):
581 if i not in self:
582 self.add(i)
588 def __init__(self, nodes):
589 self.nodes = nodes
591 def __str__(self):
592 return "CycleError: cycle involving: " + str(self.nodes)