DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
http://docs.basedpyright.com/
Other
601 stars 12 forks source link

docstrings for builtin modules that are partially compiled #428

Open DetachHead opened 2 weeks ago

DetachHead commented 2 weeks ago

Ah, got it. We only need it for compiled modules. NVM.

Hmm... doesn't seem to be this case.

import re

if m := re.search('foo', 'foo'):
    aa = m.group()
    #      ^^^^^ no docstring for `group`
>>> import inspect, re; m = re.search('foo', 'foo'); inspect.getdoc(m.group)
'group([group1, ...]) -> str or tuple.\nReturn subgroup(s) of the match by indices or names.\nFor 0 returns the entire match.'

There can a lot of built-in things still implemented in C. So I would still consider that dosctrings should be generated for the whole stdlib typeshed-fallback.

Originally posted by @jfcherng in https://github.com/DetachHead/basedpyright/issues/420#issuecomment-2178640784

KotlinIsland commented 2 weeks ago

The case here is that the re module imports some of it's exports from a compiled module _sre, and the stubs for re.py don't accurately reflect this, instead specifying that they are defined within re.