Skip to content

Commit 8dbbf5d

Browse files
🔧 Add pre-commit hooks and fix lint issues
- Add .pre-commit-config.yaml with ruff and mypy hooks - Fix mypy error: add type annotation to jwt.encode result - Fix ruff formatting in custom_reports.py - Remove invalid UP046 rule from pyproject.toml
1 parent 084a046 commit 8dbbf5d

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.8.3
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/mirrors-mypy
10+
rev: v1.13.0
11+
hooks:
12+
- id: mypy
13+
additional_dependencies:
14+
- pydantic>=2.9.0
15+
- pydantic-settings>=2.6.0
16+
- httpx>=0.27.0
17+
- pandas-stubs>=2.2.0
18+
- types-requests
19+
args: [--ignore-missing-imports]
20+
pass_filenames: false
21+
entry: mypy asa_api_client

asa_api_client/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _generate_client_secret(self) -> str:
213213
}
214214

215215
try:
216-
client_secret = jwt.encode(
216+
client_secret: str = jwt.encode(
217217
payload,
218218
self._private_key,
219219
algorithm=ALGORITHM,

asa_api_client/resources/custom_reports.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ def _get_headers(self) -> dict[str, str]:
107107

108108
async def _get_headers_async(self) -> dict[str, str]:
109109
"""Get headers for async API requests."""
110-
token = await self._client._authenticator.get_access_token_async(
111-
self._async_http_client
112-
)
110+
token = await self._client._authenticator.get_access_token_async(self._async_http_client)
113111
return {
114112
"Authorization": token.authorization_header,
115113
"X-AP-Context": f"orgId={self._client.org_id}",

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ select = [
115115
ignore = [
116116
"D100", # Missing docstring in public module
117117
"D104", # Missing docstring in public package
118-
"UP046", # Generic class uses Generic subclass instead of type params (requires invasive changes)
119118
]
120119

121120
[tool.ruff.lint.pydocstyle]

0 commit comments

Comments
 (0)