forked from JetBrains/python-skeletons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuiltins.py
2598 lines (1943 loc) · 56.8 KB
/
builtins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""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.