Skip to content

Commit a3f5655

Browse files
committed
added more ignores to solver libraries + mypy in docs
1 parent d00f513 commit a3f5655

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

doc/source/develop/contribute.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,24 @@ Applying the black linter / formatter
6868
-----------------------------------------------------
6969

7070
We use `the black formatter <https://black.readthedocs.io/en/stable/>`_. Before sending your changes, be sure to execute the black package to style the resulting files.
71-
The quickest way to do this is to run:
71+
The quickest way to do this is to run::
7272

7373
python -m black pulp
7474

7575
And it will do the changes directly on the files.
7676

7777
The easiest way is to integrate it inside your IDE so it runs every time you save a file. Learn how to do that `in the black integration docs <https://black.readthedocs.io/en/stable/integrations/editors.html>`_.
7878

79+
Checking types with mypy
80+
-------------------------------------
81+
82+
We use `the mypy type checker <https://mypy.readthedocs.io/en/stable/index.html>`_. Before sending your changes, be sure to execute the mypy package to check the types.
83+
The quickest way to do this is to run::
84+
85+
python -m mypy ./
86+
87+
Fix all the errors you see before pushing the changes.
88+
7989
Building the documentation
8090
----------------------------
8191

pulp/apis/coin_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ class CYLP(LpSolver):
891891
name = "CyLP"
892892
try:
893893
global cy
894-
from cylp import cy # type: ignore[import-not-found]
894+
from cylp import cy # type: ignore[import-not-found, import-untyped, unused-ignore]
895895
except:
896896

897897
def available(self):

pulp/apis/copt_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ class COPT(LpSolver):
861861

862862
try:
863863
global coptpy
864-
import coptpy # type: ignore[import-not-found]
864+
import coptpy # type: ignore[import-not-found, import-untyped, unused-ignore]
865865
except:
866866

867867
def available(self):

pulp/apis/gurobi_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class GUROBI(LpSolver):
5757
try:
5858
# to import the name into the module scope
5959
global gp
60-
import gurobipy as gp # type: ignore[import-not-found]
60+
import gurobipy as gp # type: ignore[import-not-found, import-untyped, unused-ignore]
6161
except: # FIXME: Bug because gurobi returns
6262
# a gurobi exception on failed imports
6363
def available(self):

pulp/apis/highs_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class HiGHS(LpSolver):
276276

277277
try:
278278
global highspy
279-
import highspy # type: ignore[import-not-found]
279+
import highspy # type: ignore[import-not-found, import-untyped, unused-ignore]
280280
except:
281281

282282
def available(self):

pulp/apis/sas_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class SAS94(SASsolver):
176176

177177
try:
178178
global saspy
179-
import saspy # type: ignore[import-not-found]
179+
import saspy # type: ignore[import-not-found, import-untyped, unused-ignore]
180180

181181
except:
182182

@@ -485,7 +485,7 @@ class SASCAS(SASsolver):
485485

486486
try:
487487
global swat
488-
import swat # type: ignore[import-not-found]
488+
import swat # type: ignore[import-not-found, import-untyped, unused-ignore]
489489

490490
except ImportError:
491491

pulp/apis/scip_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class SCIP_PY(LpSolver):
477477

478478
try:
479479
global scip
480-
import pyscipopt as scip # type: ignore[import-not-found]
480+
import pyscipopt as scip # type: ignore[import-not-found, import-untyped, unused-ignore]
481481

482482
except ImportError:
483483

pulp/apis/xpress_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def available(self):
381381
if self._available is None:
382382
try:
383383
global xpress
384-
import xpress # type: ignore[import-not-found]
384+
import xpress # type: ignore[import-not-found, import-untyped, unused-ignore]
385385

386386
# Always disable the global output. We only want output if
387387
# we install callbacks explicitly

0 commit comments

Comments
 (0)