How to use _configure method in Slash

Best Python code snippet using slash

test_questrade.py

Source:test_questrade.py Github

copy

Full Screen

...4from questradeist.symbol import Symbol5class TestClass():6 SYMBOL = "ENB"7 SYMBOL_ID = 173568 def _configure(self, klass):9 refresh_token = os.getenv("QUESTRADE_TOKEN", None)10 assert refresh_token is not None11 qt = klass(refresh_token=refresh_token)12 assert qt.access_token is not None13 self.QT = qt14 def test_symbol_search(self):15 """Searching for stock ticker symbols"""16 self._configure(Symbol)17 symbols = self.QT.search(self.SYMBOL)18 assert len(symbols) > 119 assert symbols[0].SYMBOL == self.SYMBOL20 assert symbols[0].SYMBOLID == self.SYMBOL_ID21 symbols = self.QT.search("ENB", raw=True)22 assert isinstance(symbols, dict)23 def test_symbols(self):24 """Retrieving symbol data"""25 self._configure(Symbol)26 symbols = self.QT.get(symbols=[self.SYMBOL, ])27 assert(symbols[0].SYMBOL == self.SYMBOL)28 symbols = self.QT.get(ids=[self.SYMBOL_ID, ])29 assert(symbols[0].SYMBOL == self.SYMBOL)30 symbols = self.QT.get(ids=[self.SYMBOL_ID, ], raw=True)31 assert isinstance(symbols, dict)32 symbols = self.QT.get(symbols=[self.SYMBOL, ], raw=True)33 assert isinstance(symbols, dict)34 def test_history(self):35 """Retrieving EOD data"""36 self._configure(Symbol)37 end_time = datetime.datetime.today()38 start_time = end_time - datetime.timedelta(days=30)39 prices = self.QT.history(self.SYMBOL_ID, start_time, end_time)40 assert len(prices) > 1041 for p in prices:42 assert p.VOLUME != 043 prices = self.QT.history(self.SYMBOL_ID, start_time, end_time, raw=True)44 assert isinstance(prices, dict)45 def test_quotes(self):46 """Fetching latest prices for a ticker symbol"""47 self._configure(Symbol)48 quotes = self.QT.quotes([self.SYMBOL_ID, ])49 assert(quotes[0].SYMBOL == self.SYMBOL)50 quotes = self.QT.quotes([self.SYMBOL_ID], raw=True)51 assert isinstance(quotes, dict)52 def test_accounts(self):53 """Test fetching accounts"""54 self._configure(Account)55 accounts = self.QT.get_all()56 assert (len(accounts) != 0)57 for ac in accounts:58 assert(int(ac.NUMBER) > 0)59 def test_account_positions(self):60 """Fetching account positions"""61 self._configure(Account)62 accounts = self.QT.get_all()63 positions = self.QT.positions(int(accounts[0].NUMBER))64 assert(len(positions) > 0)65 for p in positions:66 assert(int(p.SYMBOLID) > 0)67 def test_account_activities(self):68 """Fetch the account activities"""69 self._configure(Account)70 accounts = self.QT.get_all()71 today = datetime.datetime.today()72 month_ago = today - datetime.timedelta(days=30)73 activities = self.QT.activities(int(accounts[0].NUMBER), today, month_ago)74 assert(len(activities) > 0)75 for ac in activities:76 print(ac.__dict__)77 assert(ac.SYMBOLID != '')78 def test_account_executions(self):79 """Fetch the account executions"""80 self._configure(Account)81 accounts = self.QT.get_all()82 executions = self.QT.executions(int(accounts[0].NUMBER))83 assert(len(executions) > 0)84 for e in executions:85 assert(e.SYMBOLID != '')86 # now with dates87 today = datetime.datetime.today()88 month_ago = today - datetime.timedelta(days=30)89 executions = self.QT.executions(int(accounts[0].NUMBER), month_ago, today)90 assert(len(executions) > 0)91 for e in executions:92 assert(e.SYMBOLID != '')93 def test_account_currency_balances(self):94 """Fetch the account balances"""95 self._configure(Account)96 accounts = self.QT.get_all()97 executions = self.QT.balances(int(accounts[0].NUMBER))98 assert(len(executions) > 0)99 for e in executions:100 assert(e.CURRENCY != '')101 def test_account_orders(self):102 """Test fetching orders for an account."""103 self._configure(Account)104 accounts = self.QT.get_all()105 today = datetime.datetime.today()106 month_ago = today - datetime.timedelta(days=30)107 orders = self.QT.orders(int(accounts[0].NUMBER), today, month_ago, state='Closed')108 print(orders)109 assert(len(orders) > 0)110 for o in orders:...

Full Screen

Full Screen

decorations_mixin.py

Source:decorations_mixin.py Github

copy

Full Screen

