Commit d8e54955 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

use six to check for string types

parent 05317b9c
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import six
import bob.bio.base
import bob.io.base
......@@ -36,7 +37,7 @@ class Wrapper (bob.bio.base.algorithm.Algorithm):
compressed_io = False
):
# load algorithm configuration
if isinstance(algorithm, str):
if isinstance(algorithm, six.string_types):
self.algorithm = bob.bio.base.load_resource(algorithm, "algorithm")
elif isinstance(algorithm, bob.bio.base.algorithm.Algorithm):
self.algorithm = algorithm
......
import six
from collections import OrderedDict
from bob.bio.face.annotator import Base
from bob.ip.facedetect import bounding_box_from_annotation
from bob.bio.base import load_resource
from bob.bio.face.annotator import min_face_size_validator
from .. import utils
from . import normalize_annotations
class Wrapper(Base):
......@@ -37,7 +38,7 @@ class Wrapper(Base):
self.max_age = max_age
# load annotator configuration
if isinstance(annotator, str):
if isinstance(annotator, six.string_types):
self.annotator = load_resource(annotator, "annotator")
def annotate(self, frames, **kwargs):
......
......@@ -4,6 +4,7 @@
import bob.bio.base
import bob.io.base
import os
import six
from .. import utils
......@@ -36,7 +37,7 @@ class Wrapper (bob.bio.base.extractor.Extractor):
compressed_io = False
):
# load extractor configuration
if isinstance(extractor, str):
if isinstance(extractor, six.string_types):
self.extractor = bob.bio.base.load_resource(extractor, "extractor")
elif isinstance(extractor, bob.bio.base.extractor.Extractor):
self.extractor = extractor
......
......@@ -3,6 +3,7 @@
import bob.bio.base
import bob.io.base
import six
from .. import utils
......@@ -65,7 +66,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
read_original_data = _read_video_data
# load preprocessor configuration
if isinstance(preprocessor, str):
if isinstance(preprocessor, six.string_types):
self.preprocessor = bob.bio.base.load_resource(preprocessor, "preprocessor")
elif isinstance(preprocessor, bob.bio.base.preprocessor.Preprocessor):
self.preprocessor = preprocessor
......@@ -181,4 +182,4 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
if self.compressed_io:
return utils.save_compressed(frames, filename, self.preprocessor.write_data)
else:
frames.save(bob.io.base.HDF5File(filename, 'w'), self.preprocessor.write_data)
\ No newline at end of file
frames.save(bob.io.base.HDF5File(filename, 'w'), self.preprocessor.write_data)
......@@ -7,6 +7,7 @@ import bob.io.image
import bob.io.video
import numpy
import os
import six
import logging
logger = logging.getLogger("bob.bio.video")
......@@ -49,7 +50,7 @@ class FrameSelector:
When giving ``str`` or ``[str]`` data, the given ``load_function`` is used to read the data from file.
"""
# if given a string, first load the video
if isinstance(data, str):
if isinstance(data, six.string_types):
logger.debug("Loading video file '%s'", data)
data = load_function(data)
......
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