fix: support Python 3.10 on Windows
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
PYTHON ?= python3
|
PYTHON ?= py -3
|
||||||
BASE_URL ?= http://localhost:8080
|
BASE_URL ?= http://localhost:8080
|
||||||
CA_FILE ?=
|
CA_FILE ?=
|
||||||
ACTION_SCRIPT ?=
|
ACTION_SCRIPT ?=
|
||||||
|
|||||||
+15
-2
@@ -29,8 +29,21 @@ def timestamp(value):
|
|||||||
'timestamp must be UTC ending in Z'
|
'timestamp must be UTC ending in Z'
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return dt.datetime.fromisoformat(value[:-1] + '+00:00')
|
normalized = value[:-1] + '+00:00'
|
||||||
except ValueError as exc:
|
|
||||||
|
if '.' in normalized:
|
||||||
|
prefix, fraction = normalized.split('.', 1)
|
||||||
|
digits, timezone = fraction.split('+', 1)
|
||||||
|
|
||||||
|
if not digits.isdigit() or len(digits) > 9:
|
||||||
|
raise ValueError('invalid fractional seconds')
|
||||||
|
|
||||||
|
digits = digits[:6].ljust(6, '0')
|
||||||
|
normalized = f'{prefix}.{digits}+{timezone}'
|
||||||
|
|
||||||
|
return dt.datetime.fromisoformat(normalized)
|
||||||
|
|
||||||
|
except (ValueError, TypeError) as exc:
|
||||||
raise Failure(f'invalid RFC3339 timestamp: {value!r}') from exc
|
raise Failure(f'invalid RFC3339 timestamp: {value!r}') from exc
|
||||||
|
|
||||||
def validate(value, schema, where='response'):
|
def validate(value, schema, where='response'):
|
||||||
|
|||||||
Reference in New Issue
Block a user