5
5
from . import logging
6
6
from . import messages
7
7
8
+
8
9
class ProvisionalFeature (abc .ABC ):
9
10
def tag (self ) -> str :
10
11
return self .__class__ .__name__
11
12
12
- @abc .abstractproperty
13
- def __doc__ (self ): pass
13
+ @property
14
+ @abc .abstractmethod
15
+ def __doc__ (self ):
16
+ pass
14
17
15
- @abc .abstractproperty
16
- def short (self ) -> str : pass
18
+ @property
19
+ @abc .abstractmethod
20
+ def short (self ) -> str :
21
+ pass
17
22
18
- @abc .abstractproperty
19
- def stable (self ) -> str : pass
23
+ @property
24
+ @abc .abstractmethod
25
+ def stable (self ) -> bool :
26
+ pass
20
27
21
28
# Whether the feature is included in 1.2 documentation
22
29
dml12 = False
23
30
31
+
24
32
# tag -> feature
25
33
features : dict [str , ProvisionalFeature ] = {}
26
34
@@ -34,7 +42,8 @@ def feature(cls: type[ProvisionalFeature]):
34
42
35
43
@feature
36
44
class explicit_param_decls (ProvisionalFeature ):
37
- '''<a id="explicit_param_decls"/>
45
+ """<a id="explicit_param_decls"/>
46
+
38
47
This feature extends the DML syntax for parameter definitions to
39
48
distinguish between an intent to declare a new parameter, and an intent to
40
49
override an existing parameter (including when providing a definition
@@ -80,14 +89,21 @@ class explicit_param_decls(ProvisionalFeature):
80
89
81
90
Enabling the `explicit_param_decls` feature in a file only affects
82
91
the parameter definitions specified in that file.
83
- '''
84
- short = "Require := syntax for defining new params"
85
- stable = True
92
+ """
93
+
94
+ @property
95
+ def short (self ) -> str :
96
+ return "Require := syntax for defining new params"
97
+
98
+ @property
99
+ def stable (self ) -> bool :
100
+ return True
86
101
87
102
88
103
@feature
89
104
class simics_util_vect (ProvisionalFeature ):
90
- '''<a id="simics_util_vect"/>
105
+ """<a id="simics_util_vect"/>
106
+
91
107
This feature enables the `vect` type, based on the
92
108
`VECT` macro from the Simics C API (`simics/util/vect.h`).
93
109
@@ -130,18 +146,28 @@ class simics_util_vect(ProvisionalFeature):
130
146
When the `simics_util_vect` feature is disabled, usage of `vect` is an
131
147
error unless the [`experimental_vect` compatibility
132
148
feature](deprecations-auto.html#experimental_vect) is enabled.
133
- '''
134
- short = "Allow vect syntax based on the VECT macro"
135
- stable = True
149
+ """
150
+
151
+ @property
152
+ def short (self ) -> str :
153
+ return "Allow vect syntax based on the VECT macro"
154
+
155
+ @property
156
+ def stable (self ) -> bool :
157
+ return True
158
+
136
159
dml12 = True
137
160
161
+
138
162
def parse_provisional (
139
- provs : list [("Site" , str )]) -> dict [ProvisionalFeature , "Site" ]:
163
+ provs : list [tuple [logging .Site , str ]],
164
+ ) -> dict [ProvisionalFeature , logging .Site ]:
140
165
ret = {}
141
- for ( site , name ) in provs :
166
+ for site , name in provs :
142
167
if name in features :
143
168
ret [features [name ]] = site
144
169
else :
145
- logging .report (messages .ENOPROV (
146
- site , name , ', ' .join (sorted (features ))))
170
+ logging .report (
171
+ messages .ENOPROV (site , name , ", " .join (sorted (features )))
172
+ )
147
173
return ret
0 commit comments