Skip to content

Commit

Permalink
isort: Remove the remaining exceptions and sort the related files (Ch…
Browse files Browse the repository at this point in the history
  • Loading branch information
xdustinface authored Dec 13, 2022
1 parent 6467bd0 commit 42f6a88
Show file tree
Hide file tree
Showing 24 changed files with 151 additions and 148 deletions.
25 changes: 0 additions & 25 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,3 @@ line_length = 120
profile=black
skip_gitignore=true
add_imports=from __future__ import annotations
# venv/bin/isort --check . |& sed -n "s;ERROR: ${PWD}/\(.*\) Imports are.*; \1;p" | sort | uniq
extend_skip=
chia/clvm/spend_sim.py
chia/introducer/introducer.py
chia/plotters/bladebit.py
chia/plotters/chiapos.py
chia/plotters/madmax.py
chia/plotters/plotters.py
chia/pools/pool_puzzles.py
chia/pools/pool_wallet_info.py
chia/pools/pool_wallet.py
chia/protocols/pool_protocol.py
chia/protocols/protocol_state_machine.py
chia/rpc/full_node_rpc_client.py
chia/rpc/rpc_client.py
chia/rpc/wallet_rpc_api.py
chia/rpc/wallet_rpc_client.py
chia/seeder/crawler.py
chia/seeder/crawl_store.py
chia/seeder/dns_server.py
chia/simulator/simulator_constants.py
chia/simulator/start_simulator.py
chia/ssl/create_ssl.py
chia/timelord/timelord_launcher.py
tools/analyze-chain.py
43 changes: 22 additions & 21 deletions chia/clvm/spend_sim.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import random
from pathlib import Path
from __future__ import annotations

import random
from dataclasses import dataclass
from typing import Optional, List, Dict, Tuple, Any, Type, TypeVar, Callable
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar

from chia.types.blockchain_format.sized_bytes import bytes32
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
from chia.consensus.constants import ConsensusConstants
from chia.consensus.cost_calculator import NPCResult
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.full_node.bundle_tools import simple_solution_generator
from chia.full_node.coin_store import CoinStore
from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin
from chia.full_node.mempool_manager import MempoolManager
from chia.types.blockchain_format.coin import Coin
from chia.types.mempool_item import MempoolItem
from chia.util.ints import uint64, uint32
from chia.util.hash import std_hash
from chia.util.errors import Err, ValidationError
from chia.util.db_wrapper import DBWrapper2
from chia.util.streamable import Streamable, streamable
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_record import CoinRecord
from chia.types.spend_bundle import SpendBundle
from chia.types.coin_spend import CoinSpend
from chia.types.generator_types import BlockGenerator
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
from chia.types.coin_spend import CoinSpend
from chia.full_node.bundle_tools import simple_solution_generator
from chia.full_node.mempool_manager import MempoolManager
from chia.full_node.coin_store import CoinStore
from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin
from chia.consensus.constants import ConsensusConstants
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.consensus.coinbase import create_pool_coin, create_farmer_coin
from chia.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward
from chia.consensus.cost_calculator import NPCResult
from chia.types.mempool_item import MempoolItem
from chia.types.spend_bundle import SpendBundle
from chia.util.db_wrapper import DBWrapper2
from chia.util.errors import Err, ValidationError
from chia.util.hash import std_hash
from chia.util.ints import uint32, uint64
from chia.util.streamable import Streamable, streamable

"""
The purpose of this file is to provide a lightweight simulator for the testing of Chialisp smart contracts.
Expand Down
4 changes: 3 additions & 1 deletion chia/introducer/introducer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

import asyncio
import logging
import time
from typing import Any, Callable, Dict, List, Optional

from chia.rpc.rpc_server import default_get_connections
from chia.server.introducer_peers import VettedPeer
from chia.server.outbound_message import NodeType
from chia.server.server import ChiaServer
from chia.server.introducer_peers import VettedPeer
from chia.server.ws_connection import WSChiaConnection
from chia.util.ints import uint64

Expand Down
15 changes: 6 additions & 9 deletions chia/plotters/bladebit.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
from __future__ import annotations

import asyncio
import json
import traceback
import logging
import os
import sys
import logging

import traceback
from pathlib import Path
from typing import Any, Dict, Optional, Tuple

from chia.plotters.plotters_util import get_venv_bin, reset_loop_policy_for_windows, run_command, run_plotter
from chia.plotting.create_plots import resolve_plot_keys
from chia.plotters.plotters_util import (
run_plotter,
run_command,
reset_loop_policy_for_windows,
get_venv_bin,
)

log = logging.getLogger(__name__)

Expand Down
7 changes: 5 additions & 2 deletions chia/plotters/chiapos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
NOTE: This contains duplicate code from `chia.cmds.plots`.
After `chia plots create` becomes obsolete, consider removing it from there.
"""
from __future__ import annotations

import asyncio
import logging
import pkg_resources
from chia.plotting.create_plots import create_plots, resolve_plot_keys
from pathlib import Path
from typing import Any, Dict, Optional

import pkg_resources

from chia.plotting.create_plots import create_plots, resolve_plot_keys
from chia.plotting.util import add_plot_directory, validate_plot_size

log = logging.getLogger(__name__)
Expand Down
15 changes: 6 additions & 9 deletions chia/plotters/madmax.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
from __future__ import annotations

import asyncio
import traceback
import os
import logging
import os
import sys

import traceback
from pathlib import Path
from typing import Any, Dict, Optional

from chia.plotters.plotters_util import get_venv_bin, reset_loop_policy_for_windows, run_command, run_plotter
from chia.plotting.create_plots import resolve_plot_keys
from chia.plotters.plotters_util import (
run_plotter,
run_command,
reset_loop_policy_for_windows,
get_venv_bin,
)

log = logging.getLogger(__name__)

Expand Down
7 changes: 5 additions & 2 deletions chia/plotters/plotters.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from __future__ import annotations

import argparse
import binascii
import os
from enum import Enum
from pathlib import Path
from typing import Any, Dict, Optional

from chia.plotters.bladebit import get_bladebit_install_info, plot_bladebit
from chia.plotters.chiapos import get_chiapos_install_info, plot_chia
from chia.plotters.madmax import get_madmax_install_info, plot_madmax
from pathlib import Path
from typing import Any, Dict, Optional


class Options(Enum):
Expand Down
12 changes: 6 additions & 6 deletions chia/pools/pool_puzzles.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
from __future__ import annotations

import logging
from typing import Tuple, List, Optional
from typing import List, Optional, Tuple

from blspy import G1Element
from clvm.casts import int_from_bytes, int_to_bytes

from chia.clvm.singleton import SINGLETON_LAUNCHER
from chia.consensus.block_rewards import calculate_pool_reward
from chia.consensus.coinbase import pool_parent_id
from chia.pools.pool_wallet_info import PoolState, LEAVING_POOL, SELF_POOLING

from chia.pools.pool_wallet_info import LEAVING_POOL, SELF_POOLING, PoolState
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program, SerializedProgram

from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_spend import CoinSpend
from chia.util.ints import uint32, uint64
from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile
from chia.wallet.puzzles.singleton_top_layer import puzzle_for_singleton

from chia.util.ints import uint32, uint64

log = logging.getLogger(__name__)
# "Full" is the outer singleton, with the inner puzzle filled in
SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm")
Expand Down
61 changes: 28 additions & 33 deletions chia/pools/pool_wallet.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,59 @@
from __future__ import annotations

import asyncio
import dataclasses
import logging
import time
from typing import cast, Any, Optional, Set, Tuple, List, Dict, TYPE_CHECKING
from typing_extensions import final
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, cast

from blspy import PrivateKey, G2Element, G1Element
from blspy import G1Element, G2Element, PrivateKey
from typing_extensions import final

from chia.pools.pool_config import PoolWalletConfig, load_pool_config, update_pool_config
from chia.pools.pool_puzzles import (
SINGLETON_LAUNCHER,
create_absorb_spend,
create_full_puzzle,
create_pooling_inner_puzzle,
create_travel_spend,
create_waiting_room_inner_puzzle,
get_delayed_puz_info_from_launcher_spend,
get_most_recent_singleton_coin_from_coin_spend,
is_pool_member_inner_puzzle,
is_pool_waitingroom_inner_puzzle,
launcher_id_to_p2_puzzle_hash,
pool_state_to_inner_puzzle,
solution_to_pool_state,
uncurry_pool_member_inner_puzzle,
uncurry_pool_waitingroom_inner_puzzle,
)
from chia.pools.pool_wallet_info import (
PoolWalletInfo,
PoolSingletonState,
PoolState,
FARMING_TO_POOL,
SELF_POOLING,
LEAVING_POOL,
SELF_POOLING,
PoolSingletonState,
PoolState,
PoolWalletInfo,
create_pool_state,
)
from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION

from chia.server.ws_connection import WSChiaConnection
from chia.types.announcement import Announcement
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.blockchain_format.program import Program, SerializedProgram
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_record import CoinRecord
from chia.types.coin_spend import CoinSpend
from chia.types.spend_bundle import SpendBundle

from chia.pools.pool_puzzles import (
create_waiting_room_inner_puzzle,
create_full_puzzle,
SINGLETON_LAUNCHER,
create_pooling_inner_puzzle,
solution_to_pool_state,
pool_state_to_inner_puzzle,
get_most_recent_singleton_coin_from_coin_spend,
launcher_id_to_p2_puzzle_hash,
create_travel_spend,
uncurry_pool_member_inner_puzzle,
create_absorb_spend,
is_pool_member_inner_puzzle,
is_pool_waitingroom_inner_puzzle,
uncurry_pool_waitingroom_inner_puzzle,
get_delayed_puz_info_from_launcher_spend,
)

from chia.util.ints import uint8, uint32, uint64, uint128
from chia.wallet.derive_keys import (
find_owner_sk,
)
from chia.wallet.derive_keys import find_owner_sk
from chia.wallet.sign_coin_spends import sign_coin_spends
from chia.wallet.transaction_record import TransactionRecord
from chia.wallet.util.transaction_type import TransactionType
from chia.wallet.util.wallet_types import WalletType
from chia.wallet.wallet import Wallet
from chia.wallet.wallet_coin_record import WalletCoinRecord

from chia.wallet.wallet_info import WalletInfo
from chia.wallet.util.transaction_type import TransactionType


@final
Expand Down
8 changes: 5 additions & 3 deletions chia/pools/pool_wallet_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import IntEnum
from typing import Optional, Dict
from typing import Dict, Optional

from blspy import G1Element

Expand All @@ -9,8 +11,8 @@
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.byte_types import hexstr_to_bytes
from chia.util.ints import uint32, uint8
from chia.util.streamable import streamable, Streamable
from chia.util.ints import uint8, uint32
from chia.util.streamable import Streamable, streamable


class PoolSingletonState(IntEnum):
Expand Down
4 changes: 3 additions & 1 deletion chia/protocols/pool_protocol.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import time
from dataclasses import dataclass
from enum import Enum
import time
from typing import Optional

from blspy import G1Element, G2Element
Expand Down
5 changes: 4 additions & 1 deletion chia/protocols/protocol_state_machine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from chia.protocols.protocol_message_types import ProtocolMessageTypes as pmt, ProtocolMessageTypes
from __future__ import annotations

from chia.protocols.protocol_message_types import ProtocolMessageTypes
from chia.protocols.protocol_message_types import ProtocolMessageTypes as pmt

NO_REPLY_EXPECTED = [
# full_node -> full_node messages
Expand Down
4 changes: 3 additions & 1 deletion chia/rpc/full_node_rpc_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Dict, List, Optional, Tuple, Any
from __future__ import annotations

from typing import Any, Dict, List, Optional, Tuple

from chia.consensus.block_record import BlockRecord
from chia.full_node.signage_point import SignagePoint
Expand Down
4 changes: 3 additions & 1 deletion chia/rpc/rpc_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import asyncio
from ssl import SSLContext
from typing import Dict, List, Optional, Any
from typing import Any, Dict, List, Optional

import aiohttp

Expand Down
Loading

0 comments on commit 42f6a88

Please sign in to comment.