From 229359e517ff026d7dfcb11737a37c35d0efaa88 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 6 Aug 2024 12:56:52 -0400 Subject: [PATCH] Fix typo and get pyright version from lint script --- .github/workflows/lint-and-build.yml | 12 +++++++++++- pyproject.toml | 2 +- src/capture_method/XcbCaptureMethod.py | 2 +- src/capture_method/__init__.py | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-and-build.yml b/.github/workflows/lint-and-build.yml index bec662f7..fdae3d02 100644 --- a/.github/workflows/lint-and-build.yml +++ b/.github/workflows/lint-and-build.yml @@ -78,10 +78,20 @@ jobs: cache-dependency-path: "scripts/requirements*.txt" - run: scripts/install.ps1 shell: pwsh + - name: Get pyright version + id: pyright_version + run: | + PYRIGHT_VERSION=$(grep '$pyrightVersion = ' 'scripts/lint.ps1' | cut -d "#" -f 1 | cut -d = -f 2 | tr -d ' ') + echo pyright version: "${PYRIGHT_VERSION}" + if [ "$PYRIGHT_VERSION" = "'latest'" ]; then + PYRIGHT_VERSION= + fi + echo PYRIGHT_VERSION="${PYRIGHT_VERSION}" >> "${GITHUB_OUTPUT}" + shell: bash - name: Analysing the code with Pyright uses: jakebailey/pyright-action@v2 with: - version: "1.1.364" + version: ${{ steps.pyright_version.outputs.PYRIGHT_VERSION }} working-directory: src/ python-version: ${{ matrix.python-version }} Build: diff --git a/pyproject.toml b/pyproject.toml index c160de14..f72a1498 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,7 +134,7 @@ max-branches = 15 it doesn't support special characters. Use `utils.imread` instead. https://github.com/opencv/opencv/issues/4292#issuecomment-2266019697""" "cv2.imwrite".msg = """\ -it doesn't support special characters. . Use `utils.imwrite` instead. +it doesn't support special characters. Use `utils.imwrite` instead. https://github.com/opencv/opencv/issues/4292#issuecomment-2266019697""" # https://github.com/hhatto/autopep8#usage diff --git a/src/capture_method/XcbCaptureMethod.py b/src/capture_method/XcbCaptureMethod.py index 7c957a1d..7f56f41f 100644 --- a/src/capture_method/XcbCaptureMethod.py +++ b/src/capture_method/XcbCaptureMethod.py @@ -39,7 +39,7 @@ def get_frame(self): selection = self._autosplit_ref.settings_dict["capture_region"] x = selection["x"] + offset_x y = selection["y"] + offset_y - image = ImageGrab.grab( # pyright: ignore[reportUnknownMemberType] # TODO: Fix upstream + image = ImageGrab.grab( ( x, y, diff --git a/src/capture_method/__init__.py b/src/capture_method/__init__.py index 3c00b9f6..ce3ae690 100644 --- a/src/capture_method/__init__.py +++ b/src/capture_method/__init__.py @@ -154,7 +154,7 @@ def get(self, key: CaptureMethodEnum, default: object = None, /): CAPTURE_METHODS[CaptureMethodEnum.DESKTOP_DUPLICATION] = DesktopDuplicationCaptureMethod CAPTURE_METHODS[CaptureMethodEnum.PRINTWINDOW_RENDERFULLCONTENT] = ForceFullContentRenderingCaptureMethod elif sys.platform == "linux": - if features.check_feature(feature="xcb"): # pyright: ignore[reportUnknownMemberType] # TODO: Fix upstream + if features.check_feature(feature="xcb"): CAPTURE_METHODS[CaptureMethodEnum.XCB] = XcbCaptureMethod try: pyscreeze.screenshot()