Skip to content

Correctly parse List[X] annotated objects #170

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

Merged
merged 7 commits into from
Mar 19, 2023

Conversation

nielstron
Copy link
Contributor

Imperatorlang allows users to specify PlutusData like this

@dataclass()
class D(PlutusData):
  xs: List[A]  # where A is also PlutusData

This was previously not correctly parsed by Pycardano. I suggest the List notation is also added to the main Pycardano, as it otherwise lacks the ability to build complex objects.

@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2023

Codecov Report

Merging #170 (c4f801a) into main (985a2b6) will decrease coverage by 0.34%.
The diff coverage is 42.85%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #170      +/-   ##
==========================================
- Coverage   85.78%   85.45%   -0.34%     
==========================================
  Files          26       26              
  Lines        2814     2832      +18     
  Branches      672      679       +7     
==========================================
+ Hits         2414     2420       +6     
- Misses        296      302       +6     
- Partials      104      110       +6     
Impacted Files Coverage Δ
pycardano/serialization.py 84.73% <40.00%> (-1.78%) ⬇️
pycardano/plutus.py 87.16% <45.45%> (-2.29%) ⬇️

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

@nielstron nielstron force-pushed the feat/list_plutusdata branch from c489984 to 3894d49 Compare March 4, 2023 14:36
@cffls
Copy link
Collaborator

cffls commented Mar 5, 2023

Thanks! The change makes sense. Could you add a test for it? LGTM otherwise.

@nielstron
Copy link
Contributor Author

nielstron commented Mar 14, 2023

Future todos (for another PR)

@nielstron nielstron changed the title Correctly parse List[X] annotated objects from dictionaries Correctly parse List[X] annotated objects Mar 14, 2023
@nielstron
Copy link
Contributor Author

@cffls Please review

@nielstron nielstron force-pushed the feat/list_plutusdata branch from d883ae8 to e375088 Compare March 15, 2023 16:54
@nielstron
Copy link
Contributor Author

Again, coverage submission failed :/

@cffls cffls merged commit cdb7bd3 into Python-Cardano:main Mar 19, 2023
@cffls cffls added the bug fix Fixes a bug label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants