Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nipy / nitime / 159

9 Dec 2018 - 14:20 coverage: 79.708% (-0.2%) from 79.871%
159

Pull #165

travis-ci

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
Eliminate ciruclar imports.
Pull Request #165: DOC: Addresses #164

70 of 74 new or added lines in 2 files covered. (94.59%)

1 existing line in 1 file now uncovered.

4690 of 5884 relevant lines covered (79.71%)

1.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/nitime/lazy.py
1
"""
2
Commonly used nitime lazy imports are defined here, so they can be reused
3
throughout nitime. For an explanation of why we use lazily-loaded modules, and
4
how you can leverage this machinery in your code, see
5
:mod:`nitime.lazyimports`.
6

7
Lazily-loaded package have almost the same name as the
8
corresponding package's import string, except for periods are replaced with
9
underscores. For example, the way to lazily import ``matplotlib.mlab`` is via
10

11
    >>> from nitime.lazy import matplotlib_mlab as mlab
12

13
At this time, all lazy-loaded packages are defined manually. I (pi) made
14
several attempts to automate this process, such that any arbitrary package
15
``foo.bar.baz`` could be imported via ``from nitime.lazy import foo_bar_baz as
16
baz`` but had limited success.
17

18
Currently defined lazy imported packages are (remember to replace the ``.``
19
with ``_``) ::
20

21
    matplotlib.mlab
22
    scipy
23
    scipy.fftpack
24
    scipy.interpolate
25
    scipy.linalg
26
    scipy.signal
27
    scipy.signal.signaltools
28
    scipy.stats
29
    scipy.stats.distributions
30

31

32
If you want to lazily load another package in nitime, please add it to this
33
file, and then ``from nitime.lazy import your_new_package``.
34

35
If there's a package that you would like to lazily load in your own code that
36
is not listed here, use the :class:`LazyImport` class, which is in
37
:mod:`nitime.lazyimports`.
38
"""
39
from .lazyimports import LazyImport
2×
40

41
# matplotlib
42
matplotlib_mlab = LazyImport('matplotlib.mlab')
2×
43

44
# scipy
45
scipy = LazyImport('scipy')
2×
46
scipy_fftpack = LazyImport('scipy.fftpack')
2×
47
scipy_interpolate = LazyImport('scipy.interpolate')
2×
48
scipy_linalg = LazyImport('scipy.linalg')
2×
49
scipy_signal = LazyImport('scipy.signal')
2×
50
scipy_signal_signaltools = LazyImport('scipy.signal.signaltools')
2×
51
scipy_stats_distributions = LazyImport('scipy.stats.distributions')
2×
52
scipy_stats = LazyImport('scipy.stats')
2×
53
scipy_stats_distributions = LazyImport('scipy.stats.distributions')
2×
54

55
def enabled():
2×
56
    "Returns ``True`` if LazyImports are globally enabled"
57
    import nitime.lazyimports as l
!
UNCOV
58
    return not l.disable_lazy_imports
!
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc