Skip to content

Commit f352a71

Browse files
committed
adjust linting rules and refactor methods to classmethods
1 parent a2f21d8 commit f352a71

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

pixi.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ max-complexity = 12
257257
]
258258

259259
[tool.ruff.lint.pylint]
260-
max-args=12 # (PLR0913) Maximum number of arguments for function / method
260+
max-args=15 # (PLR0913) Maximum number of arguments for function / method
261261
max-bool-expr=5 # ( PLR0916) Boolean in a single if statement
262262
max-branches=12 # (PLR0912) branches allowed for a function or method body
263263
max-locals=15 # (PLR0912) local variables allowed for a function or method body

sup3r/preprocessing/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,13 @@ def __getattr__(self, attr):
202202
out = out[0]
203203
return out
204204

205-
def _getattr(self, dset, attr):
205+
@classmethod
206+
def _getattr(cls, dset, attr):
206207
"""Get attribute from single data member."""
207208
return getattr(dset.sx, attr, getattr(dset, attr))
208209

209-
def _getitem(self, dset, item):
210+
@classmethod
211+
def _getitem(cls, dset, item):
210212
"""Get item from single data member."""
211213
return dset.sx[item] if hasattr(dset, 'sx') else dset[item]
212214

sup3r/preprocessing/samplers/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
uniform_box_sampler,
1515
uniform_time_sampler,
1616
)
17-
from sup3r.preprocessing.utilities import compute_if_dask, lowered
17+
from sup3r.preprocessing.utilities import lowered
1818

1919
logger = logging.getLogger(__name__)
2020

@@ -29,7 +29,7 @@ def __init__(
2929
sample_shape: Optional[tuple] = None,
3030
batch_size: int = 16,
3131
feature_sets: Optional[dict] = None,
32-
mode: str = 'lazy'
32+
mode: str = 'lazy',
3333
):
3434
"""
3535
Parameters

sup3r/preprocessing/samplers/cc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def reduce_high_res_sub_daily(self, high_res, csr_ind=0):
149149
150150
*Needs review from @grantbuster
151151
"""
152-
if self.t_enhance not in (24, 1):
152+
if self.t_enhance not in {24, 1}:
153153
high_res = self.get_middle_days(high_res, self.hr_sample_shape)
154154
high_res = nsrdb_reduce_daily_data(
155155
high_res, self.hr_sample_shape[-1], csr_ind=csr_ind

sup3r/preprocessing/utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,9 @@ def get_source_type(file_paths):
346346

347347
_, source_type = os.path.splitext(file_paths[0])
348348

349-
if source_type in ('.h5', '.hdf'):
349+
if source_type in {'.h5', '.hdf'}:
350350
return 'h5'
351-
if source_type in ('.nc',):
351+
if source_type in {'.nc'}:
352352
return 'nc'
353353
msg = (
354354
f'Can only handle HDF or NETCDF files. Received unknown extension '

0 commit comments

Comments
 (0)