Skip to content

Commit

Permalink
Isort take 3 (Chia-Network#1213)
Browse files Browse the repository at this point in the history
* isort in a black friendly way

* isort but debug superlinter later
  • Loading branch information
hoffmang9 authored Mar 10, 2021
1 parent 91f9457 commit b5ce8c9
Show file tree
Hide file tree
Showing 244 changed files with 1,013 additions and 1,182 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .flake8
20 changes: 20 additions & 0 deletions .github/linters/.isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[settings]
profile=

; vertical hanging indent mode also used in black configuration
multi_line_output = 3

; necessary because black expect the trailing comma
include_trailing_comma = true

; black compatibility
force_grid_wrap = 0

; black compatibility
use_parentheses = True

; black compatibility
ensure_newline_before_comments = True

; we chose 120 as line length
line_length = 120
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
LINTER_RULES_PATH: .github/linters
PYTHON_BLACK_CONFIG_FILE: .python-black
VALIDATE_BASH: true
VALIDATE_CSS: true
VALIDATE_DOCKER: true
Expand All @@ -68,6 +67,7 @@ jobs:
VALIDATE_PYTHON_PYLINT: true
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_PYTHON_BLACK: true
# VALIDATE_PYTHON_ISORT: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_TYPESCRIPT_ES: true
VALIDATE_YAML: true
Expand Down
1 change: 1 addition & 0 deletions .isort.cfg
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project does not yet adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
for setuptools_scm/PEP 440 reasons.

## Unreleased 1.0rc6 aka Release Candidate 6 - 2020-03-1?

### Added

## Changed

- Remove `chia plots "-s" "--stripe_size"` - we now always use the best default of 64K

## 1.0rc5 aka Release Candidate 5 - 2020-03-04

### Added
Expand All @@ -21,7 +29,6 @@ for setuptools_scm/PEP 440 reasons.

## Changed

- Remove `chia plots "-s" "--stripe_size"` - we now always use the best default of 64K
- Testnets and mainnet now set their minimum `k` size and enforce it. RC5 testnet will reject plots of size less than k=32.
- Sub slots now require 16 blocks instead of 12.
- Thanks to @xdustinface of Dash, the BlS Signature library has been updated to 0.9 with clean ups and some speed ups. This changed how the G2 infinity element was handled and we now manage it inside of chia-blockchain, etc., instead of in blspy.
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from setuptools import setup


dependencies = [
"aiter==0.13.20191203", # Used for async generator tools
"blspy==0.9", # Signature library
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pkg_resources import get_distribution, DistributionNotFound
from pkg_resources import DistributionNotFound, get_distribution

try:
__version__ = get_distribution("chia-blockchain").version
Expand Down
17 changes: 8 additions & 9 deletions src/cmds/chia.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import asyncio
import click
from pathlib import Path

from src import __version__
from src.util.default_root import DEFAULT_ROOT_PATH
from src.daemon.server import async_run_daemon
import click

from src import __version__
from src.cmds.configure import configure_cmd
from src.cmds.farm import farm_cmd
from src.cmds.init import init_cmd
from src.cmds.keys import keys_cmd
from src.cmds.netspace import netspace_cmd
from src.cmds.plots import plots_cmd
from src.cmds.wallet import wallet_cmd
from src.cmds.configure import configure_cmd
from src.cmds.show import show_cmd
from src.cmds.start import start_cmd
from src.cmds.stop import stop_cmd
from src.cmds.netspace import netspace_cmd
from src.cmds.farm import farm_cmd

from src.cmds.wallet import wallet_cmd
from src.daemon.server import async_run_daemon
from src.util.default_root import DEFAULT_ROOT_PATH

CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])

Expand Down
11 changes: 4 additions & 7 deletions src/cmds/configure.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import click
from pathlib import Path

from src.util.config import (
load_config,
save_config,
)
from typing import Dict

import click

from src.util.config import load_config, save_config, str2bool
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.config import str2bool


def configure(root_path: Path, set_node_introducer: str, set_fullnode_port: str, set_log_level: str, enable_upnp: str):
Expand Down
13 changes: 6 additions & 7 deletions src/cmds/farm.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import math
from typing import Optional, Dict, Any, List
import asyncio
import math
from decimal import Decimal

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

import aiohttp
import click

from src.consensus.block_record import BlockRecord
from src.rpc.wallet_rpc_client import WalletRpcClient
from src.rpc.harvester_rpc_client import HarvesterRpcClient
from src.rpc.full_node_rpc_client import FullNodeRpcClient
from src.rpc.farmer_rpc_client import FarmerRpcClient
from src.rpc.full_node_rpc_client import FullNodeRpcClient
from src.rpc.harvester_rpc_client import HarvesterRpcClient
from src.rpc.wallet_rpc_client import WalletRpcClient
from src.util.config import load_config
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.ints import uint16
Expand Down
30 changes: 13 additions & 17 deletions src/cmds/init.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
import click
from src import __version__
from pathlib import Path
import os
import shutil
from pathlib import Path
from typing import Any, Dict, List, Tuple

from typing import List, Dict, Any, Tuple

from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.keychain import Keychain
import click
import yaml

from src.util.config import unflatten_properties
from src import __version__
from src.consensus.coinbase import create_puzzlehash_for_pk
from src.util.ints import uint32

