Skip to content

Commit 20f1f8f

Browse files
committed
ci: Improve typing of import utils
1 parent 0975044 commit 20f1f8f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/griffe/agents/inspector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from inspect import Parameter as SignatureParameter
2727
from inspect import Signature, cleandoc
2828
from inspect import signature as getsignature
29-
from typing import TYPE_CHECKING, Any
29+
from typing import TYPE_CHECKING, Any, Sequence
3030

3131
from griffe.agents.nodes import ObjectKind, ObjectNode, safe_get_annotation
3232
from griffe.collections import LinesCollection, ModulesCollection
@@ -58,7 +58,7 @@ def inspect(
5858
module_name: str,
5959
*,
6060
filepath: Path | None = None,
61-
import_paths: list[Path] | None = None,
61+
import_paths: Sequence[str | Path] | None = None,
6262
extensions: Extensions | None = None,
6363
parent: Module | None = None,
6464
docstring_parser: Parser | None = None,
@@ -159,7 +159,7 @@ def _get_docstring(self, node: ObjectNode) -> Docstring | None:
159159
parser_options=self.docstring_options,
160160
)
161161

162-
def get_module(self, import_paths: list[Path] | None = None) -> Module:
162+
def get_module(self, import_paths: Sequence[str | Path] | None = None) -> Module:
163163
"""Build and return the object representing the module attached to this inspector.
164164
165165
This method triggers a complete inspection of the module members.

src/griffe/importer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
from contextlib import contextmanager
77
from importlib import import_module
8-
from typing import TYPE_CHECKING, Any, Iterator
8+
from typing import TYPE_CHECKING, Any, Iterator, Sequence
99

1010
if TYPE_CHECKING:
1111
from pathlib import Path
@@ -33,7 +33,7 @@ def sys_path(*paths: str | Path) -> Iterator[None]:
3333
sys.path = old_path
3434

3535

36-
def dynamic_import(import_path: str, import_paths: list[Path] | None = None) -> Any:
36+
def dynamic_import(import_path: str, import_paths: Sequence[str | Path] | None = None) -> Any:
3737
"""Dynamically import the specified object.
3838
3939
It can be a module, class, method, function, attribute,

0 commit comments

Comments
 (0)