Skip to content

Commit 420574e

Browse files
committed
Resolve linting errors
1 parent 382f6e0 commit 420574e

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
source env/bin/activate
4949
# stop the build if there are Python syntax errors or undefined names
5050
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude env/
51-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
52-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude env/
51+
# exit-zero treats all errors as warnings
52+
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=120 --statistics --exclude env/
5353
- name: Test with pytest
5454
run: |
5555
source env/bin/activate

experiments/modularity_nonmonotonic_K/modularity_nonmonotonic_K.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434

3535
def plot_and_exit(G, ranges):
3636
layout = ig.Graph.layout_fruchterman_reingold(G, niter=1000)
37-
print(f"plotting network...")
37+
print("plotting network...")
3838
ig.plot(G, layout=layout).save("network.png")
3939

40-
print(f"plotting CHAMP domains and gamma estimates...")
40+
print("plotting CHAMP domains and gamma estimates...")
4141
gamma_estimates = ranges_to_gamma_estimates(G, ranges)
4242
plt.rc('text', usetex=True)
4343
plt.rc('font', family='serif')

tests/test_monolayer_parameter_estimation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .shared_testing_functions import assert_almost_equal_or_both_none_or_nan, generate_igraph_famous, generate_random_partition
1+
from .shared_testing_functions import assert_almost_equal_or_both_none_or_nan, generate_igraph_famous, \
2+
generate_random_partition
23
import igraph as ig
34
from math import log
45
from numpy import mean

utilities/parameter_estimation_utilities.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def gamma_estimate(G, partition):
162162

163163

164164
def gamma_estimate_from_parameters(omega_in, omega_out):
165-
"""Compute the "correct" value of gamma as in :meth:`~modularitypruning.parameter_estimation_utilities.gamma_estimate` from SBM parameters.
165+
"""
166+
Compute the "correct" value of gamma as in
167+
:meth:`~modularitypruning.parameter_estimation_utilities.gamma_estimate` from SBM parameters.
166168
167169
:param omega_in: within-community edge propensity of a degree-corrected, planted partition SBM
168170
:type omega_in: float
@@ -361,11 +363,14 @@ def gamma_omega_estimate(G_intralayer, G_interlayer, layer_vec, membership, omeg
361363

362364

363365
def ranges_to_gamma_estimates(G, ranges):
364-
"""Compute gamma estimates as in :meth:`~modularitypruning.parameter_estimation_utilities.gamma_estimate`, given domains of optimality from :meth:`~modularitypruning.champ_utilities.CHAMP_2D`.
366+
"""
367+
Compute gamma estimates as in :meth:`~modularitypruning.parameter_estimation_utilities.gamma_estimate`, given
368+
domains of optimality from :meth:`~modularitypruning.champ_utilities.CHAMP_2D`.
365369
366370
:param G: graph of interest
367371
:type G: igraph.Graph
368-
:param ranges: list of ``(gamma_start, gamma_end, membership)`` tuples as returned from :meth:`~modularitypruning.champ_utilities.CHAMP_2D`
372+
:param ranges: list of ``(gamma_start, gamma_end, membership)`` tuples as returned from
373+
:meth:`~modularitypruning.champ_utilities.CHAMP_2D`
369374
:type ranges: list of tuple[float, float, tuple[int]]
370375
:return: a copy of input ranges with the corresponding gamma estimate appended to each tuple
371376
:rtype: list of tuple[float, float, tuple[int], float]
@@ -393,15 +398,19 @@ def gamma_estimates_to_stable_partitions(gamma_estimates):
393398

394399

395400
def domains_to_gamma_omega_estimates(G_intralayer, G_interlayer, layer_vec, domains, model='temporal'):
396-
"""Compute (gamma, omega) estimates as in :meth:`~modularitypruning.parameter_estimation_utilities.gamma_omega_estimate`, given domains of optimality from :meth:`~modularitypruning.champ_utilities.CHAMP_3D`.
401+
"""
402+
Compute (gamma, omega) estimates as in
403+
:meth:`~modularitypruning.parameter_estimation_utilities.gamma_omega_estimate`, given domains of optimality from
404+
:meth:`~modularitypruning.champ_utilities.CHAMP_3D`.
397405
398406
:param G_intralayer: intralayer graph of interest
399407
:type G_intralayer: igraph.Graph
400408
:param G_interlayer: interlayer graph of interest
401409
:type G_interlayer: igraph.Graph
402410
:param layer_vec: list of each vertex's layer membership
403411
:type layer_vec: list[int]
404-
:param domains: list of ``(domain_vertices, membership)`` tuples as returned from :meth:`~modularitypruning.champ_utilities.CHAMP_3D`
412+
:param domains: list of ``(domain_vertices, membership)`` tuples as returned from
413+
:meth:`~modularitypruning.champ_utilities.CHAMP_3D`
405414
:type domains: list of tuple[list[float], tuple[int]]
406415
:param model: network layer topology (temporal, multilevel, multiplex)
407416
:type model: str

0 commit comments

Comments
 (0)