Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pyupgrade from 2.34.0 to 3.15.2 #3662

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions custom_components/hacs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import asyncio
from collections.abc import Awaitable, Callable
from dataclasses import asdict, dataclass, field
from datetime import timedelta
import gzip
Expand All @@ -10,7 +11,7 @@
import os
import pathlib
import shutil
from typing import TYPE_CHECKING, Any, Awaitable, Callable
from typing import TYPE_CHECKING, Any

from aiogithubapi import (
AIOGitHubAPIException,
Expand Down Expand Up @@ -742,7 +743,7 @@ async def async_download_file(
raise HacsException(
f"Got status code {request.status} when trying to download {url}"
)
except asyncio.TimeoutError:
except TimeoutError:
self.log.warning(
"A timeout of 60! seconds was encountered while downloading %s, "
"using over 60 seconds to download a single file is not normal. "
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hacs/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

from collections.abc import Callable
from typing import Any, Callable
from typing import Any

from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.helpers.update_coordinator import BaseDataUpdateCoordinatorProtocol
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hacs/data_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def _do_request(
response.raise_for_status()
except HacsNotModifiedException:
raise
except asyncio.TimeoutError:
except TimeoutError:
raise HacsException("Timeout of 60s reached") from None
except Exception as exception:
raise HacsException(f"Error fetching data from HACS: {exception}") from exception
Expand Down
3 changes: 2 additions & 1 deletion custom_components/hacs/utils/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from __future__ import annotations

import asyncio
from collections.abc import Coroutine
from functools import wraps
from typing import TYPE_CHECKING, Any, Coroutine
from typing import TYPE_CHECKING, Any

from ..const import DEFAULT_CONCURRENT_BACKOFF_TIME, DEFAULT_CONCURRENT_TASKS

Expand Down
2 changes: 1 addition & 1 deletion custom_components/hacs/utils/queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from __future__ import annotations

import asyncio
from collections.abc import Coroutine
import time
from typing import Coroutine

from homeassistant.core import HomeAssistant

Expand Down
2 changes: 1 addition & 1 deletion requirements_lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ codespell==2.2.6
isort==5.13.2
pre-commit==3.7.0
pre-commit-hooks==4.6.0
pyupgrade==2.34.0
pyupgrade==3.15.2
vulture==2.11
4 changes: 2 additions & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from __future__ import annotations

import asyncio
from collections.abc import AsyncGenerator, Mapping, Sequence
from collections.abc import AsyncGenerator, Iterable, Mapping, Sequence
from contextlib import asynccontextmanager, contextmanager
from contextvars import ContextVar
import functools as ft
from inspect import currentframe
import json as json_func
import os
from types import NoneType
from typing import Any, Iterable, TypedDict, TypeVar
from typing import Any, TypedDict, TypeVar
from unittest.mock import AsyncMock, Mock, patch

from aiohttp import ClientError, ClientSession, ClientWebSocketResponse
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from . import patch_time # noqa: F401, isort:skip
import asyncio
from collections import OrderedDict
from collections.abc import Generator
from dataclasses import asdict
from glob import iglob
import json
import logging
import os
import shutil
from typing import Any, Generator
from typing import Any
from unittest.mock import MagicMock, patch

from _pytest.assertion.util import _compare_eq_iterable
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/test_download_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator
from collections.abc import Generator

from homeassistant.core import HomeAssistant
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/test_register_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator
from collections.abc import Generator

from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/test_remove_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Generator
import os
from pathlib import Path
from typing import Generator

from homeassistant.core import HomeAssistant
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/test_update_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Generator
import json
import re
from typing import Generator
from unittest.mock import patch

from homeassistant.core import HomeAssistant, HomeAssistantError
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import Generator
from collections.abc import Generator
from unittest.mock import patch

from aiogithubapi import GitHubException
Expand Down
3 changes: 2 additions & 1 deletion tests/test_system_health.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Test system health."""

import asyncio
from typing import Any, Generator
from collections.abc import Generator
from typing import Any

from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
Expand Down
2 changes: 1 addition & 1 deletion tests/test_update.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Test update entity."""

from collections.abc import Generator
import json as json_func
import os
from typing import Generator

from freezegun.api import FrozenDateTimeFactory
from homeassistant.core import HomeAssistant
Expand Down