isort: Remove the remaining exceptions and sort the related files (#14124)

This commit is contained in:
dustinface 2022-12-14 06:10:55 +07:00 committed by GitHub
parent 6467bd03d7
commit 42f6a883ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 154 additions and 151 deletions

View File

@ -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

View File

@ -1,31 +1,32 @@
from __future__ import annotations
import random
from pathlib import Path
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.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.coin_record import CoinRecord
from chia.types.spend_bundle import SpendBundle
from chia.types.generator_types import BlockGenerator
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
from chia.types.coin_spend import CoinSpend
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.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.full_node.mempool_manager import MempoolManager
from chia.types.blockchain_format.coin import Coin
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.generator_types import BlockGenerator
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
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.

View File

@ -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

View File

@ -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__)

View File

@ -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__)

View File

@ -1,18 +1,15 @@
import asyncio
import traceback
import os
import logging
import sys
from __future__ import annotations
import asyncio
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__)

View File

@ -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):

View File

@ -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")

View File

@ -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 import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, cast
from blspy import G1Element, G2Element, PrivateKey
from typing_extensions import final
from blspy import PrivateKey, G2Element, G1Element
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,
FARMING_TO_POOL,
LEAVING_POOL,
SELF_POOLING,
PoolSingletonState,
PoolState,
FARMING_TO_POOL,
SELF_POOLING,
LEAVING_POOL,
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

View File

@ -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
@ -9,8 +11,8 @@ from chia.types.blockchain_format.coin import Coin
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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
import dataclasses
import json
@ -5,7 +7,7 @@ import logging
from pathlib import Path
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from blspy import G1Element, G2Element, PrivateKey, AugSchemeMPL
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
from chia.consensus.block_rewards import calculate_base_farmer_reward
from chia.data_layer.data_layer_wallet import DataLayerWallet
@ -28,7 +30,7 @@ from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash
from chia.util.byte_types import hexstr_to_bytes
from chia.util.config import load_config
from chia.util.errors import KeychainIsLocked
from chia.util.ints import uint8, uint32, uint64, uint16
from chia.util.ints import uint8, uint16, uint32, uint64
from chia.util.keychain import bytes_to_mnemonic, generate_mnemonic
from chia.util.path import path_from_root
from chia.util.ws_message import WsRpcMessage, create_payload_dict
@ -45,13 +47,13 @@ from chia.wallet.did_wallet import did_wallet_puzzles
from chia.wallet.did_wallet.did_info import DIDInfo
from chia.wallet.did_wallet.did_wallet import DIDWallet
from chia.wallet.did_wallet.did_wallet_puzzles import (
match_did_puzzle,
program_to_metadata,
DID_INNERPUZ_MOD,
create_fullpuz,
match_did_puzzle,
program_to_metadata,
)
from chia.wallet.nft_wallet import nft_puzzles
from chia.wallet.nft_wallet.nft_info import NFTInfo, NFTCoinInfo
from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTInfo
from chia.wallet.nft_wallet.nft_puzzles import get_metadata_and_phs
from chia.wallet.nft_wallet.nft_wallet import NFTWallet
from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT
@ -68,10 +70,10 @@ from chia.wallet.util.compute_hints import compute_coin_hints
from chia.wallet.util.compute_memos import compute_memos
from chia.wallet.util.transaction_type import TransactionType
from chia.wallet.util.wallet_types import AmountWithPuzzlehash, 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.wallet_node import WalletNode
from chia.wallet.wallet import Wallet
from chia.wallet.wallet_protocol import WalletProtocol
# Timeout for response from wallet/full node for sending a transaction

View File

@ -1,4 +1,6 @@
from typing import Dict, List, Optional, Any, Tuple, Union
from __future__ import annotations
from typing import Any, Dict, List, Optional, Tuple, Union
from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord
from chia.pools.pool_wallet_info import PoolWalletInfo

View File

@ -1,10 +1,12 @@
from __future__ import annotations
import asyncio
import dataclasses
import ipaddress
import logging
import random
import time
from typing import List, Dict
from typing import Dict, List
import aiosqlite

View File

