-
Notifications
You must be signed in to change notification settings - Fork 119
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
Various docstring and type annotation updates #953
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
"""Set the name and UUID of the model that this is representing. | ||
|
||
This cannot be called once begin() has been called. But it lets you set the value that | ||
will be returned by Model.name and Model.uuid. | ||
This cannot be called once :meth:`begin` has been called. But it lets | ||
you set the value that will be returned by :attr:`Model.name <ops.Model.name>` | ||
and :attr:`Model.uuid <ops.Model.uuid>`. | ||
|
||
This is a convenience method to invoke both Harness.set_model_name | ||
and Harness.set_model_uuid at once. | ||
This is a convenience method to invoke both :meth:`set_model_name` | ||
and :meth:`set_model_uuid` at once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit that shouldn't block the merge, but applies in a few places and would be good to clean up over time...
I'd prefer to remove the "you" - and stick with the imperative style (similar to commit messages).
Something like:
"""Set the name and UUID of the model this represents.
Cannot be called once :meth:`begin` has been called. Enables the
value returned by `:attr:`Model.name <ops.Model.name>` and
:attr:`Model.uuid <ops.Model.uuid>` to be controlled.
Convenience method to invoke both :meth:`set_model_name`
and :meth:`set_model_uuid` at once.
"""
Another approach might be s/you/the developer/g
but I still think the above is cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I'm going to leave it for another PR so this one can avoid too much sprawl. Opened issue #959 to track.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions about how to improve the docstrings, doesn't need a second pass from my side. Looks like a great improvement!
One more thing forgotten from #953. This is annoying because it means that charms that use ops.PebbleReadyEvent annotations when handling pebble-ready can't access any attributes of the workload, as it doesn't have a type.
The intent here is to sprinkle a bit of consistency over our reference docs. There's currently a fair bit of duplication, lack of type information on attributes, or just unclear docs, and so on. One of the biggest changes was giving instance attributes proper type annotations and separating out and enhancing their docstrings.
I've spent 30 minutes or so a day on this for the last couple of weeks, and got through all the docs (viewable version here). It's not perfect, but I think it's a definite improvement for #920.