diff --git a/ops/charm.py b/ops/charm.py index 03973f563..f68e9c12d 100755 --- a/ops/charm.py +++ b/ops/charm.py @@ -1005,7 +1005,7 @@ class CharmBase(Object): :code:`CharmBase` is used to create a charm. This is done by inheriting from :code:`CharmBase` and customising the subclass as required. So to - create a charm, say ``MyCharm``, define a charm class and set up the + create a charm called ``MyCharm``, define a charm class and set up the required event handlers (“hooks”) in its constructor:: import logging diff --git a/ops/lib/__init__.py b/ops/lib/__init__.py index 3ca8c8768..f67fbd831 100644 --- a/ops/lib/__init__.py +++ b/ops/lib/__init__.py @@ -96,7 +96,7 @@ def use(name: str, api: int, author: str) -> ModuleType: def autoimport(): """Find all libs in the path and enable use of them. - Call this only when a package has been installed or sys.path has been + Call this function only when a package has been installed or sys.path has been otherwise changed in the current run, and the changes need to be seen. Otherwise libraries are found on first call of `use`. diff --git a/ops/model.py b/ops/model.py index b0025db5d..9b04ef7d1 100644 --- a/ops/model.py +++ b/ops/model.py @@ -486,13 +486,13 @@ def _invalidate(self): def status(self) -> 'StatusBase': """Used to report or read the status of a specific unit. - The status of any unit in a different charm is always Unknown. + The status of any unit other than the current unit is always Unknown. Alternatively, use the :attr:`collect_unit_status ` event to evaluate and set unit status consistently at the end of every hook. Raises: - RuntimeError: if setting the status of a unit in another charm. + RuntimeError: if setting the status of a unit other than the current unit InvalidStatusError: if setting the status to something other than a :class:`StatusBase` Example:: @@ -2177,7 +2177,7 @@ def push_path(self, * /foo/foobar.txt * /quux.txt - These are ways to push:: + These are various push examples:: # copy one file container.push_path('/foo/foobar.txt', '/dst') @@ -2258,7 +2258,7 @@ def pull_path(self, * /foo/foobar.txt * /quux.txt - These are ways to pull:: + These are various pull examples:: # copy one file container.pull_path('/foo/foobar.txt', '/dst') @@ -2649,7 +2649,7 @@ def __init__(self, relation_name: str, num_related: int, max_supported: int): class RelationDataError(ModelError): """Raised when a relation data read/write is invalid. - This is raised when either trying to set a value to something that isn't a string, + This is raised either when trying to set a value to something that isn't a string, or when trying to set a value in a bucket without the required access. (For example, another application/unit, or setting application data without being the leader.) """ @@ -2660,7 +2660,7 @@ class RelationDataTypeError(RelationDataError): class RelationDataAccessError(RelationDataError): - """Raised by ``Relation.data[entity][key] = value`` if sufficient access is not available. + """Raised by ``Relation.data[entity][key] = value`` if unable to access. This typically means that permission to write read/write the databag is missing, but in some cases it is raised when attempting to read/write from a deceased remote entity. diff --git a/ops/testing.py b/ops/testing.py index 7f35a05f2..8b6ebb8db 100755 --- a/ops/testing.py +++ b/ops/testing.py @@ -149,7 +149,7 @@ class ExecResult: class Harness(Generic[CharmType]): """This class represents a way to build up the model that will drive a test suite. - The model created is from the viewpoint of the charm that being tested. + The model created is from the viewpoint of the charm that is being tested. Below is an example test using :meth:`begin_with_initial_hooks` that ensures the charm responds correctly to config changes:: @@ -338,7 +338,7 @@ class TestCharm(self._charm_cls): # type: ignore self._charm = TestCharm(self._framework) # type: ignore def begin_with_initial_hooks(self) -> None: - """Have the Harness fire the same hooks that Juju would fire at startup. + """Fire the same hooks that Juju would fire at startup. This triggers install, relation-created, config-changed, start, pebble-ready (for any containers), and any relation-joined hooks based on what relations have been added before @@ -616,8 +616,8 @@ def disable_hooks(self) -> None: def enable_hooks(self) -> None: """Re-enable hook events from charm.on when the model is changed. - By default hook events are enabled once :meth:`.begin` is called, - but if :meth:`.disable_hooks` is used, this can be used to enable + By default, hook events are enabled once :meth:`.begin` is called, + but if :meth:`.disable_hooks` is used, this method will enable them again. """ self._hooks_enabled = True