From 5eb12392282f1602001f3dfab2ffd737fc0e1414 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Mon, 4 Jun 2018 19:22:16 +0300 Subject: [PATCH] Remove unused skeletons and move stubs whitelist to syncing script --- .../helpers/python-skeletons/__builtin__.py | 2982 ----------------- python/helpers/python-skeletons/builtins.py | 2598 -------------- .../helpers/python-skeletons/collections.py | 56 - python/helpers/python-skeletons/datetime.py | 625 ---- .../python/codeInsight/typing/PyTypeShed.kt | 15 +- .../userSkeletons/PyUserSkeletonsUtil.java | 15 - .../jetbrains/python/tools/PyTypeShedSync.kt | 78 - .../jetbrains/python/tools/PyTypeShedSync.kts | 82 + 8 files changed, 84 insertions(+), 6367 deletions(-) delete mode 100644 python/helpers/python-skeletons/__builtin__.py delete mode 100644 python/helpers/python-skeletons/builtins.py delete mode 100644 python/helpers/python-skeletons/collections.py delete mode 100644 python/helpers/python-skeletons/datetime.py delete mode 100644 python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kt create mode 100644 python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts diff --git a/python/helpers/python-skeletons/__builtin__.py b/python/helpers/python-skeletons/__builtin__.py deleted file mode 100644 index d8841504b2cd..000000000000 --- a/python/helpers/python-skeletons/__builtin__.py +++ /dev/null @@ -1,2982 +0,0 @@ -"""Skeletons for Python 2 built-in symbols.""" - - -from __future__ import unicode_literals -import sys - - -def abs(number): - """Return the absolute value of the argument. - - :type number: T - :rtype: T | unknown - """ - return number - - -def all(iterable): - """Return True if bool(x) is True for all values x in the iterable. - - :type iterable: collections.Iterable - :rtype: bool - """ - return False - - -def any(iterable): - """Return True if bool(x) is True for any x in the iterable. - - :type iterable: collections.Iterable - :rtype: bool - """ - return False - - -def bin(number): - """Return the binary representation of an integer or long integer. - - :type number: numbers.Number - :rtype: bytes - """ - return b'' - - -def callable(object): - """Return whether the object is callable (i.e., some kind of function). - Note that classes are callable, as are instances with a __call__() method. - - :rtype: bool - """ - return False - - -def chr(i): - """Return a string of one character with ordinal i; 0 <= i < 256. - - :type i: numbers.Integral - :rtype: bytes - """ - return b'' - - -def cmp(x, y): - """Return negative if xy. - - :rtype: int - """ - return 0 - - -def dir(object=None): - """If called without an argument, return the names in the current scope. - Else, return an alphabetized list of names comprising (some of) the - attributes of the given object, and of attributes reachable from it. - - :rtype: list[string] - """ - return [] - - -def divmod(x, y): - """Return the tuple ((x-x%y)/y, x%y). - - :type x: numbers.Number - :type y: numbers.Number - :rtype: (int | long | float | unknown, int | long | float | unknown) - """ - return 0, 0 - - -def filter(function_or_none, sequence): - """Return those items of sequence for which function(item) is true. If - function is None, return the items that are true. If sequence is a tuple - or string, return the same type, else return a list. - - :type function_or_none: collections.Callable | None - :type sequence: T <= list[V] | collections.Iterable[V] | bytes | unicode - :rtype: T - """ - return sequence - - -def getattr(object, name, default=None): - """Get a named attribute from an object; getattr(x, 'y') is equivalent to - x.y. When a default argument is given, it is returned when the attribute - doesn't exist; without it, an exception is raised in that case. - - :type name: string - """ - pass - - -def globals(): - """Return the dictionary containing the current scope's global variables. - - :rtype: dict[string, unknown] - """ - return {} - - -def hasattr(object, name): - """Return whether the object has an attribute with the given name. - - :type name: string - :rtype: bool - """ - return False - - -def hash(object): - """Return a hash value for the object. - - :rtype: int - """ - return 0 - - -def hex(number): - """Return the hexadecimal representation of an integer or long integer. - - :type number: numbers.Integral - :rtype: bytes - """ - return b'' - - -def id(object): - """Return the identity of an object. - - :rtype: int - """ - return 0 - - -def isinstance(object, class_or_type_or_tuple): - """Return whether an object is an instance of a class or of a subclass - thereof. - - :rtype: bool - """ - return False - - -def issubclass(C, B): - """Return whether class C is a subclass (i.e., a derived class) of class B. - - :rtype: bool - """ - return False - - -def iter(o, sentinel=None): - """Get an iterator from an object. In the first form, the argument must - supply its own iterator, or be a sequence. In the second form, the callable - is called until it returns the sentinel. - - :type o: collections.Iterable[T] | (() -> object) - :type sentinel: object | None - :rtype: collections.Iterator[T] - """ - return [] - - -def len(object): - """Return the number of items of a sequence or mapping. - - :type object: collections.Sized - :rtype: int - """ - return 0 - - -def locals(): - """Update and return a dictionary containing the current scope's local - variables. - - :rtype: dict[string, unknown] - """ - return {} - - -def map(function, sequence, *sequence_1): - """Return a list of the results of applying the function to the items of - the argument sequence(s). - - :type function: None | (T) -> V - :type sequence: collections.Iterable[T] - :rtype: list[V] - """ - pass - - -def min(*args, key=None, default=None): - """Return the smallest item in an iterable or the smallest of two or more - arguments. - - :type args: T - :rtype: T - """ - pass - - -def max(*args, key=None, default=None): - """Return the largest item in an iterable or the largest of two or more - arguments. - - :type args: T - :rtype: T - """ - pass - - -def sum(iterable, start=0): - """Sums start and the items of an iterable from left to right and returns - the total. - - :type iterable: collections.Iterable[T] - :rtype: T - """ - pass - - -def next(iterator, default=None): - """Return the next item from the iterator. - - :type iterator: collections.Iterator[T] - :rtype: T - """ - pass - - -def oct(number): - """Return the octal representation of an integer or long integer. - - :type number: numbers.Integral - :rtype: bytes - """ - return b'' - - -def open(name, mode='r', buffering=-1, encoding=None, errors=None, newline=None, - closefd=None, opener=None): - """Open a file, returns a file object. - - :type name: string - :type mode: string - :type buffering: numbers.Integral - :type encoding: string | None - :type errors: string | None - :rtype: file - """ - return file() - - -def ord(c): - """Return the integer ordinal of a one-character string. - - :type c: string - :rtype: int - """ - return 0 - - -def pow(x, y, z=None): - """With two arguments, equivalent to x**y. With three arguments, - equivalent to (x**y) % z, but may be more efficient (e.g. for longs). - - :type x: numbers.Number - :type y: numbers.Number - :type z: numbers.Number | None - :rtype: int | long | float | complex - """ - return 0 - - -def range(start, stop=None, step=None): - """Return a list containing an arithmetic progression of integers. - - :type start: numbers.Integral - :type stop: numbers.Integral | None - :type step: numbers.Integral | None - :rtype: list[int] - """ - return [] - - -def reduce(function, sequence, initial=None): - """Apply a function of two arguments cumulatively to the items of a - sequence, from left to right, so as to reduce the sequence to a single - value. - - :type function: collections.Callable - :type sequence: collections.Iterable - :type initial: T - :rtype: T | unknown - """ - return initial - - -def repr(object): - """ - Return the canonical string representation of the object. - - :rtype: bytes - """ - return b'' - - -def round(number, ndigits=None): - """Round a number to a given precision in decimal digits (default 0 digits). - - :type number: object - :type ndigits: numbers.Integral | None - :rtype: float - """ - return 0.0 - - -class slice(object): - def __init__(self, start, stop=None, step=None): - """Create a slice object. This is used for extended slicing (e.g. - a[0:10:2]). - - :type start: numbers.Integral - :type stop: numbers.Integral | None - :type step: numbers.Integral | None - """ - pass - - -def unichr(i): - """Return the Unicode string of one character whose Unicode code is the - integer i. - - :type i: numbers.Integral - :rtype: unicode - """ - return '' - - -def vars(object=None): - """Without arguments, equivalent to locals(). With an argument, equivalent - to object.__dict__. - - :rtype: dict[string, unknown] - """ - return {} - - -def zip(*iterables): - """This function returns a list of tuples, where the i-th tuple contains - the i-th element from each of the argument sequences or iterables. - - :rtype: list[tuple] - """ - return [] - - -class object: - """ The most base type.""" - - @staticmethod - def __new__(cls, *more): - """Create a new object. - - :type cls: T - :rtype: T - """ - pass - - -class type(object): - """Type of object.""" - - def __instancecheck__(cls, instance): - """Return true if instance should be considered a (direct or indirect) - instance of class. - """ - return False - - def __subclasscheck__(cls, subclass): - """Return true if subclass should be considered a (direct or indirect) - subclass of class. - """ - return False - - -class enumerate(object): - """enumerate object.""" - - def __init__(self, iterable, start=0): - """Create an enumerate object. - - :type iterable: collections.Iterable[T] - :type start: numbers.Integral - :rtype: enumerate[T] - """ - pass - - def next(self): - """Return the next value, or raise StopIteration. - - :rtype: (int, T) - """ - pass - - def __iter__(self): - """x.__iter__() <==> iter(x). - - :rtype: collections.Iterator[(int, T)] - """ - return self - - -class xrange(object): - """xrange object.""" - - def __init__(self, start, stop=None, step=None): - """Create an xrange object. - - :type start: numbers.Integral - :type stop: numbers.Integral | None - :type step: numbers.Integral | None - :rtype: xrange[int] - """ - pass - - -class int(object): - """Integer numeric type.""" - - def __init__(self, x=None, base=10): - """Convert a number or string x to an integer, or return 0 if no - arguments are given. - - :type x: object - :type base: numbers.Integral - """ - pass - - def __eq__(self, y): - return False - - def __ne__(self, y): - return False - - def __lt__(self, y): - return False - - def __gt__(self, y): - return False - - def __le__(self, y): - return False - - def __ge__(self, y): - return False - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __pow__(self, y, modulo=None): - """x to the power y. - - :type y: numbers.Number - :type modulo: numbers.Integral | None - :rtype: int - """ - return 0 - - def __lshift__(self, n): - """x shifted left by n bits. - - :type n: numbers.Integral - :rtype: int - """ - return 0 - - def __rshift__(self, n): - """x shifted right by n bits. - - :type n: numbers.Integral - :rtype: int - """ - return 0 - - def __and__(self, y): - """Bitwise and of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __or__(self, y): - """Bitwise or of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __xor__(self, y): - """Bitwise exclusive or of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rlshift__(self, y): - """y shifted left by x bits. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rrshift__(self, y): - """y shifted right by n bits. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rand__(self, y): - """Bitwise and of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __ror__(self, y): - """Bitwise or of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rxor__(self, y): - """Bitwise exclusive or of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __pos__(self): - """x unchanged. - - :rtype: int - """ - return 0 - - def __neg__(self): - """x negated. - - :rtype: int - """ - return 0 - - def __invert__(self): - """The bits of x inverted. - - :rtype: int - """ - return 0 - - -class long(object): - """Long integer numeric type.""" - - def __init__(self, x=None, base=10): - """Convert a number or string x to a long integer, or return 0 if - no arguments are given. - - :type x: object - :type base: numbers.Integral - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __pow__(self, y, modulo=None): - """x to the power y. - - :type y: numbers.Number - :type modulo: numbers.Integral | None - :rtype: long - """ - return 0 - - def __lshift__(self, n): - """x shifted left by n bits. - - :type n: numbers.Integral - :rtype: long - """ - return 0 - - def __rshift__(self, n): - """x shifted right by n bits. - - :type n: numbers.Integral - :rtype: long - """ - return 0 - - def __and__(self, y): - """Bitwise and of x and y. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __or__(self, y): - """Bitwise or of x and y. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __xor__(self, y): - """Bitwise exclusive or of x and y. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rlshift__(self, y): - """y shifted left by x bits. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __rrshift__(self, y): - """y shifted right by n bits. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __rand__(self, y): - """Bitwise and of y and x. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __ror__(self, y): - """Bitwise or of y and x. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __rxor__(self, y): - """Bitwise exclusive or of y and x. - - :type y: numbers.Integral - :rtype: long - """ - return 0 - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: long - """ - return 0 - - def __pos__(self): - """x unchanged. - - :rtype: long - """ - return 0 - - def __neg__(self): - """x negated. - - :rtype: long - """ - return 0 - - def __invert__(self): - """The bits of x inverted. - - :rtype: long - """ - return 0 - - -class float(object): - """Floating point numeric type.""" - - def __init__(self, x=None): - """Convert a string or a number to floating point. - - :type x: object - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __pow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __pos__(self): - """x unchanged. - - :rtype: float - """ - return 0.0 - - def __neg__(self): - """x negated. - - :rtype: float - """ - return 0.0 - - @staticmethod - def fromhex(string): - """Create a floating-point number from a hexadecimal string. - - :type string: str - :rtype: float - """ - pass - - -class complex(object): - """Complex numeric type.""" - - def __init__(self, real=None, imag=None): - """Create a complex number with the value real + imag*j or convert a - string or number to a complex number. - - :type real: object - :type imag: object - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __pow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __pos__(self): - """x unchanged. - - :rtype: complex - """ - return 0j - - def __neg__(self): - """x negated. - - :rtype: complex - """ - return 0j - - -class str(basestring): - """String object.""" - - def __init__(self, object=''): - """Construct an immutable string. - - :type object: object - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: string - :rtype: string - """ - return b'' - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: str - """ - return b'' - - def __mod__(self, y): - """x % y. - - :rtype: string - """ - return b'' - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: str - """ - return b'' - - def __getitem__(self, y): - """y-th item of x or substring, origin 0. - - :type y: numbers.Integral | slice - :rtype: str - """ - return b'' - - def __iter__(self): - """Iterator over bytes. - - :rtype: collections.Iterator[str] - """ - return [] - - def capitalize(self): - """Return a copy of the string with its first character capitalized - and the rest lowercased. - - :rtype: str - """ - return b'' - - def center(self, width, fillchar=' '): - """Return centered in a string of length width. - - :type width: numbers.Integral - :type fillchar: str - :rtype: str - """ - return b'' - - def count(self, sub, start=None, end=None): - """Return the number of non-overlapping occurrences of substring - sub in the range [start, end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: int - """ - return 0 - - def decode(self, encoding='utf-8', errors='strict'): - """Return a string decoded from the given bytes. - - :type encoding: string - :type errors: string - :rtype: unicode - """ - return '' - - def encode(self, encoding='utf-8', errors='strict'): - """Return an encoded version of the string as a bytes object. - - :type encoding: string - :type errors: string - :rtype: str - """ - return b'' - - def endswith(self, suffix, start=None, end=None): - """Return True if the string ends with the specified suffix, - otherwise return False. - - :type suffix: string | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def find(self, sub, start=None, end=None): - """Return the lowest index in the string where substring sub is - found, such that sub is contained in the slice s[start:end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def format(self, *args, **kwargs): - """Perform a string formatting operation. - - :rtype: string - """ - return '' - - def index(self, sub, start=None, end=None): - """Like find(), but raise ValueError when the substring is not - found. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def isalnum(self): - """Return true if all characters in the string are alphanumeric and - there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isalpha(self): - """Return true if all characters in the string are alphabetic and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isdigit(self): - """Return true if all characters in the string are digits and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def islower(self): - """Return true if all cased characters in the string are lowercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def isspace(self): - """Return true if there are only whitespace characters in the - string and there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def istitle(self): - """Return true if the string is a titlecased string and there is at - least one character, for example uppercase characters may only - follow uncased characters and lowercase characters only cased ones. - - :rtype: bool - """ - return False - - def isupper(self): - """Return true if all cased characters in the string are uppercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def join(self, iterable): - """Return a string which is the concatenation of the strings in the - iterable. - - :type iterable: collections.Iterable[string] - :rtype: string - """ - return '' - - def ljust(self, width, fillchar=' '): - """Return the string left justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: str - :rtype: str - """ - return b'' - - def lower(self): - """Return a copy of the string with all the cased characters - converted to lowercase. - - :rtype: str - """ - return b'' - - def lstrip(self, chars=None): - """Return a copy of the string with leading characters removed. - - :type chars: string | None - :rtype: str - """ - return b'' - - def partition(self, sep): - """Split the string at the first occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: string - :rtype: (str, str, str) - """ - return b'', b'', b'' - - def replace(self, old, new, count=-1): - """Return a copy of the string with all occurrences of substring - old replaced by new. - - :type old: string - :type new: string - :type count: numbers.Integral - :rtype: string - """ - return '' - - def rfind(self, sub, start=None, end=None): - """Return the highest index in the string where substring sub is - found, such that sub is contained within s[start:end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rindex(self, sub, start=None, end=None): - """Like rfind(), but raise ValueError when the substring is not - found. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rjust(self, width, fillchar=' '): - """Return the string right justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: string - :rtype: string - """ - return '' - - def rpartition(self, sep): - """Split the string at the last occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: string - :rtype: (str, str, str) - """ - return b'', b'', b'' - - def rsplit(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: string | None - :type maxsplit: numbers.Integral - :rtype: list[str] - """ - return [] - - def rstrip(self, chars=None): - """Return a copy of the string with trailing characters removed. - - :type chars: string | None - :rtype: str - """ - return b'' - - def split(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: string | None - :type maxsplit: numbers.Integral - :rtype: list[str] - """ - return [] - - def splitlines(self, keepends=False): - """Return a list of the lines in the string, breaking at line - boundaries. - - :type keepends: bool - :rtype: list[str] - """ - return [] - - def startswith(self, prefix, start=None, end=None): - """Return True if string starts with the prefix, otherwise return - False. - - :type prefix: string | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def strip(self, chars=None): - """Return a copy of the string with the leading and trailing - characters removed. - - :type chars: string | None - :rtype: str - """ - return b'' - - def swapcase(self): - """Return a copy of the string with uppercase characters converted - to lowercase and vice versa. - - :rtype: str - """ - return b'' - - def title(self): - """Return a titlecased version of the string where words start with - an uppercase character and the remaining characters are lowercase. - - :rtype: str - """ - return b'' - - def upper(self): - """Return a copy of the string with all the cased characters - converted to uppercase. - - :rtype: str - """ - return b'' - - def zfill(self, width): - """Return the numeric string left filled with zeros in a string of - length width. - - :type width: numbers.Integral - :rtype: str - """ - return b'' - - -class unicode(basestring): - """Unicode string object.""" - - def __init__(self, object='', encoding='utf-8', errors='strict'): - """Construct an immutable Unicode string. - - :type object: object - :type encoding: string - :type errors: string - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: string - :rtype: unicode - """ - return '' - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: unicode - """ - return '' - - def __mod__(self, y): - """x % y. - - :rtype: unicode - """ - return '' - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: unicode - """ - return '' - - def __getitem__(self, y): - """y-th item of x or substring, origin 0. - - :type y: numbers.Integral | slice - :rtype: unicode - """ - return '' - - def __iter__(self): - """Iterator over bytes. - - :rtype: collections.Iterator[unicode] - """ - return [] - - def capitalize(self): - """Return a copy of the string with its first character capitalized - and the rest lowercased. - - :rtype: unicode - """ - return '' - - def center(self, width, fillchar=' '): - """Return centered in a string of length width. - - :type width: numbers.Integral - :type fillchar: string - :rtype: unicode - """ - return '' - - def count(self, sub, start=None, end=None): - """Return the number of non-overlapping occurrences of substring - sub in the range [start, end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: int - """ - return 0 - - def decode(self, encoding='utf-8', errors='strict'): - """Return a string decoded from the given bytes. - - :type encoding: string - :type errors: string - :rtype: unicode - """ - return '' - - def encode(self, encoding='utf-8', errors='strict'): - """Return an encoded version of the string as a bytes object. - - :type encoding: string - :type errors: string - :rtype: bytes - """ - return b'' - - def endswith(self, suffix, start=None, end=None): - """Return True if the string ends with the specified suffix, - otherwise return False. - - :type suffix: string | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def find(self, sub, start=None, end=None): - """Return the lowest index in the string where substring sub is - found, such that sub is contained in the slice s[start:end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def format(self, *args, **kwargs): - """Perform a string formatting operation. - - :rtype: unicode - """ - return '' - - def index(self, sub, start=None, end=None): - """Like find(), but raise ValueError when the substring is not - found. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def isalnum(self): - """Return true if all characters in the string are alphanumeric and - there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isalpha(self): - """Return true if all characters in the string are alphabetic and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isdigit(self): - """Return true if all characters in the string are digits and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def islower(self): - """Return true if all cased characters in the string are lowercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def isspace(self): - """Return true if there are only whitespace characters in the - string and there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def istitle(self): - """Return true if the string is a titlecased string and there is at - least one character, for example uppercase characters may only - follow uncased characters and lowercase characters only cased ones. - - :rtype: bool - """ - return False - - def isupper(self): - """Return true if all cased characters in the string are uppercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def join(self, iterable): - """Return a string which is the concatenation of the strings in the - iterable. - - :type iterable: collections.Iterable[string] - :rtype: unicode - """ - return '' - - def ljust(self, width, fillchar=' '): - """Return the string left justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: string - :rtype: unicode - """ - return '' - - def lower(self): - """Return a copy of the string with all the cased characters - converted to lowercase. - - :rtype: unicode - """ - return '' - - def lstrip(self, chars=None): - """Return a copy of the string with leading characters removed. - - :type chars: string | None - :rtype: unicode - """ - return '' - - def partition(self, sep): - """Split the string at the first occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: string - :rtype: (unicode, unicode, unicode) - """ - return '', '', '' - - def replace(self, old, new, count=-1): - """Return a copy of the string with all occurrences of substring - old replaced by new. - - :type old: string - :type new: string - :type count: numbers.Integral - :rtype: unicode - """ - return '' - - def rfind(self, sub, start=None, end=None): - """Return the highest index in the string where substring sub is - found, such that sub is contained within s[start:end]. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rindex(self, sub, start=None, end=None): - """Like rfind(), but raise ValueError when the substring is not - found. - - :type sub: string - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rjust(self, width, fillchar=' '): - """Return the string right justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: string - :rtype: unicode - """ - return '' - - def rpartition(self, sep): - """Split the string at the last occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: string - :rtype: (unicode, unicode, unicode) - """ - return '', '', '' - - def rsplit(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: string | None - :type maxsplit: numbers.Integral - :rtype: list[unicode] - """ - return [] - - def rstrip(self, chars=None): - """Return a copy of the string with trailing characters removed. - - :type chars: string | None - :rtype: unicode - """ - return '' - - def split(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: string | None - :type maxsplit: numbers.Integral - :rtype: list[unicode] - """ - return [] - - def splitlines(self, keepends=False): - """Return a list of the lines in the string, breaking at line - boundaries. - - :type keepends: bool - :rtype: list[unicode] - """ - return [] - - def startswith(self, prefix, start=None, end=None): - """Return True if string starts with the prefix, otherwise return - False. - - :type prefix: string | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def strip(self, chars=None): - """Return a copy of the string with the leading and trailing - characters removed. - - :type chars: string | None - :rtype: unicode - """ - return '' - - def swapcase(self): - """Return a copy of the string with uppercase characters converted - to lowercase and vice versa. - - :rtype: unicode - """ - return '' - - def title(self): - """Return a titlecased version of the string where words start with - an uppercase character and the remaining characters are lowercase. - - :rtype: unicode - """ - return '' - - def upper(self): - """Return a copy of the string with all the cased characters - converted to uppercase. - - :rtype: unicode - """ - return '' - - def zfill(self, width): - """Return the numeric string left filled with zeros in a string of - length width. - - :type width: numbers.Integral - :rtype: unicode - """ - return '' - - -class list(object): - """List object.""" - - def __init__(self, iterable=None): - """Create a list object. - - :type iterable: collections.Iterable[T] - :rtype: list[T] - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: list[T] - :rtype: list[T] - """ - return [] - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: list[T] - """ - return [] - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: list[T] - """ - return [] - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - return [] - - def __getitem__(self, y): - """y-th item of x or sublist, origin 0. - - :type y: numbers.Integral | slice - :rtype: T | list[T] - """ - pass - - def __setitem__(self, i, y): - """Item i is replaced by y. - - :type i: numbers.Integral - :type y: T - :rtype: None - """ - pass - - def __delitem__(self, i): - """Remove i-th item. - - :type i: numbers.Integral - :rtype: None - """ - pass - - def append(self, x): - """Appends x to the end of the sequence. - - :type x: T - :rtype: None - """ - pass - - def extend(self, t): - """Extends the sequence with the contents of t. - - :type t: collections.Iterable[T] - :rtype: None - """ - pass - - def count(self, x): - """Total number of occurrences of x in the sequence. - - :type x: T - :rtype: int - """ - return 0 - - def index(self, x, i=None, j=None): - """Index of the first occurrence of x in the sequence. - - :type x: T - :type i: numbers.Integral | None - :type j: numbers.Integral | none - :rtype: int - """ - return 0 - - def insert(self, i, x): - """Inserts x into the sequence at the index given by i. - - :type i: numbers.Number - :type x: T - :rtype: None - """ - pass - - def pop(self, i=-1): - """Retrieves the item at i and also removes it from the sequence. - - :type i: numbers.Number - :rtype: T - """ - pass - - def remove(self, x): - """Remove the first item x from the sequence. - - :type x: T - :rtype: None - """ - pass - - def sort(self, cmp=None, key=None, reverse=False): - """Sort the items of the sequence in place. - - :type cmp: ((T, T) -> int) | None - :type key: ((T) -> object) | None - :type reverse: bool - :rtype: None - """ - pass - - -class set(object): - """Set object.""" - - def __init__(self, iterable=None): - """Create a set object. - - :type iterable: collections.Iterable[T] - :rtype: set[T] - """ - pass - - def add(self, x): - """Add an element x to a set. - - :type x: T - :rtype: None - """ - pass - - def discard(self, x): - """Remove an element x from the set, do nothing if it's not present. - - :type x: T - :rtype: None - """ - pass - - def remove(self, x): - """Remove an element x from the set, raise KeyError if it's not present. - - :type x: T - :rtype: None - """ - pass - - def pop(self): - """Remove and return arbitrary element from the set. - - :rtype: T - """ - pass - - def copy(self): - """Return shallow copy of the set. - - :rtype: set[T] - """ - pass - - def clear(self): - """Delete all elements from the set. - - :rtype: None - """ - pass - - def union(self, *other): - """Return the union of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __or__(self, other): - """Return the union of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def update(self, *other): - """Update a set with the union of itself and other collections. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def difference(self, *other): - """Return the difference of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __sub__(self, other): - """Return the difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def difference_update(self, *other): - """Remove all elements of other collections from this set. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def symmetric_difference(self, other): - """Return the symmetric difference of this set and another collection as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __xor__(self, other): - """Return the symmetric difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def symmetric_difference_update(self, other): - """Update the set with the symmetric difference of itself and another collection. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def intersection(self, *other): - """Return the intersection of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __and__(self, other): - """Return the intersection of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def intersection_update(self, *other): - """Update a set with the intersection of itself and other collections. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def isdisjoint(self, other): - """Return True if this set and another collection have a null intersection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def issubset(self, other): - """Report whether another collection contains this set. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __le__(self, other): - """Report whether another set contains this set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __lt__(self, other): - """Report whether this set is a proper subset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def issuperset(self, other): - """Report whether this set contains another collection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __ge__(self, other): - """Report whether this set contains other set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __gt__(self, other): - """Report whether this set is a proper superset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - -class frozenset(object): - """frozenset object.""" - - def __init__(self, iterable=None): - """Create a frozenset object. - - :type iterable: collections.Iterable[T] - :rtype: frozenset[T] - """ - pass - - def copy(self): - """Return shallow copy of the set. - - :rtype: set[T] - """ - pass - - def union(self, *other): - """Return the union of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __or__(self, other): - """Return the union of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def difference(self, *other): - """Return the difference of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __sub__(self, other): - """Return the difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def symmetric_difference(self, other): - """Return the symmetric difference of this set and another collection as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __xor__(self, other): - """Return the symmetric difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def intersection(self, *other): - """Return the intersection of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __and__(self, other): - """Return the intersection of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def isdisjoint(self, other): - """Return True if this set and another collection have a null intersection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def issubset(self, other): - """Report whether another collection contains this set. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __le__(self, other): - """Report whether another set contains this set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __lt__(self, other): - """Report whether this set is a proper subset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def issuperset(self, other): - """Report whether this set contains another collection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __ge__(self, other): - """Report whether this set contains other set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __gt__(self, other): - """Report whether this set is a proper superset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - -class tuple(object): - """Tuple object.""" - - def __add__(self, y): - """The concatenation of x and y. - - :type y: tuple - :rtype: tuple - """ - pass - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: tuple - """ - pass - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: tuple - """ - pass - - def __getitem__(self, y): - """y-th item of x or subtuple, origin 0. - - :type y: numbers.Integral | slice - :rtype: object | tuple | unknown - """ - pass - - def count(self, x): - """Total number of occurrences of x in the sequence. - - :type x: object - :rtype: int - """ - return 0 - - def index(self, x, i=None, j=None): - """Index of the first occurrence of x in the sequence. - - :type x: object - :type i: numbers.Integral | None - :type j: numbers.Integral | none - :rtype: int - """ - return 0 - - def __iter__(self): - """ - :rtype: collections.Iterator[object | unknown] - """ - pass - - -class dict(object): - """Dictionary object.""" - - def __init__(self, iterable=None, **kwargs): - """Create a dictionary object. - - :type iterable: collections.Iterable[(T, V)] - :rtype: dict[T, V] - """ - pass - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - def __len__(self): - """Return the number of items in the dictionary d. - - :rtype: int - """ - return 0 - - def __getitem__(self, key): - """Return the item of d with key key. - - :type key: T - :rtype: V - """ - pass - - def __setitem__(self, key, value): - """Set d[key] to value. - - :type key: T - :type value: V - :rtype: None - """ - pass - - def __delitem__(self, key): - """Remove d[key] from d. - - :type key: T - :rtype: None - """ - pass - - def copy(self): - """Return a shallow copy of the dictionary. - - :rtype: dict[T, V] - """ - return self - - @staticmethod - def fromkeys(seq, value=None): - """Create a new dictionary with keys from seq and values set to value. - - :type seq: collections.Iterable[T] - :type value: V - :rtype: dict[T, V] - """ - return {} - - def get(self, key, default=None): - """Return the value for key if key is in the dictionary, else default. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def has_key(self, key): - """Return True if d has a key key, else False. - - :type key: T - :rtype: bool - """ - return False - - def items(self): - """Return a copy of the dictionary's list of (key, value) pairs. - - :rtype: list[(T, V)] - """ - return [] - - def iteritems(self): - """Return an iterator over the dictionary's (key, value) pairs. - - :rtype: collections.Iterable[(T, V)] - """ - return [] - - def iterkeys(self): - """Return an iterator over the dictionary's keys. - - :rtype: collections.Iterable[T] - """ - return [] - - def itervalues(self): - """Return an iterator over the dictionary's values. - - :rtype: collections.Iterable[V] - """ - return [] - - def keys(self): - """Return a copy of the dictionary's list of keys. - - :rtype: list[T] - """ - return [] - - def pop(self, key, default=None): - """If key is in the dictionary, remove it and return its value, else - return default. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def popitem(self): - """Remove and return an arbitrary (key, value) pair from the - dictionary. - - :rtype: (T, V) - """ - pass - - def setdefault(self, key, default=None): - """If key is in the dictionary, return its value. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def update(self, other=None, **kwargs): - """Update the dictionary with the key/value pairs from other, - overwriting existing keys. - - :type other: dict[T, V] | collections.Iterable[(T, V)] - :rtype: None - """ - pass - - def values(self): - """Return a copy of the dictionary's list of values. - - :rtype: list[V] - """ - return [] - - -class file(object): - """File object.""" - - def __init__(self, name, mode='r', buffering=-1): - """Create a file object. - - :type name: string - :type mode: string - :type buffering: numbers.Integral - """ - self.name = name - self.mode = mode - - def fileno(self): - """Return the integer "file descriptor" that is used by the - underlying implementation to request I/O operations from the - operating system. - - :rtype: int - """ - return 0 - - def isatty(self): - """Return True if the file is connected to a tty(-like) device, - else False. - - :rtype: bool - """ - return False - - def next(self): - """Returns the next input line. - - :rtype: bytes - """ - return '' - - def read(self, size=-1): - """Read at most size bytes from the file (less if the read hits EOF - before obtaining size bytes). - - :type size: numbers.Integral - :rtype: bytes - """ - return '' - - def readline(self, size=-1): - """Read one entire line from the file. - - :type size: numbers.Integral - :rtype: bytes - """ - return '' - - def readlines(self, sizehint=-1): - """Read until EOF using readline() and return a list containing the - lines thus read. - - :type sizehint: numbers.Integral - :rtype: list[bytes] - """ - return [] - - def xreadlines(self): - """This method returns the same thing as iter(f). - - :rtype: collections.Iterable[bytes] - """ - return [] - - def seek(self, offset, whence=0): - """Set the file's current position, like stdio's fseek(). - - :type offset: numbers.Integral - :type whence: numbers.Integral - :rtype: None - """ - pass - - def tell(self): - """Return the file's current position, like stdio's ftell(). - - :rtype: int - """ - return 0 - - def truncate(self, size=-1): - """Truncate the file's size. - - :type size: numbers.Integral - :rtype: None - """ - pass - - def write(self, str): - """"Write a string to the file. - - :type str: bytes - :rtype: None - """ - pass - - def writelines(self, sequence): - """Write a sequence of strings to the file. - - :type sequence: collections.Iterable[bytes] - :rtype: None - """ - pass - - def __iter__(self): - """ - :rtype: collections.Iterator[bytes] - """ - pass - - -class __generator(object): - """A mock class representing the generator function type.""" - def __init__(self): - """Create a generator object. - - :rtype: __generator[T, U, V] - """ - self.gi_code = None - self.gi_frame = None - self.gi_running = 0 - - def __iter__(self): - """Defined to support iteration over container. - - :rtype: collections.Iterator[T] - """ - pass - - def next(self): - """Return the next item from the container. - - :rtype: T - """ - pass - - def close(self): - """Raises new GeneratorExit exception inside the generator to - terminate the iteration. - - :rtype: None - """ - pass - - def send(self, value): - """Resumes the generator and "sends" a value that becomes the - result of the current yield-expression. - - :type value: U - :rtype: None - """ - pass - - def throw(self, type, value=None, traceback=None): - """Used to raise an exception inside the generator. - - :rtype: None - """ - pass - - -class __function(object): - """A mock class representing function type.""" - - def __init__(self): - self.__name__ = '' - self.__doc__ = '' - self.__dict__ = '' - self.__module__ = '' - - self.func_defaults = {} - self.func_globals = {} - self.func_closure = None - self.func_code = None - self.func_name = '' - self.func_doc = '' - self.func_dict = '' - - if sys.version_info >= (2, 6): - self.__defaults__ = {} - self.__globals__ = {} - self.__closure__ = None - self.__code__ = None - - -class __method(object): - """A mock class representing method type (both bound and unbound).""" - - def __init__(self): - self.im_class = None - self.im_self = None - self.im_func = None - - if sys.version_info >= (2, 6): - self.__func__ = None - self.__self__ = None - - -def input(prompt=None): - """ - :type prompt: Any - :rtype: Any - """ - pass - - -def raw_input(prompt=None): - """ - :type prompt: Any - :rtype: str - """ - pass \ No newline at end of file diff --git a/python/helpers/python-skeletons/builtins.py b/python/helpers/python-skeletons/builtins.py deleted file mode 100644 index 2e0bc3407b1b..000000000000 --- a/python/helpers/python-skeletons/builtins.py +++ /dev/null @@ -1,2598 +0,0 @@ -"""Skeletons for Python 3 built-in symbols.""" - - -import os - - -def abs(number): - """Return the absolute value of the argument. - - :type number: T - :rtype: T | unknown - """ - return number - - -def all(iterable): - """Return True if bool(x) is True for all values x in the iterable. - - :type iterable: collections.Iterable - :rtype: bool - """ - return False - - -def any(iterable): - """Return True if bool(x) is True for any x in the iterable. - - :type iterable: collections.Iterable - :rtype: bool - """ - return False - - -def bin(number): - """Return the binary representation of an integer or long integer. - - :type number: numbers.Number - :rtype: str - """ - return '' - - -def callable(object): - """Return whether the object is callable (i.e., some kind of function). - Note that classes are callable, as are instances with a __call__() method. - - :rtype: bool - """ - return False - - -def chr(i): - """Return a string of one character with ordinal i; 0 <= i < 256. - - :type i: numbers.Integral - :rtype: str - """ - return '' - - -def dir(object=None): - """If called without an argument, return the names in the current scope. - Else, return an alphabetized list of names comprising (some of) the - attributes of the given object, and of attributes reachable from it. - - :rtype: list[str] - """ - return [] - - -def divmod(x, y): - """Return the tuple ((x-x%y)/y, x%y). - - :type x: numbers.Number - :type y: numbers.Number - :rtype: (int | long | float | unknown, int | long | float | unknown) - """ - return 0, 0 - - -def filter(function_or_none, sequence): - """Return those items of sequence for which function(item) is true. If - function is None, return the items that are true. If sequence is a tuple - or string, return the same type, else return a list. - - :type function_or_none: collections.Callable | None - :type sequence: T <= list | collections.Iterable | bytes | str - :rtype: T - """ - return sequence - - -def getattr(object, name, default=None): - """Get a named attribute from an object; getattr(x, 'y') is equivalent to - x.y. When a default argument is given, it is returned when the attribute - doesn't exist; without it, an exception is raised in that case. - - :type name: str - """ - pass - - -def globals(): - """Return the dictionary containing the current scope's global variables. - - :rtype: dict[str, unknown] - """ - return {} - - -def hasattr(object, name): - """Return whether the object has an attribute with the given name. - - :type name: str - :rtype: bool - """ - return False - - -def hash(object): - """Return a hash value for the object. - - :rtype: int - """ - return 0 - - -def hex(number): - """Return the hexadecimal representation of an integer or long integer. - - :type number: numbers.Integral - :rtype: str - """ - return '' - - -def id(object): - """Return the identity of an object. - - :rtype: int - """ - return 0 - - -def isinstance(object, class_or_type_or_tuple): - """Return whether an object is an instance of a class or of a subclass - thereof. - - :rtype: bool - """ - return False - - -def issubclass(C, B): - """Return whether class C is a subclass (i.e., a derived class) of class B. - - :rtype: bool - """ - return False - - -def iter(object, sentinel=None): - """Get an iterator from an object. In the first form, the argument must - supply its own iterator, or be a sequence. In the second form, the callable - is called until it returns the sentinel. - - :type object: collections.Iterable[T] | (() -> object) - :type sentinel: object | None - :rtype: collections.Iterator[T] - """ - return [] - - -def len(object): - """Return the number of items of a sequence or mapping. - - :type object: collections.Sized - :rtype: int - """ - return 0 - - -def locals(): - """Update and return a dictionary containing the current scope's local - variables. - - :rtype: dict[str, unknown] - """ - return {} - - -class map(object): - def __init__(self, function, sequence, *sequence_1): - """Return an iterable of the results of applying the function to the items of - the argument sequence(s). - - :type function: None | (T) -> V - :type sequence: collections.Iterable[T] - :rtype: map[T, V] - """ - pass - - def __iter__(self): - """ - :rtype: collections.Iterator[V] - """ - return self - - def __next__(self): - """ - :rtype: V - """ - pass - -def min(*args, key=None, default=None): - """Return the smallest item in an iterable or the smallest of two or more - arguments. - - :type args: T - :rtype: T - """ - pass - - -def max(*args, key=None, default=None): - """Return the largest item in an iterable or the largest of two or more - arguments. - - :type args: T - :rtype: T - """ - pass - - -def sum(iterable, start=0): - """Sums start and the items of an iterable from left to right and returns - the total. - - :type iterable: collections.Iterable[T] - :rtype: T - """ - pass - - -def next(iterator, default=None): - """Return the next item from the iterator. - - :type iterator: collections.Iterator[T] - :rtype: T - """ - pass - - -def oct(number): - """Return the octal representation of an integer or long integer. - - :type number: numbers.Integral - :rtype: str - """ - return '' - - -def open(name, mode='r', buffering=-1, encoding=None, errors=None, newline=None, - closefd=None, opener=None): - """Open a file, returns a file object. - - :type name: str | os.PathLike - :type mode: str - :type buffering: numbers.Integral - :type encoding: str | None - :type errors: str | None - :rtype: file - """ - return file() - - -def ord(c): - """Return the integer ordinal of a one-character string. - - :type c: bytes | str - :rtype: int - """ - return 0 - - -def pow(x, y, z=None): - """With two arguments, equivalent to x**y. With three arguments, - equivalent to (x**y) % z, but may be more efficient (e.g. for longs). - - :type x: numbers.Number - :type y: numbers.Number - :type z: numbers.Number | None - :rtype: int | long | float | complex - """ - return 0 - - -def print(*objects, sep=' ', end='\n', file=None, flush=False): - """Print objects to the stream file, separated by sep and followed by end. - - :type sep: str - :type end: str - :type flush: bool - :rtype: None - """ - pass - - -class range(object): - """range object.""" - - def __init__(self, start, stop=None, step=None): - """Create a range object. - - :type start: numbers.Integral - :type stop: numbers.Integral | None - :type step: numbers.Integral | None - :rtype: range[int] - """ - pass - - -def repr(object): - """ - Return the canonical string representation of the object. - - :rtype: str - """ - return '' - - -def round(number, ndigits=None): - """Round a number to a given precision in decimal digits (default 0 digits). - - :type number: object - :type ndigits: numbers.Integral | None - :rtype: float - """ - return 0.0 - - -class slice(object): - def __init__(self, start, stop=None, step=None): - """Create a slice object. This is used for extended slicing (e.g. - a[0:10:2]). - - :type start: numbers.Integral - :type stop: numbers.Integral | None - :type step: numbers.Integral | None - """ - return - - -def vars(object=None): - """Without arguments, equivalent to locals(). With an argument, equivalent - to object.__dict__. - - :rtype: dict[str, unknown] - """ - return {} - - -class object: - """ The most base type.""" - - @staticmethod - def __new__(cls, *more): - """Create a new object. - - :type cls: T - :rtype: T - """ - pass - - -class type(object): - """Type of object.""" - - def __instancecheck__(cls, instance): - """Return true if instance should be considered a (direct or indirect) - instance of class. - """ - return False - - def __subclasscheck__(cls, subclass): - """Return true if subclass should be considered a (direct or indirect) - subclass of class. - """ - return False - - @staticmethod - def __prepare__(metacls, name, bases): - """Used to create the namespace for the class statement. - - :rtype: dict[str, unknown] - """ - return {} - - -class enumerate(object): - """enumerate object.""" - - def __init__(self, iterable, start=0): - """Create an enumerate object. - - :type iterable: collections.Iterable[T] - :type start: int | long - :rtype: enumerate[T] - """ - pass - - def next(self): - """Return the next value, or raise StopIteration. - - :rtype: (int, T) - """ - pass - - def __iter__(self): - """x.__iter__() <==> iter(x). - - :rtype: collections.Iterator[(int, T)] - """ - return self - - -class int(object): - """Integer numeric type.""" - - def __init__(self, x=None, base=10): - """Convert a number or string x to an integer, or return 0 if no - arguments are given. - - :type x: object - :type base: numbers.Integral - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __pow__(self, y, modulo=None): - """x to the power y. - - :type y: numbers.Number - :type modulo: numbers.Integral | None - :rtype: int - """ - return 0 - - def __lshift__(self, n): - """x shifted left by n bits. - - :type n: numbers.Integral - :rtype: int - """ - return 0 - - def __rshift__(self, n): - """x shifted right by n bits. - - :type n: numbers.Integral - :rtype: int - """ - return 0 - - def __and__(self, y): - """Bitwise and of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __or__(self, y): - """Bitwise or of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __xor__(self, y): - """Bitwise exclusive or of x and y. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rlshift__(self, y): - """y shifted left by x bits. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rrshift__(self, y): - """y shifted right by n bits. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rand__(self, y): - """Bitwise and of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __ror__(self, y): - """Bitwise or of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rxor__(self, y): - """Bitwise exclusive or of y and x. - - :type y: numbers.Integral - :rtype: int - """ - return 0 - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: int - """ - return 0 - - def __pos__(self): - """x unchanged. - - :rtype: int - """ - return 0 - - def __neg__(self): - """x negated. - - :rtype: int - """ - return 0 - - def __invert__(self): - """The bits of x inverted. - - :rtype: int - """ - return 0 - - -class float(object): - """Floating point numeric type.""" - - def __init__(self, x=None): - """Convert a string or a number to floating point. - - :type x: object - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __pow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: float - """ - return 0.0 - - def __pos__(self): - """x unchanged. - - :rtype: float - """ - return 0.0 - - def __neg__(self): - """x negated. - - :rtype: float - """ - return 0.0 - - @staticmethod - def fromhex(string): - """Create a floating-point number from a hexadecimal string. - - :type string: str - :rtype: float - """ - pass - - -class complex(object): - """Complex numeric type.""" - - def __init__(self, real=None, imag=None): - """Create a complex number with the value real + imag*j or convert a - string or number to a complex number. - - :type real: object - :type imag: object - """ - pass - - def __add__(self, y): - """Sum of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __sub__(self, y): - """Difference of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __mul__(self, y): - """Product of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __floordiv__(self, y): - """Floored quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __mod__(self, y): - """Remainder of x / y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __pow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __div__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __truediv__(self, y): - """Quotient of x and y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __radd__(self, y): - """Sum of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rsub__(self, y): - """Difference of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rmul__(self, y): - """Product of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rfloordiv__(self, y): - """Floored quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rmod__(self, y): - """Remainder of y / x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rpow__(self, y): - """x to the power y. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rdiv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __rtruediv__(self, y): - """Quotient of y and x. - - :type y: numbers.Number - :rtype: complex - """ - return 0j - - def __pos__(self): - """x unchanged. - - :rtype: complex - """ - return 0j - - def __neg__(self): - """x negated. - - :rtype: complex - """ - return 0j - - -class bytes(object): - """Bytes object.""" - - def __init__(self, source='', encoding='utf8', errors='strict'): - """Construct an immutable array of bytes. - - :type source: object - :type encoding: str - :type errors: str - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: bytes - :rtype: bytes - """ - return b'' - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: bytes - """ - return b'' - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: bytes - """ - return b'' - - def __getitem__(self, y): - """y-th item of x or substring, origin 0. - - :type y: numbers.Integral | slice - :rtype: int | bytes - """ - return 0 - - def __iter__(self): - """Iterator over bytes. - - :rtype: collections.Iterator[int] - """ - return [] - - def capitalize(self): - """Return a copy of the string with its first character capitalized - and the rest lowercased. - - :rtype: bytes - """ - return b'' - - def center(self, width, fillchar=' '): - """Return centered in a string of length width. - - :type width: numbers.Integral - :type fillchar: bytes - :rtype: bytes - """ - return b'' - - def count(self, sub, start=None, end=None): - """Return the number of non-overlapping occurrences of substring - sub in the range [start, end]. - - :type sub: bytes - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: int - """ - return 0 - - def decode(self, encoding='utf-8', errors='strict'): - """Return a string decoded from the given bytes. - - :type encoding: str - :type errors: str - :rtype: str - """ - return '' - - def endswith(self, suffix, start=None, end=None): - """Return True if the string ends with the specified suffix, - otherwise return False. - - :type suffix: bytes | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def find(self, sub, start=None, end=None): - """Return the lowest index in the string where substring sub is - found, such that sub is contained in the slice s[start:end]. - - :type sub: bytes - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def index(self, sub, start=None, end=None): - """Like find(), but raise ValueError when the substring is not - found. - - :type sub: bytes - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def isalnum(self): - """Return true if all characters in the string are alphanumeric and - there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isalpha(self): - """Return true if all characters in the string are alphabetic and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isdigit(self): - """Return true if all characters in the string are digits and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def islower(self): - """Return true if all cased characters in the string are lowercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def isspace(self): - """Return true if there are only whitespace characters in the - string and there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def istitle(self): - """Return true if the string is a titlecased string and there is at - least one character, for example uppercase characters may only - follow uncased characters and lowercase characters only cased ones. - - :rtype: bool - """ - return False - - def isupper(self): - """Return true if all cased characters in the string are uppercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def join(self, iterable): - """Return a string which is the concatenation of the strings in the - iterable. - - :type iterable: collections.Iterable[bytes] - :rtype: bytes - """ - return b'' - - def ljust(self, width, fillchar=' '): - """Return the string left justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: bytes - :rtype: bytes - """ - return b'' - - def lower(self): - """Return a copy of the string with all the cased characters - converted to lowercase. - - :rtype: bytes - """ - return b'' - - def lstrip(self, chars=None): - """Return a copy of the string with leading characters removed. - - :type chars: bytes | None - :rtype: bytes - """ - return b'' - - def partition(self, sep): - """Split the string at the first occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: bytes - :rtype: (bytes, bytes, bytes) - """ - return b'', b'', b'' - - def replace(self, old, new, count=-1): - """Return a copy of the string with all occurrences of substring - old replaced by new. - - :type old: bytes - :type new: bytes - :type count: numbers.Integral - :rtype: bytes - """ - return b'' - - def rfind(self, sub, start=None, end=None): - """Return the highest index in the string where substring sub is - found, such that sub is contained within s[start:end]. - - :type sub: bytes - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rindex(self, sub, start=None, end=None): - """Like rfind(), but raise ValueError when the substring is not - found. - - :type sub: bytes - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rjust(self, width, fillchar=' '): - """Return the string right justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: bytes - :rtype: bytes - """ - return b'' - - def rpartition(self, sep): - """Split the string at the last occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: bytes - :rtype: (bytes, bytes, bytes) - """ - return b'', b'', b'' - - def rsplit(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: bytes | None - :type maxsplit: numbers.Integral - :rtype: list[bytes] - """ - return [] - - def rstrip(self, chars=None): - """Return a copy of the string with trailing characters removed. - - :type chars: bytes | None - :rtype: bytes - """ - return b'' - - def split(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: bytes | None - :type maxsplit: numbers.Integral - :rtype: list[bytes] - """ - return [] - - def splitlines(self, keepends=False): - """Return a list of the lines in the string, breaking at line - boundaries. - - :type keepends: bool - :rtype: list[bytes] - """ - return [] - - def startswith(self, prefix, start=None, end=None): - """Return True if string starts with the prefix, otherwise return - False. - - :type prefix: bytes | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def strip(self, chars=None): - """Return a copy of the string with the leading and trailing - characters removed. - - :type chars: bytes | None - :rtype: bytes - """ - return b'' - - def swapcase(self): - """Return a copy of the string with uppercase characters converted - to lowercase and vice versa. - - :rtype: bytes - """ - return b'' - - def title(self): - """Return a titlecased version of the string where words start with - an uppercase character and the remaining characters are lowercase. - - :rtype: bytes - """ - return b'' - - def upper(self): - """Return a copy of the string with all the cased characters - converted to uppercase. - - :rtype: bytes - """ - return b'' - - def zfill(self, width): - """Return the numeric string left filled with zeros in a string of - length width. - - :type width: numbers.Integral - :rtype: bytes - """ - return b'' - - -class str(object): - """String object.""" - - def __init__(self, object='', encoding='utf-8', errors='strict'): - """Construct an immutable string. - - :type object: object - :type encoding: str - :type errors: str - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: str - :rtype: str - """ - return '' - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: str - """ - return '' - - def __mod__(self, y): - """x % y. - - :rtype: str - """ - return '' - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: str - """ - return '' - - def __getitem__(self, y): - """y-th item of x or substring, origin 0. - - :type y: numbers.Integral | slice - :rtype: str - """ - return '' - - def __iter__(self): - """Iterator over bytes. - - :rtype: collections.Iterator[str] - """ - return [] - - def capitalize(self): - """Return a copy of the string with its first character capitalized - and the rest lowercased. - - :rtype: str - """ - return '' - - def center(self, width, fillchar=' '): - """Return centered in a string of length width. - - :type width: numbers.Integral - :type fillchar: str - :rtype: str - """ - return '' - - def count(self, sub, start=None, end=None): - """Return the number of non-overlapping occurrences of substring - sub in the range [start, end]. - - :type sub: str - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: int - """ - return 0 - - def encode(self, encoding='utf-8', errors='strict'): - """Return an encoded version of the string as a bytes object. - - :type encoding: str - :type errors: str - :rtype: bytes - """ - return b'' - - def endswith(self, suffix, start=None, end=None): - """Return True if the string ends with the specified suffix, - otherwise return False. - - :type suffix: str | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def find(self, sub, start=None, end=None): - """Return the lowest index in the string where substring sub is - found, such that sub is contained in the slice s[start:end]. - - :type sub: str - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def format(self, *args, **kwargs): - """Perform a string formatting operation. - - :rtype: str - """ - return '' - - def index(self, sub, start=None, end=None): - """Like find(), but raise ValueError when the substring is not - found. - - :type sub: str - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def isalnum(self): - """Return true if all characters in the string are alphanumeric and - there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isalpha(self): - """Return true if all characters in the string are alphabetic and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def isdigit(self): - """Return true if all characters in the string are digits and there - is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def islower(self): - """Return true if all cased characters in the string are lowercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def isspace(self): - """Return true if there are only whitespace characters in the - string and there is at least one character, false otherwise. - - :rtype: bool - """ - return False - - def istitle(self): - """Return true if the string is a titlecased string and there is at - least one character, for example uppercase characters may only - follow uncased characters and lowercase characters only cased ones. - - :rtype: bool - """ - return False - - def isupper(self): - """Return true if all cased characters in the string are uppercase - and there is at least one cased character, false otherwise. - - :rtype: bool - """ - return False - - def join(self, iterable): - """Return a string which is the concatenation of the strings in the - iterable. - - :type iterable: collections.Iterable[str] - :rtype: str - """ - return '' - - def ljust(self, width, fillchar=' '): - """Return the string left justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: str - :rtype: str - """ - return '' - - def lower(self): - """Return a copy of the string with all the cased characters - converted to lowercase. - - :rtype: str - """ - return '' - - def lstrip(self, chars=None): - """Return a copy of the string with leading characters removed. - - :type chars: str | None - :rtype: str - """ - return '' - - def partition(self, sep): - """Split the string at the first occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: str - :rtype: (str, str, str) - """ - return '', '', '' - - def replace(self, old, new, count=-1): - """Return a copy of the string with all occurrences of substring - old replaced by new. - - :type old: str - :type new: str - :type count: numbers.Integral - :rtype: str - """ - return '' - - def rfind(self, sub, start=None, end=None): - """Return the highest index in the string where substring sub is - found, such that sub is contained within s[start:end]. - - :type sub: str - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rindex(self, sub, start=None, end=None): - """Like rfind(), but raise ValueError when the substring is not - found. - - :type sub: str - :type start: numbers.Integral | None - :type end: numbers.Integral | none - :rtype: int - """ - return 0 - - def rjust(self, width, fillchar=' '): - """Return the string right justified in a string of length width. - Padding is done using the specified fillchar (default is a space). - - :type width: numbers.Integral - :type fillchar: str - :rtype: str - """ - return '' - - def rpartition(self, sep): - """Split the string at the last occurrence of sep, and return a - 3-tuple containing the part before the separator, the separator - itself, and the part after the separator. - - :type sep: str - :rtype: (str, str, str) - """ - return '', '', '' - - def rsplit(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: str | None - :type maxsplit: numbers.Integral - :rtype: list[str] - """ - return [] - - def rstrip(self, chars=None): - """Return a copy of the string with trailing characters removed. - - :type chars: str | None - :rtype: str - """ - return '' - - def split(self, sep=None, maxsplit=-1): - """Return a list of the words in the string, using sep as the - delimiter string. - - :type sep: str | None - :type maxsplit: numbers.Integral - :rtype: list[str] - """ - return [] - - def splitlines(self, keepends=False): - """Return a list of the lines in the string, breaking at line - boundaries. - - :type keepends: bool - :rtype: list[str] - """ - return [] - - def startswith(self, prefix, start=None, end=None): - """Return True if string starts with the prefix, otherwise return - False. - - :type prefix: str | tuple - :type start: numbers.Integral | None - :type end: numbers.Integral | None - :rtype: bool - """ - return False - - def strip(self, chars=None): - """Return a copy of the string with the leading and trailing - characters removed. - - :type chars: str | None - :rtype: str - """ - return '' - - def swapcase(self): - """Return a copy of the string with uppercase characters converted - to lowercase and vice versa. - - :rtype: str - """ - return '' - - def title(self): - """Return a titlecased version of the string where words start with - an uppercase character and the remaining characters are lowercase. - - :rtype: str - """ - return '' - - def upper(self): - """Return a copy of the string with all the cased characters - converted to uppercase. - - :rtype: str - """ - return '' - - def zfill(self, width): - """Return the numeric string left filled with zeros in a string of - length width. - - :type width: numbers.Integral - :rtype: str - """ - return '' - - -class list(object): - """List object.""" - - def __init__(self, iterable=None): - """Create a list object. - - :type iterable: collections.Iterable[T] - :rtype: list[T] - """ - pass - - def __add__(self, y): - """The concatenation of x and y. - - :type y: list[T] - :rtype: list[T] - """ - return [] - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: list[T] - """ - return [] - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: list[T] - """ - return [] - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - return [] - - def __getitem__(self, y): - """y-th item of x or sublist, origin 0. - - :type y: numbers.Integral | slice - :rtype: T | list[T] - """ - pass - - def __setitem__(self, i, y): - """Item i is replaced by y. - - :type i: numbers.Integral - :type y: T - :rtype: None - """ - pass - - def __delitem__(self, i): - """Remove i-th item. - - :type i: numbers.Integral - :rtype: None - """ - - def append(self, x): - """Appends x to the end of the sequence. - - :type x: T - :rtype: None - """ - pass - - def extend(self, t): - """Extends the sequence with the contents of t. - - :type t: collections.Iterable[T] - :rtype: None - """ - pass - - def count(self, x): - """Total number of occurrences of x in the sequence. - - :type x: T - :rtype: int - """ - return 0 - - def index(self, x, i=None, j=None): - """Index of the first occurrence of x in the sequence. - - :type x: T - :type i: numbers.Integral | None - :type j: numbers.Integral | none - :rtype: int - """ - return 0 - - def insert(self, i, x): - """Inserts x into the sequence at the index given by i. - - :type i: numbers.Number - :type x: T - :rtype: None - """ - pass - - def pop(self, i=-1): - """Retrieves the item at i and also removes it from the sequence. - - :type i: numbers.Number - :rtype: T - """ - pass - - def remove(self, x): - """Remove the first item x from the sequence. - - :type x: T - :rtype: None - """ - pass - - def sort(self, cmp=None, key=None, reverse=False): - """Sort the items of the sequence in place. - - :type cmp: ((T, T) -> int) | None - :type key: ((T) -> object) | None - :type reverse: bool - :rtype: None - """ - pass - - -class set(object): - """Set object.""" - - def __init__(self, iterable=None): - """Create a set object. - - :type iterable: collections.Iterable[T] - :rtype: set[T] - """ - pass - - def add(self, x): - """Add an element x to a set. - - :type x: T - :rtype: None - """ - pass - - def discard(self, x): - """Remove an element x from the set, do nothing if it's not present. - - :type x: T - :rtype: None - """ - pass - - def remove(self, x): - """Remove an element x from the set, raise KeyError if it's not present. - - :type x: T - :rtype: None - """ - pass - - def pop(self): - """Remove and return arbitrary element from the set. - - :rtype: T - """ - pass - - def copy(self): - """Return shallow copy of the set. - - :rtype: set[T] - """ - pass - - def clear(self): - """Delete all elements from the set. - - :rtype: None - """ - pass - - def union(self, *other): - """Return the union of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __or__(self, other): - """Return the union of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def update(self, *other): - """Update a set with the union of itself and other collections. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def difference(self, *other): - """Return the difference of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __sub__(self, other): - """Return the difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def difference_update(self, *other): - """Remove all elements of other collections from this set. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def symmetric_difference(self, other): - """Return the symmetric difference of this set and another collection as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __xor__(self, other): - """Return the symmetric difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def symmetric_difference_update(self, other): - """Update the set with the symmetric difference of itself and another collection. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def intersection(self, *other): - """Return the intersection of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return set() - - def __and__(self, other): - """Return the intersection of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return set() - - def intersection_update(self, *other): - """Update a set with the intersection of itself and other collections. - - :type other: collections.Iterable[T] - :rtype: None - """ - pass - - def isdisjoint(self, other): - """Return True if this set and another collection have a null intersection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def issubset(self, other): - """Report whether another collection contains this set. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __le__(self, other): - """Report whether another set contains this set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __lt__(self, other): - """Report whether this set is a proper subset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def issuperset(self, other): - """Report whether this set contains another collection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __ge__(self, other): - """Report whether this set contains other set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __gt__(self, other): - """Report whether this set is a proper superset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - -class frozenset(object): - """frozenset object.""" - - def __init__(self, iterable=None): - """Create a frozenset object. - - :type iterable: collections.Iterable[T] - :rtype: frozenset[T] - """ - pass - - def copy(self): - """Return shallow copy of the set. - - :rtype: set[T] - """ - pass - - def union(self, *other): - """Return the union of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __or__(self, other): - """Return the union of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def difference(self, *other): - """Return the difference of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __sub__(self, other): - """Return the difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def symmetric_difference(self, other): - """Return the symmetric difference of this set and another collection as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __xor__(self, other): - """Return the symmetric difference of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def intersection(self, *other): - """Return the intersection of this set and other collections as a new set. - - :type other: collections.Iterable[T] - :rtype: set[T] - """ - return frozenset() - - def __and__(self, other): - """Return the intersection of two sets as a new set. - - :type other: collections.Set[T] - :rtype: set[T] - """ - return frozenset() - - def isdisjoint(self, other): - """Return True if this set and another collection have a null intersection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def issubset(self, other): - """Report whether another collection contains this set. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __le__(self, other): - """Report whether another set contains this set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __lt__(self, other): - """Report whether this set is a proper subset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def issuperset(self, other): - """Report whether this set contains another collection. - - :type other: collections.Iterable[T] - :rtype: bool - """ - return False - - def __ge__(self, other): - """Report whether this set contains other set. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __gt__(self, other): - """Report whether this set is a proper superset of other. - - :type other: collections.Set[T] - :rtype: bool - """ - return False - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - - -class tuple(object): - """Tuple object.""" - - def __add__(self, y): - """The concatenation of x and y. - - :type y: tuple - :rtype: tuple - """ - pass - - def __mul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: tuple - """ - pass - - def __rmul__(self, n): - """n shallow copies of x concatenated. - - :type n: numbers.Integral - :rtype: tuple - """ - pass - - def __getitem__(self, y): - """y-th item of x or subtuple, origin 0. - - :type y: numbers.Integral | slice - :rtype: object | tuple | unknown - """ - pass - - def count(self, x): - """Total number of occurrences of x in the sequence. - - :type x: object - :rtype: int - """ - return 0 - - def index(self, x, i=None, j=None): - """Index of the first occurrence of x in the sequence. - - :type x: object - :type i: numbers.Integral | None - :type j: numbers.Integral | none - :rtype: int - """ - return 0 - - def __iter__(self): - """ - :rtype: collections.Iterator[object | unknown] - """ - pass - - -class dict(object): - """Dictionary object.""" - - def __init__(self, iterable=None, **kwargs): - """Create a dictionary object. - - :type iterable: collections.Iterable[(T, V)] - :rtype: dict[T, V] - """ - pass - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - def __len__(self): - """Return the number of items in the dictionary d. - - :rtype: int - """ - return 0 - - def __getitem__(self, key): - """Return the item of d with key key. - - :type key: T - :rtype: V - """ - pass - - def __setitem__(self, key, value): - """Set d[key] to value. - - :type key: T - :type value: V - :rtype: None - """ - pass - - def __delitem__(self, key): - """Remove d[key] from d. - - :type key: T - :rtype: None - """ - pass - - def copy(self): - """Return a shallow copy of the dictionary. - - :rtype: dict[T, V] - """ - return self - - @staticmethod - def fromkeys(seq, value=None): - """Create a new dictionary with keys from seq and values set to value. - - :type seq: collections.Iterable[T] - :type value: V - :rtype: dict[T, V] - """ - return {} - - def get(self, key, default=None): - """Return the value for key if key is in the dictionary, else default. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def items(self): - """Return a copy of the dictionary's list of (key, value) pairs. - - :rtype: collections.Iterable[(T, V)] - """ - return [] - - def keys(self): - """Return a copy of the dictionary's list of keys. - - :rtype: collections.Iterable[T] - """ - return [] - - def pop(self, key, default=None): - """If key is in the dictionary, remove it and return its value, else - return default. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def popitem(self): - """Remove and return an arbitrary (key, value) pair from the - dictionary. - - :rtype: (T, V) - """ - pass - - def setdefault(self, key, default=None): - """If key is in the dictionary, return its value. - - :type key: T - :type default: V | None - :rtype: V - """ - pass - - def update(self, other=None, **kwargs): - """Update the dictionary with the key/value pairs from other, - overwriting existing keys. - - :type other: dict[T, V] | collections.Iterable[(T, V)] - :rtype: None - """ - pass - - def values(): - """Return a copy of the dictionary's list of values. - - :rtype: collections.Iterable[V] - """ - return [] - - -class __generator(object): - """A mock class representing the generator function type.""" - def __init__(self): - """Create a generator object. - - :rtype: __generator[T, U, V] - """ - self.gi_code = None - self.gi_frame = None - self.gi_running = 0 - - def __iter__(self): - """Defined to support iteration over container. - - :rtype: collections.Iterator[T] - """ - pass - - def __next__(self): - """Return the next item from the container. - - :rtype: T - """ - pass - - def close(self): - """Raises new GeneratorExit exception inside the generator to - terminate the iteration. - - :rtype: None - """ - pass - - def send(self, value): - """Resumes the generator and "sends" a value that becomes the - result of the current yield-expression. - - :type value: U - :rtype: None - """ - pass - - def throw(self, type, value=None, traceback=None): - """Used to raise an exception inside the generator. - - :rtype: None - """ - pass - - -class __coroutine(object): - """A mock class representing the generator function type.""" - - def __init__(self): - """ - :rtype: __coroutine[V] - """ - self.__name__ = '' - self.__qualname__ = '' - self.cr_await = None - self.cr_frame = None - self.cr_running = False - self.cr_code = None - - def __await__(self): - """ - :rtype: __generator[unknown, unknown, V] - """ - return [] - - def close(self): - """ - :rtype: None - """ - pass - - def send(self, value): - """ - :rtype: None - """ - pass - - def throw(self, type, value=None, traceback=None): - """ - :rtype: None - """ - pass - - -class __asyncgenerator(object): - """A mock class representing the async generator function type.""" - def __init__(self): - """Create an async generator object. - - :rtype: __asyncgenerator[T, U] - """ - self.__name__ = '' - self.__qualname__ = '' - self.ag_await = None - self.ag_frame = None - self.ag_running = False - self.ag_code = None - - def __aiter__(self): - """Defined to support iteration over container. - - :rtype: collections.AsyncIterator[T] - """ - pass - - def __anext__(self): - """Returns an awaitable, that performs one asynchronous generator - iteration when awaited. - - :rtype: collections.Awaitable[T] - """ - pass - - def aclose(self): - """Returns an awaitable, that throws a GeneratorExit exception - into generator. - - :rtype: collections.Awaitable[T] - """ - pass - - def asend(self, value): - """Returns an awaitable, that pushes the value object in generator. - - :type value: U - :rtype: collections.Awaitable[T] - """ - pass - - def athrow(self, type, value=None, traceback=None): - """Returns an awaitable, that throws an exception into generator. - - :rtype: collections.Awaitable[T] - """ - pass - - -class __function(object): - """A mock class representing function type.""" - - def __init__(self): - self.__name__ = '' - self.__doc__ = '' - self.__dict__ = '' - self.__module__ = '' - - self.__annotations__ = {} - self.__defaults__ = {} - self.__globals__ = {} - self.__kwdefaults__ = {} - self.__closure__ = None - self.__code__ = None - - if sys.version_info >= (3, 3): - self.__qualname__ = '' - -class __method(object): - """A mock class representing bound method type.""" - - def __init__(self): - self.__func__ = None - self.__self__ = None - - -def input(prompt=None): - """ - :type prompt: Any - :rtype: str - """ - pass diff --git a/python/helpers/python-skeletons/collections.py b/python/helpers/python-skeletons/collections.py deleted file mode 100644 index 9ea6ed9170e3..000000000000 --- a/python/helpers/python-skeletons/collections.py +++ /dev/null @@ -1,56 +0,0 @@ -"""Skeleton for 'collections' stdlib module.""" - - -import sys -import collections - - -class Iterable(object): - def __init__(self): - """ - :rtype: collections.Iterable[T] - """ - pass - - def __iter__(self): - """ - :rtype: collections.Iterator[T] - """ - - -class Iterator(collections.Iterable): - def __init__(self): - """ - :rtype: collections.Iterator[T] - """ - pass - - if sys.version_info >= (3, 0): - def __next__(self): - """ - :rtype: T - """ - pass - - if sys.version_info < (3, 0): - def next(self): - """ - :rtype: T - """ - pass - - -class defaultdict(dict): - def __init__(self, default_factory=None, **kwargs): - """ - :type default_factory: () -> V - :rtype: defaultdict[Any, V] - """ - pass - - def __missing__(self, key): - """ - :type key: Any - :rtype: V - """ - pass diff --git a/python/helpers/python-skeletons/datetime.py b/python/helpers/python-skeletons/datetime.py deleted file mode 100644 index 355052a24cc5..000000000000 --- a/python/helpers/python-skeletons/datetime.py +++ /dev/null @@ -1,625 +0,0 @@ -"""Skeleton for 'datetime' stdlib module.""" - - -import sys -import datetime as _datetime -from time import struct_time - - -class timedelta(object): - """A timedelta object represents a duration, the difference between two - dates or times.""" - - def __init__(self, days=0, seconds=0, microseconds=0, milliseconds=0, - minutes=0, hours=0, weeks=0): - """Create a timedelta object. - - :type days: numbers.Real - :type seconds: numbers.Real - :type microseconds: numbers.Real - :type milliseconds: numbers.Real - :type minutes: numbers.Real - :type hours: numbers.Real - :type weeks: numbers.Real - """ - self.days = 0 - self.seconds = 0 - self.microseconds = 0 - - def __add__(self, other): - """Add timedelta, date or datetime. - - :type other: T <= _datetime.timedelta | _datetime.date | _datetime.datetime - :rtype: T - """ - pass - - def __radd__(self, other): - """Add timedelta, date or datetime. - - :type other: T <= _datetime.timedelta | _datetime.date | _datetime.datetime - :rtype: T - """ - pass - - def __sub__(self, other): - """Subtract timedelta, date or datetime. - - :type other: _datetime.timedelta | _datetime.date | _datetime.datetime - :rtype: _datetime.timedelta | _datetime.date | _datetime.datetime - """ - pass - - def __rsub__(self, other): - """Subtract timedelta, date or datetime. - - :type other: _datetime.timedelta | _datetime.date | _datetime.datetime - :rtype: _datetime.timedelta | _datetime.date | _datetime.datetime - """ - pass - - def __mul__(self, other): - """Multiply by an integer. - - :type other: numbers.Integral - :rtype: _datetime.timedelta - """ - return _datetime.timedelta() - - def __rmul__(self, other): - """Multiply by an integer. - - :type other: numbers.Integral - :rtype: _datetime.timedelta - """ - return _datetime.timedelta() - - def __floordiv__(self, other): - """Divide by an integer or a timedelta. - - :type other: numbers.Integral | _datetime.timedelta - :rtype: _datetime.timedelta | int - """ - pass - - def __div__(self, other): - """Divide by an integer. - - :type other: numbers.Integral - :rtype: _datetime.timedelta - """ - pass - - def __truediv__(self, other): - """Divide by a float or a timedelta. - - :type other: numbers.Real | _datetime.timedelta - :rtype: _datetime.timedelta | float - """ - pass - - if sys.version_info >= (2, 7): - def total_seconds(self): - """Return the total number of seconds contained in the duration. - - :rtype: int - """ - return 0 - - min = _datetime.timedelta() - max = _datetime.timedelta() - resoultion = _datetime.timedelta() - - -class date(object): - """An idealized naive date, assuming the current Gregorian calendar always - was, and always will be, in effect.""" - - def __init__(self, year, month, day): - """Create a date object. - - :type year: numbers.Integral - :type month: numbers.Integral - :type day: numbers.Integral - """ - self.year = year - self.month = month - self.day = day - - @classmethod - def today(cls): - """Return the current local date. - - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - @classmethod - def fromtimestamp(cls, timestamp): - """Return the local date corresponding to the POSIX timestamp, such as - is returned by time.time(). - - :type timestamp: numbers.Real - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - @classmethod - def fromordinal(cls, ordinal): - """Return the date corresponding to the proleptic Gregorian ordinal, - where January 1 of year 1 has ordinal 1. - - :type ordinal: numbers.Integral - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - def __add__(self, other): - """Add timedelta. - - :type other: _datetime.timedelta - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - def __radd__(self, other): - """Add timedelta. - - :type other: _datetime.timedelta - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - def __sub__(self, other): - """Subtract date or timedelta. - - :type other: _datetime.date | _datetime.timedelta - :rtype: _datetime.timedelta | _datetime.date - """ - pass - - def __rsub__(self, other): - """Subtract date. - - :type other: _datetime.date - :rtype: _datetime.timedelta - """ - return _datetime.timedelta() - - def replace(self, year=None, month=None, day=None): - """Return a date with the same value, except for those parameters given - new values by whichever keyword arguments are specified. - - :type year: numbers.Integral - :type month: numbers.Integral - :type day: numbers.Integral - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - def timetuple(self): - """Return a time.struct_time such as returned by time.localtime(). - - :rtype: struct_time - """ - return struct_time() - - def toordinal(self): - """Return the proleptic Gregorian ordinal of the date, where January 1 - of year 1 has ordinal 1. - - :rtype: int - """ - return 0 - - def weekday(self): - """Return the day of the week as an integer, where Monday is 0 and - Sunday is 6. - - :rtype: int - """ - return 0 - - def isoweekday(self): - """Return the day of the week as an integer, where Monday is 1 and - Sunday is 7. - - :rtype: int - """ - return 0 - - def isocalendar(self): - """Return a 3-tuple, (ISO year, ISO week number, ISO weekday). - - :rtype: (int, int, int) - """ - return (0, 0, 0) - - def isoformat(self): - """Return a string representing the date in ISO 8601 format, - 'YYYY-MM-DD'. - - :rtype: string - """ - return str() - - def ctime(self): - """Return a string representing the date. - - :rtype: string - """ - return str() - - def strftime(self, format): - """Return a string representing the date, controlled by an explicit - format string. - - :type format: string - :rtype: string - """ - return str() - - min = _datetime.date(0, 0, 0) - max = _datetime.date(0, 0, 0) - resoultion = _datetime.timedelta() - - -class datetime(object): - """A datetime object is a single object containing all the information from - a date object and a time object.""" - - def __init__(self, year, month, day, hour=0, minute=0, second=0, - microsecond=0, tzinfo=None): - """Create a datetime object. - - :type year: numbers.Integral - :type month: numbers.Integral - :type day: numbers.Integral - :type hour: numbers.Integral - :type minute: numbers.Integral - :type second: numbers.Integral - :type microsecond: numbers.Integral - :type tzinfo: _datetime.tzinfo | None - """ - self.year = year - self.month = month - self.day = day - self.hour = hour - self.minute = minute - self.second = second - self.microsecond = microsecond - self.tzinfo = tzinfo - - @classmethod - def today(cls): - """Return the current local datetime, with tzinfo None. - - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def now(cls, tz=None): - """Return the current local date and time. - - :type tz: _datetime.tzinfo | None - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def utcnow(cls): - """Return the current UTC date and time, with tzinfo None. - - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def fromtimestamp(cls, timestamp, tz=None): - """Return the local date and time corresponding to the POSIX timestamp, - such as is returned by time.time(). - - :type timestamp: numbers.Real - :type tz: _datetime.tzinfo | None - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def utcfromtimestamp(cls, timestamp): - """Return the UTC datetime corresponding to the POSIX timestamp, with - tzinfo None. - - :type timestamp: numbers.Real - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def fromordinal(cls, ordinal): - """Return the datetime corresponding to the proleptic Gregorian - ordinal. - - :type ordinal: numbers.Integral - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def combine(cls, date, time): - """Return a new datetime object whose date components are equal to the - given date object's, and whose time components and tzinfo attributes - are equal to the given time object's. - - :type date: _datetime.date - :type time: _datetime.time - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - @classmethod - def strptime(cls, date_string, format): - """Return a datetime corresponding to date_string, parsed according to - format. - - :type date_string: string - :type format: string - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - def __add__(self, other): - """Add timedelta. - - :type other: _datetime.timedelta - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - def __radd__(self, other): - """Add timedelta. - - :type other: _datetime.timedelta - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - def __sub__(self, other): - """Subtract timedelta or datetime. - - :type other: _datetime.timedelta | _datetime.datetime - :rtype: _datetime.datetime | _datetime.timedelta - """ - pass - - def __rsub__(self, other): - """Subtract datetime. - - :type other: _datetime.datetime - :rtype: _datetime.timedelta - """ - return _datetime.timedelta() - - def date(self): - """Return date object with same year, month and day. - - :rtype: _datetime.date - """ - return _datetime.date(0, 0, 0) - - def time(self): - """Return time object with same hour, minute, second and microsecond. - - :rtype: _datetime.time - """ - return _datetime.time() - - def timetz(self): - """Return time object with same hour, minute, second, microsecond, and - tzinfo attributes. - - :rtype: _datetime.time - """ - return _datetime.time() - - def replace(self, year=None, month=None, day=None, hour=None, minute=None, - second=None, microsecond=None, tzinfo=None): - """Return a datetime with the same attributes, except for those - attributes given new values by whichever keyword arguments are - specified. - - :type year: numbers.Integral - :type month: numbers.Integral - :type day: numbers.Integral - :type hour: numbers.Integral - :type minute: numbers.Integral - :type second: numbers.Integral - :type microsecond: numbers.Integral - :type tzinfo: _datetime.tzinfo | None - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - def astimezone(self, tz): - """Return a datetime object with new tzinfo attribute tz, adjusting the - date and time data so the result is the same UTC time as self, but in - tz's local time. - - :type tz: _datetime.tzinfo - :rtype: _datetime.datetime - """ - return _datetime.datetime(0, 0, 0) - - def utcoffset(self): - """If tzinfo is None, returns None, else returns - self.tzinfo.utcoffset(self). - - :rtype: _datetime.timedelta | None - """ - return _datetime.timedelta() - - def dst(self): - """If tzinfo is None, returns None, else returns self.tzinfo.dst(self). - - :rtype: _datetime.timedelta | None - """ - return _datetime.timedelta() - - def tzname(self): - """If tzinfo is None, returns None, else returns - self.tzinfo.tzname(self). - - :rtype: string | None - """ - return str() - - def timetuple(self): - """Return a time.struct_time such as returned by time.localtime(). - - :rtype: struct_time - """ - return struct_time() - - def utctimetuple(self): - """If datetime instance d is naive, this is the same as d.timetuple() - except that tm_isdst is forced to 0 regardless of what d.dst() returns. - - :rtype: struct_time - """ - return struct_time() - - def toordinal(self): - """Return the proleptic Gregorian ordinal of the date. - - :rtype: int - """ - return 0 - - def weekday(self): - """Return the day of the week as an integer, where Monday is 0 and - Sunday is 6. - - :rtype: int - """ - return 0 - - def isoweekday(self): - """Return the day of the week as an integer, where Monday is 1 and - Sunday is 7. - - :rtype: int - """ - return 0 - - def isocalendar(self): - """Return a 3-tuple, (ISO year, ISO week number, ISO weekday). - - :rtype: (int, int, int) - """ - return (0, 0, 0) - - def isoformat(self, sep='T'): - """Return a string representing the date and time in ISO 8601 format. - - :type sep: string - :rtype: string - """ - return str() - - def ctime(self): - """Return a string representing the date and time. - - :rtype: string - """ - return str() - - def strftime(self, format): - """Return a string representing the date and time, controlled by an - explicit format string. - - :type format: string - :rtype: string - """ - return str() - - min = _datetime.datetime(0, 0, 0) - max = _datetime.datetime(0, 0, 0) - resoultion = _datetime.timedelta() - - -class time(object): - """A time object represents a (local) time of day, independent of any - particular day, and subject to adjustment via a tzinfo object.""" - - def __init__(self, hour=0, minute=0, second=0, microsecond=0, tzinfo=None): - """Create a time object. - - :type hour: numbers.Integral - :type minute: numbers.Integral - :type second: numbers.Integral - :type microsecond: numbers.Integral - :type tzinfo: _datetime.tzinfo | None - """ - self.hour = hour - self.minute = minute - self.second = second - self.microsecond = microsecond - sefl.tzinfo = tzinfo - - def replace(self, hour=None, minute=None, second=None, microsecond=None, - tzinfo=None): - """Return a time with the same value, except for those attributes given - new values by whichever keyword arguments are specified. - - :type hour: numbers.Integral - :type minute: numbers.Integral - :type second: numbers.Integral - :type microsecond: numbers.Integral - :type tzinfo: _datetime.tzinfo | None - :rtype: _datetime.time - """ - return _datetime.time() - - def isoformat(self): - """Return a string representing the time in ISO 8601 format. - - :rtype: string - """ - return str() - - def strftime(self, format): - """Return a string representing the time, controlled by an explicit - format string. - - :type format: string - :rtype: string - """ - return str() - - def utcoffset(self): - """If tzinfo is None, returns None, else returns - self.tzinfo.utcoffset(self). - - :rtype: _datetime.timedelta | None - """ - return _datetime.timedelta() - - def dst(self): - """If tzinfo is None, returns None, else returns self.tzinfo.dst(self). - - :rtype: _datetime.timedelta | None - """ - return _datetime.timedelta() - - def tzname(self): - """If tzinfo is None, returns None, else returns - self.tzinfo.tzname(self). - - :rtype: string | None - """ - return str() - - min = _datetime.time() - max = _datetime.time() - resoultion = _datetime.timedelta() diff --git a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt index 4270e41e86ca..4442c87b5db4 100644 --- a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt +++ b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt @@ -23,7 +23,6 @@ import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.util.QualifiedName import com.jetbrains.python.PythonHelpersLocator -import com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider.TYPING import com.jetbrains.python.packaging.PyPIPackageUtil import com.jetbrains.python.packaging.PyPackageManagers import com.jetbrains.python.packaging.PyPackageUtil @@ -39,24 +38,13 @@ import java.io.File * @author vlan */ object PyTypeShed { - private val ONLY_SUPPORTED_PY2_MINOR = 7 + private const val ONLY_SUPPORTED_PY2_MINOR = 7 private val SUPPORTED_PY3_MINORS = 2..7 - val WHITE_LIST: Set = setOf(TYPING, "six", "__builtin__", "builtins", "exceptions", "types", "datetime", "functools", "shutil", - "re", "time", "argparse", "uuid", "threading", "signal", "collections", "subprocess", "math", "queue", - "socket", "sqlite3", "attr") - private val BLACK_LIST = setOf() /** * Returns true if we allow to search typeshed for a stub for [name]. */ fun maySearchForStubInRoot(name: QualifiedName, root: VirtualFile, sdk : Sdk): Boolean { - val topLevelPackage = name.firstComponent ?: return false - if (topLevelPackage in BLACK_LIST) { - return false - } - if (topLevelPackage !in WHITE_LIST) { - return false - } if (isInStandardLibrary(root)) { return true } @@ -64,6 +52,7 @@ object PyTypeShed { if (ApplicationManager.getApplication().isUnitTestMode) { return true } + val topLevelPackage = name.firstComponent ?: return false val pyPIPackages = PyPIPackageUtil.PACKAGES_TOPLEVEL[topLevelPackage] ?: emptyList() val packages = PyPackageManagers.getInstance().forSdk(sdk).packages ?: return true return PyPackageUtil.findPackage(packages, topLevelPackage) != null || diff --git a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java index 54618032f832..4be99d9fb76a 100644 --- a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java +++ b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java @@ -34,7 +34,6 @@ import com.intellij.util.containers.ContainerUtil; import com.jetbrains.python.PythonHelpersLocator; import com.jetbrains.python.codeInsight.controlflow.ScopeOwner; import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil; -import com.jetbrains.python.codeInsight.typing.PyTypeShed; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.resolve.*; import com.jetbrains.python.psi.types.PyClassLikeType; @@ -61,27 +60,17 @@ public class PyUserSkeletonsUtil { "asyncio", "multiprocessing", "os", - "__builtin__.py", "_csv.py", - "builtins.py", - "collections.py", "copy.py", "cStringIO.py", - "datetime.py", "decimal.py", - "functools.py", "io.py", "itertools.py", "logging.py", - "math.py", "pathlib.py", "pickle.py", - "re.py", - "shutil.py", - "sqlite3.py", "StringIO.py", "struct.py", - "subprocess.py", "sys.py" ); @@ -237,10 +226,6 @@ public class PyUserSkeletonsUtil { if (moduleVirtualFile != null) { String moduleName = QualifiedNameFinder.findShortestImportableName(file, moduleVirtualFile); if (moduleName != null) { - // TODO: Delete user-skeletons altogether, meanwhile disabled user-skeletons for modules already covered by PyTypeShed - if (PyTypeShed.INSTANCE.getWHITE_LIST().contains(moduleName)) { - return null; - } final QualifiedName qName = QualifiedName.fromDottedString(moduleName); final QualifiedName restored = QualifiedNameFinder.canonizeQualifiedName(qName, null); if (restored != null) { diff --git a/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kt b/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kt deleted file mode 100644 index 91cdeb5f6f8d..000000000000 --- a/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kt +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.jetbrains.python.tools - -import com.intellij.openapi.util.io.FileUtil -import com.intellij.util.io.createDirectories -import com.intellij.util.io.delete -import com.intellij.util.io.exists -import com.jetbrains.python.codeInsight.typing.PyTypeShed -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths - -fun main(args: Array) { - val repo = Paths.get("../typeshed") - val bundled = Paths.get("./community/python/helpers/typeshed") - - println("Repo: ${repo.abs()}") - println("Bundled: ${bundled.abs()}") - - sync(repo, bundled) - clean(topLevelPackages(bundled), PyTypeShed.WHITE_LIST) -} - -private fun sync(repo: Path, bundled: Path) { - if (!repo.exists()) throw IllegalArgumentException("Not found: ${repo.abs()}") - - if (bundled.exists()) { - bundled.delete() - println("Removed: ${bundled.abs()}") - } - - bundled.createDirectories() - if (!bundled.exists()) throw IllegalStateException("Not found: ${bundled.abs()}") - - val whiteList = setOf("stdlib", - "tests", - "third_party", - ".flake8", - ".gitignore", - ".travis.yml", - "CONTRIBUTING.md", - "README.md", - "LICENSE", - "requirements-tests-py2.txt", - "requirements-tests-py3.txt") - - Files - .newDirectoryStream(repo) - .forEach { - if (it.name() in whiteList) { - val target = bundled.resolve(it.fileName) - - it.toFile().copyRecursively(target.toFile()) - println("Copied: ${it.abs()} to ${target.abs()}") - } - else { - println("Skipped: ${it.abs()}") - } - } -} - -private fun topLevelPackages(typeshed: Path): List { - return sequenceOf(typeshed) - .flatMap { sequenceOf(it.resolve("stdlib"), it.resolve("third_party")) } - .flatMap { Files.newDirectoryStream(it).asSequence() } - .flatMap { Files.newDirectoryStream(it).asSequence() } - .toList() -} - -private fun clean(topLevelPackages: List, whiteList: Set) { - topLevelPackages - .asSequence() - .filter { FileUtil.getNameWithoutExtension(it.name()) !in whiteList } - .forEach { it.delete() } -} - -private fun Path.abs() = toAbsolutePath() -private fun Path.name() = fileName.toString() \ No newline at end of file diff --git a/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts b/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts new file mode 100644 index 000000000000..4df8d3d29113 --- /dev/null +++ b/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts @@ -0,0 +1,82 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.jetbrains.python.tools + +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths + +/** + * This script was implemented to sync local copy of `typeshed` with bundled `typeshed`. + * + * As a result it leaves top-level modules and packages that are listed in `whiteList`. + * It allows us to reduce the size of bundled `typeshed` and do not run indexing and other analyzing processes on disabled stubs. + */ + +val repo = Paths.get("../../../../../../../../../typeshed").abs().normalize() +val bundled = Paths.get("../../../../../../../../community/python/helpers/typeshed").abs().normalize() + +println("Repo: ${repo.abs()}") +println("Bundled: ${bundled.abs()}") + +sync(repo, bundled) + +val whiteList = setOf("typing", "six", "__builtin__", "builtins", "exceptions", "types", "datetime", "functools", "shutil", "re", "time", + "argparse", "uuid", "threading", "signal", "collections", "subprocess", "math", "queue", "socket", "sqlite3", "attr") + +clean(topLevelPackages(bundled), whiteList) + +fun sync(repo: Path, bundled: Path) { + if (!Files.exists(repo)) throw IllegalArgumentException("Not found: ${repo.abs()}") + + if (Files.exists(bundled)) { + bundled.deleteRecursively() + println("Removed: ${bundled.abs()}") + } + + val whiteList = setOf("stdlib", + "tests", + "third_party", + ".flake8", + ".gitignore", + ".travis.yml", + "CONTRIBUTING.md", + "README.md", + "LICENSE", + "requirements-tests-py2.txt", + "requirements-tests-py3.txt") + + Files + .newDirectoryStream(repo) + .forEach { + if (it.name() in whiteList) { + val target = bundled.resolve(it.fileName) + + it.copyRecursively(target) + println("Copied: ${it.abs()} to ${target.abs()}") + } + else { + println("Skipped: ${it.abs()}") + } + } +} + +fun topLevelPackages(typeshed: Path): List { + return sequenceOf(typeshed) + .flatMap { sequenceOf(it.resolve("stdlib"), it.resolve("third_party")) } + .flatMap { Files.newDirectoryStream(it).asSequence() } + .flatMap { Files.newDirectoryStream(it).asSequence() } + .toList() +} + +fun clean(topLevelPackages: List, whiteList: Set) { + topLevelPackages + .asSequence() + .filter { it.nameWithoutExtension() !in whiteList } + .forEach { it.deleteRecursively() } +} + +fun Path.abs() = toAbsolutePath() +fun Path.deleteRecursively() = toFile().deleteRecursively() +fun Path.copyRecursively(target: Path) = toFile().copyRecursively(target.toFile()) +fun Path.name() = toFile().name +fun Path.nameWithoutExtension() = toFile().nameWithoutExtension