-
Notifications
You must be signed in to change notification settings - Fork 70
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
Future type annotations #165
Conversation
Hi @janosh, thanks for this PR but it seems like it has broken the tests? |
@utf Sorry, had forgotten about this. Looks like the failure arose from the distinction between annotations PEP 526 and type hints PEP 484. Class variables in atomate2/src/atomate2/vasp/schemas/defect.py Lines 27 to 38 in 2f4f5fa
are the former, i.e. annotations, not type hints. I'm surprised they don't appear to support future annotations below 3.10. Maybe I'm missing sth. |
Ah, maybe it's actually an issue with Would explain why I've never seen such errors before. 😄 |
Still seems like there are issues? Should I close this for now? |
@utf Hang on, I think this is easy to fix. The exact cause of the problem is well described here: pydantic/pydantic#3300 (comment). The advice there is to update to 3.10 which is not an option here so instead I'll just revert to old type hints within children of |
config files supported since autoflake v1.5
def _evaluate(self, globalns, localns): if not self.__forward_evaluated__ or localns is not globalns: if globalns is None and localns is None: globalns = localns = {} elif globalns is None: globalns = localns elif localns is None: localns = globalns self.__forward_value__ = _type_check( > eval(self.__forward_code__, globalns, localns), "Forward references must evaluate to types.", is_argument=self.__forward_is_argument__) E TypeError: 'type' object is not subscriptable
src/atomate2/vasp/schemas/{task,calculation}.py src/atomate2/common/schemas/{molecule,elastic}.py among others
Codecov Report
@@ Coverage Diff @@
## main #165 +/- ##
=======================================
Coverage 75.04% 75.04%
=======================================
Files 52 52
Lines 4685 4685
Branches 737 737
=======================================
Hits 3516 3516
Misses 983 983
Partials 186 186
|
Thanks! Would you also mind removing the new type hints in src/atomate2/amset/schemas.py and then I can merge |
@utf Sure thing. |
Great. Thank you! |
Future annotations are backwards compatible to py3.7 which is EOL Jun 2023.