type anotation fixes

This commit is contained in:
xmatthias 2018-05-30 22:38:09 +02:00
parent 88755fcded
commit 45909af7e0
4 changed files with 10 additions and 8 deletions

View File

@ -5,7 +5,7 @@ This module contains the configuration class
import json import json
import logging import logging
from argparse import Namespace from argparse import Namespace
from typing import Dict, Any from typing import Optional, Dict, Any
from jsonschema import Draft4Validator, validate from jsonschema import Draft4Validator, validate
from jsonschema.exceptions import ValidationError, best_match from jsonschema.exceptions import ValidationError, best_match
import ccxt import ccxt
@ -23,7 +23,7 @@ class Configuration(object):
""" """
def __init__(self, args: Namespace) -> None: def __init__(self, args: Namespace) -> None:
self.args = args self.args = args
self.config = None self.config: Optional[Dict[str, Any]] = None
def load_config(self) -> Dict[str, Any]: def load_config(self) -> Dict[str, Any]:
""" """
@ -192,7 +192,7 @@ class Configuration(object):
validate(conf, constants.CONF_SCHEMA) validate(conf, constants.CONF_SCHEMA)
return conf return conf
except ValidationError as exception: except ValidationError as exception:
logger.fatal( logger.critical(
'Invalid configuration. See config.json.example. Reason: %s', 'Invalid configuration. See config.json.example. Reason: %s',
exception exception
) )

View File

@ -83,7 +83,7 @@ def file_dump_json(filename, data, is_zip=False) -> None:
json.dump(data, fp, default=str) json.dump(data, fp, default=str)
def format_ms_time(date: str) -> str: def format_ms_time(date: int) -> str:
""" """
convert MS date to readable format. convert MS date to readable format.
: epoch-string in ms : epoch-string in ms

View File

@ -4,8 +4,8 @@ import gzip
import json import json
import logging import logging
import os import os
from typing import Optional, List, Dict, Tuple, Any
import arrow import arrow
from typing import Optional, List, Dict, Tuple
from freqtrade import misc, constants from freqtrade import misc, constants
from freqtrade.exchange import get_ticker_history from freqtrade.exchange import get_ticker_history
@ -139,7 +139,9 @@ def download_pairs(datadir, pairs: List[str],
def load_cached_data_for_updating(filename: str, def load_cached_data_for_updating(filename: str,
tick_interval: str, tick_interval: str,
timerange: Optional[Tuple[Tuple, int, int]]) -> Tuple[list, int]: timerange: Optional[Tuple[Tuple, int, int]]) -> Tuple[
List[Any],
Optional[int]]:
""" """
Load cached data and choose what part of the data should be updated Load cached data and choose what part of the data should be updated
""" """

View File

@ -5,7 +5,7 @@ This module contains the class to persist trades into SQLite
import logging import logging
from datetime import datetime from datetime import datetime
from decimal import Decimal, getcontext from decimal import Decimal, getcontext
from typing import Dict, Optional from typing import Dict, Optional, Any
import arrow import arrow
from sqlalchemy import (Boolean, Column, DateTime, Float, Integer, String, from sqlalchemy import (Boolean, Column, DateTime, Float, Integer, String,
@ -21,7 +21,7 @@ from sqlalchemy import inspect
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_CONF = {} _CONF = {}
_DECL_BASE = declarative_base() _DECL_BASE = declarative_base() # type: Any
def init(config: dict, engine: Optional[Engine] = None) -> None: def init(config: dict, engine: Optional[Engine] = None) -> None: