GSoC/GCI Archive
Google Code-in 2013 KDE

KDevelop Python: fix issues in the built-in library support

completed by: Levente Kurusa

mentors: Sven Brauch

kdev-python provides Python language support for the KDevelop IDE. kdev-python defines basic properties and data types in the documentation_files/builtindocumentation.py file. For example, this contains a declaration for the built-in "float" object. Recently, kdev-python has gained support for evaluating binary operators (that means, it can now find the type of an expression such as a * b) by looking at class declarations. However, this is not yet properly reflected in the builtin documentation for python's basic data types. As an example, multiplying a list by an int, as in a = [1, 2] * 3 will assign [1, 2, 1, 2, 1, 2] to a. For supporting this, in the "list" class in the file mentioned above, there would need to be a declaration like def __mul__(self, other): return list() (optimally, this declaration would have the @returnContentEqualsContentOf(0) decorator to keep the content type). The goal of this task is to find the most common of the current missing operators (as an example, all of plus, minus, divide, multiply, ... between int/float/complex are missing) and add them to the file. A bonus would be to merge those changes to the "python3-nofork" branch. This task should be rather simple, you only need to know some python and need to do some reading. No knowledge of C++ or Qt is required. Note: there can be some complicated issues when the result of an operation depends on the argument type, e.g. int.__mul__(other) could be int, float, list, ... This is currently difficult to support, so we should just stick to the most common case (such as int.__div__ always returns float, int.__mul__ always returns int, etc).