]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/commitdiff
Small refactor for `super` use
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 2 Apr 2018 11:40:14 +0000 (13:40 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 2 Apr 2018 11:40:14 +0000 (13:40 +0200)
ccxt_wrapper.py
test.py

index 97f359fa568c7fd813784dad922e431849dfb068..260d49dccbe2a2221b79fe8c36be70d940a24ab3 100644 (file)
@@ -21,7 +21,7 @@ class poloniexE(poloniex):
         Wrapped to allow retry of non-posting requests"
         """
 
-        origin_request = super(poloniexE, self).request
+        origin_request = super().request
         kwargs = {
                 "api": api,
                 "method": method,
@@ -38,7 +38,7 @@ class poloniexE(poloniex):
             return origin_request(path, **kwargs)
 
     def __init__(self, *args, **kwargs):
-        super(poloniexE, self).__init__(*args, **kwargs)
+        super().__init__(*args, **kwargs)
 
         # For requests logging
         self.session.origin_request = self.session.request
@@ -223,7 +223,7 @@ class poloniexE(poloniex):
         return all_balances
 
     def create_exchange_order(self, symbol, type, side, amount, price=None, params={}):
-        return super(poloniexE, self).create_order(symbol, type, side, amount, price=price, params=params)
+        return super().create_order(symbol, type, side, amount, price=price, params=params)
 
     def create_margin_order(self, symbol, type, side, amount, price=None, lending_rate=None, params={}):
         if type == 'market':
diff --git a/test.py b/test.py
index c229801246219870d99e5f8c574793dd96f1ddcc..9ea9df47b371290740f697e74ea7a4d3c54eb14a 100644 (file)
--- a/test.py
+++ b/test.py
@@ -27,7 +27,7 @@ class WebMockTestCase(unittest.TestCase):
         return type('Args', (object,), { "debug": debug, "quiet": quiet })()
 
     def setUp(self):
-        super(WebMockTestCase, self).setUp()
+        super().setUp()
         self.wm = requests_mock.Mocker()
         self.wm.start()
 
@@ -55,12 +55,12 @@ class WebMockTestCase(unittest.TestCase):
         for patcher in self.patchers:
             patcher.stop()
         self.wm.stop()
-        super(WebMockTestCase, self).tearDown()
+        super().tearDown()
 
 @unittest.skipUnless("unit" in limits, "Unit skipped")
 class poloniexETest(unittest.TestCase):
     def setUp(self):
-        super(poloniexETest, self).setUp()
+        super().setUp()
         self.wm = requests_mock.Mocker()
         self.wm.start()
 
@@ -68,7 +68,7 @@ class poloniexETest(unittest.TestCase):
 
     def tearDown(self):
         self.wm.stop()
-        super(poloniexETest, self).tearDown()
+        super().tearDown()
 
     def test__init(self):
         with mock.patch("market.ccxt.poloniexE.session") as session:
@@ -609,7 +609,7 @@ class LockedVar(unittest.TestCase):
 @unittest.skipUnless("unit" in limits, "Unit skipped")
 class PortfolioTest(WebMockTestCase):
     def setUp(self):
-        super(PortfolioTest, self).setUp()
+        super().setUp()
 
         with open("test_samples/test_portfolio.json") as example:
             self.json_response = example.read()
@@ -1154,7 +1154,7 @@ class BalanceTest(WebMockTestCase):
 @unittest.skipUnless("unit" in limits, "Unit skipped")
 class MarketTest(WebMockTestCase):
     def setUp(self):
-        super(MarketTest, self).setUp()
+        super().setUp()
 
         self.ccxt = mock.Mock(spec=market.ccxt.poloniexE)
 
@@ -2056,7 +2056,7 @@ class TradeStoreTest(WebMockTestCase):
 @unittest.skipUnless("unit" in limits, "Unit skipped")
 class BalanceStoreTest(WebMockTestCase):
     def setUp(self):
-        super(BalanceStoreTest, self).setUp()
+        super().setUp()
 
         self.fetch_balance = {
                 "ETC": {