Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: adding lint.select and corresponding style fixes #67

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion _nx_parallel/update_get_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import ast
import os

__all__ = [
"get_funcs_info",
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/benchmarks/bench_approximation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import networkx as nx

import nx_parallel as nxp

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx
import nx_parallel as nxp


class Connectivity(Benchmark):
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/benchmarks/bench_bipartite.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import networkx as nx

from .common import (
Benchmark,
backends,
edge_prob,
Benchmark,
)
import networkx as nx

# for an unbalanced bipartite random graph
n = [50, 100, 200, 400, 800]
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_centrality.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class Betweenness(Benchmark):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_cluster.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class Cluster(Benchmark):
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/benchmarks/bench_connectivity.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import networkx as nx

import nx_parallel as nxp

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx
import nx_parallel as nxp


class Connectivity(Benchmark):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_efficiency_measures.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class EfficiencyMeasures(Benchmark):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_isolate.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class Isolate(Benchmark):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_shortest_paths.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class Generic(Benchmark):
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/benchmarks/bench_tournament.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
Benchmark,
)
import networkx as nx


class Tournament(Benchmark):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/bench_vitality.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import networkx as nx

from .common import (
Benchmark,
backends,
num_nodes,
edge_prob,
get_cached_gnp_random_graph,
Benchmark,
num_nodes,
)
import networkx as nx


class Vitality(Benchmark):
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random
from functools import lru_cache
from pathlib import Path
import random

import networkx as nx

Expand Down
3 changes: 3 additions & 0 deletions nx_parallel/algorithms/approximation/connectivity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Parallel implementations of fast approximation for node connectivity"""

import itertools

from joblib import Parallel, delayed
from networkx.algorithms.approximation.connectivity import local_node_connectivity

import nx_parallel as nxp

__all__ = [
Expand Down
7 changes: 4 additions & 3 deletions nx_parallel/algorithms/bipartite/redundancy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from itertools import chain

import networkx as nx
from joblib import Parallel, delayed
from networkx.algorithms.bipartite.redundancy import _node_redundancy
import networkx as nx
import nx_parallel as nxp
from itertools import chain

import nx_parallel as nxp

__all__ = ["node_redundancy"]

Expand Down
1 change: 1 addition & 0 deletions nx_parallel/algorithms/centrality/betweenness.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
_single_source_shortest_path_basic,
)
from networkx.utils import py_random_state

import nx_parallel as nxp

__all__ = ["betweenness_centrality"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import math

import networkx as nx

import nx_parallel as nxp
import math


def test_betweenness_centrality_get_chunks():
Expand Down
4 changes: 3 additions & 1 deletion nx_parallel/algorithms/cluster.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from itertools import combinations, chain
from itertools import chain, combinations

from joblib import Parallel, delayed

import nx_parallel as nxp

__all__ = [
Expand Down
8 changes: 5 additions & 3 deletions nx_parallel/algorithms/connectivity/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"""

import itertools
from networkx.algorithms.flow import build_residual_network
from networkx.algorithms.connectivity.utils import build_auxiliary_node_connectivity
from networkx.algorithms.connectivity.connectivity import local_node_connectivity

from joblib import Parallel, delayed
from networkx.algorithms.connectivity.connectivity import local_node_connectivity
from networkx.algorithms.connectivity.utils import build_auxiliary_node_connectivity
from networkx.algorithms.flow import build_residual_network

import nx_parallel as nxp

