CLN: to_datetime internals
State: closed

- [x] tests passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

The internals of `to_datetime` is getting a bit unwieldy, so split out the `_convert_listlike` logic and origin shifting logic to ` _convert_listlike_datetime` and `adjust_to_origin` methods respectively outside of `to_datetime`. The logic was not changed.

Labels:
name: Clean

Comments:
Hello @mroeschke! Thanks for updating the PR.

 - In the file [`pandas/core/tools/datetimes.py`](https://github.com/pandas-dev/pandas/blob/e9320f103291d83c7db7917cb513e02749447ae4/pandas/core/tools/datetimes.py), following are the PEP8 issues :

> [Line 243:17](https://github.com/pandas-dev/pandas/blob/e9320f103291d83c7db7917cb513e02749447ae4/pandas/core/tools/datetimes.py#L243): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 315:9](https://github.com/pandas-dev/pandas/blob/e9320f103291d83c7db7917cb513e02749447ae4/pandas/core/tools/datetimes.py#L315): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'



##### Comment last updated on July 03, 2018 at 05:24 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21702?src=pr&el=h1) Report
> Merging [#21702](https://codecov.io/gh/pandas-dev/pandas/pull/21702?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7cd2679982138e1e7f9f1a759827647e6e521d43?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `88.88%`.

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

```diff
@@            Coverage Diff             @@
##           master   #21702      +/-   ##
==========================================
+ Coverage    91.9%   91.91%   +<.01%     
==========================================
  Files         158      158              
  Lines       49690    49695       +5     
==========================================
+ Hits        45670    45675       +5     
  Misses       4020     4020
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.28% <88.88%> (ø)` | :arrow_up: |
| #single | `41.95% <51.28%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21702?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/21702/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `85.22% <88.88%> (+0.23%)` | :arrow_up: |

------

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

lgtm. can you do a perf check to make sure nothing changed (as the caching logic was lightly touched here)
My asv setup is still a little broken, but here's a benchmark showing no performance hit (with cache)

```
In [1]: from pandas import *

In [3]: N = 100

In [4]: dup_string_with_tz = ['2000-02-11 15:00:00-0800'] * N

# this branch
In [5]: %timeit to_datetime(dup_string_with_tz, cache=True)
1.31 ms ± 44.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

In [6]: %timeit to_datetime(dup_string_with_tz, cache=False)
2.3 ms ± 41.2 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

# Master
In [4]: %timeit to_datetime(dup_string_with_tz, cache=True)
1.29 ms ± 13.3 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

In [5]: %timeit to_datetime(dup_string_with_tz, cache=False)
2.31 ms ± 68.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```
thanks @mroeschke happily take refactorings to clean up things / make more readable