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

utils.serialize: modify_yaml contextmanager to reduce boilerplate #4426

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented Aug 19, 2020

Reduce boilerplate of create + load + dump during serialization/deserialization

with modify_yaml(config_path, tree=repo.tree) as config:
    config["repos"] = config.get("repos", [])
    config["repos"].append(entry)

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

On top of #4425, see #4415 (comment)

@skshetry skshetry self-assigned this Aug 19, 2020
@skshetry skshetry changed the title contextmanager to reduce boilerplate code for create+load+dump for serialization utils utils.serialize: modify_yaml contextmanager to reduce boilerplate Aug 20, 2020
@skshetry skshetry force-pushed the modify-serialize-ctxmgr branch 2 times, most recently from 9813ec3 to ddb95cf Compare August 20, 2020 05:00
@skshetry skshetry force-pushed the modify-serialize-ctxmgr branch from ddb95cf to 42e86ac Compare August 20, 2020 17:41
@skshetry skshetry marked this pull request as ready for review August 20, 2020 17:41
@skshetry skshetry requested review from pmrowla, efiop and pared August 20, 2020 17:41
Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅

@efiop efiop merged commit 1d196b4 into iterative:master Aug 21, 2020
@skshetry skshetry deleted the modify-serialize-ctxmgr branch August 21, 2020 02:03
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.

2 participants