From 5b25b778b63353df0f97e538ea28e44b3dce53e2 Mon Sep 17 00:00:00 2001 From: Fergus Symon Date: Tue, 16 Aug 2016 13:40:41 +1000 Subject: [PATCH 1/2] Add IntelliJ (PyCharm) folder to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e211af6a..3cdec3ca 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ nosetests.xml .project .pydevproject +# IntelliJ +.idea From 88b621fe4ff6cd1f977df0fa79b74c560498cfd2 Mon Sep 17 00:00:00 2001 From: Fergus Symon Date: Tue, 16 Aug 2016 15:12:45 +1000 Subject: [PATCH 2/2] Add multiprocessing's SimpleQueue to those fixed by future --- src/future/moves/multiprocessing.py | 7 +++++++ src/future/standard_library/__init__.py | 3 +++ src/libpasteurize/fixes/fix_imports.py | 1 + tests/test_future/test_standard_library.py | 9 +++++++++ 4 files changed, 20 insertions(+) create mode 100644 src/future/moves/multiprocessing.py diff --git a/src/future/moves/multiprocessing.py b/src/future/moves/multiprocessing.py new file mode 100644 index 00000000..a871b676 --- /dev/null +++ b/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 diff --git a/src/future/standard_library/__init__.py b/src/future/standard_library/__init__.py index 9e22c59d..9aa654bd 100644 --- a/src/future/standard_library/__init__.py +++ b/src/future/standard_library/__init__.py @@ -34,6 +34,7 @@ from collections import OrderedDict, Counter # 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.) @@ -109,6 +110,7 @@ 'future.moves.socketserver': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', + 'multiprocessing.queues': 'multiprocessing', # 'FileDialog': 'tkinter.filedialog', # 'tkFileDialog': 'tkinter.filedialog', # 'SimpleDialog': 'tkinter.simpledialog', @@ -184,6 +186,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+). diff --git a/src/libpasteurize/fixes/fix_imports.py b/src/libpasteurize/fixes/fix_imports.py index 4db0d548..d5b21009 100644 --- a/src/libpasteurize/fixes/fix_imports.py +++ b/src/libpasteurize/fixes/fix_imports.py @@ -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", diff --git a/tests/test_future/test_standard_library.py b/tests/test_future/test_standard_library.py index 399d587f..d7a10294 100644 --- a/tests/test_future/test_standard_library.py +++ b/tests/test_future/test_standard_library.py @@ -295,6 +295,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()