File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from taskiq .state import TaskiqState
3232from taskiq .task import AsyncTaskiqTask
3333
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" )
3442__all__ = [
43+ "__version__" ,
3544 "gather" ,
3645 "Context" ,
3746 "AsyncBroker" ,
Original file line number Diff line number Diff line change 22import sys
33from typing import Dict
44
5- from importlib_metadata import entry_points , version
5+ from importlib_metadata import entry_points
66
7+ from taskiq import __version__
78from taskiq .abc .cmd import TaskiqCMD
89
910
@@ -60,7 +61,7 @@ def main() -> None: # noqa: WPS210 # pragma: no cover
6061 args , _ = parser .parse_known_args ()
6162
6263 if args .version :
63- print (version ( "taskiq" ) ) # noqa: WPS421
64+ print (__version__ ) # noqa: WPS421
6465 return
6566
6667 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:
99 """Tests that stdout and stderr calls are collected correctly."""
1010 log = StringIO ()
1111 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 )
1414 assert log .getvalue () == "log1\n log2\n "
1515
1616
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ async def test_callback_success() -> None:
162162
163163 @broker .task
164164 async def my_task () -> int :
165- nonlocal called_times # noqa: WPS420
165+ nonlocal called_times
166166 called_times += 1
167167 return 1
168168
@@ -415,7 +415,7 @@ async def test_callback_semaphore() -> None:
415415
416416 @broker .task
417417 async def task_sem () -> int :
418- nonlocal sem_num # noqa: WPS420
418+ nonlocal sem_num
419419 sem_num += 1
420420 await asyncio .sleep (1 )
421421 return 1
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def test_state_del() -> None:
2424
2525 state ["a" ] = 1
2626
27- del state ["a" ] # noqa: WPS420
27+ del state ["a" ]
2828
2929 assert state .get ("a" ) is None
3030
@@ -53,6 +53,6 @@ def test_state_del_attr() -> None:
5353
5454 state ["a" ] = 1
5555
56- del state .a # noqa: WPS420
56+ del state .a
5757
5858 assert state .get ("a" ) is None
You can’t perform that action at this time.
0 commit comments