Skip to content

Commit 62b13c9

Browse files
committed
autoformat
1 parent 1feaf72 commit 62b13c9

File tree

11 files changed

+16
-22
lines changed

11 files changed

+16
-22
lines changed

guardrails/llm_providers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ def _invoke_llm(
278278
import torch
279279
except ImportError:
280280
raise PromptCallableException(
281-
"The `torch` package is not installed. "
282-
"Install with `pip install torch`"
281+
"The `torch` package is not installed. Install with `pip install torch`"
283282
)
284283
prompt = messages_to_prompt_string(messages)
285284
tokenizer = kwargs.pop("tokenizer")
@@ -384,8 +383,7 @@ def _invoke_llm(
384383
import torch # noqa: F401 # type: ignore
385384
except ImportError:
386385
raise PromptCallableException(
387-
"The `torch` package is not installed. "
388-
"Install with `pip install torch`"
386+
"The `torch` package is not installed. Install with `pip install torch`"
389387
)
390388

391389
content_key = kwargs.pop("content_key", "generated_text")

guardrails/utils/openai_utils/v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
def get_static_openai_create_func():
1717
warnings.warn(
18-
"This function is deprecated. " " and will be removed in 0.6.0",
18+
"This function is deprecated. and will be removed in 0.6.0",
1919
DeprecationWarning,
2020
)
2121
return openai.completions.create

guardrails/utils/prompt_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def prompt_content_for_string_schema(
2626
description = output_schema.get("description")
2727
if description:
2828
prompt_content += (
29-
"Here's a description of what I want you to generate: " f"{description}"
29+
f"Here's a description of what I want you to generate: {description}"
3030
)
3131
validators = validator_map.get(json_path, [])
3232
if len(validators):

guardrails/utils/structured_data_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def set_additional_properties_false_iteratively(schema):
2929
current["properties"].keys()
3030
) # this has to be set
3131
if "maximum" in current:
32-
logger.warn("Property maximum is not supported." " Dropping")
32+
logger.warn("Property maximum is not supported. Dropping")
3333
current.pop("maximum") # the api does not like these set
3434
if "minimum" in current:
35-
logger.warn("Property maximum is not supported." " Dropping")
35+
logger.warn("Property maximum is not supported. Dropping")
3636
current.pop("minimum") # the api does not like these set
3737
if "default" in current:
3838
logger.warn("Property default is not supported. Marking field Required")

guardrails/utils/validator_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def parse_rail_arguments(arg_tokens: List[str]) -> List[Any]:
3737
t = literal_eval(t)
3838
except (ValueError, SyntaxError, NameError) as e:
3939
raise ValueError(
40-
f"Python expression `{t}` is not valid, "
41-
f"and raised an error: {e}."
40+
f"Python expression `{t}` is not valid, and raised an error: {e}."
4241
)
4342
validator_args.append(t)
4443
return validator_args

guardrails/validator_service/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def should_run_sync():
4141
bool_values = ["true", "false"]
4242
if run_sync.lower() not in bool_values:
4343
warnings.warn(
44-
f"GUARDRAILS_RUN_SYNC must be one of {bool_values}!"
45-
f" Defaulting to 'false'."
44+
f"GUARDRAILS_RUN_SYNC must be one of {bool_values}! Defaulting to 'false'."
4645
)
4746
return process_count == 1 or run_sync.lower() == "true"
4847

tests/integration_tests/integrations/langchain/test_validator_runnable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def invoke(
5151
chain.invoke({"topic": topic})
5252

5353
assert str(exc_info.value) == (
54-
"The response from the LLM failed validation!" f" {expected_error}"
54+
f"The response from the LLM failed validation! {expected_error}"
5555
)
5656

5757
else:

tests/integration_tests/mock_llm_outputs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ def _invoke_llm(
138138
if hasattr(mock_llm_responses[key], "read"):
139139
out_text = mock_llm_responses[key]
140140
else:
141-
raise ValueError(
142-
"specify either prompt and instructions " "or messages"
143-
)
141+
raise ValueError("specify either prompt and instructions or messages")
144142
return LLMResponse(
145143
output=out_text,
146144
prompt_token_count=123,

tests/integration_tests/test_assets/validators/detect_pii.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def validate(self, value: Any, metadata: Dict[str, Any]) -> ValidationResult:
140140
entities_to_filter = pii_entities
141141
else:
142142
raise ValueError(
143-
f"`pii_entities` must be one of {pii_keys}" " or a list of strings."
143+
f"`pii_entities` must be one of {pii_keys} or a list of strings."
144144
)
145145

146146
# Analyze the text, and anonymize it if there is PII
@@ -174,7 +174,7 @@ def validate(self, value: Any, metadata: Dict[str, Any]) -> ValidationResult:
174174
ErrorSpan(
175175
start=diff_range[0],
176176
end=diff_range[1],
177-
reason=f"PII detected in {value[diff_range[0]:diff_range[1]]}",
177+
reason=f"PII detected in {value[diff_range[0] : diff_range[1]]}",
178178
)
179179
)
180180

tests/unit_tests/cli/hub/test_uninstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_remove_from_hub_inits(mocker):
2929
expected_calls = [
3030
call(
3131
"/site-packages/guardrails/hub/__init__.py",
32-
"from guardrails_grhub_test_package import " "Validator, Helper",
32+
"from guardrails_grhub_test_package import Validator, Helper",
3333
),
3434
]
3535

0 commit comments

Comments
 (0)