-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix pre-commit errors (#192) #193
base: master
Are you sure you want to change the base?
Conversation
Hi @tovrstra, I made the PR to include all the errors from running
@msricher commented that we don't use any annotation in Gbasis (I think IOData and Grid does) and then the one we are more unsure about it is the |
Ruff has recommendations for every error message it can generate and these are usually quite informative: https://docs.astral.sh/ruff/rules/ I'll try to give some advice for each type of problem;
class POINT(Structure):
_fields_ = ("x", c_int), ("y", c_int) I'm not sure if that will solve the Ruff message, but it is a useful change anyway. There is no reason to have a mutable
cfunc = self._cache.get(attr)
if cfunc is None:
cfunc = self._get_cfunc(attr)
self._cache[attr] = cfunc
return cfunc Inside the helper method
|
P.S. If you prefer to stick to EAPF, which is certainly fine, then you can fix raise ValueError(f"there is no ``gbasis`` API for the function {attr}") from None` The more elaborate option would be: try:
cfunc = self._cache[attr]
except KeyError as exc:
...
else:
raise ValueError(f"there is no ``gbasis`` API for the function {attr}") from exc The second form seems less suited here because the KeyError is related to the caching and will not offer useful information. |
This PR addresses the request posted on issue #192 and includes the missing parts of PR #151 that were not included in #137. This also relates to PR #187.
Checklist
Add tests for each unit of code added (e.g. function, class)Update documentationSquash commits that can be grouped togetherType of Changes
Related