New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MAINTENANCE] Typing Improvements - render/util #8279
Conversation
Co-authored-by: Tyler Hoffman <tyler-hoffman@users.noreply.github.com> Co-authored-by: Bill Dirks <bill.dirks@gmail.com> Co-authored-by: William Shin <Shinnnyshinshin@users.noreply.github.com> Co-authored-by: Chetan Kini <ckini123@gmail.com> Co-authored-by: T Pham <TrangPham@users.noreply.github.com>
✅ Deploy Preview for niobium-lead-7998 canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great_expectations/render/util.py:399: error: Item "int" of
"Union[Dict[Any, Any], int]" has no attribute "keys" [union-attr]
set(unexpected_index_list[0].keys()).difference(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
great_expectations/render/util.py:411: error: Name "domain_column_name_list"
already defined on line 398 [no-redef]
domain_column_name_list: list[str] = ["Value"]
^
great_expectations/render/util.py:412: error: Name
"unexpected_index_column_names" already defined on line 3[67](https://github.com/great-expectations/great_expectations/actions/runs/5523788553/jobs/10075189436?pr=8279#step:7:68) [no-redef]
unexpected_index_column_names: list[str] = ["Index"]
^
great_expectations/render/util.py:422: error: Value of type
"Optional[List[str]]" is not indexable [index]
col_to_count: str = unexpected_index_column_names[0]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
great_expectations/render/util.py:431: error: Item "None" of
"Optional[List[str]]" has no attribute "__iter__" (not iterable) [union-attr]
for column in unexpected_index_column_names:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 5 errors in 1 file (checked 515 source files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I wanted to highlight one issue inline.
set(unexpected_index_list[0].keys()).difference( | ||
set(unexpected_index_column_names) | ||
first_unexpected_index = unexpected_index_list[0] | ||
if isinstance(first_unexpected_index, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a potential crasher. If first_unexpected_index
is not a dict
then we go into this branch but domain_column_name_list
is never defined. We then crash when referring to it on line 419 below. You could instantiate it above or raise
in an else
to this if isinstance
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this @billdirks. updating now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated to include a TypeError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Shinnnyshinshin !!
invoke lint
(usesblack
+ruff
)For more details, see our Contribution Checklist, Coding style guide, and Documentation style guide.
After you submit your PR, keep the page open and monitor the statuses of the various checks made by our continuous integration process at the bottom of the page. Please fix any issues that come up and reach out on Slack if you need help. Thanks for contributing!