Commit Graph
100 Commits
Author SHA1 Message Date
Guido van RossumandMatthias Kramm 05ffb1f912 Make initial_indent and subsequent_indent AnyStr in wrap() and fill() (#1662)
Leave them alone in TextWrap.__init__(), since I don't want to make the whole class generic.
2017-10-10 15:11:48 -07:00
Guido van RossumandJelle Zijlstra 6d619e013c Add textwrap.dedent() to Py2 stubs (#1661) 2017-10-10 10:07:18 -07:00
Guido van RossumandJelle Zijlstra 76685480e0 Misc fixes found by running mypy against Dropbox internal codebase "C". (#1575) 2017-08-25 20:34:13 -07:00
Guido van RossumandMatthias Kramm 9238c737de Make HasField and ClearField use Text instead of str (#1425)
This allows one to write `x.HasField("ok")` even if the file has
`from __future__ import unicode_literals`"
2017-06-21 10:51:49 -07:00
Guido van RossumandMatthias Kramm 350563223f Add Optional[] for all remaining cases of x: <type> = None (#1424)
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Guido van RossumandGitHub 81f77b17ec Remove double Optional[] (#1423) 2017-06-21 09:54:40 -07:00
Guido van RossumandJelle Zijlstra 04fe184dcf Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy (#1421)
* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
2017-06-20 22:18:49 -07:00
Guido van RossumandMatthias Kramm 30256097ea Use explicit Optional[] on argument types with default None (#1420) 2017-06-20 16:20:13 -07:00
Guido van RossumandMatthias Kramm 86070643ac Improve csv module and float() signature (#1418)
* DictReader should not be abstract. Reformat long lines.
* Make restval optional for DictWriter.__init__.
* The arg to reader() is *Iterable*, not *Iterator*.
* Improve signature of float() (use Union instead of overload).
2017-06-20 13:04:10 -07:00
Guido van RossumandMatthias Kramm 4fbdcf5b03 Revert "add back 'repeat' argument to itertools.product (#1407)" (#1409)
This reverts commit d5e7663f93.
2017-06-14 13:10:29 -07:00
Guido van RossumandJelle Zijlstra ab0de25949 Bump typed-ast version to 1.0.4 (#1408) 2017-06-14 10:43:28 -07:00
Guido van RossumandJelle Zijlstra 2216616195 Add explanation on how to use typeshed with mypy etc. (#1284) 2017-05-22 10:47:51 -07:00
Guido van RossumandGitHub b6a9a05743 Turn uidl() into an overload. (#1231)
The previous change was still right. Unique among `poplib` functions, `uidl()` returns a long response when called without arguments, but just a bytes string when called with a `which` argument.
2017-05-01 08:56:27 -07:00
Guido van RossumandGitHub 24f5bc4a2a Explain the set of labels we actually use (#1226) 2017-04-30 10:46:44 -07:00
Guido van RossumandJelle Zijlstra a934d57f3b [optparse] Change Uses of List[] to Sequence[] in argument positions. (#1179)
* Change Uses of List[] to Sequence[] in argument positions.

One of these (parse_args()) broke in real-world code, because the
expected type was List[Union[str, bytes]] but the actual type was
List[str] (because List is invariant).  That is ridiculous, so I
changed the accepted type to Sequence[_Text] which is covariant.  Then
I found a few other methods/functions that probably should also be
changed to Sequence, but I'm less certain of those.  I'm not at all
sure about the instance/class attributes, so I left those alone
(though I suspect those might also have to switch).

* Fixes suggested by code review

- Changed Sequence[Option] to Iterable[Option] everywhere
- Changed _process_args to plain List
2017-04-21 12:22:24 -07:00
Guido van RossumandGitHub 8b835f9500 Sadly symlinks don't work on Windows. (#1173)
So I have to make {ntpath,macpath}.pyi real copies of posixpath.pyi.
2017-04-18 11:55:02 -07:00
Guido van RossumandGitHub bb0a841471 Make io._IOBase and its descendents concrete. (#1172)
This solves the issue with instantiating gzip.GzipFile() mentioned at
https://github.com/python/typeshed/pull/1160#issuecomment-294534004
2017-04-18 11:13:13 -07:00
Guido van RossumandJelle Zijlstra 359c8cc313 Remove all mention of 'module' from typeshed. (#1156)
This depends on python/mypy#3107.
2017-04-13 08:40:52 -07:00
Guido van RossumandJelle Zijlstra 761ee6afb3 Update configs and instructions for running tests manually. (#1137)
- Switch requirements-tests-py3.txt to use mypy GitHub master.
- Exclude .venv{2,3} (suggested in README.md) in .flake8 and .gitignore.
- Update instructions in README.md to be working.
- Remove runtests.sh script and mentions of it -- I can't get it to work
  and the three steps are easily run by hand.
2017-04-08 19:06:54 -07:00
Guido van RossumandJelle Zijlstra f44e461d19 Use a separate type variable for unique() (#1138)
* Use a separate type variable for unique()

See https://github.com/python/typeshed/pull/1136#discussion_r109727053

* actually use the new typevar
2017-04-04 23:48:19 -07:00
Guido van RossumandJelle Zijlstra 7027c3e4e8 Support enum iteration (#1136)
* Support enum iteration.

Fixes python/mypy#2305.

* Make EnumMeta inherit from type, not ABCMeta.
2017-04-04 10:17:52 -07:00
Guido van RossumandJelle Zijlstra 3594b0e607 Fix JSONWebSignatureSerializer.load_dangerous() signature to satisfy mypy. (#1135)
The latest mypy complained that the signature didn't match that in the
superclass: Serializer.load_payload() has a serializer argument.  I
don't know this project but I think it's best to just add that
argument (rather than adding `# type: ignore`).
2017-04-04 09:51:56 -07:00
Guido van RossumandGitHub 1ea3d2de57 Make all single-constraint TypeVars use bound= insteads (plus hack) (#1118)
Another attempt for #804, to unblock python/mypy#2626.
There's a work-around here for python/mypy#1551.
2017-03-29 14:59:24 -07:00
Guido van RossumandGitHub 6a06dd40e1 Revert "Make os.stat_result and friends NamedTuples" (#1113)
* Revert "Added missing attributes of typing.Generator and typing.AsyncGenerator (#886)"

This reverts commit 8b26422b95.
2017-03-29 12:03:50 -07:00
Guido van RossumandJelle Zijlstra 72d275bbf5 Don't reference long in types.pyi (#1112)
(It's a type alias for int anyway, and it will cause a problem in the
initial import cycle once #886 is merged.)
2017-03-29 10:43:44 -07:00
Guido van RossumandJelle Zijlstra 03bfcee0b8 Remove sqlalchemy. (#1105)
See discussion in https://github.com/python/typeshed/pull/1094.

If we do this we should make it easier in mypy to install 3rd party stubs that are used by default.
2017-03-28 08:25:00 -07:00
Guido van RossumandGitHub 671d3870c2 Add 'file' attribute to cgi.[Mini]FieldStorage (#1104) 2017-03-27 14:27:38 -07:00
Guido van RossumandJelle Zijlstra 16074c1e66 Make cgi.escape() polymorphic in Python 2 (#1098) 2017-03-25 13:53:36 -07:00
Guido van RossumandGitHub 604839c3a2 Revert "Improved annotations for select.select() (#1080)" (#1097)
This reverts commit 7e05d47b81.

See discussion at https://github.com/python/typeshed/pull/1080
2017-03-25 12:36:40 -07:00
Guido van RossumandJelle Zijlstra fd77dd2e7a Make type of 'env' more flexible (#1091)
See https://github.com/python/typeshed/pull/1059#issuecomment-289150121
2017-03-24 15:58:01 -07:00
Guido van RossumandJelle Zijlstra de95aac022 Remind core devs to delete their branches (#1073) 2017-03-22 20:23:37 -07:00
Guido van RossumandJelle Zijlstra af2fadc180 More fixes related to PathLike (#1061)
* Make DirEntry generic over AnyStr, and inherit from PathLike if it exists

* Make pathlib require PathLike[str] (when it exists)
2017-03-21 22:26:21 -07:00
Guido van RossumandJelle Zijlstra 7587e7f1c1 Make PathLike generic in AnyStr (#1060) 2017-03-21 14:33:22 -07:00
Guido van RossumandGitHub 43d7747f59 Add missing List imports to dateutil package. (#934) 2017-02-14 11:59:19 -08:00
Guido van RossumandGitHub 0e9ad51882 Declare asyncio.wait() as taking an Iterable rather than a List. (#901) 2017-01-30 13:55:39 -08:00
Guido van RossumandGitHub 94641f5a84 Revert "Make all single-constraint TypeVars to use bounds" (#806)
Reverts python/typeshed#804.

Reason: until python/mypy#1551 is fixed this gives an error whenever @skip() is used.

Specifically see https://github.com/python/typeshed/pull/804#issuecomment-269926655.
2017-01-01 16:35:50 -08:00
Guido van RossumandGitHub b46280ec78 Make FrozenSet covariant. (#769)
Follow-up for PR #726.
2016-12-13 11:40:18 -08:00
Guido van RossumandŁukasz Langa bbbf1d8c7a PurePath.parent[s] should be properties (#706)
PurePath.parent[s] should be properties
2016-11-28 14:01:22 -08:00
Guido van RossumandGitHub ec4987fa5d Fix AwaitableGenerator inheritance; Awaitable is the return value, not the yielded value (#679) 2016-11-10 11:57:31 -08:00
Guido van RossumandGitHub bf8b5ac5fd Relax signature of gather() (#677)
Fixes #675
2016-11-10 10:55:29 -08:00
Guido van RossumandGitHub 970b6d5eb0 The distutils.Extension class does take positional args, and name+sources do not have defaults (#670) 2016-11-07 17:50:55 -08:00
Guido van RossumandGitHub 49a8a28c29 Use self-type for parent[s] properties too (#667)
This is possible now that python/mypy#2404 has landed.
2016-11-06 11:21:45 -08:00
Guido van RossumandGitHub 9881a2567e Start using selftype in 3.5 pathlib (#658) 2016-11-04 15:32:57 -07:00
Guido van RossumandGitHub b476028df7 Fix signature of run_coroutine_threadsafe() (#657) 2016-11-04 14:49:49 -07:00
Guido van RossumandGitHub 53014497c4 Add Coroutine. Fix signature for Generator.throw(). (#656) 2016-11-04 11:46:50 -07:00
Guido van RossumandGitHub 7f7e2d4e75 Fixes for asyncio (#654)
* Fix signature of gather().  Also fold long lines and kill _GatheringFuture.

* Add several missing exports from tasks.
2016-11-04 11:19:22 -07:00
Guido van RossumandGitHub 7c20adb715 Fix memoryview stub (#651)
Fixes python/mypy#2390
2016-11-02 17:18:44 -07:00
Guido van RossumandGitHub cb97bb54c0 Move 2.7 to 2 (#635)
Closes #579.
2016-10-26 16:24:49 -07:00
Guido van RossumandGitHub 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 RossumandGitHub 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
Guido van RossumandGitHub ed97067f6d Different fix for locale/str/__builtin__ issue (#570) 2016-09-23 10:18:04 -07:00
Guido van RossumandGitHub 8b0e6b886d Fix signature for __exit__ (#542) 2016-09-13 11:00:01 -07:00
Guido van RossumandJukka Lehtosalo 25cb6e4ab4 Make Mapping covariant. (#512)
* Make Mapping covariant.

Fixes #510.

This requires a `# type: ignore` on `__getitem__` and `get` because
mypy complains about covariant parameters.

FWIW typing.py needs to be changed too.  (It was covariant in the
value but invariant in the key -- typeshed was invariant in both.)

* Delete outdated comment.

* Backpeddle a bit -- Mapping key type should not be covariant.
2016-09-05 20:57:37 +01:00
Guido van RossumandGitHub de4e87f574 Changes required by mypy async-await support (#435) 2016-08-03 17:01:35 -07:00
Guido van RossumandGitHub 47f2746526 Fix the definitions of BadZip{f,F}ile. (#432)
In 2.7, only BadZipfile exists. In 3.x, both exist.
2016-08-02 09:04:45 -07:00
Guido van RossumandMatthias Kramm 6e596e9609 Fix decimal and contextlib (#428)
* Decimal does not support __round__, and its __abs__ returns Decimal.

* Fix contextmanager signature too.
2016-08-02 07:39:13 -07:00
Guido van RossumandMatthias Kramm 781b079f91 Add Supports{Abs,Float,Int,Round} as base classes for Decimal. (#415) 2016-07-28 15:13:27 -07:00
Guido van RossumandGitHub 39325bf159 Mypy now supports sys.platform and sys.version_info checks (#410) 2016-07-27 13:25:29 -07:00
Guido van RossumandMatthias Kramm 6d8628c247 Misc asyncio changes (#373)
* Add stub for cgi.parse_header().

* Improve asyncio stubs (far from complete)

* More asyncio changes.

* Use @overload to solve strange test failures.

* Add some TODOs. Make ProactorEventLoop conditional.

* Future should not inherit from Awaitable or implement __await__.

At least not yet.

* Fix AbstractServer.wait_closed() return type.

It's a generator, not a future.
2016-07-15 15:44:29 -07:00
Guido van RossumandMatthias Kramm 6aeea2a872 Add stub for cgi.parse_header(). (#371) 2016-07-15 15:42:51 -07:00
Guido van RossumandJukka Lehtosalo f47ff0b966 Add --strict-optional flag to mypy (#368) 2016-07-13 17:50:36 +01:00
Guido van RossumandMatthias Kramm 53d126f4d4 More fixes for argparse. (#362) 2016-07-13 07:51:29 -07:00
Guido van RossumandDavid Fisher b63e09c239 Fix some issues for dateutil and argparse (#357)
* Fix stubs for 2.7/dateutil. They were pretty broken.

(The 3/dateutil share some of the brokenness but that's still a TODO.)

* Fix argparse stubs.

- Container is not strong enough for choices.
- add_subparsers() returns something with an add_parser() method.
2016-07-12 16:24:33 -07:00
Guido van RossumandDavid Fisher 1c4662d2f3 Two small changes to help the mypy test suite pass (#355)
* Condition arg for skip{If,Unless} should be object, not bool.

* Env arg to os.get_exec_path() is a Mapping, not a Dict.
2016-07-12 14:10:36 -07:00
Guido van RossumandGitHub 8515cf5de8 Attempt to reduce cyclical dependencies between types and importlib. (#335)
- Move Loader and ModuleType into _importlib_modulespec.pyi.
- Add "import X as X" for these to types.pyi and importlib/abc.pyi.

The goal is to ensure mypy -i still works, to fix https://github.com/python/mypy/issues/1797.
2016-07-05 10:23:24 -07:00
Guido van Rossum b6b8554c6b Add stub version of Type[C] (#216) 2016-05-24 16:44:13 -07:00
Guido van Rossum 3e37029bfe Almost all re functions take a compiled pattern. (Even re.compile()!) (#203)
* Almost all re functions take a compiled pattern. (Even re.compile()!)

Fixes #188

Note: I'm using AnyStr so that the type of string used for pattern and
for the rest of the arguments must match.  This is not 100% correct,
since Python 2 sometimes allows mixed types.  But sometimes it
doesn't, depending on the values (e.g. non-ASCII bytes), and Python 3
always insists on matching, so I think this is actually a good idea.

* Same treatment for stdlib/3/re.pyi.
2016-05-16 11:25:59 -07:00
Guido van Rossum c21d8a41d5 Fix 2.7 bisect stubs (lo/hi have defaults). (#182) 2016-05-04 14:46:19 -07:00
Guido van RossumandJukka Lehtosalo 79554d6da2 Add type.__call__. Fix #158. (#159) 2016-04-25 16:22:00 +01:00
Guido van Rossum c7cdcede71 Merge pull request #141 from bdarnell/updates
Various updates to stdlib modules
2016-04-10 21:40:30 -07:00
Guido van Rossum 4f483dc314 Precision surgery to take out sqlalchemy test failures (#140)
* Comment out parts of the sqlalchemy stubs to make tests pass.

* Run all tests, one step per Python version.
2016-04-10 20:45:42 -07:00
Guido van Rossum 5894f631ae Merge pull request #134 from tharvik/master
add `__dict__` attribute to class instance
2016-04-04 08:38:12 -07:00
Guido van Rossum 5be96f78d8 Merge pull request #129 from isg/patch-2
Update dbapi2.pyi to allow `execute` without binding params
2016-03-23 13:30:57 -07:00
Guido van Rossum 7484499ce5 Merge pull request #121 from jukebox/fileinput
fileinput first version
2016-03-23 10:35:04 -07:00
Guido van Rossum 53e2d43f37 Merge pull request #127 from mulkieran/master-reduce
Fix signature for reduce in some files.
2016-03-22 08:36:07 -07:00
Guido van Rossum 3ff8635d2c Merge pull request #124 from ddfisher/master
Add version keyword arg to argparse.ArgumentParser.add_argument
2016-03-18 10:04:19 -07:00
Guido van Rossum 3657e5146e Merge pull request #123 from jstasiak/python3-fcntl
Improve Python 3 fcntl stub
2016-03-17 16:53:49 -07:00
Guido van Rossum 625b9c389a Merge pull request #122 from ahaven/contextmanager-stubs
Better stub for contextlib.contextmanager.
2016-03-16 15:29:39 -07:00
Guido van Rossum b7eedfa07c Merge pull request #120 from mgeisler/pickle-py2
Complete pickle and cPickle stubs for Python 2
2016-03-15 12:43:58 -07:00
Guido van Rossum 6dcb32c7d9 Merge pull request #119 from mgeisler/pickle
Complete pickle stubs
2016-03-15 08:04:59 -07:00
Guido van Rossum f523a8e9f1 Merge pull request #116 from mgeisler/configparser
Add stubs for configparser
2016-03-15 08:02:53 -07:00
Guido van Rossum b1a5d2194f Merge pull request #118 from mgeisler/getpass
Complete getpass stubs
2016-03-15 07:59:10 -07:00
Guido van Rossum 98c86edfbd Merge pull request #117 from mgeisler/ignore-editor-backup-files
Ignore Emacs backup files
2016-03-15 07:58:06 -07:00
Guido van Rossum c40da79e8f Merge pull request #106 from mkurnikov/setuptools-stubs
Stubs for setuptools' pkg_resources package
2016-03-14 18:41:48 -07:00
Guido van Rossum cae70c3707 Merge pull request #115 from mr-c/patch-3
Allow adding custom argparse.Actions in add_argument
2016-03-14 09:53:13 -07:00
Guido van Rossum a946304d49 Merge pull request #113 from ddfisher/master
Make all function annotations accessible from builtins complete
2016-03-11 16:49:23 -08:00
Guido van Rossum b2c4b10d6b Merge pull request #112 from isg/patch-1
Add tornado.locks module
2016-03-09 21:37:26 -08:00
Guido van Rossum b31e5eec54 Merge pull request #110 from jstasiak/python3-inspect
Improve Python 3 inspect stub
2016-03-09 16:31:19 -08:00
Guido van Rossum df40eab77f Merge pull request #111 from jstasiak/python27-inspect-fix
Fix Python 2.7 inspect stub (currentframe + frame type)
2016-03-09 16:14:40 -08:00
Guido van Rossum 307516c95b Merge pull request #101 from Naruto0/master
sqlite3 stub for 2.7  and 3
2016-03-09 13:13:20 -08:00
Guido van Rossum 33f13dec18 Merge pull request #108 from jstasiak/python27-inspect
Improve Python 2.7 inspect stub
2016-03-09 13:07:37 -08:00
Guido van Rossum 49446569e1 Merge pull request #98 from ismail-s/feature/type_check_xml
Type check xml.etree module
2016-03-09 12:48:56 -08:00
Guido van Rossum f710c1f313 Merge pull request #102 from onyb/onyb-patches
Add stub for multiprocessing.cpu_count()
2016-03-05 21:05:24 -08:00
Guido van Rossum 01e817b17c Merge pull request #104 from ymyzk/update-gc
Update stub for gc
2016-03-05 21:03:43 -08:00
Guido van Rossum c8146aa9c2 Merge pull request #103 from ymyzk/update-zlib
Update stub for zlib
2016-03-05 21:02:42 -08:00
Guido van Rossum 8808bac6fc Merge pull request #99 from Naruto0/master
reduce use of @overload in socket stubs
2016-03-03 09:21:46 -08:00
Guido van Rossum 4cc112fa07 Merge pull request #100 from jstasiak/type-overload
Define three argument type() overload (Python 3)
2016-03-03 09:17:39 -08:00
Guido van Rossum 6076c051d5 Merge pull request #97 from dahlia/syntax-error-attributes
Specify attribute types of SyntaxError
2016-02-29 10:15:57 -08:00
Guido van Rossum 0a496917e3 Merge pull request #95 from youtux/feature/decimal-2.7
Port decimal stub to Python 2
2016-02-26 13:09:42 -08:00
Guido van Rossum 2840e71fbf Merge pull request #92 from lbolla/issue87-shelve
Issue #87 Stub for shelve
2016-02-25 10:59:37 -08:00