Skip to content

Commit

Permalink
Upgrading pyyaml dependency to fix build failures (#2300)
Browse files Browse the repository at this point in the history
* Update pyyaml from 6.0 to 6.0.1

* switching to .format from fstring

* formatting
  • Loading branch information
kgeller committed Nov 7, 2023
1 parent 417f859 commit e8a8d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pip
# License: MIT
PyYAML==6.0
PyYAML==6.0.1
# License: BSD
gitpython==3.1.37
# License: BSD
Expand Down
9 changes: 6 additions & 3 deletions scripts/schema/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ 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 +296,15 @@ 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 e8a8d5a

Please sign in to comment.