Separate out _convert_datetime_to_tsobject
State: closed

A bunch of calls to `convert_to_tsobject` are made in cases where we already know that the input is a `datetime` object.  This PR separates out the `datetime` case into a new function `_convert_datetime_to_tsobject`.

Second, to make the dependency between `_TSObject` and `Timestamp` one-way, this removes the three references to `Timestamp` that are made in `convert_str_to_tsobject`.  Verifying the last of these changes may be non-trivial.

This is a prelude to separating `_TSobject` logic out into `tslibs.conversion`.

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Clean

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

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

```diff
@@            Coverage Diff             @@
##           master   #17715      +/-   ##
==========================================
- Coverage   91.27%   91.25%   -0.03%     
==========================================
  Files         163      163              
  Lines       49783    49783              
==========================================
- Hits        45439    45429      -10     
- Misses       4344     4354      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.05% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.34% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.44% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17715?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/17715?src=pr&el=footer). Last update [bbf0dda...6ced748](https://codecov.io/gh/pandas-dev/pandas/pull/17715?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/17715?src=pr&el=h1) Report
> Merging [#17715](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/bbf0ddaf6461a9586c5e459d9c00fe863adc43f8?src=pr&el=desc) will **decrease** coverage by `0.05%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #17715      +/-   ##
==========================================
- Coverage   91.27%   91.21%   -0.06%     
==========================================
  Files         163      163              
  Lines       49783    49796      +13     
==========================================
- Hits        45439    45421      -18     
- Misses       4344     4375      +31
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.01% <ø> (-0.05%)` | :arrow_down: |
| #single | `40.33% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.38% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `82.97% <0%> (-0.83%)` | :arrow_down: |
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `96.39% <0%> (-0.51%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.46% <0%> (-0.29%)` | :arrow_down: |
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92.04% <0%> (-0.2%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.11%)` | :arrow_down: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.14% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <0%> (ø)` | :arrow_up: |
| [pandas/core/dtypes/inference.py](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2luZmVyZW5jZS5weQ==) | `98.36% <0%> (+0.02%)` | :arrow_up: |
| ... and [4 more](https://codecov.io/gh/pandas-dev/pandas/pull/17715?src=pr&el=tree-more) | |

------

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

No significant changes
```
$asv continuous -f 1.1 -E virtualenv master HEAD -b timeseries
[...]
       before           after         ratio
     [cc58b84f]       [a7b66c1a]
+        11.8±0ms         15.9±2ms     1.35  timeseries.DatetimeIndex.time_infer_freq_none
+           1.55s            2.05s     1.32  timeseries.AsOfDataFrame.time_asof_nan
+     19.6±0.07μs         24.0±3μs     1.23  timeseries.Offsets.time_timeseries_day_apply
+      16.6±0.1μs       18.3±0.1μs     1.10  timeseries.Offsets.time_custom_bday_apply
-       174±0.9μs        158±0.3μs     0.91  timeseries.Offsets.time_custom_bmonthend_decr_n
-        422±20ms        380±0.2ms     0.90  timeseries.DatetimeIndex.time_add_offset_slow
-     22.1±0.09μs      19.8±0.05μs     0.90  timeseries.Offsets.time_timeseries_day_incr
-           1.99s        1.48±0.3s     0.74  timeseries.AsOfDataFrame.time_asof

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
```
ok ping on green. Still would like to simplify some of this logic generally (as the is pr just moves it around), but can do a bit later (maybe add to TODO).
> Still would like to simplify some of this logic generally

Yah.  As I look at it, some pieces might be simpler/clearer as methods (or classmethods) of `_TSObject`).  Would that defeat the purpose of `_TSObject`, since it is explicitly supposed to be "lightweight"?
Not sure what's up here.  Tests started failing when `create_datetime_from_ts ` was introduced, continue failing with just `_convert_tsobject_tz`.  My inclination is to revert to two commits ago when it was passing and add this mystery to the TODO list.
ping, though note reversion mentioned above.
thanks