Skip to content

Commit 53022c7

Browse files
committed
Apply 5.0 deprecation and renaming to neo4j.time module.
This makes the module more robust as it models sub-second precision with ints instead of floats. This finishes off the work started in PR neo4j#551. Breaking changes: - `Duration` - The constructor does not accept `subseconds` anymore. Use `milliseconds`, `microseconds`, or `nanoseconds` instead. - The property `subseconds` has been removed. Use `nanoseconds` instead. - The property `hours_minutes_seconds` has been removed. Use `hours_minutes_seconds_nanoseconds` instead. - For all math operations holds: they are element-wise on (`months`, `days`, `nanoseconds`). This affects (i.e., changes) the working of `//`, `%`, `/`, and `*`. - Years are equal to 12 months. - Weeks are equal to 7 days. - `seconds`, `milliseconds`, `microseconds`, and `nanoseconds` are implicitly converted to `nanoseconds` or `seconds` as fit. - Multiplication and division allow for floats but will always result in integer values (round to nearest even). - `Time` - The constructor does not accept `float`s for `second` anymore. Use `nanosecond` instead. - Ticks are now nanoseconds since midnight (`int`). - The property `ticks_ns` has been renamed to `ticks`. The old `ticks` is no longer supported. - The property`from_ticks_ns` has been renamed to `from_ticks`. The old `from_ticks` is no longer supported. - The property `second` returns an `int` instead of a `float`. Use `nanosecond` to get the sub-second information. - The property `hour_minute_second` has been removed. Use `hour_minute_second_nanosecond` instead. - `DateTime` - The property `hour_minute_second` has been removed. Use `hour_minute_second_nanosecond` instead. - The property `second` returns an `int` instead of a `float`. Use `nanosecond` to get the sub-second information.
1 parent 0f53077 commit 53022c7

File tree

9 files changed

+354
-395
lines changed

9 files changed

+354
-395
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,40 @@
88
`neo4j.work`. They should've been imported from `neo4j` all along.
99
- Experimental pipelines feature has been removed.
1010
- Experimental async driver has been added.
11+
- `neo4j.time` module:
12+
- `Duration`
13+
- The constructor does not accept `subseconds` anymore.
14+
Use `milliseconds`, `microseconds`, or `nanoseconds` instead.
15+
- The property `subseconds` has been removed.
16+
Use `nanoseconds` instead.
17+
- The property `hours_minutes_seconds` has been removed.
18+
Use `hours_minutes_seconds_nanoseconds` instead.
19+
- For all math operations holds: they are element-wise on
20+
(`months`, `days`, `nanoseconds`).
21+
This affects (i.e., changes) the working of `//`, `%`, `/`, and `*`.
22+
- Years are equal to 12 months.
23+
- Weeks are equal to 7 days.
24+
- `seconds`, `milliseconds`, `microseconds`, and `nanoseconds` are
25+
implicitly converted to `nanoseconds` or `seconds` as fit.
26+
- Multiplication and division allow for floats but will always result in
27+
integer values (round to nearest even).
28+
- `Time`
29+
- The constructor does not accept `float`s for `second` anymore.
30+
Use `nanosecond` instead.
31+
- Ticks are now nanoseconds since midnight (`int`).
32+
- The property `ticks_ns` has been renamed to `ticks`.
33+
The old `ticks` is no longer supported.
34+
- The property`from_ticks_ns` has been renamed to `from_ticks`.
35+
The old `from_ticks` is no longer supported.
36+
- The property `second` returns an `int` instead of a `float`.
37+
Use `nanosecond` to get the sub-second information.
38+
- The property `hour_minute_second` has been removed.
39+
Use `hour_minute_second_nanosecond` instead.
40+
- `DateTime`
41+
- The property `hour_minute_second` has been removed.
42+
Use `hour_minute_second_nanosecond` instead.
43+
- The property `second` returns an `int` instead of a `float`.
44+
Use `nanosecond` to get the sub-second information.
1145

1246
## Version 4.4
1347

docs/source/temporal_types.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ Class methods
142142

143143
.. automethod:: neo4j.time.Time.from_ticks
144144

145-
.. automethod:: neo4j.time.Time.from_ticks_ns
146-
147145
.. automethod:: neo4j.time.Time.from_native
148146

149147
.. automethod:: neo4j.time.Time.from_clock_time
@@ -164,15 +162,13 @@ Instance attributes
164162

165163
.. autoattribute:: neo4j.time.Time.ticks
166164

167-
.. autoattribute:: neo4j.time.Time.ticks_ns
168-
169165
.. autoattribute:: neo4j.time.Time.hour
170166

171167
.. autoattribute:: neo4j.time.Time.minute
172168

173169
.. autoattribute:: neo4j.time.Time.second
174170

175-
.. autoattribute:: neo4j.time.Time.hour_minute_second
171+
.. autoattribute:: neo4j.time.Time.nanosecond
176172

177173
.. autoattribute:: neo4j.time.Time.hour_minute_second_nanosecond
178174

@@ -290,8 +286,6 @@ Instance attributes
290286

291287
.. autoattribute:: neo4j.time.DateTime.tzinfo
292288

293-
.. autoattribute:: neo4j.time.DateTime.hour_minute_second
294-
295289
.. autoattribute:: neo4j.time.DateTime.hour_minute_second_nanosecond
296290

297291

@@ -388,14 +382,10 @@ Instance attributes
388382

389383
.. autoattribute:: neo4j.time.Duration.seconds
390384

391-
.. autoattribute:: neo4j.time.Duration.subseconds
392-
393385
.. autoattribute:: neo4j.time.Duration.nanoseconds
394386

395387
.. autoattribute:: neo4j.time.Duration.years_months_days
396388

397-
.. autoattribute:: neo4j.time.Duration.hours_minutes_seconds
398-
399389
.. autoattribute:: neo4j.time.Duration.hours_minutes_seconds_nanoseconds
400390

401391

@@ -410,6 +400,14 @@ Operations
410400

411401
.. automethod:: neo4j.time.Duration.__mul__
412402

403+
.. automethod:: neo4j.time.Duration.__truediv__
404+
405+
.. automethod:: neo4j.time.Duration.__floordiv__
406+
407+
.. automethod:: neo4j.time.Duration.__mod__
408+
409+
.. automethod:: neo4j.time.Duration.__divmod__
410+
413411
.. automethod:: neo4j.time.Duration.__pos__
414412

415413
.. automethod:: neo4j.time.Duration.__neg__

0 commit comments

Comments
 (0)