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

[pre-commit.ci] pre-commit autoupdate #1069

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
args: ["--py38-plus"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.13'
rev: 'v0.2.0'
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -43,12 +43,12 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
rev: 1.7.7
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
Expand Down
1 change: 1 addition & 0 deletions romancal/assign_wcs/assign_wcs_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Assign a gWCS object to a science image.
"""

import logging

import gwcs.coordinate_frames as cf
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
For more, see the :ref:`documentation overview <asn-overview>`.
"""

# flake8: noqa: F401, F402, F403

# Take version from the upstream package
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/asn_from_list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create an association from a list"""

import argparse
import sys

Expand Down
1 change: 1 addition & 0 deletions romancal/associations/association_io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Define the I/O methods for Level 3 associations
"""

import json as json_lib
import logging

Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/acid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Association Candidate Identifier"""

import re
from ast import literal_eval

Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/association_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-----
These associations are specifically defined for use in DMS.
"""

from romancal.associations.lib import rules_level2
from romancal.associations.registry import RegistryMarker

Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/constraint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Constraints
"""

import abc
import collections
import logging
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.. _glue-viz: https://github.com/glue-viz/glue
"""

from functools import wraps

__all__ = ["memoize", "singleton", "memoize_attr_check"]
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/member.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Association Member"""

from collections import UserDict
from copy import copy

Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/process_list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reprocessing List"""

from collections import deque
from enum import Enum
from functools import reduce
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/rules_level2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Association Definitions: DMS Level2b product associations
"""

import logging

from romancal.associations.lib.constraint import Constraint
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/update_path.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Update path of members in an association"""

from os.path import basename, join


Expand Down
1 change: 1 addition & 0 deletions romancal/associations/lib/utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""General Utilities"""

import logging
from ast import literal_eval
from functools import wraps
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/load_asn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Load an Association from a file or object"""

from inspect import isclass

from .association import Association
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main entry for the association generator"""

import argparse
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Association Registry"""

import importlib.util
import logging
from inspect import getmembers, isclass, isfunction, ismethod, ismodule
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for tests."""

# ruff: noqa
import os
import re
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/tests/test_constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constraint Tests"""

import pytest

from romancal.associations.lib.constraint import (
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/tests/test_level2_candidates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Level2 candidate operation"""

import pytest

from romancal.associations.main import Main
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the Registry"""

import pytest

from romancal.associations.lib.keyvalue_registry import KeyValueRegistry
Expand Down
1 change: 1 addition & 0 deletions romancal/associations/tests/test_update_path.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test utility update_path"""

from romancal.associations.asn_from_list import asn_from_list
from romancal.associations.lib.rules_elpp_base import DMS_ELPP_Base
from romancal.associations.lib.update_path import update_path
Expand Down
1 change: 1 addition & 0 deletions romancal/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Project default for pytest"""

import inspect
import json
import os
Expand Down
6 changes: 3 additions & 3 deletions romancal/dark_current/dark_current_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
if "nframes" not in dark_model.meta.exposure:
dark_model.meta.exposure["nframes"] = input_model.meta.exposure.nframes
if "groupgap" not in dark_model.meta.exposure:
dark_model.meta.exposure[
"groupgap"
] = input_model.meta.exposure.groupgap
dark_model.meta.exposure["groupgap"] = (

Check warning on line 47 in romancal/dark_current/dark_current_step.py

View check run for this annotation

Codecov / codecov/patch

romancal/dark_current/dark_current_step.py#L47

Added line #L47 was not covered by tests
input_model.meta.exposure.groupgap
)

# Do the dark correction
out_model = input_model
Expand Down
1 change: 0 additions & 1 deletion romancal/dark_current/tests/test_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Unit tests for dark current correction
"""


import numpy as np
import pytest
import roman_datamodels as rdm
Expand Down
8 changes: 5 additions & 3 deletions romancal/datamodels/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ def __getitem__(self, index):
step = index.step
m = self._models[start:stop:step]
m = [
rdm.open(item, memmap=self._memmap)
if (not isinstance(item, rdm.DataModel) and self._return_open)
else item
(
rdm.open(item, memmap=self._memmap)
if (not isinstance(item, rdm.DataModel) and self._return_open)
else item
)
for item in m
]
else:
Expand Down
1 change: 1 addition & 0 deletions romancal/jump/tests/test_jump_step.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Unit tests for the Roman jump step code
"""

from itertools import cycle

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions romancal/lib/dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Example: Certain tests are required by DMS to log in a specific way. The
decorator for this is defined in this module.
"""

from stpipe import log as stpipe_log


Expand Down
1 change: 1 addition & 0 deletions romancal/lib/dqflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
which provides 32 bits. Bits of an integer are most easily referred to using
the formula `2**bit_number` where `bit_number` is the 0-index bit of interest.
"""

# for this file drop E241 (multiple spaces after :, for readability)
# flake8: noqa: E241
# Pixel-specific flags
Expand Down
1 change: 1 addition & 0 deletions romancal/lib/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
If the module is not available, then stub it out.
"""

import logging

__all__ = ["Bar"]
Expand Down
1 change: 1 addition & 0 deletions romancal/lib/signal_slot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" A signal/slot implementation
"""

import inspect
import logging
from collections import namedtuple
Expand Down
1 change: 1 addition & 0 deletions romancal/lib/suffix.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
`SUFFIXES_TO_DISCARD` as necessary, then use the output of
`find_suffixes`.
"""

import itertools
import logging
import re
Expand Down
1 change: 1 addition & 0 deletions romancal/linearity/tests/test_linearity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Unit tests for linearity correction
"""

import numpy as np
import pytest
from astropy import units as u
Expand Down
1 change: 1 addition & 0 deletions romancal/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module collects all of the stpipe.Pipeline subclasses
made available by this package.
"""

from .exposure_pipeline import ExposurePipeline
from .highlevel_pipeline import HighLevelPipeline

Expand Down
5 changes: 1 addition & 4 deletions romancal/ramp_fitting/ramp_fit_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class RampFitStep(RomanStep):

"""
This step fits a straight line to the value of counts vs. time to
determine the mean count rate for each pixel.
Expand Down Expand Up @@ -262,9 +261,7 @@ def create_image_model(input_model, image_info):
var_poisson = u.Quantity(
var_poisson, u.electron**2 / u.s**2, dtype=var_poisson.dtype
)
var_rnoise = u.Quantity(
var_rnoise, u.electron**2 / u.s**2, dtype=var_rnoise.dtype
)
var_rnoise = u.Quantity(var_rnoise, u.electron**2 / u.s**2, dtype=var_rnoise.dtype)
err = u.Quantity(err, u.electron / u.s, dtype=err.dtype)
if dq is None:
dq = np.zeros(data.shape, dtype="u4")
Expand Down
6 changes: 3 additions & 3 deletions romancal/refpix/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ def fft_interpolate(self, num: int = 3) -> ChannelView:

# Mask all the data columns
mask = np.ones((rows, columns), dtype=bool)
mask[
:, : -Const.PAD
] = False # this maybe different for the left/right channels
mask[:, : -Const.PAD] = (
False # this maybe different for the left/right channels
)
mask = mask.flatten()

# Find the indices of the padded columns
Expand Down
3 changes: 2 additions & 1 deletion romancal/refpix/tests/reference_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
provided reference code and this implementation contained within the git history.
of the project itself.
"""

import threading

import numpy as np
Expand Down Expand Up @@ -308,7 +309,7 @@ def fft_interp(
# meaningfully
chanFrameData_Flat = spfft.irfft(
fftResult * chanFrameData_Flat.size,
workers=1
workers=1,
# )
).astype(chanFrameData_Flat.dtype)
# Return read only pixels
Expand Down
7 changes: 4 additions & 3 deletions romancal/regtest/regtestdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,10 @@ def compare_asdf(result, truth, ignore=None, rtol=1e-05, atol=1e-08, equal_nan=T
"lazy_load": False,
"copy_arrays": True,
}
with asdf.open(result, **open_kwargs) as af0, asdf.open(
truth, **open_kwargs
) as af1:
with (
asdf.open(result, **open_kwargs) as af0,
asdf.open(truth, **open_kwargs) as af1,
):
# swap the inputs here so DeepDiff(truth, result)
# this will create output with 'new_value' referring to
# the value in the result and 'old_value' referring to the truth
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_dark_current.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression test for the Dark current subtraction step."""

import pytest

from romancal.stpipe import RomanStep
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_jump_det.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression test for the Jump detection step."""

import pytest

from romancal.stpipe import RomanStep
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_linearity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression test for the linearity correction step."""

import pytest

from romancal.stpipe import RomanStep
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_ramp_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
A requirement for the larger mission verification project is to have
tests tied to reqirements.
"""

from pathlib import Path

import pytest
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_refpix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression tests for the Reference Pixel Correction step"""

import pytest

from romancal.stpipe import RomanStep
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_wfi_dq_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the DQ Init module and DMS 25 and DMS 26 requirements"""

import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_wfi_photom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression tests for the photom step of the Roman pipeline"""

import math

import pytest
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_wfi_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Roman tests for flat field correction """

import copy

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions romancal/regtest/test_wfi_saturation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for the saturation step"""

import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions romancal/skymatch/skymatch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A module that provides functions for matching sky in overlapping images.
"""

import logging
from datetime import datetime

Expand Down
Loading
Loading