From b8beb63b4dbdf8b9c7e478a8af8396481cbf9bf3 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sat, 31 Aug 2024 21:03:35 +0530 Subject: [PATCH] DOC: fix PR01,SA01,ES01 for pandas.errors.AbstractMethodError --- ci/code_checks.sh | 1 - pandas/errors/__init__.py | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 2f95367266a36..1e085c76c00f2 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -224,7 +224,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.core.resample.Resampler.transform PR01,RT03,SA01" \ -i "pandas.core.resample.Resampler.var SA01" \ -i "pandas.date_range RT03" \ - -i "pandas.errors.AbstractMethodError PR01,SA01" \ -i "pandas.errors.AttributeConflictWarning SA01" \ -i "pandas.errors.CSSWarning SA01" \ -i "pandas.errors.CategoricalConversionWarning SA01" \ diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index 6d571031636b5..2f625090e0492 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -285,6 +285,30 @@ class AbstractMethodError(NotImplementedError): """ Raise this error instead of NotImplementedError for abstract methods. + The `AbstractMethodError` is designed for use in classes that follow an abstract + base class pattern. By raising this error in the method, it ensures that a subclass + must implement the method to provide specific functionality. This is useful in a + framework or library where certain methods must be implemented by the user to + ensure correct behavior. + + Parameters + ---------- + class_instance : object + The instance of the class where the abstract method is being called. + methodtype : str, default "method" + A string indicating the type of method that is abstract. + Must be one of {"method", "classmethod", "staticmethod", "property"}. + + See Also + -------- + api.extensions.ExtensionArray + An example of a pandas extension mechanism that requires implementing + specific abstract methods. + NotImplementedError + A built-in exception that can also be used for abstract methods but lacks + the specificity of `AbstractMethodError` in indicating the need for subclass + implementation. + Examples -------- >>> class Foo: