Skip to content

Commit

Permalink
Code quality: Remove all unused imports and variables
Browse files Browse the repository at this point in the history
pylint warning codes
  W0611: Unused import
  W0612: Unused variable
  • Loading branch information
achilleas-k committed Jul 19, 2020
1 parent c01021c commit 86bdee5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nixio/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def create_data_frame(self, name="", type_="", col_dict=None,
else: # if col_names is None
if data is not None and type(data[0]) == np.void:
col_dtype = data[0].dtype
for i, dt in enumerate(col_dtype.fields.values()):
for dt in col_dtype.fields.values():
cn = list(col_dtype.fields.keys())
raw_dt = col_dtype.fields.values()
raw_dt = list(raw_dt)
Expand Down
2 changes: 1 addition & 1 deletion nixio/data_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from . import util
from .compression import Compression

from .exceptions import InvalidUnit, IncompatibleDimensions
from .exceptions import IncompatibleDimensions
from .section import Section


Expand Down
2 changes: 1 addition & 1 deletion nixio/data_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def write_rows(self, rows, index):
self._write_data(rows, sl=index)
else:
cr_list = []
for i, cr in enumerate(rows):
for cr in rows:
cr_list.append(tuple(cr))
self._write_data(cr_list, sl=index)

Expand Down
4 changes: 2 additions & 2 deletions nixio/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def can_read(nixfile):
filever = nixfile.version
if len(filever) != 3:
raise RuntimeError("Invalid version specified in file.")
vx, vy, vz = HDF_FF_VERSION
fx, fy, fz = filever
vx, vy, _ = HDF_FF_VERSION
fx, fy, _ = filever
if vx == fx and vy >= fy:
return True
else:
Expand Down
2 changes: 1 addition & 1 deletion nixio/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def __setitem__(self, key, data):
prop.values = data

def __iter__(self):
for name, item in self.items():
for _, item in self.items():
yield item

def items(self):
Expand Down
6 changes: 3 additions & 3 deletions nixio/test/test_multi_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ def test_multi_tag_tagged_data(self):
assert (segdata.shape == (1, 5, 1))

# retrieve all positions for all references
for ridx, ref in enumerate(mtag.references):
for pidx, p in enumerate(mtag.positions):
for ridx, _ in enumerate(mtag.references):
for pidx, _ in enumerate(mtag.positions):
mtag.tagged_data(pidx, ridx)

wrong_pos = self.block.create_data_array("incorpos", "test",
Expand Down Expand Up @@ -462,7 +462,7 @@ def test_multi_tag_tagged_data_1d(self):
onedmtag = self.block.create_multi_tag("2dmt", "mtag",
positions=onedpos)
onedmtag.references.append(oneddata)
for pidx, p in enumerate(onedmtag.positions):
for pidx, _ in enumerate(onedmtag.positions):
onedmtag.tagged_data(pidx, 0)

def test_multi_tag_feature_data(self):
Expand Down
2 changes: 1 addition & 1 deletion nixio/test/xcompat/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def cc(filenames, dest,
objnames = compiler.compile(filenames, output_dir=dest,
extra_postargs=compile_args)
for obj in objnames:
execname, ext = os.path.splitext(obj)
execname, _ = os.path.splitext(obj)
compiler.link_executable(
[obj], execname, output_dir=dest,
target_lang="c++",
Expand Down
8 changes: 4 additions & 4 deletions nixio/util/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def scalable(unit_a, unit_b):
if not (is_si(unit_a) and is_si(unit_b)):
return False

a_prefix, a_unit, a_power = split(unit_a)
b_prefix, b_unit, b_power = split(unit_b)
_, a_unit, a_power = split(unit_a)
_, b_unit, b_power = split(unit_b)
if a_unit != b_unit or a_power != b_power:
return False

Expand All @@ -163,8 +163,8 @@ def scaling(origin, destination):
"nixio.util.scaling"
)

org_prefix, org_unit, org_power = split(origin)
dest_prefix, dest_unit, dest_power = split(destination)
org_prefix, _, org_power = split(origin)
dest_prefix, _, dest_power = split(destination)

if org_prefix == dest_prefix and org_power == dest_power:
return scale
Expand Down

0 comments on commit 86bdee5

Please sign in to comment.