From a142eaf457c6645ebf64df9a6a9fa12d04bf5ecc Mon Sep 17 00:00:00 2001
From: VIGNET Pierre <pierre.vignet@irisa.fr>
Date: Wed, 20 Nov 2019 03:53:44 +0100
Subject: [PATCH] [lib] Reformat MCLQuery

---
 .../models/clause_constraints/mcl/MCLQuery.py | 39 ++++++++++++-------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/library/cadbiom/models/clause_constraints/mcl/MCLQuery.py b/library/cadbiom/models/clause_constraints/mcl/MCLQuery.py
index 86daf95..c8e4b09 100644
--- a/library/cadbiom/models/clause_constraints/mcl/MCLQuery.py
+++ b/library/cadbiom/models/clause_constraints/mcl/MCLQuery.py
@@ -48,6 +48,7 @@ from logging import DEBUG
 
 LOGGER = cm.logger()
 
+
 class MCLSimpleQuery(object):
     """Class packaging the elements of a query
 
@@ -83,6 +84,7 @@ class MCLSimpleQuery(object):
     NB: DClause: A clause coded as a list of DIMACS coded literals: <list <int>>
 
     """
+
     def __init__(self, start_prop, inv_prop, final_prop):
         """
         @param start_prop: init property - None is allowed
@@ -90,10 +92,14 @@ class MCLSimpleQuery(object):
         @param final_prop: final property - None is allowed
         """
         if LOGGER.getEffectiveLevel() == DEBUG:
-            LOGGER.debug("MCLSimpleQuery params:: start prop: " + \
-                         str(start_prop) + '; inv prop: ' + \
-                         str(inv_prop) + '; final prop: ' + \
-                         str(final_prop))
+            LOGGER.debug(
+                "MCLSimpleQuery params:: start prop: "
+                + str(start_prop)
+                + "; inv prop: "
+                + str(inv_prop)
+                + "; final prop: "
+                + str(final_prop)
+            )
         # Strings forms of constraints
         self.start_prop = start_prop  # logical formula or None
         self.inv_prop = inv_prop      # logical formula or None
@@ -144,7 +150,9 @@ class MCLSimpleQuery(object):
         # - Get events names in each step
         # (remove the leading "%" and split the string on spaces)
         # - join events names with a logical operator " and "
-        var_prop = [" and ".join(raw_step[1:].split()) for raw_step in f_sol.ic_sequence]
+        var_prop = [
+            " and ".join(raw_step[1:].split()) for raw_step in f_sol.ic_sequence
+        ]
         # PS: var_prop and any attribute can be [], but keep this for uniformity
         if not var_prop:
             var_prop = None
@@ -153,7 +161,6 @@ class MCLSimpleQuery(object):
         n_query.variant_prop = var_prop
         return n_query
 
-
     @classmethod
     def from_frontier_sol_new_timing(cls, f_sol, unfolder):
         """Build a query from a frontier solution
@@ -190,8 +197,10 @@ class MCLSimpleQuery(object):
         # (remove the leading "%" and split the string on spaces)
         # - negation of each event with "not ( event )"
         # - join events names with a logical operator " or "
-        var_prop = [" or ".join("not (" + icp + ")" for icp in raw_step[1:].split())
-                    for raw_step in f_sol.ic_sequence]
+        var_prop = [
+            " or ".join("not (" + icp + ")" for icp in raw_step[1:].split())
+            for raw_step in f_sol.ic_sequence
+        ]
         # PS: var_prop and any attribute can be [], but keep this for uniformity
         if not var_prop:
             var_prop = None
@@ -201,8 +210,9 @@ class MCLSimpleQuery(object):
         # and force their inactivation with a negative value.
         ## dim_start doit-il etre ordonné ?
         # 1 - Get negative values of activated frontiers in FrontierSolution object
-        activated_frontier_neg_values = \
-            {-unfolder.var_dimacs_code(name) for name in f_sol.activated_frontier}
+        activated_frontier_neg_values = {
+            -unfolder.var_dimacs_code(name) for name in f_sol.activated_frontier
+        }
 
         # 2 - Get values of inactivated frontiers in the FrontSolution object
         dim_start_values = \
@@ -250,7 +260,9 @@ class MCLSimpleQuery(object):
         # - Get events names in each step
         # (remove the leading "%" and split the string on spaces)
         # - join events names with a logical operator " and "
-        var_prop = [" and ".join(raw_step[1:].split()) for raw_step in f_sol.ic_sequence]
+        var_prop = [
+            " and ".join(raw_step[1:].split()) for raw_step in f_sol.ic_sequence
+        ]
         # PS: var_prop and any attribute can be [], but keep this for uniformity
         if not var_prop:
             var_prop = None
@@ -259,8 +271,9 @@ class MCLSimpleQuery(object):
         # Search all frontiers that are not in activated_frontier
         # and force their inactivation with a negative value.
         # Get negative values of activated frontiers in FrontierSolution object
-        activated_frontier_neg_values = \
-            {-unfolder.var_dimacs_code(name) for name in f_sol.activated_frontier}
+        activated_frontier_neg_values = {
+            -unfolder.var_dimacs_code(name) for name in f_sol.activated_frontier
+        }
 
         # Get list of values of inactivated frontiers in the FrontSolution object
         dim_start_values = \
-- 
GitLab