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

Add type hints to jwt/help.py and add missing types dependency #784

Merged
merged 3 commits into from
Aug 1, 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
11 changes: 6 additions & 5 deletions jwt/help.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import platform
import sys
from typing import Dict

from . import __version__ as pyjwt_version

Expand All @@ -10,7 +11,7 @@
cryptography = None # type: ignore


def info():
def info() -> Dict[str, Dict[str, str]]:
"""
Generate information for a bug report.
Based on the requests package help utility module.
Expand All @@ -29,13 +30,13 @@ def info():
implementation_version = platform.python_version()
elif implementation == "PyPy":
implementation_version = (
f"{sys.pypy_version_info.major}."
f"{sys.pypy_version_info.major}." # type: ignore[attr-defined]
f"{sys.pypy_version_info.minor}."
f"{sys.pypy_version_info.micro}"
)
if sys.pypy_version_info.releaselevel != "final":
if sys.pypy_version_info.releaselevel != "final": # type: ignore[attr-defined]
implementation_version = "".join(
[implementation_version, sys.pypy_version_info.releaselevel]
[implementation_version, sys.pypy_version_info.releaselevel] # type: ignore[attr-defined]
)
else:
implementation_version = "Unknown"
Expand All @@ -51,7 +52,7 @@ def info():
}


def main():
def main() -> None:
"""Pretty-print the bug information as JSON."""
print(json.dumps(info(), sort_keys=True, indent=2))

Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ docs =
zope.interface
crypto =
cryptography>=3.3.1
types-cryptography>=3.3.21
tests =
pytest>=6.0.0,<7.0.0
coverage[toml]==5.0.4
Expand All @@ -53,6 +54,7 @@ dev =
sphinx-rtd-theme
zope.interface
cryptography>=3.3.1
types-cryptography>=3.3.21
pytest>=6.0.0,<7.0.0
coverage[toml]==5.0.4
mypy
Expand Down