How to use findFirst method in pyatom

Best Python code snippet using pyatom_python

catalog.js

Source:catalog.js Github

copy

Full Screen

...391 plane48,392 plane49,393 plane50,394 ] = await Promise.all([395 Scene.root.findFirst('plane0'),396 Scene.root.findFirst('plane1'),397 Scene.root.findFirst('plane2'),398 Scene.root.findFirst('plane3'),399 Scene.root.findFirst('plane4'),400 Scene.root.findFirst('plane5'),401 Scene.root.findFirst('plane6'),402 Scene.root.findFirst('plane7'),403 Scene.root.findFirst('plane8'),404 Scene.root.findFirst('plane9'),405 Scene.root.findFirst('plane10'),406 Scene.root.findFirst('plane11'),407 Scene.root.findFirst('plane12'),408 Scene.root.findFirst('plane13'),409 Scene.root.findFirst('plane14'),410 Scene.root.findFirst('plane15'),411 Scene.root.findFirst('plane16'),412 Scene.root.findFirst('plane17'),413 Scene.root.findFirst('plane18'),414 Scene.root.findFirst('plane19'),415 Scene.root.findFirst('plane20'),416 Scene.root.findFirst('plane21'),417 Scene.root.findFirst('plane22'),418 Scene.root.findFirst('plane23'),419 Scene.root.findFirst('plane24'),420 Scene.root.findFirst('plane25'),421 Scene.root.findFirst('plane26'),422 Scene.root.findFirst('plane27'),423 Scene.root.findFirst('plane28'),424 Scene.root.findFirst('plane29'),425 Scene.root.findFirst('plane30'),426 Scene.root.findFirst('plane31'),427 Scene.root.findFirst('plane32'),428 Scene.root.findFirst('plane33'),429 Scene.root.findFirst('plane34'),430 Scene.root.findFirst('plane35'),431 Scene.root.findFirst('plane36'),432 Scene.root.findFirst('plane37'),433 Scene.root.findFirst('plane38'),434 Scene.root.findFirst('plane39'),435 Scene.root.findFirst('plane40'),436 Scene.root.findFirst('plane41'),437 Scene.root.findFirst('plane42'),438 Scene.root.findFirst('plane43'),439 Scene.root.findFirst('plane44'),440 Scene.root.findFirst('plane45'),441 Scene.root.findFirst('plane46'),442 Scene.root.findFirst('plane47'),443 Scene.root.findFirst('plane48'),444 Scene.root.findFirst('plane49'),445 Scene.root.findFirst('plane50'),446 ]);447 const [448 text0,449 text1,450 text2,451 text3,452 text4,453 text5,454 text6,455 text7,456 text8,457 text9,458 text10,459 text11,460 text12,461 text13,462 text14,463 text15,464 text16,465 text17,466 text18,467 text19,468 text20,469 text21,470 text22,471 text23,472 text24,473 text25,474 text26,475 text27,476 text28,477 text29,478 text30,479 text31,480 text32,481 text33,482 text34,483 text35,484 text36,485 text37,486 text38,487 text39,488 text40,489 text41,490 text42,491 text43,492 text44,493 text45,494 text46,495 text47,496 text48,497 text49,498 text50,499 ] = await Promise.all([500 Scene.root.findFirst('text0'),501 Scene.root.findFirst('text1'),502 Scene.root.findFirst('text2'),503 Scene.root.findFirst('text3'),504 Scene.root.findFirst('text4'),505 Scene.root.findFirst('text5'),506 Scene.root.findFirst('text6'),507 Scene.root.findFirst('text7'),508 Scene.root.findFirst('text8'),509 Scene.root.findFirst('text9'),510 Scene.root.findFirst('text10'),511 Scene.root.findFirst('text11'),512 Scene.root.findFirst('text12'),513 Scene.root.findFirst('text13'),514 Scene.root.findFirst('text14'),515 Scene.root.findFirst('text15'),516 Scene.root.findFirst('text16'),517 Scene.root.findFirst('text17'),518 Scene.root.findFirst('text18'),519 Scene.root.findFirst('text19'),520 Scene.root.findFirst('text20'),521 Scene.root.findFirst('text21'),522 Scene.root.findFirst('text22'),523 Scene.root.findFirst('text23'),524 Scene.root.findFirst('text24'),525 Scene.root.findFirst('text25'),526 Scene.root.findFirst('text26'),527 Scene.root.findFirst('text27'),528 Scene.root.findFirst('text28'),529 Scene.root.findFirst('text29'),530 Scene.root.findFirst('text30'),531 Scene.root.findFirst('text31'),532 Scene.root.findFirst('text32'),533 Scene.root.findFirst('text33'),534 Scene.root.findFirst('text34'),535 Scene.root.findFirst('text35'),536 Scene.root.findFirst('text36'),537 Scene.root.findFirst('text37'),538 Scene.root.findFirst('text38'),539 Scene.root.findFirst('text39'),540 Scene.root.findFirst('text40'),541 Scene.root.findFirst('text41'),542 Scene.root.findFirst('text42'),543 Scene.root.findFirst('text43'),544 Scene.root.findFirst('text44'),545 Scene.root.findFirst('text45'),546 Scene.root.findFirst('text46'),547 Scene.root.findFirst('text47'),548 Scene.root.findFirst('text48'),549 Scene.root.findFirst('text49'),550 Scene.root.findFirst('text50'),551 ]);552 catalog[0].plane = plane0;553 catalog[1].plane = plane1;554 catalog[2].plane = plane2;555 catalog[3].plane = plane3;556 catalog[4].plane = plane4;557 catalog[5].plane = plane5;558 catalog[6].plane = plane6;559 catalog[7].plane = plane7;560 catalog[8].plane = plane8;561 catalog[9].plane = plane9;562 catalog[10].plane = plane10;563 catalog[11].plane = plane11;564 catalog[12].plane = plane12;...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

...4// First, we create a Promise and load all the assets we need for our scene5Promise.all([6// Loading Textures for the buttons7 8 Textures.findFirst('texture0'),9 Textures.findFirst('texture1'),10 Textures.findFirst('texture2'),11 Textures.findFirst('texture3'),12 Textures.findFirst('texture4'),13 Textures.findFirst('texture5'),14 Textures.findFirst('texture6'),15 Textures.findFirst('texture7'),16 Textures.findFirst('texture8'),17 Textures.findFirst('texture9'),18 Scene.root.findFirst('nullObject0'),19 Scene.root.findFirst('nullObject1'),20 Scene.root.findFirst('nullObject2'),21 Scene.root.findFirst('nullObject3'),22 Scene.root.findFirst('nullObject4'),23 Scene.root.findFirst('nullObject5'),24 Scene.root.findFirst('nullObject6'),25 Scene.root.findFirst('nullObject7'),26 Scene.root.findFirst('nullObject8'),27 Scene.root.findFirst('nullObject9'),28// we can start using our assets and creating the NativeUI Picker 29]).then(function(results){30 31// First, we set the buttons for the NativeUI Picker32 const button1 = results[0];33 const button2 = results[1];34 const button3 = results[2];35 const button4 = results[3];36 const button5 = results[4];37 const button6 = results[5];38 const button7 = results[6];39 const button8 = results[7];40 const button9 = results[8];41 const button10 = results[9];...

Full Screen

Full Screen

ccore.py

Source:ccore.py Github

copy

Full Screen

1#!/usr/bin/python32import numpy as np3import ctypes as ct4import os5if os.name=='posix':6 _pfx = 'lib'7else:8 _pfx =''9_libname = _pfx + 'ccore'10_ccore = np.ctypeslib.load_library(_libname, os.path.dirname(__file__))11_ops = [ 'ge', 'gt', 'le', 'lt', 'eq', 'ne' ]12_typs = [ 'float', 'double',13 'int64_t', 'uint64_t', 'int32_t',14 'uint32_t', 'int8_t', 'uint8_t',15 'bool' ]16#gg = globals()17_funcs = {}18for op in _ops:19 _funcs[op] = {}20 for typ in _typs:21 atyp = typ22 if atyp.endswith('_t'):23 atyp = atyp[:-2]24 name = f'findfirst_{op}_{typ}'25 func = _ccore.__getattr__(name)26 func.argtypes = [27 ct.POINTER(eval(f'ct.c_{atyp}')),28 ct.c_uint64, ct.c_int64,29 eval(f'ct.c_{atyp}') ]30 func.restype = ct.c_uint6431 _funcs[op][typ] = func32_typmap = { np.dtype(np.float64): (8, 'double', ct.c_double),33 np.dtype(np.float32): (4, 'float', ct.c_float),34 np.dtype(np.int64): (8, 'int64_t', ct.c_int64),35 np.dtype(np.int32): (4, 'int32_t', ct.c_int32),36 np.dtype(np.int16): (2, 'int16_t', ct.c_int16),37 np.dtype(np.int8): (1, 'int8_t', ct.c_int8),38 np.dtype(np.uint64): (8, 'uint64_t', ct.c_uint64),39 np.dtype(np.uint32): (4, 'uint32_t', ct.c_uint32),40 np.dtype(np.uint16): (2, 'uint16_t', ct.c_uint16), 41 np.dtype(np.uint8): (1, 'uint8_t', ct.c_uint8),42 np.dtype(np.bool): (1, 'bool', ct.c_bool )}43def _findfirst_op(vec, op, cf):44 if vec.ndim != 1:45 raise ValueError('Input must be 1-d array')46 c = vec.ctypes47 count = vec.shape[0]48 stride_bytes = c.strides[0]49 sizeof, typname, ctyp = _typmap[vec.dtype]50 func = _funcs[op][typname]51 stride = stride_bytes // sizeof52 dat = c.data_as(ct.POINTER(ctyp))53 cf = ctyp(cf)54 '''if vec.dtype==np.float64:55 dat = c.data_as(ct.POINTER(ct.c_double))56 stride = stride_bytes // 857 func = fncs['double']58 elif vec.dtype==np.float32:59 dat = c.data_as(ct.POINTER(ct.c_float))60 stride = stride_bytes // 461 func = _fun_ccore.__getattr__(f'findfirst_{op}_float')62 elif vec.dtype==np.int64:63 dat = c.data_as(ct.POINTER(ct.c_int64))64 stride = stride_bytes // 865 func = _ccore.__getattr__(f'findfirst_{op}_int64_t')66 elif vec.dtype==np.uint64:67 dat = c.data_as(ct.POINTER(ct.c_uint64))68 stride = stride_bytes // 869 func = _ccore.__getattr__(f'findfirst_{op}_uint64_t')70 elif vec.dtype==np.int32:71 dat = c.data_as(ct.POINTER(ct.c_int32))72 stride = stride_bytes // 473 func = _ccore.__getattr__(f'findfirst_{op}_int32_t')74 elif vec.dtype==np.uint32:75 dat = c.data_as(ct.POINTER(ct.c_uint32))76 stride = stride_bytes // 477 func = _ccore.__getattr__(f'findfirst_{op}_uint32_t')78 elif vec.dtype==np.int8:79 dat = c.data_as(ct.POINTER(ct.c_int8))80 stride = stride_bytes81 func = _ccore.__getattr__(f'findfirst_{op}_int8_t')82 elif vec.dtype==np.uint8:83 dat = c.data_as(ct.POINTER(ct.c_uint8))84 stride = stride_bytes85 func = _ccore.__getattr__(f'findfirst_{op}_uint8_t')86 elif vec.dtype==np.bool:87 dat = c.data_as(ct.POINTER(ct.c_bool))88 stride = stride_bytes89 func = _ccore.__getattr__(f'findfirst_{op}_bool')90 else:91 raise ValueError(f'Unsupported data type: {vec.dtype}')'''92 idx = func(dat, count, stride, cf)93 if idx<len(vec):94 return idx95 else:96 return None97def _findlast_op(vec, op, cf):98 res = _findfirst_op(np.flip(vec), op, cf)99 if res is not None:100 return len(vec) - 1 - res101 else:102 return None103 104def findfirst_ge(vec, cf):105 return _findfirst_op(vec, 'ge', cf)106def findfirst_gt(vec, cf):107 return _findfirst_op(vec, 'gt', cf)108def findfirst_le(vec, cf):109 return _findfirst_op(vec, 'le', cf)110def findfirst_lt(vec, cf):111 return _findfirst_op(vec, 'lt', cf)112def findfirst_ne(vec, cf):113 return _findfirst_op(vec, 'ne', cf)114def findfirst_eq(vec, cf):115 return _findfirst_op(vec, 'eq', cf)116def findfirst(vec):117 return _findfirst_op(vec, 'ne', 0)118def findlast_ge(vec, cf):119 return _findlast_op(vec, 'ge', cf)120def findlast_gt(vec, cf):121 return _findlast_op(vec, 'gt', cf)122def findlast_le(vec, cf):123 return _findlast_op(vec, 'le', cf)124def findlast_lt(vec, cf):125 return _findlast_op(vec, 'lt', cf)126def findlast_ne(vec, cf):127 return _findlast_op(vec, 'ne', cf)128def findlast_eq(vec, cf):129 return _findlast_op(vec, 'eq', cf)130def findlast(vec):131 return _findlast_op(vec, 'ne', 0)132if __name__=='__main__':133 x = np.cos(np.arange(20))134 print('x = ', x, x.dtype)135 print('findfirst_eq(x, 1) = ', findfirst_eq(x, 1))136 print('findfirst_eq(x, 1.0) = ', findfirst_eq(x, 1.0))137 print('findfirst_le(x, 0) = ', findfirst_le(x, 0))138 print('findfirst_lt(x, -.50) = ', findfirst_lt(x, -.50))139 print('findfirst_gt(x, 10) = ', findfirst_gt(x, 10))140 print('findlast_ge(x, .9) = ', findlast_ge(x, .9))141 print('findlast_ge(x, 9) = ', findlast_ge(x, 9))142 print('findlast_lt(x, 0) = ', findlast_lt(x, 0))143 y = x > 0144 print('y = ', y, y.dtype)145 print('findfirst_eq(y, 0) = ', findfirst_eq(y, 0))...

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