Skip to content

Commit

Permalink
[BUGFIX] scrapy compatibility - handle dir() inconsistencies (#9830)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilo59 committed Apr 29, 2024
1 parent 1ed12ad commit bf94a26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion great_expectations/expectations/expectation.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ def _register_renderer_functions(cls) -> None:
expectation_type: str = camel_to_snake(cls.__name__)

for candidate_renderer_fn_name in dir(cls):
attr_obj: Callable = getattr(cls, candidate_renderer_fn_name)
attr_obj: Callable | None = getattr(cls, candidate_renderer_fn_name, None)
# attrs are not guaranteed to exist https://docs.python.org/3.10/library/functions.html#dir
if attr_obj is None:
continue
if not hasattr(attr_obj, "_renderer_type"):
continue
register_renderer(
Expand Down

0 comments on commit bf94a26

Please sign in to comment.