Skip to content

Commit

Permalink
Add python 3.11 to CI runs
Browse files Browse the repository at this point in the history
  • Loading branch information
vimalloc committed Apr 4, 2023
1 parent 724e6c9 commit b280d31
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9, '3.10', 'pypy3.9']
python: [3.7, 3.8, 3.9, '3.10', '3.11', 'pypy3.9']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
Expand Down
4 changes: 2 additions & 2 deletions flask_jwt_extended/jwt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class JWTManager(object):
to your app in a factory function.
"""

def __init__(self, app: Flask = None, add_context_processor: bool = False) -> None:
def __init__(self, app: Optional[Flask] = None, add_context_processor: bool = False) -> None:
"""
Create the JWTManager instance. You can either pass a flask application
in directly here to register this extension with the flask app, or
Expand Down Expand Up @@ -492,7 +492,7 @@ def _encode_jwt_from_config(
token_type: str,
claims=None,
fresh: bool = False,
expires_delta: ExpiresDelta = None,
expires_delta: Optional[ExpiresDelta] = None,
headers=None,
) -> str:
header_overrides = self._jwt_additional_header_callback(identity)
Expand Down
16 changes: 8 additions & 8 deletions flask_jwt_extended/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_current_user() -> Any:


def decode_token(
encoded_token: str, csrf_value: str = None, allow_expired: bool = False
encoded_token: str, csrf_value: Optional[str] = None, allow_expired: bool = False
) -> dict:
"""
Returns the decoded token (python dict) from an encoded JWT. This does all
Expand Down Expand Up @@ -130,7 +130,7 @@ def decode_token(
def create_access_token(
identity: Any,
fresh: bool = False,
expires_delta: datetime.timedelta = None,
expires_delta: Optional[datetime.timedelta] = None,
additional_claims=None,
additional_headers=None,
):
Expand Down Expand Up @@ -183,7 +183,7 @@ def create_access_token(

def create_refresh_token(
identity: Any,
expires_delta: datetime.timedelta = None,
expires_delta: Optional[datetime.timedelta] = None,
additional_claims=None,
additional_headers=None,
):
Expand Down Expand Up @@ -320,8 +320,8 @@ def set_access_cookies(
def set_refresh_cookies(
response: Response,
encoded_refresh_token: str,
max_age: int = None,
domain: str = None,
max_age: Optional[int] = None,
domain: Optional[str] = None,
) -> None:
"""
Modifiy a Flask Response to set a cookie containing the refresh JWT.
Expand Down Expand Up @@ -370,7 +370,7 @@ def set_refresh_cookies(
)


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


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


def unset_refresh_cookies(response: Response, domain: str = None) -> None:
def unset_refresh_cookies(response: Response, domain: Optional[str] = None) -> None:
"""
Modifiy a Flask Response to delete the cookie containing a refresh JWT.
Also deletes the corresponding CSRF cookie if applicable.
Expand Down
4 changes: 2 additions & 2 deletions flask_jwt_extended/view_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def verify_jwt_in_request(
optional: bool = False,
fresh: bool = False,
refresh: bool = False,
locations: LocationType = None,
locations: Optional[LocationType] = None,
verify_type: bool = True,
) -> Optional[Tuple[dict, dict]]:
"""
Expand Down Expand Up @@ -113,7 +113,7 @@ def jwt_required(
optional: bool = False,
fresh: bool = False,
refresh: bool = False,
locations: LocationType = None,
locations: Optional[LocationType] = None,
verify_type: bool = True,
) -> Any:
"""
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ select = B, E, F, W, B9
ignore =
# Line too long. Handled by E501 and Black
B950
# I don't like this one
B907
max-line-length = 90
per-file-ignores =
# __init__ modules export names
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py37,py38,py39,py310,pypy3.9,flask21,mypy,coverage,style,docs
envlist = py37,py38,py39,py310,py311,pypy3.9,flask21,mypy,coverage,style,docs

[testenv]
commands =
Expand Down

0 comments on commit b280d31

Please sign in to comment.