File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717import dataclasses
1818import logging
19- from typing import Sequence
19+ from typing import Literal , Sequence , final
2020
2121__all__ = [
2222 "PassBase" ,
@@ -180,23 +180,31 @@ class InPlacePass(PassBase):
180180 """A pass that modifies the input model in place and returns it."""
181181
182182 @property
183- def in_place (self ) -> bool :
183+ @final
184+ def in_place (self ) -> Literal [True ]:
185+ """An in-place pass is in place."""
184186 return True
185187
186188 @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."""
188192 return True
189193
190194
191195class FunctionalPass (PassBase ):
192196 """A pass that returns a new model but does not modify the input model."""
193197
194198 @property
195- def in_place (self ) -> bool :
199+ @final
200+ def in_place (self ) -> Literal [False ]:
201+ """A functional pass is not in place."""
196202 return False
197203
198204 @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."""
200208 return False
201209
202210
You can’t perform that action at this time.
0 commit comments