Skip to content

Commit

Permalink
style: Format
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 24, 2024
1 parent 8338e9b commit 85527c1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/_griffe/agents/nodes/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def relative_to_absolute(node: ast.ImportFrom, name: ast.alias, current_module:
The absolute import path.
"""
level = node.level
if level > 0 and current_module.is_package or current_module.is_subpackage:
if (level > 0 and current_module.is_package) or current_module.is_subpackage:
level -= 1
while level > 0 and current_module.parent is not None:
current_module = current_module.parent # type: ignore[assignment]
Expand Down
12 changes: 6 additions & 6 deletions src/_griffe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ def __str__(self) -> str:
def __repr__(self) -> str:
return f"Parameter(name={self.name!r}, annotation={self.annotation!r}, kind={self.kind!r}, default={self.default!r})"

def __eq__(self, __value: object) -> bool:
def __eq__(self, value: object, /) -> bool:
"""Parameters are equal if all their attributes except `docstring` and `function` are equal."""
if not isinstance(__value, Parameter):
if not isinstance(value, Parameter):
return NotImplemented
return (
self.name == __value.name
and self.annotation == __value.annotation
and self.kind == __value.kind
and self.default == __value.default
self.name == value.name
and self.annotation == value.annotation
and self.kind == value.kind
and self.default == value.default
)

@property
Expand Down
6 changes: 3 additions & 3 deletions src/griffe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
# names = sorted(n for n in dir(griffe) if not n.startswith("_") and n not in ("annotations", "lazy_importing"))
# print('__all__ = [\n "' + '",\n "'.join(names) + '",\n]')
__all__ = [
"DEFAULT_LOG_LEVEL",
"Alias",
"AliasResolutionError",
"Attribute",
Expand All @@ -378,7 +379,6 @@
"Class",
"ClassRemovedBaseBreakage",
"CyclicAliasError",
"DEFAULT_LOG_LEVEL",
"DataclassesExtension",
"Decorator",
"DelMembersMixin",
Expand Down Expand Up @@ -467,8 +467,8 @@
"LinesCollection",
"LoadableExtensionType",
"LoadingError",
"Logger",
"LogLevel",
"Logger",
"Module",
"ModuleFinder",
"ModulesCollection",
Expand Down Expand Up @@ -517,8 +517,8 @@
"builtin_extensions",
"c3linear_merge",
"check",
"dump",
"docstring_warning",
"dump",
"dynamic_import",
"find_breaking_changes",
"get__all__",
Expand Down
7 changes: 2 additions & 5 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ def clear_sys_modules(name: str | None = None) -> None:
else:
prefix = os.path.join(gettempdir(), _TMPDIR_PREFIX) # noqa: PTH118
for module_name, module in tuple(sys.modules.items()):
if (
(file := getattr(module, "__file__", ""))
and file.startswith(prefix)
or (paths := getattr(module, "__path__", ()))
and any(path.startswith(prefix) for path in paths)
if ((file := getattr(module, "__file__", "")) and file.startswith(prefix)) or (
(paths := getattr(module, "__path__", ())) and any(path.startswith(prefix) for path in paths)
):
sys.modules.pop(module_name, None)

0 comments on commit 85527c1

Please sign in to comment.