Remove debugging code and loop constructor
This commit is contained in:
parent
053293dfee
commit
971a6733a9
|
@ -114,7 +114,7 @@ class TestTransactions(TestCase):
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
def mock_hmset(self, string, data):
|
def mock_hmset(self, string, data):
|
||||||
print("HMSET", string, data)
|
pass
|
||||||
|
|
||||||
def mock_keys(self, string):
|
def mock_keys(self, string):
|
||||||
return [v["id"] for k, v in self.trades.items() if k in self.return_trades]
|
return [v["id"] for k, v in self.trades.items() if k in self.return_trades]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# Twisted/Klein imports
|
# Twisted/Klein imports
|
||||||
from twisted.logger import Logger
|
from twisted.logger import Logger
|
||||||
from twisted.internet import reactor
|
|
||||||
from twisted.internet.task import LoopingCall, deferLater
|
|
||||||
|
|
||||||
# Other library imports
|
# Other library imports
|
||||||
from httpx import ReadTimeout, ReadError, RemoteProtocolError
|
from httpx import ReadTimeout, ReadError, RemoteProtocolError
|
||||||
|
@ -25,26 +23,6 @@ def xmerge_attrs(init_map):
|
||||||
setattr(object_instance, classname_inside, object_instance_inside)
|
setattr(object_instance, classname_inside, object_instance_inside)
|
||||||
|
|
||||||
|
|
||||||
def setup_call_loops(token_setting, function_init, function_continuous, delay, function_post_start=None):
|
|
||||||
"""
|
|
||||||
Setup the loops for dealing with access, refresh and auth tokens for various providers.
|
|
||||||
:param token_setting: the setting for whether to do the initial authentication
|
|
||||||
:param function_init: the initial authentication function
|
|
||||||
:param function_continuous: the ongoing authentication function (refresh_token -> access_token)
|
|
||||||
:param delay: time in seconds to wait between calls to function_continuous
|
|
||||||
:param function_post_start: an optional function to run after the access token is obtained
|
|
||||||
"""
|
|
||||||
if token_setting == "1":
|
|
||||||
deferLater(reactor, 1, function_init)
|
|
||||||
else:
|
|
||||||
deferLater(reactor, 1, function_continuous, True)
|
|
||||||
if function_post_start:
|
|
||||||
deferLater(reactor, 4, function_post_start)
|
|
||||||
|
|
||||||
lc = LoopingCall(function_continuous)
|
|
||||||
lc.start(delay)
|
|
||||||
|
|
||||||
|
|
||||||
def convert(data):
|
def convert(data):
|
||||||
"""
|
"""
|
||||||
Recursively convert a dictionary.
|
Recursively convert a dictionary.
|
||||||
|
|
Loading…
Reference in New Issue