Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

referecence-stubs/time : Use _Time8Tuple for all relevant time methods. #772

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
referecence-stubs/time : Use _Time8Tuple for all relevant time methods.
also see: #771
  • Loading branch information
Josverl authored Dec 30, 2024
commit 121c81b47d790b873ed8fe7d804601252201da4e
7 changes: 4 additions & 3 deletions micropython-reference/time/__init__.pyi
Original file line number Diff line number Diff line change
@@ -45,8 +45,9 @@ _TicksMs: TypeAlias = int
_TicksUs: TypeAlias = int
_TicksCPU: TypeAlias = int
_Ticks = TypeVar("_Ticks", _TicksMs, _TicksUs, _TicksCPU, int)
_Time8Tuple: TypeAlias = Tuple[int, int, int, int, int, int, int, int]

def gmtime(secs: int | None = None, /) -> Tuple:
def gmtime(secs: int | None = None, /) -> _Time8Tuple:
"""
Convert the time *secs* expressed in seconds since the Epoch (see above) into an
8-tuple which contains: ``(year, month, mday, hour, minute, second, weekday, yearday)``
@@ -68,7 +69,7 @@ def gmtime(secs: int | None = None, /) -> Tuple:
"""
...

def localtime(secs: int | None = None, /) -> Tuple:
def localtime(secs: int | None = None, /) -> _Time8Tuple:
"""
Convert the time *secs* expressed in seconds since the Epoch (see above) into an
8-tuple which contains: ``(year, month, mday, hour, minute, second, weekday, yearday)``
@@ -90,7 +91,7 @@ def localtime(secs: int | None = None, /) -> Tuple:
"""
...

def mktime(local_time: tuple[int, int, int, int, int, int, int, int], /) -> int:
def mktime(local_time: _Time8Tuple, /) -> int:
"""
This is inverse function of localtime. It's argument is a full 8-tuple
which expresses a time as per localtime. It returns an integer which is
Loading