Skip to content

Commit

Permalink
bump black, fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeofblue committed Jun 3, 2024
1 parent 012b083 commit 11bf4d0
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 15 deletions.
1 change: 1 addition & 0 deletions examples/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for yapapi example scripts."""

import argparse
import asyncio
import tempfile
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/engine/test_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for `yapapi.engine` module."""

from unittest.mock import Mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/___test_resubscription.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test if subscription expiration is handled correctly by Golem."""

import logging
import os
import time
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A goth test scenario for agreement termination."""

import logging
import os
import re
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A goth test scenario for mid-agreement payments."""

import logging
import os
import re
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A goth test scenario for multi-activity agreements."""

import logging
import os
import re
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_recycle_ip/test_recycle_ip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs the SSH example requestor app."""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_run_custom_usage_counter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs custom usage counter example requestor app."""

import logging
import os
import re
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_run_scan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs the `scan` example."""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_run_simple_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs the Simple Service example requestor app."""

import logging
import os
import time
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_run_ssh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs the SSH example requestor app."""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/goth_tests/test_run_webapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An integration test scenario that runs the `webapp` example."""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the `yapapi.log` module."""

import logging
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions tests/test_payment_platforms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for code that selects payment platforms based on driver/network specification."""

from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions yapapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Golem Python API."""

import asyncio
import sys
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions yapapi/contrib/service/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
`webapp <https://github.com/golemfactory/yapapi/tree/master/examples/webapp>`_ examples in the
yapapi repository.
"""

import abc
import asyncio
import logging
Expand Down
1 change: 1 addition & 0 deletions yapapi/contrib/service/socket_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
`ssh <https://github.com/golemfactory/yapapi/tree/master/examples/ssh>`_ example in the
yapapi repository.
"""

import abc
import asyncio
import itertools
Expand Down
1 change: 1 addition & 0 deletions yapapi/contrib/strategy/provider_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions yapapi/ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions yapapi/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions yapapi/executor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An implementation of the new Golem's task executor."""

import asyncio
import sys
from asyncio import CancelledError
Expand Down
5 changes: 3 additions & 2 deletions yapapi/executor/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down
1 change: 1 addition & 0 deletions yapapi/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
)
```
"""

import inspect
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions yapapi/props/com.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Payment-related properties."""

import abc
import enum
from typing import Any, Dict, List
Expand Down
1 change: 1 addition & 0 deletions yapapi/services/cluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of high-level services API."""

import itertools
from contextlib import AsyncExitStack
from datetime import datetime, timedelta, timezone
Expand Down
16 changes: 9 additions & 7 deletions yapapi/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
}


Expand Down
1 change: 1 addition & 0 deletions yapapi/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions and classes used within yapapi."""

import asyncio
import enum
import functools
Expand Down

0 comments on commit 11bf4d0

Please sign in to comment.