diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index 3e2b894..46d6675 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -9,10 +9,10 @@ on: jobs: build: name: Build source and wheel distribution - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.7 - name: Build source package @@ -20,27 +20,27 @@ jobs: pip install build python -m build . - name: Upload source package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: distribution path: dist/ test: name: Test source and wheel distributions - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: [build] strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"] steps: - - uses: actions/checkout@v1 - - uses: actions/download-artifact@v2 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 with: name: distribution path: dist/ - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -57,8 +57,8 @@ jobs: needs: [test] if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 with: name: distribution path: dist/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a678f69..44880e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-case-conflict - id: check-merge-conflict @@ -12,7 +12,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v2.37.3 + rev: v3.3.1 hooks: - id: pyupgrade name: PyUpgrade 3.6+ @@ -20,16 +20,17 @@ repos: exclude: ^bin/ - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.0.0 + rev: v2.2.0 hooks: - id: setup-cfg-fmt + args: ["--min-py3-version", "3.6"] diff --git a/setup.cfg b/setup.cfg index de93f40..30c63a5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ zip_safe = False where = src [tox:tox] -envlist = py36, py37, py38, py39 +envlist = py36, py37, py38, py39, py310, py311 skip_missing_interpreters = true isolated_build = true @@ -43,7 +43,7 @@ isolated_build = true changedir = tests deps = pytest - opencv-python-headless + opencv-python-headless==4.6.0.66 # last version with 3.6 abi [gh-actions] python = @@ -51,3 +51,5 @@ python = 3.7: py37 3.8: py38 3.9: py39 + 3.10: py310 + 3.11: py311 diff --git a/src/surface_tracker/heatmap.py b/src/surface_tracker/heatmap.py index 8ba11d2..10b4b5e 100644 --- a/src/surface_tracker/heatmap.py +++ b/src/surface_tracker/heatmap.py @@ -62,7 +62,6 @@ def image( size: T.Tuple[int, int], color_format: T.Optional["SurfaceHeatmap.ColorFormat"] = None, ) -> np.ndarray: - if color_format is None: color_format = SurfaceHeatmap.ColorFormat.RGB elif not isinstance(color_format, SurfaceHeatmap.ColorFormat): diff --git a/src/surface_tracker/image_crop.py b/src/surface_tracker/image_crop.py index 21ffbfd..9a58b1e 100644 --- a/src/surface_tracker/image_crop.py +++ b/src/surface_tracker/image_crop.py @@ -109,7 +109,6 @@ def __calculate_crop_size( width: T.Optional[int], height: T.Optional[int], ) -> T.Tuple[int, int]: - # compute the width of the new image, which will be the # maximum distance between bottom-right and bottom-left # x-coordiates or the top-right and top-left x-coordinates diff --git a/src/surface_tracker/location.py b/src/surface_tracker/location.py index 3a84249..ef6c9eb 100644 --- a/src/surface_tracker/location.py +++ b/src/surface_tracker/location.py @@ -23,7 +23,6 @@ class SurfaceLocation(abc.ABC): - __versioned_subclasses = {} def __init_subclass__(cls): @@ -75,7 +74,6 @@ def transform_matrix_from_surface_to_image_undistorted(self) -> np.ndarray: def _create_location_from_markers( surface: Surface, markers: T.List[Marker] ) -> "SurfaceLocation": - if surface is None: raise ValueError("Surface is None") @@ -177,7 +175,6 @@ def _map_from_surface_to_image( def _map_marker_from_image_to_surface( self, marker: Marker, transform_matrix=None ) -> Marker: - order = CornerId.all_corners() vertices_in_image_space = marker._vertices_in_order(order=order) @@ -203,7 +200,6 @@ def _map_marker_from_image_to_surface( def _map_marker_from_surface_to_image( self, marker: Marker, transform_matrix=None ) -> Marker: - order = CornerId.all_corners() vertices_in_surface_space = marker._vertices_in_order(order=order) @@ -263,7 +259,6 @@ def __surface_to_image_transform( def __map_points( points: np.ndarray, transform_matrix: np.ndarray, custom_transformation=False ) -> np.ndarray: - points = np.asarray(points) # Validate points @@ -387,7 +382,6 @@ def _find_homographies(points_A, points_B): class _SurfaceLocation_v2(SurfaceLocation): - version = 2 # type: ClassVar[int] @property diff --git a/src/surface_tracker/marker.py b/src/surface_tracker/marker.py index 82891c8..63886d9 100644 --- a/src/surface_tracker/marker.py +++ b/src/surface_tracker/marker.py @@ -17,7 +17,6 @@ class Marker(abc.ABC): - # ## Abstract members @property diff --git a/src/surface_tracker/surface.py b/src/surface_tracker/surface.py index d5e8e13..e5effc6 100644 --- a/src/surface_tracker/surface.py +++ b/src/surface_tracker/surface.py @@ -28,7 +28,6 @@ class Surface(abc.ABC): - __versioned_subclasses = {} def __init_subclass__(cls): @@ -256,7 +255,6 @@ def _get_transform_to_normalized_corners(vertices: np.ndarray) -> np.ndarray: def _bounding_quadrangle(vertices: np.ndarray): - # According to OpenCV implementation, cv2.convexHull only accepts arrays with # 32bit floats (CV_32F) or 32bit signed ints (CV_32S). # See: https://github.com/opencv/opencv/blob/3.4/modules/imgproc/src/convhull.cpp#L137 @@ -339,7 +337,6 @@ def _GetAnglesPolyline(polyline, closed=False): class _Surface_V2(Surface): - version = 2 @property diff --git a/src/surface_tracker/tracker.py b/src/surface_tracker/tracker.py index aee7ac6..5339339 100644 --- a/src/surface_tracker/tracker.py +++ b/src/surface_tracker/tracker.py @@ -127,7 +127,7 @@ def move_surface_corner_positions_in_image_space( ordered_corners, ordered_position_in_surface_space_undistorted ) - for (corner, new_undistorted) in corner_updates: + for corner, new_undistorted in corner_updates: # TODO: Provide Surface API for moving multiple corners in one call surface._move_corner( corner=corner, new_position_in_surface_space_undistorted=new_undistorted @@ -167,7 +167,6 @@ def add_markers_to_surface( self.__locations_tracker.mark_locations_as_stale_for_surface(surface=surface) for marker in markers: - marker_undistorted = location._map_marker_from_image_to_surface( marker=marker ) diff --git a/src/surface_tracker/visual_anchors.py b/src/surface_tracker/visual_anchors.py index 67bcd4f..1730388 100644 --- a/src/surface_tracker/visual_anchors.py +++ b/src/surface_tracker/visual_anchors.py @@ -21,7 +21,6 @@ class SurfaceVisualAnchors: def _create_from_location( location: SurfaceLocation, orientation: SurfaceOrientation ) -> "SurfaceVisualAnchors": - perimeter_corners = CornerId.all_corners() perimeter_corners = [c.as_tuple() for c in perimeter_corners] perimeter_corners.append(perimeter_corners[0]) diff --git a/tests/unit/test_corner.py b/tests/unit/test_corner.py index 42060a7..6073f7d 100644 --- a/tests/unit/test_corner.py +++ b/tests/unit/test_corner.py @@ -13,7 +13,6 @@ def test_corner_id_all_corners(): - # Test default arguments assert [ diff --git a/update_license_header.py b/update_license_header.py index db18482..ffafaf6 100644 --- a/update_license_header.py +++ b/update_license_header.py @@ -86,7 +86,6 @@ def write_header(file_name, license_txt): if __name__ == "__main__": - # find out the cwd and change to the top level Pupil folder cwd = os.getcwd() pupil_dir = cwd