Skip to content

CLN: remove normalize_datetime #34016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__all__ = [
"localize_pydatetime",
"normalize_date",
"NaT",
"NaTType",
"iNaT",
Expand All @@ -17,7 +16,7 @@
]


from .conversion import localize_pydatetime, normalize_date
from .conversion import localize_pydatetime
from .nattype import NaT, NaTType, iNaT, is_null_datetimelike
from .np_datetime import OutOfBoundsDatetime
from .period import IncompatibleFrequency, Period
Expand Down
11 changes: 6 additions & 5 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime, time, timedelta
from typing import Union
from typing import Optional, Union
import warnings

import numpy as np
Expand All @@ -13,7 +13,6 @@
conversion,
fields,
iNaT,
normalize_date,
resolution as libresolution,
timezones,
tzconversion,
Expand Down Expand Up @@ -2288,19 +2287,21 @@ def _infer_tz_from_endpoints(start, end, tz):
return tz


def _maybe_normalize_endpoints(start, end, normalize):
def _maybe_normalize_endpoints(
start: Optional[Timestamp], end: Optional[Timestamp], normalize: bool
):
_normalized = True

if start is not None:
if normalize:
start = normalize_date(start)
start = start.normalize()
_normalized = True
else:
_normalized = _normalized and start.time() == _midnight

if end is not None:
if normalize:
end = normalize_date(end)
end = end.normalize()
_normalized = True
else:
_normalized = _normalized and end.time() == _midnight
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/tslibs/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def test_namespace():
"delta_to_nanoseconds",
"ints_to_pytimedelta",
"localize_pydatetime",
"normalize_date",
"tz_convert_single",
]

Expand Down
41 changes: 0 additions & 41 deletions pandas/tests/tslibs/test_normalize_date.py

This file was deleted.