File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22from collections import deque
3- from typing import Union , NamedTuple
3+ from typing import Union , NamedTuple , TypeVar
44
55import attr
66import funcy as fn
99from mtl import sugar
1010
1111
12+ Node = TypeVar ("Node" )
13+
14+
1215def flatten_binary (phi , op , dropT , shortT ):
1316 def f (x ):
1417 return x .args if isinstance (x , op ) else [x ]
@@ -173,7 +176,7 @@ def __repr__(self):
173176@ast_class
174177class NaryOpMTL :
175178 OP = "?"
176- args : " Node" # TODO: when 3.7 is more common replace with type union.
179+ args : Node # TODO: when 3.7 is more common replace with type union.
177180
178181 def __repr__ (self ):
179182 return "(" + f" { self .OP } " .join (f"{ x } " for x in self .args ) + ")"
@@ -191,7 +194,7 @@ class And(NaryOpMTL):
191194class ModalOp :
192195 OP = '?'
193196 interval : Interval
194- arg : " Node"
197+ arg : Node
195198
196199 def __repr__ (self ):
197200 if self .interval .lower == 0 and self .interval .upper == float ('inf' ):
@@ -209,8 +212,8 @@ class G(ModalOp):
209212
210213@ast_class
211214class WeakUntil :
212- arg1 : " Node"
213- arg2 : " Node"
215+ arg1 : Node
216+ arg2 : Node
214217
215218 def __repr__ (self ):
216219 return f"({ self .arg1 } W { self .arg2 } )"
@@ -222,7 +225,7 @@ def children(self):
222225
223226@ast_class
224227class Neg :
225- arg : " Node"
228+ arg : Node
226229
227230 def __repr__ (self ):
228231 return f"~{ self .arg } "
@@ -234,7 +237,7 @@ def children(self):
234237
235238@ast_class
236239class Next :
237- arg : " Node"
240+ arg : Node
238241
239242 def __repr__ (self ):
240243 return f"X{ self .arg } "
You can’t perform that action at this time.
0 commit comments