MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / wrap_call

Function wrap_call

py/generate_bidi_protocol.py:159–166  ·  view source on GitHub ↗

`prefix(args)suffix` on one line, or one arg per line when it would exceed the limit.

(prefix: str, args: list[str], suffix: str, indent: int)

Source from the content-addressed store, hash-verified

157
158
159def wrap_call(prefix: str, args: list[str], suffix: str, indent: int) -> str:
160 """`prefix(args)suffix` on one line, or one arg per line when it would exceed the limit."""
161 one_line = f"{prefix}{', '.join(args)}{suffix}"
162 if not args or indent + len(one_line) <= LINE_LIMIT:
163 return one_line
164 pad = " " * (indent + 4)
165 body = ",\n".join(f"{pad}{a}" for a in args)
166 return f"{prefix}\n{body},\n{' ' * indent}{suffix.lstrip()}"
167
168
169# --------------------------------------------------------------------------- #

Calls

no outgoing calls