Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Hoyt <[email protected]>
  • Loading branch information
tonyandrewmeyer and benhoyt authored Sep 20, 2023
1 parent 1033523 commit 77be0fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ops/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ops/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
12 changes: 6 additions & 6 deletions ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <CharmEvents.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::
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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.)
"""
Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions ops/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 77be0fc

Please sign in to comment.