quantumjot / btrack

Bayesian multi-object tracking
https://btrack.readthedocs.io
MIT License
310 stars 50 forks source link

Replace flake8 with ruff #224

Closed p-j-smith closed 1 year ago

p-j-smith commented 1 year ago

Fixes #220

Hopefully a more manageable and less destructive version of #204. Only introducing Ruff here - not prettier, and not adding support for tox 4 - this can be done in a separate pr

Edit: I've fixed all the linting complaints and removed the fix restrictions for Ruff

deprecated-napari-hub-preview-bot[bot] commented 1 year ago

Preview page for your plugin is ready here: https://preview.napari-hub.org/quantumjot/btrack/224 Updated: 2023-03-13T11:37:01.975530

p-j-smith commented 1 year ago

I went through the fixes for each rule individually, running tests after each change, and I'm fairly certain the there are no changes to any functionality or logic.

I've ignored some rules for certain lines e.g.:

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 77.63% and project coverage change: +0.27 :tada:

Comparison is base (ea0850b) 82.50% compared to head (888954d) 82.78%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #224 +/- ## ========================================== + Coverage 82.50% 82.78% +0.27% ========================================== Files 19 19 Lines 1549 1545 -4 Branches 269 262 -7 ========================================== + Hits 1278 1279 +1 + Misses 194 191 -3 + Partials 77 75 -2 ``` | [Impacted Files](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe) | Coverage Δ | | |---|---|---| | [btrack/io/exporters.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2lvL2V4cG9ydGVycy5weQ==) | `72.22% <33.33%> (ø)` | | | [btrack/libwrapper.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2xpYndyYXBwZXIucHk=) | `96.07% <33.33%> (ø)` | | | [btrack/optimise/optimiser.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL29wdGltaXNlL29wdGltaXNlci5weQ==) | `79.06% <63.63%> (ø)` | | | [btrack/io/hdf.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2lvL2hkZi5weQ==) | `72.79% <73.33%> (ø)` | | | [btrack/utils.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL3V0aWxzLnB5) | `83.18% <80.00%> (+1.93%)` | :arrow_up: | | [btrack/btypes.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2J0eXBlcy5weQ==) | `81.64% <85.71%> (+0.78%)` | :arrow_up: | | [btrack/io/utils.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2lvL3V0aWxzLnB5) | `88.37% <85.71%> (+2.32%)` | :arrow_up: | | [btrack/core.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2NvcmUucHk=) | `82.80% <88.88%> (-0.16%)` | :arrow_down: | | [btrack/\_\_init\_\_.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL19faW5pdF9fLnB5) | `90.00% <100.00%> (ø)` | | | [btrack/io/\_\_init\_\_.py](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2lvL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | | ... and [3 more](https://codecov.io/gh/quantumjot/btrack/pull/224?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

p-j-smith commented 1 year ago

I had to change the way the year is determined in the docs setup because ruff wasn't happy:

docs/conf.py:25:21: DTZ011 The use of `datetime.date.today()` is not allowed, use `datetime.datetime.now(tz=).date()` instead
paddyroddy commented 1 year ago

Looks like you've committed .hypothesis/unicode_data/13.0.0/charmap.json.gz!

p-j-smith commented 1 year ago

Looks like you've committed .hypothesis/unicode_data/13.0.0/charmap.json.gz!

woops! I'll remove

paddyroddy commented 1 year ago

I assume the codecov thing isn't an issue?

p-j-smith commented 1 year ago

I assume the codecov thing isn't an issue?

I guess not, maybe it's because the formatting split some untested code across multiple lines, so now there are more untested lines?