From ed01e92f154e65b281a129505cb7d8a5150d925c Mon Sep 17 00:00:00 2001 From: Simon Bowly Date: Tue, 6 Jun 2023 09:16:05 +1000 Subject: [PATCH] Format python files New version of black gets a bit more opinionated about empty lines --- docs/source/conf.py | 1 - src/gurobi_optimods/bipartite_matching.py | 1 - src/gurobi_optimods/qubo.py | 2 -- src/gurobi_optimods/regression.py | 1 - src/gurobi_optimods/workforce.py | 1 - tests/test_workforce.py | 2 -- 6 files changed, 8 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 35daebf6..fd6692f0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -125,7 +125,6 @@ def process_docstring(app, what, name, obj, options, lines): """Add parameter entries for decorated mods""" if what in ["function", "method"] and hasattr(obj, "_decorated_mod"): - # Find where the last input parameter is listed in_paramlist = False lineno = None diff --git a/src/gurobi_optimods/bipartite_matching.py b/src/gurobi_optimods/bipartite_matching.py index 6dee1922..39ca267e 100644 --- a/src/gurobi_optimods/bipartite_matching.py +++ b/src/gurobi_optimods/bipartite_matching.py @@ -93,7 +93,6 @@ def _maximum_bipartite_matching_pandas(frame, n1_column, n2_column, create_env): already in a pandas dataframe.""" with create_env() as env, gp.Model(env=env) as model: - # Directed flow variables between bipartite sets df = frame.set_index([n1_column, n2_column]).gppd.add_vars( model, ub=1, name="flow" diff --git a/src/gurobi_optimods/qubo.py b/src/gurobi_optimods/qubo.py index 755c3692..b400aa70 100644 --- a/src/gurobi_optimods/qubo.py +++ b/src/gurobi_optimods/qubo.py @@ -33,7 +33,6 @@ class QuboResult: def callback(model, where): - if where == GRB.Callback.MIP: runtime = model.cbGet(GRB.Callback.RUNTIME) if runtime >= model._next_output_time: @@ -85,7 +84,6 @@ def solve_qubo(coeff_matrix, time_limit=GRB.INFINITY, *, create_env) -> QuboResu params = {"TimeLimit": time_limit, "LogToConsole": 0} with create_env(params=params) as env, gp.Model(env=env) as model: - x = model.addMVar(n, vtype=GRB.BINARY) model.setObjective(x @ coeff_matrix @ x, GRB.MINIMIZE) diff --git a/src/gurobi_optimods/regression.py b/src/gurobi_optimods/regression.py index 70325fba..bf72f975 100644 --- a/src/gurobi_optimods/regression.py +++ b/src/gurobi_optimods/regression.py @@ -49,7 +49,6 @@ def fit(self, X_train, y_train, *, create_env): # Create model with create_env() as env, gp.Model(env=env) as model: - # Create unbounded variables for each column coefficient, and bound # magnitudes using additional variables. Keep intercept separate. intercept = model.addVar(lb=-GRB.INFINITY, name="intercept") diff --git a/src/gurobi_optimods/workforce.py b/src/gurobi_optimods/workforce.py index ad1b6378..b9de582c 100644 --- a/src/gurobi_optimods/workforce.py +++ b/src/gurobi_optimods/workforce.py @@ -62,7 +62,6 @@ def solve_workforce_scheduling( input data """ with create_env() as env, gp.Model(env=env) as m: - # Create binary variables for all valid shift assignments and # create preference maximization objective m.ModelSense = GRB.MAXIMIZE diff --git a/tests/test_workforce.py b/tests/test_workforce.py index ca819125..600b072f 100644 --- a/tests/test_workforce.py +++ b/tests/test_workforce.py @@ -196,7 +196,6 @@ def test_constrained(self): ) with self.subTest("upperlimits"): - worker_limits = read_csv( """ Worker,MinShifts,MaxShifts @@ -228,7 +227,6 @@ def test_constrained(self): ) with self.subTest("lowerlimits"): - worker_limits = read_csv( """ Worker,MinShifts,MaxShifts