Skip to content

Commit

Permalink
configure isort to add the future annotations import (Chia-Network#13327
Browse files Browse the repository at this point in the history
)

* configure isort to add the future annotations import

* apply the new isort setting

* remove type ignores for new mypy (Chia-Network#13539)

https://pypi.org/project/mypy/0.981/

* another
  • Loading branch information
altendky authored Sep 30, 2022
1 parent 333e836 commit 3b084a1
Show file tree
Hide file tree
Showing 386 changed files with 776 additions and 0 deletions.
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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
Expand Down
2 changes: 2 additions & 0 deletions activated.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

from __future__ import annotations

import os
import pathlib
import subprocess
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/block_ref.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import os
import random
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/block_store.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import os
import random
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/coin_store.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import os
import random
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/jsonify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import random
from time import perf_counter

Expand Down
2 changes: 2 additions & 0 deletions benchmarks/mempool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import cProfile
from contextlib import contextmanager
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/streamable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import sys
from dataclasses import dataclass
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import random
import subprocess
Expand Down
2 changes: 2 additions & 0 deletions build_scripts/check_dependency_artifacts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import pathlib
import platform
Expand Down
2 changes: 2 additions & 0 deletions build_scripts/installer-version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools_scm import get_version


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

from pkg_resources import DistributionNotFound, get_distribution, resource_filename

try:
Expand Down
2 changes: 2 additions & 0 deletions chia/clvm/singleton.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile

P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clvm")
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/beta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import zipfile
from datetime import datetime
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/beta_funcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import sys
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/cmds_util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from contextlib import asynccontextmanager
from pathlib import Path
from typing import Any, AsyncIterator, Awaitable, Callable, Dict, Optional, Tuple, Type
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/configure.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pathlib import Path
from typing import Optional

Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import logging
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/data_funcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from decimal import Decimal
from pathlib import Path
from types import TracebackType
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/db_backup_func.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

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

Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/db_validate_func.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

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

Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/netspace_funcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Optional

from chia.cmds.cmds_util import get_any_service_client
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/peer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Optional

import click
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/peer_funcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

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

Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/plots.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import logging
import sys
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/rpc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import json
import sys
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/show_funcs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pathlib import Path
from typing import Any, Dict, List, Optional, Union

Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/stop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import sys
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions chia/cmds/units.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Dict

# The rest of the codebase uses mojos everywhere.
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_body_validation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import collections
import logging
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, Union
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_creation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
import random
from dataclasses import replace
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_header_validation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import dataclasses
import logging
import time
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_record.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import List, Optional

Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_rewards.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia.util.ints import uint32, uint64

# 1 Chia coin = 1,000,000,000,000 = 1 trillion mojo.
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/block_root_validation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Dict, List, Optional, Tuple

from chia_rs import compute_merkle_set_root
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import dataclasses
import logging
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/blockchain_interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Dict, List, Optional

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/coinbase.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from blspy import G1Element

from chia.types.blockchain_format.coin import Coin
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/condition_costs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from enum import Enum


Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import dataclasses
import logging
from typing import Any
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/cost_calculator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import Optional

Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/default_constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia.util.ints import uint64

from .constants import ConsensusConstants
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/deficit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Optional

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/difficulty_adjustment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import List, Optional, Tuple

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/find_fork_point.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Union

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/full_block_to_block_record.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import List, Optional, Union

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/get_block_challenge.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from typing import List, Union

Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/make_sub_epoch_summary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from typing import Optional, Union

Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/multiprocess_validation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import logging
import traceback
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/pos_quality.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia.util.ints import uint64

# The actual space in bytes of a plot, is _expected_plot_size(k) * UI_ACTUAL_SPACE_CONSTANT_FACTO
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/pot_iterations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia.consensus.constants import ConsensusConstants
from chia.consensus.pos_quality import _expected_plot_size
from chia.types.blockchain_format.sized_bytes import bytes32
Expand Down
2 changes: 2 additions & 0 deletions chia/consensus/vdf_info_computation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import List, Optional, Tuple

from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 2 additions & 0 deletions chia/daemon/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import json
import ssl
Expand Down
2 changes: 2 additions & 0 deletions chia/daemon/windows_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
https://stackoverflow.com/questions/35772001/how-to-handle-the-signal-in-python-on-windows-machine
"""

from __future__ import annotations

import os
import signal
import sys
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/data_layer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import logging
import random
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/data_layer_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging

from chia.data_layer.data_layer import DataLayer
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/data_layer_errors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Iterable, List

from chia.types.blockchain_format.sized_bytes import bytes32
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/data_layer_server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import functools
import logging
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/data_store.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from collections import defaultdict
from contextlib import asynccontextmanager
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/dl_wallet_store.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import dataclasses
from typing import List, Optional, Type, TypeVar, Union

Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/download_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import logging
import os
Expand Down
2 changes: 2 additions & 0 deletions chia/data_layer/util/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import os
import sys
Expand Down
2 changes: 2 additions & 0 deletions chia/farmer/farmer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import json
import logging
Expand Down
2 changes: 2 additions & 0 deletions chia/farmer/farmer_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import time
from typing import Any, Dict, List, Optional, Tuple
Expand Down
2 changes: 2 additions & 0 deletions chia/full_node/hint_management.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

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

from chia.consensus.blockchain import StateChangeSummary
Expand Down
Loading

0 comments on commit 3b084a1

Please sign in to comment.