From d94bd1bd4630dc374b2f54538251c011146ed38a Mon Sep 17 00:00:00 2001 From: Svayp11 Date: Fri, 7 Apr 2023 22:40:14 +0500 Subject: [PATCH] #444: Removed pipes dependency --- fire/core.py | 5 ++--- fire/trace.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fire/core.py b/fire/core.py index c1e97367..daeae925 100644 --- a/fire/core.py +++ b/fire/core.py @@ -56,7 +56,6 @@ def main(argv): import inspect import json import os -import pipes import re import shlex import sys @@ -238,7 +237,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=shlex.quote(command)), file=sys.stderr) return show_help @@ -294,7 +293,7 @@ def _DisplayError(component_trace): if show_help: 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=shlex.quote(command)), file=sys.stderr) help_text = helptext.HelpText(result, trace=component_trace, verbose=component_trace.verbose) output.append(help_text) diff --git a/fire/trace.py b/fire/trace.py index 7174f994..4c9674e3 100644 --- a/fire/trace.py +++ b/fire/trace.py @@ -29,7 +29,7 @@ from __future__ import division from __future__ import print_function -import pipes +import shlex from fire import inspectutils @@ -166,8 +166,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 shlex.quote(prefix) + '=' + shlex.quote(value) + return shlex.quote(arg) def GetCommand(self, include_separators=True): """Returns the command representing the trace up to this point.