Commit Graph
307 Commits
Author SHA1 Message Date
Greg WardandJelle Zijlstra 603458ba09 Fix some incorrect/incomplete annotations for redis.client.PubSub (#3408)
* redis: Fix return value declarations in redis.client.PubSub

get_message() was declared incorrectly. Start here:

  https://github.com/andymccurdy/redis-py/blob/3.3.11/redis/client.py#L3298-L3300

where it's obvious that get_message() returns either None or the
output of handle_message().

So what does handle_message() return? Combine:

  https://github.com/andymccurdy/redis-py/blob/3.3.11/redis/client.py#L3316-L3336
  https://github.com/andymccurdy/redis-py/blob/3.3.11/redis/client.py#L3366

and you can see it returns None or a dict mapping str to something.

* redis: Fix incorrect declaration for PubSub.get_message() argument

Docstrings says it's a float:

  https://github.com/andymccurdy/redis-py/blob/3.3.11/redis/client.py#L3293-L3295

And it eventually gets passed to settimeout() on a socket:

  https://github.com/andymccurdy/redis-py/blob/3.3.11/redis/connection.py#L182

* redis: Annotate one more method arg in PubSub class

get_message() and handle_message() are closely related:
ignore_subscribe_message does the same in both, and its default value
in both is False.
2019-10-30 07:33:00 -07:00
Angela AmbrozandJelle Zijlstra b5b9a3959d Add pytz.FixedOffset (#3393) 2019-10-29 19:50:20 -07:00
Dima BogerandJelle Zijlstra aae01b8de0 Add sort_keys param to all dump-like functions in PyYAML (yaml) lib (#3417) 2019-10-29 19:44:04 -07:00
Taneli HukkinenandSebastian Rittau beaf306d12 Allow None for click.core.Context.default_map (#3416) 2019-10-29 00:10:27 +01:00
Ilaï DeutelandJelle Zijlstra bf944dbf94 Update stubs for tabulate (#3391) 2019-10-24 20:19:08 -07:00
Anthony SottileandSebastian Rittau 9feb21d029 Add werkzeug.exceptions.FailedDependency (#3403)
Available since werkzeug==0.15.0
2019-10-24 00:14:52 +02:00
Sebastian RittauandGitHub ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
JR HeardandSebastian Rittau bf862d9079 Add missing @property to Response.next() stub (#3384) 2019-10-18 10:23:15 +02:00
David TuckerandSebastian Rittau 38fbdc9490 Fix show_default type in click.option signatures (#3385) 2019-10-18 10:22:02 +02:00
Trim21andSebastian Rittau 6b68fb04c9 pymysql.Cursor is a context manager (#3379) 2019-10-17 15:01:55 +02:00
Jakub StasiakandJelle Zijlstra 6e4f6403ac Add PEP 593 (Annotated etc.) typing_extensions stubs (#3369)
The code has been added to typing_extensions in
https://github.com/python/typing/pull/632 and
https://github.com/python/typing/pull/639/.
2019-10-16 11:41:38 -07:00
Benjamin PetersonandJelle Zijlstra add16d2715 protobuf: Fix inadvertently deleted annotations. (#3364)
* protobuf: Fix inadvertantly deleted annotations.

* Run black on protobuf.
2019-10-14 13:41:58 -07:00
Sebastian RittauandGitHub 0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
Benjamin PetersonandSebastian Rittau 036abc7fda protobuf: Narrow type of Message.FromString. (#3340)
Remove unnecessary definitions in sub-classes.
2019-10-11 08:28:28 +02:00
Benjamin PetersonandSebastian Rittau fc23c8274f protobuf: Tighten annotations for MergeFromString and ParseFromString. (#3333) 2019-10-10 18:07:53 +02:00
Jukka LehtosaloandGitHub eca93753ee Update the signature of decorator.decorator (#3336)
Nothing prevents a decorator defined using `@decorator` from
changing the signature of the decorated function. For example,
this example changes the return type to `str`:

```
from decorator import decorator

@decorator
def stringify(f, *args, **kwargs) -> str:
    return str(f(*args, **kwargs))
```

The old signature caused false positives in internal Dropbox code.

I couldn't come up with a signature that would produce better types
with mypy while not generating false positives.
2019-10-10 16:45:06 +01:00
Vasily ZakharovandJelle Zijlstra 57384ce033 Revised stubs for geoip2 third party library (#3317) 2019-10-09 19:28:42 -07:00
Utkarsh GuptaandSebastian Rittau bd7222c396 models.pyi: Add missing requests.Respons.next() (#3328)
Closes: #3207
2019-10-09 19:01:30 +02:00
Jukka LehtosaloandGitHub 3a2fdfd45d Make it explicit that the cryptography stubs are incomplete (#3331) 2019-10-09 16:20:36 +01:00
Jukka LehtosaloandSebastian Rittau 0914d50b49 Fix the signature of decorator.contextmanager (#3330) 2019-10-09 16:58:37 +02:00
Benjamin PetersonandSebastian Rittau 50961d45a1 protobuf: Add Message.FromString static method. (#3327) 2019-10-09 07:59:07 +02:00
Lukáš LalinskýandSebastian Rittau a6f146e651 Fix return type of werkzeug's ProxyFix (#3320) 2019-10-08 10:30:00 +02:00
Rafi BlecherandSebastian Rittau 6e4708ebf3 Add type stub for decorator lib (#3038) 2019-10-07 22:21:31 +02:00
GlyphandSebastian Rittau 83589844c9 rrule.weekday(...) returns rrule.weekdays, not _common.weekdays. (#3274) 2019-10-05 01:49:49 +02:00
Sebastian RittauandJelle Zijlstra 0a426d8a8e Move cryptography from 2 to 2and3 (#3304)
The cryptography stubs are very rudimentary at the moment, but there
is nothing that limits them to just Python 2.

Closes: #3303
2019-10-04 14:11:42 -07:00
Michael J. SullivanandGitHub ad881f94d7 Add the mypyc_attr function to mypy_extensions (#3290) 2019-10-01 17:45:47 -07:00
Sebastian RittauandJelle Zijlstra c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Benjamin PetersonandJelle Zijlstra 23b353303b Allow passing bytes and byte string to yaml load APIs. (#3287) 2019-09-30 22:30:28 +02:00
Sebastian RittauandJelle Zijlstra ed4b1de0ad Fix third_party errors with --disallow-any-generics (#3278)
Part of #3267. Together with #3276 this should fix all such problems.
2019-09-30 13:14:01 +02:00
Alex JurkiewiczandSebastian Rittau efdbefee86 Add return types for pymysql.connection.close/cursor (#3268) 2019-09-27 07:04:23 +02:00
Colin GilgenbachandSebastian Rittau c33239b011 click: Support tuples of _ParamTypes, CliRunner fixes (#3259) 2019-09-24 14:11:25 +02:00
Augusto HackandSebastian Rittau 829c646d69 Added constructor types for click.FloatRange (#3257) 2019-09-23 20:40:54 +02:00
Augusto HackandSebastian Rittau c1ec292344 Added missing top-level export to click (#3256) 2019-09-23 18:48:13 +02:00
BradandSebastian Rittau babc0c1912 Accept bytes to several Redis client commands (#3238) 2019-09-17 11:30:00 +02:00
Alex GarbuttandSebastian Rittau 895ae0fd9b requests.Session.request data arg accepts an iterable of tuples (#3237) 2019-09-16 22:16:52 +02:00
Ivan LevkivskyiandSebastian Rittau d0f3eb2d6b Use Text for text arguments to click.[un]style (#3233) 2019-09-16 15:36:28 +02:00
Sebastian RittauandGitHub efb4af0108 Mark some types as non-hashable (#3219)
Based on @JelleZijlstra's PR #2221.

Fixes #2148
2019-09-04 17:38:09 +02:00
Pascal CorpetandSebastian Rittau b94fa842eb Type response of Flask test client methods: get, post, etc. (#2904) 2019-09-03 11:12:11 +02:00
Shannon ZhuandJelle Zijlstra f9300ed1ed Update pyre_extensions stub (#3214) 2019-08-30 16:15:24 -07:00
Colin GilgenbachandSebastian Rittau 99e8ed42a4 Mark ParamType.fail() as NoReturn (#3213)
This function just raises a click.BadParameter exception with the supplied arguments.
2019-08-29 17:57:43 +02:00
Sebastian RittauandJelle Zijlstra ae881faaf1 Remove custom _Text type (#3211)
* Remove custom _Text type

Since the custom type was only used in argument types, it was
effectively only an alias for typing.Text.

* Run requests/api.pyi through black
2019-08-29 08:51:59 -07:00
Benjamin PetersonandMichael J. Sullivan f53f52de57 requests: Allow bytes for url parameters. (#3209)
typeshed already partially reflected https://github.com/psf/requests/pull/2238 but not completely.
2019-08-28 21:53:19 -07:00
Shannon ZhuandJelle Zijlstra 72010bc5dc Update how mock classes alias to Any (#3182)
* Update how mock classes alias to Any

> First, the z: Any situation looks like a bug or accidental feature to me.
This is definitely meant (and works) as a variable declaration; that it
also allows using z as a type seems wrong. I can't find any evidence in
PEP 484 that this was intended; in mypy it's likely the accidental result
of other design choices meant to shut up errors about Any.

Ideally these classes could be declared as empty class stubs, but since the comments suggest this isn't possible yet, let's update these to be type aliases to Any rather than global variables of type Any. This would avoid invalid type errors when the implementation of type checkers respect the intention that `z: Any` does not make `z` a valid type.

* Update mock.pyi
2019-08-19 17:10:27 -07:00
Rebecca ChenandJelle Zijlstra fab2ee0d7c Remove unnecessary quotes around forward references. (#3191) 2019-08-16 20:29:32 -07:00
Patrick ValsecchiandJelle Zijlstra 26f575130c Add some redis types (#3092) 2019-08-10 13:22:40 -07:00
Sebastian RittauandJelle Zijlstra 628eee29f7 Use Literal in a few more places (#3176) 2019-08-10 13:08:18 -07:00
Sebastian RittauandGitHub c579f91077 Improve werkzeug exceptions slightly (#3178)
* Use Text for HTTPException.description
* Add Unauthorized.www_authenticate
* Remove wrong get_headers() overrides
2019-08-09 20:05:56 +02:00
Ilya KonstantinovandSebastian Rittau 4c8d577d68 flask: allow view func body to be dict (#3149) 2019-07-31 02:04:36 +02:00
Allison KapturandSebastian Rittau 15aa18d0a2 dateutil.rrule can take dates (#3154) 2019-07-27 11:39:23 +02:00
Sebastian RittauandGitHub 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00