From 4c0f871c4fb093eb628a1f0d607376594ad8b9de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:17:33 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.py | 1 + src/pecanpy/__init__.py | 1 + src/pecanpy/cli.py | 1 + src/pecanpy/experimental.py | 1 + src/pecanpy/graph.py | 1 + src/pecanpy/pecanpy.py | 1 + src/pecanpy/rw/__init__.py | 1 + src/pecanpy/rw/dense_rw.py | 7 ++++--- src/pecanpy/rw/sparse_rw.py | 7 ++++--- src/pecanpy/typing.py | 1 + src/pecanpy/wrappers.py | 1 + 11 files changed, 17 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 3c71798d..da0ee517 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """Setup module.""" + import setuptools if __name__ == "__main__": diff --git a/src/pecanpy/__init__.py b/src/pecanpy/__init__.py index 3b450189..65806358 100644 --- a/src/pecanpy/__init__.py +++ b/src/pecanpy/__init__.py @@ -1,4 +1,5 @@ """PecanPy: parallelized, efficient, and accelerated node2vec.""" + from . import graph from . import pecanpy diff --git a/src/pecanpy/cli.py b/src/pecanpy/cli.py index 577e59a2..6d69bd83 100755 --- a/src/pecanpy/cli.py +++ b/src/pecanpy/cli.py @@ -12,6 +12,7 @@ $ pecanpy --help """ + import argparse import warnings diff --git a/src/pecanpy/experimental.py b/src/pecanpy/experimental.py index 26c820a5..872504b1 100644 --- a/src/pecanpy/experimental.py +++ b/src/pecanpy/experimental.py @@ -1,4 +1,5 @@ """Experimental features.""" + import numpy as np from numba import njit from pecanpy.pecanpy import Base diff --git a/src/pecanpy/graph.py b/src/pecanpy/graph.py index ba905570..5b8ebe25 100644 --- a/src/pecanpy/graph.py +++ b/src/pecanpy/graph.py @@ -1,4 +1,5 @@ """Lite graph objects used by pecanpy.""" + import warnings import numpy as np diff --git a/src/pecanpy/pecanpy.py b/src/pecanpy/pecanpy.py index 923562d0..b7ed4ef6 100755 --- a/src/pecanpy/pecanpy.py +++ b/src/pecanpy/pecanpy.py @@ -1,4 +1,5 @@ """Different strategies for generating node2vec walks.""" + import numpy as np from gensim.models import Word2Vec from numba import njit diff --git a/src/pecanpy/rw/__init__.py b/src/pecanpy/rw/__init__.py index a521a465..dafc0ad2 100644 --- a/src/pecanpy/rw/__init__.py +++ b/src/pecanpy/rw/__init__.py @@ -1,4 +1,5 @@ """Graph objects equipped with random walk transition functions.""" + from .dense_rw import DenseRWGraph from .sparse_rw import SparseRWGraph diff --git a/src/pecanpy/rw/dense_rw.py b/src/pecanpy/rw/dense_rw.py index ba44916f..3c2e1481 100644 --- a/src/pecanpy/rw/dense_rw.py +++ b/src/pecanpy/rw/dense_rw.py @@ -1,4 +1,5 @@ """Dense Graph object equipped with random walk computation.""" + import numpy as np from numba import njit @@ -106,9 +107,9 @@ def get_extended_normalized_probs( alpha = 1 / q + (1 - 1 / q) * t # suppress noisy edges - alpha[ - unnormalized_probs[out_ind] < noise_threshold_ary[cur_idx] - ] = np.minimum(1, 1 / q) + alpha[unnormalized_probs[out_ind] < noise_threshold_ary[cur_idx]] = ( + np.minimum(1, 1 / q) + ) unnormalized_probs[out_ind] *= alpha # apply out biases unnormalized_probs[prev_idx] /= p # apply the return bias diff --git a/src/pecanpy/rw/sparse_rw.py b/src/pecanpy/rw/sparse_rw.py index 0ea0fb80..3a1ea205 100644 --- a/src/pecanpy/rw/sparse_rw.py +++ b/src/pecanpy/rw/sparse_rw.py @@ -1,4 +1,5 @@ """Sparse Graph equipped with random walk computation.""" + import numpy as np from numba import boolean from numba import njit @@ -119,9 +120,9 @@ def get_extended_normalized_probs( alpha = 1 / q + (1 - 1 / q) * t[out_ind] # suppress noisy edges - alpha[ - unnormalized_probs[out_ind] < noise_threshold_ary[cur_idx] - ] = np.minimum(1, 1 / q) + alpha[unnormalized_probs[out_ind] < noise_threshold_ary[cur_idx]] = ( + np.minimum(1, 1 / q) + ) unnormalized_probs[out_ind] *= alpha # apply out biases unnormalized_probs[prev_ptr] /= p # apply the return bias diff --git a/src/pecanpy/typing.py b/src/pecanpy/typing.py index 90641eff..ad34270c 100644 --- a/src/pecanpy/typing.py +++ b/src/pecanpy/typing.py @@ -1,4 +1,5 @@ """Type annotations.""" + from typing import Any from typing import Callable from typing import Dict diff --git a/src/pecanpy/wrappers.py b/src/pecanpy/wrappers.py index 3a972bca..20224aaf 100644 --- a/src/pecanpy/wrappers.py +++ b/src/pecanpy/wrappers.py @@ -1,4 +1,5 @@ """Wrappers used by pecanpy.""" + import time