Skip to content

Commit 2cef835

Browse files
committed
tidy
1 parent dc11104 commit 2cef835

File tree

6 files changed

+41
-21
lines changed

6 files changed

+41
-21
lines changed

python/python/raphtory/__init__.pyi

+10
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,15 @@ class Edge(object):
444444
445445
"""
446446

447+
def history_counts(self) -> int:
448+
"""
449+
Returns the number of times an edge is added or change to an edge is made.
450+
451+
Returns:
452+
int: The number of times an edge is added or change to an edge is made.
453+
454+
"""
455+
447456
def history_date_time(self):
448457
"""
449458
Returns a list of timestamps of when an edge is added or change to an edge is made.
@@ -895,6 +904,7 @@ class Edges(object):
895904
896905
"""
897906

907+
def history_counts(self): ...
898908
def history_date_time(self):
899909
"""
900910
Returns all timestamps of edges, when an edge is added or change to an edge is made.

python/tests/graphql/update_graph/test_batch_updates.py

+21-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
RemoteEdgeAddition,
1414
)
1515

16+
1617
def make_props():
1718
current_datetime = datetime.now(timezone.utc)
1819
naive_datetime = datetime.now()
@@ -116,12 +117,15 @@ def test_add_nodes():
116117
ben = g.node("ben")
117118
hamza = g.node("hamza")
118119
lucas = g.node("lucas")
119-
check_arr(ben.properties.temporal.get("prop_float").values(), [
120-
2.0,
121-
3.0,
122-
2.0,
123-
3.0,
124-
])
120+
check_arr(
121+
ben.properties.temporal.get("prop_float").values(),
122+
[
123+
2.0,
124+
3.0,
125+
2.0,
126+
3.0,
127+
],
128+
)
125129
check_arr(ben.history(), [1, 2, 3, 4, 5, 6])
126130
assert ben.node_type == "person"
127131
check_arr(hamza.history(), [1, 2])
@@ -176,14 +180,17 @@ def test_add_edges():
176180
ben_hammza = g.edge("ben", "hamza")
177181
hamza_lucas = g.edge("hamza", "lucas")
178182
lucas_hamza = g.edge("lucas", "hamza")
179-
check_arr( ben_hammza.properties.temporal.get("prop_float").values() , [
180-
2.0,
181-
3.0,
182-
2.0,
183-
3.0,
184-
])
185-
check_arr( ben_hammza.history() , [1, 2, 3, 4, 5, 6])
183+
check_arr(
184+
ben_hammza.properties.temporal.get("prop_float").values(),
185+
[
186+
2.0,
187+
3.0,
188+
2.0,
189+
3.0,
190+
],
191+
)
192+
check_arr(ben_hammza.history(), [1, 2, 3, 4, 5, 6])
186193
assert ben_hammza.layer_names == ["_default", "test"]
187-
check_arr( hamza_lucas.history() , [1, 2])
194+
check_arr(hamza_lucas.history(), [1, 2])
188195
assert hamza_lucas.layer_names == ["_default"]
189196
helper_test_props(lucas_hamza.layer("_default"), lucas_props)

python/tests/graphql/update_graph/test_edge_updates.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from raphtory.graphql import GraphServer, RaphtoryClient
66
from numpy.testing import assert_equal as check_arr
77

8+
89
def make_props():
910
current_datetime = datetime.now(timezone.utc)
1011
naive_datetime = datetime.now()
@@ -76,9 +77,9 @@ def test_add_updates():
7677
g = client.receive_graph("path/to/event_graph")
7778
e = g.edge("ben", "hamza")
7879
helper_test_props(e, props)
79-
check_arr( e.properties.temporal.get("prop_float").history() , [2, 3])
80-
check_arr( e.layer("test").properties.temporal.get("prop_float").history() , [2])
81-
check_arr( e.history() , [1, 2, 3, 4, 5, 6])
80+
check_arr(e.properties.temporal.get("prop_float").history(), [2, 3])
81+
check_arr(e.layer("test").properties.temporal.get("prop_float").history(), [2])
82+
check_arr(e.history(), [1, 2, 3, 4, 5, 6])
8283

8384

8485
def test_add_constant_properties():

python/tests/graphql/update_graph/test_node_updates.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_add_updates():
6969
rg.node("ben").add_updates(4)
7070
g = client.receive_graph("path/to/event_graph")
7171
helper_test_props(g.node("ben"), props)
72-
check_arr( g.node("ben").history() , [1, 2, 3, 4])
72+
check_arr(g.node("ben").history(), [1, 2, 3, 4])
7373

7474

7575
def test_add_constant_properties():

python/tests/test_graphdb/test_latest_graph.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_persistent_node_latest():
157157
wg = g.window(5, 12)
158158
assert wg.latest_time == 11
159159
assert wg.earliest_time == 5
160-
check_arr( wg.node(1).latest().history() , [])
160+
check_arr(wg.node(1).latest().history(), [])
161161

162-
check_arr( g.nodes.latest().id.collect() , [1, 2, 3])
163-
check_arr( wg.nodes.latest().id.collect() , [1, 2])
162+
check_arr(g.nodes.latest().id.collect(), [1, 2, 3])
163+
check_arr(wg.nodes.latest().id.collect(), [1, 2])

raphtory/src/io/parquet_loaders.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use crate::{
1212
serialise::incremental::InternalCache,
1313
};
1414
use itertools::Itertools;
15+
#[cfg(feature = "storage")]
16+
use polars_arrow::array::StructArray;
1517
use polars_arrow::datatypes::{ArrowDataType as DataType, ArrowSchema, Field};
1618
use polars_parquet::{
1719
read,

0 commit comments

Comments
 (0)