-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SG-32657 Enable support for Python 3.10 in CI (#920)
- Support [deprecation](https://peps.python.org/pep-0632/) of distutils for setuptools > 60. - We can't switch to `packaging.version.parse` because many TK components depend of `distutils.version.LooseVersion`. To handle the distutils deprecation, we're switching to the bundled version living on setuptools >= 60. The deprecation warning is still there, so we're suppressing just this one. - Re-enable commented tests - Support [deprecation](python/cpython#25174) of `isSet()` - Upgrade python-api v3.4.0
- Loading branch information
1 parent
6766e56
commit 509eca8
Showing
20 changed files
with
3,298 additions
and
174 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
1f132f8f495333acc7303996a8151d73b2c204ae | ||
11db780c4a18993130a988d73f9e50bd7d17e53f |
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,69 @@ | ||
import base64 | ||
import re | ||
|
||
from ... import pyparsing as pp | ||
|
||
from .error import * | ||
|
||
|
||
try: # pyparsing>=3.0.0 | ||
downcaseTokens = pp.common.downcaseTokens | ||
except AttributeError: | ||
downcaseTokens = pp.downcaseTokens | ||
|
||
UNQUOTE_PAIRS = re.compile(r"\\(.)") | ||
unquote = lambda s, l, t: UNQUOTE_PAIRS.sub(r"\1", t[0][1:-1]) | ||
|
||
# https://tools.ietf.org/html/rfc7235#section-1.2 | ||
# https://tools.ietf.org/html/rfc7235#appendix-B | ||
tchar = "!#$%&'*+-.^_`|~" + pp.nums + pp.alphas | ||
token = pp.Word(tchar).setName("token") | ||
token68 = pp.Combine(pp.Word("-._~+/" + pp.nums + pp.alphas) + pp.Optional(pp.Word("=").leaveWhitespace())).setName( | ||
"token68" | ||
) | ||
|
||
quoted_string = pp.dblQuotedString.copy().setName("quoted-string").setParseAction(unquote) | ||
auth_param_name = token.copy().setName("auth-param-name").addParseAction(downcaseTokens) | ||
auth_param = auth_param_name + pp.Suppress("=") + (quoted_string | token) | ||
params = pp.Dict(pp.delimitedList(pp.Group(auth_param))) | ||
|
||
scheme = token("scheme") | ||
challenge = scheme + (params("params") | token68("token")) | ||
|
||
authentication_info = params.copy() | ||
www_authenticate = pp.delimitedList(pp.Group(challenge)) | ||
|
||
|
||
def _parse_authentication_info(headers, headername="authentication-info"): | ||
"""https://tools.ietf.org/html/rfc7615 | ||
""" | ||
header = headers.get(headername, "").strip() | ||
if not header: | ||
return {} | ||
try: | ||
parsed = authentication_info.parseString(header) | ||
except pp.ParseException as ex: | ||
# print(ex.explain(ex)) | ||
raise MalformedHeader(headername) | ||
|
||
return parsed.asDict() | ||
|
||
|
||
def _parse_www_authenticate(headers, headername="www-authenticate"): | ||
"""Returns a dictionary of dictionaries, one dict per auth_scheme.""" | ||
header = headers.get(headername, "").strip() | ||
if not header: | ||
return {} | ||
try: | ||
parsed = www_authenticate.parseString(header) | ||
except pp.ParseException as ex: | ||
# print(ex.explain(ex)) | ||
raise MalformedHeader(headername) | ||
|
||
retval = { | ||
challenge["scheme"].lower(): challenge["params"].asDict() | ||
if "params" in challenge | ||
else {"token": challenge.get("token")} | ||
for challenge in parsed | ||
} | ||
return retval |
Oops, something went wrong.