Refactor Tunneling class to use composition instead of inheritance#476
Refactor Tunneling class to use composition instead of inheritance#476
Conversation
Co-authored-by: K20shores <[email protected]>
Tunneling
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #476 +/- ##
==========================================
+ Coverage 83.63% 84.85% +1.22%
==========================================
Files 48 49 +1
Lines 4093 4815 +722
==========================================
+ Hits 3423 4086 +663
- Misses 670 729 +59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
musica/_version.py
Outdated
There was a problem hiding this comment.
Removed the accidentally added _version.py file. This file is auto-generated during the build process and shouldn't be committed to the repository. Fixed in commit fbff368.
| Returns: | ||
| Dict: A dictionary representation of the Tunneling object. | ||
| """ | ||
| serialize_dict = { |
There was a problem hiding this comment.
create a tmporary class and use that to call serialize so that the dictionary isn't duplicated
There was a problem hiding this comment.
Refactored serialize_static() to eliminate code duplication by creating a temporary Tunneling object and using its serialize() method. This removes the duplicated dictionary creation logic. Fixed in commit dbcacbc.
Co-authored-by: K20shores <[email protected]>
…ry class Co-authored-by: K20shores <[email protected]>
This PR refactors the
Tunnelingclass inmusica.mechanism_configurationto use composition instead of inheritance from_Tunneling, following the established pattern used in other reaction classes likeArrhenius.Changes Made
Core Refactoring
class Tunneling(_Tunneling):→class Tunneling:self._instance = _Tunneling()to store internal C++ instance@propertydecorators forname,A,B,C,reactants,products,gas_phase,other_properties, andtypeself._instancePython/C++ Object Conversion
Speciesobjects and C++_ReactionComponentobjectsPhaseobjects and string inputsSerialization Updates
serialize()from static method to instance methodserialize_static()method for C++_TunnelingobjectsTunnelingand C++_TunnelingobjectsExample Usage
Validation
The refactoring maintains full backward compatibility while providing a cleaner separation between Python and C++ concerns.
Fixes #454.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.