Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Python 3.9 syntax for type unions #125

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

jwnrt
Copy link

@jwnrt jwnrt commented Jan 28, 2025

The | syntax was added in 3.10 (I think).

With this change I was able to run cfggen.py and pyot.py with Python 3.9.

I didn't add a component to the commit messages, so CI will complain.

@rivos-eblot
Copy link

The | syntax was added in 3.10 (I think).
Yes (https://docs.python.org/3/library/typing.html#typing.Union)

Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jwnrt jwnrt merged commit 9f05351 into lowRISC:ot-earlgrey-9.1.0 Jan 28, 2025
6 of 7 checks passed
@@ -240,7 +240,7 @@ def otp_vendor_test_status(self) -> int:
return self._read_reg('otp_vendor_test_status')

@property
def lc_state(self) -> [str | int]:
def lc_state(self) -> Union[str, int]:
"""Report the current state."""
istate = self._read_reg('lc_state')
tix = self._check_state(istate)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR: am I misunderstanding or should this type not be Tuple[str, int]?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the original annotation was wrong. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants