Siva Chandra
701f970c6f
Add overrides for the methods 'readlines' and 'writelines' in TextIOBase. ( #2551 )
...
Without the overrides, MRO will pick the methods in IOBase which have
the wrong signatures.
2018-10-30 22:44:18 +01:00
PRAJWAL M
13e84dc004
unittest: Complete assertRaisesRegex ( #2568 )
...
fixes #2523
2018-10-30 09:11:16 -07:00
Sebastian Rittau
e3a79d0ce6
Remove third_party/3/enum.py ( #2563 )
...
All Python 3 versions supported by typeshed (3.4+) have enum as part
of the standard library.
Make the third-party Python 2 version consistent with the Python 3 version.
2018-10-27 08:54:56 -07:00
Andrew Svetlov
07bc1c9997
Fix return annotation for loop.call_later() and loop.call_at() ( #2559 )
2018-10-26 14:15:32 +02:00
Sebastian Rittau
0730fe5fcb
Fix return of patch() and patch.multiple() ( #2520 )
...
* Fix return of patch() and patch.multiple()
* Update third party mock as well
2018-10-25 20:55:11 -07:00
Michael J. Sullivan
ffeede30d2
Make SyntaxError.offset be optional ( #2557 )
2018-10-25 13:54:55 -07:00
Rebecca Chen
3d8a8ec45d
Fix py3 types of inspect.FullArgSpec.var(args|kw) ( #2556 )
2018-10-25 10:45:59 -07:00
Sebastian Rittau
006a79220f
Flake8 fixes ( #2549 )
...
* Fix over-indented continuation lines
* Fix under-indented continuation lines
* Fix whitespace around default operator problems
* Limit line lengths
* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Jerome Leclanche
f362cf47fa
Fix email.parser.BytesParser and BytesHeaderParser method args ( #2548 )
...
Fixes #2502
2018-10-24 06:22:08 -07:00
Michael J. Sullivan
da6e18caf7
Make os.dup2 return int on Python 3.7 ( #2543 )
...
* Add inheritable param also
2018-10-23 23:15:35 +02:00
Adam Simpkins
79b2df4b24
os.DirEntry.stat() accepts a follow_symlinks keyword argument ( #2538 )
...
This function accepts the same arguments as the is_file() and is_dir()
methods in this class.
This also marks the follow_symlinks arguments to `is_dir()` and
`is_file()` as keyword only.
2018-10-23 23:13:33 +02:00
Michael Lee
53d12c0a6c
Makes enums accept objects in the argument type ( #2539 )
...
Fixes problems with using enums with the --disallow-any-expr flag.
2018-10-23 09:52:15 +02:00
Dave Halter
a437fcc886
Add attributes to int and float ( #2529 )
...
* real, imag, conjugate all exist on int and float
* numerator, denominator exists on int
2018-10-23 00:44:36 +02:00
Dave Halter
a972a8db73
Add cr_await, cr_code, cr_frame and cr_running to Coroutine ( #2530 )
2018-10-21 13:56:52 +02:00
Hannes Karppila
4d86092df0
Fix return type of ast.NodeTransformer.generic_visit ( #2486 )
2018-10-19 08:50:50 +02:00
Andrew Svetlov
d43d8a2884
loop argument for set_event_loop() is optional, it can be None ( #2525 )
2018-10-18 14:24:54 +02:00
Lourens Veen
703c03e4b0
Add UserString and UserList data attribute ( #2518 )
2018-10-16 10:36:17 +02:00
Daniel Li
254af0ff2a
Add stub for pathlib2.Path.__div__ ( #2507 )
2018-10-16 07:31:58 +02:00
thautwarm
e5713d2942
ImportFrom level cannot be optional ( #2517 )
2018-10-16 04:10:40 +02:00
Fionn Fitzmaurice
a6b4f687e0
Set urllib.parse.urljoin url argument to optional ( #2513 )
2018-10-11 19:50:52 +02:00
Wim L
fafed64213
Make _NetlocResultMixinBytes derive from _NetlocResultMixinBase[bytes], not [str] ( #2503 )
2018-10-03 19:26:12 -07:00
Richard Levasseur
4122a70648
Add some private methods to unittest ( #2494 )
...
This adds a few stubs that are used by absl-py, and, without them, cause
type checker errors under Pytype:
* TestCase._formatMessage
* TestCase._testMethodName
* TestCase._getAssertEqualityFunc
* TestProgram.runTests
2018-10-01 20:18:26 -07:00
Sebastian Rittau
2d3edbd348
Slightly improve annotation of tkinter.Tk ( #2498 )
...
Closes : #1767
2018-10-01 20:15:22 -07:00
Sebastian Rittau
7be20fcf91
Return Any, not Union from IP parsing functions ( #2499 )
...
Closes : #2080
2018-10-01 08:48:39 -07:00
Scott Colby
25c9fdc20d
Add bytes as legal type for RawConfigParser.read. ( #2484 )
...
Add `bytes` as legal type for `RawConfigParser.read` in 3.7.
Closes #2476 .
https://bugs.python.org/issue31307
2018-09-26 23:27:33 -07:00
spdkils
6968ff6cb0
error:"IPv4Network" has no attribute "hostmask" ( #2482 )
...
The hostmask property from the _BaseNetwork class was missing a stub.
This was causing type errors whenever using the hostmask property.
Fixes #2481 .
2018-09-25 22:58:05 -07:00
Michael J. Sullivan
65863bebf4
make __class__ refer to the current object's class ( #2480 )
...
This is just a direct rehash of #1549 .
2018-09-25 18:04:37 -07:00
Michael R. Crusoe
2e0af18dda
slices of MutableSequences are also MutableSequences ( #2428 )
2018-09-25 13:06:59 -07:00
Sebastian Rittau
ea2122741f
os.path.exists (Py 3) accepts a file descriptor ( #2451 )
...
Closes #1653
2018-09-24 07:53:44 -07:00
Michael J. Sullivan
4f4a025409
Remove tuple's __init__ method ( #2467 )
...
The __new__ method should suffice, and having both interferes with providing
a __new__ in namedtuples, which we want to do to fix
https://github.com/python/mypy/issues/1279 .
2018-09-18 20:01:14 -07:00
Sebastian Rittau
9827132d5b
Fix return types in urllib.request ( #2389 )
...
* Tighten return types of URL handlers
* urlopen() etc. return a modified HTTPResponse
* Add missing methods to HTTPResponse
2018-09-18 16:45:09 -07:00
Jelle Zijlstra
1bc1fc2117
add constructor arguments for TimeoutExpired ( #2466 )
...
Previously, constructing a TimeoutExpired directly worked because Exception allowed arbitrary kwargs. We fixed that recently, but now mypy gives an error on creating a TimeoutExpired with legal arguments.
2018-09-18 14:02:38 +02:00
Dmitry Shachnev
c6c8d7e540
unittest: make assertIn/assertNotIn accept iterables ( #2447 )
...
Fixes #2381 .
2018-09-11 18:48:44 +02:00
Sebastian Rittau
60548f122f
AbstractEventLoop exception handler is optional ( #2446 )
...
Closes #1616
* get_exception_handler() is only available in 3.5
2018-09-11 08:26:57 -07:00
Sebastian Rittau
44bdf6c6c7
Fix RawConfigParser.readfp() annotation ( #2443 )
...
Closes #689
2018-09-11 08:22:36 -07:00
Zac Hatfield-Dodds
6afa610191
memoryview is a context manager ( #2442 )
...
Since Python 3.2, __enter__ returns self and __exit__ calls self.release()
2018-09-11 14:13:38 +02:00
Jelle Zijlstra
8b9e4c378a
fix module argument to unittest.main ( #2403 )
2018-09-10 11:04:05 -07:00
Ivan Levkivskyi
8ed0159445
Remove duplicate method definitions in importlib and jinja2 ( #2427 )
2018-09-04 07:50:47 -07:00
Zsolt Dollenstein
5ed39dd8ce
bring protocols.pyi more inline with documentation ( #2421 )
2018-08-31 13:56:57 +02:00
Sebastian Rittau
bbe9b94b00
smtplib improvements ( #2419 )
...
* Mark SMTP attibutes with class defaults with "= ..."
* Add SMTP.command_encoding
* Annotate SMTP.__exit__()
* Add SMTP.auth() et al.
* Add LMTP_PORT constant
2018-08-27 20:22:19 -07:00
Ollie Ford
2e7e8cc009
Add 3.7 variant of subprocess.run ( #2409 )
...
Python 3.7 added:
- `text` as an alias of `universal_newlines`
- `capture_output` for `stdout=PIPE,stderr=PIPE`
cf. https://docs.python.org/3.7/library/subprocess.html
2018-08-23 11:50:23 -07:00
Ilya Konstantinov
fe04d3aa2d
Accept str in cast ( #2408 )
2018-08-21 07:53:35 -07:00
Jelle Zijlstra
9e023e7586
minor namedtuple fixes ( #2227 )
...
- The extra arguments aren't keyword-only in 2.7.
- Added the `defaults` argument in 3.7 (https://docs.python.org/3.7/library/collections.html#collections.namedtuple ).
2018-08-19 03:47:10 +01:00
Goldstein
c3b5513475
Add annotations to runpy.pyi ( #2395 )
2018-08-18 19:25:48 -07:00
Matt Gilson
ebea29a0ed
Make defaultdict.default_factory Optional. ( #2401 )
...
The API allows for setting this to `None`. It makes the defaultdict behave more like a regular dict.
Fixes #2375 .
2018-08-18 19:22:15 -07:00
Sebastian Rittau
25ac4d6af4
Implement StartResponse using a protocol ( #2392 )
...
* Add ExcInfo and OptExcInfo type aliases
* Implement StartResponse using a protocol
* Mark stub-only types with an underscore
* Remove wrong TODO note
python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
2018-08-17 08:36:00 -07:00
Sebastian Rittau
7ad682b0ae
Improve annotations for json.load() and loads() ( #2382 )
...
* loads() only accepts str as first argument for Python < 3.6
* Use a protocol for the first argument to load() (cf python/typing#564 )
2018-08-14 10:41:33 -07:00
Ville Skyttä
b0e9998c99
Complete smtplib and sync with 3.5+ ( #2371 )
2018-08-09 11:30:24 -07:00
Michael Lee
bc8d68cd34
Add constructor for HTTPError in urllib2/urllib.error ( #2373 )
...
It seems that code using HTTPError previously worked by accident
because we used to accept arbitrary keyword arguments when
instantiating BaseException, or any subclass of BaseException
(see https://github.com/python/typeshed/pull/2348 ).
This commit adds in the correct constructor (which also lets the
user specify the arguments in keyword-argument form).
Note: I'm not very familiar with the urllib libraries, so I opted
to just add the signature and leave it up to somebody else to
fill in the types.
2018-08-08 17:05:35 -07:00
Ville Skyttä
5b2c8dc883
concurrent.futures: Sync with Python 3.7 ( #2343 )
2018-08-08 08:26:01 -07:00