Skip to content

Commit

Permalink
Merge pull request #440 from lsst/tickets/DM-37808
Browse files Browse the repository at this point in the history
DM-37808: Update pre-commit dependencies
  • Loading branch information
timj committed Feb 2, 2023
2 parents 1db3d26 + 3508b40 commit dadf9dc
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.fits binary
*.npy binary
*.fits.fz binary
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand All @@ -15,7 +16,11 @@ repos:
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion doc/changes/DM-35186.feature.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Add ``focusZ`` to ``MakeRawVisitInfoViaObsInfo``.
* Add ``focusZ`` to ``MakeRawVisitInfoViaObsInfo``.
4 changes: 2 additions & 2 deletions python/lsst/obs/base/_read_curated_calibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ def check_metadata(
== (instrument.lower(), chip_id, filter_name, data_name.lower())
):
raise ValueError(
f"Path and file metadata do not agree:\n"
"Path and file metadata do not agree:\n"
f"Path metadata: {instrument} {chip_id} {filter_name} {data_name}\n"
f"File metadata: {finst} {fchip_id} {ffilter_name} {fdata_name}\n"
f"File read from : %s\n" % (filepath)
f"File read from : {filepath}\n"
)


Expand Down
7 changes: 2 additions & 5 deletions python/lsst/obs/base/defineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,7 @@ def __init__(self, config: ComputeVisitRegionsConfig, *, butler: Butler, **kwarg
_DefaultName = "computeVisitRegions"

registry = makeRegistry(
doc=(
"Registry of algorithms for computing on-sky regions for visits "
"and visit+detector combinations."
),
doc="Registry of algorithms for computing on-sky regions for visits and visit+detector combinations.",
configBaseType=ComputeVisitRegionsConfig,
)

Expand Down Expand Up @@ -647,7 +644,7 @@ def run(
return
if len(instruments) > 1:
raise RuntimeError(
f"All data IDs passed to DefineVisitsTask.run must be "
"All data IDs passed to DefineVisitsTask.run must be "
f"from the same instrument; got {instruments}."
)
(instrument,) = instruments
Expand Down
14 changes: 5 additions & 9 deletions python/lsst/obs/base/exposureAssembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@


class ExposureAssembler(StorageClassDelegate):

EXPOSURE_COMPONENTS = set(("image", "variance", "mask", "wcs", "psf"))
EXPOSURE_INFO_COMPONENTS = set(
(
Expand Down Expand Up @@ -80,7 +79,7 @@ def _groupRequestedComponents(self) -> Tuple[Set[str], Set[str]]:
# Check that we are requesting something that we support
unknown = requested - (self.EXPOSURE_COMPONENTS | self.EXPOSURE_INFO_COMPONENTS)
if unknown:
raise ValueError("Asking for unrecognized component: {}".format(unknown))
raise ValueError(f"Asking for unrecognized component: {unknown}")

expItems = requested & self.EXPOSURE_COMPONENTS
expInfoItems = requested & self.EXPOSURE_INFO_COMPONENTS
Expand Down Expand Up @@ -118,7 +117,7 @@ def getComponent(self, composite: lsst.afw.image.Exposure, componentName: str) -
return super().getComponent(composite, self.COMPONENT_MAP.get(componentName, componentName))
else:
raise AttributeError(
"Do not know how to retrieve component {} from {}".format(componentName, type(composite))
f"Do not know how to retrieve component {componentName} from {type(composite)}"
)

def getValidComponents(self, composite: Exposure) -> Dict[str, Any]:
Expand Down Expand Up @@ -194,7 +193,7 @@ def disassemble(
if not self.storageClass.validateInstance(composite):
raise TypeError(
"Unexpected type mismatch between parent and StorageClass"
" ({} != {})".format(type(composite), self.storageClass.pytype)
f" ({type(composite)} != {self.storageClass.pytype})"
)

# Only look for components that are defined by the StorageClass
Expand Down Expand Up @@ -262,8 +261,7 @@ def assemble(self, components: Dict[str, Any], pytype: Optional[Type] = None) ->

if not isinstance(exposure, pytype):
raise RuntimeError(
"Unexpected type created in assembly;"
" was {} expected {}".format(type(exposure), pytype)
f"Unexpected type created in assembly; was {type(exposure)} expected {pytype}"
)

else:
Expand Down Expand Up @@ -295,9 +293,7 @@ def assemble(self, components: Dict[str, Any], pytype: Optional[Type] = None) ->

# If we have some components left over that is a problem
if components:
raise ValueError(
"The following components were not understood: {}".format(list(components.keys()))
)
raise ValueError(f"The following components were not understood: {list(components.keys())}")

return exposure

Expand Down
3 changes: 1 addition & 2 deletions python/lsst/obs/base/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ def _calculate_dataset_info(
missing.append(property)
if missing:
raise ValueError(
f"Requested required properties are missing from file {filename}:"
f" {missing} (via JSON)"
f"Requested required properties are missing from file {filename}: {missing} (via JSON)"
)

else:
Expand Down
1 change: 0 additions & 1 deletion python/lsst/obs/base/instrument_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def getMetadata(self) -> dict[str, Any]:


class DummyCam(Instrument):

filterDefinitions = DUMMY_FILTER_DEFINITIONS
additionalCuratedDatasetTypes = frozenset(["testCalib"])
policyName = "dummycam"
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/obs/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def createInitialSkyWcs(visitInfo, detector, flipX=False):
"""
if visitInfo.getRotType() != RotType.SKY:
msg = (
f"Cannot create SkyWcs from camera geometry: rotator angle defined using "
"Cannot create SkyWcs from camera geometry: rotator angle defined using "
f"RotType={visitInfo.getRotType()} instead of SKY."
)
raise InitialSkyWcsError(msg)
Expand Down
1 change: 0 additions & 1 deletion tests/test_cliCmdDefineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class DefineVisitsTest(CliCmdTestBase, unittest.TestCase):

mockFuncName = "lsst.obs.base.cli.cmd.commands.script.defineVisits"

@staticmethod
Expand Down
2 changes: 0 additions & 2 deletions tests/test_cliCmdTestIngest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class IngestRawsTestCase(CliCmdTestBase, unittest.TestCase):

mockFuncName = "lsst.obs.base.cli.cmd.commands.script.ingestRaws"

@staticmethod
Expand Down Expand Up @@ -125,7 +124,6 @@ def test_locations(self):


class PatchRawIngestTask(lsst.obs.base.RawIngestTask):

init_args = []

def __init__(self, *args, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion tests/test_cliCmdWriteCuratedCalibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class WriteCuratedCalibrationsTest(CliCmdTestBase, unittest.TestCase):

mockFuncName = "lsst.obs.base.cli.cmd.commands.script.writeCuratedCalibrations"

@staticmethod
Expand Down
1 change: 0 additions & 1 deletion tests/test_makeRawVisitInfoViaObsInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def testMakeRawVisitInfoViaObsInfo_empty(self):
self.assertEqual(visitInfo.hasSimulatedContent, False)

def testObservationInfo2VisitInfo(self):

with self.assertWarns(UserWarning):
obsInfo = ObservationInfo(self.header, translator_class=NewTranslator)

Expand Down

0 comments on commit dadf9dc

Please sign in to comment.