eris
Top-level module, including resource and optional dependency management.
DependencyWarning
Bases: ErisWarning
Custom warning class for missing optional dependencies.
Source code in eris/__init__.py
119 120 121 |
|
ErisWarning
Bases: Warning
A warning class for this package, making it easy to silence all our warning messages should you wish to.
Consult the python.warnings
module documentation for more details.
Examples:
>>> import warnings
>>> from eris import ErisWarning
... warnings.simplefilter('ignore', ErisWarning)
Source code in eris/__init__.py
105 106 107 108 109 110 111 112 113 114 115 116 |
|
Resources
Holds global resources for this package which are generated on demand.
Attributes:
Name | Type | Description |
---|---|---|
package |
str
|
Name of the package |
optional_packages |
set[str]
|
Set of optional packages to check for |
Source code in eris/__init__.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
available_cpus
property
Number of available CPUs
data
property
Path to the package data
metadata
property
Package metadata
pool
property
A concurrent.futures.Executor instance
rng
property
A random number generator instance, can be reused
__init__(*optional_packages)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
optional_packages
|
str
|
Optional packages to check for, e.g. 'numpy', 'pandas' |
()
|
Source code in eris/__init__.py
20 21 22 23 24 25 26 27 28 29 30 31 |
|
require(*packages)
A decorator to check for required optional packages before executing a function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*packages
|
str
|
Variable number of package names (strings) that are required. |
()
|
Returns:
Type | Description |
---|---|
Callable
|
A decorator that wraps the function. If any required packages are missing, |
Callable
|
it issues a DependencyWarning and returns None. Otherwise, it executes |
Callable
|
the original function. |
Examples:
>>> from eris import require
... @require('numpy')
... def some_numpy_func():
... ...
Source code in eris/__init__.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|