How to use make_alias method in autotest

Best Python code snippet using autotest_python

setup.py

Source:setup.py Github

copy

Full Screen

...26 result = []27 for pattern in patterns:28 result += [f'../{f}' for f in glob.iglob(pattern, recursive=True)]29 return result30def make_alias(name):31 if name is None:32 f = '__init__.py'33 i = 'pydrake'34 else:35 f = f'{name}.py'36 i = f'pydrake.{name}'37 with open(os.path.join('drake', f), 'w') as m:38 m.write(f'from {i} import *\n')39os.makedirs('drake', exist_ok=True)40make_alias(None)41make_alias('all')42make_alias('common')43make_alias('examples')44make_alias('forwarddiff')45make_alias('manipulation')46make_alias('multibody')47make_alias('solvers')48make_alias('systems')49make_alias('visualization')50setup(name='drake',51 version=DRAKE_VERSION,52 description='Model-based design and verification for robotics',53 long_description='''54Drake ("dragon" in Middle English) is a toolbox maintained by the Robot55Locomotion Group at the MIT Computer Science and Artificial Intelligence56Lab (CSAIL). It is a collection of tools for analyzing the dynamics of57robots and building control systems for them in C++ and Python, with a58heavy emphasis on optimization-based design/analysis.'''.strip(),59 url='https://drake.mit.edu',60 author='Drake Development Team',61 author_email='drake-users@mit.edu',62 classifiers=[63 'Development Status :: 4 - Beta',...

Full Screen

Full Screen

test_store.py

Source:test_store.py Github

copy

Full Screen

2from satellite.aliases.generators import AliasGeneratorType3from satellite.aliases.store import AliasStore4from satellite.db import get_session5from satellite.db.models.alias import Alias6def make_alias(store: bool, **params) -> Alias:7 params.setdefault('value', str(uuid.uuid4()))8 params.setdefault('alias_generator', AliasGeneratorType.UUID)9 params.setdefault('public_alias', f'public_{params["value"]}')10 alias = Alias(**params)11 if store:12 session = get_session()13 session.add(alias)14 session.commit()15 return alias16def test_get_by_value():17 value = 'secret'18 alias1 = make_alias(19 True,20 value=value,21 alias_generator=AliasGeneratorType.UUID,22 )23 alias2 = make_alias(24 True,25 value=value,26 alias_generator=AliasGeneratorType.RAW_UUID,27 )28 store = AliasStore()29 assert store.get_by_value(value) == [alias1, alias2]30 assert store.get_by_value(value, AliasGeneratorType.UUID) == [alias1]31 assert store.get_by_value(value, AliasGeneratorType.RAW_UUID) == [alias2]32 assert store.get_by_value(value[::-1]) == []33def test_get_by_alias():34 alias = make_alias(True)35 store = AliasStore()36 assert store.get_by_alias(alias.value) is None37 assert store.get_by_alias(alias.public_alias) == alias38def test_save():39 alias = make_alias(False)40 store = AliasStore()41 store.save(alias)42 stored_alias = get_session().query(Alias).filter(Alias.id == alias.id).first()43 assert stored_alias == alias44def test_get_by_value_with_ttl():45 alias = make_alias(False)46 store = AliasStore(60)47 store.save(alias)48 assert store.get_by_value(alias.value) == [alias]49 assert AliasStore().get_by_value(alias.value) == []50def test_get_by_value_with_ttl_expired():51 alias = make_alias(False)52 store = AliasStore(-1)53 store.save(alias)54 assert store.get_by_value(alias.value) == []55def test_get_by_alias_with_ttl():56 alias = make_alias(False)57 store = AliasStore(60)58 store.save(alias)59 assert store.get_by_alias(alias.public_alias) == alias60 assert AliasStore().get_by_alias(alias.public_alias) is None61def test_get_by_alias_with_ttl_expired():62 alias = make_alias(False)63 store = AliasStore(-1)64 store.save(alias)65 assert store.get_by_alias(alias.public_alias) is None66def test_cleanup():67 session = get_session()68 session.query(Alias).delete()69 session.commit()70 persistent_store = AliasStore()71 alias1 = make_alias(False)72 persistent_store.save(alias1)73 volatile_store = AliasStore(60)74 alias2 = make_alias(False)75 volatile_store.save(alias2)76 alias3 = make_alias(False)77 AliasStore(-1).save(alias3)78 alias3_value = alias3.value79 assert AliasStore.cleanup() == 180 persistent_store.get_by_value(alias1.value) is not None81 volatile_store.get_by_value(alias2.value) is not None...

Full Screen

Full Screen

bar.py

Source:bar.py Github

copy

Full Screen

...29 if y is None:30 # If only x then we always do count(x)31 agg = F.count32 agg_fn = agg(x)33 n_alias = make_alias(agg, x)34 aliases.append(n_alias)35 count_x_agg = agg_fn.alias(n_alias)36 aggregates.append(count_x_agg)37 else:38 for y_col in y:39 agg_fn = agg(y_col)40 n_alias = make_alias(agg, y_col)41 aliases.append(n_alias)42 new_agg = agg_fn.alias(n_alias)43 aggregates.append(new_agg)44 # Calculate45 result = data.groupBy(x).agg(*aggregates)46 if sort_by is not None:47 order_by = F.col(make_alias(agg, sort_by))48 if sort_asc:49 order_by = order_by.asc()50 elif sort_desc:51 order_by = order_by.desc()52 result = result.orderBy(order_by)53 # Make Pandas DF54 pd_df = result.toPandas()55 pd_df = pd_df.set_index(x)56 # if y is None:57 # pd_df[alias]58 # else:59 # pd_df[y]60 return pd_df61def make_alias(agg, col_name):...

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