Remove arg that is only ever used as NPY_UNSAFE_CASTING
State: closed

Several functions from src/datetime are only ever called with the casting rule NPY_UNSAFE_CASTING.  By getting rid of that dummy argument, the remaining code gets simplified quite a bit.

This PR removes that argument, then removes code that this renders unreachable or unused.  It also removes several commented-out functions.

There are a couple of other never-used args; taking these one at a time.


Labels:
name: Datetime
description: Datetime data dtype
name: Clean

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

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

```diff
@@            Coverage Diff             @@
##           master   #18546      +/-   ##
==========================================
- Coverage   91.35%   91.33%   -0.02%     
==========================================
  Files         164      164              
  Lines       49802    49802              
==========================================
- Hits        45496    45487       -9     
- Misses       4306     4315       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.13% <ø> (ø)` | :arrow_up: |
| #single | `40.81% <ø> (-0.07%)` | :arrow_down: |

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

------

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

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

```diff
@@            Coverage Diff             @@
##           master   #18546      +/-   ##
==========================================
- Coverage   91.35%   91.33%   -0.02%     
==========================================
  Files         164      164              
  Lines       49802    49802              
==========================================
- Hits        45496    45487       -9     
- Misses       4306     4315       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.13% <ø> (ø)` | :arrow_up: |
| #single | `40.81% <ø> (-0.07%)` | :arrow_down: |

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

------

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

can you run an asv set on timeseries and see if anything changes.
> can you run an asv set on timeseries and see if anything changes.

Starting now.
```
taskset 2 asv continuous -f 1.1 -E virtualenv master HEAD -b timeseries
[...]
       before           after         ratio
     [2a0e54bc]       [02e4e8bf]
+      19.0±0.1ms            135ms     7.10  timeseries.DatetimeIndex.time_dti_tz_factorize
+        54.9±5ms         117±20ms     2.12  timeseries.DatetimeIndex.time_dti_factorize
+           1.61s            1.93s     1.20  timeseries.AsOfDataFrame.time_asof
-     2.49±0.01ms      2.20±0.02ms     0.88  timeseries.ToDatetime.time_cache_true_with_dup_string_dates
-      7.85±0.4μs      6.75±0.04μs     0.86  timeseries.DatetimeIndex.time_timestamp_tzinfo_cons
-      25.3±0.6μs       20.2±0.2μs     0.80  offset.Day.time_timeseries_day_incr
-           1.83s        1.12±0.2s     0.61  timeseries.AsOfDataFrame.time_asof_nan
```

`asof` and `dti_factorize` I've gotten use to completely ignoring.  Re-running anyway, but this looks like noise.
```
       before           after         ratio
     [2a0e54bc]       [02e4e8bf]
+     7.81±0.07ms         23.8±3ms     3.05  timeseries.DatetimeIndex.time_dti_tz_factorize
+         389±2μs         444±20μs     1.14  timeseries.DatetimeIndex.time_reset_index
-         134±8μs        113±0.1μs     0.85  timeseries.DatetimeIndex.time_unique
-         162±2ms          137±2ms     0.85  timeseries.ToDatetime.time_iso8601_tz_spaceformat
-        27.6±2ms       22.4±0.2ms     0.81  timeseries.DatetimeIndex.time_to_pydatetime
```
```
      before           after         ratio
     [2a0e54bc]       [02e4e8bf]
+        62.1±2ms         101±30ms     1.63  timeseries.AsOfDataFrame.time_asof_nan
+     1.47±0.01ms      1.77±0.03ms     1.20  timeseries.ToDatetime.time_cache_false_with_dup_string_dates_and_format
+      13.3±0.4μs       15.2±0.1μs     1.14  offset.YearBegin.time_timeseries_year_incr
-      19.8±0.1μs       17.6±0.2μs     0.89  timeseries.AsOf.time_asof_single_early
-      3.96±0.2ms      3.44±0.03ms     0.87  timeseries.ToDatetime.time_cache_true_with_unique_seconds_and_unit
-      2.00±0.1ms         1.69±0ms     0.84  timeseries.DatetimeIndex.time_add_timedelta
```
There are a few of these; hoping to get them out of the way before doing away with datetime.pxd
thanks!