|
54 | 54 | } |
55 | 55 | """The dictionary of operator precedence for the shunting yard algorithm.""" |
56 | 56 |
|
| 57 | + |
| 58 | +# The `FormulaEngine*` and `HigherOrderFormulaBuilder*` classes are generic, but |
| 59 | +# `TypeVar`s can't be defined on generic types, so we need to use `# type: ignore` to |
| 60 | +# avoid mypy errors, and they get treated as `FormulaEngine[Any]`, etc. |
| 61 | +# |
| 62 | +# This is not ideal, but it's the best we can do until mypy supports generic types with |
| 63 | +# `TypeVar`s. |
57 | 64 | _CompositionType = Union[ |
58 | | - "FormulaEngine", |
59 | | - "HigherOrderFormulaBuilder", |
60 | | - "FormulaEngine3Phase", |
61 | | - "HigherOrderFormulaBuilder3Phase", |
| 65 | + "FormulaEngine", # type: ignore[type-arg] |
| 66 | + "HigherOrderFormulaBuilder", # type: ignore[type-arg] |
| 67 | + "FormulaEngine3Phase", # type: ignore[type-arg] |
| 68 | + "HigherOrderFormulaBuilder3Phase", # type: ignore[type-arg] |
62 | 69 | ] |
63 | 70 |
|
64 | 71 | _CompositionType1Phase = Union[ |
65 | | - "FormulaEngine", |
66 | | - "HigherOrderFormulaBuilder", |
| 72 | + "FormulaEngine", # type: ignore[type-arg] |
| 73 | + "HigherOrderFormulaBuilder", # type: ignore[type-arg] |
67 | 74 | ] |
68 | 75 |
|
69 | 76 | _CompositionType3Phase = Union[ |
70 | | - "FormulaEngine3Phase", |
71 | | - "HigherOrderFormulaBuilder3Phase", |
| 77 | + "FormulaEngine3Phase", # type: ignore[type-arg] |
| 78 | + "HigherOrderFormulaBuilder3Phase", # type: ignore[type-arg] |
72 | 79 | ] |
73 | 80 |
|
74 | | -# The `FormulaEngine*` and `HigherOrderFormulaBuilder*` classes are generic, but |
75 | | -# `TypeVar`s can't be defined on generic types, so we need to use `# type: ignore` to |
76 | | -# avoid mypy errors, and they get treated as `FormulaEngine[Any]`, etc. |
77 | | -# |
78 | | -# This is not ideal, but it's the best we can do until mypy supports generic types with |
79 | | -# `TypeVar`s. |
80 | 81 | _GenericEngine = TypeVar( |
81 | 82 | "_GenericEngine", |
82 | 83 | "FormulaEngine", # type: ignore |
83 | 84 | "FormulaEngine3Phase", # type: ignore |
84 | 85 | ) |
| 86 | + |
85 | 87 | _GenericHigherOrderBuilder = TypeVar( |
86 | 88 | "_GenericHigherOrderBuilder", |
87 | 89 | "HigherOrderFormulaBuilder", # type: ignore |
|
0 commit comments