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

Remove restriction on DotDict critical keys #1462

Merged
merged 7 commits into from
Sep 7, 2019
Merged

Remove restriction on DotDict critical keys #1462

merged 7 commits into from
Sep 7, 2019

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Sep 7, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

Previously, DotDicts were restricted from setting "critical" keys (such as update, items, etc.) because they would shadow dict methods. The only difference between a GraphQLResult and a DotDict was that this restriction was lifted and a different repr.

However, in practice, this restriction is annoying and/or confusing.

This PR removes the restriction. The motivation for this PR was actually the discovery of a bug that as_nested_dict failed if a GraphQLResult had an items key. This PR fixes the bug but in fixing it, I realized the restriction was obviously unhelpful since this bug slipped by anyway.

Why is this PR important?

@codecov
Copy link

codecov bot commented Sep 7, 2019

Codecov Report

Merging #1462 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@jlowin jlowin added the enhancement An improvement of an existing feature label Sep 7, 2019
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Very clean implementation that avoids the special keys, I like it - two minor suggestions

src/prefect/utilities/collections.py Outdated Show resolved Hide resolved
tests/utilities/test_collections.py Show resolved Hide resolved
@jlowin jlowin merged commit 9701a91 into master Sep 7, 2019
@jlowin jlowin deleted the protect-dotdict branch September 7, 2019 19:42
zanieb pushed a commit that referenced this pull request Apr 13, 2022
Update link to running-parallel-tasks-with-dask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants