You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
xref #38076 - it can probably be extended beyond checking for classes.
Steps would be:
change PATTERN in scripts/check_for_inconsistent_pandas_namespace.py to
PATTERN = r"""
(
(?<!pd\.)(?<!\w) # check class_name doesn't start with pd. or character
(\w+)\( # match DataFrame but not pd.DataFrame or tm.makeDataFrame
.* # match anything
pd\.\2\( # only match e.g. pd.DataFrame
)|
(
pd\.(\w+)\( # only match e.g. pd.DataFrame
.* # match anything
(?<!pd\.)(?<!\w) # check class_name doesn't start with pd. or character
\4\( # match DataFrame but not pd.DataFrame or tm.makeDataFrame
)
"""
and save.
run pre-commit run inconsistent-namespace-usage --all-files, check the error messages, and fix them up
In the end, using a regex was too complicated / brittle for this, so in #39690 I've gone ahead and done it using ast.parse. It could still be expanded to other parts of the codebase, but I'll leave that for a separate issue
xref #38076 - it can probably be extended beyond checking for classes.
Steps would be:
PATTERN
inscripts/check_for_inconsistent_pandas_namespace.py
toand save.
pre-commit run inconsistent-namespace-usage --all-files
, check the error messages, and fix them upHere are the files which need fixing:
This can probably all be one in a single PR.
should return "PASSED".
The text was updated successfully, but these errors were encountered: