mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 00:24:47 +04:00
special rmtree is not needed for TemporaryDirectory in 3.8+
This commit is contained in:
parent
092e9a50ae
commit
0a0754e44a
4 changed files with 4 additions and 24 deletions
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import os.path
|
||||
import re
|
||||
import tempfile
|
||||
from typing import Any
|
||||
from typing import NamedTuple
|
||||
from typing import Sequence
|
||||
|
|
@ -19,7 +20,6 @@ from pre_commit.store import Store
|
|||
from pre_commit.util import CalledProcessError
|
||||
from pre_commit.util import cmd_output
|
||||
from pre_commit.util import cmd_output_b
|
||||
from pre_commit.util import tmpdir
|
||||
from pre_commit.util import yaml_dump
|
||||
from pre_commit.util import yaml_load
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class RevInfo(NamedTuple):
|
|||
'FETCH_HEAD', '--tags', '--exact',
|
||||
)
|
||||
|
||||
with tmpdir() as tmp:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
git.init_repo(tmp, self.repo)
|
||||
cmd_output_b(
|
||||
*git_cmd, 'fetch', 'origin', 'HEAD', '--tags',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
import argparse
|
||||
import logging
|
||||
import os.path
|
||||
import tempfile
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import git
|
||||
|
|
@ -11,7 +12,6 @@ from pre_commit.clientlib import load_manifest
|
|||
from pre_commit.commands.run import run
|
||||
from pre_commit.store import Store
|
||||
from pre_commit.util import cmd_output_b
|
||||
from pre_commit.util import tmpdir
|
||||
from pre_commit.util import yaml_dump
|
||||
from pre_commit.xargs import xargs
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ def _repo_ref(tmpdir: str, repo: str, ref: str | None) -> tuple[str, str]:
|
|||
|
||||
|
||||
def try_repo(args: argparse.Namespace) -> int:
|
||||
with tmpdir() as tempdir:
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
repo, ref = _repo_ref(tempdir, args.repo, args.ref)
|
||||
|
||||
store = Store(tempdir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue