|
| 1 | +from __future__ import annotations |
| 2 | + |
1 | 3 | # |
2 | 4 | # Concatenation classes |
3 | 5 | # |
4 | 6 | from __future__ import annotations |
5 | 7 | import copy |
6 | 8 | from collections import defaultdict |
7 | | -from typing import Optional |
8 | 9 |
|
9 | 10 | import numpy as np |
10 | 11 | import numpy.typing as npt |
@@ -470,7 +471,7 @@ def _concatenation_new_copy(self, children, perform_simplifications=True): |
470 | 471 | class ConcatenationVariable(Concatenation): |
471 | 472 | """A Variable representing a concatenation of variables.""" |
472 | 473 |
|
473 | | - def __init__(self, *children, name: Optional[str] = None): |
| 474 | + def __init__(self, *children, name: str | None = None): |
474 | 475 | if name is None: |
475 | 476 | # Name is the intersection of the children names (should usually make sense |
476 | 477 | # if the children have been named consistently) |
@@ -526,7 +527,7 @@ def intersect(s1: str, s2: str): |
526 | 527 | return intersect.lstrip().rstrip() |
527 | 528 |
|
528 | 529 |
|
529 | | -def simplified_concatenation(*children, name: Optional[str] = None): |
| 530 | +def simplified_concatenation(*children, name: str | None = None): |
530 | 531 | """Perform simplifications on a concatenation.""" |
531 | 532 | # remove children that are None |
532 | 533 | children = list(filter(lambda x: x is not None, children)) |
@@ -556,7 +557,7 @@ def simplified_concatenation(*children, name: Optional[str] = None): |
556 | 557 | return concat |
557 | 558 |
|
558 | 559 |
|
559 | | -def concatenation(*children, name: Optional[str] = None): |
| 560 | +def concatenation(*children, name: str | None = None): |
560 | 561 | """Helper function to create concatenations.""" |
561 | 562 | # TODO: add option to turn off simplifications |
562 | 563 | return simplified_concatenation(*children, name=name) |
|
0 commit comments