MCPcopy Index your code
hub / github.com/RustPython/RustPython / bow

Method bow

Lib/_pyrepl/reader.py:461–476  ·  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

459 return out_prompt, l
460
461 def bow(self, p: int | None = None) -> int:
462 """Return the 0-based index of the word break preceding p most
463 immediately.
464
465 p defaults to self.pos; word boundaries are determined using
466 self.syntax_table."""
467 if p is None:
468 p = self.pos
469 st = self.syntax_table
470 b = self.buffer
471 p -= 1
472 while p >= 0 and st.get(b[p], SYNTAX_WORD) != SYNTAX_WORD:
473 p -= 1
474 while p >= 0 and st.get(b[p], SYNTAX_WORD) == SYNTAX_WORD:
475 p -= 1
476 return p + 1
477
478 def eow(self, p: int | None = None) -> int:
479 """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