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

feat: add to_dict method to domain classes #270

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jooola
Copy link
Member

@jooola jooola commented Aug 3, 2023

This allows us to serialize the domain classes by first converting them to "dumb types". For example, to convert the objects to JSON.

import json

domain = BaseDomain.from_dict(domain_dict)
json.dumps(domain.to_dict())

@jooola jooola force-pushed the to_dict branch 2 times, most recently from 033c20d to 6c8e129 Compare August 4, 2023 15:51
@jooola
Copy link
Member Author

jooola commented Aug 7, 2023

I first intended to use this to help with the hetzner.hcloud ansible collection inventory caching implementation. But I choose to use another method.

This might still be useful for the users of the library, to be able to export the entire domain object to a dict.

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.97%. Comparing base (8e66f30) to head (b4a08e7).
Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
hcloud/core/domain.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #270      +/-   ##
==========================================
+ Coverage   92.85%   92.97%   +0.12%     
==========================================
  Files          65       64       -1     
  Lines        2883     2891       +8     
==========================================
+ Hits         2677     2688      +11     
+ Misses        206      203       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented May 2, 2024

This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs.

@github-actions github-actions bot added the Stale label May 2, 2024
@jooola jooola removed Stale labels May 24, 2024
Copy link

This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs.

@github-actions github-actions bot added Stale and removed Stale labels Sep 30, 2024
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.

1 participant