Make arg and flag preparations stateless
This commit is contained in:
parent
88870dc12d
commit
576e62507b
@ -1,12 +1,12 @@
|
||||
# standard imports
|
||||
import os
|
||||
|
||||
# local imports
|
||||
from .base import *
|
||||
from .arg import process_flags
|
||||
from .config import process_config
|
||||
## standard imports
|
||||
#import os
|
||||
#
|
||||
## local imports
|
||||
#from .base import *
|
||||
#from .arg import process_flags
|
||||
#from .config import process_config
|
||||
|
||||
|
||||
__script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
data_dir = os.path.join(os.path.dirname(__script_dir), 'data')
|
||||
config_dir = os.path.join(data_dir, 'config')
|
||||
#__script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
#data_dir = os.path.join(os.path.dirname(__script_dir), 'data')
|
||||
#config_dir = os.path.join(data_dir, 'config')
|
||||
|
@ -1,15 +1,14 @@
|
||||
# local imports
|
||||
from .base import SyncFlag
|
||||
def apply_flag(flag):
|
||||
flag.add('range')
|
||||
flag.add('head')
|
||||
flag.alias('sync_range_ext', 'range', 'head')
|
||||
return flag
|
||||
|
||||
|
||||
def process_flags(argparser, flags):
|
||||
|
||||
if flags & SyncFlag.RANGE > 0:
|
||||
argparser.add_argument('--offset', type=int, help='Block to start sync from. Default is start of history (0).')
|
||||
argparser.add_argument('--until', type=int, default=-1, help='Block to stop sync on. Default is stop at block height of first run.')
|
||||
argparser.add_argument('--single', action='store_true', help='Execute a single sync, regardless of previous states')
|
||||
if flags & SyncFlag.HEAD > 0:
|
||||
argparser.add_argument('--head', action='store_true', help='Start from latest block as offset')
|
||||
argparser.add_argument('--keep-alive', action='store_true', help='Do not stop syncing when caught up')
|
||||
|
||||
argparser.add_argument('--backend', type=str, help='Backend to use for state store')
|
||||
def apply_arg(arg):
|
||||
arg.add_long('offset', 'range', typ=int, help='Block to start sync from. Default is start of history (0).')
|
||||
arg.add_long('until', 'range', typ=int, default=-1, help='Block to stop sync on. Default is stop at block height of first run.')
|
||||
arg.add_long('single', 'range', typ=bool, help='Execute a single sync, regardless of previous states')
|
||||
arg.add_long('head', 'head', typ=bool, help='Start from latest block as offset')
|
||||
arg.add_long('keep-alive', 'head', typ=bool, help='Do not stop syncing when caught up')
|
||||
return arg
|
||||
|
Loading…
Reference in New Issue
Block a user