1616
1717__all__ = ["LiteralABC" , "ArgumentABC" , "OperatorABC" ]
1818
19+ from abc import ABC , abstractmethod
1920
20- from abc import ABCMeta , abstractmethod , abstractproperty
2121
22- import six
23-
24-
25- @six .add_metaclass (ABCMeta )
26- class LiteralABC (object ):
22+ class LiteralABC (ABC ):
2723 """Abstract Base Class for Literal.
2824
2925 See Literal for usage.
3026 """
3127
3228 @abstractmethod
3329 def identify (self , visitor ):
30+ """Identify this literal using a visitor."""
3431 pass
3532
3633 @abstractmethod
3734 def getValue (self ):
35+ """Return the value of the literal."""
3836 pass
3937
40- name = abstractproperty (None , None )
38+ @property
39+ @abstractmethod
40+ def name (self ):
41+ """Name of the literal."""
42+ pass
4143
4244
4345# End class LiteralABC
@@ -51,10 +53,20 @@ class ArgumentABC(LiteralABC):
5153
5254 @abstractmethod
5355 def setValue (self , value ):
56+ """Set the value of the argument."""
5457 pass
5558
56- const = abstractproperty (None , None )
57- value = abstractproperty (None , None )
59+ @property
60+ @abstractmethod
61+ def const (self ):
62+ """Whether the argument is constant."""
63+ pass
64+
65+ @property
66+ @abstractmethod
67+ def value (self ):
68+ """Value of the argument."""
69+ pass
5870
5971
6072# End class ArgumentABC
@@ -68,14 +80,44 @@ class OperatorABC(LiteralABC):
6880
6981 @abstractmethod
7082 def addLiteral (self , literal ):
83+ """Add a literal argument to the operator."""
84+ pass
85+
86+ @property
87+ @abstractmethod
88+ def args (self ):
89+ """Arguments of the operator."""
90+ pass
91+
92+ @property
93+ @abstractmethod
94+ def nin (self ):
95+ """Number of input arguments."""
7196 pass
7297
73- args = abstractproperty (None , None )
74- nin = abstractproperty (None , None )
75- nout = abstractproperty (None , None )
76- operation = abstractproperty (None , None )
77- symbol = abstractproperty (None , None )
78- value = abstractproperty (None , None )
98+ @property
99+ @abstractmethod
100+ def nout (self ):
101+ """Number of outputs."""
102+ pass
103+
104+ @property
105+ @abstractmethod
106+ def operation (self ):
107+ """Callable implementing the operator."""
108+ pass
109+
110+ @property
111+ @abstractmethod
112+ def symbol (self ):
113+ """Symbol representing the operator."""
114+ pass
115+
116+ @property
117+ @abstractmethod
118+ def value (self ):
119+ """Value produced by the operator."""
120+ pass
79121
80122
81123# End class OperatorABC
0 commit comments