Skip to content

Commit c51b3c9

Browse files
authored
Merge pull request #168 from MattScicluna/add_pytests
Add pytests. Corrected the version of graphtools.
2 parents d5de920 + 877ee60 commit c51b3c9

File tree

8 files changed

+3190
-8
lines changed

8 files changed

+3190
-8
lines changed

Python/phate/phate.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535

3636

3737
# Check graphtools version
38-
def _graphtools_version_is_at_least_2_0():
39-
"""Check if installed graphtools version is >= 2.0.0.
38+
def _graphtools_version_is_at_least_2_1():
39+
"""Check if installed graphtools version is >= 2.1.0.
4040
4141
Version 2.0.0+ includes support for:
4242
- random_landmarking parameter
4343
- is_connected property and connectivity checks
4444
"""
4545
try:
46-
return version.parse(graphtools.__version__) >= version.parse("2.0.0")
46+
return version.parse(graphtools.__version__) >= version.parse("2.1.0")
4747
except AttributeError:
4848
# graphtools doesn't have __version__, assume old version
4949
return False
@@ -237,7 +237,7 @@ def __init__(
237237
# Disable random_landmarking since it has no effect
238238
random_landmarking = False
239239
# Check graphtools version if random_landmarking is still requested
240-
elif random_landmarking and not _graphtools_version_is_at_least_2_0():
240+
elif random_landmarking and not _graphtools_version_is_at_least_2_1():
241241
warnings.warn(
242242
"random_landmarking is not available in graphtools version < 2.0.0. "
243243
"Please update graphtools to use this feature: "
@@ -833,7 +833,7 @@ def _update_graph(self, X, precomputed, n_pca, n_landmark, random_landmarking):
833833
}
834834

835835
# Only add random_landmarking if graphtools supports it
836-
if _graphtools_version_is_at_least_2_0():
836+
if _graphtools_version_is_at_least_2_1():
837837
graph_params["random_landmarking"] = random_landmarking
838838

839839
self.graph.set_params(**graph_params)
@@ -905,7 +905,7 @@ def fit(self, X):
905905
}
906906

907907
# Only add random_landmarking if graphtools supports it
908-
if _graphtools_version_is_at_least_2_0():
908+
if _graphtools_version_is_at_least_2_1():
909909
graph_params["random_landmarking"] = self.random_landmarking
910910

911911
# Merge with any additional kwargs
@@ -914,7 +914,7 @@ def fit(self, X):
914914
self.graph = graphtools.Graph(X, **graph_params)
915915

916916
# Check for graph connectivity (requires graphtools >= 2.0.0)
917-
if _graphtools_version_is_at_least_2_0():
917+
if _graphtools_version_is_at_least_2_1():
918918
if not self.graph.is_connected:
919919
warnings.warn(
920920
f"Graph is disconnected with {self.graph.n_connected_components} "

Python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies = [
1818
"scikit-learn>=1.5.0",
1919
"future",
2020
"tasklogger>=1.2",
21-
"graphtools>=2.0.0",
21+
"graphtools>=2.1.0",
2222
"Deprecated",
2323
"matplotlib>=3.0",
2424
]

0 commit comments

Comments
 (0)