@@ -170,12 +170,14 @@ def register(self, plugin: _Plugin, name: str | None = None) -> str | None:
170170 hook ._add_hookimpl (hookimpl )
171171 return plugin_name
172172
173- def _parse_hookimpl (self , plugin : _Plugin , name : str ) -> HookimplConfiguration | None :
173+ def _parse_hookimpl (
174+ self , plugin : _Plugin , name : str
175+ ) -> HookimplConfiguration | None :
174176 """Internal method to parse hook implementation configuration.
175-
177+
176178 This method uses the new HookimplConfiguration type internally.
177179 Falls back to the legacy parse_hookimpl_opts method for compatibility.
178-
180+
179181 :param plugin: The plugin object to inspect
180182 :param name: The attribute name to check for hook implementation
181183 :returns: HookimplConfiguration if found, None otherwise
@@ -184,30 +186,30 @@ def _parse_hookimpl(self, plugin: _Plugin, name: str) -> HookimplConfiguration |
184186 method : object = getattr (plugin , name )
185187 except Exception : # pragma: no cover
186188 return None
187-
189+
188190 if not inspect .isroutine (method ):
189191 return None
190-
192+
191193 try :
192194 # Try to get hook implementation configuration directly
193195 impl_attr = getattr (method , self .project_name + "_impl" , None )
194196 except Exception : # pragma: no cover
195197 impl_attr = None
196-
198+
197199 if impl_attr is not None :
198200 # Check if it's already a HookimplConfiguration (new style)
199201 if isinstance (impl_attr , HookimplConfiguration ):
200202 return impl_attr
201203 # Handle legacy dict-based configuration
202204 elif isinstance (impl_attr , dict ):
203205 return HookimplConfiguration .from_opts (impl_attr )
204-
206+
205207 # Fall back to legacy parse_hookimpl_opts for compatibility (e.g. pytest override)
206208 legacy_opts = self .parse_hookimpl_opts (plugin , name )
207209 if legacy_opts is not None :
208210 normalize_hookimpl_opts (legacy_opts )
209211 return HookimplConfiguration .from_opts (legacy_opts )
210-
212+
211213 return None
212214
213215 def parse_hookimpl_opts (self , plugin : _Plugin , name : str ) -> HookimplOpts | None :
@@ -217,10 +219,10 @@ def parse_hookimpl_opts(self, plugin: _Plugin, name: str) -> HookimplOpts | None
217219 :returns:
218220 The parsed hookimpl options, or None to skip the given item.
219221
220- .. deprecated::
221- Customizing hook implementation parsing by overriding this method is
222- deprecated. This method is only kept as a compatibility shim for
223- legacy projects like pytest. New code should use the standard
222+ .. deprecated::
223+ Customizing hook implementation parsing by overriding this method is
224+ deprecated. This method is only kept as a compatibility shim for
225+ legacy projects like pytest. New code should use the standard
224226 :class:`HookimplMarker` decorators.
225227 """
226228 # Compatibility shim - only overridden by legacy projects like pytest
0 commit comments