Skip to content

Commit 431907a

Browse files
committed
Pass flake8
1 parent 0e2b952 commit 431907a

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/diffupy/kernels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
def commute_time_kernel(graph: nx.Graph, normalized: bool = False) -> Matrix:
2929
"""Compute the commute-time kernel, which is the expected time of going back and forth between a couple of nodes.
30+
3031
If the network is connected, then the commuted time kernel will be totally dense, therefore reflecting global
3132
properties of the network. For further details, see [Yen, 2007]. This kernel can be computed using both the
3233
unnormalised and normalised graph Laplacian.
@@ -44,7 +45,7 @@ def commute_time_kernel(graph: nx.Graph, normalized: bool = False) -> Matrix:
4445

4546

4647
def diffusion_kernel(graph: nx.Graph, sigma2: float = 1, normalized: bool = True) -> Matrix:
47-
"""Computes the classical diffusion kernel that involves matrix exponentiation.
48+
"""Compute the classical diffusion kernel that involves matrix exponentiation.
4849
4950
It has a "bandwidth" parameter sigma^2 that controls the extent of the spreading.
5051
Quoting [Smola, 2003]:

src/diffupy/matrix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __str__(self):
7373
return f"\nmatrix {self.name} \n {s} \n "
7474

7575
def __iter__(self, **kargs):
76-
"""Helper method for the matrix class."""
76+
"""Help method for the matrix class."""
7777
self.i = -1
7878
self.j = 0
7979

@@ -85,7 +85,7 @@ def __iter__(self, **kargs):
8585
return self
8686

8787
def __next__(self):
88-
"""Helper method for the matrix class."""
88+
"""Help method for the matrix class."""
8989
if self.i >= len(self.rows_labels) - 1 and self.j >= len(self.cols_labels) - 1:
9090
self.get_labels = True
9191
self.get_indices = False
@@ -443,6 +443,7 @@ class LaplacianMatrix(Matrix):
443443
"""Laplacian matrix class"""
444444

445445
def __init__(self, graph, normalized=False, name=''):
446+
"""Initialize object."""
446447
l_mat = get_laplacian(graph, normalized)
447448

448449
Matrix.__init__(self, mat=l_mat, quadratic=True, name=name, graph=graph)

src/diffupy/validate_input.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
def _validate_method(method: str) -> None:
1717
"""Ensures that 'method' is a valid character."""
18-
1918
if not isinstance(method, str):
2019
raise ValueError(f"The supplied 'method' must be a string. The given argument is a {type(method)}")
2120

@@ -28,7 +27,6 @@ def _validate_method(method: str) -> None:
2827

2928
def _validate_scores(scores: Matrix) -> None:
3029
"""Check scores sanity: Ensures that scores are suitable for diffusion."""
31-
3230
# Check labels list
3331
if not scores.cols_labels:
3432
raise ValueError("Scores must be a named list but supplied list contains no names.")
@@ -76,7 +74,6 @@ def _validate_scores(scores: Matrix) -> None:
7674

7775
def _validate_graph(graph: nx.Graph) -> None:
7876
"""Check graph sanity: Ensures that 'graph' is a valid NetworkX Graph object."""
79-
8077
if graph in [None, 'NA', 'Nan']:
8178
raise ValueError("'graph' missing")
8279

0 commit comments

Comments
 (0)