From bdee81115be954643a88c5c3b818ca9cf2053c38 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Thu, 12 Sep 2024 13:29:35 -0400 Subject: [PATCH] Annotate noqa --- mica/archive/aca_dark/__init__.py | 2 +- mica/archive/aca_dark/dark_cal.py | 2 +- mica/archive/aca_hdr3.py | 2 +- mica/archive/aca_l0.py | 2 +- mica/archive/asp_l1.py | 4 ++-- mica/archive/cda/__init__.py | 2 +- mica/archive/tests/test_asp_l1.py | 4 ++-- mica/centroid_dashboard.py | 2 +- mica/quaternion.py | 6 +++--- mica/report/report.py | 4 ++-- mica/starcheck/starcheck_parser.py | 2 +- mica/vv/core.py | 2 +- mica/web/admin.py | 2 +- mica/web/models.py | 2 +- mica/web/tests.py | 2 +- ruff.toml | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/mica/archive/aca_dark/__init__.py b/mica/archive/aca_dark/__init__.py index 178c95c6..7fd1278a 100644 --- a/mica/archive/aca_dark/__init__.py +++ b/mica/archive/aca_dark/__init__.py @@ -1,2 +1,2 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from .dark_cal import * # noqa +from .dark_cal import * diff --git a/mica/archive/aca_dark/dark_cal.py b/mica/archive/aca_dark/dark_cal.py index 22bcfd4a..66798bf1 100644 --- a/mica/archive/aca_dark/dark_cal.py +++ b/mica/archive/aca_dark/dark_cal.py @@ -11,7 +11,7 @@ from astropy.table import Column from chandra_aca.aca_image import ACAImage from chandra_aca.dark_model import ( - DARK_SCALE_4C, # noqa + DARK_SCALE_4C, # noqa: F401 imported but unused dark_temp_scale, ) from cxotime import CxoTime diff --git a/mica/archive/aca_hdr3.py b/mica/archive/aca_hdr3.py index cdf5a3b1..8736afc5 100644 --- a/mica/archive/aca_hdr3.py +++ b/mica/archive/aca_hdr3.py @@ -621,7 +621,7 @@ def __init__(self, msids, start, stop): self.datestart = DateTime(self.tstart).date self.datestop = DateTime(self.tstop).date slot_datas = {} - slots = set(slot_for_msid(confirm_msid(msid)) for msid in msids) # noqa + slots = set(slot_for_msid(confirm_msid(msid)) for msid in msids) # noqa: C401 unnecessary generator for slot in slots: # get the 8x8 data tstop = self.tstop + 33.0 # Major frame of padding diff --git a/mica/archive/aca_l0.py b/mica/archive/aca_l0.py index a3709463..71b05015 100644 --- a/mica/archive/aca_l0.py +++ b/mica/archive/aca_l0.py @@ -563,7 +563,7 @@ def _get_missing_archive_files(self, start, only_new=False): logger.info("Checking for missing files from %s" % startdate) # find the index in the cda archive list that matches # the first entry with the "start" date - for idate, backcnt in zip(ingested_files["ingest_date"][::-1], count(1)): # noqa + for idate, backcnt in zip(ingested_files["ingest_date"][::-1], count(1)): # noqa: B007 backcnt not used in loop if idate < startdate: break diff --git a/mica/archive/asp_l1.py b/mica/archive/asp_l1.py index 5fd23730..d3efa9e7 100644 --- a/mica/archive/asp_l1.py +++ b/mica/archive/asp_l1.py @@ -19,7 +19,7 @@ from astropy.table import Table from Quaternion import Quat -from mica.archive import asp_l1_proc, obsid_archive # noqa +from mica.archive import asp_l1_proc, obsid_archive # noqa: F401 imported but unused from mica.common import MICA_ARCHIVE # these columns are available in the headers of the fetched telemetry @@ -284,7 +284,7 @@ def main(): archive = obsid_archive.ObsArchive(config) archive.logger.setLevel(logging.INFO) archive.logger.addHandler(logging.StreamHandler()) - obsids = archive.update() # noqa + obsids = archive.update() # noqa: F841 assigned but not used if __name__ == "__main__": diff --git a/mica/archive/cda/__init__.py b/mica/archive/cda/__init__.py index 7905e8c4..9cf69fb0 100644 --- a/mica/archive/cda/__init__.py +++ b/mica/archive/cda/__init__.py @@ -1 +1 @@ -from .services import * # noqa +from .services import * diff --git a/mica/archive/tests/test_asp_l1.py b/mica/archive/tests/test_asp_l1.py index 263d5e8c..93348f09 100644 --- a/mica/archive/tests/test_asp_l1.py +++ b/mica/archive/tests/test_asp_l1.py @@ -8,7 +8,7 @@ from kadi import events from Quaternion import Quat, normalize from Ska.engarchive import fetch -from testr import test_helper # noqa +from testr import test_helper # noqa: F401 imported unused (but used by pytest) from mica.archive import asp_l1, obsid_archive @@ -89,7 +89,7 @@ def test_update_l1_archive(tmp_path): config["obsid"] = 1 config["version"] = 4 archive = obsid_archive.ObsArchive(config) - obsids = archive.update() # noqa + obsids = archive.update() # noqa: F841 assigned but not used with ska_dbi.DBI(dbi="sqlite", server=config["data_root"] / "archfiles.db3") as db: dat = Table(db.fetchall("select * from archfiles")) diff --git a/mica/centroid_dashboard.py b/mica/centroid_dashboard.py index abf3cead..e433acdf 100755 --- a/mica/centroid_dashboard.py +++ b/mica/centroid_dashboard.py @@ -869,7 +869,7 @@ def update_observed_metrics( rows_obsid = [] rows_slots = [] - for obsid in obsids: # noqa + for obsid in obsids: # noqa: PLR1704 redefining obsid logger.info(f"Obsid={obsid}") obs_dir = get_cd_dir(obsid, data_root) diff --git a/mica/quaternion.py b/mica/quaternion.py index f5d479fd..22b3288a 100644 --- a/mica/quaternion.py +++ b/mica/quaternion.py @@ -232,7 +232,7 @@ def _get_equatorial(self): def _get_ra(self): """Retrieve RA term from equatorial system in degrees""" if self._equatorial is None: - self.equatorial # noqa + self.equatorial # noqa: B018 useless expression if self._equatorial.shape[0] == 1: return self._equatorial[:, 0][0] else: @@ -241,7 +241,7 @@ def _get_ra(self): def _get_dec(self): """Retrieve Dec term from equatorial system in degrees""" if self._equatorial is None: - self.equatorial # noqa + self.equatorial # noqa: B018 useless expression if self._equatorial.shape[0] == 1: return self._equatorial[:, 1][0] else: @@ -250,7 +250,7 @@ def _get_dec(self): def _get_roll(self): """Retrieve Roll term from equatorial system in degrees""" if self._equatorial is None: - self.equatorial # noqa + self.equatorial # noqa: B018 useless expression if self._equatorial.shape[0] == 1: return self._equatorial[:, 2][0] else: diff --git a/mica/report/report.py b/mica/report/report.py index a1602e8b..426898b2 100644 --- a/mica/report/report.py +++ b/mica/report/report.py @@ -381,7 +381,7 @@ def obs_links(obsid, sequence=None, plan=None): dom = dtm.strftime("%d") links["fot_daily"] = { "label": "Daily Plots {}:{:03d}".format(year, int(doy)), - "link": "{root}/{year}/{upper_month}/{lower_month}{day_of_month:02d}_{doy:03d}/".format( # noqa + "link": "{root}/{year}/{upper_month}/{lower_month}{day_of_month:02d}_{doy:03d}/".format( # noqa: E501 line too long root=DAILY_PLOT_ROOT, year=year, upper_month=month.upper(), @@ -566,7 +566,7 @@ def main(obsid): report_status = {} er = summary is None and obsid > 40000 - progress = all_progress["er" if er else "science"] # noqa + progress = all_progress["er" if er else "science"] # noqa: F841 variable never used if er: links = obs_links(obsid) else: diff --git a/mica/starcheck/starcheck_parser.py b/mica/starcheck/starcheck_parser.py index cadd33b1..34ddcd19 100755 --- a/mica/starcheck/starcheck_parser.py +++ b/mica/starcheck/starcheck_parser.py @@ -3,4 +3,4 @@ # Original module has been moved over to the starcheck package. # Keep this import here for back-compatibility. -from starcheck.parser import * # noqa +from starcheck.parser import * # noqa: F403 unable to detect undefined names diff --git a/mica/vv/core.py b/mica/vv/core.py index 0d506618..d93b51c1 100644 --- a/mica/vv/core.py +++ b/mica/vv/core.py @@ -1391,7 +1391,7 @@ def slot_checks(self): self.checks = obi_slot_check def slot_table(self): - checks = self.checks # noqa + checks = self.checks # noqa: F841 variable never used # def set_disposition(self, disp): diff --git a/mica/web/admin.py b/mica/web/admin.py index 710dd8dd..e707aa4e 100644 --- a/mica/web/admin.py +++ b/mica/web/admin.py @@ -1,4 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from django.contrib import admin # noqa +from django.contrib import admin # noqa: F401 imported by unused # Register your models here. diff --git a/mica/web/models.py b/mica/web/models.py index 00afa41f..963a95b2 100644 --- a/mica/web/models.py +++ b/mica/web/models.py @@ -1,4 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from django.db import models # noqa +from django.db import models # noqa: F401 imported by unused # Create your models here. diff --git a/mica/web/tests.py b/mica/web/tests.py index f5aa71a0..97e6d7aa 100644 --- a/mica/web/tests.py +++ b/mica/web/tests.py @@ -1,4 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from django.test import TestCase # noqa +from django.test import TestCase # noqa: F401 imported by unused # Create your tests here. diff --git a/ruff.toml b/ruff.toml index f4e2ffae..5e94e00b 100644 --- a/ruff.toml +++ b/ruff.toml @@ -16,7 +16,7 @@ lint.extend-ignore = [ # "PLR0911", # Too many returns "PLR0912", # Too many branches "PLR0915", # Too many statements - "PGH004", # Use specific rule codes when using `noqa` + # "PGH004", # Use specific rule codes when using `noqa` # "C401", # Unnecessary generator (rewrite as a `set` comprehension) "C402", # Unnecessary generator (rewrite as a dict comprehension) "C404", # Unnecessary `list` comprehension (rewrite as a `dict` comprehension)