Skip to content
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

Fixes and PEP 8/pyflakes updates for utils #78

Merged
merged 7 commits into from Aug 20, 2015
Merged

Conversation

olaurino
Copy link
Member

This PR replaces #70.

Release Note

OutOfBoundErr exceptions are properly caught in some sherpa.utils functions are properly caught.
There were several places where screen output used either print or sys.stderr.write: these have been changed to use the debug and warning loggers instead (respectively). Several routines which use min and max as variable names have been changed. A number of other pyflakes/PEP-8 style violations were addressed, e.g. a more Pythonic use of boolean variables (e.g. not xxx rather than False == xxx).

Description

These commits fix a potential error, in that OutOfBoundErr exceptions were not being caught (although it's not actually clear that this is ever thrown). There were several places where screen output used either print or sys.stderr.write: these have been changed to use the debug and warning loggers instead (respectively). Several routines which use min and max as variable names have been changed. There are very-minor documentation changes for Sphinx (mainly change : to :: when introducing some maths).

It also addresses a number of pyflakes/PEP-8 violations: more Pythonic use of boolean variables (e.g. not xxx rather than False == xxx); add spaces between operators; remove spaces before/after various brackets; line length; two blank lines between top-level declarations; explicit module export; remove blank characters at the ends of lines.

The commits have been broken up into separate sections to try and make reviewing the changes somewhat easier.

The reason for these changes is that I want to make some changes to the test class code, but found a number of issues that were being flagged up by

pyflakes "$1"
pep8 --ignore=E221,E701,E202 --repeat "$1"

so decided to clean these up first.

The main changes are to correctly catch errors, although it is not
clear if the OutOfBoundErr class is ever raised (perhaps from compiled
code?). There are several other changes: removal of unused variables,
chamge min/max variable names (not all functions are changed),
comments on screen output that maybe should use the logging output,
more Pythonic boolean checks (e.g. change 'False == xxx' to 'not xxx'),
and a couple of PEP8 adding-space-around-symbol changes that accidentally
made it in.
These are mainly for Sphinx (change : to :: to introduce a section
of text). Several PEP8 changes (removal of spaces around symbols)
have crept in with this commit.
PEP-8 related changes: add blank lines before top-level symbols so
there are two such lines separating definitions; ensure there's a
space after the comment character; ensure comment line doesn't make
the line too long.
PEP-8 changes to syntax, not functionality (in the most part; due to
the desire to keep line-lengths short, some lines have been split up
and the code slightly-rewritten to account for this).
A PEP-8 suggestion: it showed that gsl_fcmp is not exported by this
module which is probably intentional.
@DougBurke
Copy link
Contributor

Looks good to me.

@DougBurke DougBurke mentioned this pull request Aug 19, 2015
@olaurino
Copy link
Member Author

@wmclaugh (as you were assigned to it). I reviewed this PR and I think it should be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants