-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from serengil/feat-task-2512-more-type-hinting…
…-and-docstrings type hinting
- Loading branch information
Showing
16 changed files
with
364 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import multiprocessing | ||
import multiprocessing.pool | ||
|
||
class NoDaemonProcess(multiprocessing.Process): | ||
""" | ||
NoDaemonProcess class for recursive parallel runs | ||
""" | ||
def _get_daemon(self): | ||
# make 'daemon' attribute always return False | ||
return False | ||
|
||
def _set_daemon(self, value): | ||
pass | ||
|
||
daemon = property(_get_daemon, _set_daemon) | ||
|
||
|
||
class NoDaemonContext(type(multiprocessing.get_context())): | ||
""" | ||
NoDaemonContext class for recursive parallel runs | ||
""" | ||
# pylint: disable=too-few-public-methods | ||
Process = NoDaemonProcess | ||
|
||
|
||
class CustomPool(multiprocessing.pool.Pool): | ||
""" | ||
MyPool class for recursive parallel runs | ||
""" | ||
# pylint: disable=too-few-public-methods, abstract-method, super-with-arguments | ||
def __init__(self, *args, **kwargs): | ||
kwargs["context"] = NoDaemonContext() | ||
super(CustomPool, self).__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.