@@ -58,10 +58,10 @@ def always_rebuild(self, o, *args, **kwargs):
5858 return o ._rebuild (* new_ops , ** okwargs )
5959
6060
61- TResult = TypeVar ('TResult ' )
61+ ResultType = TypeVar ('ResultType ' )
6262
6363
64- class LazyVisitor (GenericVisitor , Generic [TResult ]):
64+ class LazyVisitor (GenericVisitor , Generic [ResultType ]):
6565
6666 """
6767 A generic visitor that lazily yields results instead of flattening results
@@ -82,7 +82,7 @@ def _visit(self, o, *args, **kwargs) -> Iterator[Any]:
8282 meth = self .lookup_method (o )
8383 yield from meth (o , * args , ** kwargs )
8484
85- def _post_visit (self , ret : Iterator [Any ]) -> TResult :
85+ def _post_visit (self , ret : Iterator [Any ]) -> ResultType :
8686 """Postprocess the visitor output before returning it to the caller."""
8787 return list (ret )
8888
@@ -1072,7 +1072,7 @@ def __init__(self, mode: str = 'symbolics') -> None:
10721072 self .rule = lambda n : chain (self .rules [mode ](n ) for mode in modes )
10731073
10741074 def _post_visit (self , ret ):
1075- return sorted (filter_ordered (ret , key = id ), key = str )
1075+ return sorted (filter_ordered (ret ), key = str )
10761076
10771077 def visit_Node (self , o : Node ) -> Iterator [Any ]:
10781078 yield from self ._visit (o .children )
@@ -1126,36 +1126,36 @@ def visit_Node(self, o: Node) -> Iterator[Any]:
11261126 yield from self ._visit (i )
11271127
11281128
1129- TApp = TypeVar ('TApp ' )
1129+ ApplicationType = TypeVar ('ApplicationType ' )
11301130
11311131
1132- class FindApplications (LazyVisitor [set [TApp ]]):
1132+ class FindApplications (LazyVisitor [set [ApplicationType ]]):
11331133
11341134 """
11351135 Find all SymPy applied functions (aka, `Application`s). The user may refine
11361136 the search by supplying a different target class.
11371137 """
11381138
1139- def __init__ (self , cls : type [TApp ] = Application ):
1139+ def __init__ (self , cls : type [ApplicationType ] = Application ):
11401140 super ().__init__ ()
11411141 self .match = lambda i : isinstance (i , cls ) and not isinstance (i , Basic )
11421142
11431143 def _post_visit (self , ret ):
11441144 return set (ret )
11451145
1146- def visit_Node (self , o : Node ) -> Iterator [TApp ]:
1146+ def visit_Node (self , o : Node ) -> Iterator [ApplicationType ]:
11471147 for i in o .children :
11481148 yield from self ._visit (i )
11491149
1150- def visit_Expression (self , o : Expression , ** kwargs ) -> Iterator [TApp ]:
1150+ def visit_Expression (self , o : Expression , ** kwargs ) -> Iterator [ApplicationType ]:
11511151 yield from o .expr .find (self .match )
11521152
1153- def visit_Iteration (self , o : Iteration , ** kwargs ) -> Iterator [TApp ]:
1153+ def visit_Iteration (self , o : Iteration , ** kwargs ) -> Iterator [ApplicationType ]:
11541154 yield from self ._visit (o .children )
11551155 yield from o .symbolic_min .find (self .match )
11561156 yield from o .symbolic_max .find (self .match )
11571157
1158- def visit_Call (self , o : Call , ** kwargs ) -> Iterator [TApp ]:
1158+ def visit_Call (self , o : Call , ** kwargs ) -> Iterator [ApplicationType ]:
11591159 for i in o .arguments :
11601160 try :
11611161 yield from i .find (self .match )
0 commit comments