Add typehints
This commit is contained in:
parent
86313b337a
commit
b4630c403d
@ -7,7 +7,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from jsonschema import Draft4Validator, validators
|
from jsonschema import Draft4Validator, validators
|
||||||
from jsonschema.exceptions import ValidationError, best_match
|
from jsonschema.exceptions import ValidationError, best_match
|
||||||
@ -17,7 +17,6 @@ from freqtrade.exchange import is_exchange_supported, supported_exchanges
|
|||||||
from freqtrade.misc import deep_merge_dicts
|
from freqtrade.misc import deep_merge_dicts
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -210,11 +209,16 @@ class Configuration(object):
|
|||||||
logger.info(f'Created data directory: {datadir}')
|
logger.info(f'Created data directory: {datadir}')
|
||||||
return datadir
|
return datadir
|
||||||
|
|
||||||
def _args_to_config(self, config, argname, logstring, logfun=None) -> None:
|
def _args_to_config(self, config: Dict[str, Any], argname: str,
|
||||||
|
logstring: str, logfun=Optional[Callable]) -> None:
|
||||||
"""
|
"""
|
||||||
logfun is applied to the configuration entry before passing
|
:param config: Configuration dictionary
|
||||||
that entry to the log string using .format().
|
:param argname: Argumentname in self.args - will be copied to config dict.
|
||||||
sample: logfun=len (prints the length of the found configuration instead of the content)
|
:param logstring: Logging String
|
||||||
|
:param logfun: logfun is applied to the configuration entry before passing
|
||||||
|
that entry to the log string using .format().
|
||||||
|
sample: logfun=len (prints the length of the found
|
||||||
|
configuration instead of the content)
|
||||||
"""
|
"""
|
||||||
if argname in self.args and getattr(self.args, argname):
|
if argname in self.args and getattr(self.args, argname):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user