Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Oct 8, 2024
1 parent af08a36 commit d4c3392
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions mknodes/info/grifferegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
from abc import ABCMeta
from collections.abc import MutableMapping
import types
from typing import TYPE_CHECKING

from griffe import GriffeLoader, Parser
import griffe

from mknodes.utils import log


if TYPE_CHECKING:
import griffe
from griffe import Alias


logger = log.get_logger(__name__)


def get_module(module: str | types.ModuleType) -> griffe.Module | Alias:
def get_module(module: str | types.ModuleType) -> griffe.Module | griffe.Alias:
"""Return info for given module from registry.
Arguments:
Expand All @@ -27,7 +21,7 @@ def get_module(module: str | types.ModuleType) -> griffe.Module | Alias:
return registry.get_module(module)


def get_class(klass: str | type) -> griffe.Class | Alias:
def get_class(klass: str | type) -> griffe.Class | griffe.Alias:
"""Return info for given klass from registry.
Arguments:
Expand Down Expand Up @@ -83,7 +77,7 @@ def get_module(
self,
module: str | types.ModuleType,
docstring_style: str = "google",
) -> griffe.Module | Alias:
) -> griffe.Module | griffe.Alias:
"""Get griffe Module for given module.
Arguments:
Expand All @@ -97,8 +91,8 @@ def get_module(
else:
module_name, sub_mod_path = module, ""
if module_name not in self._modules:
parser = Parser(docstring_style)
loader = GriffeLoader(docstring_parser=parser)
parser = griffe.Parser(docstring_style)
loader = griffe.GriffeLoader(docstring_parser=parser)
griffe_mod = loader.load(module_name)
assert isinstance(griffe_mod, griffe.Object)
if self.expand_wildcards:
Expand All @@ -111,7 +105,7 @@ def get_class(
self,
klass: str | type,
docstring_style: str = "google",
) -> griffe.Class | Alias:
) -> griffe.Class | griffe.Alias:
"""Get griffe Class for given class.
Arguments:
Expand Down

0 comments on commit d4c3392

Please sign in to comment.