Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
- name: Run black
run: python -m black --check --diff .

- name: Get changed Python files
id: changed_files
- name: Get all Python files
id: list_files
run: |
echo "files=$(git diff --name-only HEAD^ HEAD | grep '.py$' | xargs)" >> $GITHUB_OUTPUT
echo "files=$(git ls-files '*.py' '*.pyi' | xargs)" >> $GITHUB_OUTPUT

- name: Run Pylint on changed files
- name: Run Pylint on files
run: |
files="${{ steps.changed_files.outputs.files }}"
files="${{ steps.list_files.outputs.files }}"
if [ -n "$files" ]; then
pylint --rcfile=.pylintrc $files
else
echo "No Python files have changed."
echo "No Python files found."
fi

- name: Check GitHub rate limit at end
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python -m pip install .[with-dependencies,ape]

- name: Analysing code with pyright
run: python -m pyright $(git ls-files '*.py')
run: python -m pyright $(git ls-files '*.py' '*.pyi')

- name: Check GitHub rate limit at end
uses: wakamex/rate-limit-action@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
token: ${{ secrets.GH_GITHUB_COM_TOKEN || github.token}}
- run: |
python -m pip install --upgrade pip
python -m pip install .[with-dependencies,postgres,ape]
python -m pip install .[with-dependencies]
python -m pip install coverage

- name: Run pytest with coverage
run: |
coverage run -m pytest --ignore=tests/cross_platform
coverage run -m pytest

- name: Generate coverage report
run: |
Expand Down
22 changes: 14 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ limit-inference-results=100

# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=pylint.extensions.docparams, pylint.extensions.docstyle
load-plugins=
# TODO: Turn this back on after trading competition
#load-plugins=pylint.extensions.docparams, pylint.extensions.docstyle

# Pickle collected data for later comparisons.
persistent=yes
Expand Down Expand Up @@ -617,26 +619,30 @@ variable-naming-style=snake_case
# naming-style. If left empty, variable names will be checked with the set
# naming style.
#variable-rgx=
[tool.pylint.parameter_documentation]

# TODO: Turn these back on after trading competition
# [tool.pylint.parameter_documentation]
# Whether to accept totally missing parameter documentation
# in the docstring of a function that has parameters.
accept-no-param-doc = false
# accept-no-param-doc = false

# Whether to accept totally missing raises documentation
# in the docstring of a function that raises an exception.
accept-no-raise-doc = true
# accept-no-raise-doc = true

# Whether to accept totally missing return documentation in
# the docstring of a function that returns a statement.
accept-no-return-doc = false
# accept-no-return-doc = false

# Whether to accept totally missing yields documentation
# in the docstring of a generator.
accept-no-yields-doc = false
# accept-no-yields-doc = false

# If the docstring type cannot be guessed the
# specified docstring type will be used.
default-docstring-type = numpy
# default-docstring-type = numpy

# TODO: Turn these back on after trading competition
[pylint.'test_*.py']
disable = missing-param-doc, missing-return-doc, missing-return-type-doc, too-few-public-methods, missing-type-doc
#disable = missing-param-doc, missing-return-doc, missing-return-type-doc, too-few-public-methods, missing-type-doc
disable = too-few-public-methods
1 change: 1 addition & 0 deletions elfpy/eth/errors/types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Error types from Web3"""
from typing import Literal, Sequence, TypedDict

from web3.types import ABIFunctionParams
Expand Down
7 changes: 3 additions & 4 deletions elfpy/hyperdrive_interface/hyperdrive_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
from web3.contract.contract import Contract
from web3.types import BlockData

from elfpy import eth, hyperdrive_interface
from elfpy import eth
from elfpy import time as elftime
from elfpy.markets.hyperdrive import HyperdriveMarket, HyperdriveMarketState, HyperdrivePricingModel

from .hyperdrive_addresses import HyperdriveAddresses
from .hyperdrive_assets import AssetIdPrefix, encode_asset_id

RETRY_COUNT = 10

Expand Down Expand Up @@ -108,9 +109,7 @@ def get_hyperdrive_pool_info(web3: Web3, hyperdrive_contract: Contract, block_nu
# add position duration to the data dict
position_duration = eth.smart_contract_read(hyperdrive_contract, "getPoolConfig").get("positionDuration", None)
if position_duration is not None:
asset_id = hyperdrive_interface.encode_asset_id(
hyperdrive_interface.AssetIdPrefix.WITHDRAWAL_SHARE, position_duration
)
asset_id = encode_asset_id(AssetIdPrefix.WITHDRAWAL_SHARE, position_duration)
pool_info["totalSupplyWithdrawalShares"] = eth.smart_contract_read(
hyperdrive_contract, "balanceOf", asset_id, hyperdrive_contract.address
)["value"]
Expand Down
4 changes: 2 additions & 2 deletions examples/eth_bots/execute_agent_trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def execute_agent_trades(
account.agent.wallet.update(wallet_deltas)


def assert_never(x: NoReturn) -> NoReturn:
def assert_never(arg: NoReturn) -> NoReturn:
"""Helper function for exhaustive matching on ENUMS"""
assert False, "Unhandled type: {}".format(type(x).__name__)
assert False, f"Unhandled type: {type(arg).__name__}"


def match_contract_call_to_trade(
Expand Down
1 change: 0 additions & 1 deletion examples/eth_bots/trade_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from web3.contract.contract import Contract
from web3.types import RPCEndpoint

from elfpy import eth
from elfpy.eth.accounts import EthAccount
from examples.eth_bots.execute_agent_trades import execute_agent_trades

Expand Down