Skip to content

Commit 97b12bd

Browse files
committed
ci: Ease Mypy
1 parent 441b3b7 commit 97b12bd

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/_griffe/extensions/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _dataclass_parameters(class_: Class) -> list[Parameter]:
118118

119119
# Determine parameter default.
120120
if "default_factory" in field_args:
121-
default = ExprCall(function=field_args["default_factory"], arguments=[])
121+
default: str | Expr | None = ExprCall(function=field_args["default_factory"], arguments=[])
122122
else:
123123
default = field_args.get("default", None if field_args else member.value)
124124

src/_griffe/finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ def _handle_editable_module(path: Path) -> list[_SP]:
495495
target = node.target
496496
else:
497497
continue
498-
if isinstance(target, ast.Name) and target.id == "MAPPING" and isinstance(node.value, ast.Dict): # type: ignore[attr-defined]
499-
return [_SP(Path(cst.value).parent) for cst in node.value.values if isinstance(cst, ast.Constant)] # type: ignore[attr-defined]
498+
if isinstance(target, ast.Name) and target.id == "MAPPING" and isinstance(node.value, ast.Dict):
499+
return [_SP(Path(cst.value).parent) for cst in node.value.values if isinstance(cst, ast.Constant)]
500500
if _match_pattern(path.name, _editable_meson_python_patterns):
501501
# Support for how 'meson-python' writes these files:
502502
# example line: `install({'package', 'module1'}, '/media/data/dev/griffe/build/cp311', ["path"], False)`.

src/_griffe/loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ def _get_or_create_parent_module(
699699
raise UnimportableModuleError(f"Skip {subpath}, it is not importable") from error
700700
else:
701701
parent_namespace = parent_module.is_namespace_package or parent_module.is_namespace_subpackage
702-
if parent_namespace and module_filepath not in parent_module.filepath: # type: ignore[operator]
703-
parent_module.filepath.append(module_filepath) # type: ignore[union-attr]
702+
if parent_namespace and module_filepath not in parent_module.filepath:
703+
parent_module.filepath.append(module_filepath)
704704
return parent_module
705705

706706
def _expand_wildcard(self, wildcard_obj: Alias) -> list[tuple[Object | Alias, int | None, int | None]]:

src/_griffe/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ def _resolve_target(self) -> None:
17551755
raise CyclicAliasError([self.target_path, *error.chain]) from error
17561756
self._target = resolved
17571757
if self.parent is not None:
1758-
self._target.aliases[self.path] = self # type: ignore[union-attr]
1758+
self._target.aliases[self.path] = self
17591759

17601760
def _update_target_aliases(self) -> None:
17611761
with suppress(AttributeError, AliasResolutionError, CyclicAliasError):

0 commit comments

Comments
 (0)