Skip to content

Commit

Permalink
[WIP] fixing linter horde
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbueno committed Sep 17, 2024
1 parent 3d48d20 commit 8cc20d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion extradict/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TransformKeyDict(Mapping):
"""

transform = lambda s, key: key
transform = lambda s, key: key # noqa

def __getitem__(self, key):
return self.transform(key)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repository = "https://github.com/jsbueno/extradict"
dev = [
"pytest",
"black",
"pyflakes",
"flake8",
"pytest-coverage",
]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_bijective.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_bijective_works():

def test_bijective_dict_raises_on_unhashable_value():
with pytest.raises(TypeError):
a = BijectiveDict["a"] = []
BijectiveDict["a"] = []


def test_bijective_changes_reciprocal_value_on_assignement():
Expand Down
22 changes: 12 additions & 10 deletions tests/test_map_getter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa

import enum
import threading

Expand All @@ -20,21 +22,21 @@ def test_mapgetter_can_be_used_with_key_renaming():

def test_mapgetter_can_use_any_name():
a = dict(b=1, c=2)
with MapGetter(a) as anyname:
with MapGetter(a) as anyname: # flake8: noqa
from anyname import b, c
assert b == 1 and c == 2


def test_mapgetter_can_use_existing_module_name():
a = dict(b=1, c=2)
with MapGetter(a) as math:
with MapGetter(a) as math: # NOQA
from math import b, c
assert b == 1 and c == 2


def test_regular_import_works_from_within_():
a = dict(b=1, c=2)
with MapGetter(a) as a:
with MapGetter(a) as a: # NOQA
from math import cos
assert cos

Expand All @@ -47,7 +49,7 @@ def test_mapgetter_is_thread_safe():
nonlocal_check = [False, None, None, None]

def thread_1():
with MapGetter(a) as math:
with MapGetter(a) as math: # NOQA
from math import b, c

nonlocal_check[0] = True
Expand Down Expand Up @@ -76,22 +78,22 @@ def thread_2():


def test_mapgetter_works_with_default_value():
with MapGetter(default=None) as m:
with MapGetter(default=None) as m: # NOQA
from m import n, o, p
assert n is None
assert o is None
assert p is None


def test_mapgetter_works_with_default_function_with_parameters():
with MapGetter(default=lambda name: name) as m:
with MapGetter(default=lambda name: name) as m: # NOQA
from m import foo, bar
assert foo == "foo"
assert bar == "bar"


def test_mapgetter_works_with_default_function_without_parameters():
with MapGetter(default=lambda: "baz") as m:
with MapGetter(default=lambda: "baz") as m: # NOQA
from m import foo, bar
assert foo == "baz"
assert bar == "baz"
Expand All @@ -102,7 +104,7 @@ class Defaulter(object):
def __call__(self, name):
return name

with MapGetter(default=Defaulter()) as m:
with MapGetter(default=Defaulter()) as m: # NOQA
from m import foo, bar
assert foo == "foo"
assert bar == "bar"
Expand All @@ -121,7 +123,7 @@ def __call__(self):
def test_mapgetter_works_with_defaultdict():
from collections import defaultdict

with MapGetter(defaultdict(lambda: "baz")) as m:
with MapGetter(defaultdict(lambda: "baz")) as m: # NOQA
from m import foo, bar

assert foo == "baz"
Expand All @@ -130,7 +132,7 @@ def test_mapgetter_works_with_defaultdict():

def test_mapgetter_works_with_mapping_and_default_parameter():
a = dict(b=1, c=2)
with MapGetter(a, default=lambda name: name) as a:
with MapGetter(a, default=lambda name: name) as a: # NOQA
from a import b, c, d
assert b == 1 and c == 2 and d == "d"

Expand Down

0 comments on commit 8cc20d4

Please sign in to comment.