Skip to content

Commit

Permalink
Address mypy complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
josiah-wolf-oberholtzer committed Dec 13, 2022
1 parent 536273c commit 2ec2309
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions uqbar/apis/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def __str__(self) -> str:

### PUBLIC METHODS ###

def build_graph(self, urls=None):
def build_graph(self, urls=None) -> uqbar.graphs.Graph:
urls = urls or {}
graph = uqbar.graphs.Graph(
name="InheritanceGraph",
Expand Down Expand Up @@ -286,7 +286,7 @@ def build_graph(self, urls=None):
"style": ["filled", "rounded"],
},
)
class_paths_to_nodes: Dict[type, uqbar.graphs.Node] = {}
class_paths_to_nodes: Dict[str, uqbar.graphs.Node] = {}
for class_path in self._all_class_paths:
node = self._get_or_create_node(class_path, graph, urls)
class_paths_to_nodes[class_path] = node
Expand Down
2 changes: 1 addition & 1 deletion uqbar/graphs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Attachable(UniqueTreeNode):

### INITIALIZER ###

def __init__(self):
def __init__(self) -> None:
self._edges: Set["Edge"] = set()

### PRIVATE METHODS ###
Expand Down
14 changes: 7 additions & 7 deletions uqbar/sphinx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def logger_func(string):
logger.info("{} {}".format(bold("[uqbar-api]"), string))


def on_builder_inited(app):
def on_builder_inited(app) -> None:
"""
Hooks into Sphinx's ``builder-inited`` event.
Expand All @@ -60,16 +60,16 @@ def on_builder_inited(app):
source_paths = config.uqbar_api_source_paths
for source_path in source_paths:
if isinstance(source_path, types.ModuleType):
if hasattr(source_path, "__path__"):
initial_source_paths.extend(getattr(source_path, "__path__"))
else:
if hasattr(source_path, "__path__") and source_path.__path__ is not None:
initial_source_paths.extend(source_path.__path__)
elif hasattr(source_path, "__file__") and source_path.__file__ is not None:
initial_source_paths.extend(source_path.__file__)
continue
try:
module = importlib.import_module(source_path)
if hasattr(module, "__path__"):
initial_source_paths.extend(getattr(module, "__path__"))
else:
if hasattr(module, "__path__") and module.__path__ is not None:
initial_source_paths.extend(module.__path__)
elif hasattr(module, "__file__") and module.__file__ is not None:
initial_source_paths.append(module.__file__)
except ImportError:
initial_source_paths.append(source_path)
Expand Down
2 changes: 1 addition & 1 deletion uqbar/sphinx/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def handle_method(signature_node, module, object_name, cache):
signature_node.insert(0, emphasis)


def on_doctree_read(app, document):
def on_doctree_read(app, document) -> None:
"""
Hooks into Sphinx's ``doctree-read`` event.
"""
Expand Down

0 comments on commit 2ec2309

Please sign in to comment.