Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class _DelayedImportError(object):
def __init__(self, package_name):
self.package_name = package_name
def __getattribute__(self, name):
package_name = super(_DelayedImportError, self).__getattribute__('package_name')
raise RuntimeError('Missing dependency: %s' % package_name)
try:
import numpy as np
except ImportError:
np = _DelayedImportError('numpy')
Empty = Sentinel('Empty', 'traittypes',
"""
Used in traittypes to specify that the default value should
be an empty dataset
""")
class SciType(TraitType):
"""A base trait type for numpy arrays, pandas dataframes, pandas series, xarray datasets and xarray dataarrays."""
def __init__(self, **kwargs):
super(SciType, self).__init__(**kwargs)
self.validators = []
def valid(self, *validators):
"""