Skip to content

Commit 58d193f

Browse files
committed
flake8
1 parent 302c39b commit 58d193f

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

src/netcdf_scm/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ def wrangle_openscm_csvs(src, dst, var_to_wrangle, nested, out_format):
319319
if not var_regexp.match(dirpath):
320320
continue
321321

322+
format_custom_text.update_mapping(curr_dir=dirpath)
323+
bar.update(i)
324+
322325
openscmdf = df_append([join(dirpath, f) for f in filenames])
323326

324327
if nested:
@@ -342,6 +345,6 @@ def wrangle_openscm_csvs(src, dst, var_to_wrangle, nested, out_format):
342345
if out_format == "tuningstrucs":
343346
out_file = join(dst, "ts")
344347
click.echo("Wrangling everything to {}".format(dst))
345-
convert_scmdf_to_tuningstruc(openscmdf, out_file)
348+
convert_scmdf_to_tuningstruc(collected, out_file)
346349
else:
347350
raise ValueError("Unsupported format: {}".format(out_format))

src/netcdf_scm/mat4py/loadmat.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626

2727

2828
# encode a string to bytes and vice versa
29-
asbytes = lambda s: s.encode("latin1")
30-
asstr = lambda b: b.decode("latin1")
29+
def asbytes(s):
30+
return s.encode("latin1")
31+
32+
33+
def asstr(b):
34+
return b.decode("latin1")
35+
3136

3237
# array element data types
3338
etypes = {
@@ -323,7 +328,9 @@ def read_struct_array(fd, endian, header):
323328
fields = [fields]
324329

325330
# read rows and columns of each field
326-
empty = lambda: [list() for i in range(header["dims"][0])]
331+
def empty():
332+
return [list() for i in range(header["dims"][0])]
333+
327334
array = {}
328335
for row in range(header["dims"][0]):
329336
for col in range(header["dims"][1]):

src/netcdf_scm/mat4py/savemat.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727

2828

2929
# encode a string to bytes and vice versa
30-
asbytes = lambda s: s.encode("latin1")
31-
asstr = lambda b: b.decode("latin1")
30+
def asbytes(s):
31+
return s.encode("latin1")
32+
33+
34+
def asstr(b):
35+
return b.decode("latin1")
36+
3237

3338
# array element data types
3439
etypes = {
@@ -145,13 +150,13 @@ def write_elements(fd, mtp, data, is_name=False):
145150
else:
146151
fmt = "".join("{}s".format(len(s)) for s in data)
147152
else:
148-
l = len(data)
149-
if l == 0:
153+
length = len(data)
154+
if length == 0:
150155
# empty array
151156
fmt = ""
152-
if l > 1:
157+
if length > 1:
153158
# more than one element to be written
154-
fmt = "{}{}".format(l, fmt)
159+
fmt = "{}{}".format(length, fmt)
155160
else:
156161
data = (data,)
157162
num_bytes = struct.calcsize(fmt)

src/netcdf_scm/wranglers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def convert_tuningstruc_to_scmdf(
6868
try:
6969
metadata[k] = [dataset["tuningdata"]["model"][m][k]]
7070
except KeyError:
71-
if k is "model":
71+
if k == "model":
7272
metadata[k] = ["unspecified"]
7373
continue
7474

0 commit comments

Comments
 (0)