Commit Graph

27 Commits

Author SHA1 Message Date
Jelle Zijlstra
5021b30711 functools: remove first type param of cached_property (#3553)
Fixes #3547

This removes some type safety in exceptional cases, like code that interacts
directly with cached_property objects, but that seems like a price worth
paying.
2019-12-21 10:42:43 -08:00
layday
e404e1592d Preserve original type in total_ordering annotation (#3552)
See https://github.com/microsoft/pyright/issues/443
for reference.
2019-12-20 17:18:05 -08:00
Sebastian Rittau
add0b5e930 Add functools.cached_property (#3439)
Part of #3319
2019-11-06 07:21:32 -08:00
Sebastian Rittau
ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
Sebastian Rittau
62bbdf856c Add several Python 3.8 annotations (#3347) 2019-10-12 19:36:56 +02:00
Sebastian Rittau
256b3ce8ab Remove a bunch of unused imports (#3323) 2019-10-08 07:59:32 -07:00
Jelle Zijlstra
ada0570efc Revert "Define functools.partial as overloaded function instead of its own class (#2878)" (#3077)
This reverts commit e45f443d85.
2019-06-20 20:39:49 -07:00
berdario
e45f443d85 Define functools.partial as overloaded function instead of its own class (#2878) 2019-05-06 12:05:02 -04:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Sebastian Rittau
95eff73ab2 Drop Python 3.3 support from several stubs (#2265)
* Drop Python 3.3 support from several stubs

* Revert wrong socketserver changes
2018-06-20 16:49:47 -07:00
Ethan Smith
1c47458ac6 Add cache_clear to lru_cache (#1941) 2018-03-05 18:52:46 -08:00
rchen152
fd8be43044 Fix the return type of functools.update_wrapper() (#1589) 2017-09-05 20:03:51 -07:00
Jelle Zijlstra
42cd0f59e5 add functools.partialmethod (#1316)
Plus other cleanup to the py3 functools stub
2017-05-23 15:36:09 -07:00
Lukasz Langa
6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Lukasz Langa
2058ae30ab Proper singledispatch type definitions
Correctly detects calls to `register()` with a function of incompatible return
type.  Correctly recognizes the `register()`, `dispatch()`, and
`_clear_cache()` methods on a generic function, as well as the `registry`
mapping.

Possible future improvements: it would be amazing if `register()` checked if
the first argument of the registered callable is indeed of valid type. This
would require Callable[] to support varargs.  It would also be great if we
could read the arguments of the remaining arguments during `@singledispatch()`
and cross-check them during `register()` with the currently registered
implementation. Again, this would require Callable[] to become much more
advanced.
2016-12-19 12:54:08 -08:00
Kai Lautaportti
f6bbc46c35 Fix functools.lru_cache() type hint to allow maxsize=None (#627) 2016-10-22 15:45:57 -07:00
Jakub Stasiak
0edb87fc6b Make functools.cmp_to_key more realistic (#458)
The documentation[1] says:

    A comparison function is any callable that accept two arguments,
    compares them, and returns a negative number for less-than, zero for
    equality, or a positive number for greater-than.

This doesn't seem possible with the comparison function defined as
returning bool.

[1] https://docs.python.org/3.6/library/functools.html#functools.cmp_to_key
2016-08-10 12:12:52 -07:00
Sidharth Kapur
8b428ce2ff Fix imports 2016-02-22 17:44:07 -06:00
Sidharth Kapur
241e741ef2 Change Iterator to Iterable in type of reduce 2016-02-22 17:41:47 -06:00
Sidharth Kapur
dc647c3ed5 Fix imports 2016-02-20 22:49:12 -06:00
Sidharth Kapur
fd9310fa97 Overload the reduce function 2016-02-20 22:46:39 -06:00
Sidharth Kapur
b0c0f94210 Fix type for reduce 2016-02-20 22:31:17 -06:00
Robert T. McGibbon
a40418ed7b Enhance type information for lru_cache 2016-01-11 01:46:05 -08:00
Guido van Rossum
87bc00eb2a Unify 2.7 and 3 stubs for functools. 2016-01-08 10:10:50 -08:00
Matthias Kramm
94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Matthias Kramm
337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00