mkdocstrings / pytkdocs

Load Python objects documentation.
https://mkdocstrings.github.io/pytkdocs
ISC License
50 stars 32 forks source link

[BUG] collections.namedtuple leads to source not found warning #111

Closed ArneBachmannDLR closed 3 years ago

ArneBachmannDLR commented 3 years ago

Describe the bug I declare a few named tuples in my code, which leads to:

←[33mWARNING  -  ←[0mmkdocstrings.handlers.python: Couldn't read source for 'autocook.python.PackageVersion.__new__': could not get source code
←[33mWARNING  -  ←[0mmkdocstrings.handlers.python: Couldn't read source for 'autocook.windows.WindowsService.VALUE.__new__': could not get source code

To Reproduce Here is the code:

class WindowsService(WindowsServiceRemoval):
  ''' long docstring '''
  VALUE:NamedTuple = collections.namedtuple("VALUE", "required nssmKey quotes type")

  def __init__(_, name:str) -> None:
    pass

Expected behavior Nothing special, just no warning.

System (please complete the following information):

pawamoy commented 3 years ago

I agree that these warnings are annoying or even disrupting with the strict mode enabled. We can probably add a special cases, or some configuration option to choose what warnings to disable.