Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 4142421

Browse files
author
Matthias Koeppe
committed
python3 print in remaining mip backends
1 parent 46fe07f commit 4142421

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/sage/numerical/backends/coin_backend.pyx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ AUTHORS:
1717
# http://www.gnu.org/licenses/
1818
##############################################################################
1919

20+
from __future__ import print_function
21+
2022
include "cysignals/memory.pxi"
2123
include "cysignals/signals.pxi"
2224

@@ -1154,7 +1156,7 @@ cdef class CoinBackend(GenericBackend):
11541156
sage: from sage.numerical.backends.generic_backend import get_solver
11551157
sage: p = get_solver(solver = "Coin") # optional - cbc
11561158
sage: p.problem_name("There once was a french fry") # optional - cbc
1157-
sage: print p.problem_name() # optional - cbc
1159+
sage: print(p.problem_name()) # optional - cbc
11581160
There once was a french fry
11591161
"""
11601162
if name == NULL:
@@ -1179,7 +1181,7 @@ cdef class CoinBackend(GenericBackend):
11791181
sage: from sage.numerical.backends.generic_backend import get_solver
11801182
sage: p = get_solver(solver = "Coin") # optional - cbc
11811183
sage: p.add_linear_constraints(1, 2, None, names=['Empty constraint 1']) # optional - cbc
1182-
sage: print p.row_name(0) # optional - cbc
1184+
sage: print(p.row_name(0)) # optional - cbc
11831185
Empty constraint 1
11841186
"""
11851187
if self.row_names is not None:
@@ -1201,7 +1203,7 @@ cdef class CoinBackend(GenericBackend):
12011203
sage: p = get_solver(solver = "Coin") # optional - cbc
12021204
sage: p.add_variable(name='I am a variable') # optional - cbc
12031205
0
1204-
sage: print p.col_name(0) # optional - cbc
1206+
sage: print(p.col_name(0)) # optional - cbc
12051207
I am a variable
12061208
"""
12071209
if self.col_names is not None:

src/sage/numerical/backends/cplex_backend.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ cdef class CPLEXBackend(GenericBackend):
354354
sage: from sage.numerical.backends.generic_backend import get_solver # optional - CPLEX
355355
sage: p = get_solver(solver = "CPLEX") # optional - CPLEX
356356
sage: p.problem_name("There once was a french fry") # optional - CPLEX
357-
sage: print p.problem_name() # optional - CPLEX
357+
sage: print(p.problem_name()) # optional - CPLEX
358358
There once was a french fry
359359
"""
360360

@@ -1534,7 +1534,7 @@ cdef class CPLEXBackend(GenericBackend):
15341534
sage: p.solve() # optional - CPLEX
15351535
2.0
15361536
sage: with open(filename,'r') as f: # optional - CPLEX
1537-
....: print f.read() # optional - CPLEX
1537+
....: print(f.read()) # optional - CPLEX
15381538
Found incumbent of value ...
15391539
Reduced MIP has 5 rows, 5 columns, and 10 nonzeros.
15401540
...

src/sage/numerical/backends/generic_backend.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ AUTHORS:
2929
# http://www.gnu.org/licenses/
3030
#*****************************************************************************
3131

32+
from __future__ import print_function
33+
3234
from copy import copy
3335

3436
cdef class GenericBackend:
@@ -784,7 +786,7 @@ cdef class GenericBackend:
784786
sage: from sage.numerical.backends.generic_backend import get_solver
785787
sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver
786788
sage: p.problem_name("There once was a french fry") # optional - Nonexistent_LP_solver
787-
sage: print p.problem_name() # optional - Nonexistent_LP_solver
789+
sage: print(p.problem_name()) # optional - Nonexistent_LP_solver
788790
There once was a french fry
789791
"""
790792

src/sage/numerical/backends/gurobi_backend.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Methods
2626
# http://www.gnu.org/licenses/
2727
##############################################################################
2828

29+
from __future__ import print_function
30+
2931
include "cysignals/memory.pxi"
3032

3133
from sage.numerical.mip import MIPSolverException
@@ -354,14 +356,14 @@ cdef class GurobiBackend(GenericBackend):
354356
sage: from sage.numerical.backends.generic_backend import get_solver # optional - Gurobi
355357
sage: p = get_solver(solver = "Gurobi") # optional - Gurobi
356358
sage: p.problem_name("There once was a french fry") # optional - Gurobi
357-
sage: print p.problem_name() # optional - Gurobi
359+
sage: print(p.problem_name()) # optional - Gurobi
358360
There once was a french fry
359361
360362
TESTS::
361363
362364
sage: from sage.numerical.backends.generic_backend import get_solver # optional - Gurobi
363365
sage: p = get_solver(solver = "Gurobi") # optional - Gurobi
364-
sage: print p.problem_name() # optional - Gurobi
366+
sage: print(p.problem_name()) # optional - Gurobi
365367
"""
366368
cdef int error
367369
cdef char * pp_name[1]

src/sage/numerical/backends/logging_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def LoggingBackendFactory(solver=None, printing=True, doctest_file=None, test_me
299299
....: doctest_file=fname))
300300
4711
301301
sage: with open(fname) as f:
302-
....: for line in f.readlines(): print '|{}'.format(line),
302+
....: for line in f.readlines(): sys.stdout.write('|{}'.format(line))
303303
| sage: p = get_solver(solver='GLPK')
304304
| sage: p.add_variable(obj=42, name='Helloooooo')
305305
| 0
@@ -326,7 +326,7 @@ def LoggingBackendFactory(solver=None, printing=True, doctest_file=None, test_me
326326
....: test_method='something'))
327327
4711
328328
sage: with open(fname) as f:
329-
....: for line in f.readlines(): print '|{}'.format(line),
329+
....: for line in f.readlines(): sys.stdout.write('|{}'.format(line))
330330
|
331331
| @classmethod
332332
| def _test_something(cls, tester=None, **options):

0 commit comments

Comments
 (0)