Completed
Push — master ( a1e8f3...b95acc )
by Oleksandr
02:23
created

Console

Complexity

Total Complexity 0

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 0
c 1
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
1
# coding: utf-8
2
3 1
from schematics.models import Model
4 1
from schematics.types import StringType, IntType, BooleanType
5 1
from schematics.types.compound import ListType, ModelType
6
7
8 1
class Connection(Model):
9 1
    port = IntType(
10
        min_value=0,
11
        max_value=65000,
12
        default=0,
13
        required=True,
14
    )
15 1
    allowed_hosts = ListType(
16
        field=StringType,
17
        min_size=0,
18
        required=True,
19
        min_length=1,
20
    )
21
22
23 1
class Logging(Model):
24 1
    is_enabled = BooleanType(
25
        default=False,
26
        required=True,
27
    )
28 1
    file_name = StringType(
29
        default="log.lst",
30
        min_length=1,
31
        required=True,
32
    )
33 1
    keep = BooleanType(
34
        default=True,
35
        required=True,
36
    )
37 1
    log_time = BooleanType(
38
        default=False,
39
        required=True,
40
    )
41
42
43 1
class HistorySize(Model):
44 1
    commands = IntType(
45
        min_value=0,
46
        max_value=10000,
47
        default=128,
48
        required=True,
49
    )
50 1
    records = IntType(
51
        min_value=0,
52
        max_value=10000,
53
        default=128,
54
        required=True,
55
    )
56
57
58 1
class Console(Model):
59 1
    connection = ModelType(
60
        model_spec=Connection,
61
        required=True,
62
    )
63 1
    logging = ModelType(
64
        model_spec=Logging,
65
        required=True,
66
    )
67 1
    history_size = ModelType(
68
        model_spec=HistorySize,
69
        required=True,
70
    )
71