- Notifications
You must be signed in to change notification settings - Fork263
-
Hand-waving, I have this: classMockDateTime:@overload@classmethoddefset(cls,year:int,month:int,day:int,hour:int= ...,minute:int= ...,second:int= ...,microsecond:int= ...,tzinfo:TZInfo= ..., )->None: ...@overload@classmethoddefset(cls,instance:datetime,/ )->None: ...@classmethoddefset(cls,*args:int|datetime,**kw:int)->None:""" This will set the :class:`datetime.datetime` created from the supplied parameters as the next datetime to be returned by :meth:`~MockDateTime.now` or :meth:`~MockDateTime.utcnow`, clearing out any datetimes in the queue. An instance of :class:`~datetime.datetime` may also be passed as a single positional argument. """ So, those ellipsis make mypy unhappy, but how do I express "these may not be present, but if they are, they must be ints, or TZInfo in the case of Note, this is explicitlynot what I want, since it's not valid to pass None for these: classMockDateTime:@overload@classmethoddefset(cls,year:int,month:int,day:int,hour:int=None,minute:int=None,second:int=None,microsecond:int=None,tzinfo:TZInfo=None, )->None: ... |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
See#2040 for newer discussion on this. |
BetaWas this translation helpful?Give feedback.
All reactions
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment