Skip to content

Commit

Permalink
chore: backpedal on some incompatible backports from 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Nov 27, 2023
1 parent f4e132e commit 742a0d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 4 additions & 5 deletions falcon/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import http
import inspect
import re
from typing import Callable
import unicodedata

from falcon import status_codes
Expand Down Expand Up @@ -71,17 +70,17 @@
_UNSAFE_CHARS = re.compile(r'[^a-zA-Z0-9.-]')

# PERF(kgriffs): Avoid superfluous namespace lookups
_strptime: Callable[[str, str], datetime.datetime] = datetime.datetime.strptime
_utcnow: Callable[[], datetime.datetime] = functools.partial(
_strptime = datetime.datetime.strptime
_utcnow = functools.partial(
datetime.datetime.now, datetime.timezone.utc
)

# The above aliases were not underscored prior to Falcon 3.1.2.
strptime: Callable[[str, str], datetime.datetime] = deprecated(
strptime = deprecated(
'This was a private alias local to this module; '
'please reference datetime.strptime() directly.'
)(datetime.datetime.strptime)
utcnow: Callable[[], datetime.datetime] = deprecated(
utcnow = deprecated(
'This was a private alias local to this module; '
'please reference datetime.utcnow() directly.'
)(datetime.datetime.utcnow)
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ deps = {[testenv]deps}
commands = pip uninstall --yes msgpack
coverage run -m pytest tests -k "test_ws and test_msgpack_missing"

[testenv:py35]
deps = {[testenv]deps}
pytest-randomly
jsonschema
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
coverage run -m pytest tests --ignore=tests/asgi []

[testenv:py310]
basepython = python3.10
deps = {[testenv]deps}
Expand Down

0 comments on commit 742a0d1

Please sign in to comment.