Merge pull request #574 from joerick/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
This commit is contained in:
@@ -36,7 +36,7 @@ repos:
|
|||||||
args: ["--python-version=3.7", "--ignore-missing-imports", "--scripts-are-modules"]
|
args: ["--python-version=3.7", "--ignore-missing-imports", "--scripts-are-modules"]
|
||||||
|
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v2.7.4
|
rev: v2.9.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ["--py36-plus"]
|
args: ["--py36-plus"]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import ast
|
import ast
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterator, Optional
|
from typing import Iterator
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import yaml
|
import yaml
|
||||||
@@ -15,7 +15,7 @@ from cibuildwheel.projectfiles import Analyzer
|
|||||||
DIR = Path(__file__).parent.resolve()
|
DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
def parse(contents: str) -> Optional[str]:
|
def parse(contents: str) -> str | None:
|
||||||
try:
|
try:
|
||||||
tree = ast.parse(contents)
|
tree = ast.parse(contents)
|
||||||
analyzer = Analyzer()
|
analyzer = Analyzer()
|
||||||
@@ -50,7 +50,7 @@ class MaybeRemote:
|
|||||||
def __init__(self, cached_file: Path | str, *, online: bool) -> None:
|
def __init__(self, cached_file: Path | str, *, online: bool) -> None:
|
||||||
self.online = online
|
self.online = online
|
||||||
if self.online:
|
if self.online:
|
||||||
self.contents: dict[str, dict[str, Optional[str]]] = {
|
self.contents: dict[str, dict[str, str | None]] = {
|
||||||
"setup.py": {},
|
"setup.py": {},
|
||||||
"setup.cfg": {},
|
"setup.cfg": {},
|
||||||
"pyproject.toml": {},
|
"pyproject.toml": {},
|
||||||
@@ -59,7 +59,7 @@ class MaybeRemote:
|
|||||||
with open(cached_file) as f:
|
with open(cached_file) as f:
|
||||||
self.contents = yaml.safe_load(f)
|
self.contents = yaml.safe_load(f)
|
||||||
|
|
||||||
def get(self, repo: str, filename: str) -> Optional[str]:
|
def get(self, repo: str, filename: str) -> str | None:
|
||||||
if self.online:
|
if self.online:
|
||||||
try:
|
try:
|
||||||
self.contents[filename][repo] = (
|
self.contents[filename][repo] = (
|
||||||
@@ -79,7 +79,7 @@ class MaybeRemote:
|
|||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
yaml.safe_dump(self.contents, f, default_flow_style=False)
|
yaml.safe_dump(self.contents, f, default_flow_style=False)
|
||||||
|
|
||||||
def on_each(self, repos: list[str]) -> Iterator[tuple[str, str, Optional[str]]]:
|
def on_each(self, repos: list[str]) -> Iterator[tuple[str, str, str | None]]:
|
||||||
for repo in repos:
|
for repo in repos:
|
||||||
print(f"[bold]{repo}:")
|
print(f"[bold]{repo}:")
|
||||||
for filename in sorted(self.contents, reverse=True):
|
for filename in sorted(self.contents, reverse=True):
|
||||||
|
|||||||
Reference in New Issue
Block a user