Lunderberg commented on code in PR #10906:
URL: https://github.com/apache/tvm/pull/10906#discussion_r843136706
##########
tests/scripts/ci.py:
##########
@@ -434,6 +436,26 @@ def cli_name(s: str) -> str:
return s.replace("_", "-")
+def typing_get_origin(annotation):
+ if sys.version_info >= (3, 8):
+ return typing.get_origin(annotation)
+ else:
+ return annotation.__origin__
Review Comment:
Thank you! It looks like python3.9+ represent it as `typing.Optional`,
while earlier versions give `typing.Union`. After some quick testing, checking
for `__origin__` works on all versions. Unfortunately, I don't see any public
classes for checking if the annotation is any `typing.*` class, as the
`typing._Final` class is private.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]