Skip to content

Commit b058d7e

Browse files
committed
minor code style and linting
1 parent 30703cd commit b058d7e

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def expected_precision_loss_by_query_reduction(
359359
"""
360360
max_score = gtp_scores.score
361361
variant_max_k_prec_loss_reps = defaultdict(OrderedDict)
362-
for max_k_idx, max_k in enumerate(max_ks):
362+
for max_k in max_ks:
363363
# TODO: try other (non clustering) algorithms to improve set coverage
364364
# TODO: picking fittest representative might be non-optimal solution
365365
cluster_variants = make_cluster_variants_for_gps_by_precision(
@@ -381,8 +381,8 @@ def expected_precision_loss_by_query_reduction(
381381
'Precision loss for max %d requests in clustering %s: %0.3f',
382382
max_k, cv_name, lost_precision
383383
)
384-
variant_max_k_prec_loss_reps[cv_name][max_k] = \
385-
(lost_precision / max_score, gp_reps)
384+
variant_max_k_prec_loss_reps[cv_name][max_k] = (
385+
lost_precision / max_score, gp_reps)
386386

387387
log_msg = ['Best clusterings (least precision loss) per k requests:']
388388
for k in max_ks:

fusion/trained.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def crossval_fm_score_single_split(
9999
vecs[test_idxs], labels[test_idxs], groups[test_idxs],
100100
clf=clf
101101
)
102-
except Exception as e:
102+
except Exception:
103103
logger.warning(
104104
'%s: param %d/%d: CV split %d/%d: caused an exception\nparams: %s',
105105
fm.name, params_number, n_params, split, n_splits, params,

gp_learner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def mate_helper(
285285
assert isinstance(overlap, set)
286286
assert isinstance(delta_dom, set)
287287
assert isinstance(delta_other, set)
288-
for i in range(retries):
288+
for _ in range(retries):
289289
overlap_part = [t for t in overlap if random.random() < pb_overlap]
290290
dom_part = [t for t in delta_dom if random.random() < pb_dom]
291291
other_part = [t for t in delta_other if random.random() < pb_other]
@@ -629,6 +629,10 @@ def mutate_fix_var(
629629
fitness. By randomizing the subset size, we will eventually (and more
630630
likely) select other combinations of remaining GTPs.
631631
632+
:param sparql: SPARQLWrapper endpoint.
633+
:param timeout: Timeout in seconds for each individual query (gp).
634+
:param gtp_scores: Current GTPScores object for sampling.
635+
:param child: a graph pattern to mutate.
632636
:param gtp_sample_max_n: Maximum GTPs subset size to base fixations on.
633637
:param rand_var: If given uses this variable instead of a random one.
634638
:param sample_max_n: Maximum number of children.

gp_query.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def query_stats(guard):
165165
)
166166
_query_stats_last_adapt = deepcopy(_query_stats)
167167
return _query_stats, bs
168+
169+
168170
_query_stats = _QueryStats()
169171
_query_stats_last_adapt = _QueryStats()
170172

@@ -303,7 +305,7 @@ def _multi_query_wrapper(*args, **kwds):
303305
closed.pop()
304306
try:
305307
return func(*args, **kwds)
306-
except:
308+
except Exception:
307309
closed.append(datetime.utcnow())
308310
raise
309311
return _multi_query_wrapper

prediction_baselines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def predict_target_with_milne_witten(
185185
/ (lN - log(min(s_indeg, t_indeg)))
186186
)
187187
scores[t] = mw
188-
res = scores.most_common()
188+
# res = scores.most_common()
189189
# for t, mw in res[:10]:
190190
# print('\t', mw, t)
191191
return scores.most_common()

utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def curify(self, identifier):
6161
self.prefixes[prefix] = ns_n3
6262
return res
6363

64-
def decurify(self, n3_str):
64+
@staticmethod
65+
def decurify(n3_str):
6566
return decurify(n3_str)
6667

6768
@staticmethod

0 commit comments

Comments
 (0)