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

Commit

Permalink
src/sage/sat/solvers/picosat.py: Use lazy_import with feature instead…
Browse files Browse the repository at this point in the history
… of try/except
  • Loading branch information
Matthias Koeppe committed Sep 20, 2020
1 parent fdc62f7 commit 30613c8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sage/sat/solvers/picosat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

from .satsolver import SatSolver

from sage.misc.lazy_import import lazy_import
from sage.features import PythonModule
lazy_import('pycosat', ['solve'],
feature=PythonModule('pycosat', spkg='pycosat'))

class PicoSAT(SatSolver):
r"""
PicoSAT Solver.
Expand Down Expand Up @@ -55,12 +60,7 @@ def __init__(self, verbosity=0, prop_limit=0):
self._prop_limit = 0
else:
self._prop_limit = int(prop_limit)
try:
import pycosat
except ImportError:
from sage.misc.package import PackageNotFoundError
raise PackageNotFoundError("pycosat")
self._solve = pycosat.solve
self._solve = solve
self._nvars = 0
self._clauses = []

Expand Down

0 comments on commit 30613c8

Please sign in to comment.