Update pre-commit with newer tools (#724)

This commit is contained in:
J. Nick Koston 2023-11-26 08:09:52 -06:00 committed by GitHub
parent 7a7a99474e
commit 908545768b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 16 deletions

View File

@ -1,9 +1,41 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
exclude: '^aioesphomeapi/api.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
args:
- --quiet
files: ^((aioesphomeapi|tests)/.+)?[^/]+\.py$
- repo: https://github.com/cdce8p/python-typing-update
rev: v0.6.0
hooks:
- id: python-typing-update
stages: [manual]
args:
- --py39-plus
- --force
- --keep-updates
files: ^(aioesphomeapi)/.+\.py$

View File

@ -42,7 +42,7 @@ class APIFrameHelper:
def __init__(
self,
connection: "APIConnection",
connection: APIConnection,
client_info: str,
log_name: str,
) -> None:

View File

@ -83,7 +83,7 @@ class APINoiseFrameHelper(APIFrameHelper):
def __init__(
self,
connection: "APIConnection",
connection: APIConnection,
noise_psk: str,
expected_name: str | None,
client_info: str,

View File

@ -30,5 +30,10 @@ disable = [
"too-many-lines",
]
[tool.ruff]
ignore = [
"E721", # We want type() check for protobuf messages
]
[build-system]
requires = ['setuptools>=65.4.1', 'wheel', 'Cython>=3.0.2']

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3
from subprocess import check_call
from pathlib import Path
import os
from pathlib import Path
from subprocess import check_call
root_dir = Path(__file__).absolute().parent.parent
os.chdir(root_dir)

View File

@ -23,11 +23,11 @@ PROJECT_EMAIL = "esphome@nabucasa.com"
PROJECT_GITHUB_USERNAME = "esphome"
PROJECT_GITHUB_REPOSITORY = "aioesphomeapi"
PYPI_URL = "https://pypi.python.org/pypi/{}".format(PROJECT_PACKAGE_NAME)
GITHUB_PATH = "{}/{}".format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY)
GITHUB_URL = "https://github.com/{}".format(GITHUB_PATH)
PYPI_URL = f"https://pypi.python.org/pypi/{PROJECT_PACKAGE_NAME}"
GITHUB_PATH = f"{PROJECT_GITHUB_USERNAME}/{PROJECT_GITHUB_REPOSITORY}"
GITHUB_URL = f"https://github.com/{GITHUB_PATH}"
DOWNLOAD_URL = "{}/archive/{}.zip".format(GITHUB_URL, VERSION)
DOWNLOAD_URL = f"{GITHUB_URL}/archive/{VERSION}.zip"
MODULES_TO_CYTHONIZE = [
"aioesphomeapi/client_callbacks.py",