from src.ssl.create_ssl import generate_ca_signed_cert, get_chia_ca_crt_key, make_ca_cert
from src.util.bech32m import encode_puzzle_hash
from src.util.config import (
create_default_chia_config,
initial_config_file,
load_config,
save_config,
initial_config_file,
unflatten_properties,
)
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.ints import uint32
from src.util.keychain import Keychain
from src.util.path import mkdir
import yaml

from src.ssl.create_ssl import get_chia_ca_crt_key, generate_ca_signed_cert, make_ca_cert
from src.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_pool_sk
from src.util.bech32m import encode_puzzle_hash

from src.wallet.derive_keys import master_sk_to_pool_sk, master_sk_to_wallet_sk

private_node_names = {"full_node", "wallet", "farmer", "harvester", "timelord", "daemon"}
public_node_names = {"full_node", "wallet", "farmer", "introducer", "timelord"}
Expand Down
18 changes: 4 additions & 14 deletions src/cmds/keys.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import click

from pathlib import Path
from typing import List

import click
from blspy import AugSchemeMPL, G1Element, G2Element

from src.cmds.init import check_keys
from src.consensus.coinbase import create_puzzlehash_for_pk
from src.util.bech32m import encode_puzzle_hash
from src.util.config import load_config
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.keychain import (
generate_mnemonic,
bytes_to_mnemonic,
Keychain,
)
from src.wallet.derive_keys import (
master_sk_to_pool_sk,
master_sk_to_farmer_sk,
master_sk_to_wallet_sk,
)
from src.util.ints import uint32
from src.consensus.coinbase import create_puzzlehash_for_pk

from src.util.keychain import Keychain, bytes_to_mnemonic, generate_mnemonic
from src.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_pool_sk, master_sk_to_wallet_sk

keychain: Keychain = Keychain()

Expand Down
11 changes: 6 additions & 5 deletions src/cmds/netspace.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import click
import aiohttp
import asyncio

import aiohttp
import click

from src.rpc.full_node_rpc_client import FullNodeRpcClient
from src.util.byte_types import hexstr_to_bytes
from src.util.config import load_config
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.byte_types import hexstr_to_bytes
from src.util.ints import uint16

from src.rpc.full_node_rpc_client import FullNodeRpcClient


async def netstorge_async(rpc_port: int, delta_block_height: str, start: str) -> None:
"""
Expand Down
16 changes: 6 additions & 10 deletions src/cmds/plots.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import click
import logging
import sys

from pathlib import Path
import logging
from src.plotting.plot_tools import (
add_plot_directory,
remove_plot_directory,
get_plot_directories,
)
from src.plotting.create_plots import create_plots

import click

from src.plotting.check_plots import check_plots
from src.plotting.create_plots import create_plots
from src.plotting.plot_tools import add_plot_directory, get_plot_directories, remove_plot_directory
from src.util.chia_logging import initialize_logging


DEFAULT_STRIPE_SIZE = 65536
log = logging.getLogger(__name__)

Expand Down
15 changes: 7 additions & 8 deletions src/cmds/show.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import click
import traceback

import aiohttp
import asyncio
import time
from time import struct_time, localtime

import traceback
from time import localtime, struct_time
from typing import List, Optional

import aiohttp
import click

from src.consensus.block_record import BlockRecord
from src.rpc.full_node_rpc_client import FullNodeRpcClient
from src.server.outbound_message import NodeType
from src.types.full_block import FullBlock
from src.rpc.full_node_rpc_client import FullNodeRpcClient
from src.util.bech32m import encode_puzzle_hash
from src.util.byte_types import hexstr_to_bytes
from src.util.config import load_config
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.bech32m import encode_puzzle_hash
from src.util.ints import uint16


Expand Down
5 changes: 3 additions & 2 deletions src/cmds/start.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import click
import asyncio
import os
import subprocess
from pathlib import Path
from typing import Optional

from src.daemon.client import connect_to_daemon_and_validate, DaemonProxy
import click

from src.daemon.client import DaemonProxy, connect_to_daemon_and_validate
from src.daemon.server import not_launched_error_message
from src.util.service_groups import all_groups, services_for_groups

Expand Down
5 changes: 3 additions & 2 deletions src/cmds/stop.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import click
import sys
import asyncio
import sys
from pathlib import Path

import click

from src.daemon.client import connect_to_daemon_and_validate
from src.util.service_groups import all_groups, services_for_groups

Expand Down
12 changes: 6 additions & 6 deletions src/cmds/wallet.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import click
import asyncio
import sys
import time
from datetime import datetime
from typing import Tuple, Optional, Callable, List
from decimal import Decimal
from typing import Callable, List, Optional, Tuple

import aiohttp
import asyncio
import click

from src.cmds.units import units
from src.rpc.wallet_rpc_client import WalletRpcClient
from src.server.start_wallet import SERVICE_NAME
from src.util.bech32m import encode_puzzle_hash
from src.util.byte_types import hexstr_to_bytes
from src.util.config import load_config
from src.util.default_root import DEFAULT_ROOT_PATH
from src.util.ints import uint64, uint16
from src.util.ints import uint16, uint64
from src.wallet.transaction_record import TransactionRecord
from src.wallet.util.wallet_types import WalletType
from src.cmds.units import units
from decimal import Decimal


def print_transaction(tx: TransactionRecord, verbose: bool, name) -> None:
Expand Down
Loading

0 comments on commit b5ce8c9

Please sign in to comment.