MCPcopy Index your code
hub / github.com/python/cpython / bow

Method bow

Lib/_pyrepl/reader.py:411–426  ·  view source on GitHub ↗

Return the 0-based index of the word break preceding p most immediately. p defaults to self.pos; word boundaries are determined using self.syntax_table.

(self, p: int | None = None)

Source from the content-addressed store, hash-verified

409 return out_prompt, wlen(visible_prompt)
410
411 def bow(self, p: int | None = None) -> int:
412 """Return the 0-based index of the word break preceding p most
413 immediately.
414
415 p defaults to self.pos; word boundaries are determined using
416 self.syntax_table."""
417 if p is None:
418 p = self.pos
419 st = self.syntax_table
420 b = self.buffer
421 p -= 1
422 while p >= 0 and st.get(b[p], SYNTAX_WORD) != SYNTAX_WORD:
423 p -= 1
424 while p >= 0 and st.get(b[p], SYNTAX_WORD) == SYNTAX_WORD:
425 p -= 1
426 return p + 1
427
428 def eow(self, p: int | None = None) -> int:
429 """Return the 0-based index of the word break following p most

Callers 3

doMethod · 0.80
doMethod · 0.80
doMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected