diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-05-18 14:35:54 (GMT) |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2017-05-18 14:35:54 (GMT) |
commit | 3972628de3d569c88451a2a176a1c94d8822b8a6 (patch) | |
tree | 30627d132c42fb65f96c3d9e209b317f68d175ed /Lib/multiprocessing | |
parent | 906f5330b9c9a74cad1cf27fddaf77e99dff9edd (diff) | |
download | cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.zip cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.tar.gz cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.tar.bz2 |
bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)
* Replaced list(<generator expression>) with list comprehension
* Replaced dict(<generator expression>) with dict comprehension
* Replaced set(<list literal>) with set literal
* Replaced builtin func(<list comprehension>) with func(<generator
expression>) when supported (e.g. any(), all(), tuple(), min(), &
max())
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/context.py | 2 | ||||
-rw-r--r-- | Lib/multiprocessing/forkserver.py | 3 | ||||
-rw-r--r-- | Lib/multiprocessing/sharedctypes.py | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index a3d491b..c98ee43 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -261,7 +261,7 @@ class DefaultContext(BaseContext): else: return ['fork', 'spawn'] -DefaultContext.__all__ = list(x for x in dir(DefaultContext) if x[0] != '_') +DefaultContext.__all__ = [x for x in dir(DefaultContext) if x[0] != '_'] # # Context types for fixed start method diff --git a/Lib/multiprocessing/forkserver.py b/Lib/multiprocessing/forkserver.py index d5ce625..6e09539 100644 --- a/Lib/multiprocessing/forkserver.py +++ b/Lib/multiprocessing/forkserver.py @@ -98,8 +98,7 @@ class ForkServer(object): if self._preload_modules: desired_keys = {'main_path', 'sys_path'} data = spawn.get_preparation_data('ignore') - data = dict((x,y) for (x,y) in data.items() - if x in desired_keys) + data = {x: y for x, y in data.items() if x in desired_keys} else: data = {} diff --git a/Lib/multiprocessing/sharedctypes.py b/Lib/multiprocessing/sharedctypes.py index 25cbcf2..7228751 100644 --- a/Lib/multiprocessing/sharedctypes.py +++ b/Lib/multiprocessing/sharedctypes.py @@ -115,7 +115,7 @@ def synchronized(obj, lock=None, ctx=None): scls = class_cache[cls] except KeyError: names = [field[0] for field in cls._fields_] - d = dict((name, make_property(name)) for name in names) + d = {name: make_property(name) for name in names} classname = 'Synchronized' + cls.__name__ scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) return scls(obj, lock, ctx) |