Skip to content

Commit

Permalink
More Python 3 support.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 243823028
Change-Id: I6a5c2614365814af72282bc52a40bc9111395869
  • Loading branch information
dbieber authored and copybara-github committed Apr 16, 2019
1 parent 1bfc1d0 commit 6434381
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions fire/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def main(argv):
import inspect
import json
import os
import pipes
import re
import shlex
import sys
Expand Down Expand Up @@ -233,7 +232,7 @@ def _IsHelpShortcut(component_trace, remaining_args):
component_trace.show_help = True
command = '{cmd} -- --help'.format(cmd=component_trace.GetCommand())
print('INFO: Showing help with the command {cmd}.\n'.format(
cmd=pipes.quote(command)), file=sys.stderr)
cmd=six.moves.shlex_quote(command)), file=sys.stderr)
return show_help


Expand Down Expand Up @@ -265,7 +264,7 @@ def _DisplayError(component_trace):
if help_flag in component_trace.elements[-1].args:
command = '{cmd} -- --help'.format(cmd=component_trace.GetCommand())
message = 'INFO: Showing help with the command {cmd}.\n'.format(
cmd=pipes.quote(command))
cmd=six.moves.shlex_quote(command))
output.append(message)
output.append('Fire trace:\n{trace}\n'.format(trace=component_trace))
result = component_trace.GetResult()
Expand Down
6 changes: 3 additions & 3 deletions fire/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from __future__ import division
from __future__ import print_function

import pipes
from fire import inspectutils
import six

INITIAL_COMPONENT = 'Initial component'
INSTANTIATED_CLASS = 'Instantiated class'
Expand Down Expand Up @@ -165,8 +165,8 @@ def display(arg1, arg2='!'):
def _Quote(self, arg):
if arg.startswith('--') and '=' in arg:
prefix, value = arg.split('=', 1)
return pipes.quote(prefix) + '=' + pipes.quote(value)
return pipes.quote(arg)
return six.moves.shlex_quote(prefix) + '=' + six.moves.shlex_quote(value)
return six.moves.shlex_quote(arg)

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

0 comments on commit 6434381

Please sign in to comment.