Upload backend/venv/lib/python3.10/site-packages/jwt/help.py with huggingface_hub
Browse files
backend/venv/lib/python3.10/site-packages/jwt/help.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import platform
|
| 3 |
+
import sys
|
| 4 |
+
from typing import Dict
|
| 5 |
+
|
| 6 |
+
from . import __version__ as pyjwt_version
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
import cryptography
|
| 10 |
+
|
| 11 |
+
cryptography_version = cryptography.__version__
|
| 12 |
+
except ModuleNotFoundError:
|
| 13 |
+
cryptography_version = ""
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def info() -> Dict[str, Dict[str, str]]:
|
| 17 |
+
"""
|
| 18 |
+
Generate information for a bug report.
|
| 19 |
+
Based on the requests package help utility module.
|
| 20 |
+
"""
|
| 21 |
+
try:
|
| 22 |
+
platform_info = {
|
| 23 |
+
"system": platform.system(),
|
| 24 |
+
"release": platform.release(),
|
| 25 |
+
}
|
| 26 |
+
except OSError:
|
| 27 |
+
platform_info = {"system": "Unknown", "release": "Unknown"}
|
| 28 |
+
|
| 29 |
+
implementation = platform.python_implementation()
|
| 30 |
+
|
| 31 |
+
if implementation == "CPython":
|
| 32 |
+
implementation_version = platform.python_version()
|
| 33 |
+
elif implementation == "PyPy":
|
| 34 |
+
pypy_version_info = sys.pypy_version_info # type: ignore[attr-defined]
|
| 35 |
+
implementation_version = (
|
| 36 |
+
f"{pypy_version_info.major}."
|
| 37 |
+
f"{pypy_version_info.minor}."
|
| 38 |
+
f"{pypy_version_info.micro}"
|
| 39 |
+
)
|
| 40 |
+
if pypy_version_info.releaselevel != "final":
|
| 41 |
+
implementation_version = "".join(
|
| 42 |
+
[
|
| 43 |
+
implementation_version,
|
| 44 |
+
pypy_version_info.releaselevel,
|
| 45 |
+
]
|
| 46 |
+
)
|
| 47 |
+
else:
|
| 48 |
+
implementation_version = "Unknown"
|
| 49 |
+
|
| 50 |
+
return {
|
| 51 |
+
"platform": platform_info,
|
| 52 |
+
"implementation": {
|
| 53 |
+
"name": implementation,
|
| 54 |
+
"version": implementation_version,
|
| 55 |
+
},
|
| 56 |
+
"cryptography": {"version": cryptography_version},
|
| 57 |
+
"pyjwt": {"version": pyjwt_version},
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def main() -> None:
|
| 62 |
+
"""Pretty-print the bug information as JSON."""
|
| 63 |
+
print(json.dumps(info(), sort_keys=True, indent=2))
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
main()
|