Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hoh committed Jan 25, 2023
1 parent b7a625a commit 1d3be30
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 104 deletions.
3 changes: 2 additions & 1 deletion src/aleph_client/chains/cosmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import ecdsa
from cosmospy._wallet import privkey_to_address, privkey_to_pubkey

from .common import BaseAccount, get_fallback_private_key, get_verification_buffer
from .common import (BaseAccount, get_fallback_private_key,
get_verification_buffer)

DEFAULT_HRP = "cosmos"

Expand Down
8 changes: 2 additions & 6 deletions src/aleph_client/chains/ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
from eth_account.messages import encode_defunct
from eth_account.signers.local import LocalAccount

from .common import (
BaseAccount,
get_fallback_private_key,
get_public_key,
get_verification_buffer,
)
from .common import (BaseAccount, get_fallback_private_key, get_public_key,
get_verification_buffer)


class ETHAccount(BaseAccount):
Expand Down
8 changes: 2 additions & 6 deletions src/aleph_client/chains/nuls1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@

from coincurve.keys import PrivateKey, PublicKey

from .common import (
BaseAccount,
get_fallback_private_key,
get_public_key,
get_verification_buffer,
)
from .common import (BaseAccount, get_fallback_private_key, get_public_key,
get_verification_buffer)

LOGGER = logging.getLogger("NULS")

Expand Down
18 changes: 5 additions & 13 deletions src/aleph_client/chains/nuls2.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import base64

from nuls2.model.data import (
NETWORKS,
address_from_hash,
public_key_to_hash,
sign_recoverable_message,
)

from .common import (
BaseAccount,
get_fallback_private_key,
get_public_key,
get_verification_buffer,
)
from nuls2.model.data import (NETWORKS, address_from_hash, public_key_to_hash,
sign_recoverable_message)

from .common import (BaseAccount, get_fallback_private_key, get_public_key,
get_verification_buffer)


def get_address(public_key=None, private_key=None, chain_id=1, prefix="NULS"):
Expand Down
3 changes: 2 additions & 1 deletion src/aleph_client/chains/tezos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from nacl.public import SealedBox
from nacl.signing import SigningKey

from .common import BaseAccount, get_fallback_private_key, get_verification_buffer
from .common import (BaseAccount, get_fallback_private_key,
get_verification_buffer)


class TezosAccount(BaseAccount):
Expand Down
18 changes: 5 additions & 13 deletions src/aleph_client/commands/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,15 @@
from zipfile import BadZipFile

import typer
from aleph_message.models import (
MessagesResponse,
ProgramContent,
ProgramMessage,
StoreMessage,
)
from aleph_message.models import (MessagesResponse, ProgramContent,
ProgramMessage, StoreMessage)

from aleph_client import AuthenticatedUserSession
from aleph_client.account import _load_account
from aleph_client.commands import help_strings
from aleph_client.commands.utils import (
input_multiline,
prompt_for_volumes,
setup_logging,
volume_to_dict,
yes_no_input,
)
from aleph_client.commands.utils import (input_multiline, prompt_for_volumes,
setup_logging, volume_to_dict,
yes_no_input)
from aleph_client.conf import settings
from aleph_client.types import AccountFromPrivateKey, StorageEnum
from aleph_client.utils import create_archive
Expand Down
50 changes: 12 additions & 38 deletions src/aleph_client/user_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,25 @@
import time
from datetime import datetime
from pathlib import Path
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Dict,
Iterable,
List,
Mapping,
NoReturn,
Optional,
Tuple,
Type,
TypeVar,
Union,
)
from typing import (Any, AsyncIterable, Awaitable, Callable, Dict, Iterable,
List, Mapping, NoReturn, Optional, Tuple, Type, TypeVar,
Union)

import aiohttp
from aleph_message.models import (
AggregateContent,
AggregateMessage,
AlephMessage,
ForgetContent,
ForgetMessage,
ItemType,
Message,
MessageType,
PostContent,
PostMessage,
ProgramMessage,
StoreContent,
StoreMessage,
)
from aleph_message.models import (AggregateContent, AggregateMessage,
AlephMessage, ForgetContent, ForgetMessage,
ItemType, Message, MessageType, PostContent,
PostMessage, ProgramMessage, StoreContent,
StoreMessage)
from aleph_message.models.program import Encoding, ProgramContent
from pydantic import ValidationError

from aleph_client.types import Account, GenericMessage, MessageStatus, StorageEnum
from aleph_client.types import (Account, GenericMessage, MessageStatus,
StorageEnum)

from .conf import settings
from .exceptions import (
BroadcastError,
InvalidMessageError,
MessageNotFoundError,
MultipleMessagesError,
)
from .exceptions import (BroadcastError, InvalidMessageError,
MessageNotFoundError, MultipleMessagesError)
from .models import MessagesResponse
from .utils import get_message_type_value

Expand Down
12 changes: 2 additions & 10 deletions src/aleph_client/vm/app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
from dataclasses import dataclass
from typing import (
Any,
Awaitable,
Callable,
Dict,
List,
Mapping,
MutableMapping,
Optional,
)
from typing import (Any, Awaitable, Callable, Dict, List, Mapping,
MutableMapping, Optional)

AsgiApplication = Callable

Expand Down
9 changes: 2 additions & 7 deletions tests/unit/test_asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
from unittest.mock import AsyncMock, MagicMock

import pytest as pytest
from aleph_message.models import (
AggregateMessage,
ForgetMessage,
PostMessage,
ProgramMessage,
StoreMessage,
)
from aleph_message.models import (AggregateMessage, ForgetMessage, PostMessage,
ProgramMessage, StoreMessage)

from aleph_client import AuthenticatedUserSession
from aleph_client.types import Account, MessageStatus, StorageEnum
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_chain_nuls1_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from coincurve.keys import PrivateKey

from aleph_client.chains.common import get_fallback_private_key
from aleph_client.chains.nuls1 import LOGGER, MESSAGE_TEMPLATE, NulsSignature, VarInt
from aleph_client.chains.nuls1 import (LOGGER, MESSAGE_TEMPLATE, NulsSignature,
VarInt)

SECRET = (
b"\xc4\xfe\xe65\x96\x14\xb4:\r: \x05;\x12j\x9bJ"
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from aleph_message.models import (
AggregateMessage,
ForgetMessage,
MessageType,
PostMessage,
ProgramMessage,
StoreMessage,
)
from aleph_message.models import (AggregateMessage, ForgetMessage, MessageType,
PostMessage, ProgramMessage, StoreMessage)

from aleph_client.utils import get_message_type_value

Expand Down

0 comments on commit 1d3be30

Please sign in to comment.