Skip to content

Commit

Permalink
linter. fix offset update in blobdict
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbueno committed Sep 17, 2024
1 parent 3611648 commit 3d48d20
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
20 changes: 20 additions & 0 deletions extradict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@

__author__ = "João S. O. Bueno"
__version__ = "0.7.0beta1"


__all__ = [
"VersionDict",
"OrderedVersionDict",
"FallbackNormalizedDict",
"NormalizedDict",
"MapGetter",
"BijectiveDict",
"namedtuple",
"defaultnamedtuple",
"fastnamedtuple",
"TreeDict",
"Grouper",
"NestedData",
"PrefixTrie",
"Trie",
"NormalizedTrie",
"BlobTextDict",
]
4 changes: 2 additions & 2 deletions extradict/binary_tree_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def insert(self, key, value=_empty, replace=True):
return
try:
target_str = "left" if new_key < self_key else "right"
except TypeError as error:
except TypeError:
raise KeyError(
f"{key!r} {'was converted to ' if type(key) != type(new_key) else 'has'}type {type(new_key)} and cant't be compared with {type(self_key)} "
)
Expand All @@ -120,7 +120,7 @@ def get(self, key):
return self
try:
new_key_smaller = new_key < self_key
except TypeError as error:
except TypeError:
raise KeyError(f"{key} type incompatible with other keys in the tree")

if new_key_smaller:
Expand Down
4 changes: 2 additions & 2 deletions extradict/blobdict.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import UserDict
from collections.abc import MutableSet
from collections.abc import MutableSet, Iterable
from threading import RLock

import math
Expand Down Expand Up @@ -30,7 +30,7 @@ def __len__(self):

def add(self, item):
self.data.add(item)
new_offset = self.parent._store(self.offset, self.data)
self.offset = self.parent._store(self.offset, self.data)

def discard(self, item):
self.data.discard(item)
Expand Down
2 changes: 1 addition & 1 deletion extradict/grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ def __call__(self, keyhint: T.Container[str] = ()) -> dict[T.Hashable, list[T.an
return result

def __repr__(self):
return f"Grouper by {sentinel.__name__}"
return f"Grouper by {self.key}"
2 changes: 0 additions & 2 deletions extradict/map_getter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import sys
import threading

from collections import defaultdict

_sentinel = object()


Expand Down
1 change: 0 additions & 1 deletion extradict/normalized_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def __init__(self, *args, **kw):
self._update(self.literal)

def _update(self, data):
normalized = self.normalized
for key, value in data.items():
self._setitem(key, value)

Expand Down
1 change: 0 additions & 1 deletion extradict/trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def add(self, key):
"PatternCharTrie cannot add new final values having a selected pattern"
)

pattern = ""
with self.lock:
for i in range(len(key)):
self._subpattern_add(
Expand Down

0 comments on commit 3d48d20

Please sign in to comment.