Skip to content

Commit 0ef9ad6

Browse files
committed
further adressed linting
1 parent e00c09d commit 0ef9ad6

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

pyproject.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ omit = [ # Regexes for lines to exclude from consideration
8484
"*/io.py",
8585
"*/long_refinement_graphs.py",
8686
"*/visualization.py",
87+
"*wl.py",
8788
]
8889

8990

9091
[tool.flake8]
9192
# Some sane defaults for the code style checker flake8
92-
max_line_length = 125
93+
max_line_length = 200
9394
extend_ignore = ["E203", "W503", "E741"]
9495
# ^ Black-compatible
9596
# E203 and W503 have edge cases handled by black
@@ -112,17 +113,20 @@ good-names = [
112113
"A",
113114
"F",
114115
"H",
115-
"F_vals",
116-
"F_val",
116+
"E",
117+
"E2",
117118
"H_vals",
118119
"M",
119120
"SMALL_VAL",
120121
"LARGE_VAL",
121-
"MicroaggWilberCalculator_edu",
122-
"N_vals",
123-
"N",
122+
"Gnp_row_first",
123+
"_Gnp_row_first",
124+
"SBM",
124125
"setUp",
125126
"tearDown",
127+
"P",
128+
"G_str",
129+
"G_fg",
126130
]
127131

128132
# Good variable names regexes, separated by a comma. If names match any regex,

scripts/convergence_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def range_over_samples(self):
5151
the_range = range(self.number_of_samples)
5252
if self.tqdm:
5353
try:
54-
from tqdm.auto import tqdm
54+
from tqdm.auto import tqdm # pylint: disable=import-outside-toplevel
5555

5656
the_range = tqdm(the_range, leave=False, desc="samples")
5757
except ModuleNotFoundError:
@@ -62,7 +62,7 @@ def wl_range(self, wl_iterations):
6262
the_range = range(wl_iterations - 1, -1, -1)
6363
if self.tqdm:
6464
try:
65-
from tqdm.auto import tqdm
65+
from tqdm.auto import tqdm # pylint: disable=import-outside-toplevel
6666

6767
the_range = tqdm(the_range, desc="wl_rounds", leave=False)
6868
except ModuleNotFoundError:

src/nestmodel/ERGM_experiments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def rewire(self, n_steps, phi, seed):
7777
target_p = self.target_p.copy()
7878
A_work = self.A0.copy()
7979
rew_t0 = time.process_time()
80+
result_p = None
81+
ratio = None
8082
if self.kind == "adjacency":
8183
result_p, ratio = edge_flip_ergm_pagerank_adjacency(
8284
A_work, target_p, n_steps, phi, seed

src/nestmodel/fast_graph.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
get_block_indices,
1919
dir_sample_source_only_direct,
2020
)
21+
from nestmodel.fast_rewire2 import (
22+
fg_rewire_nest,
23+
)
2124

2225

2326
def ensure_is_numpy_or_none(arr, dtype=np.int64):
@@ -209,7 +212,9 @@ def load_npz(file):
209212
G.wl_iterations = npzfile["wl_iterations"]
210213
G.edges_classes = npzfile["edges_classes"]
211214

212-
from nestmodel.fast_rewire import create_mono_from_arrs
215+
from nestmodel.fast_rewire import (
216+
create_mono_from_arrs,
217+
) # pylint: disable=import-outside-toplevel
213218

214219
G.is_mono = []
215220
for i in range(npzfile["mono_len"]):
@@ -379,10 +384,6 @@ def rewire(self, depth, method, **kwargs):
379384
res = None
380385
elif method == 2:
381386

382-
from nestmodel.fast_rewire2 import (
383-
fg_rewire_nest,
384-
) # pylint: disable=import-outside-toplevel
385-
386387
res = fg_rewire_nest(self, depth, kwargs["n_rewire"], kwargs["seed"])
387388
elif method == 3:
388389
source_only = kwargs.get("source_only", False)

tests/test_fast_rewire.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
# faulthandler.enable()
55
import unittest
66
import numpy as np
7+
from numpy.testing import assert_array_equal
78

89
# from nestmodel.load_datasets import *
910
from nestmodel.fast_rewire import sort_edges
1011

11-
from numpy.testing import assert_array_equal
12-
1312

1413
def safe_diff(arr1, arr2):
1514
return np.maximum(arr1, arr2) - np.minimum(arr1, arr2)

0 commit comments

Comments
 (0)