Skip to content

Commit

Permalink
SCALRCORE-30060 Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
petroprotsakh committed Jul 1, 2024
1 parent d72eb3e commit d549c4f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pygohcl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def attributes_loadb(data: bytes) -> tp.Dict:
Example:
>>> hcl = '''
>>> key1 = "value"
>>> key2 = false
>>> key3 = [1, 2, 3]
>>> '''
... key1 = "value"
... key2 = false
... key3 = [1, 2, 3]
... '''
>>> import pygohcl
>>> print(pygohcl.attributes_loads(hcl))
{'key1': 'value', 'key2': False, 'key3': [1, 2, 3]}
Expand Down Expand Up @@ -108,6 +108,16 @@ def eval_var_condition(
For that reason a separate `UnknownFunctionError` is raised then,
so the consumer can decide how to treat this case.
Example:
>>> import pygohcl
>>> pygohcl.eval_var_condition(
... condition="var.count < 3",
... error_message="count must be less than 3, but ${var.count} was given",
... variable_name="count",
... variable_value="5",
... )
pygohcl.ValidationError: count must be less than 3, but 5 was given
:raises ValidationError: when the condition expression has not evaluated to `True`
:raises UnknownFunctionError: when the condition expression refers to a function
that is not known to the library
Expand Down

0 comments on commit d549c4f

Please sign in to comment.