-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cleancodev2 #1
Cleancodev2 #1
Conversation
Cleancodev2
pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exeeding 80 chars Update not automatic fixed %-formated strings
pyupgrade --py38-plus flynt black flake8 Manual: Update lines exeeding 80 chars Update not automatic fixed %-formated strings
Changes: Automatic: pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings
clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings remove all __future__ imports remove import * resolve circular imports (still work required) renamed __main__.py to bmain.py and created new __main__.py. This was necessary due to "E402 - module level import not at top of file" flake8 does not support builtins. Thus and also for readability I changed builtins._ and .N_ to Utils methods and add `from Utils import _, N_` to required files. A001 - variable "" is shadowing a python builtin A002 - argument "" is shadowing a python builtin F401 - imported but unused F841 - local variable is assigned to but never used E201 - whitespace after '(' E202 - whitespace before ')' E203 - whitespace before ':' E402 - module level import not at top of file E722 - do not use bare 'except' N805 - first argument of a method should be named 'self' W601 - .has_key() is deprecated, use 'in' Final flake8 test: flake8 --max-doc-length 1000 --statistics --ignore A003,E501,E713,E741,N801,N802,N803,N806,N815,N816,W503 ./bCNC > flake8.out with one error remaining: ./bCNC/Utils.py:530:26: F821 undefined name 'self'
some smaller fixed
Remove commented code
2 E302 expected 2 blank lines, found 1 1 E303 too many blank lines (2) 1 E305 expected 2 blank lines after class or function definition, found 1 1 E713 test for membership should be 'not in' 9 E741 ambiguous variable name 'O' 1 F821 undefined name 'self'
I think I could improve the overall code quality quite a bit. There are still lots of flake8 errors to be fixed: |
I also had to add two new files:
|
Somehow, I did'nt get a notification for this PR. But I'm here now. I struggled quite a bit with the imports. The pre-commit script I had use moved all the imports in the right order.. But it ended up breaking the code. |
vlachoudis#1714 (comment) bosd#1 (comment) bosd#1 (comment) Also changed application to be inherited from tkinter.Tk, instead of tkinter.Toplevel. This change also fixes the issue, that the windowname is also displayed in the dock. Further I moved bmain.main functionality back to __main__.main.
Just realized that these big changes in source code also affect the localization. EDIT: Just realized you took already care of that! Awesome!! 🎉 ✨ |
Translation was not working in my last commit. Fixed it now |
Is this one ready for review? |
Yes. This PR is ready. |
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.
Quick review on windows 10, python 3.10.
Test failling to load main window
@m1ch Thanks, main window is loading now! unrelated to this pr, found this irregularity. Quick DXF file loading |
Another functional test. This PR is OK now! |
* Automatic: pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exeeding 80 chars Update not automatic fixed %-formated strings * Automatic: pyupgrade --py38-plus flynt black flake8 Manual: Update lines exeeding 80 chars Update not automatic fixed %-formated strings * Draft: intermediate commit Changes: Automatic: pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings * Draft: intermediate commit clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings remove all __future__ imports remove import * resolve circular imports (still work required) renamed __main__.py to bmain.py and created new __main__.py. This was necessary due to "E402 - module level import not at top of file" flake8 does not support builtins. Thus and also for readability I changed builtins._ and .N_ to Utils methods and add `from Utils import _, N_` to required files. A001 - variable "" is shadowing a python builtin A002 - argument "" is shadowing a python builtin F401 - imported but unused F841 - local variable is assigned to but never used E201 - whitespace after '(' E202 - whitespace before ')' E203 - whitespace before ':' E402 - module level import not at top of file E722 - do not use bare 'except' N805 - first argument of a method should be named 'self' W601 - .has_key() is deprecated, use 'in' Final flake8 test: flake8 --max-doc-length 1000 --statistics --ignore A003,E501,E713,E741,N801,N802,N803,N806,N815,N816,W503 ./bCNC > flake8.out with one error remaining: ./bCNC/Utils.py:530:26: F821 undefined name 'self' * Fix deleted import * Move pot file under locale * Draft: Mainly change for translation _() strings to the "".format() some smaller fixed * Draft: updated one %-formated string * Replace remaining \t characters Remove commented code * flake8 Fixes: 2 E302 expected 2 blank lines, found 1 1 E303 too many blank lines (2) 1 E305 expected 2 blank lines after class or function definition, found 1 1 E713 test for membership should be 'not in' 9 E741 ambiguous variable name 'O' 1 F821 undefined name 'self' * improved some imports * Update CHANGELOG.md * Update CHANGELOG.md * improve imports * Fixed: #1714 (comment) bosd#1 (comment) bosd#1 (comment) Also changed application to be inherited from tkinter.Tk, instead of tkinter.Toplevel. This change also fixes the issue, that the windowname is also displayed in the dock. Further I moved bmain.main functionality back to __main__.main. * Fixed translation issue * small fixes for bosd#1 * small fixes for bosd#1 * Bugfixes from string type conversions
* Automatic: pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exeeding 80 chars Update not automatic fixed %-formated strings * Automatic: pyupgrade --py38-plus flynt black flake8 Manual: Update lines exeeding 80 chars Update not automatic fixed %-formated strings * Draft: intermediate commit Changes: Automatic: pyupgrade --py38-plus flynt black flake8 Manual: clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings * Draft: intermediate commit clean imports (Remove imports from Python2) Update lines exceeding 80 chars Update not automatic fixed %-formatted strings remove all __future__ imports remove import * resolve circular imports (still work required) renamed __main__.py to bmain.py and created new __main__.py. This was necessary due to "E402 - module level import not at top of file" flake8 does not support builtins. Thus and also for readability I changed builtins._ and .N_ to Utils methods and add `from Utils import _, N_` to required files. A001 - variable "" is shadowing a python builtin A002 - argument "" is shadowing a python builtin F401 - imported but unused F841 - local variable is assigned to but never used E201 - whitespace after '(' E202 - whitespace before ')' E203 - whitespace before ':' E402 - module level import not at top of file E722 - do not use bare 'except' N805 - first argument of a method should be named 'self' W601 - .has_key() is deprecated, use 'in' Final flake8 test: flake8 --max-doc-length 1000 --statistics --ignore A003,E501,E713,E741,N801,N802,N803,N806,N815,N816,W503 ./bCNC > flake8.out with one error remaining: ./bCNC/Utils.py:530:26: F821 undefined name 'self' * Fix deleted import * Move pot file under locale * Draft: Mainly change for translation _() strings to the "".format() some smaller fixed * Draft: updated one %-formated string * Replace remaining \t characters Remove commented code * flake8 Fixes: 2 E302 expected 2 blank lines, found 1 1 E303 too many blank lines (2) 1 E305 expected 2 blank lines after class or function definition, found 1 1 E713 test for membership should be 'not in' 9 E741 ambiguous variable name 'O' 1 F821 undefined name 'self' * improved some imports * Update CHANGELOG.md * Update CHANGELOG.md * improve imports * Fixed: vlachoudis#1714 (comment) bosd#1 (comment) bosd#1 (comment) Also changed application to be inherited from tkinter.Tk, instead of tkinter.Toplevel. This change also fixes the issue, that the windowname is also displayed in the dock. Further I moved bmain.main functionality back to __main__.main. * Fixed translation issue * small fixes for bosd#1 * small fixes for bosd#1 * Bugfixes from string type conversions
I started to do further improvements of the code. It will take me some days till I'm done.
As there are still a lot of files that need an update, I would prefer to first merge it in your branch.