Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 16, 2024
1 parent af7d925 commit ca2040c
Show file tree
Hide file tree
Showing 65 changed files with 15 additions and 84 deletions.
1 change: 0 additions & 1 deletion proto/hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Dynamically generate protobuf python code."""


from __future__ import annotations

import os
Expand Down
1 change: 0 additions & 1 deletion src/ota_metadata/legacy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"""


from __future__ import annotations

import atexit
Expand Down
1 change: 0 additions & 1 deletion src/ota_metadata/utils/cert_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Implementation of otaclient CA cert chain store."""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/ota_proxy/cache_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Implementation of cache streaming."""


from __future__ import annotations

import asyncio
Expand Down
2 changes: 0 additions & 2 deletions src/ota_proxy/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def export_headers_to_client(self) -> CIMultiDict[str]:


class CacheMetaORM(ORMBase[CacheMeta]):

def cachemeta_create_indexes(self) -> None:
_indexes = {
"bucket_idx_index": CacheMeta.table_create_index_stmt(
Expand All @@ -138,7 +137,6 @@ def cachemeta_create_indexes(self) -> None:


class AsyncCacheMetaORM(AsyncORMBase[CacheMeta]):

async def rotate_cache(
self, bucket_idx: int, num: int
) -> Optional[list[CacheMeta]]:
Expand Down
1 change: 0 additions & 1 deletion src/ota_proxy/external_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Implementation of mounting/umounting external cache."""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/ota_proxy/lru_cache_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Implementation of OTA cache control."""


from __future__ import annotations

import bisect
Expand Down
4 changes: 3 additions & 1 deletion src/ota_proxy/ota_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ async def _do_request() -> AsyncIterator[bytes]:
yield data

# open remote connection
resp_headers: CIMultiDictProxy[str] = await (_remote_fd := _do_request()).__anext__() # type: ignore
resp_headers: CIMultiDictProxy[str] = await (
_remote_fd := _do_request()
).__anext__() # type: ignore
return _remote_fd, resp_headers

async def _retrieve_file_by_cache_lookup(
Expand Down
2 changes: 1 addition & 1 deletion src/ota_proxy/server_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def parse_raw_headers(raw_headers: List[Tuple[bytes, bytes]]) -> Dict[str, str]:


def encode_headers(
headers: Union[CIMultiDict[str], CIMultiDictProxy[str]]
headers: Union[CIMultiDict[str], CIMultiDictProxy[str]],
) -> List[Tuple[bytes, bytes]]:
"""Encode headers dict to list of bytes tuples for sending back to client.
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Configure the logging for otaclient."""


from __future__ import annotations

import atexit
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/_otaproxy_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
The API exposed by this module is meant to be controlled by otaproxy managing thread only.
"""


from __future__ import annotations

import asyncio
Expand Down
2 changes: 0 additions & 2 deletions src/otaclient/_status_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""The implementation of tracking otaclient operation status."""


from __future__ import annotations

import atexit
Expand Down Expand Up @@ -72,7 +71,6 @@ class SetOTAClientMetaReport:

@dataclass
class UpdateProgressReport:

class Type(Enum):
# NOTE: PREPARE_LOCAL, DOWNLOAD_REMOTE and APPLY_DELTA are together
# counted as <processed_files_*>
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""OTAClient internal used types."""


from __future__ import annotations

import multiprocessing.synchronize as mp_sync
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Common shared utils, only used by otaclient package."""


from __future__ import annotations

import itertools
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_firmware_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
```
"""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
still expecting new mechanism to fundamentally resolve this issue.
"""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_jetson_cboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Supports BSP version < R34.
"""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_jetson_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
This module is shared by jetson-cboot and jetson-uefi bootloader type.
"""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_jetson_uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
But firmware update is only supported after BSP R35.2.
"""


from __future__ import annotations

import contextlib
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_ota_status_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Shared utils for boot_controller."""


from __future__ import annotations

import contextlib
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_rpi_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Boot control support for Raspberry pi 4 Model B."""


from __future__ import annotations

import contextlib
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/boot_control/_slot_mnt_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Helper for mounting/umount slots during OTA."""


from __future__ import annotations

import atexit
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class DefaultOTAClientConfigs(ConfigurableSettings, Consts):
else:

class DefaultOTAClientConfigs:

def __init__(self) -> None:
self._cfg_consts = Consts()
self._cfg_configurable = ConfigurableSettings()
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/configs/_cfg_configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Runtime configurable configs for otaclient."""


from __future__ import annotations

import logging
Expand Down
2 changes: 0 additions & 2 deletions src/otaclient/configs/_cfg_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""otaclient internal uses consts, should not be changed from external."""


from __future__ import annotations

from otaclient_common import replace_root
Expand All @@ -29,7 +28,6 @@ class CreateStandbyMechanism(StrEnum):


class Consts:

CANONICAL_ROOT = CANONICAL_ROOT

@property
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/configs/_ecu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""ECU metadatas definition and parsing logic."""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/configs/_proxy_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""proxy_info.yaml definition and parsing logic."""


from __future__ import annotations

import logging
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/configs/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class _OTAClientConfigs(ConfigurableSettings, Consts):
else:

class _OTAClientConfigs:

# NOTE(20241108): still use __getattr__ to allow changing/mocking attributes
# for easy testing.
def __getattr__(self, name: str) -> Any:
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/create_standby/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Common used helpers, classes and functions for different bank creating methods."""


from __future__ import annotations

import contextlib
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/create_standby/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
update to the standby slot.
"""


from __future__ import annotations

from abc import abstractmethod
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""OTA error code definition"""


from __future__ import annotations

from enum import Enum, unique
Expand Down
2 changes: 0 additions & 2 deletions src/otaclient/grpc/api_v2/ecu_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
any_requires_network, all_success, in_update_ecus_id, failed_ecus_id, success_ecus_id and in_update_childecus_id.
"""


from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -82,7 +81,6 @@ def discard(self, value: T):


class ECUStatusStorage:

def __init__(
self,
*,
Expand Down
2 changes: 0 additions & 2 deletions src/otaclient/grpc/api_v2/ecu_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Tracker that queries and stores ECU status from all defined ECUs."""


from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -48,7 +47,6 @@


class ECUTracker:

def __init__(
self,
ecu_status_storage: ECUStatusStorage,
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/grpc/api_v2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Main entry for OTA API v2 grpc server."""


from __future__ import annotations

import asyncio
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/grpc/api_v2/servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""OTA Service API v2 implementation."""


from __future__ import annotations

import asyncio
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/grpc/api_v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Helpers for converting otaclient internal used types into api_v2 types."""


from __future__ import annotations

import time
Expand Down
1 change: 0 additions & 1 deletion src/otaclient/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Entrypoint of otaclient."""


from __future__ import annotations

import atexit
Expand Down
3 changes: 0 additions & 3 deletions src/otaclient/ota_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ def execute(self):


class OTAClient:

def __init__(
self,
*,
Expand Down Expand Up @@ -840,7 +839,6 @@ def main(
)

elif isinstance(request, UpdateRequestV2):

_update_thread = threading.Thread(
target=self.update,
args=[request],
Expand Down Expand Up @@ -877,7 +875,6 @@ def main(
)
_allow_request_after = _now + HOLD_REQ_HANDLING_ON_ACK_REQUEST
else:

_err_msg = f"request is invalid: {request=}, {self._live_ota_status=}"
logger.error(_err_msg)
resp_queue.put_nowait(
Expand Down
1 change: 0 additions & 1 deletion src/otaclient_api/v2/api_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""OTAClient API caller implementation."""


from __future__ import annotations

import grpc.aio
Expand Down
1 change: 0 additions & 1 deletion src/otaclient_api/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Defined wrappers for otaclient_v2 protobuf message types."""


from __future__ import annotations

from abc import abstractmethod
Expand Down
1 change: 0 additions & 1 deletion src/otaclient_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Common shared libs for otaclient."""


from __future__ import annotations

import importlib.util
Expand Down
1 change: 0 additions & 1 deletion src/otaclient_common/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Common shared helper functions for IO."""


from __future__ import annotations

import hashlib
Expand Down
Loading

0 comments on commit ca2040c

Please sign in to comment.