mirror of
https://github.com/ansible/awx.git
synced 2026-06-27 17:38:02 -02:30
AAP-59874: Update to Python 3.12 (#16208)
* update to Python 3.12 * remove use of utcnow * switch to timezone.utc datetime.UTC is an alias of datetime.timezone.utc. if we're doing the double import for datetime it's more straightforward to just import timezone as well and get it directly * debug python env version issue * change python version * pin to SHA and remove debug portion
This commit is contained in:
@@ -1,13 +1,29 @@
|
||||
import locale
|
||||
import json
|
||||
from distutils.util import strtobool
|
||||
|
||||
import yaml
|
||||
|
||||
from awxkit.cli.utils import colored
|
||||
from awxkit import config
|
||||
|
||||
|
||||
def strtobool(val):
|
||||
"""Convert a string representation of truth to true (1) or false (0).
|
||||
|
||||
True values are 'y', 'yes', 't', 'true', 'on', and '1'.
|
||||
False values are 'n', 'no', 'f', 'false', 'off', and '0'.
|
||||
Raises ValueError if 'val' is anything else.
|
||||
|
||||
This replaces the deprecated distutils.util.strtobool removed in Python 3.12.
|
||||
"""
|
||||
val = val.lower()
|
||||
if val in ('y', 'yes', 't', 'true', 'on', '1'):
|
||||
return 1
|
||||
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
|
||||
return 0
|
||||
else:
|
||||
raise ValueError(f"invalid truth value {val!r}")
|
||||
|
||||
|
||||
def get_config_credentials():
|
||||
"""Load username and password from config.credentials.default.
|
||||
|
||||
|
||||
@@ -6,10 +6,8 @@ import re
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
from distutils.util import strtobool
|
||||
|
||||
from .custom import CustomAction
|
||||
from .format import add_output_formatting_arguments
|
||||
from .format import add_output_formatting_arguments, strtobool
|
||||
from .resource import DEPRECATED_RESOURCES_REVERSE
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user