Skip to content

Commit

Permalink
replace flake8 with ruff (#129)
Browse files Browse the repository at this point in the history
* replace `flake8` with `ruff`

* add rule ignore

* apply equivalent fixes for list and dict comprehension

* remove unused import

* add newline to end of file
  • Loading branch information
zacharyburnett committed Dec 1, 2022
1 parent 25d8c7a commit 8fd6162
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 33 deletions.
17 changes: 0 additions & 17 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: style-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }}
- run: pip install flake8
- run: flake8 --count src
- run: pip install ruff
- run: ruff src
audit:
name: Bandit security audit
runs-on: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,16 @@ doctest_rst = true
text_file_format = 'rst'
addopts = '--open-files'

[tool.ruff]
line-length = 110
select = ['F', 'W', 'E', 'C']
ignore = [
'C901', # variable is too complex
]
exclude = [
'docs',
'build',
'dist',
'.tox',
'.eggs',
]
22 changes: 11 additions & 11 deletions tests/test_dark_current.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ def _params():
"""

# Dictionary of NIRCam readout patterns
readpatterns = dict(
DEEP8=dict(ngroups=20, nframes=8, nskip=12),
DEEP2=dict(ngroups=20, nframes=2, nskip=18),
MEDIUM8=dict(ngroups=10, nframes=8, nskip=2),
MEDIUM2=dict(ngroups=10, nframes=2, nskip=8),
SHALLOW4=dict(ngroups=10, nframes=4, nskip=1),
SHALLOW2=dict(ngroups=10, nframes=2, nskip=3),
BRIGHT2=dict(ngroups=10, nframes=2, nskip=0),
BRIGHT1=dict(ngroups=10, nframes=1, nskip=1),
RAPID=dict(ngroups=10, nframes=1, nskip=0),
)
readpatterns = {
"DEEP8": {"ngroups": 20, "nframes": 8, "nskip": 12},
"DEEP2": {"ngroups": 20, "nframes": 2, "nskip": 18},
"MEDIUM8": {"ngroups": 10, "nframes": 8, "nskip": 2},
"MEDIUM2": {"ngroups": 10, "nframes": 2, "nskip": 8},
"SHALLOW4": {"ngroups": 10, "nframes": 4, "nskip": 1},
"SHALLOW2": {"ngroups": 10, "nframes": 2, "nskip": 3},
"BRIGHT2": {"ngroups": 10, "nframes": 2, "nskip": 0},
"BRIGHT1": {"ngroups": 10, "nframes": 1, "nskip": 1},
"RAPID": {"ngroups": 10, "nframes": 1, "nskip": 0},
}

params = []
ngroups = 3
Expand Down
3 changes: 1 addition & 2 deletions tests/test_jump.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pytest
import numpy as np
from astropy.io import fits
import cv2 as cv

from stcal.jump.jump import flag_large_events, make_snowballs, extend_snowballs, extend_ellipses, find_circles, find_ellipses
from stcal.jump.jump import flag_large_events, find_circles, find_ellipses



Expand Down
2 changes: 1 addition & 1 deletion tests/test_ramp_fitting_gls_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def test_simple_ramp():
dims, gain, rnoise, group_time, frame_time
)

ramp = np.array([k for k in range(ngroups)]) * 20 + 10
ramp = np.array(list(range(ngroups))) * 20 + 10
ramp_data.data[0, :, 50, 50] = ramp

save_opt, algo, ncores = False, "GLS", "none"
Expand Down

0 comments on commit 8fd6162

Please sign in to comment.