-
Notifications
You must be signed in to change notification settings - Fork 39
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
several tidy-ups of code #61
base: master
Are you sure you want to change the base?
Conversation
marksmayo
commented
May 26, 2023
- all tests pass
- no files removed/added
- only language updates, cleaning
- added f-strings and tidied imports
- cleaned whitespace, unncessary f-strings, naked excepts
- removed u-prefixes
- updated deprecated optparse to argparse
-
- fix singleton comparisons
- made rsplot more accurate
- simplfied if statements
- fixed a bunch of flake8 warnings, including spaces, docstrings, alignments, trailing commas and other language cleanups.
Used flynt and isort to clean up imports and replace several format strings with f-strings.
Added exception to naked excepts Cleaned up trailing whitespace Removed f-strings where no substituted values occured
don't need to inherit from object
The u prefix for strings is no longer necessary in Python >=3.0
line was indented too far
exit() more for REPL
Now using argparse
simplifying and removing one redundant one
with min where possible used dict literals
- space after # in comments - trailing commas - tidy whitespace around brackets, symbols - clean up docstrings - spacing between functions - docstrings punctuated - alignment of hanging lines - spaces around operators - indentation of blocks
@@ -285,7 +284,7 @@ def warnAboutTicks(fig): | |||
print("Warning tick and label differ", t, l, "for axes", ax_name, file=sys.stderr) | |||
|
|||
|
|||
""" Window """ | |||
""" Window. """ |
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.
I don't see why a comment that is not a sentence should have a period at the end.
@@ -192,7 +191,7 @@ def show(hide_window: bool = False): | |||
if setting_use_global_variable_names: | |||
setFigureVariableNames(figure) | |||
# get the window | |||
#window = _pylab_helpers.Gcf.figs[figure].canvas.window_pylustrator | |||
# window = _pylab_helpers.Gcf.figs[figure].canvas.window_pylustrator |
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.
I think there is value to have code lines that are commented out without the space to distinguish them from "real" comments which are annotations
try: # starting from mpl version 3.6.0 | ||
from matplotlib.axes import Axes | ||
except: | ||
except Exception: |
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.
Just adding Exception as the exception does not make the except less of a wildcard. I think here the right thing would be ImportError
@@ -77,7 +82,8 @@ def schedule_draw(self): | |||
def draw(self): | |||
self.timer.stop() | |||
import traceback |
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.
I guess instead of adding an empty line after the import this import should go to the top.