Skip to content

Commit efaa379

Browse files
committedJan 24, 2025·
FIX: linting
1 parent 42088de commit efaa379

35 files changed

+1062
-710
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*.tmp
1717
*.vim
1818
tags
19+
.vscode
1920

2021
# Compiled source #
2122
###################

‎src/pyrad_proc/pyrad/flow/flow_aux.py

+31-23
Original file line numberDiff line numberDiff line change
@@ -1038,15 +1038,16 @@ def _create_cfg_dict(cfgfile):
10381038
try:
10391039
print("- Main config file : {}".format(cfgfile))
10401040
cfg = read_config(cfg["configFile"], cfg=cfg, defaults=DEFAULT_CONFIG["main"])
1041-
1041+
10421042
# Convert loc and prod config files to absolute paths if needed
1043-
filenames = ["locationConfigFile",
1044-
"productConfigFile",
1043+
filenames = [
1044+
"locationConfigFile",
1045+
"productConfigFile",
10451046
]
10461047
for fname in filenames:
10471048
if not os.path.isabs(cfg[fname]):
1048-
cfg[fname] = os.path.join(cfg['configpath'], cfg[fname])
1049-
1049+
cfg[fname] = os.path.join(cfg["configpath"], cfg[fname])
1050+
10501051
print("- Location config file : {}".format(cfg["locationConfigFile"]))
10511052
cfg = read_config(
10521053
cfg["locationConfigFile"], cfg=cfg, defaults=DEFAULT_CONFIG["loc"]
@@ -1183,7 +1184,8 @@ def _create_cfg_dict(cfgfile):
11831184

11841185
# check whether specified paths are relative or absolute
11851186
# if relative add configpath to the path
1186-
filenames = ["locationConfigFile",
1187+
filenames = [
1188+
"locationConfigFile",
11871189
"productConfigFile",
11881190
"datapath",
11891191
"iconpath",
@@ -1194,17 +1196,18 @@ def _create_cfg_dict(cfgfile):
11941196
"psrpath",
11951197
"iqpath",
11961198
"satpath",
1197-
"smnpath"]
1198-
1199+
"smnpath",
1200+
]
1201+
11991202
for fname in filenames:
12001203
if type(cfg[fname]) is list:
12011204
for val in cfg[fname]:
12021205
if not os.path.isabs(val):
1203-
val = os.path.join(cfg['configpath'], val)
1206+
val = os.path.join(cfg["configpath"], val)
12041207
elif type(cfg[fname]) is str:
12051208
if not os.path.isabs(cfg[fname]):
1206-
cfg[fname] = os.path.join(cfg['configpath'], cfg[fname])
1207-
1209+
cfg[fname] = os.path.join(cfg["configpath"], cfg[fname])
1210+
12081211
# if specified in config, convert coordinates to arrays
12091212
if "RadarPosition" in cfg:
12101213
fltarr_list = ["latitude", "longitude", "altitude"]
@@ -1329,30 +1332,35 @@ def _create_datacfg_dict(cfg):
13291332
datacfg.update({"MFScale": cfg["MFScale"]})
13301333
datacfg.update({"DataTypeIDInFiles": cfg["DataTypeIDInFiles"]})
13311334

1332-
#s3 buckets
1335+
# s3 buckets
13331336
if "bucket" in cfg:
13341337
try:
13351338
datacfg["s3_key"] = os.environ["S3_IN_KEY"]
13361339
datacfg["s3_secret_key"] = os.environ["S3_IN_SECRET"]
13371340
except KeyError:
13381341
warn(
1339-
'Define environment variables S3_IN_KEY and S3_IN_SECRET'
1340-
' to get input data from S3 buckets.')
1342+
"Define environment variables S3_IN_KEY and S3_IN_SECRET"
1343+
" to get input data from S3 buckets."
1344+
)
13411345

13421346
if "s3path" in cfg:
13431347
datacfg.update({"s3path": cfg["s3path"]})
13441348
else:
1345-
warn('Unable to read data from s3 bucket. Define s3path')
1349+
warn("Unable to read data from s3 bucket. Define s3path")
13461350
if "s3_url" in cfg:
13471351
datacfg.update({"s3_url": cfg["s3_url"]})
13481352
else:
1349-
warn('Unable to read data from s3 bucket. Define s3_url')
1353+
warn("Unable to read data from s3 bucket. Define s3_url")
13501354

13511355
if "rm_s3_file" in cfg:
13521356
datacfg.update({"rm_s3_file": cfg["rm_s3_file"]})
13531357

1354-
if ('s3path' in datacfg and 's3_url' in datacfg
1355-
and 's3_key' in datacfg and 's3_secret_key' in datacfg):
1358+
if (
1359+
"s3path" in datacfg
1360+
and "s3_url" in datacfg
1361+
and "s3_key" in datacfg
1362+
and "s3_secret_key" in datacfg
1363+
):
13561364
datacfg.update({"bucket": cfg["bucket"]})
13571365

13581366
# Modify size of radar or radar spectra object
@@ -1791,14 +1799,14 @@ def _get_masterfile_list(datatypesdescr, starttimes, endtimes, datacfg, scan_lis
17911799
)
17921800
return [], None, None
17931801

1794-
if 'bucket' in datacfg:
1802+
if "bucket" in datacfg:
17951803
masterfilelist = get_file_list_s3(
1796-
masterdatatypedescr, starttimes, endtimes, datacfg,
1797-
scan=masterscan)
1804+
masterdatatypedescr, starttimes, endtimes, datacfg, scan=masterscan
1805+
)
17981806
else:
17991807
masterfilelist = get_file_list(
1800-
masterdatatypedescr, starttimes, endtimes, datacfg,
1801-
scan=masterscan)
1808+
masterdatatypedescr, starttimes, endtimes, datacfg, scan=masterscan
1809+
)
18021810