...27 if self.bar.horizontal:28 self._realdraw(offsetx=offsetx, offsety=self.offsety, width=width, height=height)29 else:30 self._realdraw(offsetx=self.offsetx, offsety=offsety, width=width, height=height)31 def _configure(self, qtile, bar):32 self._old_bar_configure(qtile, bar)33 self._realdraw = self.drawer.draw34 self.drawer.draw = self._offset_draw35 if not hasattr(classdef, "_injected_offsets"):36 classdef._offset_draw = _offset_draw37 classdef._old_bar_configure = classdef._configure38 classdef._configure = _configure39 classdef._injected_offsets = True40 classdef.height = height41 classdef.width = width42 43 @staticmethod44 def inject_decorations(classdef):45 """46 Method to inject ability for widgets to display decorations.47 """48 def new_clear(self, colour):49 """Draw decorations after clearing background."""50 self._clear(colour)51 for decoration in self.decorations:52 decoration.draw()53 def configure_decorations(self):54 if hasattr(self, "decorations"):55 if not self.configured:56 # Give each widget a copy of the decoration objects57 temp_decs = []58 for i, dec in enumerate(self.decorations):59 cloned_dec = dec.clone()60 cloned_dec._configure(self)61 temp_decs.append(cloned_dec)62 self.decorations = temp_decs63 self._clear = self.drawer.clear64 self.drawer.clear = self.new_clear65 def new_configure(self, qtile, bar):66 self.old_configure(qtile, bar)67 self.configure_decorations()68 if not hasattr(classdef, "_injected_decorations"):69 classdef.old_configure = classdef._configure70 classdef.new_clear = new_clear71 classdef.configure_decorations = configure_decorations72 classdef._configure = new_configure73 classdef.defaults.append(("decorations", [], "Decorations for widgets"))...

Full Screen

Full Screen

quest.py

Source:quest.py Github

copy

Full Screen

...9 api_version10from kano_profile.apps import load_app_state_variable11from kano_world.functions import is_registered12class WorldExplorerBadge(Badge):13 def _configure(self):14 super(WorldExplorerBadge, self)._configure()15 self._id = 'world-explorer'16 self._title = title = _("World Explorer")17 self._icon = quest_media(__file__, 'badge.svg')18 self._desc_locked = title19 self._desc_unlocked = _("You discovered Kano World!")20 self._bg_color = 'ffe591'21 self._image = self._icon22 self._image_locked = self._icon23 n = self._notification24 n['title'] = title25 n['byline'] = _("You made it to Kano World!")26 n['command'] = 'kano-profile badges'27 n['image'] = quest_media(__file__, 'badge-notification.png')28class Step1(Step):29 def _configure(self):30 super(Step1, self)._configure()31 self._title = _("Connect to wifi")32 def is_fulfilled(self):33 return is_internet()34class Step2(Step):35 def _configure(self):36 super(Step2, self)._configure()37 self._title = _("Connect your Kano World account")38 def is_fulfilled(self):39 return is_registered()40class Step3(Step):41 def _configure(self):42 super(Step3, self)._configure()43 self._title = _("Launch the Kano World app")44 self._events = [45 'kano-world-launched'46 ]47 def is_fulfilled(self):48 return load_app_state_variable('kano-world-launcher', 'opened')49class KanoWorldQuest(Quest):50 def _configure(self):51 super(KanoWorldQuest, self)._configure()52 self._id = 'travel-to-kano-world'53 self._title = _("Travel to Kano World")54 self._description = """55Godard distillery bitters dreamcatcher butcher, pop-up irony Austin scenester56narwhal retro raw denim. Irony pork belly slow-carb seitan Austin. Mlkshk57plaid Neutra, quinoa tattooed bitters Odd Future paleo Helvetica next level58crucifix High Life flannel VHS. Pour-over Austin paleo umami. Deep v small59batch mustache, fap polaroid try-hard biodiesel dreamcatcher wayfarers butcher60Schlitz you probably haven't heard of them. Odd Future lumbersexual umami61hella fap you probably haven't heard of them American Apparel, paleo wolf62whatever readymade farm-to-table. Thundercats Pitchfork brunch drinking63vinegar, four loko fashion axe polaroid freegan trust fund scenester meggings64semiotics keytar vegan."""65 self._icon = quest_media(__file__, 'quest-icon.svg')...

Full Screen

Full Screen

Configure.py

Source:Configure.py Github

copy

Full Screen

1class Configure:2 def __init__(self, configure=None):3 self._configure = self.generate_default_configure()4 if configure is not None:5 self.update(configure)6 def generate_default_configure(self) -> dict:7 default_configure = {8 "device": "cuda:0",9 "top_k": 10,10 "top_p": 0.90,11 "repetition_penalty": 1.2,12 "repetition_window": 4,13 "max_length": 512,14 "max_summary_length": 30,15 "summary_nums": 1016 }17 return default_configure18 def update(self, configure: dict) -> None:19 updated_key = []20 for key, value in configure.items():...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful