Skip to content
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

Refactor ogmios.py module maintainability #114

Merged
merged 8 commits into from Nov 3, 2022

Conversation

daehan-koreapool
Copy link
Contributor

Background

In my opinion, pycardano.backend.base.GenesisParameters and pycardano.backend.base.ProtocolParameters should be frozen dataclasses with no optional attributes.
I tested refactoring these dataclasses to require all field values, but it touches many of ogmios.py module.

Goal

  • Refactor ogmios.py as much as possible before GenesisParameters and ProtocolParameters become frozen dataclasses with full data requirements

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2022

Codecov Report

Merging #114 (bae4341) into main (c5430c0) will decrease coverage by 0.00%.
The diff coverage is 70.31%.

@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
- Coverage   86.36%   86.36%   -0.01%     
==========================================
  Files          24       24              
  Lines        2633     2647      +14     
  Branches      515      514       -1     
==========================================
+ Hits         2274     2286      +12     
- Misses        265      267       +2     
  Partials       94       94              
Impacted Files Coverage Δ
pycardano/backend/ogmios.py 58.94% <66.07%> (+2.12%) ⬆️
pycardano/address.py 77.65% <100.00%> (ø)
pycardano/hash.py 96.15% <100.00%> (ø)
pycardano/metadata.py 97.26% <100.00%> (ø)
pycardano/nativescript.py 96.38% <100.00%> (ø)
pycardano/plutus.py 91.37% <100.00%> (ø)
pycardano/transaction.py 94.23% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

REFACTOR. re-order methods so that helper functions are right beneath the main function for readability
…dependently testable

REFACTOR. renaming chain tip status checking helper method
@daehan-koreapool daehan-koreapool marked this pull request as ready for review November 1, 2022 08:15
@daehan-koreapool
Copy link
Contributor Author

daehan-koreapool commented Nov 1, 2022

Major Updates

  • localizing Ogmosis query methods for reusability and for better maintainability
  • adding more explicit return types for each Ogmosis query methods
  • reordering methods so that helper methods are right beneath the caller method for easier top-to-bottom reading experience
  • pulling out ProtocolParameter and GenesisParameter fetching logics so that it would be easier to update these dataclasses as non-optional + frozen dataclass in the next merge request

Minor Updates

  • Add black formatter check in the static analyses step

Makefile Show resolved Hide resolved
@cffls cffls merged commit a2c3a8e into Python-Cardano:main Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants