Skip to content

🎈 Add Docstrings to Anrede Enum Members#75

Merged
hf-kklein merged 9 commits intodevelopfrom
enum_member_docs
Nov 10, 2021
Merged

🎈 Add Docstrings to Anrede Enum Members#75
hf-kklein merged 9 commits intodevelopfrom
enum_member_docs

Conversation

@hf-kklein
Copy link
Copy Markdown
Contributor

@hf-kklein hf-kklein commented Nov 10, 2021

I'd like to merge this already to see if the docs on https://bo4e-python.readthedocs.io/en/master/api/bo4e.enum.html#module-bo4e.enum.anrede show up after releasing this. It's a "testballon" ;)

@hf-kklein hf-kklein self-assigned this Nov 10, 2021
@hf-kklein hf-kklein requested a review from hf-krechan November 10, 2021 15:12
@hf-kklein hf-kklein changed the title (DRAFT) Allow Documenting Enum Members 🎈 Add Docstrings to Anrede Enum Members Nov 10, 2021
@hf-kklein hf-kklein marked this pull request as ready for review November 10, 2021 15:44
Copy link
Copy Markdown
Collaborator

@hf-krechan hf-krechan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice nice, just two little format change requests =)


# see https://stackoverflow.com/a/50473952/10009545
def __new__(cls, value, doc=None):
self = str.__new__(cls, value) # calling super().__new__(value) here would fail
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it with StrEnum but it did not work =(
It seems that it can not find the right ENUM if we use the StrEnum class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for me

Comment on lines +49 to +55
@staticmethod
def _get_class_doc(enum_class: TEnum) -> Optional[str]:
"""
asserts that enum class is a class and returns the class' docstring
"""
assert inspect.isclass(enum_class)
return inspect.getdoc(enum_class)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put this staticmethod at the top of this class?
So you find it before it's first call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hf-kklein hf-kklein requested a review from hf-krechan November 10, 2021 16:29
Copy link
Copy Markdown
Collaborator

@hf-krechan hf-krechan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants