mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Add basic typing for module_utils.
This commit is contained in:
@@ -8,15 +8,15 @@ from __future__ import annotations
|
||||
import datetime as _datetime
|
||||
|
||||
|
||||
def ensure_timezone_info(value):
|
||||
def ensure_timezone_info(value: _datetime.datetime) -> _datetime.datetime:
|
||||
if value.tzinfo is not None:
|
||||
return value
|
||||
return value.astimezone(_datetime.timezone.utc)
|
||||
|
||||
|
||||
def fromtimestamp(value):
|
||||
def fromtimestamp(value: int | float) -> _datetime.datetime:
|
||||
return _datetime.datetime.fromtimestamp(value, tz=_datetime.timezone.utc)
|
||||
|
||||
|
||||
def now():
|
||||
def now() -> _datetime.datetime:
|
||||
return _datetime.datetime.now(tz=_datetime.timezone.utc)
|
||||
|
||||
Reference in New Issue
Block a user