Passed
Push — master ( bbd02a...7ebed9 )
by Matt
02:12
created

AudioException.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
"""
2
 *  PyDMXControl: A Python 3 module to control DMX using uDMX.
3
 *                Featuring fixture profiles, built-in effects and a web control panel.
4
 *  <https://github.com/MattIPv4/PyDMXControl/>
5
 *  Copyright (C) 2022 Matt Cowley (MattIPv4) ([email protected])
6
"""
7
8
9
class PyDMXControlException(Exception):
10
    pass
11
12
13
class LTPCollisionException(PyDMXControlException):
14
15
    def __init__(self, channel_id: int):
16
        super().__init__("Channel {} has two different values assigned at the same timestamp.".format(channel_id))
17
18
19
class FixtureCreationException(PyDMXControlException):
20
21
    def __init__(self, fixture_class, message: str):
22
        super().__init__("Unable to create fixture '{}': {}.".format(fixture_class, message))
23
24
25
class MissingArgumentException(PyDMXControlException, ValueError):
26
27
    def __init__(self, argument: str, kwarg: bool = False):
28
        super().__init__("Argument '{}' ({}) missing from call.".format(
29
            argument, "Positional" if not kwarg else "Keyword"))
30
31
32
class InvalidArgumentException(PyDMXControlException, ValueError):
33
34
    def __init__(self, argument: str, message: str, kwarg: bool = False):
35
        super().__init__("Argument '{}' ({}) is not valid - {}.".format(
36
            argument, message, "Positional" if not kwarg else "Keyword"))
37
38
39
class JSONConfigException(PyDMXControlException):
40
41
    def __init__(self, message: str):
42
        super().__init__(message)
43
44
45
class JSONConfigLoadException(JSONConfigException):
46
47
    def __init__(self, filename: str, extra_info: str = ""):
48
        super().__init__("Failed to load JSON file '{}'{}.".format(
49
            filename, ", {}".format(extra_info) if extra_info else ""))
50
51
52
class JSONConfigSaveException(JSONConfigException):
53
54
    def __init__(self, message: str):
55
        super().__init__(message)
56
57
58
class AudioException(PyDMXControlException):
59
60
    def __init__(self, message: str):
61
        super().__init__(message)
62
63
64
class EventAlreadyExistsException(PyDMXControlException):
65
66
    def __init__(self, timestamp: int):
67
        super().__init__("An event already exists at {}".format(timestamp))
68