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

Code Quality #664

Closed
wants to merge 12 commits into from
Closed

Code Quality #664

wants to merge 12 commits into from

Conversation

labrys
Copy link

@labrys labrys commented Jul 22, 2018

This fixes the following:

  • Comparison to None
  • Tests for membership
  • Tests for object identity
  • Bare except
  • Old style classes
  • Builtins being shadowed
  • File encoding
  • Deprecated function call
  • Trailing comma on bare tuple

labrys added 12 commits July 21, 2018 23:39
Fix `test_nonnumeric_magnitudes`
Should be 'if cond is None:'
Should be 'not in'
Should be 'is not'
Bare except also catches unexpected events like memory errors,
interrupts,  system exit, and so on.  Prefer the specific exception
or `except Exception:` for general exceptions.  If you're sure
what you're doing, be explicit and write `except BaseException:`.
@hgrecco
Copy link
Owner

hgrecco commented Jul 25, 2018

What is the relation of this and #661 ?

@labrys
Copy link
Author

labrys commented Jul 25, 2018

Doh it merged my two branches when I pushed them to my local fork after creating the PR.

@hgrecco
Copy link
Owner

hgrecco commented Aug 9, 2018

Thanks for the PR. It looks good to me except for those two comments which I am not sure.

@labrys
Copy link
Author

labrys commented Aug 9, 2018

I've been busy the last couple of weeks. I'll correct the PRs when I get a chance (hopefully Monday or Tuesday). The very first commit 3af7a56 should have been the only commit in #661. The rest were part of this PR.

@znicholls znicholls mentioned this pull request Sep 2, 2018
6 tasks
bors bot added a commit that referenced this pull request Sep 6, 2018
684: Add pandas support r=hgrecco a=znicholls

This pull request adds pandas support to pint (hence is related to #645, #401 and pandas-dev/pandas#10349).

An example can be seen in `example-notebooks/basic-example.ipynb`.

It's a little bit hacksih, feedback would be greatly appreciated by me and @andrewgsavage. One obvious example is that we have to run all the interface tests with `pytest` to fit with `pandas` test suite, which introduces a dependency for the CI and currently gives us this awkward testing setup (see the alterations we had to make to `testsuite`). This also means that our code coverage tests are fiddly too.

If you'd like us to squash the commits, that can be done.

If pint has a linter, it would be good to run that over this pull request too as we're a little bit all over the place re style.

Things to discuss:

- [x]  general feedback and changes
- [x] test setup, especially need for pytest for pandas tests and hackish way to get around automatic discovery
- [x] squashing/rebasing
- [x] linting/other code style (related to #664 and #628: we're happy with whatever, I've found using an automatic linter e.g. black and/or flake8 has made things much simpler in other projects)
- [x] including notebooks in the repo (if we want to, I'm happy to put them under CI so we can make sure they run)
- [x] setting up the docs correctly

Co-authored-by: Zebedee Nicholls <[email protected]>
Co-authored-by: andrewgsavage <[email protected]>
@Silmathoron
Copy link

This PR looks pretty straightforward and useful, is there any reason for postponing the merge?

@crusaderky
Copy link
Contributor

I have embedded all these changes into #931, please close

bors bot added a commit that referenced this pull request Dec 16, 2019
931: black, flake8, and isort (part 2) r=hgrecco a=crusaderky

- Configure flake8 and isort
- Resolve all flake8 errors
- Assorted code quality tweaks (embeds #664)
- Out of scope: CI integration and documentation (will be done in a successive PR)

Co-authored-by: Guido Imperiale <[email protected]>
@hgrecco hgrecco closed this Dec 28, 2019
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.

4 participants