Fix #291: drop python < 3.6#304
Conversation
|
|
||
|
|
||
| class BaseRetrying(object): | ||
| __metaclass__ = ABCMeta |
There was a problem hiding this comment.
looks like here was s bug
| return fut.result() | ||
|
|
||
| if self.after is not None: | ||
| self.after(retry_state=retry_state) |
There was a problem hiding this comment.
do not use keyword call
| from monotonic import monotonic as now # noqa | ||
|
|
||
|
|
||
| class cached_property(object): |
There was a problem hiding this comment.
not used at code base -> no reason to migrate on backports or make semi-stdlib code
| def test_repr(self): | ||
| class ConcreteRetrying(tenacity.BaseRetrying): | ||
| def __call__(self): | ||
| def __call__(self, fn, *args, **kwargs): |
There was a problem hiding this comment.
do not modify signature
| ) | ||
| if iscoroutinefunction is not None and iscoroutinefunction(f): | ||
| r = AsyncRetrying(*dargs, **dkw) | ||
| r: "BaseRetrying" = AsyncRetrying(*dargs, **dkw) |
There was a problem hiding this comment.
using base class due to API reuse and MyPy questions
| break | ||
|
|
||
| @abstractmethod | ||
| def __call__(self, *args, **kwargs): |
There was a problem hiding this comment.
API should match between parent and child classes
| def call(self, *args, **kwargs): | ||
| def call(self, *args: t.Any, **kwargs: t.Any) -> t.Union[DoAttempt, DoSleep, t.Any]: | ||
| """Use ``__call__`` instead because this method is deprecated.""" | ||
| warnings.warn( |
There was a problem hiding this comment.
looks like reason to set deprecation period before remove (and also for bound function in Retrying)
|
|
||
|
|
||
| def visible_attrs(obj, attrs=None): | ||
| def visible_attrs( |
There was a problem hiding this comment.
method is used only once and technically 1liner -> dict comprehension in place of use?
jd
left a comment
There was a problem hiding this comment.
A couple of minor things otherwise LGTM.
(I'd have preferred to have multiple PR for different things here: removing Python 2 is one thing, adding typing information is another.)
Thanks for doing this huge work!
#293 is repared, so I can rebase on it after merge. It will reduce size of mine PR |
|
Rebased on master |
jd
left a comment
There was a problem hiding this comment.
Ditto for the six and typing which should be 2 different PR, but if it's complicated to split them, it'll be fine.
|
|
||
|
|
||
| def before_log(logger, log_level): | ||
| def before_log(logger: "logging.Logger", log_level: int) -> typing.Callable[["RetryCallState"], None]: # noqa:BLK100 |
There was a problem hiding this comment.
Will make separate PR with unified black formatting
* Removed all transitional requirements (including `six`) * Most type annotations fixed. * Python 3.10 tested. * Most part of code is type annotated. Co-authored-by: Julien Danjou <julien@danjou.info>
|
manually rebased to make history float |
six)