Commit Graph

16 Commits

Author SHA1 Message Date
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