Skip to content

Commit 46ad0b8

Browse files
romanlutzbiefanCopilot
authored
MAINT: Reword property docstrings to noun phrases (D421) (#2097)
Co-authored-by: biefan <70761325+biefan@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 965093b commit 46ad0b8

80 files changed

Lines changed: 118 additions & 118 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.

pyrit/backend/models/attacks.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ScoreView(Score):
4444
@computed_field # type: ignore[prop-decorator]
4545
@property
4646
def scorer_type(self) -> str:
47-
"""Return the scorer class name, or ``"Unknown"`` when unavailable."""
47+
"""The scorer class name, or ``"Unknown"`` when unavailable."""
4848
identifier = self.scorer_class_identifier
4949
if identifier and identifier.class_name:
5050
return identifier.class_name
@@ -188,19 +188,19 @@ class MessageView(Message):
188188
@computed_field # type: ignore[prop-decorator]
189189
@property
190190
def turn_number(self) -> int:
191-
"""Return the sequence of the first piece (the conversation turn)."""
191+
"""The sequence of the first piece (the conversation turn)."""
192192
return self.message_pieces[0].sequence if self.message_pieces else 0
193193

194194
@computed_field # type: ignore[prop-decorator]
195195
@property
196196
def role(self) -> ChatMessageRole:
197-
"""Return the role of the first piece."""
197+
"""The role of the first piece."""
198198
return self.message_pieces[0].role if self.message_pieces else "user"
199199

200200
@computed_field # type: ignore[prop-decorator]
201201
@property
202202
def created_at(self) -> datetime:
203-
"""Return the timestamp of the first piece."""
203+
"""The timestamp of the first piece."""
204204
return self.message_pieces[0].timestamp if self.message_pieces else datetime.now(timezone.utc)
205205

206206

@@ -242,21 +242,21 @@ def _serialize_related_conversations(self, conversations: set[ConversationRefere
242242
@computed_field # type: ignore[prop-decorator]
243243
@property
244244
def attack_type(self) -> str:
245-
"""Return the attack strategy class name, or ``"Unknown"``."""
245+
"""The attack strategy class name, or ``"Unknown"``."""
246246
identifier = self.get_attack_strategy_identifier()
247247
return identifier.class_name if identifier else "Unknown"
248248

249249
@computed_field # type: ignore[prop-decorator]
250250
@property
251251
def attack_specific_params(self) -> dict[str, Any] | None:
252-
"""Return the attack strategy params, or ``None``."""
252+
"""The attack strategy params, or ``None``."""
253253
identifier = self.get_attack_strategy_identifier()
254254
return (identifier.params or None) if identifier else None
255255

256256
@computed_field # type: ignore[prop-decorator]
257257
@property
258258
def target(self) -> TargetInfo | None:
259-
"""Return the objective target info extracted from the identifier."""
259+
"""The objective target info extracted from the identifier."""
260260
identifier = self.get_attack_strategy_identifier()
261261
target_id = identifier.get_child("objective_target") if identifier else None
262262
if not target_id:
@@ -270,15 +270,15 @@ def target(self) -> TargetInfo | None:
270270
@computed_field # type: ignore[prop-decorator]
271271
@property
272272
def converters(self) -> list[str]:
273-
"""Return the request-converter class names applied in this attack."""
273+
"""The request-converter class names applied in this attack."""
274274
identifier = self.get_attack_strategy_identifier()
275275
converter_ids = identifier.get_child_list("request_converters") if identifier else []
276276
return [c.class_name for c in converter_ids]
277277

278278
@computed_field # type: ignore[prop-decorator]
279279
@property
280280
def related_conversation_ids(self) -> list[str]:
281-
"""Return the IDs of related conversations, sorted for stable output."""
281+
"""The IDs of related conversations, sorted for stable output."""
282282
return sorted(ref.conversation_id for ref in self.related_conversations)
283283

284284

pyrit/common/apply_defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def reset_defaults(self) -> None:
152152

153153
@property
154154
def all_defaults(self) -> dict[DefaultValueScope, Any]:
155-
"""Get a copy of all current default values."""
155+
"""A copy of all current default values."""
156156
return self._default_values.copy()
157157

158158

pyrit/datasets/seed_datasets/local/jailbreak_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, *, templates_path: Path = JAILBREAK_TEMPLATES_PATH) -> None:
5151
@property
5252
@override
5353
def dataset_name(self) -> str:
54-
"""Return the dataset name."""
54+
"""The dataset name."""
5555
return "jailbreak_templates"
5656

5757
@override

pyrit/datasets/seed_datasets/local/local_dataset_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, *, file_path: Path) -> None:
5050

5151
@property
5252
def dataset_name(self) -> str:
53-
"""Return the dataset name."""
53+
"""The dataset name."""
5454
return self._dataset_name
5555

5656
async def fetch_dataset_async(self, *, cache: bool = True) -> SeedDataset:

pyrit/datasets/seed_datasets/remote/aegis_ai_content_safety_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(
115115
@property
116116
@override
117117
def dataset_name(self) -> str:
118-
"""Return the dataset name."""
118+
"""The dataset name."""
119119
return "aegis_content_safety"
120120

121121
@override

pyrit/datasets/seed_datasets/remote/agent_threat_rules_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(
204204
@property
205205
@override
206206
def dataset_name(self) -> str:
207-
"""Return the dataset name."""
207+
"""The dataset name."""
208208
return "agent_threat_rules"
209209

210210
@override

pyrit/datasets/seed_datasets/remote/aya_redteaming_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100
@property
101101
@override
102102
def dataset_name(self) -> str:
103-
"""Return the dataset name."""
103+
"""The dataset name."""
104104
return "aya_redteaming"
105105

106106
@override

pyrit/datasets/seed_datasets/remote/babelscape_alert_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
@property
8181
@override
8282
def dataset_name(self) -> str:
83-
"""Return the dataset name."""
83+
"""The dataset name."""
8484
return "babelscape_alert"
8585

8686
@override

pyrit/datasets/seed_datasets/remote/beaver_tails_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(
5454

5555
@property
5656
def dataset_name(self) -> str:
57-
"""Return the dataset name."""
57+
"""The dataset name."""
5858
return "beaver_tails"
5959

6060
async def fetch_dataset_async(self, *, cache: bool = True) -> SeedDataset:

pyrit/datasets/seed_datasets/remote/categorical_harmful_qa_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(
6868

6969
@property
7070
def dataset_name(self) -> str:
71-
"""Return the dataset name."""
71+
"""The dataset name."""
7272
return "categorical_harmful_qa"
7373

7474
async def fetch_dataset_async(self, *, cache: bool = True) -> SeedDataset:

0 commit comments

Comments
 (0)