Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a05e90

Browse files
authored
optional pickleshare (#14217)
2 parents 9cd8a95 + d614fcf commit 1a05e90

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

IPython/core/interactiveshell.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,28 @@
3737
from typing import Optional, Sequence, Tuple
3838
from warnings import warn
3939

40-
from pickleshare import PickleShareDB
40+
try:
41+
from pickleshare import PickleShareDB
42+
except ModuleNotFoundError:
43+
44+
class PickleShareDB: # type: ignore [no-redef]
45+
def __init__(self, path):
46+
pass
47+
48+
def get(self, key, default):
49+
warn(
50+
f"using {key} requires you to install the `pickleshare` library.",
51+
stacklevel=2,
52+
)
53+
return default
54+
55+
def __setitem__(self, key, value):
56+
warn(
57+
f"using {key} requires you to install the `pickleshare` library.",
58+
stacklevel=2,
59+
)
60+
61+
4162
from tempfile import TemporaryDirectory
4263
from traitlets import (
4364
Any,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ install_requires =
3636
jedi>=0.16
3737
matplotlib-inline
3838
pexpect>4.3; sys_platform != "win32"
39-
pickleshare
4039
prompt_toolkit>=3.0.30,<3.1.0,!=3.0.37
4140
pygments>=2.4.0
4241
stack_data
@@ -76,6 +75,7 @@ test =
7675
pytest<7.1
7776
pytest-asyncio
7877
testpath
78+
pickleshare
7979
test_extra =
8080
%(test)s
8181
curio

0 commit comments

Comments
 (0)