Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 27, 2024
1 parent 1407cba commit 059d37a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pluggy/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ def parse_hookimpl_opts(self, plugin: _Plugin, name: str) -> HookimplOpts | None
plugin_class = plugin if inspect.isclass(plugin) else type(plugin)
if isinstance(getattr(plugin_class, name, None), property):
return None

# if attr is field on a pydantic model, skip it (pydantic fields are never hookimpls)

Check warning on line 191 in src/pluggy/_manager.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_manager.py#L191

Added line #L191 was not covered by tests
if hasattr(plugin, '__pydantic_core_schema__') and name in getattr(plugin, 'model_fields', {}):
# pydantic can present class attributes, instance attributes, or methods
if hasattr(plugin, "__pydantic_core_schema__") and name in getattr(
plugin, "model_fields", {}
):
# pydantic can present class attributes, instance attributes, or methods
# but none of them can be hookimpls so they throw off the logic below

Check warning on line 196 in src/pluggy/_manager.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_manager.py#L195-L196

Added lines #L195 - L196 were not covered by tests
return None

method: object = getattr(plugin, name)
if not inspect.isroutine(method):
return None
Expand Down

0 comments on commit 059d37a

Please sign in to comment.