8000 Fix typos in docs and comments in idlelib by tirkarthi · Pull Request #13749 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Fix typos in docs and comments in idlelib #13749

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

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

tirkarthi
Copy link
Member

extenstons -> extensions
Attrbutes -> Attributes
delagator -> delegator
diplayable -> displayable
corresonding -> corresponding
examime -> examine
contination -> continuation
seach -> search
create_widgers -> create_widgets
Double-cliking -> Double-clicking
tkintter -> tkinter

@tirkarthi
Copy link
Member Author

This is similar to #13745 but the raised the changes to idlelib folder as a separate PR to assist backporting workflow for idlelib.

Copy link
Contributor
@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix red builds

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@tirkarthi tirkarthi force-pushed the fix-idlelib-typos branch from 30d58d6 to b6d15ed Compare June 2, 2019 20:29
@tirkarthi
Copy link
Member Author

I am not sure why code comments changes cause test failure and especially it happens in test_asyncio and not idlelib related test failure. I have rebased and retriggered the run.

@terryjreedy terryjreedy dismissed asvetlov’s stale review June 3, 2019 04:18

Changes fixed CI failures

Copy link
Member
@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did I (and previous spell checks) miss some of these? Thanks for finding these and doing them separately.

@terryjreedy terryjreedy merged commit d9677f3 into python:master Jun 3, 2019
@miss-islington
Copy link
Contributor

Thanks @tirkarthi for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 3, 2019
(cherry picked from commit d9677f3)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@bedevere-bot
Copy link

GH-13770 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Jun 3, 2019
(cherry picked from commit d9677f3)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@tirkarthi
Copy link
Member Author

Since new docs are added everyday I just try to run the spell check every 2-3 months. I use aspell and it reports lot of false positives like variable names, function names, tests etc. For Docs folder it reports 10k words and Lib folder 30k words as typos. Hence manual skimming is required and sometimes I overlook the typo to find it next time.

@tirkarthi tirkarthi deleted the fix-idlelib-typos branch June 3, 2019 05:24
@terryjreedy
Copy link
Member

Are you reducing .py files to strings and comments first?

@tirkarthi
Copy link
Member Author

aspell takes the input and splits it into words based on word boundary I think to get all words from the source. Below is the command I use

aspell list < Lib/idlelib/**/*py | tr '[:upper:]' '[:lower:]' | sort -u | less

8000

@terryjreedy
Copy link
Member

The following, using the regexes in idlelib.colorizer, strips a file down to comments and strings. If you could feed the output for all (idlelib or other stdlib) py files to aspell, there would be less to wade through, as the result have only a small fraction of the variable names. (Since I am on Windows and don't know the aspell API, I cannot be more specific.)

import re

comment = r"#[^\n]*"
stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
dq3string = stringprefix + r'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
comstring = "|".join([comment, sq3string, dq3string, sqstring, dqstring])

pattern = re.compile(comstring, re.S)
with open("c:/Programs/Python38/Lib/idlelib/autocomplete.py") as f:
    for m in pattern.finditer(f.read()):
        print(m.group(0))

@18z
Copy link
Contributor
18z commented Jun 4, 2019

Hi @tirkarthi

Just came up with the idea.
Is it possible that we can create a typo checker (bot) ?

Like the-knights-who-say-ni or bedevere-bot,
when receive a PR, the bot automatically checks the typo.

@18z
Copy link
Contributor
18z commented Jun 4, 2019

More details.

Every time when the typo checker finds a typo, it warns the PR submitter.
PR submitter can fix the typo based on the report.

It is okay, if the typos were found and submitter doesn't fix it.
Since it is probably intended to spell the word that way.

@terryjreedy
Copy link
Member

I had that in the back of my mind when I posted the code above. However, the problem is that even after reducing the code checked, there will still be mostly false positives, and for many modules, there will always be false positives. @tirkarthi could get some numbers after interfacing the filter with aspell. And of course, the bot would have to have aspell available. The report could be made optional with a spellcheck label.

@krnick
Copy link
Contributor
krnick commented Jun 4, 2019

More details.

Every time when the typo checker finds a typo, it warns the PR submitter.
PR submitter can fix the typo based on the report.

It is okay, if the typos were found and submitter doesn't fix it.
Since it is probably intended to spell the word that way.

I also think it would be great to add this feature to the CI test. For example, trailing whitespace testing.

@tirkarthi
Copy link
Member Author

I share the same concern about high number of false positives. I mostly took the code from the rust-lang book where there is a separate dictionary.txt file with list of false positives and this shell script to check spelling. It can work at the scale of book but not sure about Python docs, code level docstrings and comments that can have lot of variables, function names and so on that there is a higher rate of changes to keep updating dictionary.txt.

@18z
Copy link
Contributor
18z commented Jun 5, 2019

Hi @terryjreedy and @tirkarthi

I summarized the discussion above.

Consensus:

  • Reducing typo in a constructive way.

To be Solved:

  • Even after reducing the code checked, there will still be mostly false positives.
  • High frequency of updating dictionary.txt (false positive typo).

Next Step:

  • Interfacing the filter with aspell to get some numb 8000 ers.

MISC:

  • The report could be made optional with a spellcheck label.
  • Code for reducing .py files to strings and comments.
  • Command line for spellcheck.

Is @tirkarthi currently working on interfacing the filter?
I can help otherwise :D

@tirkarthi
Copy link
Member Author

No, I am not working on the filters data or improving aspell side and manual check for every 2-3 months seems good. Feel free to continue with the approach and I may not have time to continue with this.

Thanks

@terryjreedy
Copy link
Member

Further general discussion should be on the core-workflow list. A specific proposal for git should be an issue for the core-workflow repository, which I believe is where bots originate.

@18z
Copy link
Contributor
18z commented Jun 6, 2019

Thanks @terryjreedy , I'll move the discussion to core-workflow repository. :D

@tirkarthi tirkarthi restored the fix-idlelib-typos branch September 27, 2019 04:33
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0