File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import dataclasses
18
18
import logging
19
- from typing import Sequence
19
+ from typing import Literal , Sequence , final
20
20
21
21
__all__ = [
22
22
"PassBase" ,
@@ -180,23 +180,31 @@ class InPlacePass(PassBase):
180
180
"""A pass that modifies the input model in place and returns it."""
181
181
182
182
@property
183
- def in_place (self ) -> bool :
183
+ @final
184
+ def in_place (self ) -> Literal [True ]:
185
+ """An in-place pass is in place."""
184
186
return True
185
187
186
188
@property
187
- def changes_input (self ) -> bool :
189
+ @final
190
+ def changes_input (self ) -> Literal [True ]:
191
+ """An in-place pass changes the input model."""
188
192
return True
189
193
190
194
191
195
class FunctionalPass (PassBase ):
192
196
"""A pass that returns a new model but does not modify the input model."""
193
197
194
198
@property
195
- def in_place (self ) -> bool :
199
+ @final
200
+ def in_place (self ) -> Literal [False ]:
201
+ """A functional pass is not in place."""
196
202
return False
197
203
198
204
@property
199
- def changes_input (self ) -> bool :
205
+ @final
206
+ def changes_input (self ) -> Literal [False ]:
207
+ """A functional pass does not change the input model."""
200
208
return False
201
209
202
210
You can’t perform that action at this time.
0 commit comments