66import logging .config
77import time
88import uuid
9- from collections .abc import Iterator
9+ from collections .abc import Callable , Iterator
1010from copy import copy , deepcopy
1111from typing import (
1212 TYPE_CHECKING ,
1313 Any ,
14- Callable ,
1514 Concatenate ,
1615 Literal ,
1716 ParamSpec ,
3433# https://test.pypi.org/project/annotated-logger/
3534# The dev versions in testpypi can then be pulled in to whatever project needed
3635# the new feature.
37- VERSION = "1.2.3 " # pragma: no mutate
36+ VERSION = "1.2.4 " # pragma: no mutate
3837
3938T = TypeVar ("T" )
4039P = ParamSpec ("P" )
@@ -732,7 +731,7 @@ def wrap_class(
732731 cls = wrapped , logger_base_name = logger_name
733732 )
734733 logger .debug ("init" )
735- new = cast (AnnotatedClass [C_co ], wrapped (* args , ** kwargs ))
734+ new = cast (" AnnotatedClass[C_co]" , wrapped (* args , ** kwargs ))
736735 new .annotated_logger = logger
737736 return new
738737
@@ -766,7 +765,7 @@ def wrap_function(*args: P.args, **kwargs: P.kwargs) -> R:
766765 post_call_attempted = True
767766 _attempt_post_call (post_call , logger , * new_args , ** new_kwargs ) # pyright: ignore[reportCallIssue]
768767 end_time = time .perf_counter ()
769- logger .annotate (run_time = f"{ end_time - start_time :.1f} " )
768+ logger .annotate (run_time = f"{ end_time - start_time :.1f} " )
770769 with contextlib .suppress (TypeError ):
771770 logger .annotate (count = len (result )) # pyright: ignore[reportArgumentType]
772771
@@ -880,7 +879,7 @@ def _inject_by_kwarg(
880879 else :
881880 instance = False # pragma: no mutate
882881 logger , annotations = self ._pick_correct_logger (
883- function , instance , logger_base_name = logger_base_name
882+ function , instance = instance , logger_base_name = logger_base_name
884883 )
885884 if not provided :
886885 kwargs ["annotated_logger" ] = logger
@@ -904,7 +903,7 @@ def _inject_by_index( # noqa: PLR0913
904903 else :
905904 instance = False # pragma: no mutate
906905 logger , annotations = self ._pick_correct_logger (
907- function , instance , logger_base_name = logger_base_name
906+ function , instance = instance , logger_base_name = logger_base_name
908907 )
909908 if not provided :
910909 args .insert (index , logger )
@@ -927,6 +926,7 @@ def _check_parameters_for_self_and_cls(
927926 def _pick_correct_logger (
928927 self ,
929928 function : Function [S , P , R ],
929+ * ,
930930 instance : object | bool ,
931931 logger_base_name : str | None = None ,
932932 ) -> tuple [AnnotatedAdapter , Annotations | None ]:
0 commit comments