mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 21:08:24 +08:00
Merge pull request #1518 from stefanv/relative_imports
Consistently use relative imports
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
*.pyc
|
||||
*~
|
||||
*#
|
||||
.#*
|
||||
*egg-info
|
||||
*.so
|
||||
*.pyd
|
||||
|
||||
+17
-9
@@ -79,15 +79,17 @@ For a more detailed discussion, read these :doc:`detailed documents
|
||||
|
||||
5. Document changes
|
||||
|
||||
Before merging your commits, you must add a description of your changes
|
||||
to the release notes of the upcoming version in
|
||||
``doc/release/release_dev.txt``.
|
||||
If your change introduces any API modifications, please update
|
||||
``doc/source/api_changes.txt``.
|
||||
|
||||
If your change introduces a deprecation, add a reminder to ``TODO.txt``
|
||||
for the team to remove the deprecated functionality in the future.
|
||||
|
||||
.. note::
|
||||
|
||||
To reviewers: if it is not obvious, add a short explanation of what a branch
|
||||
did to the merge message and, if closing a bug, also add "Closes #123"
|
||||
where 123 is the issue number.
|
||||
To reviewers: if it is not obvious from the PR description, add a short
|
||||
explanation of what a branch did to the merge message and, if closing a
|
||||
bug, also add "Closes #123" where 123 is the issue number.
|
||||
|
||||
|
||||
Divergence between ``upstream master`` and your feature branch
|
||||
@@ -124,8 +126,7 @@ Guidelines
|
||||
* All code should have tests (see `test coverage`_ below for more details).
|
||||
* All code should be documented, to the same
|
||||
`standard <://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard>`_ as NumPy and SciPy.
|
||||
* For new functionality, always add an example to the
|
||||
gallery.
|
||||
* For new functionality, always add an example to the gallery.
|
||||
* No changes are ever committed without review. Ask on the
|
||||
`mailing list <http://groups.google.com/group/scikit-image>`_ if
|
||||
you get no response to your pull request.
|
||||
@@ -147,7 +148,7 @@ Stylistic Guidelines
|
||||
import matplotlib.pyplot as plt
|
||||
from scipy import ndimage as ndi
|
||||
|
||||
cimport numpy as cnp # in Cython code
|
||||
cimport numpy as cnp # in Cython code
|
||||
|
||||
* When documenting array parameters, use ``image : (M, N) ndarray``
|
||||
and then refer to ``M`` and ``N`` in the docstring, if necessary.
|
||||
@@ -166,10 +167,17 @@ Stylistic Guidelines
|
||||
* Use ``Py_ssize_t`` as data type for all indexing, shape and size variables
|
||||
in C/C++ and Cython code.
|
||||
|
||||
* Use relative module imports, i.e. ``from .._shared import xyz`` rather than
|
||||
``from skimage._shared import xyz``.
|
||||
|
||||
* Wrap Cython code in a pure Python function, which defines the API. This
|
||||
improves compatibility with code introspection tools, which are often not
|
||||
aware of Cython code.
|
||||
|
||||
* For Cython functions, release the GIL whenever possible, using
|
||||
``with nogil:``.
|
||||
|
||||
|
||||
Test coverage
|
||||
-------------
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from tempfile import NamedTemporaryFile
|
||||
|
||||
from numpy import testing
|
||||
import numpy as np
|
||||
from skimage._shared._warnings import expected_warnings
|
||||
from ._warnings import expected_warnings
|
||||
import warnings
|
||||
|
||||
from .. import data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte
|
||||
@@ -183,15 +183,19 @@ def mono_check(plugin, fmt='png'):
|
||||
def setup_test():
|
||||
"""Default package level setup routine for skimage tests.
|
||||
|
||||
Import packages known to raise errors, and then
|
||||
Import packages known to raise warnings, and then
|
||||
force warnings to raise errors.
|
||||
Set a random seed
|
||||
|
||||
Also set the random seed to zero.
|
||||
"""
|
||||
warnings.simplefilter('default')
|
||||
|
||||
from scipy import signal, ndimage, special, optimize, linalg
|
||||
from scipy.io import loadmat
|
||||
from skimage import viewer, filter
|
||||
|
||||
np.random.seed(0)
|
||||
|
||||
warnings.simplefilter('error')
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -41,7 +41,7 @@ def load(f):
|
||||
Returns
|
||||
-------
|
||||
img : ndarray
|
||||
Image loaded from skimage.data_dir.
|
||||
Image loaded from ``skimage.data_dir``.
|
||||
"""
|
||||
use_plugin('pil')
|
||||
return imread(_os.path.join(data_dir, f))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -26,8 +26,8 @@ from ..filters.thresholding import (threshold_adaptive, threshold_otsu, threshol
|
||||
from ..filters import rank
|
||||
from ..filters.rank import median
|
||||
|
||||
from skimage._shared.utils import deprecated
|
||||
from skimage import restoration
|
||||
from .._shared.utils import deprecated
|
||||
from .. import restoration
|
||||
denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\
|
||||
(restoration.denoise_bilateral)
|
||||
denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ...._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import numpy as np
|
||||
from skimage.restoration._nl_means_denoising import _nl_means_denoising_2d, \
|
||||
_nl_means_denoising_3d, \
|
||||
_fast_nl_means_denoising_2d, _fast_nl_means_denoising_3d
|
||||
from ._nl_means_denoising import (
|
||||
_nl_means_denoising_2d,
|
||||
_nl_means_denoising_3d,
|
||||
_fast_nl_means_denoising_2d,
|
||||
_fast_nl_means_denoising_3d)
|
||||
|
||||
|
||||
def nl_means_denoising(image, patch_size=7, patch_distance=11, h=0.1,
|
||||
multichannel=True, fast_mode=True):
|
||||
@@ -113,8 +116,7 @@ def nl_means_denoising(image, patch_size=7, patch_distance=11, h=0.1,
|
||||
else: # 3-D grayscale
|
||||
if fast_mode:
|
||||
return np.array(_fast_nl_means_denoising_3d(image, s=patch_size,
|
||||
d=patch_distance, h=h))
|
||||
d=patch_distance, h=h))
|
||||
else:
|
||||
return np.array(_nl_means_denoising_3d(image, patch_size,
|
||||
patch_distance, h))
|
||||
|
||||
patch_distance, h))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from skimage._shared.testing import setup_test, teardown_test
|
||||
from ..._shared.testing import setup_test, teardown_test
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
from skimage.viewer.qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg
|
||||
from ..qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg
|
||||
import matplotlib as mpl
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib import _pylab_helpers
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
|
||||
from skimage.viewer.qt import QtGui
|
||||
from ..qt import QtGui
|
||||
|
||||
|
||||
__all__ = ['open_file_dialog', 'save_file_dialog']
|
||||
|
||||
Reference in New Issue
Block a user