CLN: Remove type definitions from pandas.compat
State: closed

- [X] xref #25725
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Removes the following:
- `string_types`
- `text_types`
- `binary_types`
- `string_and_binary_types`
- `strlen`
   - only used once and in PY3 is equivalent to `len`, so just directly called `len`
- `east_asian_len`
  - only called by `EastAsianTextAdjustment.len` in  `pandas/io/formats/format.py`
  - directly implemented as `EastAsianTextAdjustment.len` instead

Labels:
name: Strings
description: String extension data type and string data
name: Clean

Comments:
Note that these changes now reduce the `is_string_like` function in `pandas/core/dtypes/inference.py` to simply be `isinstance(obj, str)`:

https://github.com/pandas-dev/pandas/blob/6701e71f6fc48eb96e3bbf900ac733042492a74e/pandas/core/dtypes/inference.py#L69-L90

Does it make sense to deprecate `is_string_like` and convert all existing references to the `isinstance` check as a followup?
I would be +1 on replacing that function with isinstance checks - if anything I think it will make static code analysis cleaner
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=h1) Report
> Merging [#25903](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/882961df6025b800b899d351c243412e799accf4?src=pr&el=desc) will **increase** coverage by `0.02%`.
> The diff coverage is `94.14%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25903/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25903      +/-   ##
==========================================
+ Coverage   91.53%   91.56%   +0.02%     
==========================================
  Files         175      175              
  Lines       52808    52747      -61     
==========================================
- Hits        48338    48297      -41     
+ Misses       4470     4450      -20
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.12% <92.18%> (+0.02%)` | :arrow_up: |
| #single | `41.8% <41.79%> (-0.03%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `84.46% <ø> (-0.15%)` | :arrow_down: |
| [pandas/compat/pickle\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9waWNrbGVfY29tcGF0LnB5) | `75.3% <ø> (-0.31%)` | :arrow_down: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `100% <ø> (ø)` | :arrow_up: |
| [pandas/core/computation/scope.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vc2NvcGUucHk=) | `93.06% <ø> (ø)` | :arrow_up: |
| [pandas/plotting/\_timeseries.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL190aW1lc2VyaWVzLnB5) | `65.28% <0%> (-0.18%)` | :arrow_down: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `35.53% <0%> (ø)` | :arrow_up: |
| [pandas/core/computation/engines.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZW5naW5lcy5weQ==) | `88.52% <0%> (-0.19%)` | :arrow_down: |
| [pandas/io/json/normalize.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vbm9ybWFsaXplLnB5) | `96.93% <100%> (ø)` | :arrow_up: |
| [pandas/plotting/\_style.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19zdHlsZS5weQ==) | `77.17% <100%> (-0.25%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.73% <100%> (+0.27%)` | :arrow_up: |
| ... and [68 more](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=footer). Last update [882961d...6701e71](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=h1) Report
> Merging [#25903](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7721f7009249e2b1fa2647526114e7c423fef4ea?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `94.86%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25903/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25903      +/-   ##
==========================================
+ Coverage   91.77%   91.79%   +0.01%     
==========================================
  Files         175      175              
  Lines       52606    52538      -68     
==========================================
- Hits        48280    48228      -52     
+ Misses       4326     4310      -16
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.35% <93.28%> (+0.02%)` | :arrow_up: |
| #single | `41.88% <41.89%> (-0.1%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `84.46% <ø> (-0.15%)` | :arrow_down: |
| [pandas/compat/pickle\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9waWNrbGVfY29tcGF0LnB5) | `69.13% <ø> (-0.38%)` | :arrow_down: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `100% <ø> (ø)` | :arrow_up: |
| [pandas/core/computation/scope.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vc2NvcGUucHk=) | `93.06% <ø> (ø)` | :arrow_up: |
| [pandas/plotting/\_timeseries.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL190aW1lc2VyaWVzLnB5) | `65.28% <0%> (-0.18%)` | :arrow_down: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `35.53% <0%> (ø)` | :arrow_up: |
| [pandas/core/computation/engines.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZW5naW5lcy5weQ==) | `88.52% <0%> (-0.19%)` | :arrow_down: |
| [pandas/io/json/normalize.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vbm9ybWFsaXplLnB5) | `96.93% <100%> (ø)` | :arrow_up: |
| [pandas/plotting/\_style.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19zdHlsZS5weQ==) | `77.17% <100%> (-0.25%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.63% <100%> (+0.17%)` | :arrow_up: |
| ... and [68 more](https://codecov.io/gh/pandas-dev/pandas/pull/25903/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=footer). Last update [7721f70...4137281](https://codecov.io/gh/pandas-dev/pandas/pull/25903?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

can merge master. sorry i think merged something else and causes conflicts.
thanks @jschendel