Skip to content

Commit 9d94848

Browse files
authored
Resolve mypy type annotation issues in CI (#328)
The failures were: ``` readme_renderer/rst.py:26: error: Unused "type: ignore" comment [unused-ignore] readme_renderer/rst.py:33: error: Argument 1 of "emptytag" is incompatible with supertype "docutils.writers._html_base.HTMLTranslator"; supertype defines the argument type as "Element" [override] readme_renderer/rst.py:33: note: This violates the Liskov substitution principle readme_renderer/rst.py:33: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides ``` The CI failures appear to be related to an updated release of `types-docutils`.
1 parent 04d5cfe commit 9d94848

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

readme_renderer/rst.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
# limitations under the License.
1414

1515
import io
16-
from typing import Any, Dict, IO, Optional, Union
16+
from typing import Any, Dict, IO, Optional
1717

1818
from docutils.core import publish_parts
19-
from docutils.nodes import colspec, image
19+
from docutils.nodes import Element
2020
from docutils.writers.html5_polyglot import HTMLTranslator, Writer
2121
from docutils.utils import SystemMessage
2222

2323
from .clean import clean
2424

2525

26-
class ReadMeHTMLTranslator(HTMLTranslator): # type: ignore[misc] # docutils is incomplete, returns `Any` python/typeshed#7256 # noqa E501
26+
class ReadMeHTMLTranslator(HTMLTranslator):
2727

2828
# Overrides base class not to output `<object>` tag for SVG images.
2929
object_image_types: Dict[str, str] = {}
3030

3131
def emptytag(
3232
self,
33-
node: Union[colspec, image],
33+
node: Element,
3434
tagname: str,
3535
suffix: str = "\n",
3636
**attributes: Any

0 commit comments

Comments
 (0)