-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packaging: restore Python 3.8 and 3.9 (#304)
- Loading branch information
Showing
21 changed files
with
165 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
- "3.12" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#! python3 # noqa: E265 | ||
|
||
|
||
""" | ||
Manage timezones for pages date(time)s using pytz module. | ||
Meant to be dropped when Python 3.8 reaches EOL. | ||
""" | ||
|
||
# ############################################################################ | ||
# ########## Libraries ############# | ||
# ################################## | ||
|
||
# standard library | ||
from datetime import datetime | ||
|
||
# 3rd party | ||
import pytz | ||
from mkdocs.plugins import get_plugin_logger | ||
|
||
# package | ||
from mkdocs_rss_plugin.constants import MKDOCS_LOGGER_NAME | ||
|
||
# ############################################################################ | ||
# ########## Globals ############# | ||
# ################################ | ||
|
||
|
||
logger = get_plugin_logger(MKDOCS_LOGGER_NAME) | ||
|
||
|
||
# ############################################################################ | ||
# ########## Functions ########### | ||
# ################################ | ||
|
||
|
||
def set_datetime_zoneinfo( | ||
input_datetime: datetime, config_timezone: str = "UTC" | ||
) -> datetime: | ||
"""Apply timezone to a naive datetime. | ||
:param input_datetime: offset-naive datetime | ||
:type input_datetime: datetime | ||
:param config_timezone: name of timezone as registered in IANA database, | ||
defaults to "UTC". Example : Europe/Paris. | ||
:type config_timezone: str, optional | ||
:return: offset-aware datetime | ||
:rtype: datetime | ||
""" | ||
if input_datetime.tzinfo: | ||
return input_datetime | ||
elif not config_timezone: | ||
return input_datetime.replace(tzinfo=pytz.utc) | ||
else: | ||
config_tz = pytz.timezone(config_timezone) | ||
return config_tz.localize(input_datetime) |
Oops, something went wrong.