Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
- Remove `ExperimentalWarning` and turn the few left instances of it into `PreviewWarning`.
- Deprecate importing `PreviewWarning` from `neo4j`.
Import it from `neo4j.warnings` instead.
- Make undocumented internal constants private:
- Make undocumented internal constants, helper functions, and other items private:
- `neo4j.api`
- `DRIVER_BOLT`
- `DRIVER_NEO4J`
Expand All @@ -86,6 +86,27 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
- `ERROR_REWRITE_MAP`
- `client_errors`
- `transient_errors`
- `neo4j.time`
- `DATE_ISO_PATTERN`
- `TIME_ISO_PATTERN`
- `DURATION_ISO_PATTERN`
- `NANO_SECONDS`
- `AVERAGE_SECONDS_IN_MONTH`
- `AVERAGE_SECONDS_IN_DAY`
- `FORMAT_F_REPLACE`
- `IS_LEAP_YEAR`
- `DAYS_IN_YEAR`
- `DAYS_IN_MONTH`
- `round_half_to_even`
- `symmetric_divmod`
- `DateTimeType`
- `DateType`
- `TimeType`
- all other indirectly exposed items from imports (e.g. `re` as `neo4j.time.re`)
- Deprecate ClockTime and its accessors
- For each `neo4j.time.Date`, `neo4j.time.DateTime`, `neo4j.time.Time`
- `from_clock_time` and `to_clock_time` methods
- `neo4j.time.ClockTime` itself
- Raise `ConfigurationError` instead of ignoring the routing context (URI query parameters) when creating a direct
driver ("bolt[+s[sc]]://" scheme).
- Change behavior of closed drivers:
Expand Down
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@
autodoc_typehints = "description"

autodoc_type_aliases = {
# The code-base uses `import typing_extensions as te`.
# The code-base uses `import typing_extensions as te` / `as _te`.
# Re-write these to use `typing` instead, as Sphinx always resolves against
# the latest version of the `typing` module.
# This is a work-around to make Sphinx resolve type hints correctly, even
# though we're using `from __future__ import annotations`.
"te": typing,
"_te": typing,
# Type alias that's only defined and imported if `typing.TYPE_CHECKING`
# is `True`.
"_TAuth": "typing.Tuple[typing.Any, typing.Any] | Auth | None",
Expand Down
9 changes: 5 additions & 4 deletions src/neo4j/_codec/hydration/v1/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
pd,
)
from ....time import (
_NANO_SECONDS,
Date,
DateTime,
Duration,
MAX_YEAR,
MIN_YEAR,
NANO_SECONDS,
Time,
)
from ...packstream import Structure
Expand Down Expand Up @@ -170,8 +170,8 @@ def seconds_and_nanoseconds(dt):
if isinstance(dt, datetime):
dt = DateTime.from_native(dt)
zone_epoch = DateTime(1970, 1, 1, tzinfo=dt.tzinfo)
dt_clock_time = dt.to_clock_time()
zone_epoch_clock_time = zone_epoch.to_clock_time()
dt_clock_time = dt._to_clock_time()
zone_epoch_clock_time = zone_epoch._to_clock_time()
t = dt_clock_time - zone_epoch_clock_time
return t.seconds, t.nanoseconds

Expand Down Expand Up @@ -226,7 +226,8 @@ def dehydrate_np_datetime(value):
)
seconds = value.astype(np.dtype("datetime64[s]")).astype(int)
nanoseconds = (
value.astype(np.dtype("datetime64[ns]")).astype(int) % NANO_SECONDS
value.astype(np.dtype("datetime64[ns]")).astype(int)
% _NANO_SECONDS
)
return Structure(b"d", seconds, nanoseconds)

Expand Down
8 changes: 4 additions & 4 deletions src/neo4j/_codec/hydration/v2/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from ...._optional_deps import pd
from ....time import (
_NANO_SECONDS,
Date,
DateTime,
NANO_SECONDS,
Time,
)
from ...packstream import Structure
Expand Down Expand Up @@ -74,8 +74,8 @@ def seconds_and_nanoseconds(dt):
dt = DateTime.from_native(dt)
dt = dt.astimezone(pytz.UTC)
utc_epoch = DateTime(1970, 1, 1, tzinfo=pytz.UTC)
dt_clock_time = dt.to_clock_time()
utc_epoch_clock_time = utc_epoch.to_clock_time()
dt_clock_time = dt._to_clock_time()
utc_epoch_clock_time = utc_epoch._to_clock_time()
t = dt_clock_time - utc_epoch_clock_time
return t.seconds, t.nanoseconds

Expand Down Expand Up @@ -119,7 +119,7 @@ def dehydrate_pandas_datetime(value):
:type value: pandas.Timestamp
:returns:
"""
seconds, nanoseconds = divmod(value.value, NANO_SECONDS)
seconds, nanoseconds = divmod(value.value, _NANO_SECONDS)

tz = value.tzinfo
if tz is None:
Expand Down
Loading