Skip to content

Commit f93f020

Browse files
committed
style(acquisition): minor formatting fixes
1 parent 8459cc2 commit f93f020

File tree

10 files changed

+221
-42
lines changed

10 files changed

+221
-42
lines changed

src/acquisition/ecdc/ecdc_db_update.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,23 @@ def update_from_file(issue, date, dir, test_mode=False):
156156
def main():
157157
# args and usage
158158
parser = argparse.ArgumentParser()
159+
# fmt: off
159160
parser.add_argument(
160-
"--test", action="store_true", help="do dry run only, do not update the database"
161+
"--test",
162+
action="store_true",
163+
help="do dry run only, do not update the database"
161164
)
162165
parser.add_argument(
163-
"--file", type=str, help="load an existing zip file (otherwise fetch current data)"
166+
"--file",
167+
type=str,
168+
help="load an existing zip file (otherwise fetch current data)"
164169
)
165170
parser.add_argument(
166-
"--issue", type=int, help="issue of the file (e.g. 201740); used iff --file is given"
171+
"--issue",
172+
type=int,
173+
help="issue of the file (e.g. 201740); used iff --file is given"
167174
)
175+
# fmt: on
168176
args = parser.parse_args()
169177

170178
if (args.file is None) != (args.issue is None):

src/acquisition/flusurv/flusurv_update.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,19 @@ def update(issue, location_name, test_mode=False):
160160
def main():
161161
# args and usage
162162
parser = argparse.ArgumentParser()
163+
# fmt: off
163164
parser.add_argument(
164-
"location", help='location for which data should be scraped (e.g. "CA" or "all")'
165+
"location",
166+
help='location for which data should be scraped (e.g. "CA" or "all")'
165167
)
166168
parser.add_argument(
167-
"--test", "-t", default=False, action="store_true", help="do not commit database changes"
169+
"--test",
170+
"-t",
171+
default=False,
172+
action="store_true",
173+
help="do not commit database changes"
168174
)
175+
# fmt: on
169176
args = parser.parse_args()
170177

171178
# scrape current issue from the main page

src/acquisition/fluview/fluview_update.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,23 @@ def update_from_file(issue, date, filename, test_mode=False):
516516
def main():
517517
# args and usage
518518
parser = argparse.ArgumentParser()
519+
# fmt: off
519520
parser.add_argument(
520-
"--test", action="store_true", help="do dry run only, do not update the database"
521+
"--test",
522+
action="store_true",
523+
help="do dry run only, do not update the database"
521524
)
522525
parser.add_argument(
523-
"--file", type=str, help="load an existing zip file (otherwise fetch current data)"
526+
"--file",
527+
type=str,
528+
help="load an existing zip file (otherwise fetch current data)"
524529
)
525530
parser.add_argument(
526-
"--issue", type=int, help="issue of the file (e.g. 201740); used iff --file is given"
531+
"--issue",
532+
type=int,
533+
help="issue of the file (e.g. 201740); used iff --file is given"
527534
)
535+
# fmt: on
528536
args = parser.parse_args()
529537

530538
if (args.file is None) != (args.issue is None):

src/acquisition/ght/ght_update.py

+36-8
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ def get_num_rows():
330330
# print(' [%s|%s|%d] missing value' % (term, location, ew))
331331
ew = flu.add_epiweeks(ew, 1)
332332
if num_missing > 0:
333-
print(
334-
f" [{term}|{location}] missing {int(num_missing)}/{len(values)} value(s)"
335-
)
333+
print(f" [{term}|{location}] missing {int(num_missing)}/{len(values)} value(s)")
336334
except Exception as ex:
337335
print(f" [{term}|{location}] caught exception (will NOT retry):", ex)
338336

@@ -350,11 +348,41 @@ def main():
350348
# args and usage
351349
parser = argparse.ArgumentParser()
352350
# fmt: off
353-
parser.add_argument("location", action="store", type=str, default=None, help="location(s) (ex: all; US; TX; CA,LA,WY)")
354-
parser.add_argument("term", action="store", type=str, default=None, help='term/query/topic (ex: all; /m/0cycc; "flu fever")')
355-
parser.add_argument("--first", "-f", default=None, type=int, help="first epiweek override")
356-
parser.add_argument("--last", "-l", default=None, type=int, help="last epiweek override")
357-
parser.add_argument("--country", "-c", default="US", type=str, help="location country (ex: US; BR)")
351+
parser.add_argument(
352+
"location",
353+
action="store",
354+
type=str,
355+
default=None,
356+
help="location(s) (ex: all; US; TX; CA,LA,WY)"
357+
)
358+
parser.add_argument(
359+
"term",
360+
action="store",
361+
type=str,
362+
default=None,
363+
help='term/query/topic (ex: all; /m/0cycc; "flu fever")'
364+
)
365+
parser.add_argument(
366+
"--first",
367+
"-f",
368+
default=None,
369+
type=int,
370+
help="first epiweek override"
371+
)
372+
parser.add_argument(
373+
"--last",
374+
"-l",
375+
default=None,
376+
type=int,
377+
help="last epiweek override"
378+
)
379+
parser.add_argument(
380+
"--country",
381+
"-c",
382+
default="US",
383+
type=str,
384+
help="location country (ex: US; BR)"
385+
)
358386
# fmt: on
359387
args = parser.parse_args()
360388

src/acquisition/ght/google_health_trends.py

+25-5
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,39 @@ def main():
116116
parser = argparse.ArgumentParser()
117117
# fmt: off
118118
parser.add_argument(
119-
"apikey", action="store", type=str, default=None, help="API key"
119+
"apikey",
120+
action="store",
121+
type=str,
122+
default=None,
123+
help="API key"
120124
)
121125
parser.add_argument(
122-
"startweek", action="store", type=int, default=None, help="first week (ex: 201440)"
126+
"startweek",
127+
action="store",
128+
type=int,
129+
default=None,
130+
help="first week (ex: 201440)"
123131
)
124132
parser.add_argument(
125-
"endweek", action="store", type=int, default=None, help="last week (ex: 201520)"
133+
"endweek",
134+
action="store",
135+
type=int,
136+
default=None,
137+
help="last week (ex: 201520)"
126138
)
127139
parser.add_argument(
128-
"location", action="store", type=str, default=None, help="location (ex: US)"
140+
"location",
141+
action="store",
142+
type=str,
143+
default=None,
144+
help="location (ex: US)"
129145
)
130146
parser.add_argument(
131-
"term", action="store", type=str, default=None, help="term/query/topic (ex: /m/0cycc)"
147+
"term",
148+
action="store",
149+
type=str,
150+
default=None,
151+
help="term/query/topic (ex: /m/0cycc)"
132152
)
133153
# fmt: on
134154
args = parser.parse_args()

src/acquisition/paho/paho_db_update.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,23 @@ def update_from_file(issue, date, filename, test_mode=False):
234234
def main():
235235
# args and usage
236236
parser = argparse.ArgumentParser()
237+
# fmt: off
237238
parser.add_argument(
238-
"--test", action="store_true", help="do dry run only, do not update the database"
239+
"--test",
240+
action="store_true",
241+
help="do dry run only, do not update the database"
239242
)
240243
parser.add_argument(
241-
"--file", type=str, help="load an existing zip file (otherwise fetch current data)"
244+
"--file",
245+
type=str,
246+
help="load an existing zip file (otherwise fetch current data)"
242247
)
243248
parser.add_argument(
244-
"--issue", type=int, help="issue of the file (e.g. 201740); used iff --file is given"
249+
"--issue",
250+
type=int,
251+
help="issue of the file (e.g. 201740); used iff --file is given"
245252
)
253+
# fmt: on
246254
args = parser.parse_args()
247255

248256
if (args.file is None) != (args.issue is None):

src/acquisition/quidel/quidel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def retrieve_excels(self):
140140
m.select("INBOX") # here you a can choose a mail box like INBOX instead
141141
# use m.list() to get all the mailboxes
142142
# you could filter using the IMAP rules here (check https://www.example-code.com/csharp/imap-search-critera.asp)
143-
_, items = m.search(None, "ALL")
143+
_, items = m.search(None, "ALL")
144144
items = items[0].split() # getting the mails id
145145

146146
# The emailids are ordered from past to now

src/acquisition/quidel/quidel_update.py

+33-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,39 @@ def main():
125125
# args and usage
126126
parser = argparse.ArgumentParser()
127127
# fmt: off
128-
parser.add_argument("--location", action="store", type=str, default=None, help="location(s) (ex: all; any of hhs1-10)")
129-
parser.add_argument("--first", "-f", default=None, type=int, help="first epiweek override")
130-
parser.add_argument("--last", "-l", default=None, type=int, help="last epiweek override")
131-
parser.add_argument("--force_update", "-u", action="store_true", help="force update db values")
132-
parser.add_argument("--skip_email", "-s", action="store_true", help="skip email downloading step")
128+
parser.add_argument(
129+
"--location",
130+
action="store",
131+
type=str,
132+
default=None,
133+
help="location(s) (ex: all; any of hhs1-10)"
134+
)
135+
parser.add_argument(
136+
"--first",
137+
"-f",
138+
default=None,
139+
type=int,
140+
help="first epiweek override"
141+
)
142+
parser.add_argument(
143+
"--last",
144+
"-l",
145+
default=None,
146+
type=int,
147+
help="last epiweek override"
148+
)
149+
parser.add_argument(
150+
"--force_update",
151+
"-u",
152+
action="store_true",
153+
help="force update db values"
154+
)
155+
parser.add_argument(
156+
"--skip_email",
157+
"-s",
158+
action="store_true",
159+
help="skip email downloading step"
160+
)
133161
# fmt: on
134162
args = parser.parse_args()
135163

src/acquisition/twtr/healthtweets.py

+39-6
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,45 @@ def main():
216216
# args and usage
217217
parser = argparse.ArgumentParser()
218218
# fmt: off
219-
parser.add_argument("username", action="store", type=str, help="healthtweets.org username")
220-
parser.add_argument("password", action="store", type=str, help="healthtweets.org password")
221-
parser.add_argument("state", action="store", type=str, choices=list(HealthTweets.STATE_CODES.keys()), help="U.S. state (ex: TX)")
222-
parser.add_argument("date1", action="store", type=str, help="first date, inclusive (ex: 2015-01-01)")
223-
parser.add_argument("date2", action="store", type=str, help="last date, inclusive (ex: 2015-01-01)")
224-
parser.add_argument("-d", "--debug", action="store_const", const=True, default=False, help="enable debug mode")
219+
parser.add_argument(
220+
"username",
221+
action="store",
222+
type=str,
223+
help="healthtweets.org username"
224+
)
225+
parser.add_argument(
226+
"password",
227+
action="store",
228+
type=str,
229+
help="healthtweets.org password"
230+
)
231+
parser.add_argument(
232+
"state",
233+
action="store",
234+
type=str,
235+
choices=list(HealthTweets.STATE_CODES.keys()),
236+
help="U.S. state (ex: TX)"
237+
)
238+
parser.add_argument(
239+
"date1",
240+
action="store",
241+
type=str,
242+
help="first date, inclusive (ex: 2015-01-01)"
243+
)
244+
parser.add_argument(
245+
"date2",
246+
action="store",
247+
type=str,
248+
help="last date, inclusive (ex: 2015-01-01)"
249+
)
250+
parser.add_argument(
251+
"-d",
252+
"--debug",
253+
action="store_const",
254+
const=True,
255+
default=False,
256+
help="enable debug mode"
257+
)
225258
# fmt: on
226259
args = parser.parse_args()
227260

src/acquisition/wiki/wiki_download.py

+45-6
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,51 @@ def main():
288288
# args and usage
289289
parser = argparse.ArgumentParser()
290290
# fmt: off
291-
parser.add_argument("secret", type=str, help="hmac secret key")
292-
parser.add_argument("-b", "--blimit", action="store", type=int, default=None, help="download limit, in bytes")
293-
parser.add_argument("-j", "--jlimit", action="store", type=int, default=None, help="job limit")
294-
parser.add_argument("-s", "--sleep", action="store", type=int, default=1, help="seconds to sleep between each job")
295-
parser.add_argument("-t", "--type", action="store", type=int, default=0, help="type of job")
296-
parser.add_argument("-d", "--debug", action="store_const", const=True, default=False, help="enable debug mode")
291+
parser.add_argument(
292+
"secret",
293+
type=str,
294+
help="hmac secret key"
295+
)
296+
parser.add_argument(
297+
"-b",
298+
"--blimit",
299+
action="store",
300+
type=int,
301+
default=None,
302+
help="download limit, in bytes"
303+
)
304+
parser.add_argument(
305+
"-j",
306+
"--jlimit",
307+
action="store",
308+
type=int,
309+
default=None,
310+
help="job limit"
311+
)
312+
parser.add_argument(
313+
"-s",
314+
"--sleep",
315+
action="store",
316+
type=int,
317+
default=1,
318+
help="seconds to sleep between each job"
319+
)
320+
parser.add_argument(
321+
"-t",
322+
"--type",
323+
action="store",
324+
type=int,
325+
default=0,
326+
help="type of job"
327+
)
328+
parser.add_argument(
329+
"-d",
330+
"--debug",
331+
action="store_const",
332+
const=True,
333+
default=False,
334+
help="enable debug mode"
335+
)
297336
# fmt: on
298337
args = parser.parse_args()
299338

0 commit comments

Comments
 (0)