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

doc: Mnemonics for cdict and sdict #704

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions bundlewrap/items/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,9 @@ def run(self, command, **kwargs):
def cdict(self):
"""
Return a statedict that describes the target state of this item
as configured in the repo. Returning `None` instead means that
the item should not exist.
as configured in the repo (mnemonic: _c_dict for _config_
dict). Returning `None` instead means that the item should
not exist.

MAY be overridden by subclasses.
"""
Expand Down Expand Up @@ -885,8 +886,9 @@ def preview(self):
def sdict(self):
"""
Return a statedict that describes the actual state of this item
on the node. Returning `None` instead means that the item does
not exist on the node.
on the node (mnemonic: _s_dict for _state_ dict). Returning
`None` instead means that the item does not exist on the
node.

For the item to validate as correct, the values for all keys in
self.cdict() have to match this statedict.
Expand Down
10 changes: 6 additions & 4 deletions docs/content/guide/dev_item.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ Create a new file called `/your/bundlewrap/repo/items/foo.py`. You can use this
def cdict(self):
"""
Return a statedict that describes the target state of this item
as configured in the repo. Returning `None` instead means that
the item should not exist.
as configured in the repo (mnemonic: _c_dict for _config_
dict). Returning `None` instead means that the item should
not exist.

Implementing this method is optional. The default implementation
uses the attributes as defined in the bundle.
Expand All @@ -61,8 +62,9 @@ Create a new file called `/your/bundlewrap/repo/items/foo.py`. You can use this
def sdict(self):
"""
Return a statedict that describes the actual state of this item
on the node. Returning `None` instead means that the item does
not exist on the node.
on the node (mnemonic: _s_dict for _state_ dict). Returning
`None` instead means that the item does not exist on the
node.

For the item to validate as correct, the values for all keys in
self.cdict() have to match this statedict.
Expand Down