Skip to content

Commit 79f5676

Browse files
authored
new version of mypy changes its mind (#846)
1 parent afe2fb1 commit 79f5676

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

doc/KPyCon2009/code/beerdistribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
x = pulp.LpVariable.dicts("route", (warehouses, bars), lowBound=0, cat=pulp.LpInteger)
4646

4747
# The objective function is added to 'prob' first
48-
prob += sum([x[w][b] * costs[w][b] for (w, b) in routes]), "Sum_of_Transporting_Costs" # type: ignore[call-overload]
48+
prob += sum([x[w][b] * costs[w][b] for (w, b) in routes]), "Sum_of_Transporting_Costs"
4949

5050
# Supply maximum constraints are added to prob for each supply node (warehouse)
5151
for w in warehouses:

pulp/mps_lp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ def writeMPS(
312312
if mpsSense != lp.sense:
313313
n = cobj.name
314314
cobj = -cobj
315-
cobj.name = n # type: ignore[union-attr]
315+
cobj.name = n
316316
if rename:
317-
constrNames, varNames, cobj.name = lp.normalisedNames() # type: ignore[union-attr]
317+
constrNames, varNames, cobj.name = lp.normalisedNames()
318318
# No need to call self.variables() again, we have just filled self._variables:
319319
vs = lp._variables
320320
else:
@@ -324,7 +324,7 @@ def writeMPS(
324324
model_name = lp.name
325325
if rename:
326326
model_name = "MODEL"
327-
objName = cobj.name # type: ignore[union-attr]
327+
objName = cobj.name
328328
if not objName:
329329
objName = "OBJ"
330330

@@ -346,7 +346,7 @@ def writeMPS(
346346
for v in vs:
347347
name = varNames[v.name]
348348
columns_lines.extend(
349-
writeMPSColumnLines(coefs[name], v, mip, name, cobj, objName) # type: ignore[arg-type]
349+
writeMPSColumnLines(coefs[name], v, mip, name, cobj, objName)
350350
)
351351

352352
# right hand side
@@ -382,7 +382,7 @@ def writeMPS(
382382
if not rename:
383383
return vs
384384
else:
385-
return vs, varNames, constrNames, cobj.name # type: ignore[union-attr]
385+
return vs, varNames, constrNames, cobj.name
386386

387387

388388
def writeMPSColumnLines(

0 commit comments

Comments
 (0)