From 10066b390468fb0ec22f2b622b93780e7eafe626 Mon Sep 17 00:00:00 2001 From: Aaron Briggs <abriggs@contractor.usgs.gov> Date: Tue, 13 Oct 2020 17:33:16 -0500 Subject: [PATCH] some catchup linting --- assets/src/scripts/lib/compound.js | 4 +++- assets/src/scripts/lib/d3-redux.spec.js | 4 ++-- .../components/daily-value-hydrograph/graph-controls.js | 4 ++-- .../components/daily-value-hydrograph/index.spec.js | 2 +- .../components/daily-value-hydrograph/selectors/scales.js | 2 +- .../selectors/time-series-data.spec.js | 2 +- .../components/daily-value-hydrograph/time-series-graph.js | 2 +- .../monitoring-location/components/hydrograph/audible.js | 4 ++-- .../monitoring-location/components/hydrograph/index.js | 2 +- assets/src/scripts/network/index.js | 2 +- wdfn-server/waterdata/__init__.py | 2 +- wdfn-server/waterdata/camera.py | 2 +- .../tests/commands/lookup_generation/test_nwis_lookups.py | 2 +- .../tests/commands/lookup_generation/test_wqp_lookups.py | 2 +- wdfn-server/waterdata/tests/test_camera.py | 2 +- wdfn-server/waterdata/tests/test_location_utils.py | 4 ++-- wdfn-server/waterdata/tests/test_utils.py | 7 +++---- wdfn-server/waterdata/utils.py | 2 +- wdfn-server/waterdata/views.py | 3 ++- 19 files changed, 28 insertions(+), 26 deletions(-) diff --git a/assets/src/scripts/lib/compound.js b/assets/src/scripts/lib/compound.js index 44defa95a..acc12bcdb 100644 --- a/assets/src/scripts/lib/compound.js +++ b/assets/src/scripts/lib/compound.js @@ -44,7 +44,9 @@ export default function compound() { }; scale.copy = function() { - return compound.apply(null, scales.map(function(s) { return s.copy(); })); + return compound.apply(null, scales.map(function(s) { + return s.copy(); + })); }; scale.scales = function(_) { diff --git a/assets/src/scripts/lib/d3-redux.spec.js b/assets/src/scripts/lib/d3-redux.spec.js index 2618856aa..e2e9309aa 100644 --- a/assets/src/scripts/lib/d3-redux.spec.js +++ b/assets/src/scripts/lib/d3-redux.spec.js @@ -1,6 +1,6 @@ -import { createStore } from 'redux'; +import {createStore} from 'redux'; -import { listen } from './d3-redux'; +import {listen} from './d3-redux'; describe('d3-redux', () => { diff --git a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/graph-controls.js b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/graph-controls.js index 47a49de17..0792b1297 100644 --- a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/graph-controls.js +++ b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/graph-controls.js @@ -39,14 +39,14 @@ const drawDVTimeSeriesSelection = function(ul, store) { .attr('ga-event-action', 'toggleParameterCode') .attr('name', 'dvParamCd'); - if (idx == 0){ + if (idx == 0) { input.attr('checked', 'checked'); } input.on('click', function() { store.dispatch(Actions.retrieveDVTimeSeries( monitorLoc, ts_id - )).then(function () { + )).then(function() { store.dispatch(Actions.setCurrentDVTimeSeriesIds( input.attr('data-00002'), input.attr('data-00003'), diff --git a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/index.spec.js b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/index.spec.js index fbe6f4e39..17afe09f9 100644 --- a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/index.spec.js +++ b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/index.spec.js @@ -116,7 +116,7 @@ describe('monitoring-location/components/dailyValueHydrograph/index', () => { describe('Tests after available time series is fetched', () => { beforeEach(() => { - spyOn(Actions, 'retrieveAvailableDVTimeSeries').and.returnValue(function () { + spyOn(Actions, 'retrieveAvailableDVTimeSeries').and.returnValue(function() { return Promise.resolve({}); }); spyOn(Actions, 'retrieveDVTimeSeries').and.callThrough(); diff --git a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/scales.js b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/scales.js index d8fb44eec..f6ccc6358 100644 --- a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/scales.js +++ b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/scales.js @@ -35,7 +35,7 @@ export const getXScale = memoize((kind) => createSelector( export const getMainXScale = getXScale(); export const getBrushXScale = getXScale('BRUSH'); -const createYScale = function (layout, valueRange) { +const createYScale = function(layout, valueRange) { const PADDING_RATIO = 0.2; let yScale = scaleLinear(); yScale.range([layout.height - layout.margin.top - layout.margin.bottom, 0]); diff --git a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/time-series-data.spec.js b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/time-series-data.spec.js index af08a8a37..fd8af05f7 100644 --- a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/time-series-data.spec.js +++ b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/selectors/time-series-data.spec.js @@ -36,7 +36,7 @@ describe('monitoring-location/components/daily-value-hydrograph/time-series-data phenomenonTimeEnd: '2018-01-10', timeStep: ['2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08', '2018-01-09', '2018-01-10'], - result: [ '5.2', '3.0', '6.0', '7.1', + result: ['5.2', '3.0', '6.0', '7.1', '8.3', '9.1', '7.2', '3.9', '4.4'], approvals: [['Approved'], ['Approved'], ['Approved'], ['Approved'], ['Approved'], ['Approved'], ['Approved'], ['Approved'], ['Working']], diff --git a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/time-series-graph.js b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/time-series-graph.js index 5b31b7eec..a8e122c96 100644 --- a/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/time-series-graph.js +++ b/assets/src/scripts/monitoring-location/components/daily-value-hydrograph/time-series-graph.js @@ -1,4 +1,4 @@ -import { line as d3Line } from 'd3-shape'; +import {line as d3Line} from 'd3-shape'; import {createStructuredSelector} from 'reselect'; import {addSVGAccessibility} from '../../../d3-rendering/accessibility'; diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/audible.js b/assets/src/scripts/monitoring-location/components/hydrograph/audible.js index 89ace2cb5..86d852bd6 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/audible.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/audible.js @@ -20,7 +20,7 @@ import {getMainXScale, getMainYScale} from './selectors/scales'; const volumeScale = scaleLinear().range([2, .3]); const AudioContext = config.TIMESERIES_AUDIO_ENABLED ? window.AudioContext || window.webkitAudioContext : null; -const getAudioContext = memoize(function () { +const getAudioContext = memoize(function() { return new AudioContext(); }); @@ -51,7 +51,7 @@ export const createSound = memoize(/* eslint no-unused-vars: off */ tsKey => { return {oscillator, gainNode, compressor}; }); -export const updateSound = function ({enabled, points}) { +export const updateSound = function({enabled, points}) { const audioCtx = getAudioContext(); for (const tsKey of Object.keys(points)) { const point = points[tsKey]; diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/index.js b/assets/src/scripts/monitoring-location/components/hydrograph/index.js index 3feda26ae..73f8e96b5 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/index.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/index.js @@ -49,7 +49,7 @@ const controlDisplay = function(elem, showElem) { * @param {DOM node} node * @param {Object} - string properties to set initial state information. The property siteno is required */ -export const attachToNode = function (store, +export const attachToNode = function(store, node, { siteno, diff --git a/assets/src/scripts/network/index.js b/assets/src/scripts/network/index.js index 9c7d6963b..651f3b945 100644 --- a/assets/src/scripts/network/index.js +++ b/assets/src/scripts/network/index.js @@ -10,7 +10,7 @@ const COMPONENTS = { 'network': NetworkMapComponent }; -const load = function () { +const load = function() { let nodes = document.getElementsByClassName('wdfn-component'); let store = configureStore(); for (let node of nodes) { diff --git a/wdfn-server/waterdata/__init__.py b/wdfn-server/waterdata/__init__.py index ebd77ced0..85d1a1282 100644 --- a/wdfn-server/waterdata/__init__.py +++ b/wdfn-server/waterdata/__init__.py @@ -85,4 +85,4 @@ if os.getenv('CONTAINER_RUN', False): app.wsgi_app = WhiteNoise(app.wsgi_app, root='/home/python/assets', prefix='static/') from . import views # pylint: disable=C0413 -from . import filters # pylint: disable=C0413 \ No newline at end of file +from . import filters # pylint: disable=C0413 diff --git a/wdfn-server/waterdata/camera.py b/wdfn-server/waterdata/camera.py index 1eddf506f..41cec60bd 100644 --- a/wdfn-server/waterdata/camera.py +++ b/wdfn-server/waterdata/camera.py @@ -14,7 +14,7 @@ import os from waterdata import app # proof of concept. should call service to get -MONITORING_CAMERA_RAW = app.config['MONITORING_CAMERA_LOOKUP']; +MONITORING_CAMERA_RAW = app.config['MONITORING_CAMERA_LOOKUP'] def get_json_camera_data(): diff --git a/wdfn-server/waterdata/tests/commands/lookup_generation/test_nwis_lookups.py b/wdfn-server/waterdata/tests/commands/lookup_generation/test_nwis_lookups.py index ab4ba66dd..b1366d20b 100644 --- a/wdfn-server/waterdata/tests/commands/lookup_generation/test_nwis_lookups.py +++ b/wdfn-server/waterdata/tests/commands/lookup_generation/test_nwis_lookups.py @@ -25,7 +25,7 @@ class TranslateToLookupTestCase(TestCase): {'value1': {'name': 'Name1'}, 'value2': {'name': 'Name2'}, 'value3': {'name': 'Name3'}} - ) + ) def test_with_unmatched_name_key(self): self.assertEqual(translate_to_lookup(self.test_dict_iter, 'this_cd', 'that_name', '', ''), diff --git a/wdfn-server/waterdata/tests/commands/lookup_generation/test_wqp_lookups.py b/wdfn-server/waterdata/tests/commands/lookup_generation/test_wqp_lookups.py index 6d112c6bc..e7b2b98f3 100644 --- a/wdfn-server/waterdata/tests/commands/lookup_generation/test_wqp_lookups.py +++ b/wdfn-server/waterdata/tests/commands/lookup_generation/test_wqp_lookups.py @@ -61,7 +61,7 @@ class GetNwisStateLookupTestCase(TestCase): self.assertEqual(get_nwis_state_lookup(test_lookup), {'55': {'name': 'Wisconsin'}, '01': {'name': 'Alabama'}} - ) + ) class GetNwisCountyLookupTestCase(TestCase): diff --git a/wdfn-server/waterdata/tests/test_camera.py b/wdfn-server/waterdata/tests/test_camera.py index bbf20ff60..7473e97d5 100644 --- a/wdfn-server/waterdata/tests/test_camera.py +++ b/wdfn-server/waterdata/tests/test_camera.py @@ -6,7 +6,7 @@ from .. import camera JSON_CAMERA_TEST_FILE = "wdfn-server/data/monitoring_camera_data_test.json" with open(JSON_CAMERA_TEST_FILE, 'r') as json_file: - camera.MONITORING_CAMERA_RAW = json_file.read() + camera.MONITORING_CAMERA_RAW = json_file.read() class TestCamera(TestCase): diff --git a/wdfn-server/waterdata/tests/test_location_utils.py b/wdfn-server/waterdata/tests/test_location_utils.py index 09a76f49d..bd2ac880f 100644 --- a/wdfn-server/waterdata/tests/test_location_utils.py +++ b/wdfn-server/waterdata/tests/test_location_utils.py @@ -384,10 +384,10 @@ class TestBuildLinkedData(TestCase): 'geo': {'@type': 'schema:GeoCoordinates', 'latitude': '-800.12', 'longitude': '12.12' - }, + }, 'image': ('https://waterdata.usgs.gov/nwisweb/graph' '?agency_cd=Cat Leadership Academy&site_no=09876543&parm_cd=00060&period=100' - ) + ) } self.assertDictEqual(result, expected) diff --git a/wdfn-server/waterdata/tests/test_utils.py b/wdfn-server/waterdata/tests/test_utils.py index 1b27b6acd..5d8bcdc12 100644 --- a/wdfn-server/waterdata/tests/test_utils.py +++ b/wdfn-server/waterdata/tests/test_utils.py @@ -4,13 +4,12 @@ Unit tests for the main WDFN views. from unittest import TestCase, mock -import requests as r +from flask import Response -from flask import Response, request +import requests as r from .. import app - from ..utils import construct_url, defined_when, execute_get_request, parse_rdb, set_cookie_for_banner_message @@ -265,4 +264,4 @@ class TestParseRdb(TestCase): def test_ignore_empty_lines(self): result = parse_rdb(iter(self.test_rdb_lines + ['\n', '\n'])) result_list = list(result) - self.assertEqual(len(result_list), 2) \ No newline at end of file + self.assertEqual(len(result_list), 2) diff --git a/wdfn-server/waterdata/utils.py b/wdfn-server/waterdata/utils.py index cab790b56..85def9e66 100644 --- a/wdfn-server/waterdata/utils.py +++ b/wdfn-server/waterdata/utils.py @@ -102,4 +102,4 @@ def defined_when(condition, fallback): func = fallback return update_wrapper(func, f) - return wrap \ No newline at end of file + return wrap diff --git a/wdfn-server/waterdata/views.py b/wdfn-server/waterdata/views.py index 4ff684dd9..9dd5442e3 100644 --- a/wdfn-server/waterdata/views.py +++ b/wdfn-server/waterdata/views.py @@ -215,7 +215,8 @@ def networks(network_cd): if network_cd: collection = network_data extent = network_data['extent']['spatial']['bbox'][0] - narrative = markdown(network_data['properties']['narrative']) if network_data['properties'].get('narrative') else None + narrative = markdown(network_data['properties']['narrative'])\ + if network_data['properties'].get('narrative') else None else: collection = network_data.get('collections') extent = None -- GitLab