Commit Graph

854 Commits

Author SHA1 Message Date
Reiner Gerecke
5624e7fd4b Add collections.Container to Python 2/3 (#608) 2016-10-15 08:16:02 -07:00
Guido van Rossum
0b04c44710 Revert last two commits.
Reason: https://github.com/python/mypy/issues/328

* Revert "Make fromkeys() take an Iterable instead of a sequence. (#605)"

  This reverts commit 66e8d4a14f.

* Revert "Make dict.fromkeys() a classmethod (which it is). (#604)"

  This reverts commit 26dfcb6859.

* Add an explanation for fromkeys() being a staticmethod.
2016-10-14 21:11:10 -07:00
Guido van Rossum
66e8d4a14f Make fromkeys() take an Iterable instead of a sequence. (#605)
(This, too, came up in python/mypy#2254 -- thanks @rwbarton!)
2016-10-14 10:00:43 -07:00
Guido van Rossum
26dfcb6859 Make dict.fromkeys() a classmethod (which it is). (#604)
This came up in https://github.com/python/mypy/issues/2254.

I don't know why it was previously defined as a staticmethod, perhaps
there was an old mypy issue?
2016-10-14 09:41:26 -07:00
Calen Pennington
5daf552f5b Make viewkeys, viewitems, viewvalues use proper types now that the typing backport has them (#602) 2016-10-14 08:41:29 -07:00
jgarvin
1b9266d801 Let open() take a pathlib.Path starting in 3.6 (#596) 2016-10-13 16:17:39 -07:00
Alex Jurkiewicz
8d10e885d1 [review] Add multiprocessing.Pool (#523) 2016-10-12 16:44:37 -07:00
Eklavya Sharma
7f7a5789bd Add attribute 'name' to StringIO (#600)
Add an attribute 'name' of type str to StringIO.StringIO in python2
and io.StringIO in python2 and python3.

Fixes #598.
2016-10-12 07:34:58 -07:00
Alvaro Caceres
08ac3b7742 2.7/os: remove exception throwing, add misc members (#591)
* 2.7/os: remove exception throwing, add misc members

* added tempnam, tmpnam
2016-10-12 07:34:35 -07:00
Eklavya Sharma
b92991bc2a Add TimeTuple in python3's time.pyi and datetime.pyi. (#597)
Add `TimeTuple = Tuple[int, int, int, int, int, int, int, int, int]`
to stdlib/3/time.pyi and stdlib/3/datetime.pyi.

Use `TimeTuple` instead of `tuple` (where relevant) in time.pyi for
stronger type checking.

Use `TimeTuple` instead of
`Tuple[int, int, int, int, int, int, int, int, int]` in datetime.pyi
to increase readability.
2016-10-11 14:48:47 -07:00
Matthias Kramm
b0eae4bf46 allow to use RLock in type annotations (#595) 2016-10-10 16:52:47 -07:00
paavoap
71042452c7 Add stub for SameFileError. (#594) 2016-10-10 08:07:54 -07:00
jgarvin
490b34649f Add stub for shutil.which (#592) 2016-10-09 19:58:55 -07:00
paavoap
cac07d6dea Add type hints for _create_default_https_context and _create_unverified_context. (#583) 2016-10-09 19:56:01 -07:00
Alvaro Caceres
92b600540e Add private members to stdlib threading (#590)
* Add threading._DummyThread

* Make threading.RLock a factory function, not a class

Will break code that currently uses a threading.RLock type annotation
2016-10-07 13:11:47 -07:00
Alvaro Caceres
9b092f353e 2.7/inspect: add getframeinfo, getouterframes, Traceback (#588) 2016-10-06 15:20:42 -07:00
Alvaro Caceres
674fe2b59f Add threading.Condition.notifyAll (#587)
Documented in py2, undocumented in py3
2016-10-06 14:14:08 -07:00
Alvaro Caceres
f90a6d1c0e Inspect: use any instead of object (#585)
* Have inspect.getmembers' return value use Any instead of object
2016-10-06 11:36:17 -07:00
Alvaro Caceres
9586411dad Add MONDAY, TUESDAY, ... constants to stdlib/calendar (#586)
These are undocumented but enough people seem to use them that they
should be considered public
2016-10-06 10:19:16 -07:00
Alvaro Caceres
9e71e54aa9 Add http status code constants to 2.7/httplib (#584) 2016-10-06 09:42:42 -07:00
Evgeniy Vasilev
0e5003b61e Add HTTPStatus definition for python3.5+ (#577)
Fixes #576.
2016-09-29 13:09:30 -07:00
Matthias Kramm
ccd1dc1fac fix 2.7 version of Logger.debug (#578) 2016-09-29 12:02:12 -07:00
Guido van Rossum
896110fd54 The value member of an IntEnum object is an int. 2016-09-29 09:48:43 -07:00
Ivan Levkivskyi
70cfe793d9 Implement PEP 526 in typed_ast (#548)
See dropbox/typed_ast#16.
2016-09-28 10:31:28 -07:00
Manuel Krebber
aa549db5e5 Added missing operations to collections.Counter stub. (#575) 2016-09-27 10:07:57 -07:00
olliewild
68339ebf2e Add fileinput .pyi for Python 2.7. (#572) 2016-09-26 15:23:27 -07:00
Robin Alazard
1002950322 Add missing method add_mutually_exclusive_group(...) to argparse group (#573) 2016-09-26 12:07:47 -07:00
Sebastian Meßmer
34b343ba66 Add missing type hints to atexit.register() (#571) 2016-09-23 13:35:55 -07:00
Guido van Rossum
ed97067f6d Different fix for locale/str/__builtin__ issue (#570) 2016-09-23 10:18:04 -07:00
Gustavo J. A. M. Carneiro
bda2b54dfc itemgetter parameters can be any type that the container accepts, not just int (#564) 2016-09-23 05:40:16 -07:00
dlinnemeyer
bbf0ac2d1f Fixing timezone utc type (#568)
* switching to timezone type

* taking a shot at 2.7
2016-09-23 05:39:52 -07:00
Matthias Kramm
76c0850eb2 Use the correct __builtin__/builtins module in Python 2/3. (#569) 2016-09-23 05:38:35 -07:00
Samuel Colvin
5161341240 add signal.Signals for python3.5 (#555) 2016-09-22 12:50:27 -07:00
Stephen Thorne
4b0efd9343 Allow the first argument to SequenceMatcher.__init__ to be None. (#566) 2016-09-21 17:06:02 -07:00
Rich Li
9de69f9cf2 Include time updates with Python 3.3 (#563)
* Add definitions added in Python 3.3

* Remove blanks between function stubs

* Group Unix-only functions into platform checks

* Correct get_clock_info() return type to SimpleNamespace
2016-09-21 15:26:04 -07:00
rchen152
b53e4c349d Fix HTMLParser.HTMLParser, HTMLParseError. (#565)
Signed-off-by: Rebecca Chen <rechen@rechen0.mtv.corp.google.com>
2016-09-21 11:55:02 -07:00
Gustavo J. A. M. Carneiro
f93642b32a Add __format__ to float, fixes #560 (#561)
Fixes #560.
2016-09-21 08:17:28 -07:00
Guido van Rossum
c9dbb96f1d Change mmap to use bytes. 2016-09-19 15:17:09 -07:00
Guido van Rossum
8be390d2a6 Improve signature of communicate().
The input type can be bytes or unicode, the return types are always Optional bytes.
2016-09-19 15:17:09 -07:00
Guido van Rossum
794e51612e Improve signatures of {get,set}sockopt(): use bytes, not str. 2016-09-19 15:17:09 -07:00
Yasushi Saito
61007ab1dc Add tm_zone and tm_gmtoff to time.pyi (#551)
* Enable tm_gmtoff and tm_zone only for python >= 3.3.
2016-09-19 14:38:14 -07:00
Sebastian Meßmer
93ef68315b Fixed types in stdlib/3/concurrent/futures: (#557)
* Fixed types in stdlib/3/concurrent/futures:
 - Remove private classes from public interface
 - Add missing types

* Remove "generated by stubgen" headers from modified type stubs

* - Use ... as default value
- Fix space formatting

* Replace more default values with '...'

* Use 'None' as default value where specified by documentation

* Use explicit Optional[T] type instead of default value None
2016-09-19 08:13:12 -07:00
Roy Williams
b5e372bc7f Add stubs for itsdangerous. (#537)
This is needed for https://github.com/python/typeshed/issues/28
2016-09-18 14:40:18 -07:00
Samuel Colvin
773ad48c04 correct utcoffset return type (#554) 2016-09-18 13:44:38 -07:00
Guido van Rossum
a353aabbcd Add commented-out flag to use --fast-parser. 2016-09-15 16:49:56 -07:00
Guido van Rossum
d131efcaa0 Skip "module" whose name starts with ".". 2016-09-15 16:20:28 -07:00
Michael Lee
ec2b9ce97e Add partial stubs for fractions (#544)
This commit adds some incomplete stubs for the fractions module. In
particular, this commit does not add type signatures for the more
complex functions (such as `__add__`), and just leaves their types as
effectively `Any`.
2016-09-14 16:40:17 -07:00
Elazar
1d820d48cf Add signatures for cast() and NewType (#549)
(Mypy ignores these in favor of hard-coded behaviors, but the signatures here may be useful for other tools.)
2016-09-14 14:55:06 -07:00
Michael Lee
748428d8a4 Refine stubs for Python 2's decimal module (#545)
* Refine stubs for Python 2's decimal module

The decimal module for Python 2 was relatively incomplete, unlike the
decimal module for Python 3. This commit copies the relevant type
signatures from Python 3's decimal module to Python 2's.

There was a lot of code in both stubs and it wasn't clear to me if it
was safe to merge the two modules together, so I refrained from doing
so.

* Allow comparisions with Decimals and Floats

This commit loosens the types for Decimals to allow comparisons like
`Decimal('3.14') < 4.2`. Previously, you could compare decimals with
only other decimals or ints.
2016-09-14 09:40:14 -07:00
Michael Lee
f29a996501 Refine stubs for numbers.pyi (#543)
* Partially refine numbers.pyi

This commit refines numbers.pyi. More specifically, it...

- Adds in explicit type annotations where it's obvious how to do
  so (leaving more non-obvious type signatures alone).
- Adds in missing '@abstractmethod' decorators
- Combines together the Python 2 and Python 3 versions of numbers.pyi.

* Merges Python 2 and Python 3 numbers.pyi

This commit removes the old `stdlib/2.7/numbers.pyi` file and moves the
previously-committed `stdlib/3/numbers.pyi` to the shared `2and3`
directory.

* Modify comment at top of numbers.pyi

Since the stubs are no longer identical to what stubgen creates, the
comment should also probably be changed.
2016-09-14 08:12:36 -07:00