Commit 390a968d authored by Mark Hymers's avatar Mark Hymers

Fixes for newer flake8 error messages

Signed-off-by: Mark Hymers's avatarMark Hymers <mark.hymers@ynic.york.ac.uk>
parent 94ba7b60
Pipeline #25179 passed with stage
in 2 minutes and 7 seconds
......@@ -525,11 +525,11 @@ class AbstractAnam(object):
# Now read any old-style lists in.
# This is for backwards compatibility only
for l in lists:
if isinstance(l, bytes):
l = l.decode('utf-8')
hname = 'LIST_' + l
setattr(ret, l, AnamList.from_oldstyle_hdf5(subgroup, hname))
for li in lists:
if isinstance(li, bytes):
li = li.decode('utf-8')
hname = 'LIST_' + li
setattr(ret, li, AnamList.from_oldstyle_hdf5(subgroup, hname))
# Tell the object to sort itself out if a Anam object
if isinstance(ret, AbstractAnam):
......
......@@ -286,8 +286,8 @@ class AbstractWritingTest(AnamTestBase):
def test_write_list_of_objects(self):
"""Check that we can save and restore a list of objects"""
l = [ExampleWriter(1), ExampleWriter(2), ExampleWriter(3)]
a = ExampleListWriter(l)
li = [ExampleWriter(1), ExampleWriter(2), ExampleWriter(3)]
a = ExampleListWriter(li)
self.write_it('test.hdf5', a)
b = self.read_it('test.hdf5', ExampleListWriter)
assert(isinstance(b, ExampleListWriter))
......@@ -331,8 +331,8 @@ class AbstractWritingTest(AnamTestBase):
def test_write_empty_dict(self):
"""Check that we can save and restore an empty dictionary"""
l = {}
a = ExampleDictWriter(l)
li = {}
a = ExampleDictWriter(li)
self.write_it('test.hdf5', a)
b = self.read_it('test.hdf5', ExampleDictWriter)
assert(isinstance(b, ExampleDictWriter))
......@@ -341,8 +341,8 @@ class AbstractWritingTest(AnamTestBase):
def test_write_basic_dict(self):
"""Check that we can save and restore a basic dictionary"""
l = {'A': 1, 'B': 2}
a = ExampleDictWriter(l)
li = {'A': 1, 'B': 2}
a = ExampleDictWriter(li)
self.write_it('test.hdf5', a)
b = self.read_it('test.hdf5', ExampleDictWriter)
assert(isinstance(b, ExampleDictWriter))
......@@ -354,10 +354,10 @@ class AbstractWritingTest(AnamTestBase):
def test_write_dict_with_objects(self):
"""Check that we can save and restore a dictionary containing
objects"""
l = {'a': ExampleWriter(1),
2: ExampleWriter(2),
3: ExampleWriter(3)}
a = ExampleDictWriter(l)
li = {'a': ExampleWriter(1),
2: ExampleWriter(2),
3: ExampleWriter(3)}
a = ExampleDictWriter(li)
self.write_it('test.hdf5', a)
b = self.read_it('test.hdf5', ExampleDictWriter)
assert(isinstance(b, ExampleDictWriter))
......@@ -370,10 +370,10 @@ class AbstractWritingTest(AnamTestBase):
def test_write_dict_with_dict(self):
"""Check that we can save and restore a dictionary containing a
dictionary"""
l = {'a': ExampleWriter(1),
2: {'c': 99, 'd': 100, 'e': ExampleWriter('blah')},
3: ExampleWriter(3)}
a = ExampleDictWriter(l)
li = {'a': ExampleWriter(1),
2: {'c': 99, 'd': 100, 'e': ExampleWriter('blah')},
3: ExampleWriter(3)}
a = ExampleDictWriter(li)
self.write_it('test.hdf5', a)
b = self.read_it('test.hdf5', ExampleDictWriter)
......
......@@ -5,7 +5,7 @@ from test_classes2 import ComplexPerson, ComplexPlace # noqa: F401
# Load the classes from the HDF5 file using
# the default hdf5group names
s = ComplexPerson.from_hdf5file('test_script2.hdf5')
l = ComplexPlace.from_hdf5file('test_script2.hdf5')
loc = ComplexPlace.from_hdf5file('test_script2.hdf5')
# Show that we have reconstructed the object
print("Person")
......@@ -15,5 +15,5 @@ print(s.age)
print("Place")
print(type(l))
print(l.location)
print(type(loc))
print(loc.location)
......@@ -14,8 +14,8 @@ s = ComplexPerson('Anna', 45)
print(s.name)
print(s.age)
l = ComplexPlace('York')
print(l.location)
loc = ComplexPlace('York')
print(loc.location)
t = ComplexTrain('Glasgow')
print(t.destination)
......@@ -23,7 +23,7 @@ print(t.destination)
# Serialise the person and place to disk
f = h5py.File('test_script2.hdf5', 'w')
s.to_hdf5(f.create_group(s.hdf5_defaultgroup))
l.to_hdf5(f.create_group(l.hdf5_defaultgroup))
loc.to_hdf5(f.create_group(loc.hdf5_defaultgroup))
t.to_hdf5(f.create_group(t.hdf5_defaultgroup))
f.close()
......
[flake8]
max-line-length=120
exclude=build/
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
......
#!/usr/bin/python
import sys
import os
from setuptools import setup
# Scripts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment