55
66from collections .abc import Sequence
77from copy import copy
8- from typing import Optional , Union , overload
8+ from typing import overload
99
1010from pytensor .compile .function .types import Function , UnusedInputError , orig_function
1111from pytensor .compile .io import In , Out
@@ -105,7 +105,7 @@ def rebuild_collect_shared(
105105
106106
107107def rebuild_collect_shared (
108- outputs : Union [ Sequence [Variable ], Variable , Out , Sequence [Out ] ],
108+ outputs : Sequence [Variable ] | Variable | Out | Sequence [Out ],
109109 inputs = None ,
110110 replace = None ,
111111 updates = None ,
@@ -115,7 +115,7 @@ def rebuild_collect_shared(
115115 clone_inner_graphs = False ,
116116) -> tuple [
117117 list [Variable ],
118- Union [ list [Variable ], Variable , Out , list [Out ] ],
118+ list [Variable ] | Variable | Out | list [Out ],
119119 tuple [
120120 dict [Variable , Variable ],
121121 dict [SharedVariable , Variable ],
@@ -376,7 +376,7 @@ def pfunc(
376376 profile = None ,
377377 on_unused_input = None ,
378378 output_keys = None ,
379- fgraph : Optional [ FunctionGraph ] = None ,
379+ fgraph : FunctionGraph | None = None ,
380380) -> Function :
381381 """
382382 Function-constructor for graphs with shared variables.
@@ -484,7 +484,7 @@ def construct_pfunc_ins_and_outs(
484484 no_default_updates = False ,
485485 rebuild_strict = True ,
486486 allow_input_downcast = None ,
487- fgraph : Optional [ FunctionGraph ] = None ,
487+ fgraph : FunctionGraph | None = None ,
488488):
489489 """Construct inputs and outputs for `pfunc`.
490490
0 commit comments