Tslibs offsets validation
State: closed

Lots to do in offsets, trying to push breaking changes to the very end.  This just implements validation for DateOffset args/kwargs, fixes a poorly-worded error message and the associated tm.assert_raises_regex tests.

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Internals
description: Related to non-user accessible pandas implementation

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

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

```diff
@@            Coverage Diff             @@
##           master   #18210      +/-   ##
==========================================
- Coverage    91.4%   91.38%   -0.02%     
==========================================
  Files         163      163              
  Lines       50064    50055       -9     
==========================================
- Hits        45759    45744      -15     
- Misses       4305     4311       +6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.19% <100%> (ø)` | :arrow_up: |
| #single | `40.36% <12.5%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97.22% <100%> (+0.11%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.48% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18210?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/18210?src=pr&el=footer). Last update [ca737ac...9ef49b4](https://codecov.io/gh/pandas-dev/pandas/pull/18210?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/18210?src=pr&el=h1) Report
> Merging [#18210](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1647a724ae5c9038cdd3cf4ebbf2273d1b6ab109?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #18210      +/-   ##
==========================================
- Coverage   91.36%   91.35%   -0.02%     
==========================================
  Files         164      164              
  Lines       49718    49709       -9     
==========================================
- Hits        45426    45410      -16     
- Misses       4292     4299       +7
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.15% <100%> (ø)` | :arrow_up: |
| #single | `39.61% <50%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `96.83% <100%> (+0.12%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18210?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

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

```
taskset 7 asv continuous -f 1.1 -E virtualenv master HEAD -b timeseries
[...]
       before           after         ratio
     [ca737aca]       [ada38540]
+      43.2±0.2μs       48.0±0.2μs     1.11  timeseries.SemiMonthOffset.time_begin_apply
+     18.4±0.05μs       20.3±0.1μs     1.10  timeseries.Offsets.time_custom_bday_apply_dt64
+       135±0.2μs          149±1μs     1.10  timeseries.Offsets.time_custom_bmonthend_incr
-     8.50±0.08μs      7.65±0.03μs     0.90  timeseries.Offsets.time_timeseries_year_apply
-     21.2±0.08μs      18.9±0.05μs     0.89  timeseries.Offsets.time_custom_bday_incr
-        92.9±9ms       26.9±0.1ms     0.29  timeseries.AsOfDataFrame.time_asof_nan
-        97.8±4ms       24.1±0.3ms     0.25  timeseries.AsOfDataFrame.time_asof
```

The time_asof and time_asof_nan are pretty frequently outliers.  Given the local entropy field, this is about a wash.
travis error is TestClipboard
isn't this competing with #18228 ? thought was closing this one
> isn't this competing with #18228 ? thought was closing this one

#18826 is fundamentally a bugfix, while this is mostly a refactor with a side of unrelated-bugfix.  The resemblance is coincidence.  #18226 does need rebasing though.
so will leave to after #18228 is merged, you are defining the validate_n again here (but please add the doc-strings to #18228)
needs a rebase (and prob some code removal)
Low priority, closing for now