forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
76 lines (54 loc) · 2.59 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
73
74
75
76
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from conda import CondaError
class CondaEnvException(CondaError):
def __init__(self, message, *args, **kwargs):
msg = "%s" % message
super(CondaEnvException, 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 EnvironmentFileExtensionNotValid(CondaEnvException):
def __init__(self, filename, *args, **kwargs):
msg = "'{}' file extension must be one of '.txt', '.yaml' or '.yml'".format(filename)
self.filename = filename
super(EnvironmentFileExtensionNotValid, self).__init__(msg, *args, **kwargs)
class NoBinstar(CondaError):
def __init__(self):
msg = 'The anaconda-client cli must be installed to perform this action'
super(NoBinstar, self).__init__(msg)
class AlreadyExist(CondaError):
def __init__(self):
msg = 'The environment path already exists'
super(AlreadyExist, self).__init__(msg)
class EnvironmentAlreadyInNotebook(CondaError):
def __init__(self, notebook, *args, **kwargs):
msg = "The notebook {} already has an environment"
super(EnvironmentAlreadyInNotebook, self).__init__(msg, *args, **kwargs)
class EnvironmentFileDoesNotExist(CondaError):
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(CondaError):
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(CondaError):
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(CondaError):
def __init__(self):
msg = """nbformat is not installed. Install it with:
conda install nbformat
"""
super(NBFormatNotInstalled, self).__init__(msg)