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

Method highlight_quote_groups

mypy/util.py:819–834  ·  view source on GitHub ↗

Make groups quoted with double quotes bold (including quotes). This is used to highlight types, attribute names etc.

(self, msg: str)

Source from the content-addressed store, hash-verified

817 return error
818
819 def highlight_quote_groups(self, msg: str) -> str:
820 """Make groups quoted with double quotes bold (including quotes).
821
822 This is used to highlight types, attribute names etc.
823 """
824 if msg.count('"') % 2:
825 # Broken error message, don't do any formatting.
826 return msg
827 parts = msg.split('"')
828 out = ""
829 for i, part in enumerate(parts):
830 if i % 2 == 0:
831 out += self.style(part, "none")
832 else:
833 out += self.style('"' + part + '"', "none", bold=True)
834 return out
835
836 def underline_link(self, note: str) -> str:
837 """Underline a link in a note message (if any).

Callers 1

colorizeMethod · 0.95

Calls 4

styleMethod · 0.95
enumerateFunction · 0.85
splitMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected