• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SPF-OST / trnsys-dck-parser / 8924936794

02 May 2024 01:45PM UTC coverage: 0.0%. First build
8924936794

Pull #1

github

web-flow
Merge 16fd89c64 into add13752b
Pull Request #1: Expressions

0 of 401 new or added lines in 9 files covered. (0.0%)

0 of 401 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/trnsys_dck_parser/model/expression.py
NEW
1
import abc as _abc
×
NEW
2
import dataclasses as _dc
×
NEW
3
import typing as _tp
×
4

NEW
5
import trnsys_dck_parser.common as _pcom
×
6

7

NEW
8
class Expression(_abc.ABC):
×
NEW
9
    def __neg__(self) -> "Negation":
×
NEW
10
        return Negation(self)
×
11

NEW
12
    def __add__(self, other: "Expression") -> "Addition":
×
NEW
13
        return Addition(self, other)
×
14

NEW
15
    def __radd__(self, other: "Expression") -> "Addition":
×
NEW
16
        return Addition(other, self)
×
17

NEW
18
    def __sub__(self, other: "Expression") -> "Subtraction":
×
NEW
19
        return Subtraction(self, other)
×
20

NEW
21
    def __rsub__(self, other: "Expression") -> "Subtraction":
×
NEW
22
        return Subtraction(other, self)
×
23

NEW
24
    def __mul__(self, other: "Expression") -> "Multiplication":
×
NEW
25
        return Multiplication(self, other)
×
26

NEW
27
    def __rmul__(self, other: "Expression") -> "Multiplication":
×
NEW
28
        return Multiplication(other, self)
×
29

NEW
30
    def __truediv__(self, other: "Expression") -> "Division":
×
NEW
31
        return Division(self, other)
×
32

NEW
33
    def __rtruediv__(self, other: "Expression") -> "Division":
×
NEW
34
        return Division(self, other)
×
35

NEW
36
    def __pow__(self, power: "Expression") -> "Power":
×
NEW
37
        return Power(self, power)
×
38

39

NEW
40
Number = int | float
×
41

42

NEW
43
@_dc.dataclass(eq=True)
×
NEW
44
class Literal(Expression):
×
NEW
45
    value: Number
×
46

47

NEW
48
@_dc.dataclass(eq=True)
×
NEW
49
class UnaryExpression(Expression, _abc.ABC):
×
NEW
50
    x: Expression
×
51

52

NEW
53
@_dc.dataclass(eq=True)
×
NEW
54
class Negation(UnaryExpression):
×
NEW
55
    pass
×
56

57

NEW
58
@_dc.dataclass(eq=True)
×
NEW
59
class BinaryExpression(Expression, _abc.ABC):
×
NEW
60
    x: Expression
×
NEW
61
    y: Expression
×
62

63

NEW
64
class Addition(BinaryExpression):
×
NEW
65
    pass
×
66

67

NEW
68
class Subtraction(BinaryExpression):
×
NEW
69
    pass
×
70

71

NEW
72
class Multiplication(BinaryExpression):
×
NEW
73
    pass
×
74

75

NEW
76
class Division(BinaryExpression):
×
NEW
77
    pass
×
78

79

NEW
80
class Power(BinaryExpression):
×
NEW
81
    pass
×
82

83

NEW
84
@_dc.dataclass(eq=True)
×
NEW
85
class Variable(Expression):
×
NEW
86
    name: str
×
87

NEW
88
    def __post_init__(self):
×
NEW
89
        pattern = _pcom.IDENTIFIER_PATTERN
×
NEW
90
        if not pattern.fullmatch(self.name):
×
NEW
91
            raise ValueError(f"Variable names must match the following regex pattern: {pattern.pattern}")
×
92

93

NEW
94
@_dc.dataclass(eq=True)
×
NEW
95
class UnitOutput(Expression):
×
NEW
96
    unit_number: int
×
NEW
97
    output_number: int
×
98

99

NEW
100
@_dc.dataclass(eq=True)
×
NEW
101
class FunctionCall(Expression):
×
NEW
102
    function: str
×
NEW
103
    arguments: _tp.Sequence[Expression]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc