Skip to content

Commit 739be3c

Browse files
authored
Dependencies were updated. (#354)
1 parent d6786c1 commit 739be3c

File tree

12 files changed

+709
-820
lines changed

12 files changed

+709
-820
lines changed

.flake8

Lines changed: 0 additions & 131 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ repos:
2929
pass_filenames: false
3030
types: [python]
3131
args:
32+
- "check"
3233
- "--fix"
3334
- "taskiq"
3435
- "tests"
@@ -37,4 +38,8 @@ repos:
3738
name: Validate types with MyPy
3839
entry: poetry run mypy
3940
language: system
41+
pass_filenames: false
4042
types: [python]
43+
args:
44+
- ./taskiq
45+
- ./tests

poetry.lock

Lines changed: 673 additions & 661 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ pyzmq = { version = "^23.2.0", optional = true, markers = "python_version < '3.1
4141
# For speed
4242
uvloop = { version = ">=0.16.0,<1", optional = true, markers = "sys_platform != 'win32'" }
4343
# For hot-reload.
44-
watchdog = { version = "^2.1.9", optional = true }
44+
watchdog = { version = "^4", optional = true }
4545
gitignore-parser = { version = "^0", optional = true }
4646
pytz = "*"
47-
orjson = { version = "^3.9.9", optional = true }
47+
orjson = { version = "^3", optional = true }
4848
msgpack = { version = "^1.0.7", optional = true }
49-
cbor2 = { version = "^5.4.6", optional = true }
49+
cbor2 = { version = "^5", optional = true }
5050

5151
[tool.poetry.dev-dependencies]
5252
pytest = "^7.1.2"
53-
ruff = "^0.0.291"
53+
ruff = "^0"
5454
black = { version = "^22.6.0", allow-prereleases = true }
5555
mypy = "^1"
5656
pre-commit = "^2.20.0"
@@ -120,7 +120,7 @@ build-backend = "poetry.core.masonry.api"
120120
[tool.ruff]
121121
# List of enabled rulsets.
122122
# See https://docs.astral.sh/ruff/rules/ for more information.
123-
select = [
123+
lint.select = [
124124
"E", # Error
125125
"F", # Pyflakes
126126
"W", # Pycodestyle
@@ -147,7 +147,7 @@ select = [
147147
"PL", # PyLint checks
148148
"RUF", # Specific to Ruff checks
149149
]
150-
ignore = [
150+
lint.ignore = [
151151
"D105", # Missing docstring in magic method
152152
"D107", # Missing docstring in __init__
153153
"D212", # Multi-line docstring summary should start at the first line
@@ -161,10 +161,10 @@ ignore = [
161161
"D106", # Missing docstring in public nested class
162162
]
163163
exclude = [".venv/"]
164-
mccabe = { max-complexity = 10 }
164+
lint.mccabe = { max-complexity = 10 }
165165
line-length = 88
166166

167-
[tool.ruff.per-file-ignores]
167+
[tool.ruff.lint.per-file-ignores]
168168
"tests/*" = [
169169
"S101", # Use of assert detected
170170
"S301", # Use of pickle detected
@@ -174,12 +174,12 @@ line-length = 88
174174
"D101", # Missing docstring in public class
175175
]
176176

177-
[tool.ruff.pydocstyle]
177+
[tool.ruff.lint.pydocstyle]
178178
convention = "pep257"
179179
ignore-decorators = ["typing.overload"]
180180

181-
[tool.ruff.pylint]
181+
[tool.ruff.lint.pylint]
182182
allow-magic-value-types = ["int", "str", "float"]
183183

184-
[tool.ruff.flake8-bugbear]
184+
[tool.ruff.lint.flake8-bugbear]
185185
extend-immutable-calls = ["taskiq_dependencies.Depends", "taskiq.TaskiqDepends"]

taskiq/abc/broker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ def inner(
335335
),
336336
)
337337

338-
self._register_task(decorated_task.task_name, decorated_task)
338+
self._register_task(decorated_task.task_name, decorated_task) # type: ignore
339339

340-
return decorated_task
340+
return decorated_task # type: ignore
341341

342342
return inner
343343

@@ -417,7 +417,7 @@ def add_event_handler(
417417

418418
def with_result_backend(
419419
self,
420-
result_backend: "AsyncResultBackend[_T]",
420+
result_backend: "AsyncResultBackend[Any]",
421421
) -> "Self": # pragma: no cover
422422
"""
423423
Set a result backend and return updated broker.

taskiq/kicker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ def _prepare_arg(cls, arg: Any) -> Any:
228228
if isinstance(arg, BaseModel):
229229
arg = model_dump(arg)
230230
if is_dataclass(arg):
231+
if isinstance(arg, type):
232+
raise ValueError(
233+
f"Cannot serialize types. The {arg} is not serializable.",
234+
)
231235
arg = asdict(arg)
232236
return arg
233237

taskiq/labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def prepare_label(label_value: Any) -> Tuple[str, int]:
3434
var_type = type(label_value)
3535
if var_type in (int, str, float, bool):
3636
return str(label_value), LabelType[var_type.__name__.upper()].value
37-
if var_type == bytes:
37+
if var_type is bytes:
3838
return base64.b64encode(label_value).decode(), LabelType.BYTES.value
3939
return str(label_value), LabelType.ANY.value
4040

taskiq/serializers/cbor_serializer.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from typing import Any, Callable, Optional
2+
from typing import Any, Callable, Dict, Optional
33

44
from taskiq.abc.serializer import TaskiqSerializer
55

@@ -26,8 +26,10 @@ def __init__(
2626
date_as_datetime: bool = True,
2727
string_referencing: bool = True,
2828
# Decoder options
29-
tag_hook: "Optional[Callable[[cbor2.CborDecoder, Any], Any]]" = None,
30-
object_hook: Optional[Callable[[Any], Any]] = None,
29+
tag_hook: Optional[Callable[["cbor2.CBORDecoder", Any], Any]] = None,
30+
object_hook: Optional[
31+
Callable[["cbor2.CBORDecoder", Dict[Any, Any]], Any]
32+
] = None,
3133
) -> None:
3234
if cbor2 is None:
3335
raise ImportError("cbor2 is not installed")
@@ -43,7 +45,7 @@ def __init__(
4345

4446
def dumpb(self, value: Any) -> bytes:
4547
"""Dump value to bytes."""
46-
return cbor2.dumps(
48+
return cbor2.dumps( # type: ignore
4749
value,
4850
datetime_as_timestamp=self.datetime_as_timestamp,
4951
timezone=self.timezone,
@@ -56,7 +58,7 @@ def dumpb(self, value: Any) -> bytes:
5658

5759
def loadb(self, value: bytes) -> Any:
5860
"""Load value from bytes."""
59-
return cbor2.loads(
61+
return cbor2.loads( # type: ignore
6062
value,
6163
tag_hook=self.tag_hook,
6264
object_hook=self.object_hook,

taskiq/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import UserDict
22
from typing import TYPE_CHECKING, Any
33

4-
if TYPE_CHECKING: # pragma: no cover # noqa: SIM108
4+
if TYPE_CHECKING: # pragma: no cover
55
_Base = UserDict[str, Any]
66
else:
77
_Base = UserDict

tests/receiver/test_receiver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_func() -> None:
186186
assert result.return_value is None
187187
assert result.is_err
188188
assert len(_TestMiddleware.found_exceptions) == 1
189-
assert _TestMiddleware.found_exceptions[0].__class__ == ValueError
189+
assert _TestMiddleware.found_exceptions[0].__class__ is ValueError
190190

191191

192192
@pytest.mark.anyio

0 commit comments

Comments
 (0)