Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for pyright on strict mode #747

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Changed
Fixed
~~~~~

- Fix for pyright on strict mode `#747 <https://github.com/jpadilla/pyjwt/pull/747>`_

Added
~~~~~

Expand Down
6 changes: 3 additions & 3 deletions jwt/api_jws.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def encode(
payload: bytes,
key: str,
algorithm: Optional[str] = "HS256",
headers: Optional[Dict] = None,
headers: Optional[Dict[str, Any]] = None,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    Type of "encode" is "(payload: Dict[str, Any], key: str, algorithm: str | None = "HS256", headers: Dict[Unknown, Unknown] | None = None, json_encoder: Type[JSONEncoder] | None = None) -> str" (reportUnknownMemberType)

json_encoder: Optional[Type[json.JSONEncoder]] = None,
is_payload_detached: bool = False,
) -> str:
Expand Down Expand Up @@ -155,7 +155,7 @@ def decode_complete(
jwt: str,
key: str = "",
algorithms: Optional[List[str]] = None,
options: Optional[Dict] = None,
options: Optional[Dict[str, Any]] = None,
detached_payload: Optional[bytes] = None,
**kwargs,
) -> Dict[str, Any]:
Expand Down Expand Up @@ -193,7 +193,7 @@ def decode(
jwt: str,
key: str = "",
algorithms: Optional[List[str]] = None,
options: Optional[Dict] = None,
options: Optional[Dict[str, Any]] = None,
**kwargs,
) -> str:
decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
Expand Down
6 changes: 3 additions & 3 deletions jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def encode(
payload: Dict[str, Any],
key: str,
algorithm: Optional[str] = "HS256",
headers: Optional[Dict] = None,
headers: Optional[Dict[str, Any]] = None,
json_encoder: Optional[Type[json.JSONEncoder]] = None,
) -> str:
# Check that we get a mapping
Expand Down Expand Up @@ -68,7 +68,7 @@ def decode_complete(
jwt: str,
key: str = "",
algorithms: Optional[List[str]] = None,
options: Optional[Dict] = None,
options: Optional[Dict[str, Any]] = None,
**kwargs,
) -> Dict[str, Any]:
options = dict(options or {}) # shallow-copy or initialize an empty dict
Expand Down Expand Up @@ -123,7 +123,7 @@ def decode(
jwt: str,
key: str = "",
algorithms: Optional[List[str]] = None,
options: Optional[Dict] = None,
options: Optional[Dict[str, Any]] = None,
**kwargs,
) -> Dict[str, Any]:
decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
Expand Down