comparison mercurial/configitems.py @ 52643:5cc8deb96b48

pyupgrade: modernize calls to superclass methods This is the `legacy` fixer in `pyupgrade`, with the loop yielding the offset of `yield` statements commented out.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 05 Jan 2025 22:23:31 -0500
parents f4733654f144
children
comparison
equal deleted inserted replaced
52642:73ab542565e0 52643:5cc8deb96b48
78 78
79 class itemregister(dict): 79 class itemregister(dict):
80 """A specialized dictionary that can handle wild-card selection""" 80 """A specialized dictionary that can handle wild-card selection"""
81 81
82 def __init__(self): 82 def __init__(self):
83 super(itemregister, self).__init__() 83 super().__init__()
84 self._generics = set() 84 self._generics = set()
85 85
86 def update(self, other): # pytype: disable=signature-mismatch 86 def update(self, other): # pytype: disable=signature-mismatch
87 super(itemregister, self).update(other) 87 super().update(other)
88 self._generics.update(other._generics) 88 self._generics.update(other._generics)
89 89
90 def __setitem__(self, key, item): 90 def __setitem__(self, key, item):
91 super(itemregister, self).__setitem__(key, item) 91 super().__setitem__(key, item)
92 if item.generic: 92 if item.generic:
93 self._generics.add(item) 93 self._generics.add(item)
94 94
95 def get(self, key): 95 def get(self, key):
96 baseitem = super(itemregister, self).get(key) 96 baseitem = super().get(key)
97 if baseitem is not None and not baseitem.generic: 97 if baseitem is not None and not baseitem.generic:
98 return baseitem 98 return baseitem
99 99
100 # search for a matching generic item 100 # search for a matching generic item
101 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) 101 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))