Skip to content

Commit 96b1ea6

Browse files
committed
Fix inlined default values + add exceptions
1 parent 4559126 commit 96b1ea6

File tree

7 files changed

+54
-34
lines changed

7 files changed

+54
-34
lines changed

graphdatascience/procedure_surface/api/community/sllpa_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def mutate(
2424
log_progress: bool = True,
2525
min_association_strength: float = 0.2,
2626
node_labels: list[str] = ALL_LABELS,
27-
partitioning: Any | None = None,
27+
partitioning: str = "RANGE",
2828
relationship_types: list[str] = ALL_TYPES,
2929
sudo: bool = False,
3030
username: str | None = None,
@@ -77,7 +77,7 @@ def stats(
7777
log_progress: bool = True,
7878
min_association_strength: float = 0.2,
7979
node_labels: list[str] = ALL_LABELS,
80-
partitioning: Any | None = None,
80+
partitioning: str = "RANGE",
8181
relationship_types: list[str] = ALL_TYPES,
8282
sudo: bool = False,
8383
username: str | None = None,
@@ -126,7 +126,7 @@ def stream(
126126
log_progress: bool = True,
127127
min_association_strength: float = 0.2,
128128
node_labels: list[str] = ALL_LABELS,
129-
partitioning: Any | None = None,
129+
partitioning: str = "RANGE",
130130
relationship_types: list[str] = ALL_TYPES,
131131
sudo: bool = False,
132132
username: str | None = None,
@@ -176,7 +176,7 @@ def write(
176176
log_progress: bool = True,
177177
min_association_strength: float = 0.2,
178178
node_labels: list[str] = ALL_LABELS,
179-
partitioning: Any | None = None,
179+
partitioning: str = "RANGE",
180180
relationship_types: list[str] = ALL_TYPES,
181181
sudo: bool = False,
182182
username: str | None = None,
@@ -228,7 +228,7 @@ def estimate(
228228
concurrency: int | None = None,
229229
min_association_strength: float = 0.2,
230230
node_labels: list[str] = ALL_LABELS,
231-
partitioning: Any | None = None,
231+
partitioning: str = "RANGE",
232232
relationship_types: list[str] = ALL_TYPES,
233233
) -> EstimationResult:
234234
"""

graphdatascience/procedure_surface/api/similarity/knn_filtered_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def mutate(
2525
node_properties: str | list[str] | dict[str, str],
2626
source_node_filter: str,
2727
target_node_filter: str,
28-
seed_target_nodes: bool | None = None,
28+
seed_target_nodes: bool = False,
2929
top_k: int = 10,
3030
similarity_cutoff: float = 0.0,
3131
delta_threshold: float = 0.001,
@@ -111,7 +111,7 @@ def stats(
111111
node_properties: str | list[str] | dict[str, str],
112112
source_node_filter: str,
113113
target_node_filter: str,
114-
seed_target_nodes: bool | None = None,
114+
seed_target_nodes: bool = False,
115115
top_k: int = 10,
116116
similarity_cutoff: float = 0.0,
117117
delta_threshold: float = 0.001,
@@ -193,7 +193,7 @@ def stream(
193193
node_properties: str | list[str] | dict[str, str],
194194
source_node_filter: str,
195195
target_node_filter: str,
196-
seed_target_nodes: bool | None = None,
196+
seed_target_nodes: bool = False,
197197
top_k: int = 10,
198198
similarity_cutoff: float = 0.0,
199199
delta_threshold: float = 0.001,
@@ -277,7 +277,7 @@ def write(
277277
node_properties: str | list[str] | dict[str, str],
278278
source_node_filter: str,
279279
target_node_filter: str,
280-
seed_target_nodes: bool | None = None,
280+
seed_target_nodes: bool = False,
281281
top_k: int = 10,
282282
similarity_cutoff: float = 0.0,
283283
delta_threshold: float = 0.001,
@@ -366,7 +366,7 @@ def estimate(
366366
node_properties: str | list[str] | dict[str, str],
367367
source_node_filter: str,
368368
target_node_filter: str,
369-
seed_target_nodes: bool | None = None,
369+
seed_target_nodes: bool = False,
370370
top_k: int = 10,
371371
similarity_cutoff: float = 0.0,
372372
delta_threshold: float = 0.001,

graphdatascience/procedure_surface/arrow/community/sllpa_arrow_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def mutate(
3838
log_progress: bool = True,
3939
min_association_strength: float = 0.2,
4040
node_labels: list[str] = ALL_LABELS,
41-
partitioning: Any | None = None,
41+
partitioning: str = "RANGE",
4242
relationship_types: list[str] = ALL_TYPES,
4343
sudo: bool = False,
4444
username: str | None = None,
@@ -71,7 +71,7 @@ def stats(
7171
log_progress: bool = True,
7272
min_association_strength: float = 0.2,
7373
node_labels: list[str] = ALL_LABELS,
74-
partitioning: Any | None = None,
74+
partitioning: str = "RANGE",
7575
relationship_types: list[str] = ALL_TYPES,
7676
sudo: bool = False,
7777
username: str | None = None,
@@ -104,7 +104,7 @@ def stream(
104104
log_progress: bool = True,
105105
min_association_strength: float = 0.2,
106106
node_labels: list[str] = ALL_LABELS,
107-
partitioning: Any | None = None,
107+
partitioning: str = "RANGE",
108108
relationship_types: list[str] = ALL_TYPES,
109109
sudo: bool = False,
110110
username: str | None = None,
@@ -136,7 +136,7 @@ def write(
136136
log_progress: bool = True,
137137
min_association_strength: float = 0.2,
138138
node_labels: list[str] = ALL_LABELS,
139-
partitioning: Any | None = None,
139+
partitioning: str = "RANGE",
140140
relationship_types: list[str] = ALL_TYPES,
141141
sudo: bool = False,
142142
username: str | None = None,
@@ -175,7 +175,7 @@ def estimate(
175175
concurrency: int | None = None,
176176
min_association_strength: float = 0.2,
177177
node_labels: list[str] = ALL_LABELS,
178-
partitioning: Any | None = None,
178+
partitioning: str = "RANGE",
179179
relationship_types: list[str] = ALL_TYPES,
180180
) -> EstimationResult:
181181
config = self._node_property_endpoints.create_estimate_config(

graphdatascience/procedure_surface/arrow/similarity/knn_filtered_arrow_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def mutate(
3636
node_properties: str | list[str] | dict[str, str],
3737
source_node_filter: str,
3838
target_node_filter: str,
39-
seed_target_nodes: bool | None = None,
39+
seed_target_nodes: bool = False,
4040
top_k: int = 10,
4141
similarity_cutoff: float = 0.0,
4242
delta_threshold: float = 0.001,
@@ -90,7 +90,7 @@ def stats(
9090
node_properties: str | list[str] | dict[str, str],
9191
source_node_filter: str,
9292
target_node_filter: str,
93-
seed_target_nodes: bool | None = None,
93+
seed_target_nodes: bool = False,
9494
top_k: int = 10,
9595
similarity_cutoff: float = 0.0,
9696
delta_threshold: float = 0.001,
@@ -142,7 +142,7 @@ def stream(
142142
node_properties: str | list[str] | dict[str, str],
143143
source_node_filter: str,
144144
target_node_filter: str,
145-
seed_target_nodes: bool | None = None,
145+
seed_target_nodes: bool = False,
146146
top_k: int = 10,
147147
similarity_cutoff: float = 0.0,
148148
delta_threshold: float = 0.001,
@@ -197,7 +197,7 @@ def write(
197197
node_properties: str | list[str] | dict[str, str],
198198
source_node_filter: str,
199199
target_node_filter: str,
200-
seed_target_nodes: bool | None = None,
200+
seed_target_nodes: bool = False,
201201
top_k: int = 10,
202202
similarity_cutoff: float = 0.0,
203203
delta_threshold: float = 0.001,
@@ -259,7 +259,7 @@ def estimate(
259259
node_properties: str | list[str] | dict[str, str],
260260
source_node_filter: str,
261261
target_node_filter: str,
262-
seed_target_nodes: bool | None = None,
262+
seed_target_nodes: bool = False,
263263
top_k: int = 10,
264264
similarity_cutoff: float = 0.0,
265265
delta_threshold: float = 0.001,

graphdatascience/procedure_surface/cypher/community/sllpa_cypher_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def mutate(
3636
log_progress: bool = True,
3737
min_association_strength: float = 0.2,
3838
node_labels: list[str] = ALL_LABELS,
39-
partitioning: Any | None = None,
39+
partitioning: str = "RANGE",
4040
relationship_types: list[str] = ALL_TYPES,
4141
sudo: bool = False,
4242
username: str | None = None,
@@ -75,7 +75,7 @@ def stats(
7575
log_progress: bool = True,
7676
min_association_strength: float = 0.2,
7777
node_labels: list[str] = ALL_LABELS,
78-
partitioning: Any | None = None,
78+
partitioning: str = "RANGE",
7979
relationship_types: list[str] = ALL_TYPES,
8080
sudo: bool = False,
8181
username: str | None = None,
@@ -113,7 +113,7 @@ def stream(
113113
log_progress: bool = True,
114114
min_association_strength: float = 0.2,
115115
node_labels: list[str] = ALL_LABELS,
116-
partitioning: Any | None = None,
116+
partitioning: str = "RANGE",
117117
relationship_types: list[str] = ALL_TYPES,
118118
sudo: bool = False,
119119
username: str | None = None,
@@ -152,7 +152,7 @@ def write(
152152
log_progress: bool = True,
153153
min_association_strength: float = 0.2,
154154
node_labels: list[str] = ALL_LABELS,
155-
partitioning: Any | None = None,
155+
partitioning: str = "RANGE",
156156
relationship_types: list[str] = ALL_TYPES,
157157
sudo: bool = False,
158158
username: str | None = None,
@@ -191,7 +191,7 @@ def estimate(
191191
concurrency: int | None = None,
192192
min_association_strength: float = 0.2,
193193
node_labels: list[str] = ALL_LABELS,
194-
partitioning: Any | None = None,
194+
partitioning: str = "RANGE",
195195
relationship_types: list[str] = ALL_TYPES,
196196
) -> EstimationResult:
197197
from graphdatascience.procedure_surface.cypher.estimation_utils import estimate_algorithm

graphdatascience/procedure_surface/cypher/similarity/knn_filtered_cypher_endpoints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def mutate(
2929
node_properties: str | list[str] | dict[str, str],
3030
source_node_filter: str,
3131
target_node_filter: str,
32-
seed_target_nodes: bool | None = None,
32+
seed_target_nodes: bool = False,
3333
top_k: int = 10,
3434
similarity_cutoff: float = 0.0,
3535
delta_threshold: float = 0.001,
@@ -84,7 +84,7 @@ def stats(
8484
node_properties: str | list[str] | dict[str, str],
8585
source_node_filter: str,
8686
target_node_filter: str,
87-
seed_target_nodes: bool | None = None,
87+
seed_target_nodes: bool = False,
8888
top_k: int = 10,
8989
similarity_cutoff: float = 0.0,
9090
delta_threshold: float = 0.001,
@@ -139,7 +139,7 @@ def stream(
139139
node_properties: str | list[str] | dict[str, str],
140140
source_node_filter: str,
141141
target_node_filter: str,
142-
seed_target_nodes: bool | None = None,
142+
seed_target_nodes: bool = False,
143143
top_k: int = 10,
144144
similarity_cutoff: float = 0.0,
145145
delta_threshold: float = 0.001,
@@ -192,7 +192,7 @@ def write(
192192
node_properties: str | list[str] | dict[str, str],
193193
source_node_filter: str,
194194
target_node_filter: str,
195-
seed_target_nodes: bool | None = None,
195+
seed_target_nodes: bool = False,
196196
top_k: int = 10,
197197
similarity_cutoff: float = 0.0,
198198
delta_threshold: float = 0.001,
@@ -251,7 +251,7 @@ def estimate(
251251
node_properties: str | list[str] | dict[str, str],
252252
source_node_filter: str,
253253
target_node_filter: str,
254-
seed_target_nodes: bool | None = None,
254+
seed_target_nodes: bool = False,
255255
top_k: int = 10,
256256
similarity_cutoff: float = 0.0,
257257
delta_threshold: float = 0.001,

graphdatascience/tests/integrationV2/procedure_surface/session/test_session_api_spec_coverage.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,24 @@
103103
}
104104

105105
ADJUSTED_PARAM_DEFAULT_VALUES = {
106-
"concurrency": None, # default value differs for Aura Graph Analytics compared to plugin (spec is off)
107-
"job_id": None, # default value in spec is `random id`
108-
"write_concurrency": None, # default value is an internal "value of concurrency"
106+
".*": {
107+
"concurrency": None, # default value differs for Aura Graph Analytics compared to plugin (spec is off)
108+
"job_id": None, # default value in spec is `random id`
109+
"write_concurrency": None, # default value is an internal "value of concurrency"
110+
},
111+
".*(knn|node_similarity).filtered.*": {
112+
"source_node_filter": None,
113+
"target_node_filter": None,
114+
},
115+
".*sllpa.mutate": {
116+
"mutate_property": None,
117+
},
118+
".*sllpa.(write)": {
119+
"write_property": None,
120+
},
121+
".*triangle_count.*": {
122+
"max_degree": None,
123+
},
109124
}
110125

111126

@@ -233,8 +248,13 @@ def verify_configuration_fields(callable_object: MethodType, endpoint_spec: Endp
233248
)
234249

235250
# validate default values match
251+
default_adjustments: dict[str, str] = {}
252+
for endpoint_pattern, adjustments in ADJUSTED_PARAM_DEFAULT_VALUES.items():
253+
if re.match(endpoint_pattern, py_endpoint):
254+
default_adjustments.update(adjustments)
255+
236256
for name, expected_param in expected_configuration.items():
237-
expected_default = ADJUSTED_PARAM_DEFAULT_VALUES.get(name, expected_param.defaultValue)
257+
expected_default = default_adjustments.get(name, expected_param.defaultValue)
238258
if expected_default == []:
239259
expected_default = None # empty list defaults to None in the python api
240260

0 commit comments

Comments
 (0)