TYP: handle mypy ignore in SelectionMixin
State: closed

- [ ] xref #37715
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Handle mypy ignore comments in ``pandas/core/base.py``, class ``SelectionMixin``.
There were issues with attributes ``obj`` and ``exclusions`` not defined in the mixin, but defined in the child classes.

I wish I made ``obj`` of type ``FrameOrSeries`` rather than ``Any``.
This is the type used in the child classes, but this results in multiple mypy errors of this kind.
```
pandas\core\window\rolling.py:197: error: FrameOrSeries? has no attribute "ndim"  [attr-defined]
```
If I go with ``FrameOrSeriesUnion``, then it is necessary to go and do casting where required to DataFrame or Series.
This is necessary since, for example, some kwargs for either of the types are irrelevant.

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

Comments:
I am not sure about the problem, but docs build finished with two warnings, causing CI to fail.
```
build finished with problems, 2 warnings.
Error: Process completed with exit code 1.
```
I documented ``obj`` and ``exclusions`` in ``SelectionMixin`` docstring.
But there are still complains in build docs.

```
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.DataFrame.exclusions.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.Series.exclusions.rst: WARNING: document isn't included in any toctree
```

Any idea how to fix it?
i was thinking just make them private
> 
> 
> i was thinking just make them private

I tried, but the thing is that they are used heavily in the classes (at least ``obj``), which subclass from ``SelectionMixin``.
I guess, than avoiding mypy errors by making an actively used attributes private and thus changing quite the code base, is too costly.
can you merge master
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.
can you merge master
Hello @ivanovmg! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2021-03-16 06:40:20 UTC
@ivanovmg well my browser change added some whitespace :-< if you can fix up and push when you can.
@ivanovmg can you merge master and fixup mypy failures.
@simonjayhawkins I merged master.
It turns out that the changes introduced here regarding typing induce the following issues:
```
pandas/core/groupby/generic.py:1557: error: Unexpected keyword argument "columns" for "Series"  [call-arg]
pandas/core/groupby/generic.py:852: error: Unexpected keyword argument "name" for "DataFrame"  [call-arg]
```

In my opinion, there is a problem with the interchangeability of ``Series`` and ``DataFrame``.
Fixing these problems is going to be extremely intrusive.
Considering the trade offs, IMHO, it is better to close this PR.
> Considering the trade offs, IMHO, it is better to close this PR.

That's your call.
Closing.