Skip to content

Commit

Permalink
switching to .format from fstring
Browse files Browse the repository at this point in the history
  • Loading branch information
kgeller committed Nov 7, 2023
1 parent a16de40 commit 92b6de4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/schema/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def check_example_value(field: Union[List, FieldEntry], strict: Optional[bool] =

if isinstance(example_value, (list, dict)):
field_name: str = field['field_details']['name']
msg: str = f"Example value for field `{field_name}` contains an object or array which must be quoted to avoid YAML interpretation."
msg: str = "Example value for field `{}` contains an object or array which must be quoted to avoid YAML interpretation.".format(field_name)
strict_warning_handler(msg, strict)

# Examples with arrays must be handled
Expand All @@ -295,13 +295,13 @@ def check_example_value(field: Union[List, FieldEntry], strict: Optional[bool] =
for example_value in example_values:
match = re.match(pattern, example_value)
if not match:
msg = f"Example value for field `{name}` does not match the regex defined in the pattern attribute: `{pattern}`."
msg = "Example value for field `{}` does not match the regex defined in the pattern attribute: `{}`.".format(name, pattern)
strict_warning_handler(msg, strict)

if expected_values:
for example_value in example_values:
if example_value not in expected_values:
msg = f"Example value `{example_value}` for field `{name}` is not one of the values defined in `expected_value`: {expected_values}."
msg = "Example value `{}` for field `{}` is not one of the values defined in `expected_value`: {}.".format(example_value, name, example_values)
strict_warning_handler(msg, strict)


Expand Down

0 comments on commit 92b6de4

Please sign in to comment.