UnknownFileTypeError   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 3 1
1
#
2
# Copyright (C) 2013 - 2018 Satoru SATOH <ssato @ redhat.com>
3
# License: MIT
4
#
5
# pylint: disable=invalid-name
6
"""anyconfig globals.
7
"""
8
import collections
9
import anyconfig.init
10
11
12
PACKAGE = "anyconfig"
13
AUTHOR = "Satoru SATOH <[email protected]>"
14
VERSION = "0.9.7"
15
16
LOGGER = anyconfig.init.getLogger(PACKAGE)
17
18
IOI_KEYS = "src type path processor opener".split()
19
IOInfo = collections.namedtuple("IOInfo", IOI_KEYS)
20
21
IOI_TYPES = (IOI_NONE, IOI_PATH_STR, IOI_PATH_OBJ, IOI_STREAM) = \
22
            (None, "path", "pathlib.Path", "stream")
23
24
25
class UnknownParserTypeError(RuntimeError):
26
    """Raise if no parsers were found for given type."""
27
    def __init__(self, forced_type):
28
        msg = "No parser found for type '%s'" % forced_type
29
        super(UnknownParserTypeError, self).__init__(msg)
30
31
32
class UnknownProcessorTypeError(RuntimeError):
33
    """Raise if no processors were found for given type."""
34
    def __init__(self, forced_type):
35
        msg = "No parser found for type '%s'" % forced_type
36
        super(UnknownProcessorTypeError, self).__init__(msg)
37
38
39
class UnknownFileTypeError(RuntimeError):
40
    """Raise if not parsers were found for given file path."""
41
    def __init__(self, path):
42
        msg = "No parser found for file '%s'" % path
43
        super(UnknownFileTypeError, self).__init__(msg)
44
45
# vim:sw=4:ts=4:et:
46