Skip to content

Updated examples to be PEP compliant #307

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 12 commits into from
Jun 9, 2019
Merged

Updated examples to be PEP compliant #307

merged 12 commits into from
Jun 9, 2019

Conversation

billtubbs
Copy link
Contributor

@billtubbs billtubbs commented Jun 8, 2019

Made various edits to all the example scripts including:

  • Replaced Python 2.7 print statements with print(...)
  • Removed MATLAB-like formatting such as semi-colons
  • Changed indenting and syntax to be PEP compliant (using PyCharm)
  • Changed imports from from ___ import * to conventions such as import matplotlib.pyplot as plt and import numpy as np
  • Removed tabs
  • Added the following line to scripts that produce plot output:
if 'PYCONTROL_TEST_EXAMPLES' not in os.environ:
    plt.show()

Outstanding issues:

  • Some examples still use out-dated np.matrix

billtubbs added 4 commits May 18, 2019 23:48
Removed MATLAB-like formatting such as semi-colons, syntax and indenting PEP compliant (using PyCharm), changed imports from `from ___ import *` to things like `import matplotlib.pyplot as plt` and `import numpy as np`, removed tabs
@coveralls
Copy link

coveralls commented Jun 8, 2019

Coverage Status

Coverage remained the same at 80.936% when pulling 5648440 on billtubbs:bt-tests into 8a11cd3 on python-control:master.

if ax.get_label() == 'control-bode-magnitude':
break
ax.semilogx([1e-4, 1e3], 20 * np.log10([1, 1]), 'k-')
ax.semilogx([1e-4, 1e3], 20*np.log10([1, 1]), 'k-')
Copy link
Member

Choose a reason for hiding this comment

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

Should this be indented? It means that it could get executed multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! I misunderstood that. Will revert it back.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this line is still indented and shouldn't be?

@murrayrm
Copy link
Member

murrayrm commented Jun 8, 2019

@billtubbs Did a quick look through the changes. Overall they look good! Some small comments/questions for you to consider, but I think this is fine as is. Will give you a chance to update in case any of the comments resonate, but then we can merge these in.

@murrayrm murrayrm merged commit c99f72f into python-control:master Jun 9, 2019
@billtubbs billtubbs deleted the bt-tests branch June 9, 2019 03:21
@murrayrm murrayrm added this to the 0.8.3 milestone Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants