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

Commit

Permalink
Replace not hasattr(self, 'xyz') by self.xyz is None
Browse files Browse the repository at this point in the history
  • Loading branch information
yuan-zhou committed Mar 28, 2021
1 parent dc36f82 commit 71ae94d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sage/numerical/backends/interactivelp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ cdef class InteractiveLPBackend:
INPUT:
- ``basic_variables`` -- (optional) a list of indices or names of the variables
- ``basic_variables`` -- (optional) a list of indices or names of the variables
in the ``coordinate_ring`` of ``self.interactive_lp_problem().standard_form()``.
If not provided, then the current dictionary is set to the initial dictionary.
Expand Down Expand Up @@ -641,7 +641,7 @@ cdef class InteractiveLPBackend:
"""
## FIXME: standard_form should allow to pass slack names (which we would take from row_names).
## FIXME: Perhaps also pass the problem name as objective name
if not hasattr(self, "lp_std_form"):
if self.lp_std_form is None:
self.lp_std_form, self.std_form_transformation = self.lp.standard_form(transformation=True)
var_names = self.lp_std_form.coordinate_ring().gens()
x_B = [var_names[v] if v in ZZ else v for v in basic_variables]
Expand Down Expand Up @@ -674,7 +674,7 @@ cdef class InteractiveLPBackend:
...
MIPSolverException: ...
"""
if not hasattr(self, "current_dictionary"):
if self.current_dictionary is None:
self.set_dictionary()
output = [self.current_dictionary.run_simplex_method()]
## FIXME: Display output as a side effect if verbosity is high enough. We don't care about output for now.
Expand Down Expand Up @@ -1273,7 +1273,7 @@ cdef class InteractiveLPBackend:
(17/8, 0)
"""
if not hasattr(self, "current_dictionary"):
if self.current_dictionary is None:
self.set_dictionary()
return self.current_dictionary

Expand Down

0 comments on commit 71ae94d

Please sign in to comment.