aiodynamo icon indicating copy to clipboard operation
aiodynamo copied to clipboard

manually document enums

Open ojii opened this issue 1 year ago • 5 comments

Fixes #190

ojii avatar Aug 15 '24 09:08 ojii

WDYT about this idiom for documenting enum values?

https://github.com/canonical/operator/blob/6a17bf933114959a968fe65502f429a0dab4452c/ops/charm.py#L1815-L1822

dimaqq avatar Nov 21 '24 07:11 dimaqq

those docstrings look like they're the wrong way around (I'd expect them to be before the thing they document)

ojii avatar Nov 21 '24 07:11 ojii

The convention was counter-intuitive for me too.

The way I force myself to remember this is:

  • after def foo() goes the function docstring
  • after attr: int goes the attribute docstring

dimaqq avatar Nov 21 '24 07:11 dimaqq

Or you could use https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Doc if the tooling groks that.

dimaqq avatar Nov 21 '24 07:11 dimaqq

Or you could use https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Doc if the tooling groks that.

I detest that use of type hints... I do a lot of fastapi these days and I find their doc-typehints to make the code super unreadable.

ojii avatar Nov 21 '24 07:11 ojii