"""Image Processing SciKit (Toolbox for SciPy)

``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image
processing and computer vision.

The main package of ``skimage`` only provides a few utilities for converting
between image data types; for most features, you need to import one of the
following subpackages:

Subpackages
-----------
color
    Color space conversion.
data
    Test images and example data.
draw
    Drawing primitives (lines, text, etc.) that operate on NumPy arrays.
exposure
    Image intensity adjustment, e.g., histogram equalization, etc.
feature
    Feature detection and extraction, e.g., texture analysis corners, etc.
filter
    Sharpening, edge finding, rank filters, thresholding, etc.
graph
    Graph-theoretic operations, e.g., shortest paths.
io
    Reading, saving, and displaying images and video.
measure
    Measurement of image properties, e.g., similarity and contours.
morphology
    Morphological operations, e.g., opening or skeletonization.
novice
    Simplified interface for teaching purposes.
restoration
    Restoration algorithms, e.g., deconvolution algorithms, denoising, etc.
segmentation
    Partitioning an image into multiple regions.
transform
    Geometric and other transforms, e.g., rotation or the Radon transform.
util
    Generic utilities.
viewer
    A simple graphical user interface for visualizing results and exploring
    parameters.

Utility Functions
-----------------
img_as_float
    Convert an image to floating point format, with values in [0, 1].
img_as_uint
    Convert an image to unsigned integer format, with values in [0, 65535].
img_as_int
    Convert an image to signed integer format, with values in [-32768, 32767].
img_as_ubyte
    Convert an image to unsigned byte format, with values in [0, 255].

"""

import os.path as _osp
import imp as _imp
import functools as _functools
import warnings as _warnings
from skimage._shared.utils import deprecated as _deprecated

pkg_dir = _osp.abspath(_osp.dirname(__file__))
data_dir = _osp.join(pkg_dir, 'data')

try:
    from .version import version as __version__
except ImportError:
    __version__ = "unbuilt-dev"
else:
    del version


try:
    _imp.find_module('nose')
except ImportError:
    def _test(verbose=False):
        """This would run all unit tests, but nose couldn't be
        imported so the test suite can not run.
        """
        raise ImportError("Could not load nose. Unit tests not available.")

    def _doctest(verbose=False):
        """This would run all doc tests, but nose couldn't be
        imported so the test suite can not run.
        """
        raise ImportError("Could not load nose. Doctests not available.")
else:
    def _test(doctest=False, verbose=False):
        """Run all unit tests."""
        import nose
        args = ['', pkg_dir, '--exe', '--ignore-files=^_test']
        if verbose:
            args.extend(['-v', '-s'])
        if doctest:
            args.extend(['--with-doctest', '--ignore-files=^\.',
                         '--ignore-files=^setup\.py$$', '--ignore-files=test'])
            # Make sure warnings do not break the doc tests
            with _warnings.catch_warnings():
                _warnings.simplefilter("ignore")
                success = nose.run('skimage', argv=args)
        else:
            success = nose.run('skimage', argv=args)
        # Return sys.exit code
        if success:
            return 0
        else:
            return 1


# do not use `test` as function name as this leads to a recursion problem with
# the nose test suite
test = _test
test_verbose = _functools.partial(test, verbose=True)
test_verbose.__doc__ = test.__doc__
doctest = _functools.partial(test, doctest=True)
doctest.__doc__ = doctest.__doc__
doctest_verbose = _functools.partial(test, doctest=True, verbose=True)
doctest_verbose.__doc__ = doctest.__doc__


class _Log(Warning):
    pass


class _FakeLog(object):
    def __init__(self, name):
        """
        Parameters
        ----------
        name : str
            Name of the log.
        repeat : bool
            Whether to print repeating messages more than once (False by
            default).
        """
        self._name = name

        warnings.simplefilter("always", _Log)

        self._warnings = _warnings

    def _warn(self, msg, wtype):
        self._warnings.warn('%s: %s' % (wtype, msg), _Log)

    def debug(self, msg):
        self._warn(msg, 'DEBUG')

    def info(self, msg):
        self._warn(msg, 'INFO')

    def warning(self, msg):
        self._warn(msg, 'WARNING')

    warn = warning

    def error(self, msg):
        self._warn(msg, 'ERROR')

    def critical(self, msg):
        self._warn(msg, 'CRITICAL')

    def addHandler(*args):
        pass

    def setLevel(*args):
        pass


from .util.dtype import *

@@ -3879,934 +3879,8 @@
 __%0A%0A
-%0Aclass _Log(Warning):%0A    pass%0A%0A%0Aclass _FakeLog(object):%0A    def __init__(self, name):%0A        %22%22%22%0A        Parameters%0A        ----------%0A        name : str%0A            Name of the log.%0A        repeat : bool%0A            Whether to print repeating messages more than once (False by%0A            default).%0A        %22%22%22%0A        self._name = name%0A%0A        warnings.simplefilter(%22always%22, _Log)%0A%0A        self._warnings = _warnings%0A%0A    def _warn(self, msg, wtype):%0A        self._warnings.warn('%25s: %25s' %25 (wtype, msg), _Log)%0A%0A    def debug(self, msg):%0A        self._warn(msg, 'DEBUG')%0A%0A    def info(self, msg):%0A        self._warn(msg, 'INFO')%0A%0A    def warning(self, msg):%0A        self._warn(msg, 'WARNING')%0A%0A    warn = warning%0A%0A    def error(self, msg):%0A        self._warn(msg, 'ERROR')%0A%0A    def critical(self, msg):%0A        self._warn(msg, 'CRITICAL')%0A%0A    def addHandler(*args):%0A        pass%0A%0A    def setLevel(*args):%0A        pass%0A%0A%0A
 from

Remove leftovers of old logger