De-duplicate add_offset_array methods
State: closed

Combine DTI/TDI/PI add_offset_array and sub_offset_array methods.

Re-order `__add__` and `__sub__` if/else branches to put scalars up front.

This was going to include fixes for DTI/TDI with ndarray[timedelta64]/ndarray[datetime64], but the diff got big enough to split that off to the next one.

Labels:
name: Datetime
description: Datetime data dtype
name: Timedelta
description: Timedelta data type
name: Period
description: Period data type
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19835?src=pr&el=h1) Report
> Merging [#19835](https://codecov.io/gh/pandas-dev/pandas/pull/19835?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b585e3b5145a73cc7480db9a3b0c3ce7bd55511e?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `93.33%`.

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

```diff
@@            Coverage Diff             @@
##           master   #19835      +/-   ##
==========================================
+ Coverage   91.57%   91.58%   +<.01%     
==========================================
  Files         150      150              
  Lines       48903    48870      -33     
==========================================
- Hits        44785    44758      -27     
+ Misses       4118     4112       -6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.96% <93.33%> (ø)` | :arrow_up: |
| #single | `41.8% <30%> (+0.02%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19835?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/19835/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.7% <ø> (+0.14%)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/19835/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `93.04% <ø> (+0.16%)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/19835/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `90.94% <66.66%> (+0.31%)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/19835/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.14% <96.29%> (+0.24%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/19835/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `83.64% <0%> (-0.21%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19835?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/19835?src=pr&el=footer). Last update [b585e3b...34a49a3](https://codecov.io/gh/pandas-dev/pandas/pull/19835?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks!