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

Function mypy_comments_to_config_map

mypy/config_parser.py:637–653  ·  view source on GitHub ↗

Rewrite the mypy comment syntax into ini file syntax.

(line: str, template: Options)

Source from the content-addressed store, hash-verified

635
636
637def mypy_comments_to_config_map(line: str, template: Options) -> tuple[dict[str, str], list[str]]:
638 """Rewrite the mypy comment syntax into ini file syntax."""
639 options = {}
640 entries, errors = split_directive(line)
641 for entry in entries:
642 if "=" not in entry:
643 name = entry
644 value = None
645 else:
646 name, value = (x.strip() for x in entry.split("=", 1))
647
648 name = name.replace("-", "_")
649 if value is None:
650 value = "True"
651 options[name] = value
652
653 return options, errors
654
655
656def parse_mypy_comments(

Callers 1

parse_mypy_commentsFunction · 0.85

Calls 4

split_directiveFunction · 0.85
stripMethod · 0.80
splitMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…