18031811
return masterfilelist, masterdatatypedescr, masterscan
18041812

‎src/pyrad_proc/pyrad/graph/plots_timeseries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def plot_timeseries(
9797
2018.03.05 -jgr- added x-limit of x axis to avoid unwanted error messages
9898
9999
"""
100-
tvec = np.array(tvec) # convert from pandas if needed
100+
tvec = np.array(tvec) # convert from pandas if needed
101101
if period > 0:
102102
for i, data in enumerate(data_list):
103103
data *= period / 3600.0

‎src/pyrad_proc/pyrad/graph/plots_vol.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def plot_ppi_map(
527527
)
528528
for rng_ring in rng_rings:
529529
display_map.plot_range_ring(rng_ring, ax=ax)
530-
530+
531531
if save_fig:
532532
for fname in fname_list:
533533
fig.savefig(fname, dpi=dpi)

‎src/pyrad_proc/pyrad/io/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@
253253
from .read_data_sensor import read_trt_thundertracking_traj_data # noqa
254254
from .read_data_sensor import read_coord_sensors, read_disdro_parsivel # noqa
255255
from .read_data_sensor import read_knmi # noqa
256-
from .read_data_sensor import read_radiosounding_wyoming, read_radiosounding_igra #noqa
256+
from .read_data_sensor import (# noqa
257+
read_radiosounding_wyoming,
258+
read_radiosounding_igra,
259+
)
257260
from .read_data_sensor import read_fzl_igra # noqa
258261

259262
from .read_data_sun import read_sun_hits_multiple_days, read_sun_hits # noqa

‎src/pyrad_proc/pyrad/io/flock_utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
try:
22
import fcntl
3+
34
FCNTL_AVAIL = True
45
except ModuleNotFoundError:
56
import msvcrt # For windows
7+
68
FCNTL_AVAIL = False
79

810
import os
911
import time
1012
from warnings import warn
1113
import errno
1214

15+
1316
def lock_file(file):
1417
if FCNTL_AVAIL:
1518
while True:
@@ -47,8 +50,9 @@ def lock_file(file):
4750
else:
4851
raise
4952

53+
5054
def unlock_file(file):
51-
if os.name == 'posix':
55+
if os.name == "posix":
5256
fcntl.flock(file, fcntl.LOCK_UN)
5357
else:
54-
msvcrt.locking(file.fileno(), msvcrt.LK_UNLCK, 1)
58+
msvcrt.locking(file.fileno(), msvcrt.LK_UNLCK, 1)

0 commit comments

Comments
 (0)
Please sign in to comment.