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

DM-28480: Updates for new flake8 #124

Merged
merged 5 commits into from
Jan 27, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: lint

on:
- push
- pull_request
push:
branches:
- master
pull_request:

jobs:
lint:
Expand All @@ -13,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Install
run: pip install -r <(curl https://raw.githubusercontent.com/lsst/linting/master/requirements.txt)
Expand Down
4 changes: 2 additions & 2 deletions bin.src/matchedVisitMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#
import matplotlib
matplotlib.use('Agg') # noqa E402
matplotlib.use('Agg')

from lsst.validate.drp.matchedVisitMetricsTask import MatchedVisitMetricsTask
from lsst.validate.drp.matchedVisitMetricsTask import MatchedVisitMetricsTask # noqa: E402

MatchedVisitMetricsTask.parseAndRun()
7 changes: 3 additions & 4 deletions bin.src/validateDrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.

import argparse

# Ensure that this script will run on a mis-configured node
# that may default to a backend that requires X
# e.g., 'Qt5Agg', even though there is is no display available
# Putting this here in the command-line script is fine because no one
# should import this script.
import matplotlib
matplotlib.use('Agg') # noqa E402

import argparse
matplotlib.use('Agg')

from lsst.validate.drp import validate, util
from lsst.validate.drp import validate, util # noqa: E402


description = """
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/validate/drp/calcsrd/afx.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def measureAFx(metric, amx, adx, adx_spec):
datums = {}
datums['ADx'] = adx.datum
if not np.isnan(amx.quantity):
quantity = 100.*np.mean(amx.extras['rmsDistMas'].quantity > amx.quantity +
adx_spec.threshold)*u.Unit('percent')
quantity = 100.*np.mean(amx.extras['rmsDistMas'].quantity > amx.quantity
+ adx_spec.threshold)*u.Unit('percent')
else:
quantity = np.nan*u.Unit('percent')
datums.update(amx.extras)
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/validate/drp/calcsrd/amx.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def magInRange(cat):
rmsDistances = list()
for obj1, (ra1, dec1, visit1) in enumerate(zip(meanRa, meanDec, visit)):
dist = sphDist(ra1, dec1, meanRa[obj1+1:], meanDec[obj1+1:])
objectsInAnnulus, = np.where((annulusRadians[0] <= dist) &
(dist < annulusRadians[1]))
objectsInAnnulus, = np.where((annulusRadians[0] <= dist)
& (dist < annulusRadians[1]))
for obj2 in objectsInAnnulus:
distances = matchVisitComputeDistance(
visit[obj1], ra[obj1], dec[obj1],
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/validate/drp/matchreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ def _loadAndMatchCatalogs(repo, dataIds, matchRadius,
afwTable.updateSourceCoords(wcs, tmpCat)
photoCalib.instFluxToMagnitude(tmpCat, "base_PsfFlux", "base_PsfFlux")
if not skipNonSrd:
tmpCat['slot_ModelFlux_snr'][:] = (tmpCat['slot_ModelFlux_instFlux'] /
tmpCat['slot_ModelFlux_instFluxErr'])
tmpCat['slot_ModelFlux_snr'][:] = (tmpCat['slot_ModelFlux_instFlux']
/ tmpCat['slot_ModelFlux_instFluxErr'])
photoCalib.instFluxToMagnitude(tmpCat, "slot_ModelFlux", "slot_ModelFlux")

if not skipTEx:
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/validate/drp/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ def print_metrics(job, levels=('minimum', 'design', 'stretch')):
specs, metrics = get_specs_metrics(job)

print(Bcolors.BOLD + Bcolors.HEADER + "=" * 65 + Bcolors.ENDC)
print(Bcolors.BOLD + Bcolors.HEADER +
'{band} band metric measurements'.format(band=job.meta['filter_name']) +
Bcolors.ENDC)
print(Bcolors.BOLD + Bcolors.HEADER
+ '{band} band metric measurements'.format(band=job.meta['filter_name'])
timj marked this conversation as resolved.
Show resolved Hide resolved
+ Bcolors.ENDC)
print(Bcolors.BOLD + Bcolors.HEADER + "=" * 65 + Bcolors.ENDC)

wrapper = TextWrapper(width=65)
Expand All @@ -532,9 +532,9 @@ def print_metrics(job, levels=('minimum', 'design', 'stretch')):
if 'release' in job.specs[spec_key].tags:
# Skip release specs
continue
for l in levels:
if l in str(spec_key):
level = l
for lev in levels:
if lev in str(spec_key):
level = lev
try:
m = job.measurements[metric_key]
except KeyError:
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[flake8]
max-line-length = 110
ignore = E133, E226, E228, N802, N803, N806, N812, N815, N816, W504
ignore = E133, E226, E228, N802, N803, N806, N812, N815, N816, W503
exclude = __init__.py, config/*.py, Cfht/*

[tool:pytest]
addopts = --flake8
flake8-ignore = E133 E226 E228 N802 N803 N806 N812 N815 N816 W504
flake8-ignore = E133 E226 E228 N802 N803 N806 N812 N815 N816 W503