From 7e64b122eefdca850104af9ca32877f37bc375d7 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 22 Oct 2024 14:20:20 -0400 Subject: [PATCH] `make reformat` Signed-off-by: William Woodruff --- pip_audit/_audit.py | 2 +- pip_audit/_cli.py | 3 ++- pip_audit/_dependency_source/interface.py | 2 +- pip_audit/_dependency_source/pip.py | 2 +- pip_audit/_dependency_source/pyproject.py | 9 +++++---- pip_audit/_dependency_source/requirement.py | 3 ++- pip_audit/_fix.py | 3 ++- pip_audit/_format/columns.py | 3 ++- pip_audit/_service/interface.py | 3 ++- pip_audit/_state.py | 3 ++- pip_audit/_subprocess.py | 2 +- pip_audit/_virtual_env.py | 2 +- 12 files changed, 22 insertions(+), 15 deletions(-) diff --git a/pip_audit/_audit.py b/pip_audit/_audit.py index d977dbe2..b13cf91c 100644 --- a/pip_audit/_audit.py +++ b/pip_audit/_audit.py @@ -5,8 +5,8 @@ from __future__ import annotations import logging +from collections.abc import Iterator from dataclasses import dataclass -from typing import Iterator from pip_audit._dependency_source import DependencySource from pip_audit._service import Dependency, VulnerabilityResult, VulnerabilityService diff --git a/pip_audit/_cli.py b/pip_audit/_cli.py index 85cc02c9..c6bc7b91 100644 --- a/pip_audit/_cli.py +++ b/pip_audit/_cli.py @@ -9,9 +9,10 @@ import logging import os import sys +from collections.abc import Iterator from contextlib import ExitStack, contextmanager from pathlib import Path -from typing import IO, Iterator, NoReturn, cast +from typing import IO, NoReturn, cast from pip_audit import __version__ from pip_audit._audit import AuditOptions, Auditor diff --git a/pip_audit/_dependency_source/interface.py b/pip_audit/_dependency_source/interface.py index 74e1794d..9f07739a 100644 --- a/pip_audit/_dependency_source/interface.py +++ b/pip_audit/_dependency_source/interface.py @@ -6,7 +6,7 @@ from __future__ import annotations from abc import ABC, abstractmethod -from typing import Iterator +from collections.abc import Iterator from pip_audit._fix import ResolvedFixVersion from pip_audit._service import Dependency diff --git a/pip_audit/_dependency_source/pip.py b/pip_audit/_dependency_source/pip.py index 52667547..4404732f 100644 --- a/pip_audit/_dependency_source/pip.py +++ b/pip_audit/_dependency_source/pip.py @@ -7,8 +7,8 @@ import os import subprocess import sys +from collections.abc import Iterator, Sequence from pathlib import Path -from typing import Iterator, Sequence import pip_api from packaging.version import InvalidVersion, Version diff --git a/pip_audit/_dependency_source/pyproject.py b/pip_audit/_dependency_source/pyproject.py index 30d2767c..a3e7313f 100644 --- a/pip_audit/_dependency_source/pyproject.py +++ b/pip_audit/_dependency_source/pyproject.py @@ -6,9 +6,9 @@ import logging import os +from collections.abc import Iterator from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory -from typing import Iterator import toml from packaging.requirements import Requirement @@ -81,9 +81,10 @@ def collect(self) -> Iterator[Dependency]: # dependency resolution now, we can think about doing `pip install ` # regardless of whether the project has a `pyproject.toml` or not. And if it doesn't # have a `pyproject.toml`, we can raise an error if the user provides `--fix`. - with TemporaryDirectory() as ve_dir, NamedTemporaryFile( - dir=ve_dir, delete=False - ) as req_file: + with ( + TemporaryDirectory() as ve_dir, + NamedTemporaryFile(dir=ve_dir, delete=False) as req_file, + ): # We use delete=False in creating the tempfile to allow it to be # closed and opened multiple times within the context scope on # windows, see GitHub issue #646. diff --git a/pip_audit/_dependency_source/requirement.py b/pip_audit/_dependency_source/requirement.py index b19f3047..96d3f4b5 100644 --- a/pip_audit/_dependency_source/requirement.py +++ b/pip_audit/_dependency_source/requirement.py @@ -7,10 +7,11 @@ import logging import re import shutil +from collections.abc import Iterator from contextlib import ExitStack from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory -from typing import IO, Iterator +from typing import IO from packaging.specifiers import SpecifierSet from packaging.utils import canonicalize_name diff --git a/pip_audit/_fix.py b/pip_audit/_fix.py index 488764c9..3ae19ed5 100644 --- a/pip_audit/_fix.py +++ b/pip_audit/_fix.py @@ -5,8 +5,9 @@ from __future__ import annotations import logging +from collections.abc import Iterator from dataclasses import dataclass -from typing import Any, Iterator, cast +from typing import Any, cast from packaging.version import Version diff --git a/pip_audit/_format/columns.py b/pip_audit/_format/columns.py index 988fc35d..262a2f08 100644 --- a/pip_audit/_format/columns.py +++ b/pip_audit/_format/columns.py @@ -4,8 +4,9 @@ from __future__ import annotations +from collections.abc import Iterable from itertools import zip_longest -from typing import Any, Iterable, cast +from typing import Any, cast from packaging.version import Version diff --git a/pip_audit/_service/interface.py b/pip_audit/_service/interface.py index 6aefcd07..b02942ce 100644 --- a/pip_audit/_service/interface.py +++ b/pip_audit/_service/interface.py @@ -6,9 +6,10 @@ from __future__ import annotations from abc import ABC, abstractmethod +from collections.abc import Iterator from dataclasses import dataclass, replace from datetime import datetime -from typing import Any, Iterator, NewType +from typing import Any, NewType from packaging.utils import canonicalize_name from packaging.version import Version diff --git a/pip_audit/_state.py b/pip_audit/_state.py index 1f7f2938..abd5ae81 100644 --- a/pip_audit/_state.py +++ b/pip_audit/_state.py @@ -7,8 +7,9 @@ import logging from abc import ABC, abstractmethod +from collections.abc import Sequence from logging.handlers import MemoryHandler -from typing import Any, Sequence +from typing import Any from rich.align import StyleType from rich.console import Console, Group, RenderableType diff --git a/pip_audit/_subprocess.py b/pip_audit/_subprocess.py index 32b43885..fb021a4c 100644 --- a/pip_audit/_subprocess.py +++ b/pip_audit/_subprocess.py @@ -5,8 +5,8 @@ import os.path import subprocess +from collections.abc import Sequence from subprocess import Popen -from typing import Sequence from ._state import AuditState diff --git a/pip_audit/_virtual_env.py b/pip_audit/_virtual_env.py index d3dcc99e..c59ae530 100644 --- a/pip_audit/_virtual_env.py +++ b/pip_audit/_virtual_env.py @@ -7,10 +7,10 @@ import json import logging import venv +from collections.abc import Iterator from os import PathLike from tempfile import NamedTemporaryFile, TemporaryDirectory, gettempdir from types import SimpleNamespace -from typing import Iterator from packaging.version import Version