Skip to content

CI,STYLE: narrow down list of ignored words #38811

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

Closed
wants to merge 0 commits into from
Closed

CI,STYLE: narrow down list of ignored words #38811

wants to merge 0 commits into from

Conversation

chinggg
Copy link
Contributor

@chinggg chinggg commented Dec 30, 2020

I have used grep to check if the words in the list exist in the code.
Only ba can be deleted from the list.

@jreback jreback added the Code Style Code style, linting, code_checks label Dec 30, 2020
@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

@chinggg we can delete these if we change the references to better words where appropriate

@MarcoGorelli
Copy link
Member

I don't think it can be removed:

codespell..............................................................................................Failed
- hook id: codespell
- exit code: 65

pandas/core/resample.py:1383: BA ==> BY, BE
pandas/core/shared_docs.py:604: ba ==> by, be
pandas/core/shared_docs.py:610: ba ==> by, be
pandas/core/shared_docs.py:616: ba ==> by, be
pandas/core/shared_docs.py:622: ba ==> by, be
pandas/core/shared_docs.py:628: ba ==> by, be

Rather, it may be that you can change the occurrences of these "words" in the code to more meaningful ones such that they don't have to be ignored

ba is used in

    >>> df.replace(to_replace=r'^ba.$', value='new', regex=True)

so it likely can't be removed


to check whether something can be removed, you should run

pre-commit run codespell --all-files

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Dec 30, 2020

On the other hand, fo can be removed by applying

diff --git a/pandas/core/strings/accessor.py b/pandas/core/strings/accessor.py
index 339ad2653..975115584 100644
--- a/pandas/core/strings/accessor.py
+++ b/pandas/core/strings/accessor.py
@@ -1547,10 +1547,10 @@ class StringMethods(NoNewAttributesMixin):
 
         Examples
         --------
-        >>> s = pd.Series(["koala", "fox", "chameleon"])
+        >>> s = pd.Series(["koala", "nox", "chameleon"])
         >>> s
         0        koala
-        1          fox
+        1          nox
         2    chameleon
         dtype: object
 
@@ -1568,19 +1568,19 @@ class StringMethods(NoNewAttributesMixin):
 
         >>> s.str.slice(stop=2)
         0    ko
-        1    fo
+        1    no
         2    ch
         dtype: object
 
         >>> s.str.slice(step=2)
         0      kaa
-        1       fx
+        1       nx
         2    caeen
         dtype: object
 
         >>> s.str.slice(start=0, stop=5, step=3)
         0    kl
-        1     f
+        1     n
         2    cm
         dtype: object
 
@@ -1588,7 +1588,7 @@ class StringMethods(NoNewAttributesMixin):
 
         >>> s.str[0:5:3]
         0    kl
-        1     f
+        1     n
         2    cm
         dtype: object
         """

datas can also be removed by renaming it in pandas/core/arrays/sparse/accessor.py to just data

@chinggg
Copy link
Contributor Author

chinggg commented Dec 30, 2020

Sorry, I did not know how to use codespell and pre-commit' well before. And I tried to type diff --git or git diff as you presented above, but there must be some mistakes and it does not work.
But now I have understood your instructions and made corresponding modifications.Finally it passed the pre-commit test on my machine.
Thanks!

But it seems I cannot use git very well so the first wrong commit still exists and produced a useless blank commit.
So I learned to clear that commits in the remote repo by push forcefully, but now this PR automatically closed. I will make a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants