Skip to content

Commit 7ec4a5b

Browse files
committed
Remove old /dev/null setup.
This probably existed for Python 2, but a shortcut as added in Python 3.
1 parent 24a39f3 commit 7ec4a5b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

jupyter_console/ptshell.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -975,24 +975,21 @@ def handle_image_stream(self, data, mime):
975975
imageformat = self._imagemime[mime]
976976
fmt = dict(format=imageformat)
977977
args = [s.format(**fmt) for s in self.stream_image_handler]
978-
with open(os.devnull, 'w') as devnull:
979-
proc = subprocess.Popen(
980-
args, stdin=subprocess.PIPE,
981-
stdout=devnull, stderr=devnull)
978+
with subprocess.Popen(args, stdin=subprocess.PIPE,
979+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as proc:
982980
proc.communicate(raw)
983-
return (proc.returncode == 0)
981+
return (proc.returncode == 0)
984982

985983
def handle_image_tempfile(self, data, mime):
986984
raw = base64.decodebytes(data[mime].encode('ascii'))
987985
imageformat = self._imagemime[mime]
988986
filename = 'tmp.{0}'.format(imageformat)
989-
with NamedFileInTemporaryDirectory(filename) as f, \
990-
open(os.devnull, 'w') as devnull:
987+
with NamedFileInTemporaryDirectory(filename) as f:
991988
f.write(raw)
992989
f.flush()
993990
fmt = dict(file=f.name, format=imageformat)
994991
args = [s.format(**fmt) for s in self.tempfile_image_handler]
995-
rc = subprocess.call(args, stdout=devnull, stderr=devnull)
992+
rc = subprocess.call(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
996993
return (rc == 0)
997994

998995
def handle_image_callable(self, data, mime):

0 commit comments

Comments
 (0)