refactor: centralize MissingAttributeError in cclib.exception#1748
Closed
sputnik-mac wants to merge 1 commit intocclib:masterfrom
Closed
refactor: centralize MissingAttributeError in cclib.exception#1748sputnik-mac wants to merge 1 commit intocclib:masterfrom
sputnik-mac wants to merge 1 commit intocclib:masterfrom
Conversation
…clib#1746) Define a single canonical MissingAttributeError under the top-level cclib namespace in cclib/exception.py. Remove the duplicate class definitions from: - cclib/bridge/cclib2pyscf.py - cclib/bridge/cclib2pyquante.py - cclib/io/filewriter.py - cclib/method/calculationmethod.py Update all imports across source files and tests to use the new canonical cclib.exception.MissingAttributeError. Also expose the exception in cclib.__init__ as part of the public API.
Member
|
While we develop a policy on AI-based contributions (#1749), I'm closing this as it is not in the intent of "good first issues" for them to be solved entirely by AI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1746
This PR removes the four duplicate
MissingAttributeErrorclass definitions and consolidates them into a single canonical exception undercclib.exception.Changes
New file:
cclib/exception.py— definesMissingAttributeError(Exception)onceRemoved duplicate definitions from:
cclib/bridge/cclib2pyscf.pycclib/bridge/cclib2pyquante.pycclib/io/filewriter.pycclib/method/calculationmethod.pyUpdated imports in source files:
cclib/io/wfxwriter.py— was usingfilewriter.MissingAttributeError, now imports directlycclib/method/population.pyUpdated imports in test files:
test/io/testwfxwriter.pytest/io/testmoldenwriter.pytest/method/testddec.pytest/method/testhirshfeld.pytest/method/testbader.pytest/method/testpopulation.pyPublic API:
MissingAttributeErroris now exported fromcclib.__init__, making it accessible ascclib.MissingAttributeErrorBackward compatibility
Existing code that imports
from cclib.io.filewriter import MissingAttributeErrororfrom cclib.method.calculationmethod import MissingAttributeErrorwill break. If backward compatibility is required, re-export aliases can be added to those modules. Happy to add that if the maintainers prefer.