Skip to content

Update type annotations to use pipe | for union types #18

@ryanhill1

Description

@ryanhill1

Since this project is restricted to Python 3.10 and above, we can take advantage of the newer, preferred syntax for combined types using the pipe (|) operator in type annotations. This syntax is more concise and replaces the need for Union from the typing module.

For example:

from typing import Union

def validate(program: Union[openqasm3.ast.Program, str]) -> None:

can now be simplified to:

def validate(program: openqasm3.ast.Program | str) -> None:

We should apply this updated syntax to all instances where Union is used.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions