diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a46cafd0..1f3efaf7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,29 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: .bumpversion.cfg - id: end-of-file-fixer - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + rev: v3.16.0 hooks: - id: reorder-python-imports args: ["--py38-plus"] - repo: https://github.com/asottile/add-trailing-comma - rev: v3.1.0 + rev: v4.0.0 hooks: - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.21.2 hooks: - id: pyupgrade - - repo: https://github.com/psf/black - rev: 23.12.1 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.1.0 hooks: - id: black args: [--safe] 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 5fd07282..bdfa39db 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 b25a449a..c587dcff 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