add pydantic support to mypy

This commit is contained in:
Alexandre Teles 2022-09-05 11:48:27 -03:00
parent 7a9f23e75a
commit f559730107
7 changed files with 27 additions and 25 deletions

22
main.py
View File

@ -1,19 +1,19 @@
#!/usr/bin/env python3
import os
import toml
import uvicorn
import aioredis
from fastapi import FastAPI, Request, Response
import toml #type: ignore
import uvicorn #type: ignore
import aioredis #type: ignore
from fastapi import FastAPI, Request, Response #type: ignore
from modules.Releases import Releases
from fastapi.responses import RedirectResponse
from fastapi.responses import RedirectResponse #type: ignore
import modules.ResponseModels as ResponseModels
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.util import get_remote_address
from slowapi.errors import RateLimitExceeded
from fastapi_cache import FastAPICache
from fastapi_cache.backends.redis import RedisBackend
from fastapi_cache.decorator import cache
from slowapi import Limiter, _rate_limit_exceeded_handler #type: ignore
from slowapi.util import get_remote_address #type: ignore
from slowapi.errors import RateLimitExceeded #type: ignore
from fastapi_cache import FastAPICache #type: ignore
from fastapi_cache.backends.redis import RedisBackend #type: ignore
from fastapi_cache.decorator import cache #type: ignore
"""Get latest ReVanced releases from GitHub API."""

View File

@ -1,7 +1,7 @@
import os
import toml
import msgpack
import aioredis
import toml #type: ignore
import msgpack #type: ignore
import aioredis #type: ignore
# Load config

View File

@ -1,6 +1,6 @@
import os
import orjson
import httpx_cache
import orjson #type: ignore
import httpx_cache #type: ignore
from base64 import b64decode
from modules.InternalCache import InternalCache

2
mypy.ini Normal file
View File

@ -0,0 +1,2 @@
[mypy]
plugins = pydantic.mypy

10
poetry.lock generated
View File

@ -104,7 +104,7 @@ dev = ["PyTest (<5)", "PyTest-Cov (<2.6)", "bump2version (<1)", "configparser (<
[[package]]
name = "fastapi"
version = "0.81.0"
version = "0.82.0"
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
category = "main"
optional = false
@ -497,7 +497,7 @@ python-versions = ">=3.7"
name = "types-toml"
version = "0.10.8"
description = "Typing stubs for toml"
category = "main"
category = "dev"
optional = false
python-versions = "*"
@ -574,7 +574,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
[metadata]
lock-version = "1.1"
python-versions = "^3.10"
content-hash = "33285f8fe530773f3688461fbe9c4261fdf08d05480014eb59512d86b21bf491"
content-hash = "2b0b56a7745c55184de59a2ef30f617e8ba020382033e4fc855147ba096637a3"
[metadata.files]
aioredis = [
@ -614,8 +614,8 @@ deprecated = [
{file = "Deprecated-1.2.13.tar.gz", hash = "sha256:43ac5335da90c31c24ba028af536a91d41d53f9e6901ddb021bcc572ce44e38d"},
]
fastapi = [
{file = "fastapi-0.81.0-py3-none-any.whl", hash = "sha256:9ac5f5d252b4b394df29accb1ed4bedf30e0e87fc6eb7ec75e1449fa040bfc17"},
{file = "fastapi-0.81.0.tar.gz", hash = "sha256:9dafdc41feda85ee5acf0f7dd6bcb7fd946318a6664b41fd33e33b26f666a346"},
{file = "fastapi-0.82.0-py3-none-any.whl", hash = "sha256:a4269329a7374c78f6e92c195d14cc4ce3a525e25b79e62edf2df8196469743f"},
{file = "fastapi-0.82.0.tar.gz", hash = "sha256:5ee7b7473a55940a18d4869ff57d29c372363bf8d3033a0e660a8cf38b1d3d9e"},
]
fastapi-cache2 = [
{file = "fastapi-cache2-0.1.9.tar.gz", hash = "sha256:816612f7b29b4ea4ed3b4e03c55b7f96b4e4d6dffce6a95e2cf5cf36a980eaaa"},

View File

@ -18,7 +18,7 @@ fastapi-cache2 = ">=0.1.9"
aioredis = {version = ">=2.0.1", extras = ["hiredis"]}
redis = ">=4.3.4"
msgpack = ">=1.0.4"
types-toml = ">=0.10.8"
pydantic = ">=1.10.1"
[tool.poetry.dev-dependencies]
mypy = ">=0.971"
@ -33,6 +33,7 @@ fastapi-cache2 = ">=0.1.9"
aioredis = {version = ">=2.0.1", extras = ["hiredis"]}
redis = ">=4.3.4"
msgpack = ">=1.0.4"
pydantic = ">=1.10.1"
types-toml = ">=0.10.8"
[build-system]

View File

@ -8,7 +8,7 @@ click==8.1.3; python_version >= "3.7" and python_version < "4.0"
colorama==0.4.5; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" and python_version < "4.0" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0" and python_version < "4.0" and platform_system == "Windows"
deprecated==1.2.13; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
fastapi-cache2==0.1.9; python_version >= "3.7" and python_version < "4.0"
fastapi==0.81.0; python_full_version >= "3.6.1"
fastapi==0.82.0; python_full_version >= "3.6.1"
fasteners==0.17.3; python_version >= "3.7" and python_version < "4.0"
h11==0.12.0; python_version >= "3.7" and python_version < "4.0"
h2==4.1.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
@ -25,7 +25,7 @@ msgpack==1.0.4
orjson==3.8.0; python_version >= "3.7"
packaging==21.3; python_version >= "3.6"
pendulum==2.1.2; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.5.0"
pydantic==1.10.1; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
pydantic==1.10.1; python_version >= "3.7"
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.6"
python-dateutil==2.8.2; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.5.0"
python-dotenv==0.21.0; python_version >= "3.7" and python_version < "4.0"
@ -38,7 +38,6 @@ slowapi==0.1.6; python_version >= "3.7" and python_version < "4.0"
sniffio==1.3.0; python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.6.2"
starlette==0.19.1; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
toml==0.10.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
types-toml==0.10.8
typing-extensions==4.3.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
uvicorn==0.18.3; python_version >= "3.7"
uvloop==0.16.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy" and python_version >= "3.7" and python_version < "4.0"