Best Python code snippet using stestr_python
coinex.py
Source:coinex.py
...13 def __init__(self, access_id=None, secret=None):14 self._access_id = access_id15 self._secret = secret16 def currency_rate(self):17 return self._v1('common/currency/rate')18 def asset_config(self, **params):19 return self._v1('common/asset/config', **params)20 def market_list(self):21 return self._v1('market/list')22 def market_ticker(self, market):23 return self._v1('market/ticker', market=market)24 def market_ticker_all(self):25 return self._v1('market/ticker/all')26 def market_depth(self, market, merge='0.00000001', **params):27 return self._v1('market/depth', market=market, merge=merge, **params)28 def market_deals(self, market, **params):29 return self._v1('market/deals', market=market, **params)30 def market_kline(self, market, type='1hour', **params):31 return self._v1('market/kline', market=market, type=type, **params)32 def market_info(self):33 return self._v1('market/info')34 def market_detail(self, market):35 return self._v1('market/detail', market=market)36 def margin_market(self):37 return self._v1('margin/market')38 def margin_transfer(self, from_account, to_account, coin_type, amount):39 return self._v1('margin/transfer', method='post', auth=True, from_account=from_account, to_account=to_account, coin_type=coin_type, amount=amount)40 def margin_account(self, **params):41 return self._v1('margin/account', auth=True, **params)42 def margin_config(self, **params):43 return self._v1('margin/config', auth=True, **params)44 def margin_loan_history(self, **params):45 return self._v1('margin/loan/history', auth=True, **params)46 def margin_loan(self, market, coin_type, amount):47 return self._v1('margin/loan', method='post', auth=True, market=market, coin_type=coin_type, amount=amount)48 def margin_flat(self, market, coin_type, amount, **params):49 return self._v1('margin/flat', method='post', auth=True, market=market, coin_type=coin_type, amount=amount, **params)50 def future_market(self):51 return self._v1('future/market')52 def future_transfer(self, from_account, to_account, coin_type, amount):53 return self._v1('future/transfer', method='post', auth=True, from_account=from_account, to_account=to_account, coin_type=coin_type, amount=amount)54 def future_account(self, **params):55 return self._v1('future/account', auth=True, **params)56 def future_limitprice(self, account_id):57 return self._v1('future/limitprice', account_id=account_id)58 def future_config(self, **params):59 return self._v1('future/config', auth=True, **params)60 def future_loan_history(self, account_id, **params):61 return self._v1('future/loan/history', auth=True, account_id=account_id, **params)62 def future_loan(self, account_id, coin_type, amount):63 return self._v1('future/loan', method='post', auth=True, account_id=account_id, coin_type=coin_type, amount=amount)64 def future_flat(self, account_id, coin_type, amount, **params):65 return self._v1('future/flat', method='post', auth=True, account_id=account_id, coin_type=coin_type, amount=amount, **params)66 def option_market(self):67 return self._v1('option/market')68 def option_detail(self):69 return self._v1('option/detail')70 def option_issue(self, market_type, amount):71 return self._v1('option/issue', method='post', auth=True, market_type=market_type, amount=amount)72 def option_redeem(self, market_type, amount):73 return self._v1('option/redeem', method='post', auth=True, market_type=market_type, amount=amount)74 def balance_info(self):75 return self._v1('balance/info', auth=True)76 def balance_coin_withdraw_list(self, **params):77 return self._v1('balance/coin/withdraw', auth=True, **params)78 def balance_coin_withdraw(self, coin_type, coin_address, actual_amount, transfer_method, **params):79 return self._v1('balance/coin/withdraw', method='post', auth=True, coin_type=coin_type, coin_address=coin_address, actual_amount=actual_amount, transfer_method=transfer_method, **params)80 def balance_coin_withdraw_cancel(self, coin_withdraw_id, **params):81 return self._v1('balance/coin/withdraw', method='delete', auth=True, coin_withdraw_id=coin_withdraw_id, **params)82 def balance_coin_deposit_list(self, **params):83 return self._v1('balance/coin/deposit', auth=True, **params)84 def balance_deposit_address(self, coin_type, **params):85 return self._v1('balance/deposit/address/{}'.format(coin_type), auth=True, **params)86 def balance_deposit_address_new(self, coin_type, **params):87 return self._v1('balance/deposit/address/{}'.format(coin_type), method='post', auth=True, **params)88 def sub_account_transfer(self, coin_type, amount, **params):89 return self._v1('sub_account/transfer', auth=True, coin_type=coin_type, amount=amount, **params)90 def order_limit(self, market, type, amount, price, **params):91 return self._v1('order/limit', method='post', auth=True, market=market, type=type, amount=amount, price=price, **params)92 def order_market(self, market, type, amount, **params):93 return self._v1('order/market', method='post', auth=True, market=market, type=type, amount=amount, **params)94 def order_ioc(self, market, type, amount, price, **params):95 return self._v1('order/ioc', method='post', auth=True, market=market, type=type, amount=amount, price=price, **params)96 def order_pending(self, market, page=1, limit=100):97 return self._v1('order/pending', method='get', auth=True, market=market, page=page, limit=limit)98 def order_finished(self, market, page=1, limit=100):99 return self._v1('order/finished', method='get', auth=True, market=market, page=page, limit=limit)100 def order_status(self, market, id):101 return self._v1('order/status', method='get', auth=True, market=market, id=id)102 def order_deals(self, id, page=1, limit=100):103 return self._v1('order/deals', method='get', auth=True, id=id, page=page, limit=limit)104 def order_user_deals(self, market, page=1, limit=100):105 return self._v1('order/user/deals', method='get', auth=True, market=market, page=page, limit=limit)106 def order_pending_cancel(self, market, id):107 return self._v1('order/pending', method='delete', auth=True, market=market, id=id)108 def order_pending_cancel_all(self, account_id, market):109 return self._v1('order/pending', method='delete', auth=True, account_id=account_id, market=market)110 def order_mining_difficulty(self):111 return self._v1('order/mining/difficulty', method='get', auth=True)112 def _v1(self, path, method='get', auth=False, **params):113 headers = dict(self._headers)114 if auth:115 if not self._access_id or not self._secret:116 raise CoinExApiError('API keys not configured')117 params.update(access_id=self._access_id)118 params.update(tonce=int(time.time() * 1000))119 params = collections.OrderedDict(sorted(params.items()))120 if auth:121 headers.update(Authorization=self._sign(params))122 if method == 'post':123 resp = requests.post('https://api.coinex.com/v1/' + path, json=params, headers=headers)124 else:125 fn = getattr(requests, method)126 resp = fn('https://api.coinex.com/v1/' + path, params=params, headers=headers)...
generic_graph_test.py
Source:generic_graph_test.py
1__author__ = 'Alexey Bright'2import unittest3from graphlib.generic_link import GenericLink4from graphlib.generic_graph import GenericGraph5from graphlib.generic_vertex import GenericVertex6from graphlib.algorithms import ordered_pair7class GenericGraphTest(unittest.TestCase):8 def setUp(self):9 self._gg = GenericGraph()10 self._v1 = GenericVertex()11 self._v2 = GenericVertex()12 self._v3 = GenericVertex()13 self._v4 = GenericVertex()14 self._v5 = GenericVertex()15 self._l1 = GenericLink()16 self._l2 = GenericLink()17 self._l3 = GenericLink()18 self._l4 = GenericLink()19 self._l5 = GenericLink() # 120 self._gg.connect(self._v1, self._v2, self._l1) # 1 -- 221 self._gg.connect(self._v1, self._v3, self._l2) # 2 | | 322 self._gg.connect(self._v2, self._v4, self._l3) # 3 -- 4 -- 523 self._gg.connect(self._v3, self._v4, self._l4) # 4 524 self._gg.connect(self._v4, self._v5, self._l5) #25 # -------------------------------------------------------------------------26 def test_init(self):27 self.assertEqual(len(self._gg.get_all_links()), 5)28 # -------------------------------------------------------------------------29 def test_add_vertex(self):30 v = GenericVertex()31 self._gg.add_vertex(v)32 self.assertEqual(self._gg.get_connected_vertices(v), set())33 # -------------------------------------------------------------------------34 def test_connect(self):35 link = GenericLink()36 self._gg.connect(self._v1, self._v4, link)37 self.assertEqual(self._gg.get_link(self._v1, self._v4), link)38 self.assert_(self._gg.connected(self._v1, self._v4))39 # -------------------------------------------------------------------------40 def test_disconnect(self):41 self._gg.disconnect(self._v1, self._v2)42 self.assert_(not self._gg.connected(self._v1, self._v2))43 # -------------------------------------------------------------------------44 def test_connected(self):45 self.assert_(self._gg.connected(self._v1, self._v2))46 self.assert_(not self._gg.connected(self._v1, self._v4))47 # -------------------------------------------------------------------------48 def test_get_link(self):49 self.assertEqual(self._gg.get_link(self._v1, self._v2), self._l1)50 # -------------------------------------------------------------------------51 def test_break_link(self):52 self._gg.break_link(self._l1)53 self.assert_(not self._gg.connected(self._v1, self._v2))54 # -------------------------------------------------------------------------55 def test_remove_vertex(self):56 self._gg.remove_vertex(self._v1)57 self.assert_(not self._gg.connected(self._v1, self._v2))58 self.assert_(not self._gg.connected(self._v1, self._v3))59 def test_get_connected_vertices(self):60 self.assertEqual(self._gg.get_connected_vertices(self._v1),61 {self._v2, self._v3})62 # -------------------------------------------------------------------------63 def test_get_linked_vertices(self):64 self.assertEqual(self._gg.get_linked_vertices(self._l1),65 ordered_pair(self._v1, self._v2))66 # -------------------------------------------------------------------------67 def test_get_adjacent_links(self):68 self.assertEqual({self._l1, self._l2},69 self._gg.get_adjacent_links(self._v1))70 # -------------------------------------------------------------------------71 def test_get_all_vertices(self):72 self.assertEqual(len(self._gg.get_all_vertices()), 5)73 # -------------------------------------------------------------------------74 def test_get_all_links(self):75 self.assertEqual(len(self._gg.get_all_links()), 5)76 # -------------------------------------------------------------------------77 def test_replace_node(self):78 v = GenericVertex()79 self._gg.replace_node(self._v4, v)80 self.assertEqual({self._v2, self._v3, self._v5},81 self._gg.get_connected_vertices(v))82 self.assertEqual({self._l3, self._l4, self._l5},83 self._gg.get_adjacent_links(v))84 self.assertEqual(self._gg.get_connected_vertices(self._v5), {v})85if __name__ == "__main__":...
__init__.py
Source:__init__.py
1# This file is MACHINE GENERATED! Do not edit.2# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.3"""Implementation of the Keras API meant to be a high-level API for TensorFlow.45Detailed documentation and user guides are available at6[keras.io](https://keras.io).78"""910from __future__ import print_function as _print_function1112from tensorflow.python.keras import Input13from tensorflow.python.keras import Model14from tensorflow.python.keras import Sequential15from tensorflow.python.keras import __version__16from tensorflow.python.keras.api._v1.keras import activations17from tensorflow.python.keras.api._v1.keras import applications18from tensorflow.python.keras.api._v1.keras import backend19from tensorflow.python.keras.api._v1.keras import callbacks20from tensorflow.python.keras.api._v1.keras import constraints21from tensorflow.python.keras.api._v1.keras import datasets22from tensorflow.python.keras.api._v1.keras import estimator23from tensorflow.python.keras.api._v1.keras import experimental24from tensorflow.python.keras.api._v1.keras import initializers25from tensorflow.python.keras.api._v1.keras import layers26from tensorflow.python.keras.api._v1.keras import losses27from tensorflow.python.keras.api._v1.keras import metrics28from tensorflow.python.keras.api._v1.keras import mixed_precision29from tensorflow.python.keras.api._v1.keras import models30from tensorflow.python.keras.api._v1.keras import optimizers31from tensorflow.python.keras.api._v1.keras import preprocessing32from tensorflow.python.keras.api._v1.keras import regularizers33from tensorflow.python.keras.api._v1.keras import utils34from tensorflow.python.keras.api._v1.keras import wrappers3536del _print_function3738import sys as _sys39from tensorflow.python.util import deprecation_wrapper as _deprecation_wrapper4041if not isinstance(_sys.modules[__name__], _deprecation_wrapper.DeprecationWrapper):42 _sys.modules[__name__] = _deprecation_wrapper.DeprecationWrapper(
...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!