Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new flake8 errors #351

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hdmf/backends/hdf5/h5_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class H5DataIO(DataIO):
)
def __init__(self, **kwargs):
# Get the list of I/O options that user has passed in
ioarg_names = [name for name in kwargs.keys() if name not in['data', 'link_data', 'allow_plugin_filters']]
ioarg_names = [name for name in kwargs.keys() if name not in ['data', 'link_data', 'allow_plugin_filters']]
# Remove the ioargs from kwargs
ioarg_values = [popargs(argname, kwargs) for argname in ioarg_names]
# Consume link_data parameter
Expand Down
4 changes: 2 additions & 2 deletions src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,9 +1159,9 @@ def __queue_ref(self, func):
# dependency
self.__ref_queue.append(func)

def __rec_get_ref(self, l):
def __rec_get_ref(self, ref_list):
ret = list()
for elem in l:
for elem in ref_list:
if isinstance(elem, (list, tuple)):
ret.append(self.__rec_get_ref(elem))
elif isinstance(elem, (Builder, Container)):
Expand Down
18 changes: 9 additions & 9 deletions src/hdmf/build/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ def source(self, s):
source when this source is set
'''
super(GroupBuilder, self.__class__).source.fset(self, s)
for g in self.groups.values():
if g.source is None:
g.source = s
for d in self.datasets.values():
if d.source is None:
d.source = s
for l in self.links.values():
if l.source is None:
l.source = s
for group in self.groups.values():
if group.source is None:
group.source = s
for dset in self.datasets.values():
if dset.source is None:
dset.source = s
for link in self.links.values():
if link.source is None:
link.source = s

@property
def groups(self):
Expand Down
2 changes: 1 addition & 1 deletion src/hdmf/common/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def create_region(self, **kwargs):
region = getargs('region', kwargs)
if isinstance(region, slice):
if (region.start is not None and region.start < 0) or (region.stop is not None and region.stop > len(self)):
msg = 'region slice %s is out of range for this DynamicTable of length ' % (str(region), len(self))
msg = 'region slice %s is out of range for this DynamicTable of length %d' % (str(region), len(self))
raise IndexError(msg)
region = list(range(*region.indices(len(self))))
else:
Expand Down
10 changes: 5 additions & 5 deletions src/hdmf/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,20 @@ def __smart_str(v, num_indent):
return str(v)

@staticmethod
def __smart_str_list(l, num_indent, left_br):
def __smart_str_list(str_list, num_indent, left_br):
if left_br == '(':
right_br = ')'
if left_br == '{':
right_br = '}'
if len(l) == 0:
if len(str_list) == 0:
return left_br + ' ' + right_br
indent = num_indent * 2 * ' '
indent_in = (num_indent + 1) * 2 * ' '
out = left_br
for v in l[:-1]:
for v in str_list[:-1]:
out += '\n' + indent_in + Container.__smart_str(v, num_indent + 1) + ','
if l:
out += '\n' + indent_in + Container.__smart_str(l[-1], num_indent + 1)
if str_list:
out += '\n' + indent_in + Container.__smart_str(str_list[-1], num_indent + 1)
out += '\n' + indent + right_br
return out

Expand Down
2 changes: 1 addition & 1 deletion tests/coloredtestrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __len__(self, x):
return len(re.sub(r"\033\[[0-9];[0-9];[0-9]{1,2}m", "", x))

def addRow(self, row):
rows = [[''] for l in range(len(row))]
rows = [[''] for i in range(len(row))]
maxrows = 0
for i, x in enumerate(row):
for j, y in enumerate(x.split("\n")):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/spec_tests/test_spec_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _test_extensions_file(self):
- name: testdata
dtype: float
doc: test
""" # noqa: E128
""" # noqa: E122
nsstr = file.read()
self.assertEqual(nsstr, match_str)

Expand All @@ -80,7 +80,7 @@ def _test_namespace_file(self):
source: mylab.extensions.yaml
title: Extensions for my lab
version: 0.0.1
""" % self.date.isoformat() # noqa: E128
""" % self.date.isoformat() # noqa: E122
nsstr = file.read()
self.assertEqual(nsstr, match_str)

Expand Down Expand Up @@ -207,7 +207,7 @@ def _test_namespace_file(self):
schema:
- source: mylab.extensions.yaml
version: 0.0.1
""" % self.date.isoformat() # noqa: E128
""" % self.date.isoformat() # noqa: E122
nsstr = file.read()
self.assertEqual(nsstr, match_str)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_io_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def default(self, obj):
try:
ret = t(obj)
break
except: # noqa: F722
except: # noqa: E722
pass
if ret is None:
return obj
Expand Down