Commit Graph

69 Commits

Author SHA1 Message Date
cshesse
9c87b24041 Add default value to BaseContext.Pipe() (#3479) 2019-11-23 16:12:45 +01:00
Martijn Pieters
c53bc5a7ab Add missing elements for multiprocessing.dummy (#3471)
`multiprocessing.dummy` exports names that were not yet listed in the typeshed stub:

```python
>>> from multiprocessing import dummy as mpdummy
>>> imported_objects = (
...     (name, obj) for name, obj in vars(mpdummy).items()
...     if name in mpdummy.__all__ and not obj.__module__.startswith("multiprocessing.dummy")
... )
>>> print(*(f"{name}: {obj.__module__}" for name, obj in sorted(imported_objects)), sep="\n")
Barrier: threading
BoundedSemaphore: threading
Condition: threading
Event: threading
JoinableQueue: queue
Lock: _thread
Queue: queue
RLock: threading
Semaphore: threading
current_process: threading
```

Of these, only `JoinableQueue` was listed.
2019-11-20 10:40:12 +00:00
Anthony Sottile
9c724e9e60 Fix signature of multiprocessing.get_start_method (#3415) 2019-10-28 17:39:14 +01:00
Sebastian Rittau
87d7dd3d95 Fix annotations with literal values (#3411) 2019-10-28 06:59:28 -07:00
Nathaniel Brahms
fa9e1ab445 multiprocessing.pool: Fix return of map_async() (#3378)
Closes #3377
2019-10-17 17:43:37 +02:00
Sebastian Rittau
6b55f5c498 Clean up multiprocessing + shared_memory (#3351)
* Make multiprocessing stubs match implementation

* Add multiprocessing.process.BaseProcess
* Use BaseProcess in multiprocessing.context where applicable
* Remove non-existing BaseContext.Process()
* Derive DefaultContext from BaseContext
* Fix BaseContext/DefaultContext.set_start_method() signatures
* Re-export multiprocessing.context.Process from multiprocessing,
  instead of using a custom definition
* Re-export multiprocessing.active_from from multiprocessing.process
  instead of using a custom definition

* Add parent_process() (Python 3.8)

* Complete BaseManager; add Server

* Add multiprocessing.shared_memory et al
2019-10-14 09:54:45 +02:00
Sebastian Rittau
07c8675ba5 Remove unused # type: ignore comments (#3325) 2019-10-09 10:27:18 -07:00
Sebastian Rittau
256b3ce8ab Remove a bunch of unused imports (#3323) 2019-10-08 07:59:32 -07:00
Sebastian Rittau
c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Alan Du
d4727c39f1 Add multiprocessing.Array (#3272) 2019-09-29 16:30:09 +02:00
plokmijnuhby
8d053f139f Change SyncManager behaviour when used as a context decorator (#3230)
Resolves #3018.
2019-09-11 18:24:36 +02:00
秋葉
5ccf017ca0 fix: Add MapResult type (#3228) 2019-09-11 18:20:40 +02:00
Alan Du
e252094354 multiprocessing.Value can also take a Type (#3200) 2019-08-19 17:52:00 +02:00
Rebecca Chen
fab2ee0d7c Remove unnecessary quotes around forward references. (#3191) 2019-08-16 20:29:32 -07:00
ikelos
3e700224ba Add in multiprocessing.managers.ValueProxy types (#3100)
Fixes #1778
2019-07-03 08:49:16 +02:00
Philipp Schrader
d9c5422ebf Add stub for multiprocessing.Value.get_lock() (#2920)
I also noticed that the "lock" parameter for Value's __init__ was
incomplete. The parameter also accepts lock objects directly.

https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.Value

Fixes #2917
2019-04-13 11:35:52 -07:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Sean McLemon
17cd91eeb3 multiprocessing.spawn submodule and multiprocessing.pool stubs (#2823)
Added stub for multiprocessing.spawn submodule and updated multiprocessing.pool stub

Closes #2758
2019-03-05 14:52:02 +01:00
Maxim Kurnikov
b80b2e4b98 make IMapIterator a subclass of Iterator (#2814) 2019-03-05 10:15:25 +01:00
Juan Gonzalez
c18b75b2e6 Make mypy aware of IMapUnorderedIterator (#2701) 2018-12-20 19:41:58 -08:00
Dev Aggarwal
c7b0e60032 Add missing stubs for multiprocessing.connection module. (#2596) 2018-11-11 16:54:11 +01: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
Stig Johan Berggren
92a697cabd Make BaseManager.register a classmethod (#2356) (#2357) 2018-08-07 10:02:21 -07:00
Sebastian Rittau
b05e99297c Drop Python 3.3 support from several stubs (#2266)
* Drop Python 3.3 support from importlib stubs

* Drop Python 3.3 support from html and symbol stubs
2018-06-20 16:46:11 -07:00
Jelle Zijlstra
4e6af84640 improve multiprocessing.Pool types (#2126)
Fixes #1703

Mostly introduce typevars to express that the return types match the return types of the
callbacks.

Removed comment about incompleteness since all documented classes from
https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool
are covered.
2018-06-11 14:42:57 -07:00
Jelle Zijlstra
53fde2ddf7 make timeout argument to Connection.poll Optional (#2122)
Fixes #2094
2018-06-11 14:04:45 -07:00
Jelle Zijlstra
91af6291b1 make shlex.shlex and multiprocessing.pool.IMapIterator instantiable (#2120)
Part of #1476.
2018-06-11 14:04:05 -07:00
Michael J. Sullivan
2ba90a65c0 Remove __all__ = ... from stubs (#2161)
The presence of a __all__ causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.
2018-05-24 19:00:07 -07:00
Martin DeMello
2935017157 Add multiprocessing.dummy pyi files (#2059) 2018-04-18 19:20:01 -07:00
John Reese
a51b480609 Add type annotations for multiprocessing manager address/connect (#2033) 2018-04-10 20:54:23 -07:00
Jelle Zijlstra
3f456e335e add multiprocessing.Process.kill and close (#2027)
See https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.Process.kill.

Fixes #2022.
2018-04-09 12:04:14 -07:00
Tuomas Suutari
4da20cb8b7 multiprocessing: Fix timeout args of AsyncResult methods (#1984)
The timeout argument of wait and get methods of AsyncResult accepts also
None so fix the type specification to include Optional.

Accepting None is not an implementation detail as it's clearly
documented too:

https://docs.python.org/2/library/multiprocessing.html#multiprocessing.pool.AsyncResult

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.AsyncResult
2018-03-24 08:15:39 -07:00
Takuya Akiba
74345aa898 Add missing next method to iterators returned by Pool.imap (#1926) 2018-02-28 18:34:30 -08:00
Takuya Akiba
5e37071a42 Fix imports to expose error classes in multiprocessing module (#1928) 2018-02-27 09:47:18 -08:00
Ivan Levkivskyi
7ae2f25216 Fix some problems introduced by recent commits. (#1905) 2018-02-20 13:34:48 -08:00
Łukasz Langa
18ae67d040 [stdlib/3/multiprocessing] Add queues.pyi, make the other stubs use it (#1879) 2018-02-16 17:00:44 -08:00
Jelle Zijlstra
9390a49600 complete multiprocessing.connection stub (#1716)
Adds additional public members based on https://github.com/python/cpython/blob/master/Lib/multiprocessing/connection.py#L10 and https://docs.python.org/3/library/multiprocessing.html#multiprocessing-listeners-clients.

I found some discrepancies in the docs while adding these stubs and filed python/cpython#4304 to address them.
2017-11-09 10:40:49 -08:00
Jelle Zijlstra
324f1761f4 Change more defaults to ... (#1727) 2017-11-09 10:32:17 -08:00
Jelle Zijlstra
54dd6ba27c Change numerous default values to ... (#1722)
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Alan Du
275d9b5818 Python 3 multiprocesisng synchronization stubs (#1678)
* Add multiprocessing.Array to Python 3 stub

* Add Pipe and Connection type

* Add synchronize type-stub

* Add multiprocessing Exceptions

* Update context with synchronization primitives

* Code review comments

* Add acquire and release from _make_method

* Remove Array stub

* add missing Optional
2017-11-06 23:07:02 -08:00
John Reese
6865c24a4c Add support for multiprocessing.get_context().Process() (#1581) 2017-09-05 20:11:21 -07:00
Daniel Watkins
85a788dbca multiprocessing Pool (and context manager) fixes/improvements (#1562)
* Use typing.ContextManager for multiprocessing context managers

Prior to this commit, the types for __enter__ and __exit__ were not
fully defined; this addresses that.

* Move Pool class stub to multiprocessing.pool

This is where the class is actually defined in the stdlib.

* Ensure that __enter__ on Pool subclasses returns the subclass

This ensures that:

```py
class MyPool(Pool):
    def my_method(self): pass

with MyPool() as pool:
    pool.my_method()
```

type-checks correctly.

* Update the signature of BaseContext.Pool to match Pool.__init__

* Restore multiprocessing.Pool as a function

And also add comments to note that it should have an identical signature
to multiprocessing.context.BaseContext.Pool (because it is just that
method partially applied).
2017-08-28 21:19:08 -07:00
Brian C. Lane
19275ea38a Make multiprocessing.Queue a subclass of queue.Queue (#1525)
Also change multiprocessing.Queue's put and get timeout arguments to
allow None.

This fixes a problem with logging.handlers.QueueHandler and
QueueListener not accepting a multiprocessing.Queue as the queue
argument.

Declaring the Queue now needs to note what it will be used for. eg.
q = multiprocessing.Queue()    # type: multiprocessing.Queue[List[Any]]
2017-08-07 19:25:53 -07:00
eujing
be31439168 Added missing Process fields; More accurate Optional parameters (#1483) 2017-07-18 19:17:23 -07:00
Luka Sterbic
dd7ff91519 Support mp.Value.value (#1480) 2017-07-12 15:00:14 +02:00
khyox
61154a9ad2 Add more multiprocessing function stubs (#1435)
Fixes #1422
2017-06-30 22:25:05 -07:00
Guido van Rossum
350563223f Add Optional[] for all remaining cases of x: <type> = None (#1424)
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Luka Sterbic
4a8a20f04e Allow passing lambdas as init arguments in multiprocessing (#1416)
* Use NoReturn in multiprocessing init functions
* Use Any for init functions
2017-06-19 06:45:57 -07:00
Luka Sterbic
0679e0232c Add start, shutdown and context manager methods to BaseManager (#1392) 2017-06-05 14:58:52 -07:00
Luka Sterbic
9601a76b54 Use AsyncResult from multiprocessing.pool (#1317) 2017-05-23 16:33:46 -07:00