Исправлены type hints у декоратора log
このコミットが含まれているのは:
コミット
43749cab59
|
@ -69,14 +69,8 @@ def gen_client(output_client_filename):
|
|||
code = code.replace(f'self.{method}(', f'await self.{method}(')
|
||||
|
||||
# specific cases
|
||||
code = code.replace(
|
||||
'self.users_playlists_change(',
|
||||
'await self.users_playlists_change('
|
||||
)
|
||||
code = code.replace(
|
||||
'self.rotor_station_feedback(',
|
||||
'await self.rotor_station_feedback('
|
||||
)
|
||||
code = code.replace('self.users_playlists_change(', 'await self.users_playlists_change(')
|
||||
code = code.replace('self.rotor_station_feedback(', 'await self.rotor_station_feedback(')
|
||||
code = code.replace('return DownloadInfo.de_list', 'return await DownloadInfo.de_list_async')
|
||||
|
||||
code = DISCLAIMER + code
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import functools
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Union
|
||||
from typing import Dict, List, Optional, Union, TypeVar, Callable, Any
|
||||
|
||||
from yandex_music import (
|
||||
Album,
|
||||
|
@ -55,12 +55,14 @@ de_list = {
|
|||
|
||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||
|
||||
F = TypeVar('F', bound=Callable[..., Any])
|
||||
|
||||
def log(method):
|
||||
|
||||
def log(method: F) -> F:
|
||||
logger = logging.getLogger(method.__module__)
|
||||
|
||||
@functools.wraps(method)
|
||||
def wrapper(*args, **kwargs):
|
||||
def wrapper(*args, **kwargs) -> Any:
|
||||
logger.debug(f'Entering: {method.__name__}')
|
||||
|
||||
result = method(*args, **kwargs)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import functools
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Union
|
||||
from typing import Dict, List, Optional, Union, TypeVar, Callable, Any
|
||||
|
||||
from yandex_music import (
|
||||
Album,
|
||||
|
@ -59,12 +59,14 @@ de_list = {
|
|||
|
||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||
|
||||
F = TypeVar('F', bound=Callable[..., Any])
|
||||
|
||||
def log(method):
|
||||
|
||||
def log(method: F) -> F:
|
||||
logger = logging.getLogger(method.__module__)
|
||||
|
||||
@functools.wraps(method)
|
||||
async def wrapper(*args, **kwargs):
|
||||
async def wrapper(*args, **kwargs) -> Any:
|
||||
logger.debug(f'Entering: {method.__name__}')
|
||||
|
||||
result = await method(*args, **kwargs)
|
||||
|
|
読み込み中…
新しいイシューから参照