From dfac6aecda60011eb89c9b6f72bad04023b764cd Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Wed, 19 Jun 2013 13:00:36 +0400 Subject: [PATCH 1/2] Provide types for built-ins using user skeletons based on cached docstrings --- python/helpers/StdlibTypes2.properties | 130 ------------------------- python/helpers/StdlibTypes3.properties | 10 -- 2 files changed, 140 deletions(-) diff --git a/python/helpers/StdlibTypes2.properties b/python/helpers/StdlibTypes2.properties index 29db05ebd8ba..bfcbdef61460 100644 --- a/python/helpers/StdlibTypes2.properties +++ b/python/helpers/StdlibTypes2.properties @@ -2,103 +2,6 @@ ## 2. Built-in functions -__builtin__.abs = \ - :type number: T \n\ - :rtype: T or unknown \n\ - -__builtin__.all = \ - :type iterable: collections.Iterable \n\ - :rtype: bool \n\ - -__builtin__.any = \ - :type iterable: collections.Iterable \n\ - :rtype: bool \n\ - -__builtin__.bin = \ - :type number: int or long or float or complex \n\ - :rtype: bytes \n\ - -__builtin__.callable = \ - :rtype: bool \n\ - -__builtin__.chr = \ - :type i: int \n\ - :rtype: bytes \n\ - -__builtin__.dir = \ - :rtype: list of bytes \n\ - -__builtin__.divmod = \ - :type x: int or long or float or complex \n\ - :type y: int or long or float or complex \n\ - :rtype: (int or long or float or unknown, int or long or float or unknown) \n\ - -__builtin__.enumerate.__init__ = \ - :type iterable: collections.Iterable of T \n\ - :type start: int or long \n\ - :rtype: enumerate of (int, T) \n\ - -__builtin__.enumerate.__iter__ = \ - :rtype: enumerate of (int, T) \n\ - -__builtin__.enumerate.next = \ - :rtype: (int, T) \n\ - -__builtin__.filter = \ - :type function_or_none: collections.Callable or None \n\ - :type sequence: collections.Iterable of T \n\ - :rtype: list of T \n\ - -__builtin__.filter.1 = \ - :type sequence: bytes \n\ - :rtype: bytes \n\ - -__builtin__.filter.2 = \ - :type sequence: unicode \n\ - :rtype: unicode \n\ - -__builtin__.filter.3 = \ - :type sequence: tuple \n\ - :rtype: tuple \n\ - -__builtin__.getattr = \ - :type name: string \n\ - :rtype: object or unknown \n\ - -__builtin__.globals = \ - :rtype: dict of (string, unknown) - -__builtin__.hasattr = \ - :type name: string \n\ - :rtype: bool \n\ - -__builtin__.hash = \ - :rtype: int \n\ - -__builtin__.iter = \ - :type source: collections.Iterable of T \n\ - :rtype: collections.Iterator of T \n\ - -__builtin__.len = \ - :type p_object: collections.Sized \n\ - :rtype: int \n\ - -__builtin__.locals = \ - :rtype: dict of (string, unknown) - -__builtin__.map = \ - :type function: collections.Callable or None \n\ - :type sequence: collections.Iterable \n\ - :rtype: list \n\ - -__builtin__.next = \ - :type iterator: collections.Iterator of T \n\ - :rtype: T \n\ - -__builtin__.object.__new__ = \n\ - :type cls: T \n\ - :rtype: T \n\ - __builtin__.open = \ :type name: string \n\ :type mode: string \n\ @@ -115,39 +18,6 @@ __builtin__.open.2 = \ :type mode: bytes \n\ :rtype: io.FileIO of bytes \n\ -__builtin__.ord = \ - :type c: string \n\ - :rtype: int \n\ - -__builtin__.pow = \ - :type x: int or long or float or complex \n\ - :type y: int or long or float or complex \n\ - :rtype: int or long or float or unknown \n\ - -__builtin__.range = \ - :type start: int or None \n\ - :type stop: int or None \n\ - :type step: int or None \n\ - :rtype: list of int \n\ - -__builtin__.reduce = \ - :type function: collections.Callable \n\ - :type sequence: collections.Iterable \n\ - :type initial: object or None \n\ - :rtype: object or unknown \n\ - -__builtin__.round = \ - :type number: int or long or float \n\ - :type ndigits: int or long or float or None \n\ - :rtype: float \n\ - -__builtin__.vars = \ - :rtype: dict of (string, unknown) - -__builtin__.xrange.__init__ = \ - :type start: int \n\ - :rtype: xrange of int \n\ - ## 5.4. Numeric types diff --git a/python/helpers/StdlibTypes3.properties b/python/helpers/StdlibTypes3.properties index ee77eed147f2..6359d0d1df7a 100644 --- a/python/helpers/StdlibTypes3.properties +++ b/python/helpers/StdlibTypes3.properties @@ -1,15 +1,5 @@ # Python 3.2 stdlib -## 2. Built-in functions - -__builtin__.chr = \ - :type i: int \n\ - :rtype: str \n\ - -__builtin__.dir = \ - :rtype: list of str \n\ - - ## 4.6. Sequence types __builtin__.bytes.__init__ = \ From 7fdc938631c9a6e469c4584a04b8511756ea3917 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Wed, 19 Jun 2013 14:12:00 +0400 Subject: [PATCH 2/2] Overloaded type signatures for functions are not supported in user skeletons yet --- .../inspections/PyTypeCheckerInspection/DictLiterals.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py b/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py index 5b55ba3c4a69..f6d79460c4e4 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py +++ b/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py @@ -6,5 +6,3 @@ def test(): print(k + None) for k in xs: print(k + None) - ys = filter(lambda x: x, xs.keys()) - ys.append(0)