Skip to content

Commit 078e11f

Browse files
DOC: fix PR01,SA01,ES01 for pandas.errors.AbstractMethodError (#59679)
1 parent 8566ff3 commit 078e11f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
221221
-i "pandas.core.resample.Resampler.transform PR01,RT03,SA01" \
222222
-i "pandas.core.resample.Resampler.var SA01" \
223223
-i "pandas.date_range RT03" \
224-
-i "pandas.errors.AbstractMethodError PR01,SA01" \
225224
-i "pandas.errors.AttributeConflictWarning SA01" \
226225
-i "pandas.errors.CSSWarning SA01" \
227226
-i "pandas.errors.CategoricalConversionWarning SA01" \

pandas/errors/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,30 @@ class AbstractMethodError(NotImplementedError):
285285
"""
286286
Raise this error instead of NotImplementedError for abstract methods.
287287
288+
The `AbstractMethodError` is designed for use in classes that follow an abstract
289+
base class pattern. By raising this error in the method, it ensures that a subclass
290+
must implement the method to provide specific functionality. This is useful in a
291+
framework or library where certain methods must be implemented by the user to
292+
ensure correct behavior.
293+
294+
Parameters
295+
----------
296+
class_instance : object
297+
The instance of the class where the abstract method is being called.
298+
methodtype : str, default "method"
299+
A string indicating the type of method that is abstract.
300+
Must be one of {"method", "classmethod", "staticmethod", "property"}.
301+
302+
See Also
303+
--------
304+
api.extensions.ExtensionArray
305+
An example of a pandas extension mechanism that requires implementing
306+
specific abstract methods.
307+
NotImplementedError
308+
A built-in exception that can also be used for abstract methods but lacks
309+
the specificity of `AbstractMethodError` in indicating the need for subclass
310+
implementation.
311+
288312
Examples
289313
--------
290314
>>> class Foo:

0 commit comments

Comments
 (0)