Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP: check_untyped_defs core.arrays.base #36885

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Oct 5, 2020

xref #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 #31160 (comment)

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]

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Oct 5, 2020
@simonjayhawkins simonjayhawkins added this to the 1.2 milestone Oct 5, 2020
@jreback jreback merged commit fa53b14 into pandas-dev:master Oct 5, 2020
@jreback
Copy link
Contributor

jreback commented Oct 5, 2020

thanks

@simonjayhawkins simonjayhawkins deleted the core.arrays.base branch October 5, 2020 13:15
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Oct 13, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants