Skip to content

Commit 88b621f

Browse files
committed
Add multiprocessing's SimpleQueue to those fixed by future
1 parent 5b25b77 commit 88b621f

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/future/moves/multiprocessing.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import absolute_import
2+
from future.utils import PY3
3+
4+
from multiprocessing import *
5+
if not PY3:
6+
__future_module__ = True
7+
from multiprocessing.queues import SimpleQueue

src/future/standard_library/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from collections import OrderedDict, Counter # even on Py2.6
3535
from subprocess import getoutput, getstatusoutput
3636
from subprocess import check_output # even on Py2.6
37+
from multiprocessing import SimpleQueue
3738
3839
(The renamed modules and functions are still available under their old
3940
names on Python 2.)
@@ -109,6 +110,7 @@
109110
'future.moves.socketserver': 'socketserver',
110111
'ConfigParser': 'configparser',
111112
'repr': 'reprlib',
113+
'multiprocessing.queues': 'multiprocessing',
112114
# 'FileDialog': 'tkinter.filedialog',
113115
# 'tkFileDialog': 'tkinter.filedialog',
114116
# 'SimpleDialog': 'tkinter.simpledialog',
@@ -184,6 +186,7 @@
184186
('itertools', 'filterfalse','itertools', 'ifilterfalse'),
185187
('itertools', 'zip_longest','itertools', 'izip_longest'),
186188
('sys', 'intern','__builtin__', 'intern'),
189+
('multiprocessing', 'SimpleQueue', 'multiprocessing.queues', 'SimpleQueue'),
187190
# The re module has no ASCII flag in Py2, but this is the default.
188191
# Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one
189192
# (and it exists on Py2.6+).

src/libpasteurize/fixes/fix_imports.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
u"winreg": u"_winreg",
1717
u"configparser": u"ConfigParser",
1818
u"copyreg": u"copy_reg",
19+
u"multiprocessing.SimpleQueue": u"multiprocessing.queues.SimpleQueue",
1920
u"queue": u"Queue",
2021
u"socketserver": u"SocketServer",
2122
u"_markupbase": u"markupbase",

tests/test_future/test_standard_library.py

+9
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ def test_bytesio(self):
295295
for method in ['tell', 'read', 'seek', 'close', 'flush', 'getvalue']:
296296
self.assertTrue(hasattr(s, method))
297297

298+
def test_SimpleQueue(self):
299+
from multiprocessing import SimpleQueue
300+
sq = SimpleQueue()
301+
self.assertTrue(sq.empty())
302+
sq.put('thing')
303+
self.assertFalse(sq.empty())
304+
self.assertEqual(sq.get(), 'thing')
305+
self.assertTrue(sq.empty())
306+
298307
def test_queue(self):
299308
import queue
300309
q = queue.Queue()

0 commit comments

Comments
 (0)