Skip to content

Commit 925ae49

Browse files
dbiebercopybara-github
authored andcommitted
Switch back to pipes.quote
PiperOrigin-RevId: 243904197 Change-Id: Ie15e9db18da83b5602e6ccac171990166ac1b9e9
1 parent 6434381 commit 925ae49

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

fire/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def main(argv):
5656
import inspect
5757
import json
5858
import os
59+
import pipes
5960
import re
6061
import shlex
6162
import sys
@@ -232,7 +233,7 @@ def _IsHelpShortcut(component_trace, remaining_args):
232233
component_trace.show_help = True
233234
command = '{cmd} -- --help'.format(cmd=component_trace.GetCommand())
234235
print('INFO: Showing help with the command {cmd}.\n'.format(
235-
cmd=six.moves.shlex_quote(command)), file=sys.stderr)
236+
cmd=pipes.quote(command)), file=sys.stderr)
236237
return show_help
237238

238239

@@ -264,7 +265,7 @@ def _DisplayError(component_trace):
264265
if help_flag in component_trace.elements[-1].args:
265266
command = '{cmd} -- --help'.format(cmd=component_trace.GetCommand())
266267
message = 'INFO: Showing help with the command {cmd}.\n'.format(
267-
cmd=six.moves.shlex_quote(command))
268+
cmd=pipes.quote(command))
268269
output.append(message)
269270
output.append('Fire trace:\n{trace}\n'.format(trace=component_trace))
270271
result = component_trace.GetResult()

fire/trace.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
from __future__ import division
3030
from __future__ import print_function
3131

32+
import pipes
33+
3234
from fire import inspectutils
33-
import six
3435

3536
INITIAL_COMPONENT = 'Initial component'
3637
INSTANTIATED_CLASS = 'Instantiated class'
@@ -165,8 +166,8 @@ def display(arg1, arg2='!'):
165166
def _Quote(self, arg):
166167
if arg.startswith('--') and '=' in arg:
167168
prefix, value = arg.split('=', 1)
168-
return six.moves.shlex_quote(prefix) + '=' + six.moves.shlex_quote(value)
169-
return six.moves.shlex_quote(arg)
169+
return pipes.quote(prefix) + '=' + pipes.quote(value)
170+
return pipes.quote(arg)
170171

171172
def GetCommand(self):
172173
"""Returns the command representing the trace up to this point.

0 commit comments

Comments
 (0)