TYP: check_untyped_defs core.arrays.base
State: closed

xref https://github.com/pandas-dev/pandas/issues/31160

from https://docs.python.org/3/library/functions.html?highlight=setattr#setattr

> For example, setattr(x, 'foobar', 123) is equivalent to x.foobar = 123.

The changes here, don't 'fix' the issue. The correct solution is to create these methods with a statically defined interface, see https://github.com/pandas-dev/pandas/issues/31160#issuecomment-699193016

In the meantime, the changes here allows untyped defs in this module to be checked. (without adding type ignores)

pandas\core\arrays\base.py:1179: error: Unsupported left operand type for + ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1180: error: "Type[ExtensionOpsMixin]" has no attribute "__radd__"  [attr-defined]
pandas\core\arrays\base.py:1181: error: Unsupported left operand type for - ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1182: error: "Type[ExtensionOpsMixin]" has no attribute "__rsub__"  [attr-defined]
pandas\core\arrays\base.py:1183: error: Unsupported left operand type for * ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1184: error: "Type[ExtensionOpsMixin]" has no attribute "__rmul__"  [attr-defined]
pandas\core\arrays\base.py:1185: error: Unsupported left operand type for ** ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1186: error: "Type[ExtensionOpsMixin]" has no attribute "__rpow__"  [attr-defined]
pandas\core\arrays\base.py:1187: error: Unsupported left operand type for % ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1188: error: "Type[ExtensionOpsMixin]" has no attribute "__rmod__"  [attr-defined]
pandas\core\arrays\base.py:1189: error: Unsupported left operand type for // ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1190: error: "Type[ExtensionOpsMixin]" has no attribute "__rfloordiv__"  [attr-defined]
pandas\core\arrays\base.py:1191: error: Unsupported left operand type for / ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1192: error: "Type[ExtensionOpsMixin]" has no attribute "__rtruediv__"  [attr-defined]
pandas\core\arrays\base.py:1193: error: Unsupported left operand type for divmod ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1194: error: "Type[ExtensionOpsMixin]" has no attribute "__rdivmod__"  [attr-defined]
pandas\core\arrays\base.py:1202: error: Cannot assign to a method  [assignment]
pandas\core\arrays\base.py:1203: error: Cannot assign to a method  [assignment]
pandas\core\arrays\base.py:1204: error: Unsupported left operand type for < ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1205: error: Unsupported left operand type for > ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1206: error: Unsupported left operand type for <= ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1207: error: Unsupported left operand type for >= ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1215: error: Unsupported left operand type for & ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1216: error: "Type[ExtensionOpsMixin]" has no attribute "__rand__"  [attr-defined]
pandas\core\arrays\base.py:1217: error: Unsupported left operand type for | ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1218: error: "Type[ExtensionOpsMixin]" has no attribute "__ror__"  [attr-defined]
pandas\core\arrays\base.py:1219: error: Unsupported left operand type for ^ ("Type[ExtensionOpsMixin]")  [operator]
pandas\core\arrays\base.py:1220: error: "Type[ExtensionOpsMixin]" has no attribute "__rxor__"  [attr-defined]

Labels:
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
thanks