Skip to content

Commit 9c6ca1f

Browse files
committed
Merge branch '6.x' into feat/vector-from-native-optimization
2 parents 29d788b + 134be3e commit 9c6ca1f

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
148148
- `ColourFormatter`
149149
- `TaskIdFilter`
150150
- all other indirectly exposed items from imports (e.g. `asyncio` as `neo4j.debug.asyncio`)
151-
- Deprecate ClockTime and its accessors
151+
- Deprecate `ClockTime` and its accessors
152152
- For each `neo4j.time.Date`, `neo4j.time.DateTime`, `neo4j.time.Time`
153153
- `from_clock_time` and `to_clock_time` methods
154154
- `neo4j.time.ClockTime` itself

docs/source/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Bolt protocol versions supported:
1111
1212
* Bolt 6.0
1313
* Bolt 5.0 - 5.8
14-
* Bolt 4.4
1514

1615
See https://7687.org/bolt-compatibility/ for what Neo4j DBMS versions support which Bolt versions.
1716
See https://neo4j.com/developer/kb/neo4j-supported-versions/ for a driver-server compatibility matrix.

src/neo4j/vector.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
]
5454

5555

56+
_DEFAULT = object()
57+
58+
5659
class Vector:
5760
r"""
5861
A class representing a Neo4j vector.
@@ -754,8 +757,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
754757
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
755758
data = tuple(data)
756759
non_float_gen = (item for item in data if not isinstance(item, float))
757-
non_float = next(non_float_gen, None)
758-
if non_float:
760+
non_float = next(non_float_gen, _DEFAULT)
761+
if non_float is not _DEFAULT:
759762
raise TypeError(
760763
f"Cannot build f64 vector from {type(non_float).__name__}, "
761764
"expected float."
@@ -828,8 +831,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
828831
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
829832
data = tuple(data)
830833
non_float_gen = (item for item in data if not isinstance(item, float))
831-
non_float = next(non_float_gen, None)
832-
if non_float:
834+
non_float = next(non_float_gen, _DEFAULT)
835+
if non_float is not _DEFAULT:
833836
raise TypeError(
834837
f"Cannot build f32 vector from {type(non_float).__name__}, "
835838
"expected float."
@@ -906,8 +909,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
906909
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
907910
data = tuple(data)
908911
non_int_gen = (item for item in data if not isinstance(item, int))
909-
non_int = next(non_int_gen, None)
910-
if non_int:
912+
non_int = next(non_int_gen, _DEFAULT)
913+
if non_int is not _DEFAULT:
911914
raise TypeError(
912915
f"Cannot build i64 vector from {type(non_int).__name__}, "
913916
"expected int."
@@ -998,8 +1001,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
9981001
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
9991002
data = tuple(data)
10001003
non_int_gen = (item for item in data if not isinstance(item, int))
1001-
non_int = next(non_int_gen, None)
1002-
if non_int:
1004+
non_int = next(non_int_gen, _DEFAULT)
1005+
if non_int is not _DEFAULT:
10031006
raise TypeError(
10041007
f"Cannot build i32 vector from {type(non_int).__name__}, "
10051008
"expected int."
@@ -1090,8 +1093,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
10901093
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
10911094
data = tuple(data)
10921095
non_int_gen = (item for item in data if not isinstance(item, int))
1093-
non_int = next(non_int_gen, None)
1094-
if non_int:
1096+
non_int = next(non_int_gen, _DEFAULT)
1097+
if non_int is not _DEFAULT:
10951098
raise TypeError(
10961099
f"Cannot build i16 vector from {type(non_int).__name__}, "
10971100
"expected int."
@@ -1182,8 +1185,8 @@ def _from_native_rust(cls, data: _t.Iterable[object], /) -> _t.Self:
11821185
def _from_native_np(cls, data: _t.Iterable[object], /) -> _t.Self:
11831186
data = tuple(data)
11841187
non_int_gen = (item for item in data if not isinstance(item, int))
1185-
non_int = next(non_int_gen, None)
1186-
if non_int:
1188+
non_int = next(non_int_gen, _DEFAULT)
1189+
if non_int is not _DEFAULT:
11871190
raise TypeError(
11881191
f"Cannot build i8 vector from {type(non_int).__name__}, "
11891192
"expected int."

0 commit comments

Comments
 (0)