MCPcopy Index your code
hub / github.com/dbcli/mycli / _multiline_exception

Function _multiline_exception

mycli/clibuffer.py:24–58  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

22
23
24def _multiline_exception(text: str) -> bool:
25 orig = text
26 text = text.strip()
27 first_word = text.split()[0] if text else ''
28
29 # Multi-statement favorite query is a special case. Because there will
30 # be a semicolon separating statements, we can't consider semicolon an
31 # EOL. Let's consider an empty line an EOL instead.
32 if first_word.startswith(("\\fs", "/fs")):
33 return orig.endswith("\n")
34
35 return (
36 # Special Command
37 first_word.startswith("\\")
38 or (first_word.startswith('/') and not first_word.startswith('/*'))
39 or text.endswith((
40 # Ended with the current delimiter (usually a semi-column)
41 iocommands.get_current_delimiter(),
42 # or ended with certain commands
43 "\\g",
44 "\\G",
45 r"\e",
46 r"\edit",
47 r"\clip",
48 ))
49 or
50 # non-backslashed special commands such as "exit" or "help" don't need semicolon
51 first_word in CASE_SENSITIVE_COMMANDS
52 or
53 # uppercase variants accepted
54 first_word.lower() in CASE_INSENSITIVE_COMMANDS
55 or
56 # just a plain enter without any text
57 (first_word == "")
58 )

Callers 1

condFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected