forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
72 lines (50 loc) · 2.47 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
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
from conda import CondaError
from conda.exceptions import CondaRuntimeError
class CondaEnvException(CondaError):
def __init__(self, message, *args, **kwargs):
msg = "Conda Env Exception: %s" % message
super(CondaEnvException, self).__init__(msg, *args, **kwargs)
class CondaEnvRuntimeError(CondaRuntimeError):
def __init__(self, msg, *args, **kwargs):
super(CondaEnvRuntimeError, self).__init__(msg, *args, **kwargs)
class EnvironmentFileNotFound(CondaEnvException):
def __init__(self, filename, *args, **kwargs):
msg = '{} file not found'.format(filename)
self.filename = filename
super(EnvironmentFileNotFound, self).__init__(msg, *args, **kwargs)
class NoBinstar(CondaEnvRuntimeError):
def __init__(self):
msg = 'The anaconda-client cli must be installed to perform this action'
super(NoBinstar, self).__init__(msg)
class AlreadyExist(CondaEnvRuntimeError):
def __init__(self):
msg = 'The environment path already exists'
super(AlreadyExist, self).__init__(msg)
class EnvironmentAlreadyInNotebook(CondaEnvRuntimeError):
def __init__(self, notebook, *args, **kwargs):
msg = "The notebook {} already has an environment"
super(EnvironmentAlreadyInNotebook, self).__init__(msg, *args, **kwargs)
class EnvironmentFileDoesNotExist(CondaEnvRuntimeError):
def __init__(self, handle, *args, **kwargs):
self.handle = handle
msg = "{} does not have an environment definition".format(handle)
super(EnvironmentFileDoesNotExist, self).__init__(msg, *args, **kwargs)
class EnvironmentFileNotDownloaded(CondaEnvRuntimeError):
def __init__(self, username, packagename, *args, **kwargs):
msg = '{}/{} file not downloaded'.format(username, packagename)
self.username = username
self.packagename = packagename
super(EnvironmentFileNotDownloaded, self).__init__(msg, *args, **kwargs)
class SpecNotFound(CondaEnvRuntimeError):
def __init__(self, msg, *args, **kwargs):
super(SpecNotFound, self).__init__(msg, *args, **kwargs)
class InvalidLoader(Exception):
def __init__(self, name):
msg = 'Unable to load installer for {}'.format(name)
super(InvalidLoader, self).__init__(msg)
class NBFormatNotInstalled(CondaEnvRuntimeError):
def __init__(self):
msg = """nbformat is not installed. Install it with:
conda install nbformat
"""
super(NBFormatNotInstalled, self).__init__(msg)