Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#2625)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Aug 15, 2023
1 parent 496506d commit 81383b2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ repos:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.13.0"
rev: "0.13.1"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.6.4"]
additional_dependencies: ["tox>=4.8"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.1"
hooks:
- id: prettier
args: ["--print-width=120", "--prose-wrap=always"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.282"
rev: "v0.0.284"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
15 changes: 11 additions & 4 deletions docs/render_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations

from argparse import SUPPRESS
from collections import namedtuple
from contextlib import contextmanager
from typing import Any, ClassVar
from typing import Any, ClassVar, NamedTuple

from docutils import nodes as n
from docutils.parsers.rst.directives import unchanged_required
Expand All @@ -12,9 +11,17 @@

from virtualenv.run.plugin.base import ComponentBuilder

TableRow = namedtuple("TableRow", ["names", "default", "choices", "help"])

TextAsDefault = namedtuple("TextAsDefault", ["text"])
class TableRow(NamedTuple):
names: list[str]
default: str
choices: set[str]
help: str # noqa: A003


class TextAsDefault(NamedTuple):
text: str


CUSTOM = {
"discovery": ComponentBuilder.entry_points_for("virtualenv.discovery"),
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ dependencies = [
"platformdirs<4,>=3.9.1",
]
optional-dependencies.docs = [
"furo>=2023.5.20",
"furo>=2023.7.26",
"proselint>=0.13",
"sphinx>=7.0.1",
"sphinx>=7.1.2",
"sphinx-argparse>=0.4",
"sphinxcontrib-towncrier>=0.2.1a0",
"towncrier>=23.6",
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/discovery/py_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from collections import OrderedDict, namedtuple
from string import digits

VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"]) # noqa: PYI024


def _get_path_extensions():
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/discovery/windows/pep514.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def parse_version(version_str):


def msg(path, what):
LOGGER.warning(f"PEP-514 violation in Windows Registry at {path} error: {what}")
LOGGER.warning("PEP-514 violation in Windows Registry at %s error: %s", path, what)


def _run():
Expand Down
13 changes: 11 additions & 2 deletions src/virtualenv/run/plugin/creators.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
from __future__ import annotations

from collections import OrderedDict, defaultdict, namedtuple
from collections import OrderedDict, defaultdict
from typing import TYPE_CHECKING, NamedTuple

from virtualenv.create.describe import Describe
from virtualenv.create.via_global_ref.builtin.builtin_way import VirtualenvBuiltin

from .base import ComponentBuilder

CreatorInfo = namedtuple("CreatorInfo", ["key_to_class", "key_to_meta", "describe", "builtin_key"])
if TYPE_CHECKING:
from virtualenv.create.creator import Creator, CreatorMeta


class CreatorInfo(NamedTuple):
key_to_class: dict[str, type[Creator]]
key_to_meta: dict[str, CreatorMeta]
describe: type[Describe] | None
builtin_key: str


class CreatorSelector(ComponentBuilder):
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/discovery/py_info/test_py_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import os
import sys
import sysconfig
from collections import namedtuple
from pathlib import Path
from textwrap import dedent
from typing import NamedTuple

import pytest

Expand Down Expand Up @@ -166,7 +166,10 @@ def test_py_info_cached_symlink(mocker, tmp_path, session_app_data):
assert spy.call_count == count + 1 # no longer needed the host invocation, but the new symlink is must


PyInfoMock = namedtuple("PyInfoMock", ["implementation", "architecture", "version_info"])
class PyInfoMock(NamedTuple):
implementation: str
architecture: int
version_info: VersionInfo


@pytest.mark.parametrize(
Expand Down

0 comments on commit 81383b2

Please sign in to comment.