diff --git a/examples/utils/__init__.py b/examples/utils/__init__.py index 885bf1a16..90ebf0e8f 100644 --- a/examples/utils/__init__.py +++ b/examples/utils/__init__.py @@ -1,4 +1,5 @@ """Utilities for yapapi example scripts.""" + import argparse import asyncio import tempfile diff --git a/pyproject.toml b/pyproject.toml index fd0382ef7..79519853c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ sphinx-rtd-theme = { version = "^1.0.0", optional = true} docs = ['sphinx', 'sphinx-autodoc-typehints', 'sphinx-rtd-theme'] [tool.poetry.group.dev.dependencies] -black = "^23.1.0" +black = "^24.4.2" factory-boy = "^3.2.0" isort = "^5.10.1" liccheck = "^0.4.7" diff --git a/tests/engine/test_engine.py b/tests/engine/test_engine.py index 357ca483d..c1184df77 100644 --- a/tests/engine/test_engine.py +++ b/tests/engine/test_engine.py @@ -1,4 +1,5 @@ """Unit tests for `yapapi.engine` module.""" + from unittest.mock import Mock import pytest diff --git a/tests/goth_tests/___test_resubscription.py b/tests/goth_tests/___test_resubscription.py index 9de34ad1e..2da7c4c63 100644 --- a/tests/goth_tests/___test_resubscription.py +++ b/tests/goth_tests/___test_resubscription.py @@ -1,4 +1,5 @@ """Test if subscription expiration is handled correctly by Golem.""" + import logging import os import time diff --git a/tests/goth_tests/assertions.py b/tests/goth_tests/assertions.py index 69c19c891..9ec24ce2e 100644 --- a/tests/goth_tests/assertions.py +++ b/tests/goth_tests/assertions.py @@ -6,6 +6,7 @@ the string "Agreement confirmed by provider P", for any name P, then eventually it will also print a line containing "Accepted invoice from P". """ + import logging import re from typing import Set diff --git a/tests/goth_tests/test_agreement_termination/test_agreement_termination.py b/tests/goth_tests/test_agreement_termination/test_agreement_termination.py index 91cf1a802..3ac8bf373 100644 --- a/tests/goth_tests/test_agreement_termination/test_agreement_termination.py +++ b/tests/goth_tests/test_agreement_termination/test_agreement_termination.py @@ -1,4 +1,5 @@ """A goth test scenario for agreement termination.""" + import logging import os import re diff --git a/tests/goth_tests/test_mid_agreement_payments/test_mid_agreement_payments.py b/tests/goth_tests/test_mid_agreement_payments/test_mid_agreement_payments.py index 21f65fef6..aab25fc17 100644 --- a/tests/goth_tests/test_mid_agreement_payments/test_mid_agreement_payments.py +++ b/tests/goth_tests/test_mid_agreement_payments/test_mid_agreement_payments.py @@ -1,4 +1,5 @@ """A goth test scenario for mid-agreement payments.""" + import logging import os import re diff --git a/tests/goth_tests/test_multiactivity_agreement/test_multiactivity_agreement.py b/tests/goth_tests/test_multiactivity_agreement/test_multiactivity_agreement.py index 134b25b93..9d510e7d3 100644 --- a/tests/goth_tests/test_multiactivity_agreement/test_multiactivity_agreement.py +++ b/tests/goth_tests/test_multiactivity_agreement/test_multiactivity_agreement.py @@ -1,4 +1,5 @@ """A goth test scenario for multi-activity agreements.""" + import logging import os import re diff --git a/tests/goth_tests/test_recycle_ip/test_recycle_ip.py b/tests/goth_tests/test_recycle_ip/test_recycle_ip.py index 6b4bd9034..c19452c2c 100644 --- a/tests/goth_tests/test_recycle_ip/test_recycle_ip.py +++ b/tests/goth_tests/test_recycle_ip/test_recycle_ip.py @@ -1,4 +1,5 @@ """An integration test scenario that runs the SSH example requestor app.""" + import asyncio import logging import os diff --git a/tests/goth_tests/test_run_custom_usage_counter.py b/tests/goth_tests/test_run_custom_usage_counter.py index 9585e97e6..6a2c566d4 100644 --- a/tests/goth_tests/test_run_custom_usage_counter.py +++ b/tests/goth_tests/test_run_custom_usage_counter.py @@ -1,4 +1,5 @@ """An integration test scenario that runs custom usage counter example requestor app.""" + import logging import os import re diff --git a/tests/goth_tests/test_run_scan.py b/tests/goth_tests/test_run_scan.py index 6f6cc7955..9d14f342d 100644 --- a/tests/goth_tests/test_run_scan.py +++ b/tests/goth_tests/test_run_scan.py @@ -1,4 +1,5 @@ """An integration test scenario that runs the `scan` example.""" + import asyncio import logging import os diff --git a/tests/goth_tests/test_run_simple_service.py b/tests/goth_tests/test_run_simple_service.py index f2a87c54d..1e3abf62c 100644 --- a/tests/goth_tests/test_run_simple_service.py +++ b/tests/goth_tests/test_run_simple_service.py @@ -1,4 +1,5 @@ """An integration test scenario that runs the Simple Service example requestor app.""" + import logging import os import time diff --git a/tests/goth_tests/test_run_ssh.py b/tests/goth_tests/test_run_ssh.py index c719f2148..9a6f844fc 100644 --- a/tests/goth_tests/test_run_ssh.py +++ b/tests/goth_tests/test_run_ssh.py @@ -1,4 +1,5 @@ """An integration test scenario that runs the SSH example requestor app.""" + import asyncio import logging import os diff --git a/tests/goth_tests/test_run_webapp.py b/tests/goth_tests/test_run_webapp.py index fa31c47a2..2bace1470 100644 --- a/tests/goth_tests/test_run_webapp.py +++ b/tests/goth_tests/test_run_webapp.py @@ -1,4 +1,5 @@ """An integration test scenario that runs the `webapp` example.""" + import asyncio import logging import os diff --git a/tests/test_log.py b/tests/test_log.py index 2d1e99c5f..117862964 100644 --- a/tests/test_log.py +++ b/tests/test_log.py @@ -1,4 +1,5 @@ """Unit tests for the `yapapi.log` module.""" + import logging import os import sys diff --git a/tests/test_payment_platforms.py b/tests/test_payment_platforms.py index 0b60d612f..987b85575 100644 --- a/tests/test_payment_platforms.py +++ b/tests/test_payment_platforms.py @@ -1,4 +1,5 @@ """Unit tests for code that selects payment platforms based on driver/network specification.""" + from unittest import mock import pytest diff --git a/yapapi/__init__.py b/yapapi/__init__.py index feac6b86b..51a60d71c 100644 --- a/yapapi/__init__.py +++ b/yapapi/__init__.py @@ -1,4 +1,5 @@ """Golem Python API.""" + import asyncio import sys from pathlib import Path diff --git a/yapapi/contrib/service/http_proxy.py b/yapapi/contrib/service/http_proxy.py index bcf7c8ff9..baf6c872d 100644 --- a/yapapi/contrib/service/http_proxy.py +++ b/yapapi/contrib/service/http_proxy.py @@ -8,6 +8,7 @@ `webapp `_ examples in the yapapi repository. """ + import abc import asyncio import logging diff --git a/yapapi/contrib/service/socket_proxy.py b/yapapi/contrib/service/socket_proxy.py index 0ae0a51c1..6225ccdda 100644 --- a/yapapi/contrib/service/socket_proxy.py +++ b/yapapi/contrib/service/socket_proxy.py @@ -7,6 +7,7 @@ `ssh `_ example in the yapapi repository. """ + import abc import asyncio import itertools diff --git a/yapapi/contrib/strategy/provider_filter.py b/yapapi/contrib/strategy/provider_filter.py index 485ca3552..137eb6e92 100644 --- a/yapapi/contrib/strategy/provider_filter.py +++ b/yapapi/contrib/strategy/provider_filter.py @@ -4,6 +4,7 @@ a simple boolean condition, while preserving correct scoring of the remaining offers by the base strategy. """ + import inspect from typing import Awaitable, Callable, Union diff --git a/yapapi/ctx.py b/yapapi/ctx.py index 2a1ffa0d5..af99f066c 100644 --- a/yapapi/ctx.py +++ b/yapapi/ctx.py @@ -28,8 +28,7 @@ class ExecOptions: class WorkContextEmitter(Protocol): - def __call__(self, event_class: Type[ActivityEventType], **kwargs) -> ActivityEventType: - ... + def __call__(self, event_class: Type[ActivityEventType], **kwargs) -> ActivityEventType: ... class WorkContext: diff --git a/yapapi/engine.py b/yapapi/engine.py index f34261ab2..8843ef83d 100644 --- a/yapapi/engine.py +++ b/yapapi/engine.py @@ -143,9 +143,11 @@ def __init__( self._payment_token: str = ( payment_token.lower() if payment_token - else MAINNET_TOKEN_NAME - if self._payment_network in MAINNET_NETWORKS - else TESTNET_TOKEN_NAME + else ( + MAINNET_TOKEN_NAME + if self._payment_network in MAINNET_NETWORKS + else TESTNET_TOKEN_NAME + ) ) self._stream_output = stream_output diff --git a/yapapi/executor/__init__.py b/yapapi/executor/__init__.py index 6a6ca2e5c..24d697d84 100644 --- a/yapapi/executor/__init__.py +++ b/yapapi/executor/__init__.py @@ -1,4 +1,5 @@ """An implementation of the new Golem's task executor.""" + import asyncio import sys from asyncio import CancelledError diff --git a/yapapi/executor/task.py b/yapapi/executor/task.py index c05b6b527..c42712a52 100644 --- a/yapapi/executor/task.py +++ b/yapapi/executor/task.py @@ -34,8 +34,9 @@ class TaskStatus(Enum): class TaskEmitter(Protocol): - def __call__(self, event_class: Type[events.TaskEventType], **kwargs) -> events.TaskEventType: - ... + def __call__( + self, event_class: Type[events.TaskEventType], **kwargs + ) -> events.TaskEventType: ... class Task(Generic[TaskData, TaskResult]): diff --git a/yapapi/log.py b/yapapi/log.py index c539ddba3..dc19c944a 100644 --- a/yapapi/log.py +++ b/yapapi/log.py @@ -41,6 +41,7 @@ ) ``` """ + import inspect import logging import os diff --git a/yapapi/props/com.py b/yapapi/props/com.py index 2de0b1214..714de25cd 100644 --- a/yapapi/props/com.py +++ b/yapapi/props/com.py @@ -1,4 +1,5 @@ """Payment-related properties.""" + import abc import enum from typing import Any, Dict, List diff --git a/yapapi/services/cluster.py b/yapapi/services/cluster.py index 00543a0d4..278116ab8 100644 --- a/yapapi/services/cluster.py +++ b/yapapi/services/cluster.py @@ -1,4 +1,5 @@ """Implementation of high-level services API.""" + import itertools from contextlib import AsyncExitStack from datetime import datetime, timedelta, timezone diff --git a/yapapi/services/service.py b/yapapi/services/service.py index 35ee7b769..07735a5e2 100644 --- a/yapapi/services/service.py +++ b/yapapi/services/service.py @@ -436,13 +436,15 @@ def serialize(self) -> "ServiceSerialization": "activity_id": self._ctx._activity.id if self._ctx else None, "agreement_id": self._ctx._agreement.id if self._ctx else None, "state": self.state.value, - "network_node": { - "network_id": self._network_node.network.network_id, - "node_id": self._network_node.node_id, - "ip": self._network_node.ip, - } - if self._network_node - else None, + "network_node": ( + { + "network_id": self._network_node.network.network_id, + "node_id": self._network_node.node_id, + "ip": self._network_node.ip, + } + if self._network_node + else None + ), } diff --git a/yapapi/utils.py b/yapapi/utils.py index 2c2c5328c..4332c300c 100644 --- a/yapapi/utils.py +++ b/yapapi/utils.py @@ -1,4 +1,5 @@ """Utility functions and classes used within yapapi.""" + import asyncio import enum import functools