diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9397c0d2e..3f20dd30c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,7 +8,7 @@ about: Create a bug report to help us improve DVC diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 6ee206a3c..9a12e416f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,4 +2,3 @@ name: "\U0001F680 Feature Request" about: Suggest an idea for this project --- - diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d452c2371..9d1448c25 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -45,7 +45,7 @@ jobs: matrix: os: [ubuntu-20.04, windows-latest, macos-latest] pyv: ["3.8", "3.9", "3.10"] - pytest-filter: + pytest-filter: - "import or plot or live or experiment" - "not (import or plot or live or experiment)" include: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 63a6d9e71..02e6de413 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,39 +1,62 @@ +default_language_version: + python: python3 + ci: skip: [mypy, pylint, dvc-pre-commit] repos: - - hooks: - - id: black - language_version: python3 - repo: https://github.com/ambv/black - rev: 22.10.0 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + exclude: "tests/func/utils/test_strict_yaml.py" + args: ['--assume-in-merge'] - id: check-toml - id: check-yaml - - hooks: - - id: codespell - args: - - --ignore-words-list - - ba,datas,fo,uptodate,cachable,falsy - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 - - hooks: - - id: isort - language_version: python3 - repo: https://github.com/timothycrosley/isort + - id: debug-statements + exclude: "dvc/_debug.py" + - id: end-of-file-fixer + - id: mixed-line-ending + - id: sort-simple-yaml + - id: trailing-whitespace + - repo: https://github.com/lovesegfault/beautysh + rev: v6.2.1 + hooks: + - id: beautysh + args: ["-i", "2"] + - repo: https://github.com/asottile/pyupgrade + rev: v3.2.0 + hooks: + - id: pyupgrade + args: + - --py38-plus + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + - repo: https://github.com/PyCQA/isort rev: 5.10.1 - - hooks: + hooks: + - id: isort + - repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell + additional_dependencies: ["tomli"] + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: - id: flake8 - language_version: python3 additional_dependencies: + - flake8-broken-line - flake8-bugbear - flake8-comprehensions - flake8-debugger - flake8-string-format - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 - repo: local hooks: - id: mypy @@ -47,14 +70,6 @@ repos: entry: pylint language: system types: [python] - - hooks: - - args: - - -i - - "2" - id: beautysh - language_version: python3 - repo: https://github.com/lovesegfault/beautysh - rev: v6.2.1 - hooks: - args: - git-hook diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 67715e749..c66fa0c93 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -74,4 +74,3 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq - diff --git a/dvc/machine/backend/base.py b/dvc/machine/backend/base.py index e303c8cdc..ba2bc366e 100644 --- a/dvc/machine/backend/base.py +++ b/dvc/machine/backend/base.py @@ -26,7 +26,7 @@ class BaseMachineBackend(ABC): ) -> Iterator[dict]: """Iterate over status of all instances of the specified machine.""" - def close(self): + def close(self): # noqa: B027 pass @abstractmethod diff --git a/dvc/parsing/__init__.py b/dvc/parsing/__init__.py index 4f86b932c..13e5e9af6 100644 --- a/dvc/parsing/__init__.py +++ b/dvc/parsing/__init__.py @@ -36,7 +36,7 @@ from .interpolate import ( ) if TYPE_CHECKING: - from typing_extensions import NoReturn + from typing import NoReturn from dvc.repo import Repo diff --git a/dvc/parsing/interpolate.py b/dvc/parsing/interpolate.py index 4c29875a7..137eaf340 100644 --- a/dvc/parsing/interpolate.py +++ b/dvc/parsing/interpolate.py @@ -9,10 +9,9 @@ from dvc.exceptions import DvcException from dvc.utils.flatten import flatten if typing.TYPE_CHECKING: - from typing import List, Match + from typing import List, Match, NoReturn from pyparsing import ParseException - from typing_extensions import NoReturn from .context import Context diff --git a/dvc/repo/experiments/queue/base.py b/dvc/repo/experiments/queue/base.py index 6ddf0fc71..b7999f4f7 100644 --- a/dvc/repo/experiments/queue/base.py +++ b/dvc/repo/experiments/queue/base.py @@ -269,6 +269,7 @@ class BaseStashQueue(ABC): finish any active experiments before shutting down. """ + @abstractmethod def logs( self, rev: str, diff --git a/dvc/testing/cloud.py b/dvc/testing/cloud.py index 8aa01ec6d..f1f13a0ec 100644 --- a/dvc/testing/cloud.py +++ b/dvc/testing/cloud.py @@ -65,7 +65,7 @@ class Cloud(ABC): self._gen(struct) return struct.keys() - def close(self): + def close(self): # noqa: B027 pass @staticmethod diff --git a/dvc/utils/serialize/_common.py b/dvc/utils/serialize/_common.py index 9a4198056..243016ef1 100644 --- a/dvc/utils/serialize/_common.py +++ b/dvc/utils/serialize/_common.py @@ -1,10 +1,17 @@ """Common utilities for serialize.""" import os from contextlib import contextmanager -from typing import TYPE_CHECKING, Any, Callable, ContextManager, Dict, Union +from typing import ( + TYPE_CHECKING, + Any, + Callable, + ContextManager, + Dict, + Protocol, + Union, +) from funcy import reraise -from typing_extensions import Protocol from dvc.exceptions import DvcException diff --git a/pyproject.toml b/pyproject.toml index f2ddf1237..47454c1c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,3 +81,6 @@ signature-mutators = ["funcy.decorators.decorator"] [tool.pylint.variables] dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_" ignored-argument-names = "_.*|^ignored_|^unused_|args|kwargs" + +[tool.codespell] +ignore-words-list = "ba,datas,fo,uptodate,cachable,falsy" diff --git a/scripts/innosetup/addSymLinkPermissions.ps1 b/scripts/innosetup/addSymLinkPermissions.ps1 index ea44eba6b..b09be93ab 100644 --- a/scripts/innosetup/addSymLinkPermissions.ps1 +++ b/scripts/innosetup/addSymLinkPermissions.ps1 @@ -24,8 +24,8 @@ function addSymLinkPermissions($accountToAdd){ Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan $tmp = [System.IO.Path]::GetTempFileName() Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan - secedit.exe /export /cfg "$($tmp)" - $c = Get-Content -Path $tmp + secedit.exe /export /cfg "$($tmp)" + $c = Get-Content -Path $tmp $currentSetting = "" foreach($s in $c) { if( $s -like "SECreateSymbolicLinkPrivilege*") { @@ -35,7 +35,7 @@ function addSymLinkPermissions($accountToAdd){ } if( $currentSetting -notlike "*$($sidstr)*" ) { Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow - + Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan if( [string]::IsNullOrEmpty($currentSetting) ) { @@ -58,8 +58,8 @@ SECreateSymbolicLinkPrivilege = $($currentSetting) $outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force Push-Location (Split-Path $tmp2) try { - secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS - } finally { + secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS + } finally { Pop-Location } } else { diff --git a/tests/func/experiments/test_set_params.py b/tests/func/experiments/test_set_params.py index 5be97527d..6a30e9b19 100644 --- a/tests/func/experiments/test_set_params.py +++ b/tests/func/experiments/test_set_params.py @@ -17,7 +17,7 @@ from ..utils.test_hydra import hydra_setup def test_modify_params(params_repo, dvc, changes, expected): dvc.experiments.run(params=changes) # pylint: disable=unspecified-encoding - with open("params.yaml", mode="r") as fobj: + with open("params.yaml") as fobj: assert fobj.read().strip() == expected diff --git a/tests/integration/plots/test_plots.py b/tests/integration/plots/test_plots.py index 6d0b38b42..1969e1487 100644 --- a/tests/integration/plots/test_plots.py +++ b/tests/integration/plots/test_plots.py @@ -44,7 +44,7 @@ def extract_vega_specs(html_path, plots_ids): result = {} - with open(html_path, "r", encoding="utf-8") as fd: + with open(html_path, encoding="utf-8") as fd: content = fd.read() reader = BeautifulSoup(content, features="html.parser")