Skip to content

Commit

Permalink
(feat) Added Isort to the project and configure it to run in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abel committed Sep 19, 2023
1 parent 71becbf commit fa7377d
Show file tree
Hide file tree
Showing 60 changed files with 189 additions and 214 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ repos:
types_or: [ python, jupyter, markdown, rst, yaml ]
require_serial: true
minimum_pre_commit_version: 2.9.0
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
18 changes: 6 additions & 12 deletions compatibility-tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import asyncio
import aiohttp
import base64
import json
from typing import Any, Dict, List

import aiohttp
import ecdsa
import sha3
import grpc

from typing import Any, Dict, List
from injective.chain_client._wallet import (
privkey_to_address,
privkey_to_pubkey,
seed_to_privkey,
DEFAULT_BECH32_HRP,
)
from injective.chain_client._typings import SyncMode
import injective.exchange_api.injective_accounts_rpc_pb2 as accounts_rpc_pb
import injective.exchange_api.injective_accounts_rpc_pb2_grpc as accounts_rpc_grpc

import sha3
from injective.chain_client._typings import SyncMode
from injective.chain_client._wallet import DEFAULT_BECH32_HRP, privkey_to_address, privkey_to_pubkey, seed_to_privkey

MIN_GAS_PRICE = 500000000

Expand Down
22 changes: 8 additions & 14 deletions compatibility-tests/unit_tests.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import pytest
import aiohttp
import json
import ecdsa
import sha3
import grpc
import base64

import json
from typing import Any, Dict, List
from injective.chain_client._wallet import (
privkey_to_address,
privkey_to_pubkey,
seed_to_privkey,
DEFAULT_BECH32_HRP,
)

from injective.chain_client._typings import SyncMode
import aiohttp
import ecdsa
import grpc
import injective.exchange_api.injective_accounts_rpc_pb2 as accounts_rpc_pb
import injective.exchange_api.injective_accounts_rpc_pb2_grpc as accounts_rpc_grpc
import pytest
import sha3
from injective.chain_client._typings import SyncMode
from injective.chain_client._wallet import DEFAULT_BECH32_HRP, privkey_to_address, privkey_to_pubkey, seed_to_privkey

MIN_GAS_PRICE = 500000000

Expand Down
3 changes: 1 addition & 2 deletions examples/SendToInjective.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json

import asyncio
import json

from pyinjective.core.network import Network
from pyinjective.sendtocosmos import Peggo
Expand Down
4 changes: 2 additions & 2 deletions examples/chain_client/0_LocalOrderHash.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.wallet import PrivateKey
from pyinjective.orderhash import OrderHashManager
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


async def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/13_MsgIncreasePositionMargin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/15_MsgWithdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/16_MsgSubaccountTransfer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/17_MsgBatchUpdateOrders.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/18_MsgBid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/19_MsgGrant.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/1_MsgSend.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
4 changes: 2 additions & 2 deletions examples/chain_client/20_MsgExec.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.wallet import PrivateKey, Address
from pyinjective.transaction import Transaction
from pyinjective.wallet import Address, PrivateKey


async def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/21_MsgRevoke.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
3 changes: 2 additions & 1 deletion examples/chain_client/22_MsgSendToEth.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import asyncio

import requests

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/23_MsgRelayPriceFeedPrice.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/24_MsgRewardsOptOut.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/25_MsgDelegate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/26_MsgWithdrawDelegatorReward.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/2_MsgDeposit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/30_ExternalTransfer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Denom
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/33_MsgCancelBinaryOptionsOrder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/36_MsgRelayProviderPrices.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
3 changes: 2 additions & 1 deletion examples/chain_client/38_StreamEventOrderFail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import asyncio
import base64
import json

import websockets
import base64

from pyinjective.core.network import Network

Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/3_MsgCreateSpotLimitOrder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/40_MsgExecuteContract.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/41_MsgCreateInsuranceFund.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/42_MsgUnderwrite.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/43_MsgRequestRedemption.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.core.network import Network
from pyinjective.transaction import Transaction
from pyinjective.wallet import PrivateKey


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
from pyinjective.core.network import Network
from pyinjective.wallet import PrivateKey, Address
from pyinjective.wallet import Address, PrivateKey


async def main() -> None:
Expand Down
Loading

0 comments on commit fa7377d

Please sign in to comment.