Make support/python/mkdocstrings_handlers/cxx/__init__.py PEP 8 compliant (1 of 2)#4110
Conversation
|
Thanks for the PR. Are you talking about PEP 8 and could you split indent/whitespace change into a separate commit/PR to make the more important changes easier to see in the diff? |
Yes! To be honest, I am just follow the recommendations (yellow flags) from CLion.
Sure, I'll do split it in 2. |
support/python/mkdocstrings_handlers/cxx/__init__.py PEP compliantsupport/python/mkdocstrings_handlers/cxx/__init__.py PEP 8 compliant
support/python/mkdocstrings_handlers/cxx/__init__.py PEP 8 compliantsupport/python/mkdocstrings_handlers/cxx/__init__.py PEP 8 compliant (1 of 2)
vitaut
left a comment
There was a problem hiding this comment.
There is one error:
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/runner/work/fmt/fmt/support/python/mkdocstrings_handlers/cxx/__init__.py", line 53, in <module>
def doxyxml2html(nodes: List[ElementTree.Element] | ElementTree.Element):
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'type'
… using operator '|'.
Ooops, Python 3.8 doesn't like that |
| if n.text: | ||
| out += escape_html(n.text) | ||
| out += doxyxml2html(n) | ||
| out += doxyxml2html([n]) |
There was a problem hiding this comment.
Looks like this introduces infinite recursion: https://github.com/fmtlib/fmt/actions/runs/10303709064/job/28524343469?pr=4110
There was a problem hiding this comment.
Should probably be list(n) instead of [n] because what we need is a list of chile elements.
There was a problem hiding this comment.
Should probably be
list(n)instead of[n]because what we need is a list of chile elements.
Oh my! I had introduced the from __future__ import annotations so that I could use the operator | (I tested this in a python:3.8 docker), but then I also pushed this change (something I was trying on my machine). Sorry about that! I hope it works now.
…tor. Change convert_type return type to Optional[str].
|
Merged, thanks! |
Yey, thanks to you! |
Definitionclass.convert_typecan returnstr | None.etis imported asElementTree.doxyxml2htmlcan receive either aList[ElementTree.Element]or anElementTree.Element.typevariable is renamed totype_(andtype_text) to avoid conflicts with built-intype.templateparamlistis renamed totemplate_param_list.