Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
edschofield committed Feb 21, 2024
2 parents 515f611 + 88b621f commit b12eca0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -44,7 +44,7 @@ nosetests.xml
.project
.pydevproject

# PyCharm
# PyCharm / IntelliJ
.idea

# Generated test file
Expand Down
7 changes: 7 additions & 0 deletions src/future/moves/multiprocessing.py
@@ -0,0 +1,7 @@
from __future__ import absolute_import
from future.utils import PY3

from multiprocessing import *
if not PY3:
__future_module__ = True
from multiprocessing.queues import SimpleQueue
3 changes: 3 additions & 0 deletions src/future/standard_library/__init__.py
Expand Up @@ -33,6 +33,7 @@
from collections import OrderedDict, Counter, ChainMap # even on Py2.6
from subprocess import getoutput, getstatusoutput
from subprocess import check_output # even on Py2.6
from multiprocessing import SimpleQueue
(The renamed modules and functions are still available under their old
names on Python 2.)
Expand Down Expand Up @@ -111,6 +112,7 @@
'future.moves.socketserver': 'socketserver',
'ConfigParser': 'configparser',
'repr': 'reprlib',
'multiprocessing.queues': 'multiprocessing',
# 'FileDialog': 'tkinter.filedialog',
# 'tkFileDialog': 'tkinter.filedialog',
# 'SimpleDialog': 'tkinter.simpledialog',
Expand Down Expand Up @@ -187,6 +189,7 @@
('itertools', 'filterfalse','itertools', 'ifilterfalse'),
('itertools', 'zip_longest','itertools', 'izip_longest'),
('sys', 'intern','__builtin__', 'intern'),
('multiprocessing', 'SimpleQueue', 'multiprocessing.queues', 'SimpleQueue'),
# The re module has no ASCII flag in Py2, but this is the default.
# Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one
# (and it exists on Py2.6+).
Expand Down
1 change: 1 addition & 0 deletions src/libpasteurize/fixes/fix_imports.py
Expand Up @@ -16,6 +16,7 @@
u"winreg": u"_winreg",
u"configparser": u"ConfigParser",
u"copyreg": u"copy_reg",
u"multiprocessing.SimpleQueue": u"multiprocessing.queues.SimpleQueue",
u"queue": u"Queue",
u"socketserver": u"SocketServer",
u"_markupbase": u"markupbase",
Expand Down
9 changes: 9 additions & 0 deletions tests/test_future/test_standard_library.py
Expand Up @@ -302,6 +302,15 @@ def test_bytesio(self):
for method in ['tell', 'read', 'seek', 'close', 'flush', 'getvalue']:
self.assertTrue(hasattr(s, method))

def test_SimpleQueue(self):
from multiprocessing import SimpleQueue
sq = SimpleQueue()
self.assertTrue(sq.empty())
sq.put('thing')
self.assertFalse(sq.empty())
self.assertEqual(sq.get(), 'thing')
self.assertTrue(sq.empty())

def test_queue(self):
import queue
q = queue.Queue()
Expand Down

0 comments on commit b12eca0

Please sign in to comment.