Skip to content

Commit 7cc3d78

Browse files
committed
fix: fix mypy issues
1 parent 8054479 commit 7cc3d78

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ jobs:
2929
3030
- name: Run checks
3131
run: |
32-
poetry run ruff check .
33-
poetry run ruff format --check .
34-
poetry run mypy .
32+
poetry run make check

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ lint:
1515
ruff check . --fix
1616
mypy .
1717

18+
.PHONY: check
19+
check:
20+
ruff check .
21+
ruff format . --check
22+
mypy .
23+
1824
# Windows only
1925
PHONY: kill
2026
kill:

fastlink/jwt/manager.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def create(self, token_type: str, payload: JWTPayload) -> str:
2626
)
2727
if config.expires_in is not None:
2828
claims["exp"] = now + config.expires_in
29+
assert config.private_key is not None
2930
return jwt.encode(
3031
claims,
3132
config.private_key,
@@ -37,13 +38,14 @@ def validate(
3738
token_type: str,
3839
token: str,
3940
) -> JWTPayload:
40-
params = self.config[token_type]
41+
config = self.config[token_type]
42+
assert config.public_key is not None
4143
try:
4244
decoded = jwt.decode(
4345
token,
44-
params.public_key,
45-
algorithms=[params.algorithm],
46-
issuer=params.issuer,
46+
config.public_key,
47+
algorithms=[config.algorithm],
48+
issuer=config.issuer,
4749
)
4850
except JWTInvalidTokenError as e:
4951
raise TokenError from e

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Repository = "https://github.com/everysoftware/fastlink"
4343

4444
[tool.poetry.dependencies]
4545
python = "^3.12"
46-
pydantic = "^2.11.5"
4746
httpx = "^0.28.1"
4847
pyjwt = "^2.10.1"
4948
fastapi = {extras = ["standart"], version = "^0.115.7"}
5049
aiogram = "^3.20.0.post0"
50+
pydantic = "^2.11.5"
5151

5252
[tool.poetry.group.dev.dependencies]
5353
ruff = "^0.9.3"
@@ -143,9 +143,5 @@ disallow_incomplete_defs = true
143143
disallow_untyped_decorators = true
144144
disallow_any_unimported = false
145145

146-
[[tool.mypy.overrides]]
147-
module = "*.*"
148-
ignore_missing_imports = true
149-
150146
[tool.pytest.ini_options]
151147
asyncio_mode = "auto"

0 commit comments

Comments
 (0)