Commit Graph

2327 Commits

Author SHA1 Message Date
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
Sebastian Rittau
f07bdf418b Fix pytype test output (#2534) 2018-10-22 09:14:22 +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
Michael
82d54ce57b Update PyJWT's exceptions (#2522)
Regards jpadilla/pyjwt#316, jpadilla/pyjwt#335, jpadilla/pyjwt#340
2018-10-21 13:30:37 +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
Grzegorz Śliwiński
4ed42f899e click.option's defined type as return type of callable (#2505) 2018-10-16 03:53:29 +02:00
Siva Chandra
cec2202550 Widen the type of the file argument to Python 2's json.dump. (#2516) 2018-10-12 15:58:46 -07:00
Rebecca Chen
ea0a0fd17e Fix _StrType in difflib in Python 2. (#2514)
difflib functions accept unicode as well.
2018-10-12 14:39:24 +02:00
Fionn Fitzmaurice
a6b4f687e0 Set urllib.parse.urljoin url argument to optional (#2513) 2018-10-11 19:50:52 +02:00
Semyon Proshev
4859742087 Inherit InstanceType from object (#2511) 2018-10-08 14:31:21 +02:00
Siva Chandra
1b37ca4297 Make csv.reader take Iterator[Text] argument instead of Iterator[str]. (#2508) 2018-10-05 13:10:41 -07:00
Grzegorz Śliwiński
94485f9e4f skip .git files from linting with flake8 (#2506) 2018-10-05 08:29:21 -07:00
Wim L
fafed64213 Make _NetlocResultMixinBytes derive from _NetlocResultMixinBase[bytes], not [str] (#2503) 2018-10-03 19:26:12 -07:00
Jelle Zijlstra
bc3f9fe1d3 fix typing.Pattern in Python 2 (#2219)
Fixes #2199
2018-10-01 20:35:13 -07:00
Manuel Vázquez Acosta
1297caa27b Make 'datetime' a subclass of 'date'. (#2488)
Fixes #2487.
2018-10-01 20:19:02 -07:00
Benjamin Peterson
b2a9f2e383 Add new gflags names. (#2489)
As a described in https://github.com/google/python-gflags/blob/master/absl_migration/migration_guidelines.md, gflags did a mass rename to PEP 8-style names.
2018-10-01 20:18:51 -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
Jan Teske
94a1b09d1d Support PathLike arguments in the logging module. (#2500)
Since Python 3.6 logging.FileHandler's filename argument can be a
PathLike object. Same for FileHandler's subclasses.
logging.basicConfig passes its filename argument to a FileHandler, so
this can be a PathLike object too.
Finally, logging.config.fileConfig passes its fname argument to
ConfigParser.read, which also takes a PathLike since version 3.6.1.
2018-10-01 20:13:37 -07:00
Sebastian Rittau
7be20fcf91 Return Any, not Union from IP parsing functions (#2499)
Closes: #2080
2018-10-01 08:48:39 -07:00
Ruben Berenguel
3814d47aff Change json arguments in requests to Any (#2497)
Fixes #2492
2018-09-30 09:23:34 -07:00
Adam Dangoor
45a11b974e Update parse_multipart return type to support Python 3.7 (#2474)
* Add encoding and errors parameters to cgi.parse_multipart stub.
2018-09-27 22:19:02 +02:00
Benjamin Peterson
a8cfde79c4 Use structural inference for enum34 EnumMeta. (#2490)
Fixes python/mypy#5577.
2018-09-27 09:27:41 -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
Ran Benita
4f396f8130 Improve the pytz stubs (#2475)
Based on the pytz docs http://pytz.sourceforge.net/ and code (version
2018.5).

- Accurately model the return value of the `timezone()` function. This
  necessitates modeling the internal pytz class hierarchy which is quite
  inconsistent.

- Expose `_BaseTzInfo` as `BaseTzInfo`.

  This change is useful because this type is importable and otherwise
  there is no pytz type which can be used in type annotations, e.g. in a
  function which takes a pytz `tzinfo` with the `localize` method,
  rather than a general `datetime.tzinfo`.

- Remove the lazy.pyi stubs. The `lazy` module contains some unrelated
  general data structures. It is not a public API - it is not documented
  and the types are not included in `__all__`.

- Remove methods which are already specified by inheritance in
  `datetime.tzinfo`.

- Add several public exception classes.

- Fill in the generic type parameters of the exposed `Dict`/`List`
  constants. Also change `Dict` -> `Mapping` because it is not actually
  a proper `dict`.

- Some style/ordering improvements.
2018-09-26 07:11:24 -07:00
Michael R. Crusoe
3af4ff9f94 PY2: UUID accepts both unicode and str (#2478) 2018-09-26 13:31:04 +02: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
Rebecca Chen
9fda6b20ec Make the signature of optparse.OptionParser.parse_args more precise. (#2464) 2018-09-25 21:15:10 -07:00
Rebecca Chen
cfa52c7c38 Add a stub for google.protobuf.json_format. (#2479) 2018-09-25 21:03:27 -07:00
Israel Tsadok
2a30462c4a The filter function may return str, tuple or list (#2472)
In Python 2, the return type of filter depends on the iterable
parameter.
2018-09-25 20:26:23 -07:00
Siva Chandra
f73d060042 Use Text under Python 2 in shutil.pyi. (#2471) 2018-09-25 20:25:04 -07:00
Sebastian Rittau
9f98737119 weakproxy fixes (#2450)
* The callback argument to ref() and proxy() is optional, per documentation
* proxy() returns a ProxyType or CallableProxyType

Closes #1627
2018-09-25 20:23:02 -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
Nathaniel Manista
cca6ee43e6 Fix traceback.FrameSummary's "line" parameter (#2470)
traceback.FrameSummary's "line" parameter is a string that is the text
of a line of code, not an int that is the line number of a line of
code.
2018-09-21 16:58:25 -07:00
Rebecca Chen
eb09e2898b Update pytype_test to be easier to run manually. (#2469)
* Moves the pytype installation to requirements-tests-py3.txt, now
  that pytype can run under Python 3.5+.
* Changes tests/pytype_test.py to not require a --python{version}-exe
  argument when it can automatically find the Python interpreter, and
  cleans up a few typos and out-of-date things.
* Updates the appropriate documentation.
* Updates .travis.yml.
2018-09-21 09:38:33 -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
Emil Hessman
d70a6cbcc0 Add missing instance attributes to logging.LoggerAdapter (#2462) 2018-09-18 20:23:04 +02: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
Rebecca Chen
b7c262523b Fix the Python 2 signature of tempfile._TemporaryFileWrapper.write. (#2465) 2018-09-18 13:54:56 +02:00
Rebecca Chen
7dbc8748dc Add __iter__ method to codecs.StreamReader. (#2463) 2018-09-18 13:46:16 +02:00
Matthew Christopher
110ebf4bfe Add exc_text to LogRecord (#2461) 2018-09-18 13:39:05 +02:00
Matt Robinson
c1eb946324 Add name attribute to logging.Handler (#2459)
* Add name attribute to logging.Handler
* Replace some older type comments with variable annotations around the addition line.
2018-09-17 19:36:49 +02:00
Christian Haudum
daae0c7980 Allow any keyword argument in argparse add_argument() method (#2460)
Closes #2457
2018-09-15 22:05:15 +02:00