Skip to content

Commit 6f5b784

Browse files
New lint and format fixes
1 parent 0b85ad1 commit 6f5b784

File tree

22 files changed

+61
-71
lines changed

22 files changed

+61
-71
lines changed

guardrails/classes/history/call.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ def validation_response(self) -> Optional[Union[str, Dict, ReAsk]]:
227227
self.inputs.full_schema_reask
228228
or number_of_iterations < 2
229229
or isinstance(
230-
self.iterations.last.validation_response, ReAsk # type: ignore
230+
self.iterations.last.validation_response,
231+
ReAsk, # type: ignore
231232
)
232233
or isinstance(self.iterations.last.validation_response, str) # type: ignore
233234
):
@@ -410,9 +411,7 @@ def tree(self) -> Tree:
410411
title="Validated Output",
411412
style="on #F0FFF0",
412413
)
413-
tree.children[
414-
-1
415-
].label.renderable._renderables = previous_panels + ( # type: ignore
414+
tree.children[-1].label.renderable._renderables = previous_panels + ( # type: ignore
416415
validated_outcome_panel,
417416
)
418417

guardrails/classes/history/iteration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def status(self) -> str:
166166
@property
167167
def rich_group(self) -> Group:
168168
def create_msg_history_table(
169-
msg_history: Optional[List[Dict[str, Prompt]]]
169+
msg_history: Optional[List[Dict[str, Prompt]]],
170170
) -> Union[str, Table]:
171171
if msg_history is None:
172172
return "No message history."

guardrails/cli/hub/install.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ def install(
245245

246246
console.print(f"\nInstalling {package_uri}...\n")
247247
logger.log(
248-
level=LEVELS.get("SPAM"), msg=f"Installing {package_uri}..." # type: ignore
248+
level=LEVELS.get("SPAM"),
249+
msg=f"Installing {package_uri}...", # type: ignore
249250
)
250251

251252
# Validation

guardrails/cli/logger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import logging
22
import os
33

4-
os.environ[
5-
"COLOREDLOGS_LEVEL_STYLES"
6-
] = "spam=white,faint;success=green,bold;debug=magenta;verbose=blue;notice=cyan,bold;warning=yellow;error=red;critical=background=red" # noqa
4+
os.environ["COLOREDLOGS_LEVEL_STYLES"] = (
5+
"spam=white,faint;success=green,bold;debug=magenta;verbose=blue;notice=cyan,bold;warning=yellow;error=red;critical=background=red" # noqa
6+
)
77
LEVELS = {
88
"SPAM": 5,
99
"VERBOSE": 15,

guardrails/document_store.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ class DocumentStoreBase(ABC):
5252
The store can be queried by text for similar documents.
5353
"""
5454

55-
def __init__(self, vector_db: VectorDBBase, path: Optional[str] = None):
56-
...
55+
def __init__(self, vector_db: VectorDBBase, path: Optional[str] = None): ...
5756

5857
@abstractmethod
5958
def add_document(self, document: Document) -> None:
@@ -182,9 +181,7 @@ class RealSqlDocument(Base):
182181
__tablename__ = "documents"
183182

184183
id: Mapped[int] = mapped_column(primary_key=True) # type: ignore
185-
page_num: Mapped[int] = mapped_column(
186-
sqlalchemy.Integer, primary_key=True
187-
) # type: ignore
184+
page_num: Mapped[int] = mapped_column(sqlalchemy.Integer, primary_key=True) # type: ignore
188185
text: Mapped[str] = mapped_column(sqlalchemy.String) # type: ignore
189186
meta: Mapped[dict] = mapped_column(sqlalchemy.PickleType) # type: ignore
190187
vector_index: Mapped[int] = mapped_column(sqlalchemy.Integer) # type: ignore

guardrails/guard.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ def __call__(
467467
stream: Optional[bool] = False,
468468
*args,
469469
**kwargs,
470-
) -> Union[ValidationOutcome[OT], Iterable[ValidationOutcome[OT]]]:
471-
...
470+
) -> Union[ValidationOutcome[OT], Iterable[ValidationOutcome[OT]]]: ...
472471

473472
@overload
474473
def __call__(
@@ -483,8 +482,7 @@ def __call__(
483482
full_schema_reask: Optional[bool] = None,
484483
*args,
485484
**kwargs,
486-
) -> Awaitable[ValidationOutcome[OT]]:
487-
...
485+
) -> Awaitable[ValidationOutcome[OT]]: ...
488486

489487
def __call__(
490488
self,
@@ -811,8 +809,7 @@ def parse(
811809
full_schema_reask: Optional[bool] = None,
812810
*args,
813811
**kwargs,
814-
) -> ValidationOutcome[OT]:
815-
...
812+
) -> ValidationOutcome[OT]: ...
816813

817814
@overload
818815
def parse(
@@ -825,8 +822,7 @@ def parse(
825822
full_schema_reask: Optional[bool] = None,
826823
*args,
827824
**kwargs,
828-
) -> Awaitable[ValidationOutcome[OT]]:
829-
...
825+
) -> Awaitable[ValidationOutcome[OT]]: ...
830826

831827
@overload
832828
def parse(
@@ -839,8 +835,7 @@ def parse(
839835
full_schema_reask: Optional[bool] = None,
840836
*args,
841837
**kwargs,
842-
) -> ValidationOutcome[OT]:
843-
...
838+
) -> ValidationOutcome[OT]: ...
844839

845840
def parse(
846841
self,
@@ -1194,14 +1189,12 @@ def __add_validator(self, validator: Validator, on: str = "output"):
11941189
)
11951190

11961191
@overload
1197-
def use(self, validator: Validator, *, on: str = "output") -> "Guard":
1198-
...
1192+
def use(self, validator: Validator, *, on: str = "output") -> "Guard": ...
11991193

12001194
@overload
12011195
def use(
12021196
self, validator: Type[Validator], *args, on: str = "output", **kwargs
1203-
) -> "Guard":
1204-
...
1197+
) -> "Guard": ...
12051198

12061199
def use(
12071200
self,
@@ -1227,8 +1220,7 @@ def use(
12271220
return self
12281221

12291222
@overload
1230-
def use_many(self, *validators: Validator, on: str = "output") -> "Guard":
1231-
...
1223+
def use_many(self, *validators: Validator, on: str = "output") -> "Guard": ...
12321224

12331225
@overload
12341226
def use_many(
@@ -1239,8 +1231,7 @@ def use_many(
12391231
Optional[Dict[str, Any]],
12401232
],
12411233
on: str = "output",
1242-
) -> "Guard":
1243-
...
1234+
) -> "Guard": ...
12441235

12451236
def use_many(
12461237
self,

guardrails/llm_providers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ def model_is_supported_server_side(
946946

947947
# FIXME: Update with newly supported LLMs
948948
def get_llm_api_enum(
949-
llm_api: Callable[[Any], Awaitable[Any]]
949+
llm_api: Callable[[Any], Awaitable[Any]],
950950
) -> Optional[ValidatePayloadLlmApi]:
951951
# TODO: Distinguish between v1 and v2
952952
if llm_api == get_static_openai_create_func():

guardrails/prompt/base_prompt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Class for representing a prompt entry."""
2+
23
import re
34
from string import Template
45
from typing import Optional

guardrails/prompt/instructions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Instructions to the LLM, to be passed in the prompt."""
2+
23
from string import Template
34

45
from guardrails.utils.parsing_utils import get_template_variables

guardrails/prompt/prompt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The LLM prompt."""
2+
23
from string import Template
34

45
from guardrails.utils.parsing_utils import get_template_variables

0 commit comments

Comments
 (0)