diff --git a/src/griffe/mixins.py b/src/griffe/mixins.py index 1853a2d6..f3fe7913 100644 --- a/src/griffe/mixins.py +++ b/src/griffe/mixins.py @@ -324,6 +324,11 @@ def is_special(self) -> bool: """Whether this object/alias is special ("dunder" attribute/method, starts and end with `__`).""" return self.name.startswith("__") and self.name.endswith("__") # type: ignore[attr-defined] + @property + def is_class_private(self) -> bool: + """Whether this object/alias is class-private (starts with `__` and is a class member).""" + return self.parent and self.parent.is_class and self.name.startswith("__") and not self.name.endswith("__") # type: ignore[attr-defined] + @property def is_exported(self) -> bool: """Whether this object/alias is exported (listed in `__all__`)."""