opae.admin:mtd: address lint errors
* Change how 'progress' object is tested as a file type.
In Python 3, `open(...)` will return an object deriving from
io.IOBase. Python 2 uses a `file` type object.
import fcntl
import shutil
import struct
+import sys
from opae.admin.utils.log import loggable
from opae.admin.utils.progress import progress
+if sys.version_info[0] == 3:
+ from io import IOBase as _ftype
+else:
+ _ftype = file # noqa (Python 3 will report this as an error)
+
class mtd(loggable):
"""mtd encapsulates an mtd (flash) device"""
@@ -181,7 +187,7 @@ class mtd(loggable):
cfg = {'bytes': size}
if callable(prg_writer):
cfg['log'] = prg_writer
- elif type(prg_writer) is file:
+ elif isinstance(prg_writer, _ftype):
cfg['stream'] = prg_writer
else:
cfg['null'] = True
