Skip to content

Fix type annotations in pandas.core.ops #26377

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

Merged
merged 4 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ ignore_errors=True
[mypy-pandas.core.internals.blocks]
ignore_errors=True

[mypy-pandas.core.ops]
ignore_errors=True

[mypy-pandas.core.panel]
ignore_errors=True

Expand Down
7 changes: 3 additions & 4 deletions pandas/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import datetime
import operator
import textwrap
from typing import Dict, Optional
import warnings

import numpy as np
Expand Down Expand Up @@ -625,15 +626,13 @@ def _get_op_name(op, special):
'desc': 'Greater than or equal to',
'reverse': None,
'series_examples': None}
}
} # type: Dict[str, Dict[str, Optional[str]]]

_op_names = list(_op_descriptions.keys())
for key in _op_names:
_op_descriptions[key]['reversed'] = False
reverse_op = _op_descriptions[key]['reverse']
if reverse_op is not None:
_op_descriptions[reverse_op] = _op_descriptions[key].copy()
_op_descriptions[reverse_op]['reversed'] = True
_op_descriptions[reverse_op]['reverse'] = key

_flex_doc_SERIES = """
Expand Down Expand Up @@ -1010,7 +1009,7 @@ def _make_flex_doc(op_name, typ):
op_name = op_name.replace('__', '')
op_desc = _op_descriptions[op_name]

if op_desc['reversed']:
if op_name.startswith('r'):
equiv = 'other ' + op_desc['op'] + ' ' + typ
else:
equiv = typ + ' ' + op_desc['op'] + ' other'
Expand Down