From fb11c35ab354556ce1d1db4030171508e8518f70 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 03:41:23 +0000 Subject: [PATCH 1/7] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/asottile/pyupgrade: v2.37.3 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v2.37.3...v3.3.1) - [github.com/PyCQA/isort: 5.10.1 → 5.12.0](https://github.com/PyCQA/isort/compare/5.10.1...5.12.0) - [github.com/psf/black: 22.6.0 → 23.1.0](https://github.com/psf/black/compare/22.6.0...23.1.0) - [github.com/asottile/setup-cfg-fmt: v2.0.0 → v2.2.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.0.0...v2.2.0) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a678f69..ed15526 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,16 @@ 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 From 8ae90c79ea0fdead0c6eda3316cb57ef75aa157a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 03:42:12 +0000 Subject: [PATCH 2/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.cfg | 2 +- src/surface_tracker/heatmap.py | 1 - src/surface_tracker/image_crop.py | 1 - src/surface_tracker/location.py | 6 ------ src/surface_tracker/marker.py | 1 - src/surface_tracker/surface.py | 3 --- src/surface_tracker/tracker.py | 3 +-- src/surface_tracker/visual_anchors.py | 1 - tests/unit/test_corner.py | 1 - update_license_header.py | 1 - 10 files changed, 2 insertions(+), 18 deletions(-) diff --git a/setup.cfg b/setup.cfg index de93f40..de737ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,7 +25,7 @@ project_urls = packages = find: install_requires = numpy -python_requires = >=3.6 +python_requires = >=3.7 include_package_data = True package_dir = =src 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 From ee213f1c9c35eb3bc453650e310c3840f9ddbb6d Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Tue, 7 Feb 2023 09:28:59 +0100 Subject: [PATCH 3/7] Set args: ["--min-py3-version", "3.6"] --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed15526..44880e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,3 +33,4 @@ repos: rev: v2.2.0 hooks: - id: setup-cfg-fmt + args: ["--min-py3-version", "3.6"] From e4f55c8c4c41545e28e4c681acda642be4cdd933 Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Tue, 7 Feb 2023 10:11:14 +0100 Subject: [PATCH 4/7] Update Github actions --- .github/workflows/build-test-deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index 3e2b894..2a779b6 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -11,8 +11,8 @@ jobs: name: Build source and wheel distribution runs-on: ubuntu-latest 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,7 +20,7 @@ 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/ @@ -34,13 +34,13 @@ jobs: python-version: [3.6, 3.7, 3.8, 3.9] 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/ From 27fc85ff4646da31f9435308652690fcc6d8e35f Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Tue, 7 Feb 2023 10:20:14 +0100 Subject: [PATCH 5/7] GA: Use ubuntu 20.04 and test on 3.10/3.11 too --- .github/workflows/build-test-deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index 2a779b6..46d6675 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Build source and wheel distribution - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -27,11 +27,11 @@ jobs: 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@v3 From 06c359481b3406de9701cdcddd103429c0734809 Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Tue, 7 Feb 2023 10:51:08 +0100 Subject: [PATCH 6/7] GA: Fix cv2 to 4.6.0.66 for testing --- setup.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index de737ae..1a4fb4f 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 From 392f3ccabfb5691f56cbe884cef894668ec7147c Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Tue, 7 Feb 2023 10:53:02 +0100 Subject: [PATCH 7/7] GA: Fix cv2 and python requirements --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 1a4fb4f..30c63a5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,7 +25,7 @@ project_urls = packages = find: install_requires = numpy -python_requires = >=3.7 +python_requires = >=3.6 include_package_data = True package_dir = =src @@ -43,7 +43,7 @@ isolated_build = true changedir = tests deps = pytest - "opencv-python-headless==4.6.0.66" # last version with 3.6 abi + opencv-python-headless==4.6.0.66 # last version with 3.6 abi [gh-actions] python =