This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
Resolve special stenzas lazily with no side-effects on the body #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolve the special stenzas in the body lazily, on demand, without actual creation.
Description
There was an issue that
spec
,status
,metadata
fields were implicitly added to the body due tobody.setdefault(..., {})
usage — even if such a stenzas didn't exist actually. From the users point of view, it appeared unexpectedly — i.e. an undesired side effect.This was needed to ensure that the
spec
,status
,metadata
kwargs are exactly the same in thebody
kwarg, and any change in either of them is reflected in another one.With this implementation, a dict-like object is introduced, which resolves these stenzas on-demand. In all other aspects, this object should behave like a normal dict.
In addition, this change is done as a preparation for the throughout type-hinting in the code base. Resolving the cyclic imports becomes important. The whole refactoring is split into few PRs (one per concept) for ease of review.
Types of Changes
Tasks
repr()
status
stenza at all).Review