File tree Expand file tree Collapse file tree 5 files changed +18
-8
lines changed Expand file tree Collapse file tree 5 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 31
31
from taskiq .state import TaskiqState
32
32
from taskiq .task import AsyncTaskiqTask
33
33
34
+ try :
35
+ # Python 3.8+
36
+ from importlib .metadata import version # noqa: WPS433
37
+ except ImportError :
38
+ # Python 3.7
39
+ from importlib_metadata import version # noqa: WPS433
40
+
41
+ __version__ = version ("taskiq" )
34
42
__all__ = [
43
+ "__version__" ,
35
44
"gather" ,
36
45
"Context" ,
37
46
"AsyncBroker" ,
Original file line number Diff line number Diff line change 2
2
import sys
3
3
from typing import Dict
4
4
5
- from importlib_metadata import entry_points , version
5
+ from importlib_metadata import entry_points
6
6
7
+ from taskiq import __version__
7
8
from taskiq .abc .cmd import TaskiqCMD
8
9
9
10
@@ -60,7 +61,7 @@ def main() -> None: # noqa: WPS210 # pragma: no cover
60
61
args , _ = parser .parse_known_args ()
61
62
62
63
if args .version :
63
- print (version ( "taskiq" ) ) # noqa: WPS421
64
+ print (__version__ ) # noqa: WPS421
64
65
return
65
66
66
67
if args .subcommand is None :
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ def test_log_collector_std_success() -> None:
9
9
"""Tests that stdout and stderr calls are collected correctly."""
10
10
log = StringIO ()
11
11
with log_collector (log , "%(message)s" ):
12
- print ("log1" ) # noqa: WPS421
13
- print ("log2" , file = sys .stderr ) # noqa: WPS421
12
+ print ("log1" )
13
+ print ("log2" , file = sys .stderr )
14
14
assert log .getvalue () == "log1\n log2\n "
15
15
16
16
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ async def test_callback_success() -> None:
162
162
163
163
@broker .task
164
164
async def my_task () -> int :
165
- nonlocal called_times # noqa: WPS420
165
+ nonlocal called_times
166
166
called_times += 1
167
167
return 1
168
168
@@ -415,7 +415,7 @@ async def test_callback_semaphore() -> None:
415
415
416
416
@broker .task
417
417
async def task_sem () -> int :
418
- nonlocal sem_num # noqa: WPS420
418
+ nonlocal sem_num
419
419
sem_num += 1
420
420
await asyncio .sleep (1 )
421
421
return 1
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def test_state_del() -> None:
24
24
25
25
state ["a" ] = 1
26
26
27
- del state ["a" ] # noqa: WPS420
27
+ del state ["a" ]
28
28
29
29
assert state .get ("a" ) is None
30
30
@@ -53,6 +53,6 @@ def test_state_del_attr() -> None:
53
53
54
54
state ["a" ] = 1
55
55
56
- del state .a # noqa: WPS420
56
+ del state .a
57
57
58
58
assert state .get ("a" ) is None
You can’t perform that action at this time.
0 commit comments