diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 13d1cb5..083ba89 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -63,7 +63,7 @@ from IPython.utils.decorators import undoc from IPython.utils.io import ask_yes_no from IPython.utils.ipstruct import Struct from IPython.utils.path import get_home_dir, get_ipython_dir, get_py_filename, unquote_filename, ensure_dir_exists -from IPython.utils.pickleshare import PickleShareDB +from IPython.external.pickleshare import PickleShareDB from IPython.utils.process import system, getoutput from IPython.utils.py3compat import (builtin_mod, unicode_type, string_types, with_metaclass, iteritems) diff --git a/IPython/external/pickleshare/__init__.py b/IPython/external/pickleshare/__init__.py new file mode 100644 index 0000000..17200e4 --- /dev/null +++ b/IPython/external/pickleshare/__init__.py @@ -0,0 +1,4 @@ +try: + from pickleshare import * +except ImportError: + from ._pickleshare import * diff --git a/IPython/utils/pickleshare.py b/IPython/external/pickleshare/_pickleshare.py similarity index 100% rename from IPython/utils/pickleshare.py rename to IPython/external/pickleshare/_pickleshare.py index 03c36b8..7c4e82b 100755 --- a/IPython/utils/pickleshare.py +++ b/IPython/external/pickleshare/_pickleshare.py @@ -322,5 +322,3 @@ def main(): if __name__== "__main__": main() - - diff --git a/IPython/utils/tests/test_pickleshare.py b/IPython/utils/tests/test_pickleshare.py deleted file mode 100644 index 7d4f577..0000000 --- a/IPython/utils/tests/test_pickleshare.py +++ /dev/null @@ -1,61 +0,0 @@ -from __future__ import print_function - -import os -from unittest import TestCase - -from IPython.testing.decorators import skip -from IPython.utils.tempdir import TemporaryDirectory -from IPython.utils.pickleshare import PickleShareDB - - -class PickleShareDBTestCase(TestCase): - def setUp(self): - self.tempdir = TemporaryDirectory() - - def tearDown(self): - self.tempdir.cleanup() - - def test_picklesharedb(self): - db = PickleShareDB(self.tempdir.name) - db.clear() - print("Should be empty:",db.items()) - db['hello'] = 15 - db['aku ankka'] = [1,2,313] - db['paths/nest/ok/keyname'] = [1,(5,46)] - db.hset('hash', 'aku', 12) - db.hset('hash', 'ankka', 313) - self.assertEqual(db.hget('hash','aku'), 12) - self.assertEqual(db.hget('hash','ankka'), 313) - print("all hashed",db.hdict('hash')) - print(db.keys()) - print(db.keys('paths/nest/ok/k*')) - print(dict(db)) # snapsot of whole db - db.uncache() # frees memory, causes re-reads later - - # shorthand for accessing deeply nested files - lnk = db.getlink('myobjects/test') - lnk.foo = 2 - lnk.bar = lnk.foo + 5 - self.assertEqual(lnk.bar, 7) - - @skip("Too slow for regular running.") - def test_stress(self): - db = PickleShareDB('~/fsdbtest') - import time,sys - for i in range(1000): - for j in range(1000): - if i % 15 == 0 and i < 200: - if str(j) in db: - del db[str(j)] - continue - - if j%33 == 0: - time.sleep(0.02) - - db[str(j)] = db.get(str(j), []) + [(i,j,"proc %d" % os.getpid())] - db.hset('hash',j, db.hget('hash',j,15) + 1 ) - - print(i, end=' ') - sys.stdout.flush() - if i % 10 == 0: - db.uncache() \ No newline at end of file