Skip to content

Commit 8c73df3

Browse files
authored
Merge pull request #365 from sgsmob/pylint
add pylintrc file to each indicator
2 parents a233937 + 6b407bf commit 8c73df3

File tree

29 files changed

+331
-70
lines changed

29 files changed

+331
-70
lines changed

_delphi_utils_python/.pylintrc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
[DESIGN]
21

3-
min-public-methods=1
2+
[MESSAGES CONTROL]
43

4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
511

6-
[MESSAGES CONTROL]
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
719

8-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

_template_python/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

cdc_covidnet/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

changehc/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

claims_hosp/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

combo_cases_and_deaths/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

emr_hosp/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

google_health/.pylintrc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
[DESIGN]
21

3-
min-public-methods=1
2+
[MESSAGES CONTROL]
43

4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
511

6-
[MESSAGES CONTROL]
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
719

8-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

google_health/delphi_google_health/pull_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def query(self, start_date: str, end_date: str, geo_id, dma=False) -> dict:
7777
start_date,
7878
end_date,
7979
)
80-
data = self.service.getTimelinesForHealth(**params).execute()
80+
data = self.service.getTimelinesForHealth(**params).execute() #pylint: disable=no-member
8181

8282
return data
8383

google_health/delphi_google_health/smooth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ def _left_gauss_linear(s: np.ndarray, h=10, impute=False, minval=None) -> np.nda
6060

6161
n = len(s)
6262
t = np.zeros_like(s, dtype=np.float64)
63-
X = np.vstack([np.ones(n), np.arange(n)]).T
63+
X = np.vstack([np.ones(n), np.arange(n)]).T #pylint: disable=invalid-name
6464
for idx in range(n):
6565
wts = np.exp(-((np.arange(idx + 1) - idx) ** 2) / (h ** 2))
66-
XwX = np.dot(X[: (idx + 1), :].T * wts, X[: (idx + 1), :])
67-
Xwy = np.dot(X[: (idx + 1), :].T * wts, s[: (idx + 1)].reshape(-1, 1))
66+
XwX = np.dot(X[: (idx + 1), :].T * wts, X[: (idx + 1), :]) #pylint: disable=invalid-name
67+
Xwy = np.dot(X[: (idx + 1), :].T * wts, #pylint: disable=invalid-name
68+
s[: (idx + 1)].reshape(-1, 1))
6869
try:
6970
beta = np.linalg.solve(XwX, Xwy)
7071
t[idx] = np.dot(X[: (idx + 1), :], beta)[-1]

jhu/.pylintrc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
[DESIGN]
21

3-
min-public-methods=1
2+
[MESSAGES CONTROL]
43

4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
511

6-
[MESSAGES CONTROL]
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
719

8-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

jhu/delphi_jhu/geo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# -*- coding: utf-8 -*-
2+
"""Functions for translating between geocodes."""
23
import pandas as pd
34
from delphi_utils import GeoMapper
45

6+
VALID_GEO_RES = ("county", "state", "msa", "hrr")
57
INCIDENCE_BASE = 100000
68

79
def geo_map(df: pd.DataFrame, geo_res: str):
@@ -27,7 +29,6 @@ def geo_map(df: pd.DataFrame, geo_res: str):
2729
Columns: geo_id, timestamp, ...
2830
"""
2931
df = df.copy()
30-
VALID_GEO_RES = ("county", "state", "msa", "hrr")
3132
if geo_res not in VALID_GEO_RES:
3233
raise ValueError(f"geo_res must be one of {VALID_GEO_RES}")
3334

jhu/delphi_jhu/pull.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
"""Functions to pull data from JHU website."""
23

34
import pandas as pd
45
import numpy as np

jhu/delphi_jhu/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767

6868
def run_module():
69-
69+
"""Run the JHU indicator module."""
7070
params = read_params()
7171
export_start_date = params["export_start_date"]
7272
export_dir = params["export_dir"]

jhu/delphi_jhu/smooth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
'''Functions to smooth signals.'''
3+
24
import numpy as np
35

46
def identity(x):

nchs_mortality/.pylintrc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
[DESIGN]
21

3-
min-public-methods=1
2+
[MESSAGES CONTROL]
43

4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
511

6-
[MESSAGES CONTROL]
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
719

8-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

quidel/.pylintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
[MESSAGES CONTROL]
3+
4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
11+
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
19+
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

quidel_covidtest/.pylintrc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
[DESIGN]
21

3-
min-public-methods=1
2+
[MESSAGES CONTROL]
43

4+
disable=logging-format-interpolation,
5+
too-many-locals,
6+
too-many-arguments,
7+
# Allow pytest functions to be part of a class.
8+
no-self-use,
9+
# Allow pytest classes to have one test.
10+
too-few-public-methods
511

6-
[MESSAGES CONTROL]
12+
[BASIC]
13+
14+
# Allow arbitrarily short-named variables.
15+
variable-rgx=[a-z_][a-z0-9_]*
16+
argument-rgx=[a-z_][a-z0-9_]*
17+
18+
[DESIGN]
719

8-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702
20+
# Don't complain about pytest "unused" arguments.
21+
ignored-argument-names=(_.*|run_as_module)

quidel_covidtest/delphi_quidel_covidtest/generate_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def generate_sensor_for_other_geores(state_groups, data, res_key, smooth,
9393
res_group = res_group.merge(parent_group, how="left",
9494
on="timestamp", suffixes=('', '_parent'))
9595
res_group = res_group.drop(columns=[res_key, "state_id", "state_id" + '_parent'])
96-
except:
96+
except KeyError:
9797
has_parent = False
9898
res_group = res_group.drop(columns=[res_key, "state_id"])
9999
res_group.set_index("timestamp", inplace=True)

0 commit comments

Comments
 (0)