As discussed in pypa/readme_renderer#231
Here's the custom class:
|
class _WarningStream: |
|
def __init__(self) -> None: |
|
self.output = io.StringIO() |
|
|
|
def write(self, text: str) -> None: |
|
matched = _REPORT_RE.search(text) |
|
|
|
if not matched: |
|
self.output.write(text) |
|
return |
|
|
|
self.output.write( |
|
"line {line}: {level_text}: {message}\n".format( |
|
level_text=matched.group("level").capitalize(), |
|
line=matched.group("line"), |
|
message=matched.group("message").rstrip("\r\n"), |
|
) |
|
) |
|
|
|
def __str__(self) -> str: |
|
return self.output.getvalue().strip() |
@bhrutledge has some ideas on how to replace the usage to better reflect the future interaction of twine check and readme_renderer when docutils doesn't pass a warning, but readme_renderer does.
As discussed in pypa/readme_renderer#231
Here's the custom class:
twine/twine/commands/check.py
Lines 51 to 71 in a6dd69c
@bhrutledge has some ideas on how to replace the usage to better reflect the future interaction of twine check and
readme_rendererwhendocutilsdoesn't pass a warning, butreadme_rendererdoes.