You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 tzinfo"?
Note, this is explicitly not what I want, since it's not valid to pass None for these:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hand-waving, I have this:
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
tzinfo
"?Note, this is explicitly not what I want, since it's not valid to pass None for these:
Beta Was this translation helpful? Give feedback.
All reactions