MCPcopy
hub / github.com/google/python-fire / NeedsSeparator

Method NeedsSeparator

fire/trace.py:192–208  ·  view source on GitHub ↗

Returns whether a separator should be added to the command. If the command is a function call, then adding an additional argument to the command sometimes would add an extra arg to the function call, and sometimes would add an arg acting on the result of the function call. This fun

(self)

Source from the content-addressed store, hash-verified

190 return ' '.join(self._Quote(arg) for arg in args)
191
192 def NeedsSeparator(self):
193 """Returns whether a separator should be added to the command.
194
195 If the command is a function call, then adding an additional argument to the
196 command sometimes would add an extra arg to the function call, and sometimes
197 would add an arg acting on the result of the function call.
198
199 This function tells us whether we should add a separator to the command
200 before adding additional arguments in order to make sure the arg is applied
201 to the result of the function call, and not the function call itself.
202
203 Returns:
204 Whether a separator should be added to the command if order to keep the
205 component referred to by the command the same when adding additional args.
206 """
207 element = self.GetLastHealthyElement()
208 return element.HasCapacity() and not element.HasSeparator()
209
210 def __str__(self):
211 lines = []

Callers 1

GetCommandMethod · 0.95

Calls 3

GetLastHealthyElementMethod · 0.95
HasCapacityMethod · 0.80
HasSeparatorMethod · 0.80

Tested by

no test coverage detected