Skip to content

Commit a38ab50

Browse files
authored
Add python 3.11 to CI runs (#507)
1 parent 724e6c9 commit a38ab50

File tree

8 files changed

+21
-15
lines changed

8 files changed

+21
-15
lines changed

.github/workflows/unit_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python: [3.7, 3.8, 3.9, '3.10', 'pypy3.9']
13+
python: [3.7, 3.8, 3.9, '3.10', '3.11', 'pypy3.9']
1414

1515
steps:
1616
- uses: actions/checkout@v3

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
rev: 22.3.0
1010
hooks:
1111
- id: black
12-
- repo: https://gitlab.com/pycqa/flake8
12+
- repo: https://github.com/PyCQA/flake8
1313
rev: 4.0.1
1414
hooks:
1515
- id: flake8

flask_jwt_extended/jwt_manager.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class JWTManager(object):
5555
to your app in a factory function.
5656
"""
5757

58-
def __init__(self, app: Flask = None, add_context_processor: bool = False) -> None:
58+
def __init__(
59+
self, app: Optional[Flask] = None, add_context_processor: bool = False
60+
) -> None:
5961
"""
6062
Create the JWTManager instance. You can either pass a flask application
6163
in directly here to register this extension with the flask app, or
@@ -492,7 +494,7 @@ def _encode_jwt_from_config(
492494
token_type: str,
493495
claims=None,
494496
fresh: bool = False,
495-
expires_delta: ExpiresDelta = None,
497+
expires_delta: Optional[ExpiresDelta] = None,
496498
headers=None,
497499
) -> str:
498500
header_overrides = self._jwt_additional_header_callback(identity)

flask_jwt_extended/utils.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_current_user() -> Any:
101101

102102

103103
def decode_token(
104-
encoded_token: str, csrf_value: str = None, allow_expired: bool = False
104+
encoded_token: str, csrf_value: Optional[str] = None, allow_expired: bool = False
105105
) -> dict:
106106
"""
107107
Returns the decoded token (python dict) from an encoded JWT. This does all
@@ -130,7 +130,7 @@ def decode_token(
130130
def create_access_token(
131131
identity: Any,
132132
fresh: bool = False,
133-
expires_delta: datetime.timedelta = None,
133+
expires_delta: Optional[datetime.timedelta] = None,
134134
additional_claims=None,
135135
additional_headers=None,
136136
):
@@ -183,7 +183,7 @@ def create_access_token(
183183

184184
def create_refresh_token(
185185
identity: Any,
186-
expires_delta: datetime.timedelta = None,
186+
expires_delta: Optional[datetime.timedelta] = None,
187187
additional_claims=None,
188188
additional_headers=None,
189189
):
@@ -320,8 +320,8 @@ def set_access_cookies(
320320
def set_refresh_cookies(
321321
response: Response,
322322
encoded_refresh_token: str,
323-
max_age: int = None,
324-
domain: str = None,
323+
max_age: Optional[int] = None,
324+
domain: Optional[str] = None,
325325
) -> None:
326326
"""
327327
Modifiy a Flask Response to set a cookie containing the refresh JWT.
@@ -370,7 +370,7 @@ def set_refresh_cookies(
370370
)
371371

372372

373-
def unset_jwt_cookies(response: Response, domain: str = None) -> None:
373+
def unset_jwt_cookies(response: Response, domain: Optional[str] = None) -> None:
374374
"""
375375
Modifiy a Flask Response to delete the cookies containing access or refresh
376376
JWTs. Also deletes the corresponding CSRF cookies if applicable.
@@ -382,7 +382,7 @@ def unset_jwt_cookies(response: Response, domain: str = None) -> None:
382382
unset_refresh_cookies(response, domain)
383383

384384

385-
def unset_access_cookies(response: Response, domain: str = None) -> None:
385+
def unset_access_cookies(response: Response, domain: Optional[str] = None) -> None:
386386
"""
387387
Modifiy a Flask Response to delete the cookie containing an access JWT.
388388
Also deletes the corresponding CSRF cookie if applicable.
@@ -420,7 +420,7 @@ def unset_access_cookies(response: Response, domain: str = None) -> None:
420420
)
421421

422422

423-
def unset_refresh_cookies(response: Response, domain: str = None) -> None:
423+
def unset_refresh_cookies(response: Response, domain: Optional[str] = None) -> None:
424424
"""
425425
Modifiy a Flask Response to delete the cookie containing a refresh JWT.
426426
Also deletes the corresponding CSRF cookie if applicable.

flask_jwt_extended/view_decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def verify_jwt_in_request(
4646
optional: bool = False,
4747
fresh: bool = False,
4848
refresh: bool = False,
49-
locations: LocationType = None,
49+
locations: Optional[LocationType] = None,
5050
verify_type: bool = True,
5151
) -> Optional[Tuple[dict, dict]]:
5252
"""
@@ -113,7 +113,7 @@ def jwt_required(
113113
optional: bool = False,
114114
fresh: bool = False,
115115
refresh: bool = False,
116-
locations: LocationType = None,
116+
locations: Optional[LocationType] = None,
117117
verify_type: bool = True,
118118
) -> Any:
119119
"""

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ select = B, E, F, W, B9
1515
ignore =
1616
# Line too long. Handled by E501 and Black
1717
B950
18+
# I don't like this one
19+
B907
1820
max-line-length = 90
1921
per-file-ignores =
2022
# __init__ modules export names

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
"Programming Language :: Python :: 3.7",
5151
"Programming Language :: Python :: 3.8",
5252
"Programming Language :: Python :: 3.9",
53+
"Programming Language :: Python :: 3.10",
54+
"Programming Language :: Python :: 3.11",
5355
"Programming Language :: Python :: Implementation :: CPython",
5456
"Programming Language :: Python :: Implementation :: PyPy",
5557
"Topic :: Software Development :: Libraries :: Python Modules",

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py37,py38,py39,py310,pypy3.9,flask21,mypy,coverage,style,docs
7+
envlist = py37,py38,py39,py310,py311,pypy3.9,flask21,mypy,coverage,style,docs
88

99
[testenv]
1010
commands =

0 commit comments

Comments
 (0)