Bug 325090

Summary: JJ: Ensure proper documentation is provided for commonly used modules
Product: [Developer tools] kdev-python Reporter: Sven Brauch <mail>
Component: Documentation dataAssignee: Sven Brauch <mail>
Status: CONFIRMED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: git master   
Target Milestone: 1.6.0   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Sven Brauch 2013-09-19 13:27:05 UTC
Our support for the very basic built-in modules, like sys, os etc. is currently read from the files python uses too, i.e. /usr/lib/pythonx.y/os.py. That works to varying degrees -- for example, os.gecwd() is imported in a fancy way from the C POSIX builtins, and is thus not there.

A clever, but a bit complicated way to solve this would be:
 1) Add a file called os.py to documentation_files/. In there, do "from os import *", and then "def getcwd(): return str()" or something.
 2) Hack ContextBuilder::findModulePath (kdev-python/duchain/contextbuilder.cpp) to search in the system directories *before* those from Helper::getDataDirs() in case the currently parsed file is in those data dirs already. That'll ensure the "from os import *" will indeed pick up the system's os module.

A simpler solution, which might also be ok for different, smaller modules than os is just copying the system file to documentation_files and modifying it there, or just creating a new "pseudo" implementation of the module which just defines the functions and has docstrings, but doesn't actually implement anything.

Reproducible: Always
Comment 1 Sven Brauch 2016-01-31 00:43:03 UTC
Next in list: sys. sys.stdin and stuff should really work properly.
Comment 2 Sven Brauch 2016-02-02 18:04:40 UTC
sys is done now, another one which is always shaky is re.
Comment 3 Justin Zobel 2021-03-09 23:42:29 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.