-
Notifications
You must be signed in to change notification settings - Fork 915
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
Standardize usage of collections.abc. #10679
Standardize usage of collections.abc. #10679
Conversation
@@ -279,7 +279,7 @@ cdef csv_reader_options make_csv_reader_options( | |||
) | |||
csv_reader_options_c.set_dtypes(c_dtypes_list) | |||
csv_reader_options_c.set_parse_hex(c_hex_col_indexes) | |||
elif isinstance(dtype, abc.Iterable): | |||
elif isinstance(dtype, abc.Collection): |
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.
We must use Collection
because an Iterable
is not guaranteed to support len(dtype)
below. Similarly in json.pyx
.
python/cudf/cudf/core/dataframe.py
Outdated
if isinstance(val, abc.Iterable): | ||
idxs.update(val) | ||
elif isinstance(val, str): | ||
idxs.add(val) |
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.
The order of these statements may be a bug. Strings meet the requirements of Iterable
, so the string code path may never be taken here. Strings should probably be handled first. I fixed this in 816319d.
Codecov Report
@@ Coverage Diff @@
## branch-22.06 #10679 +/- ##
================================================
+ Coverage 86.38% 86.41% +0.02%
================================================
Files 142 142
Lines 22334 22333 -1
================================================
+ Hits 19294 19299 +5
+ Misses 3040 3034 -6
Continue to review full report at Codecov.
|
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.
LGTM, minor comment.
Co-authored-by: GALI PREM SAGAR <[email protected]>
@gpucibot merge |
The codebase currently uses multiple ways of importing
collections.abc
classes in cudf. This can be problematic because the names incollections.abc
can overlap with names intyping
, so we need a way to disambiguate the two. This PR standardizes our imports such that abstract base classes follow a pattern so thatabc.
is always in the name of abstract base classes.