Merge pull request #976 from freqtrade/sort-imports

sort imports
This commit is contained in:
Michael Egger 2018-07-04 16:59:42 +02:00 committed by GitHub
commit 64c68d93c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 71 additions and 65 deletions

View File

@ -7,8 +7,8 @@ To launch Freqtrade as a module
""" """
import sys import sys
from freqtrade import main
from freqtrade import main
if __name__ == '__main__': if __name__ == '__main__':
main.set_loggers() main.set_loggers()

View File

@ -12,8 +12,7 @@ from pandas import DataFrame, to_datetime
from freqtrade import constants from freqtrade import constants
from freqtrade.exchange import Exchange from freqtrade.exchange import Exchange
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.strategy.resolver import StrategyResolver, IStrategy from freqtrade.strategy.resolver import IStrategy, StrategyResolver
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -2,12 +2,13 @@
This module contains the argument manager class This module contains the argument manager class
""" """
import os
import argparse import argparse
import logging import logging
import os
import re import re
from typing import List, NamedTuple, Optional
import arrow import arrow
from typing import List, Optional, NamedTuple
from freqtrade import __version__, constants from freqtrade import __version__, constants

View File

@ -1,18 +1,18 @@
""" """
This module contains the configuration class This module contains the configuration class
""" """
import os
import json import json
import logging import logging
import os
from argparse import Namespace from argparse import Namespace
from typing import Optional, Dict, Any from typing import Any, Dict, Optional
import ccxt
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
from freqtrade import OperationalException, constants from freqtrade import OperationalException, constants
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -7,10 +7,12 @@ import logging
import time import time
from typing import Dict, List from typing import Dict, List
from coinmarketcap import Market
from requests.exceptions import RequestException from requests.exceptions import RequestException
from coinmarketcap import Market
from freqtrade.constants import SUPPORTED_FIAT from freqtrade.constants import SUPPORTED_FIAT
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -7,16 +7,14 @@ import logging
import time import time
import traceback import traceback
from datetime import datetime from datetime import datetime
from typing import Dict, List, Optional, Any, Callable from typing import Any, Callable, Dict, List, Optional
import arrow import arrow
import requests import requests
from cachetools import TTLCache, cached from cachetools import TTLCache, cached
from freqtrade import ( from freqtrade import (DependencyException, OperationalException,
DependencyException, OperationalException, TemporaryError, persistence, __version__, TemporaryError, __version__, constants, persistence)
)
from freqtrade import constants
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtrade.exchange import Exchange from freqtrade.exchange import Exchange
from freqtrade.fiat_convert import CryptoToFiatConverter from freqtrade.fiat_convert import CryptoToFiatConverter

View File

@ -1,4 +1,4 @@
from math import exp, pi, sqrt, cos from math import cos, exp, pi, sqrt
import numpy as np import numpy as np
import talib as ta import talib as ta

View File

@ -2,10 +2,10 @@
Various tool function for Freqtrade and scripts Various tool function for Freqtrade and scripts
""" """
import gzip
import json import json
import logging import logging
import re import re
import gzip
from datetime import datetime from datetime import datetime
from typing import Dict from typing import Dict

View File

@ -7,18 +7,18 @@ import logging
import operator import operator
from argparse import Namespace from argparse import Namespace
from datetime import datetime from datetime import datetime
from typing import Dict, Tuple, Any, List, Optional, NamedTuple from typing import Any, Dict, List, NamedTuple, Optional, Tuple
import arrow import arrow
from pandas import DataFrame from pandas import DataFrame
from tabulate import tabulate from tabulate import tabulate
import freqtrade.optimize as optimize import freqtrade.optimize as optimize
from freqtrade import constants, DependencyException from freqtrade import DependencyException, constants
from freqtrade.exchange import Exchange
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtrade.arguments import Arguments from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration from freqtrade.configuration import Configuration
from freqtrade.exchange import Exchange
from freqtrade.misc import file_dump_json from freqtrade.misc import file_dump_json
from freqtrade.persistence import Trade from freqtrade.persistence import Trade

View File

@ -5,12 +5,11 @@ 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, Any from typing import Any, Dict, Optional
import arrow import arrow
from sqlalchemy import (Boolean, Column, DateTime, Float, Integer, String, from sqlalchemy import (Boolean, Column, DateTime, Float, Integer, String,
create_engine) create_engine, inspect)
from sqlalchemy import inspect
from sqlalchemy.exc import NoSuchModuleError from sqlalchemy.exc import NoSuchModuleError
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm.scoping import scoped_session from sqlalchemy.orm.scoping import scoped_session

View File

@ -3,9 +3,9 @@ This module contains class to define a RPC communications
""" """
import logging import logging
from abc import abstractmethod from abc import abstractmethod
from datetime import datetime, timedelta, date from datetime import date, datetime, timedelta
from decimal import Decimal from decimal import Decimal
from typing import Dict, Tuple, Any, List from typing import Any, Dict, List, Tuple
import arrow import arrow
import sqlalchemy as sql import sqlalchemy as sql

View File

@ -2,8 +2,8 @@
IStrategy interface IStrategy interface
This module defines the interface to apply for strategies This module defines the interface to apply for strategies
""" """
from typing import Dict
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import Dict
from pandas import DataFrame from pandas import DataFrame

View File

@ -8,13 +8,12 @@ import inspect
import logging import logging
import os import os
from collections import OrderedDict from collections import OrderedDict
from typing import Optional, Dict, Type from typing import Dict, Optional, Type
from freqtrade import constants from freqtrade import constants
from freqtrade.strategy import import_strategy from freqtrade.strategy import import_strategy
from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.interface import IStrategy
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -2,8 +2,8 @@
import json import json
import logging import logging
from datetime import datetime from datetime import datetime
from typing import Dict, Optional
from functools import reduce from functools import reduce
from typing import Dict, Optional
from unittest.mock import MagicMock from unittest.mock import MagicMock
import arrow import arrow
@ -11,8 +11,8 @@ import pytest
from jsonschema import validate from jsonschema import validate
from telegram import Chat, Message, Update from telegram import Chat, Message, Update
from freqtrade.analyze import Analyze
from freqtrade import constants from freqtrade import constants
from freqtrade.analyze import Analyze
from freqtrade.exchange import Exchange from freqtrade.exchange import Exchange
from freqtrade.freqtradebot import FreqtradeBot from freqtrade.freqtradebot import FreqtradeBot

View File

@ -2,16 +2,16 @@
# pragma pylint: disable=protected-access # pragma pylint: disable=protected-access
import logging import logging
from copy import deepcopy from copy import deepcopy
from random import randint
from datetime import datetime from datetime import datetime
from random import randint
from unittest.mock import MagicMock, PropertyMock from unittest.mock import MagicMock, PropertyMock
import ccxt import ccxt
import pytest import pytest
from freqtrade import OperationalException, DependencyException, TemporaryError from freqtrade import DependencyException, OperationalException, TemporaryError
from freqtrade.exchange import Exchange, API_RETRY_COUNT from freqtrade.exchange import API_RETRY_COUNT, Exchange
from freqtrade.tests.conftest import log_has, get_patched_exchange from freqtrade.tests.conftest import get_patched_exchange, log_has
def ccxt_exceptionhandlers(mocker, default_conf, api_mock, fun, mock_ccxt_fun, **kwargs): def ccxt_exceptionhandlers(mocker, default_conf, api_mock, fun, mock_ccxt_fun, **kwargs):

View File

@ -3,19 +3,20 @@
import json import json
import math import math
import random import random
import pytest
from copy import deepcopy from copy import deepcopy
from typing import List from typing import List
from unittest.mock import MagicMock from unittest.mock import MagicMock
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import pytest
from arrow import Arrow from arrow import Arrow
from freqtrade import optimize, constants, DependencyException from freqtrade import DependencyException, constants, optimize
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtrade.arguments import Arguments, TimeRange from freqtrade.arguments import Arguments, TimeRange
from freqtrade.optimize.backtesting import Backtesting, start, setup_configuration from freqtrade.optimize.backtesting import (Backtesting, setup_configuration,
start)
from freqtrade.tests.conftest import log_has, patch_exchange from freqtrade.tests.conftest import log_has, patch_exchange

View File

@ -3,16 +3,19 @@
import json import json
import os import os
import uuid import uuid
import arrow
from shutil import copyfile from shutil import copyfile
import arrow
from freqtrade import optimize from freqtrade import optimize
from freqtrade.misc import file_dump_json
from freqtrade.optimize.__init__ import make_testdata_path, download_pairs, \
download_backtesting_testdata, load_tickerdata_file, trim_tickerlist, \
load_cached_data_for_updating
from freqtrade.arguments import TimeRange from freqtrade.arguments import TimeRange
from freqtrade.tests.conftest import log_has, get_patched_exchange from freqtrade.misc import file_dump_json
from freqtrade.optimize.__init__ import (download_backtesting_testdata,
download_pairs,
load_cached_data_for_updating,
load_tickerdata_file,
make_testdata_path, trim_tickerlist)
from freqtrade.tests.conftest import get_patched_exchange, log_has
# Change this if modifying UNITTEST/BTC testdatafile # Change this if modifying UNITTEST/BTC testdatafile
_BTC_UNITTEST_LENGTH = 13681 _BTC_UNITTEST_LENGTH = 13681

View File

@ -13,7 +13,8 @@ from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.rpc.rpc import RPC, RPCException from freqtrade.rpc.rpc import RPC, RPCException
from freqtrade.state import State from freqtrade.state import State
from freqtrade.tests.test_freqtradebot import patch_get_signal, patch_coinmarketcap from freqtrade.tests.test_freqtradebot import (patch_coinmarketcap,
patch_get_signal)
# Functions for recurrent object patching # Functions for recurrent object patching

View File

@ -7,7 +7,7 @@ from copy import deepcopy
from unittest.mock import MagicMock from unittest.mock import MagicMock
from freqtrade.rpc.rpc_manager import RPCManager from freqtrade.rpc.rpc_manager import RPCManager
from freqtrade.tests.conftest import log_has, get_patched_freqtradebot from freqtrade.tests.conftest import get_patched_freqtradebot, log_has
def test_rpc_manager_object() -> None: def test_rpc_manager_object() -> None:

View File

@ -11,17 +11,18 @@ from datetime import datetime
from random import randint from random import randint
from unittest.mock import MagicMock from unittest.mock import MagicMock
from telegram import Update, Message, Chat from telegram import Chat, Message, Update
from telegram.error import NetworkError from telegram.error import NetworkError
from freqtrade import __version__ from freqtrade import __version__
from freqtrade.freqtradebot import FreqtradeBot from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.rpc.telegram import Telegram from freqtrade.rpc.telegram import Telegram, authorized_only
from freqtrade.rpc.telegram import authorized_only
from freqtrade.state import State from freqtrade.state import State
from freqtrade.tests.conftest import get_patched_freqtradebot, patch_exchange, log_has from freqtrade.tests.conftest import (get_patched_freqtradebot, log_has,
from freqtrade.tests.test_freqtradebot import patch_get_signal, patch_coinmarketcap patch_exchange)
from freqtrade.tests.test_freqtradebot import (patch_coinmarketcap,
patch_get_signal)
class DummyCls(Telegram): class DummyCls(Telegram):

View File

@ -1,8 +1,9 @@
# pragma pylint: disable=missing-docstring,C0103,protected-access # pragma pylint: disable=missing-docstring,C0103,protected-access
import freqtrade.tests.conftest as tt # test tools
from unittest.mock import MagicMock from unittest.mock import MagicMock
import freqtrade.tests.conftest as tt # test tools
# whitelist, blacklist, filtering, all of that will # whitelist, blacklist, filtering, all of that will
# eventually become some rules to run on a generic ACL engine # eventually become some rules to run on a generic ACL engine
# perhaps try to anticipate that by using some python package # perhaps try to anticipate that by using some python package

View File

@ -12,9 +12,9 @@ import arrow
from pandas import DataFrame from pandas import DataFrame
from freqtrade.analyze import Analyze, SignalType from freqtrade.analyze import Analyze, SignalType
from freqtrade.optimize.__init__ import load_tickerdata_file
from freqtrade.arguments import TimeRange from freqtrade.arguments import TimeRange
from freqtrade.tests.conftest import log_has, get_patched_exchange from freqtrade.optimize.__init__ import load_tickerdata_file
from freqtrade.tests.conftest import get_patched_exchange, log_has
# Avoid to reinit the same object again and again # Avoid to reinit the same object again and again
_ANALYZE = Analyze({'strategy': 'DefaultStrategy'}) _ANALYZE = Analyze({'strategy': 'DefaultStrategy'})

View File

@ -4,18 +4,18 @@
Unit test file for configuration.py Unit test file for configuration.py
""" """
import json import json
from argparse import Namespace
from copy import deepcopy from copy import deepcopy
from unittest.mock import MagicMock from unittest.mock import MagicMock
from argparse import Namespace
import pytest import pytest
from jsonschema import ValidationError from jsonschema import ValidationError
from freqtrade import OperationalException
from freqtrade.arguments import Arguments from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration from freqtrade.configuration import Configuration
from freqtrade.constants import DEFAULT_DB_PROD_URL, DEFAULT_DB_DRYRUN_URL from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
from freqtrade.tests.conftest import log_has from freqtrade.tests.conftest import log_has
from freqtrade import OperationalException
def test_configuration_object() -> None: def test_configuration_object() -> None:

View File

@ -5,7 +5,6 @@ import time
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pytest import pytest
from requests.exceptions import RequestException from requests.exceptions import RequestException
from freqtrade.fiat_convert import CryptoFiat, CryptoToFiatConverter from freqtrade.fiat_convert import CryptoFiat, CryptoToFiatConverter

View File

@ -14,11 +14,13 @@ import arrow
import pytest import pytest
import requests import requests
from freqtrade import constants, DependencyException, OperationalException, TemporaryError from freqtrade import (DependencyException, OperationalException,
TemporaryError, constants)
from freqtrade.freqtradebot import FreqtradeBot from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.state import State from freqtrade.state import State
from freqtrade.tests.conftest import log_has, patch_coinmarketcap, patch_exchange from freqtrade.tests.conftest import (log_has, patch_coinmarketcap,
patch_exchange)
# Functions for recurrent object patching # Functions for recurrent object patching

View File

@ -1,6 +1,6 @@
import pandas as pd import pandas as pd
from freqtrade.indicator_helpers import went_up, went_down from freqtrade.indicator_helpers import went_down, went_up
def test_went_up(): def test_went_up():

View File

@ -11,7 +11,7 @@ import pytest
from freqtrade import OperationalException from freqtrade import OperationalException
from freqtrade.arguments import Arguments from freqtrade.arguments import Arguments
from freqtrade.freqtradebot import FreqtradeBot from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.main import main, set_loggers, reconfigure from freqtrade.main import main, reconfigure, set_loggers
from freqtrade.state import State from freqtrade.state import State
from freqtrade.tests.conftest import log_has, patch_exchange from freqtrade.tests.conftest import log_has, patch_exchange

View File

@ -8,8 +8,8 @@ import datetime
from unittest.mock import MagicMock from unittest.mock import MagicMock
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtrade.misc import (shorten_date, datesarray_to_datetimearray, from freqtrade.misc import (common_datearray, datesarray_to_datetimearray,
common_datearray, file_dump_json, format_ms_time) file_dump_json, format_ms_time, shorten_date)
from freqtrade.optimize.__init__ import load_tickerdata_file from freqtrade.optimize.__init__ import load_tickerdata_file

View File

@ -5,8 +5,8 @@ from unittest.mock import MagicMock
import pytest import pytest
from sqlalchemy import create_engine from sqlalchemy import create_engine
from freqtrade import constants, OperationalException from freqtrade import OperationalException, constants
from freqtrade.persistence import Trade, init, clean_dry_run_db from freqtrade.persistence import Trade, clean_dry_run_db, init
from freqtrade.tests.conftest import log_has from freqtrade.tests.conftest import log_has