Skip to content

[Lint] Reformat with latest black version #93

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

Merged
merged 2 commits into from
Feb 1, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/httpgateway.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Server metrics upload.
"""

# -*- coding: utf-8 -*-

import click
Expand Down
1 change: 1 addition & 0 deletions examples/metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Server metrics upload.
"""

import asyncio
import os
import platform
Expand Down
1 change: 1 addition & 0 deletions examples/mqtt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Server metrics upload.
"""

# -*- coding: utf-8 -*-

import asyncio
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ exclude =
dist
.eggs
docs/conf.py
ignore = E501 W291 W503 E203
ignore = E501 W291 W503 E203 E704

[isort]
profile = black
Expand Down
1 change: 1 addition & 0 deletions src/aleph/sdk/chains/nuls1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Barebone NULS address and message signing support.
"""

import hashlib
import logging
import struct
Expand Down
1 change: 1 addition & 0 deletions src/aleph/sdk/chains/remote.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Remote account, accessible via an API.
"""

import asyncio
from typing import Dict, Optional

Expand Down
16 changes: 10 additions & 6 deletions src/aleph/sdk/client/authenticated_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,11 @@ async def create_program(
runtime=FunctionRuntime(
ref=runtime,
use_latest=True,
comment="Official aleph.im runtime"
if runtime == settings.DEFAULT_RUNTIME_ID
else "",
comment=(
"Official aleph.im runtime"
if runtime == settings.DEFAULT_RUNTIME_ID
else ""
),
),
volumes=[MachineVolume.parse_obj(volume) for volume in volumes],
time=time.time(),
Expand Down Expand Up @@ -551,9 +553,11 @@ async def create_instance(
size_mib=rootfs_size,
persistence="host",
use_latest=True,
comment="Official Aleph Debian root filesystem"
if rootfs == settings.DEFAULT_RUNTIME_ID
else "",
comment=(
"Official Aleph Debian root filesystem"
if rootfs == settings.DEFAULT_RUNTIME_ID
else ""
),
),
volumes=[MachineVolume.parse_obj(volume) for volume in volumes],
time=time.time(),
Expand Down
4 changes: 3 additions & 1 deletion src/aleph/sdk/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class Settings(BaseSettings):
REMOTE_CRYPTO_UNIX_SOCKET: Optional[str] = None
ADDRESS_TO_USE: Optional[str] = None

DEFAULT_RUNTIME_ID: str = "f873715dc2feec3833074bd4b8745363a0e0093746b987b4c8191268883b2463" # Debian 12 official runtime
DEFAULT_RUNTIME_ID: str = (
"f873715dc2feec3833074bd4b8745363a0e0093746b987b4c8191268883b2463" # Debian 12 official runtime
)
DEFAULT_VM_MEMORY: int = 256
DEFAULT_VM_VCPUS: int = 1
DEFAULT_VM_TIMEOUT: float = 30.0
Expand Down
12 changes: 4 additions & 8 deletions src/aleph/sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,19 @@ class Account(Protocol):
CURVE: str

@abstractmethod
async def sign_message(self, message: Dict) -> Dict:
...
async def sign_message(self, message: Dict) -> Dict: ...

@abstractmethod
def get_address(self) -> str:
...
def get_address(self) -> str: ...

@abstractmethod
def get_public_key(self) -> str:
...
def get_public_key(self) -> str: ...


class AccountFromPrivateKey(Account, Protocol):
"""Only accounts that are initialized from a private key string are supported."""

def __init__(self, private_key: bytes):
...
def __init__(self, private_key: bytes): ...


GenericMessage = TypeVar("GenericMessage", bound=AlephMessage)
6 changes: 2 additions & 4 deletions src/aleph/sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ def check_unix_socket_valid(unix_socket_path: str) -> bool:


class AsyncReadable(Protocol[T]):
async def read(self, n: int = -1) -> T:
...
async def read(self, n: int = -1) -> T: ...


class Writable(Protocol[U]):
def write(self, buffer: U) -> int:
...
def write(self, buffer: U) -> int: ...


async def copy_async_readable_to_buffer(
Expand Down
12 changes: 5 additions & 7 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def json_post() -> dict:
@pytest.fixture
def raw_messages_response(aleph_messages) -> Callable[[int], Dict[str, Any]]:
return lambda page: {
"messages": [message.dict() for message in aleph_messages]
if int(page) == 1
else [],
"messages": (
[message.dict() for message in aleph_messages] if int(page) == 1 else []
),
"pagination_item": "messages",
"pagination_page": int(page),
"pagination_per_page": max(len(aleph_messages), 20),
Expand All @@ -158,11 +158,9 @@ def __init__(self, sync: bool):
async def __aenter__(self):
return self

async def __aexit__(self, exc_type, exc_val, exc_tb):
...
async def __aexit__(self, exc_type, exc_val, exc_tb): ...

async def raise_for_status(self):
...
async def raise_for_status(self): ...

@property
def status(self):
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_chain_nuls1_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This file tests that both implementations returns identical results.
"""

from pathlib import Path
from tempfile import NamedTemporaryFile

Expand Down