Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix mypy issues that are failing on CI #731

Merged
merged 6 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ jobs:
- 3.3.1
- 3.4.3
- 3.5.4
- git+https://github.com/sphinx-doc/sphinx.git@4.0.x
# enable 4.x again when 4.0.x has been merged into it
#- git+https://github.com/sphinx-doc/sphinx.git@4.x
- git+https://github.com/sphinx-doc/sphinx.git@4.x
- git+https://github.com/sphinx-doc/sphinx.git@master

steps:
Expand Down
6 changes: 6 additions & 0 deletions breathe/directive/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def create_warning(project_info: Optional[ProjectInfo], state, lineno: int,


class BaseDirective(SphinxDirective):
required_arguments: int
optional_arguments: int
option_spec: Dict[str, Any]
has_content: bool
final_argument_whitespace: bool

def __init__(self, finder_factory: FinderFactory,
project_info_factory: ProjectInfoFactory,
parser_factory: DoxygenParserFactory,
Expand Down
2 changes: 1 addition & 1 deletion breathe/directive/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from breathe.renderer.sphinxrenderer import SphinxRenderer
from breathe.renderer.target import create_target_handler

from docutils.parsers.rst.directives import unchanged_required, flag
from docutils.parsers.rst.directives import unchanged_required, flag # type: ignore


class BaseFileDirective(BaseDirective):
Expand Down
2 changes: 1 addition & 1 deletion breathe/directive/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from breathe.renderer.sphinxrenderer import SphinxRenderer
from breathe.renderer.target import create_target_handler

from docutils.parsers.rst.directives import unchanged_required, flag
from docutils.parsers.rst.directives import unchanged_required, flag # type: ignore


class RootDataObject(object):
Expand Down
2 changes: 1 addition & 1 deletion breathe/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from docutils import nodes
from docutils.nodes import Node
from docutils.parsers.rst.directives import unchanged_required, unchanged, flag
from docutils.parsers.rst.directives import unchanged_required, unchanged, flag # type: ignore

import os
import re
Expand Down
2 changes: 2 additions & 0 deletions breathe/file_state_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def update(app: Sphinx, source_file: str) -> None:
mtime, docnames = app.env.breathe_file_state.setdefault( # type: ignore
source_file, (new_mtime, set()))

assert app.env is not None
docnames.add(app.env.docname)

app.env.breathe_file_state[source_file] = (new_mtime, docnames) # type: ignore


Expand Down
8 changes: 8 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def run_directive(self, obj_type: str, declaration: str, contentCallback: Conten
for k, v in options.items():
directive.options[k] = v

assert self.app.env is not None
config = self.app.env.config

if config.breathe_debug_trace_directives:
Expand Down Expand Up @@ -635,6 +636,8 @@ def content(contentnode):
content_callback = content
declaration = declaration.replace('\n', ' ')
nodes_ = self.run_directive(obj_type, declaration, content_callback, options)

assert self.app.env is not None
if self.app.env.config.breathe_debug_trace_doxygen_ids:
target = self.create_doxygen_target(node)
if len(target) == 0:
Expand Down Expand Up @@ -696,6 +699,7 @@ def get_qualification(self) -> List[str]:
if self.nesting_level > 0:
return []

assert self.app.env is not None
config = self.app.env.config
if config.breathe_debug_trace_qualification:
def debug_print_node(n):
Expand Down Expand Up @@ -1722,6 +1726,8 @@ def visit_compoundref(self, node) -> List[Node]:
return nodelist

def visit_docxrefsect(self, node) -> List[Node]:
assert self.app.env is not None

signode = addnodes.desc_signature()
title = node.xreftitle[0] + ':'
titlenode = nodes.emphasis(text=title)
Expand Down Expand Up @@ -1897,6 +1903,8 @@ def visit_function(self, node) -> List[Node]:
self.context.directive_args[1] = [signature]

nodes = self.run_domain_directive(node.kind, self.context.directive_args[1])

assert self.app.env is not None
if self.app.env.config.breathe_debug_trace_doxygen_ids:
target = self.create_doxygen_target(node)
if len(target) == 0:
Expand Down
5 changes: 4 additions & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-r production.txt

flake8
pip-tools>=0.3.5
pytest
mypy

mypy>=0.900
types-docutils>=0.17.0