Skip to content

Commit 52e45d1

Browse files
authored
docs: consistent markup for "true" and "false" (#254)
Fixes #252 Use either back-ticked True or lower-case true in docs.
1 parent b13b1ba commit 52e45d1

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

docs/how-to/migrate-from-pytest-operator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ def test_active(juju: jubilant.Juju, app: str):
210210

211211
However, instead of calling `status` directly, it's usually better to wait for a certain condition to be true. In python-libjuju you used `model.wait_for_idle`; in Jubilant you use [`juju.wait`](jubilant.Juju.wait), which has a simpler and more consistent API.
212212

213-
The `wait` method takes a *ready* callable, which takes a [`Status`](jubilant.Status) object. Internally, `wait` polls `juju status` every second and calls the *ready* callable, which must return True three times in a row (this is configurable).
213+
The `wait` method takes a *ready* callable, which takes a [`Status`](jubilant.Status) object. Internally, `wait` polls `juju status` every second and calls the *ready* callable, which must return `True` three times in a row (this is configurable).
214214

215-
You can optionally provide an *error* callable, which also takes a `Status` object. If the *error* callable returns True, `wait` raises a [`WaitError`](jubilant.WaitError) immediately.
215+
You can optionally provide an *error* callable, which also takes a `Status` object. If the *error* callable returns `True`, `wait` raises a [`WaitError`](jubilant.WaitError) immediately.
216216

217217
Jubilant provides helper functions to use for the *ready* and *error* callables, such as [`jubilant.all_active`](jubilant.all_active) and [`jubilant.any_error`](jubilant.any_error). These check whether the workload status of all (or any) applications and their units are in a given state.
218218

jubilant/_all_any.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def all_active(status: Status, *apps: str) -> bool:
1919
Args:
2020
status: The status object being tested.
2121
apps: If provided, only these applications (and their units) are tested. If an app is not
22-
present in ``status.apps``, returns False.
22+
present in ``status.apps``, returns ``False``.
2323
"""
2424
return _all_statuses_are('active', status, apps)
2525

@@ -32,7 +32,7 @@ def all_blocked(status: Status, *apps: str) -> bool:
3232
Args:
3333
status: The status object being tested.
3434
apps: If provided, only these applications (and their units) are tested. If an app is not
35-
present in ``status.apps``, returns False.
35+
present in ``status.apps``, returns ``False``.
3636
"""
3737
return _all_statuses_are('blocked', status, apps)
3838

@@ -45,7 +45,7 @@ def all_error(status: Status, *apps: str) -> bool:
4545
Args:
4646
status: The status object being tested.
4747
apps: If provided, only these applications (and their units) are tested. If an app is not
48-
present in ``status.apps``, returns False.
48+
present in ``status.apps``, returns ``False``.
4949
"""
5050
return _all_statuses_are('error', status, apps)
5151

@@ -58,7 +58,7 @@ def all_maintenance(status: Status, *apps: str) -> bool:
5858
Args:
5959
status: The status object being tested.
6060
apps: If provided, only these applications (and their units) are tested. If an app is not
61-
present in ``status.apps``, returns False.
61+
present in ``status.apps``, returns ``False``.
6262
"""
6363
return _all_statuses_are('maintenance', status, apps)
6464

@@ -71,7 +71,7 @@ def all_waiting(status: Status, *apps: str) -> bool:
7171
Args:
7272
status: The status object being tested.
7373
apps: If provided, only these applications (and their units) are tested. If an app is not
74-
present in ``status.apps``, returns False.
74+
present in ``status.apps``, returns ``False``.
7575
"""
7676
return _all_statuses_are('waiting', status, apps)
7777

@@ -162,7 +162,7 @@ def all_agents_idle(status: Status, *apps: str) -> bool:
162162
Args:
163163
status: The status object being tested.
164164
apps: If provided, only the unit agents of units from these applications are tested.
165-
If an app is not present in ``status.apps``, returns False.
165+
If an app is not present in ``status.apps``, returns ``False``.
166166
"""
167167
return _all_agent_statuses_are('idle', status, apps)
168168

jubilant/_juju.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __str__(self) -> str:
3838

3939

4040
class WaitError(Exception):
41-
"""Raised when :meth:`Juju.wait`'s *error* callable returns True."""
41+
"""Raised when :meth:`Juju.wait`'s *error* callable returns ``True``."""
4242

4343

4444
ConfigValue = Union[bool, int, float, str, SecretURI]
@@ -142,14 +142,14 @@ def add_credential(
142142
cloud: Name of the cloud to add credentials for.
143143
credential: Path to a YAML file containing credential to add, or a mapping
144144
representing the parsed credential YAML (``{'credentials': ...}``).
145-
client: Set to True to save credentials on the client, meaning controllers
145+
client: Set to true to save credentials on the client, meaning controllers
146146
created later will have access to them. You must specify ``client=True``
147147
or provide *controller* (or both).
148148
controller: If specified, save credentials to the named controller.
149149
region: Cloud region that the credential is valid for.
150150
"""
151151
if not client and controller is None:
152-
raise TypeError('"client" must be True or "controller" must be specified (or both)')
152+
raise TypeError('"client" must be true or "controller" must be specified (or both)')
153153

154154
args = ['add-credential', cloud]
155155

@@ -330,7 +330,7 @@ def bootstrap(
330330
workload machines in the model, exactly as if the constraints were set with
331331
``juju set-model-constraints``.
332332
credential: Name of cloud credential to use when bootstrapping.
333-
force: If True, allow bypassing of checks such as supported bases.
333+
force: If true, allow bypassing of checks such as supported bases.
334334
model_defaults: Configuration options to set for all models.
335335
storage_pool: Options for an initial storage pool as key-value pairs. ``name``
336336
and ``type`` are required, plus any additional attributes.
@@ -438,7 +438,7 @@ def config(
438438
Args:
439439
app: Application name to get or set config for.
440440
values: Mapping of config names to values to set.
441-
app_config: When getting config, set this to True to get the
441+
app_config: When getting config, set this to true to get the
442442
(poorly-named) "application-config" values instead of charm config.
443443
reset: Key or list of keys to reset to their defaults.
444444
"""
@@ -637,11 +637,11 @@ def destroy_model(
637637
638638
Args:
639639
model: Name of model to destroy.
640-
destroy_storage: If True, destroy all storage instances in the model.
641-
force: If True, force model destruction and ignore any errors.
642-
no_wait: If True, rush through model destruction without waiting for each step
640+
destroy_storage: If true, destroy all storage instances in the model.
641+
force: If true, force model destruction and ignore any errors.
642+
no_wait: If true, rush through model destruction without waiting for each step
643643
to complete.
644-
release_storage: If True, release all storage instances in the model.
644+
release_storage: If true, release all storage instances in the model.
645645
This is mutually exclusive with *destroy_storage*.
646646
timeout: Maximum time (in seconds) to wait for each step in the model destruction.
647647
This option can only be used with *force*.
@@ -949,7 +949,7 @@ def remove_application(
949949
950950
Args:
951951
app: Name of the application or applications to remove.
952-
destroy_storage: If True, also destroy storage attached to application units.
952+
destroy_storage: If true, also destroy storage attached to application units.
953953
force: Force removal even if an application is in an error state.
954954
"""
955955
args = ['remove-application', '--no-prompt', *app]
@@ -1027,7 +1027,7 @@ def remove_unit(
10271027
On Kubernetes models, this is actually the application name (a single string),
10281028
as individual units are not named; you must use *num_units* to remove more than
10291029
one unit on a Kubernetes model.
1030-
destroy_storage: If True, also destroy storage attached to units.
1030+
destroy_storage: If true, also destroy storage attached to units.
10311031
force: Force removal even if a unit is in an error state.
10321032
num_units: Number of units to remove (Kubernetes models only).
10331033
"""
@@ -1138,7 +1138,7 @@ def scp(
11381138
source: Source of file, in format ``[[<user>@]<target>:]<path>``.
11391139
destination: Destination for file, in format ``[<user>@]<target>[:<path>]``.
11401140
container: Name of container for Kubernetes charms. Defaults to the charm container.
1141-
host_key_checks: Set to False to disable host key checking (insecure).
1141+
host_key_checks: Set to false to disable host key checking (insecure).
11421142
scp_options: ``scp`` client options, for example ``['-r', '-C']``.
11431143
"""
11441144
# Need this check because str is also an iterable of str.
@@ -1297,7 +1297,7 @@ def ssh(
12971297
``juju.ssh('mysql/0', 'echo foo', ...)``.
12981298
args: Arguments of the command.
12991299
container: Name of container for Kubernetes charms. Defaults to the charm container.
1300-
host_key_checks: Set to False to disable host key checking (insecure).
1300+
host_key_checks: Set to false to disable host key checking (insecure).
13011301
ssh_options: OpenSSH client options, for example ``['-i', '/path/to/private.key']``.
13021302
user: User account to make connection with. Defaults to ``ubuntu`` account.
13031303
"""
@@ -1333,7 +1333,7 @@ def trust(
13331333
13341334
Args:
13351335
app: Application name to set trust status for.
1336-
remove: Set to True to remove trust status.
1336+
remove: Set to true to remove trust status.
13371337
scope: On Kubernetes models, this must be set to "cluster", as the trust operation
13381338
grants the charm full access to the cluster.
13391339
"""
@@ -1393,10 +1393,10 @@ def wait(
13931393
timeout: float | None = None,
13941394
successes: int = 3,
13951395
) -> Status:
1396-
"""Wait until ``ready(status)`` returns true.
1396+
"""Wait until ``ready(status)`` returns ``True``.
13971397
13981398
This fetches the Juju status repeatedly (waiting *delay* seconds between each call),
1399-
and returns the last status after the *ready* callable returns true for *successes*
1399+
and returns the last status after the *ready* callable returns ``True`` for *successes*
14001400
times in a row.
14011401
14021402
Example::
@@ -1422,21 +1422,21 @@ def wait(
14221422
logging.getLogger('jubilant.wait').setLevel('WARNING')
14231423
14241424
Args:
1425-
ready: Callable that takes a :class:`Status` object and returns true when the wait
1426-
should be considered ready. It needs to return true *successes* times in a row
1425+
ready: Callable that takes a :class:`Status` object and returns ``True`` when the wait
1426+
should be considered ready. It needs to return ``True`` *successes* times in a row
14271427
before ``wait`` returns.
1428-
error: Callable that takes a :class:`Status` object and returns true when ``wait``
1428+
error: Callable that takes a :class:`Status` object and returns ``True`` when ``wait``
14291429
should raise an error (:class:`WaitError`).
14301430
delay: Delay in seconds between status calls.
14311431
timeout: Overall timeout in seconds; :class:`TimeoutError` is raised if this
14321432
is reached. If not specified, uses the *wait_timeout* specified when the
14331433
instance was created.
1434-
successes: Number of times *ready* must return true for the wait to succeed.
1434+
successes: Number of times *ready* must return ``True`` for the wait to succeed.
14351435
14361436
Raises:
14371437
TimeoutError: If the *timeout* is reached. A string representation
14381438
of the last status, if any, is added as an exception note.
1439-
WaitError: If the *error* callable returns True. A string representation
1439+
WaitError: If the *error* callable returns ``True``. A string representation
14401440
of the last status is added as an exception note.
14411441
"""
14421442
if timeout is None:

0 commit comments

Comments
 (0)