Skip to content

Commit af011a0

Browse files
authored
MAINT strict mypy checking on the whole repository (microsoft#1310)
1 parent b029f02 commit af011a0

160 files changed

Lines changed: 1147 additions & 954 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,11 @@ repos:
5555
hooks:
5656
- id: mypy
5757
name: mypy (strict)
58-
files: &strict_modules ^pyrit/(auth|analytics|embedding|exceptions|memory|prompt_normalizer)/
58+
files: &strict_modules ^pyrit/
5959
args: [--install-types, --non-interactive, --ignore-missing-imports, --sqlite-cache, --cache-dir=.mypy_cache, --strict]
6060
entry: mypy
6161
language: system
6262
types: [ python ]
63-
- id: mypy
64-
name: mypy (regular)
65-
exclude: *strict_modules
66-
args: [--install-types, --non-interactive, --ignore-missing-imports, --sqlite-cache, --cache-dir=.mypy_cache]
67-
entry: mypy
68-
language: system
69-
types: [ python ]
7063

7164
- repo: local
7265
hooks:

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,17 @@ dev = [
8484
"ruff>=0.14.4",
8585
"sphinxcontrib-mermaid>=1.0.0",
8686
"types-aiofiles>=24.1.0",
87+
"types-cachetools>=5.5.0",
88+
"types-decorator>=5.1.0",
89+
"types-paramiko>=3.5.0",
90+
"types-pycurl>=7.45.0",
91+
"types-pytz>=2024.2.0",
8792
"types-PyYAML>=6.0.12.20250516",
8893
"types-requests>=2.31.0.20250515",
94+
"types-simplejson>=3.19.0",
95+
"types-six>=1.16.0",
96+
"types-tabulate>=0.9.0",
97+
"types-ujson>=5.10.0",
8998
]
9099
huggingface = [
91100
"torch>=2.7.0",

pyrit/analytics/conversation_analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_similar_chat_messages_by_embedding(
9090
return similar_messages
9191

9292

93-
def cosine_similarity(a: np.ndarray, b: np.ndarray) -> float:
93+
def cosine_similarity(a: np.ndarray, b: np.ndarray) -> float: # type: ignore[type-arg, unused-ignore]
9494
"""
9595
Calculate the cosine similarity between two 1D vectors.
9696

pyrit/auth/azure_storage_auth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Licensed under the MIT license.
33

44
from datetime import datetime, timedelta
5-
from typing import cast
65
from urllib.parse import urlparse
76

87
from azure.identity.aio import DefaultAzureCredential
@@ -89,11 +88,11 @@ async def get_sas_token(container_url: str) -> str:
8988
account_name=storage_account_name,
9089
container_name=container_name,
9190
user_delegation_key=user_delegation_key,
92-
permission=ContainerSasPermissions(read=True, write=True, create=True, list=True, delete=True), # type: ignore
91+
permission=ContainerSasPermissions(read=True, write=True, create=True, list=True, delete=True), # type: ignore[no-untyped-call, unused-ignore]
9392
expiry=expiry_time,
9493
start=start_time,
9594
)
9695
finally:
9796
await credential.close()
9897

99-
return cast(str, sas_token)
98+
return sas_token # type: ignore[return-value, no-any-return, unused-ignore]

0 commit comments

Comments
 (0)