cleaning up poetry scripts
This commit is contained in:
parent
c592a49c35
commit
f55b94192f
@ -1,29 +1,38 @@
|
|||||||
|
from subprocess import check_call
|
||||||
import click
|
import click
|
||||||
from subprocess import check_call, run
|
|
||||||
|
|
||||||
def lint():
|
def lint():
|
||||||
check_call(['pylint', '.'])
|
check_call(["pylint", "."])
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
check_call(['pytest', '--cov=mev_inspect', 'tests'])
|
check_call(["pytest", "--cov=mev_inspect", "tests"])
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option('-c', required=False, is_flag=True)
|
@click.option("-c", required=False, is_flag=True)
|
||||||
def isort(c: str):
|
def isort(c: str):
|
||||||
'''if c is present run isort in diff mode'''
|
"""if c is present run isort in diff mode"""
|
||||||
if c:
|
if c:
|
||||||
check_call(['isort', '.'])
|
check_call(["isort", "."])
|
||||||
else:
|
else:
|
||||||
check_call(['isort', '--diff', '.'])
|
check_call(["isort", "--diff", "."])
|
||||||
|
|
||||||
|
|
||||||
def mypy():
|
def mypy():
|
||||||
check_call(['mypy', '.'])
|
check_call(["mypy", "."])
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option('-c', required=False, is_flag=True)
|
@click.option("-c", required=False, is_flag=True)
|
||||||
def black(c: str):
|
def black(c: str):
|
||||||
'''if c is present run black in diff mode'''
|
"""if c is present run black in diff mode"""
|
||||||
if c:
|
if c:
|
||||||
check_call(['black', '.'])
|
check_call(["black", "."])
|
||||||
else:
|
else:
|
||||||
check_call(['black', '--diff', '--color', '.'])
|
check_call(["black", "--diff", "--color", "."])
|
||||||
|
|
||||||
|
|
||||||
|
def pre_commit():
|
||||||
|
check_call(["pre-commit", "run", "--all-files"])
|
||||||
|
@ -1,19 +1,45 @@
|
|||||||
|
from subprocess import check_call
|
||||||
import click
|
import click
|
||||||
from subprocess import check_call, run
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option('-b', required=False, is_flag=True)
|
@click.option("-b", required=False, is_flag=True)
|
||||||
def start(b: str):
|
def start(b: str):
|
||||||
'''if d is present background compose'''
|
"""if d is present background compose"""
|
||||||
if b:
|
if b:
|
||||||
check_call(['docker', 'compose', 'up', '-d'])
|
check_call(["docker", "compose", "up", "-d"])
|
||||||
click.echo('docker running in the background...')
|
click.echo("docker running in the background...")
|
||||||
else:
|
else:
|
||||||
check_call(['docker', 'compose', 'up'])
|
check_call(["docker", "compose", "up"])
|
||||||
|
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
check_call(['docker', 'compose', 'down'])
|
check_call(["docker", "compose", "down"])
|
||||||
|
|
||||||
|
|
||||||
def build():
|
def build():
|
||||||
check_call(['docker', 'compose', 'build'])
|
check_call(["docker", "compose", "build"])
|
||||||
|
|
||||||
|
|
||||||
|
def attach():
|
||||||
|
check_call(["docker", "exec", "-it", "mev-inspect-py_mev-inspect_1", "bash"])
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option("-script", help="inspect script", default="./examples/uniswap_inspect.py")
|
||||||
|
@click.option("-block_num", help="block number to inspect", default=11931271)
|
||||||
|
@click.option("-rpc", help="rpc address", default="http://111.11.11.111:8545")
|
||||||
|
def inspect(script: str, block_num: int, rpc: str):
|
||||||
|
"""Runs mev-inspect scripts through docker services"""
|
||||||
|
check_call(
|
||||||
|
[
|
||||||
|
"docker",
|
||||||
|
"compose",
|
||||||
|
"exec",
|
||||||
|
"mev-inspect",
|
||||||
|
"python",
|
||||||
|
script,
|
||||||
|
f"-block_number {block_num}",
|
||||||
|
f"-rpc {rpc}",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user