@ -1,8 +1,10 @@
from __future__ import annotations
import asyncio
import ipaddress
import logging
import time
import traceback
import ipaddress
from collections import defaultdict
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple
@ -10,8 +12,8 @@ from typing import Any, Callable, Dict, List, Optional, Tuple
import aiosqlite
from chia.consensus.constants import ConsensusConstants
from chia.full_node.full_node_api import FullNodeAPI
from chia.full_node.coin_store import CoinStore
from chia.full_node.full_node_api import FullNodeAPI
from chia.protocols import full_node_protocol
from chia.rpc.rpc_server import default_get_connections
from chia.seeder.crawl_store import CrawlStore
@ -20,8 +22,8 @@ from chia.server.outbound_message import NodeType
from chia.server.server import ChiaServer
from chia.server.ws_connection import WSChiaConnection
from chia.types.peer_info import PeerInfo
from chia.util.path import path_from_root
from chia.util.ints import uint32, uint64
from chia.util.path import path_from_root
log = logging.getLogger(__name__)

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
import ipaddress
import logging
@ -8,12 +10,12 @@ from pathlib import Path
from typing import Any, Dict, List
import aiosqlite
from dnslib import A, AAAA, SOA, NS, MX, CNAME, RR, DNSRecord, QTYPE, DNSHeader
from dnslib import AAAA, CNAME, MX, NS, QTYPE, RR, SOA, A, DNSHeader, DNSRecord
from chia.util.chia_logging import initialize_logging
from chia.util.path import path_from_root
from chia.util.config import load_config
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.path import path_from_root
SERVICE_NAME = "seeder"
log = logging.getLogger(__name__)

View File

@ -1,7 +1,9 @@
from __future__ import annotations
if __name__ == "__main__":
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.simulator.block_tools import create_block_tools, test_constants
from chia.simulator.keyring import TempKeyring
from chia.util.default_root import DEFAULT_ROOT_PATH
with TempKeyring() as keychain:
# TODO: mariano: fix this with new consensus

View File

@ -1,21 +1,23 @@
from __future__ import annotations
import logging
import sys
from multiprocessing import freeze_support
from pathlib import Path
from typing import Optional, Dict, List, Tuple
from typing import Dict, List, Optional, Tuple
from chia.full_node.full_node import FullNode
from chia.server.outbound_message import NodeType
from chia.server.start_service import Service, async_run
from chia.simulator.block_tools import BlockTools, test_constants
from chia.simulator.full_node_simulator import FullNodeSimulator
from chia.simulator.simulator_full_node_rpc_api import SimulatorFullNodeRpcApi
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import decode_puzzle_hash
from chia.util.chia_logging import initialize_logging
from chia.util.config import load_config_cli, override_config, load_config
from chia.util.config import load_config, load_config_cli, override_config
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.simulator.block_tools import BlockTools, test_constants
from chia.util.ints import uint16
from chia.simulator.full_node_simulator import FullNodeSimulator
# See: https://bugs.python.org/issue29288
"".encode("idna")

View File

@ -1,10 +1,11 @@
from __future__ import annotations
import datetime
import os
from pathlib import Path
from typing import Any, List, Tuple, Optional, Dict
from typing import Any, Dict, List, Optional, Tuple
import pkg_resources
from chia.util.ssl_check import DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
@ -12,6 +13,7 @@ from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import load_pem_private_key
from cryptography.x509.oid import NameOID
from chia.util.ssl_check import DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE
_all_private_node_names: List[str] = [
"full_node",

View File

@ -1,9 +1,11 @@
from __future__ import annotations
import asyncio
import logging
import os
import pathlib
import signal
import time
import os
from typing import Dict, List
import pkg_resources

View File

@ -1,26 +1,27 @@
#!/usr/bin/env python3
from __future__ import annotations
import sqlite3
import sys
import zstd
import click
from functools import partial
from pathlib import Path
from blspy import AugSchemeMPL, G1Element
from typing import Callable, Optional, Union, List
from time import time
from typing import Callable, List, Optional, Union
from chia_rs import run_generator, MEMPOOL_MODE
import click
import zstd
from blspy import AugSchemeMPL, G1Element
from chia_rs import MEMPOOL_MODE, run_generator
from chia.types.blockchain_format.program import Program
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.wallet.puzzles.rom_bootstrap_generator import get_generator
from chia.util.full_block_utils import block_info_from_block, generator_from_block
from chia.util.condition_tools import pkm_pairs
from chia.types.full_block import FullBlock
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
from chia.types.block_protocol import BlockInfo
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
from chia.types.full_block import FullBlock
from chia.util.condition_tools import pkm_pairs
from chia.util.full_block_utils import block_info_from_block, generator_from_block
from chia.wallet.puzzles.rom_bootstrap_generator import get_generator
GENERATOR_ROM = bytes(get_generator())