MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / matches_to_json

Function matches_to_json

scripts/developer-guide/run_languagetool.py:525–539  ·  view source on GitHub ↗
(matches, text)

Source from the content-addressed store, hash-verified

523
524
525def matches_to_json(matches, text):
526 out = []
527 for global_offset, m in matches:
528 line = text.count("\n", 0, global_offset) + 1
529 out.append({
530 "rule": _attr(m, "rule_id", "ruleId", default=""),
531 "category": _attr(m, "category", default=""),
532 "message": _attr(m, "message", default=""),
533 "line": line,
534 "offset": global_offset,
535 "length": _attr(m, "error_length", "errorLength", default=0),
536 "context": _attr(m, "context", default=""),
537 "replacements": list(_attr(m, "replacements", default=[])[:5]),
538 })
539 return out
540
541
542def main():

Callers 1

mainFunction · 0.85

Calls 3

_attrFunction · 0.85
countMethod · 0.65
appendMethod · 0.65

Tested by

no test coverage detected