Skip to content

Commit

Permalink
Ran ruff --select UP
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 12, 2024
1 parent a7e7c3a commit 6c198fc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions jaraco/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def transform_key(key): # pragma: nocover
return key

def __init__(self, *args, **kargs):
super(KeyTransformingDict, self).__init__()
super().__init__()
# build a dictionary using the default constructs
d = dict(*args, **kargs)
# build this dictionary using transformed keys.
Expand All @@ -304,31 +304,31 @@ def __init__(self, *args, **kargs):

def __setitem__(self, key, val):
key = self.transform_key(key)
super(KeyTransformingDict, self).__setitem__(key, val)
super().__setitem__(key, val)

def __getitem__(self, key):
key = self.transform_key(key)
return super(KeyTransformingDict, self).__getitem__(key)
return super().__getitem__(key)

def __contains__(self, key):
key = self.transform_key(key)
return super(KeyTransformingDict, self).__contains__(key)
return super().__contains__(key)

def __delitem__(self, key):
key = self.transform_key(key)
return super(KeyTransformingDict, self).__delitem__(key)
return super().__delitem__(key)

def get(self, key, *args, **kwargs):
key = self.transform_key(key)
return super(KeyTransformingDict, self).get(key, *args, **kwargs)
return super().get(key, *args, **kwargs)

def setdefault(self, key, *args, **kwargs):
key = self.transform_key(key)
return super(KeyTransformingDict, self).setdefault(key, *args, **kwargs)
return super().setdefault(key, *args, **kwargs)

def pop(self, key, *args, **kwargs):
key = self.transform_key(key)
return super(KeyTransformingDict, self).pop(key, *args, **kwargs)
return super().pop(key, *args, **kwargs)

def matching_key_for(self, key):
"""
Expand Down Expand Up @@ -487,7 +487,7 @@ class ItemsAsAttributes:

def __getattr__(self, key):
try:
return getattr(super(ItemsAsAttributes, self), key)
return getattr(super(), key)
except AttributeError as e:
# attempt to get the value from the mapping (return self[key])
# but be careful not to lose the original exception context.
Expand Down Expand Up @@ -681,7 +681,7 @@ class BijectiveMap(dict):
"""

def __init__(self, *args, **kwargs):
super(BijectiveMap, self).__init__()
super().__init__()
self.update(*args, **kwargs)

def __setitem__(self, item, value):
Expand All @@ -695,19 +695,19 @@ def __setitem__(self, item, value):
)
if overlap:
raise ValueError("Key/Value pairs may not overlap")
super(BijectiveMap, self).__setitem__(item, value)
super(BijectiveMap, self).__setitem__(value, item)
super().__setitem__(item, value)
super().__setitem__(value, item)

def __delitem__(self, item):
self.pop(item)

def __len__(self):
return super(BijectiveMap, self).__len__() // 2
return super().__len__() // 2

def pop(self, key, *args, **kwargs):
mirror = self[key]
super(BijectiveMap, self).__delitem__(mirror)
return super(BijectiveMap, self).pop(key, *args, **kwargs)
super().__delitem__(mirror)
return super().pop(key, *args, **kwargs)

def update(self, *args, **kwargs):
# build a dictionary using the default constructs
Expand Down Expand Up @@ -773,7 +773,7 @@ class FrozenDict(collections.abc.Mapping, collections.abc.Hashable):
__slots__ = ['__data']

def __new__(cls, *args, **kwargs):
self = super(FrozenDict, cls).__new__(cls)
self = super().__new__(cls)
self.__data = dict(*args, **kwargs)
return self

Expand Down Expand Up @@ -848,7 +848,7 @@ def __init__(self, names, codes=None):
names = names.split()
if codes is None:
codes = itertools.count()
super(Enumeration, self).__init__(zip(names, codes))
super().__init__(zip(names, codes))

@property
def names(self):
Expand Down

0 comments on commit 6c198fc

Please sign in to comment.