linter fixes and cleanups
This commit is contained in:
parent
1b6b0ad9d2
commit
0abc30401c
@ -57,8 +57,8 @@ def load_config(path: str) -> Dict:
|
|||||||
try:
|
try:
|
||||||
validate(conf, CONF_SCHEMA)
|
validate(conf, CONF_SCHEMA)
|
||||||
return conf
|
return conf
|
||||||
except ValidationError as ex:
|
except ValidationError as exception:
|
||||||
logger.fatal('Invalid configuration. See config.json.example. Reason: %s', ex)
|
logger.fatal('Invalid configuration. See config.json.example. Reason: %s', exception)
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
best_match(Draft4Validator(CONF_SCHEMA).iter_errors(conf)).message
|
best_match(Draft4Validator(CONF_SCHEMA).iter_errors(conf)).message
|
||||||
)
|
)
|
||||||
@ -81,7 +81,7 @@ def throttle(func: Callable[..., Any], min_secs: float, *args, **kwargs) -> Any:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def parse_args_common(args: List[str], description: str):
|
def common_args_parser(description: str):
|
||||||
"""
|
"""
|
||||||
Parses given common arguments and returns them as a parsed object.
|
Parses given common arguments and returns them as a parsed object.
|
||||||
"""
|
"""
|
||||||
@ -117,11 +117,11 @@ def parse_args(args: List[str], description: str):
|
|||||||
Parses given arguments and returns an argparse Namespace instance.
|
Parses given arguments and returns an argparse Namespace instance.
|
||||||
Returns None if a sub command has been selected and executed.
|
Returns None if a sub command has been selected and executed.
|
||||||
"""
|
"""
|
||||||
parser = parse_args_common(args, description)
|
parser = common_args_parser(description)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--dry-run-db',
|
'--dry-run-db',
|
||||||
help='Force dry run to use a local DB "tradesv3.dry_run.sqlite" instead of memory DB. Work only if dry_run is \
|
help='Force dry run to use a local DB "tradesv3.dry_run.sqlite" \
|
||||||
enabled.', # noqa
|
instead of memory DB. Work only if dry_run is enabled.',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
dest='dry_run_db',
|
dest='dry_run_db',
|
||||||
)
|
)
|
||||||
@ -135,7 +135,8 @@ def parse_args(args: List[str], description: str):
|
|||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--dynamic-whitelist',
|
'--dynamic-whitelist',
|
||||||
help='dynamically generate and update whitelist based on 24h BaseVolume (Default 20 currencies)', # noqa
|
help='dynamically generate and update whitelist \
|
||||||
|
based on 24h BaseVolume (Default 20 currencies)', # noqa
|
||||||
dest='dynamic_whitelist',
|
dest='dynamic_whitelist',
|
||||||
const=20,
|
const=20,
|
||||||
type=int,
|
type=int,
|
||||||
|
@ -8,7 +8,7 @@ import pytest
|
|||||||
from jsonschema import ValidationError
|
from jsonschema import ValidationError
|
||||||
|
|
||||||
from freqtrade.misc import throttle, parse_args, load_config,\
|
from freqtrade.misc import throttle, parse_args, load_config,\
|
||||||
parse_args_common
|
common_args_parser
|
||||||
|
|
||||||
|
|
||||||
def test_throttle():
|
def test_throttle():
|
||||||
@ -39,12 +39,10 @@ def test_throttle_with_assets():
|
|||||||
assert result == -1
|
assert result == -1
|
||||||
|
|
||||||
|
|
||||||
# Parse common command-line-arguments
|
# Parse common command-line-arguments. Used for all tools
|
||||||
# used for all tools
|
|
||||||
|
|
||||||
|
|
||||||
def test_parse_args_none():
|
def test_parse_args_none():
|
||||||
args = parse_args_common([], '')
|
args = common_args_parser('')
|
||||||
assert isinstance(args, argparse.ArgumentParser)
|
assert isinstance(args, argparse.ArgumentParser)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ import matplotlib # Install PYQT5 manually if you want to test this helper func
|
|||||||
matplotlib.use("Qt5Agg")
|
matplotlib.use("Qt5Agg")
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from freqtrade import exchange, analyze
|
from freqtrade import exchange, analyze
|
||||||
from freqtrade.misc import parse_args_common
|
from freqtrade.misc import common_args_parser
|
||||||
|
|
||||||
|
|
||||||
def plot_parse_args(args ):
|
def plot_parse_args(args ):
|
||||||
parser = parse_args_common(args, 'Graph utility')
|
parser = common_args_parser(args, 'Graph utility')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--pair',
|
'-p', '--pair',
|
||||||
help = 'What currency pair',
|
help = 'What currency pair',
|
||||||
|
Loading…
Reference in New Issue
Block a user