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

Function _match_edge

Tools/unicode/dawg.py:439–450  ·  view source on GitHub ↗
(packed, s, size, node_offset, stringpos)

Source from the content-addressed store, hash-verified

437 return child_offset, last_edge, size, offset
438
439def _match_edge(packed, s, size, node_offset, stringpos):
440 if size > 1 and stringpos + size > len(s):
441 # past the end of the string, can't match
442 return False
443 for i in range(size):
444 if packed[node_offset + i] != s[stringpos + i]:
445 # if a subsequent char of an edge doesn't match, the word isn't in
446 # the dawg
447 if i > 0:
448 raise KeyError
449 return False
450 return True
451
452def lookup(packed, data, s):
453 return data[_lookup(packed, s)]

Callers 1

_lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…