delvtech / agent0

Analysis & simulation repo for Delv
https://agent0.readthedocs.io/en/latest/
Apache License 2.0
49 stars 21 forks source link

Improve community standards #332

Open dpaiton opened 1 year ago

dpaiton commented 1 year ago

The Community Standards page has suggestions for what we can add to the repo to improve the ability for others to contribute. I'd say the top priority now is filling out contributing.md. There are also lots of suggestions in the GitHub Best Practices page. To keep this issue concrete, I'll name these specific tasks:

So that this issue doesn't live on forever, let's scope it to the above tasks and then when they're done make a new one with additional tasks. Here are some example additional tasks:

wakamex commented 1 year ago

always have """ alone on a new line image

wakamex commented 1 year ago

use r""" to start docstrings so that we can render backticks and other sphinxdoc stuff

wakamex commented 11 months ago

use r""" to start docstrings so that we can render backticks and other sphinxdoc stuff

I disagree, we have a whole lot of docstrings right now that don't start with r""", and I prefer the simpler approach. We can use r""" only when necessary (render backticks and sphinx docs).

wakamex commented 11 months ago

previous discussion around removing parantheses around tuples: https://github.com/delvtech/elf-simulations/pull/136#discussion_r1088280879

in our codebase as of Oct11, I see 64 examples of return without parentheses and 8 with

64 return statements without parentheses:

./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return agent_id, agent_deltas, market_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/borrow/borrow_market_state.py:        return {key: value * self.collateral_spot_price[key] for key, value in self.collateral.items()}
./lib/elfpy/elfpy/markets/borrow/borrow_pricing_model.py:        return collateral_value_in_base, borrow_amount_in_base
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return agent_id, agent_deltas, market_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_market.py:        return market_deltas, wallet_deltas
./lib/elfpy/elfpy/markets/hyperdrive/yieldspace_pricing_model.py:        return lp_out, d_base, d_bonds
./lib/elfpy/elfpy/markets/hyperdrive/yieldspace_pricing_model.py:        return shares_delta, bonds_delta
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return lp_out, base_in, delta_bond_reserves
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return updated_share_reserves, updated_bond_reserves
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return market_deltas, agent_deltas
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_pricing_model.py:        return base, bonds
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_pricing_model.py:        return base, bonds
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_pricing_model.py:        return shares_delta, bonds_delta
./lib/elfpy/elfpy/utils/format.py:    return f"{value:,.{decimals}f}"
./lib/elfpy/elfpy/utils/outputs.py:    return fig, axes, grid_spec
./lib/elfpy/elfpy/utils/sim_utils.py:    return market, agent_deltas, market_deltas
./lib/elfpy/elfpy/utils/logs.py:    return log_dir, log_name
./lib/elfpy/tests/solidity/test_fees.py:    return curve_fee, flat_fee, gov_curve_fee, gov_flat_fee
./lib/ethpy/ethpy/hyperdrive/assets.py:    return prefix, timestamp
./lib/ethpy/ethpy/hyperdrive/deploy.py:    return base_token_contract, factory_contract
./lib/ethpy/ethpy/hyperdrive/deploy.py:    return mint_tx_receipt, approve_tx_receipt
./lib/ethpy/ethpy/hyperdrive/get_web3_and_hyperdrive_contracts.py:    return web3, base_token_contract, hyperdrive_contract
./lib/ethpy/ethpy/base/transactions.py:    return {f"value{idx}": value for idx, value in enumerate(return_values)}
./lib/ethpy/ethpy/base/transactions.py:    return {f"value{idx}": value for idx, value in enumerate(return_values)}
./lib/ethpy/ethpy/base/abi/load_abis.py:        return abis, bytecodes
./lib/ethpy/ethpy/base/abi/load_abis.py:            return data["abi"], data["bytecode"]["object"]
./lib/ethpy/ethpy/base/contract/deploy_contract.py:        return contract_addr, contract
./lib/ethpy/ethpy/base/receipts.py:            return event_data, event
./lib/chainsync/chainsync/db/hyperdrive/convert_data.py:    return out_transactions, out_wallet_deltas
./lib/chainsync/chainsync/db/hyperdrive/interface.py:    return_timestamp: bool = True,
./lib/chainsync/chainsync/db/hyperdrive/interface.py:    return_timestamp : bool, optional
./lib/chainsync/chainsync/db/hyperdrive/interface.py:    return_timestamp: bool = True,
./lib/chainsync/chainsync/db/hyperdrive/interface.py:    return_timestamp : bool, optional
./lib/agent0/agent0/hyperdrive/exec/execute_agent_trades.py:        return_exceptions=True,
./lib/agent0/agent0/hyperdrive/exec/trade_loop.py:    return is_slippage, trade_result
./lib/agent0/agent0/hyperdrive/exec/trade_loop.py:    return invalid_balance, trade_result
./lib/agent0/agent0/hyperdrive/exec/setup_experiment.py:    return hyperdrive, agent_accounts
./lib/agent0/agent0/hyperdrive/policies/arbitrage.py:        return action_list, False
./lib/agent0/agent0/hyperdrive/policies/random_agent.py:            return [], False
./lib/agent0/agent0/hyperdrive/policies/random_agent.py:        return [], False
./lib/agent0/agent0/hyperdrive/crash_report/crash_report.py:    return {"address": agent.checksum_address, "policy": agent.policy.name}
./lib/agent0/agent0/base/policies/no_action.py:        return [], False
./lib/agent0/agent0/test_fixtures/cycle_trade_policy.py:            return [], True
./lib/agent0/agent0/test_fixtures/cycle_trade_policy.py:        return action_list, done_trading
./lib/agent0/examples/custom_agent.py:        return action_list, False
./tests/bot_load_state_test.py:        return action_list, done_trading
./tests/multi_trade_per_block_test.py:        return action_list, True

8 return statements with parentheses:

grep -rsI "^ *return *([^,]*," .
./lib/pypechain/pypechain/run_pypechain.py:    return (intersection, unique_values)
./lib/elfpy/elfpy/markets/hyperdrive/yieldspace_pricing_model_sol.py:    return (optimal_z - z, y - optimal_y)
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:        return (FixedPoint(0), {checkpoint_time: FixedPoint(0)}, FixedPoint(0))
./lib/elfpy/elfpy/markets/hyperdrive/hyperdrive_actions.py:    return (d_base_volume, d_checkpoints, lp_margin)
./lib/ethpy/ethpy/base/transactions.py:    return (return_value_name, return_value_type)
./lib/ethpy/ethpy/base/receipts.py:    return (None, None)
./lib/chainsync/chainsync/dashboard/build_leaderboard.py:    return (comb_leaderboard.astype(str), ind_leaderboard.astype(str))
./lib/agent0/bin/checkpoint_bot.py:    return (eth_config, env_config)