Skip to content

Commit

Permalink
Start using MyPy in CI
Browse files Browse the repository at this point in the history
* MyPy related cleanup

* Simple mypy conf

* Run mypy on travis

* Install mypy before using it

* Remove unused functions

* Added some type annotations to geom

* Started adding annotations + minor cleanups

* Apply black

* find/replace typo fix

* mypy.ini cleanup

* Install OCP-stubs before running mypy in travis

* Try without ignoring missing imports

* Install ocp before running mypy

* More explicit ignoring import policy

* install mypy via conda

* Mypy debugging

* Cleanup of travis.yml

* Added annotations to BoundBox

* Added coveragerc

* Add member types in Plane

* Correct .coveragerc

* Blackify geom
  • Loading branch information
adam-urbanczyk authored Jun 13, 2020
1 parent f9fe7b1 commit f38f9cb
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 163 deletions.
1 change: 0 additions & 1 deletion .coverage

This file was deleted.

7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
branch = True

[report]
exclude_lines =
# Ignore stub body
\.\.\.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ matrix:
os: linux
script:
- black . --diff --check
- mypy cadquery

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
Expand All @@ -54,7 +55,8 @@ before_install:
- conda config --set always_yes yes --set changeps1 no;
- conda env create -f environment.yml
- source ~/miniconda/bin/activate cadquery
- conda install -c conda-forge -c defaults -c cadquery python=$PYTHON_VERSION
- conda install -c conda-forge -c defaults -c cadquery python=$PYTHON_VERSION mypy
- pip install git+https://github.com/CadQuery/OCP-stubs.git

install:
- python setup.py install
Expand Down
10 changes: 2 additions & 8 deletions cadquery/occ_impl/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import os
import sys

if sys.version_info.major == 2:
import cStringIO as StringIO
else:
import io as StringIO
import io as StringIO

from .shapes import Shape, Compound, TOLERANCE
from .geom import BoundBox
Expand All @@ -20,10 +17,7 @@
from OCP.HLRAlgo import HLRAlgo_Projector
from OCP.GCPnts import GCPnts_QuasiUniformDeflection

try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import xml.etree.cElementTree as ET

DISCRETIZATION_TOLERANCE = 1e-3
DEFAULT_DIR = gp_Dir(-1.75, 1.1, 5)
Expand Down
Loading

0 comments on commit f38f9cb

Please sign in to comment.