Best Python code snippet using slash
finder.py
Source:finder.py
...89 # Disallow keyword arguments90 if len(param_list) == 2 and len(arglist.children) == 3:91 (key1, _), (key2, lazy_value_cls) = param_list92 if key1 is None and key2 is None:93 call = _get_call_string(search_name)94 is_instance_call = _get_call_string(arglist.children[0])95 # Do a simple get_code comparison of the strings . They should96 # just have the same code, and everything will be all right.97 # There are ways that this is not correct, if some stuff is98 # redefined in between. However here we don't care, because99 # it's a heuristic that works pretty well.100 if call == is_instance_call:101 lazy_cls = lazy_value_cls102 if lazy_cls is None:103 return None104 value_set = NO_VALUES105 for cls_or_tup in lazy_cls.infer():106 if isinstance(cls_or_tup, iterable.Sequence) and cls_or_tup.array_type == 'tuple':107 for lazy_value in cls_or_tup.py__iter__():108 value_set |= lazy_value.infer().execute_with_values()109 else:110 value_set |= cls_or_tup.execute_with_values()111 return value_set112def _get_call_string(node):113 if node.parent.type == 'atom_expr':114 return _get_call_string(node.parent)115 code = ''116 leaf = node.get_first_leaf()117 end = node.get_last_leaf().end_pos118 while leaf.start_pos < end:119 code += leaf.value120 leaf = leaf.get_next_leaf()...
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!!