__all__ = [
Expand Down
2 changes: 2 additions & 0 deletions nx_parallel/algorithms/efficiency_measures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Provides functions for computing the efficiency of nodes and graphs."""

import networkx as nx
from joblib import Parallel, delayed

import nx_parallel as nxp

__all__ = ["local_efficiency"]
Expand Down
1 change: 1 addition & 0 deletions nx_parallel/algorithms/isolate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import networkx as nx
from joblib import Parallel, delayed

import nx_parallel as nxp

__all__ = ["number_of_isolates"]
Expand Down
3 changes: 2 additions & 1 deletion nx_parallel/algorithms/shortest_paths/generic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from networkx.algorithms.shortest_paths.generic import single_source_all_shortest_paths
from joblib import Parallel, delayed
from networkx.algorithms.shortest_paths.generic import single_source_all_shortest_paths

import nx_parallel as nxp

__all__ = [
Expand Down
5 changes: 3 additions & 2 deletions nx_parallel/algorithms/shortest_paths/unweighted.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"""

from joblib import Parallel, delayed
import nx_parallel as nxp
from networkx.algorithms.shortest_paths.unweighted import (
single_source_shortest_path_length,
single_source_shortest_path,
single_source_shortest_path_length,
)

import nx_parallel as nxp

__all__ = [
"all_pairs_shortest_path",
"all_pairs_shortest_path_length",
Expand Down
15 changes: 8 additions & 7 deletions nx_parallel/algorithms/shortest_paths/weighted.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"""

from joblib import Parallel, delayed
import nx_parallel as nxp
from networkx.algorithms.shortest_paths.weighted import (
single_source_dijkstra,
single_source_dijkstra_path_length,
single_source_dijkstra_path,
_bellman_ford,
_dijkstra,
_weight_function,
single_source_bellman_ford_path,
single_source_bellman_ford_path_length,
_weight_function,
_dijkstra,
_bellman_ford,
single_source_dijkstra,
single_source_dijkstra_path,
single_source_dijkstra_path_length,
)

import nx_parallel as nxp

__all__ = [
"all_pairs_dijkstra",
"all_pairs_dijkstra_path_length",
Expand Down
5 changes: 3 additions & 2 deletions nx_parallel/algorithms/tournament.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import networkx as nx
from joblib import Parallel, delayed
import nx_parallel as nxp
from networkx.algorithms.simple_paths import is_simple_path as is_path
import networkx as nx

import nx_parallel as nxp

__all__ = [
"is_reachable",
Expand Down
6 changes: 4 additions & 2 deletions nx_parallel/algorithms/vitality.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from functools import partial
import nx_parallel as nxp
from joblib import Parallel, delayed

import networkx as nx
from joblib import Parallel, delayed

import nx_parallel as nxp

__all__ = ["closeness_vitality"]

Expand Down
31 changes: 16 additions & 15 deletions nx_parallel/interface.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import networkx as nx

from nx_parallel.algorithms.approximation.connectivity import (
approximate_all_pairs_node_connectivity,
)
from nx_parallel.algorithms.bipartite.redundancy import node_redundancy
from nx_parallel.algorithms.centrality.betweenness import betweenness_centrality
from nx_parallel.algorithms.cluster import square_clustering
from nx_parallel.algorithms.connectivity import connectivity
from nx_parallel.algorithms.efficiency_measures import local_efficiency
from nx_parallel.algorithms.isolate import number_of_isolates
from nx_parallel.algorithms.shortest_paths.generic import all_pairs_all_shortest_paths
from nx_parallel.algorithms.shortest_paths.unweighted import (
all_pairs_shortest_path,
all_pairs_shortest_path_length,
)
from nx_parallel.algorithms.shortest_paths.weighted import (
all_pairs_bellman_ford_path,
all_pairs_bellman_ford_path_length,
all_pairs_dijkstra,
all_pairs_dijkstra_path_length,
all_pairs_dijkstra_path,
all_pairs_bellman_ford_path_length,
all_pairs_bellman_ford_path,
all_pairs_dijkstra_path_length,
johnson,
)
from nx_parallel.algorithms.shortest_paths.unweighted import (
all_pairs_shortest_path,
all_pairs_shortest_path_length,
)
from nx_parallel.algorithms.efficiency_measures import local_efficiency
from nx_parallel.algorithms.isolate import number_of_isolates
from nx_parallel.algorithms.tournament import (
is_reachable,
tournament_is_strongly_connected,
)
from nx_parallel.algorithms.vitality import closeness_vitality
from nx_parallel.algorithms.approximation.connectivity import (
approximate_all_pairs_node_connectivity,
)
from nx_parallel.algorithms.connectivity import connectivity
from nx_parallel.algorithms.cluster import square_clustering
import networkx as nx

__all__ = ["BackendInterface", "ParallelGraph"]

Expand Down
10 changes: 6 additions & 4 deletions nx_parallel/tests/test_get_chunks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# smoke tests for all functions supporting `get_chunks` kwarg

import inspect
import importlib
import networkx as nx
import nx_parallel as nxp
import inspect
import math
import random
import types
import math

import networkx as nx

import nx_parallel as nxp


def get_all_functions(package_name="nx_parallel"):
Expand Down
Loading
Loading