From 0e7ae882e4e7a249e95291a04aa5ba81b8629f8b Mon Sep 17 00:00:00 2001 From: Lennart Regebro Date: Mon, 9 Oct 2023 09:11:55 +0200 Subject: [PATCH] Added type hints for the public functions --- tzlocal/unix.py | 8 ++++---- tzlocal/win32.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tzlocal/unix.py b/tzlocal/unix.py index 5178e0d..2151c43 100644 --- a/tzlocal/unix.py +++ b/tzlocal/unix.py @@ -3,7 +3,7 @@ import re import sys import warnings -from datetime import timezone +from datetime import timezone, tzinfo from tzlocal import utils @@ -202,7 +202,7 @@ def _get_localzone(_root="/"): return tz -def get_localzone_name(): +def get_localzone_name() -> str: """Get the computers configured local timezone name, if any.""" global _cache_tz_name if _cache_tz_name is None: @@ -211,7 +211,7 @@ def get_localzone_name(): return _cache_tz_name -def get_localzone(): +def get_localzone() -> tzinfo: """Get the computers configured local timezone, if any.""" global _cache_tz @@ -221,7 +221,7 @@ def get_localzone(): return _cache_tz -def reload_localzone(): +def reload_localzone() -> None: """Reload the cached localzone. You need to call this if the timezone has changed.""" global _cache_tz_name global _cache_tz diff --git a/tzlocal/win32.py b/tzlocal/win32.py index 9e8dc73..d326c65 100644 --- a/tzlocal/win32.py +++ b/tzlocal/win32.py @@ -1,5 +1,5 @@ import logging -from datetime import datetime +from datetime import datetime, tzinfo try: import _winreg as winreg @@ -112,7 +112,7 @@ def _get_localzone_name(): return timezone -def get_localzone_name(): +def get_localzone_name() -> str: """Get the zoneinfo timezone name that matches the Windows-configured timezone.""" global _cache_tz_name if _cache_tz_name is None: @@ -121,7 +121,7 @@ def get_localzone_name(): return _cache_tz_name -def get_localzone(): +def get_localzone() -> tzinfo: """Returns the zoneinfo-based tzinfo object that matches the Windows-configured timezone.""" global _cache_tz @@ -137,7 +137,7 @@ def get_localzone(): return _cache_tz -def reload_localzone(): +def reload_localzone() -> None: """Reload the cached localzone. You need to call this if the timezone has changed.""" global _cache_tz global _cache_tz_name