CLN: datetimelike arrays: isort, small reorg
State: closed

Big diff, few real changes.

Implement `__repr__` for DTA/TDA.  Shared with PeriodArray implementation.  Added truncation so we don't print all N elements.  Adds tests for all three subclasses.  Creates dedicated test files for test_datetimes and test_timedeltas

Some PeriodArray methods got shuffled into weird places, so this puts them back.
Collects wrapping-properties in DatetimeIndex.
isort on indexes/datetimelike, datetimes, timedeltas

Labels:
name: Refactor
description: Internal refactoring of code
name: Datetime
description: Datetime data dtype
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
Hello @jbrockmendel! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/arrays/datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimes.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/arrays/datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/period.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/arrays/period.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/timedeltas.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/arrays/timedeltas.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/indexes/datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/datetimes.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/indexes/datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/period.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/indexes/period.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/timedeltas.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/core/indexes/timedeltas.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/tests/arrays/test_datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_datetimes.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/tests/arrays/test_datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_period.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/tests/arrays/test_period.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_timedeltas.py`](https://github.com/jbrockmendel/pandas/blob/e81f5d6bff3baaadec3782a5a1354dcf6710b2b3/pandas/tests/arrays/test_timedeltas.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23587?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@592fd64`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff            @@
##             master   #23587   +/-   ##
=========================================
  Coverage          ?   92.24%           
=========================================
  Files             ?      161           
  Lines             ?    51316           
  Branches          ?        0           
=========================================
  Hits              ?    47337           
  Misses            ?     3979           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.63% <100%> (?)` | |
| #single | `42.29% <79.59%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23587?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `95.08% <ø> (ø)` | |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.44% <ø> (ø)` | |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `93.04% <ø> (ø)` | |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `95.92% <100%> (ø)` | |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.01% <100%> (ø)` | |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `89.26% <100%> (ø)` | |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.49% <100%> (ø)` | |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23587/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.12% <100%> (ø)` | |

------

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

> What's the motivation for aliasing DatetimeArrayMixin to DatetimeArray, rather than doing the rename all at once?

In several branches where I have tried doing it all-at-once the diffs become difficult for even me to read.  Getting this out of the way early saves some trouble.
Are we OK with merging this and then shortly thereafter getting rid of the `__repr__` here and replace it with #23601?  Or should I remove repr and tests from this PR?
I'm going to revert the repr changes if that's OK. We'll need to change them eventually, when the name changes from ArrayMixin to just Array, and since they aren't inheriting from ExtensionArray yet the formatting on #23601 won't quite work..
Converted the new array repr tests to xfails. We'll need to be a bit careful with those once we DatetimeArrayMixin inherits from DatetimeArray. I may not have gotten the future formatting 100% correct. 
Sounds good, thanks.
Fixed I sort that broke travis, hopefully got all of them
Travis fail is Hypothesis
> I see you have added [_timezone] [...] what is the point of _timezones when _tz already does this?

I didn't add this, has existed for a while.  No idea what the original reasoning was.  Maybe just an alias?
@jbrockmendel https://github.com/pandas-dev/pandas/pull/23587#issuecomment-437687293

ok. can you create an issue about seeing what that is about. it seems pretty confusing (though its actually a nice name).
lgtm. ping on green (circle seems to have failed <:)
Thanks @jbrockmendel !