MCPcopy Index your code
hub / github.com/python/mypy / split_words

Function split_words

mypy/util.py:510–524  ·  view source on GitHub ↗

Split line of text into words (but not within quoted groups).

(msg: str)

Source from the content-addressed store, hash-verified

508
509
510def split_words(msg: str) -> list[str]:
511 """Split line of text into words (but not within quoted groups)."""
512 next_word = ""
513 res: list[str] = []
514 allow_break = True
515 for c in msg:
516 if c == " " and allow_break:
517 res.append(next_word)
518 next_word = ""
519 continue
520 if c == '"':
521 allow_break = not allow_break
522 next_word += c
523 res.append(next_word)
524 return res
525
526
527def get_terminal_width() -> int:

Callers 2

test_split_wordsMethod · 0.90
soft_wrapFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by 1

test_split_wordsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…