Skip to content

Commit

Permalink
Remove redundant schema_path variable
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Binder <binder_stefan@outlook.com>
  • Loading branch information
joelostblom and binste authored Feb 19, 2023
1 parent 33296b0 commit 5623808
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions altair/utils/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,8 @@ def __str__(self):
)

# Output all existing parameters when an unknown parameter is specified
if (
hasattr(vegalite, schema_path.split(".")[-1])
and self.validator == "additionalProperties"
):
altair_class = schema_path.split(".")[-1]
vegalite_core_class = getattr(vegalite, schema_path.split(".")[-1])
param_dict_keys = inspect.signature(vegalite_core_class).parameters.keys()
if self.validator == "additionalProperties":
param_dict_keys = inspect.signature(cls).parameters.keys()
param_names_table = self._format_params_as_table(param_dict_keys)

# `cleandoc` removes multiline string indentation in the output
Expand All @@ -259,18 +254,18 @@ def __str__(self):
{}
See the help for `{}` to read the full description of these parameters
""".format(
altair_class,
cls.__name__,
self.message.split("('")[-1].split("'")[0],
param_names_table,
altair_class,
cls.__name__,
)
)
# Use the default error message for all other cases than unknown parameter errors
else:
message = self.message
# Add a summary line when parameters are passed an invalid value
# For example: "'asdf' is an invalid value for `stack`
if hasattr(vegalite, schema_path.split(".")[-1]) and self.absolute_path:
if self.absolute_path:
# The indentation here must match that of `cleandoc` below
message = f"""'{self.instance}' is an invalid value for `{self.absolute_path[-1]}`:
Expand Down

0 comments on commit 5623808

Please sign in to comment.