summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:18 +0000
commita75e61fbe483eb1f3bbfb2d61d7c15615f56172b (patch)
tree2200a67ca0cbe0c8091c69a447c70c3b0ca0a79c /pre_commit/commands
parentAdding upstream version 3.0.4. (diff)
downloadpre-commit-a75e61fbe483eb1f3bbfb2d61d7c15615f56172b.tar.xz
pre-commit-a75e61fbe483eb1f3bbfb2d61d7c15615f56172b.zip
Adding upstream version 3.1.0.upstream/3.1.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/commands')
-rw-r--r--pre_commit/commands/migrate_config.py9
-rw-r--r--pre_commit/commands/run.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/pre_commit/commands/migrate_config.py b/pre_commit/commands/migrate_config.py
index 6f7af4e..842fb3a 100644
--- a/pre_commit/commands/migrate_config.py
+++ b/pre_commit/commands/migrate_config.py
@@ -42,6 +42,14 @@ def _migrate_sha_to_rev(contents: str) -> str:
return re.sub(r'(\n\s+)sha:', r'\1rev:', contents)
+def _migrate_python_venv(contents: str) -> str:
+ return re.sub(
+ r'(\n\s+)language: python_venv\b',
+ r'\1language: python',
+ contents,
+ )
+
+
def migrate_config(config_file: str, quiet: bool = False) -> int:
with open(config_file) as f:
orig_contents = contents = f.read()
@@ -55,6 +63,7 @@ def migrate_config(config_file: str, quiet: bool = False) -> int:
contents = _migrate_map(contents)
contents = _migrate_sha_to_rev(contents)
+ contents = _migrate_python_venv(contents)
if contents != orig_contents:
with open(config_file, 'w') as f:
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index a7eb4f4..c9bc55b 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -19,9 +19,9 @@ from identify.identify import tags_from_path
from pre_commit import color
from pre_commit import git
from pre_commit import output
+from pre_commit.all_languages import languages
from pre_commit.clientlib import load_config
from pre_commit.hook import Hook
-from pre_commit.languages.all import languages
from pre_commit.repository import all_hooks
from pre_commit.repository import install_hook_envs
from pre_commit.staged_files_only import staged_files_only