Skip to content

Commit c041ba4

Browse files
authored
Fix flask8 version 6.1.0 validation errors (#61)
1 parent 66e9b3a commit c041ba4

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ repos:
1616
- id: check-added-large-files
1717

1818
- repo: https://github.com/PyCQA/flake8
19-
rev: 6.0.0
19+
rev: 6.1.0
2020
hooks:
2121
- id: flake8
2222

2323
- repo: https://github.com/psf/black
24-
rev: 23.3.0
24+
rev: 23.7.0
2525
hooks:
2626
- id: black
2727

2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: v1.4.0
29+
rev: v1.4.1
3030
hooks:
3131
- id: mypy
3232

src/coherence/extractor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def compose(self, before: ValueExtractor[T, E]) -> ValueExtractor[T, E]:
3737
"""
3838
if before is None:
3939
raise ValueError("before cannot be null")
40-
if type(before) == ValueExtractor:
40+
if type(before) == ValueExtractor: # noqa: E721
4141
return before.and_then(self)
4242
else:
4343
return ChainedExtractor([before, self])
@@ -53,7 +53,7 @@ def and_then(self, after: ValueExtractor[T, E]) -> ValueExtractor[T, E]:
5353
"""
5454
if after is None:
5555
raise ValueError("after cannot be null")
56-
if type(after) == ChainedExtractor:
56+
if type(after) == ChainedExtractor: # noqa: E721
5757
return ChainedExtractor([self, after])
5858
else:
5959
return after.compose(self)
@@ -129,7 +129,7 @@ def __init__(self, extractors_or_method: str | Sequence[ValueExtractor[T, Any]])
129129
sequence of method names which results in a ChainedExtractor that is based on an array of corresponding
130130
:class:`coherence.extractor.UniversalExtractor` objects
131131
"""
132-
if type(extractors_or_method) == str:
132+
if type(extractors_or_method) == str: # noqa: E721
133133
e = list()
134134
names = extractors_or_method.split(".")
135135
for name in names:
@@ -152,7 +152,7 @@ def __init__(self, extractors_or_method: str | Sequence[ValueExtractor[Any, Any]
152152
sequence of method names which results in a ChainedExtractor that is based on an array of corresponding
153153
:class:`coherence.extractor.UniversalExtractor` objects
154154
"""
155-
if type(extractors_or_method) == str:
155+
if type(extractors_or_method) == str: # noqa: E721
156156
e = list()
157157
names = extractors_or_method.split(",")
158158
for name in names:

src/coherence/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, extractor: ExtractorExpression[T, E]):
7979
super().__init__()
8080
if isinstance(extractor, ValueExtractor):
8181
self.extractor = extractor
82-
elif type(extractor) == str:
82+
elif isinstance(extractor, str):
8383
self.extractor = Extractors.extract(extractor)
8484
else:
8585
raise ValueError("extractor cannot be any other type")

src/coherence/processor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, value_extractor: ExtractorExpression[V, R]):
9494
else:
9595
if isinstance(value_extractor, ValueExtractor):
9696
self.extractor = value_extractor
97-
elif type(value_extractor) == str:
97+
elif isinstance(value_extractor, str):
9898
self.extractor = Extractors.extract(value_extractor)
9999
else:
100100
raise ValueError("value_extractor cannot be any other type")
@@ -233,7 +233,7 @@ def __init__(
233233
:param post_multiplication: pass true to return the value as it was before it was multiplied, or pass false
234234
to return the value as it is after it is multiplied
235235
"""
236-
if type(name_or_manipulator) == str:
236+
if isinstance(name_or_manipulator, str):
237237
manipulator: ValueManipulator[Any, Numeric] = self.create_custom_manipulator(name_or_manipulator)
238238
super().__init__(manipulator)
239239
else:
@@ -266,7 +266,7 @@ def __init__(self, name_or_manipulator: ManipulatorExpression, increment: Numeri
266266
:param post_increment: pass `True` to return the value as it was before it was incremented, or pass `False`
267267
to return the value as it is after it is incremented
268268
"""
269-
if type(name_or_manipulator) == str:
269+
if isinstance(name_or_manipulator, str):
270270
manipulator: ValueManipulator[Any, Numeric] = self.create_custom_manipulator(name_or_manipulator)
271271
super().__init__(manipulator)
272272
else:
@@ -477,7 +477,7 @@ def __init__(self, updater_or_property_name: UpdaterExpression[V, bool], value:
477477
:param value: the value to update the target entry with
478478
"""
479479
super().__init__()
480-
if type(updater_or_property_name) == str:
480+
if type(updater_or_property_name) == str: # noqa: E721
481481
self.updater: ValueUpdater[V, bool]
482482
if updater_or_property_name.find(".") == -1:
483483
self.updater = UniversalUpdater(updater_or_property_name)

src/coherence/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def serialize(self, obj: object) -> bytes:
7474
return b
7575

7676
def deserialize(self, value: bytes) -> T: # type: ignore
77-
if type(value) == bytes:
77+
if isinstance(value, bytes):
7878
s = value.decode()
7979
if value.__len__() == 0: # empty string
8080
return cast(T, None)

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async def test_get_and_put(setup_and_teardown: NamedCache[str, str | int | Perso
8989
v2: Person = Person.andy()
9090
await cache.put(k2, v2)
9191
r = await cache.get(k2)
92-
assert type(r) == Person
92+
assert isinstance(r, Person)
9393
assert r.name == k2
9494
assert r.address.city == Person.andy().address.city
9595

@@ -460,7 +460,7 @@ async def test_invoke(setup_and_teardown: NamedCache[str, str | Person]) -> None
460460
r4: str = await cache.invoke(k3, ExtractorProcessor(UniversalExtractor("name")))
461461
assert r4 == k3
462462
r5: Address = await cache.invoke(k3, ExtractorProcessor(UniversalExtractor("address")))
463-
assert type(r5) == Address
463+
assert isinstance(r5, Address)
464464
assert r5.zipcode == v3.address.zipcode
465465
r6: int = await cache.invoke(k3, ExtractorProcessor(ChainedExtractor("address.zipcode")))
466466
assert r6 == v3.address.zipcode

tests/test_processors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def test_extractor(setup_and_teardown: NamedCache[Any, Any]) -> None:
5555
r = await cache.invoke(k3, Processors.extract("name"))
5656
assert r == k3
5757
r = await cache.invoke(k3, Processors.extract("address"))
58-
assert type(r) == Address
58+
assert isinstance(r, Address)
5959
assert r.zipcode == v3.address.zipcode
6060
r = await cache.invoke(k3, Processors.extract("address.zipcode"))
6161
assert r == v3.address.zipcode

0 commit comments

Comments
 (0)