You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently use the Union export from the typing module to define type annotations where more than one type is acceptable. This works, but for more complicated type annotations, using Union makes the code more difficult to read and understand relative to |.
As of python 3.10, the | operator works as Union would but with a simpler syntax. This can improve code readability significantly in some scenarios.
Description
Because the minimum version of python that polaris-lib supports is 3.10, we should embrace the use of the pipe operator rather than the Union type hint.
Acceptance Criteria
Redefine all types where Union is used to leverage the | operator instead
Ensure all types do not change after the replacement and resolve to the same type annotation
The text was updated successfully, but these errors were encountered:
Context
We currently use the
Union
export from thetyping
module to define type annotations where more than one type is acceptable. This works, but for more complicated type annotations, usingUnion
makes the code more difficult to read and understand relative to|
.As of python 3.10, the
|
operator works asUnion
would but with a simpler syntax. This can improve code readability significantly in some scenarios.Description
Because the minimum version of python that
polaris-lib
supports is3.10
, we should embrace the use of the pipe operator rather than theUnion
type hint.Acceptance Criteria
Union
is used to leverage the|
operator insteadThe text was updated successfully, but these errors were encountered: