How to use retrieve_config method in avocado

Best Python code snippet using avocado_python

service_manager.py

Source:service_manager.py Github

copy

Full Screen

...43 and version == CtsVersion.ONE_DOT_ZERO44 )45 ):46 service = SiriusXmService(47 config=config_manager.retrieve_config(SiriusXmConfig),48 table=get_main_table(config_manager.retrieve_config(DynamoConfig)),49 )50 elif (51 programcode52 and programcode.lower() == ProgramCode.FCA.name.lower()53 and version == CtsVersion.ONE_DOT_ZERO54 ):55 service = FcaService(56 config=config_manager.retrieve_config(FcaConfig),57 table=get_main_table(config_manager.retrieve_config(DynamoConfig)),58 supplementtable=get_supplement_table(59 config_manager.retrieve_config(DynamoConfig)60 ),61 )62 elif (63 programcode64 and programcode.lower() == ProgramCode.VWCARNET.name.lower()65 and version == CtsVersion.ONE_DOT_ZERO66 ):67 service = VerizonService(68 config=config_manager.retrieve_config(VerizonConfig),69 table=get_main_table(config_manager.retrieve_config(DynamoConfig)),70 supplementtable=get_supplement_table(71 config_manager.retrieve_config(DynamoConfig)72 ),73 )74 elif (75 programcode76 and programcode.lower() == ProgramCode.VWCARNET.name.lower()77 and version == CtsVersion.TWO_DOT_ZERO78 ):79 service = AerisService(80 config=config_manager.retrieve_config(AerisConfig),81 table=get_main_table(config_manager.retrieve_config(DynamoConfig)),82 )83 elif (84 programcode85 and programcode.lower() == ProgramCode.PORSCHE.name.lower()86 and version == CtsVersion.ONE_DOT_ZERO87 ):88 service = VodafoneService(89 config=config_manager.retrieve_config(VodafoneConfig),90 table=get_main_table(config_manager.retrieve_config(DynamoConfig)),91 supplementtable=get_supplement_table(92 config_manager.retrieve_config(DynamoConfig)93 ),94 )95 elif (96 programcode97 and programcode.lower() == ProgramCode.TOYOTA.name.lower()98 and version == CtsVersion.TWO_DOT_ZERO99 ):100 service = TmnaService(101 config=config_manager.retrieve_config(TmnaConfig),102 )103 elif (104 programcode105 and programcode.lower() == ProgramCode.SUBARU.name.lower()106 and version == CtsVersion.TWO_DOT_ZERO107 ):108 service = WirelessCarService(109 config=config_manager.retrieve_config(WirelessCarConfig),110 )...

Full Screen

Full Screen

initialization.py

Source:initialization.py Github

copy

Full Screen

...15 :param P: number of inducing inputs16 :param D: dimensionality of inducing input17 :return: inducing inputs (P, D)18 """19 method = retrieve_config(config_inducing_inputs, 'method',20 "init_inducing_inputs: Keyword 'method' required. \21 Can be 'kmeans', 'random', 'randomXpermutedU'")22 # Cluster GP input data, cluster centers become inducing input23 if method == 'kmeans':24 assert 'X' in kwargs, 'Keyword argument X required: GP training input'25 X = kwargs['X']26 from sklearn.cluster import KMeans27 m = KMeans(n_clusters=P, n_init=50, max_iter=500)28 m.fit(X.copy())29 Z = m.cluster_centers_.copy()30 # Randomly draw inducing inputs i.i.d. from N(0,1)31 if method == 'random':32 noise = retrieve_config(config_inducing_inputs, 'noise',33 "init_inducing_inputs: Keyword 'noise' required.")34 Z = np.sqrt(noise) * np.random.randn(P, D)35 if method == 'uniform':36 low = retrieve_config(config_inducing_inputs, 'low',37 "init_inducing_inputs: Keyword 'low' required.")38 high = retrieve_config(config_inducing_inputs, 'high',39 "init_inducing_inputs: Keyword 'high' required.")40 Z = np.random.uniform(low=low, high=high, size=(P, D))41 # Random inducing inputs on state and random selection of input sequence42 if method == 'randomXpermutedU':43 assert 'X' in kwargs, 'Keyword argument X required: GP training input'44 assert 'dim_u' in kwargs, 'Keyword argument U required: input dim'45 X = kwargs['X']46 dim_u = kwargs['dim_u']47 U_ind = np.random.permutation(X[:, :dim_u])[:P]48 X_ind = 3. * np.random.randn(P, D-dim_u)49 Z = np.concatenate((U_ind, X_ind), axis=1)50 return Z51def init_inducing_outputs(config_inducing_outputs, P=20, D=1, **kwargs):52 """53 Initialize gaussian distribution on GP pseudo outputs54 :param config_inducing_outputs: dict, configuration55 :param P: number of pseudo points56 :param D: output dimensionality57 :return: q_mu, ndarray, NxD means and q_var, ndarray (N, D) variances of58 GP pseudo outputs.59 """60 method = retrieve_config(config_inducing_outputs, 'method',61 "init_inducing_outputs: Keyword 'method' required. \62 Can be 'random', 'lstm[1-3]', 'ssm', 'model'")63 # GP output: 0 + noise64 if method == 'zero':65 noise = retrieve_config(config_inducing_outputs, 'noise',66 "init_inducing_inputs: Keyword 'noise' required.")67 q_mu = np.sqrt(noise) * np.random.rand(P, D)68 # GP output: 1 + noise69 if method == 'one':70 noise = retrieve_config(config_inducing_outputs, 'noise',71 "init_inducing_inputs: Keyword 'noise' required.")72 q_mu = np.ones((P, D)) + np.sqrt(noise) * np.random.rand(P, D)73 # GP output: identity + noise74 if method == 'identity':75 noise = retrieve_config(config_inducing_outputs, 'noise',76 "init_inducing_inputs: Keyword 'noise' required.")77 'Z' in kwargs, 'Keyword argument Z required: GP pseudo inputs'78 Z = kwargs['Z']79 assert Z.shape[1] >= D, 'Output dimension larger than input dimension'80 q_mu = Z[:, :D] + np.sqrt(noise) * np.random.rand(P, D)81 # Variance of inducing outputs82 var = retrieve_config(config_inducing_outputs, 'var',83 "init_latent: Keyword 'var' required.")84 q_var = var * np.ones((P, D))...

Full Screen

Full Screen

FacebookService.py

Source:FacebookService.py Github

copy

Full Screen

2import facebook3from decouple import config4from database.database import retrieve_config5async def getCurrentUserEmail(token: str) -> str:6 appSecret = await retrieve_config('facebook_appSecret')7 FB = facebook.GraphAPI(8 access_token=token, app_secret=appSecret, version="11.0")9 user = FB.get_object("me", fields='email')10 return user['email'] if user else False11async def fbPublish(msg: str, link: str) -> dict:12 appSecret = await retrieve_config('facebook_appSecret')13 pageUsername = await retrieve_config('facebook_pageUsername')14 accessToken = await retrieve_config('facebook_accessToken')15 FB = facebook.GraphAPI(access_token=accessToken,16 app_secret=appSecret, version="11.0")17 post = FB.put_object(pageUsername, "feed", message=msg, link=link)18 return post19async def fbPublishImg(msg: str, imgLink: str) -> dict:20 appSecret = await retrieve_config('facebook_appSecret')21 pageUsername = await retrieve_config('facebook_pageUsername')22 accessToken = await retrieve_config('facebook_accessToken')23 FB = facebook.GraphAPI(access_token=accessToken,24 app_secret=appSecret, version="11.0")25 post = FB.put_object(pageUsername, "photos", message=msg, url=imgLink)...

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 avocado 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