Skip to content

Commit 541b888

Browse files
authored
Replaces uses of deprecated library pipes with shlex (#7017)
The `pipes` standard library was deprecated in python 3.11 and removed in python 3.13. (See https://docs.python.org/3/library/pipes.html) This replacement enables running CI with python 3.13 (unless I find more blockers later). The affected files are only for testing or diagnosing, not part of the actual TB package.
1 parent e1f19a4 commit 541b888

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tensorboard/manager_e2e_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import errno
2121
import json
2222
import os
23-
import pipes
24-
import signal
23+
import shlex
2524
import shutil
25+
import signal
2626
import subprocess
2727
import tempfile
2828
import textwrap
@@ -275,7 +275,7 @@ def test_failure_unreadable_stdio(self):
275275
rm -r %s
276276
exit 22
277277
"""
278-
% pipes.quote(self.tmproot),
278+
% shlex.quote(self.tmproot),
279279
).lstrip(),
280280
)
281281
start_result = manager.start(["--logdir=./logs", "--port=0"])
@@ -305,7 +305,7 @@ def test_timeout(self):
305305
printf >&2 'warn: I am tired\n'
306306
sleep 60
307307
"""
308-
% pipes.quote(os.path.realpath(pid_file)),
308+
% shlex.quote(os.path.realpath(pid_file)),
309309
).lstrip(),
310310
)
311311
start_result = manager.start(

tensorboard/tools/diagnose_tensorboard.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import inspect
3030
import logging
3131
import os
32-
import pipes
3332
import shlex
3433
import socket
3534
import subprocess
@@ -394,8 +393,7 @@ def stat_tensorboardinfo():
394393
)
395394
# This error should only appear on Unices, so it's okay to use
396395
# Unix-specific utilities and shell syntax.
397-
quote = getattr(shlex, "quote", None) or pipes.quote # Python <3.3
398-
command = "chmod 777 %s" % quote(path)
396+
command = "chmod 777 %s" % shlex.quote(path)
399397
message = "%s\n\n\t%s" % (preamble, command)
400398
yield Suggestion('Fix permissions on "%s"' % path, message)
401399

0 commit comments

Comments
 (0)