Best Python code snippet using localstack_python
importers.py
Source:importers.py
...35 except ImportError:36 pass37 for module in modules:38 module_name = module.__name__39 yield from self._process_member(40 member=module,41 member_name=module_name,42 root_module_name=module_name,43 parent=None,44 )45 def _process_member(46 self, *, member, member_name, root_module_name, parent47 ) -> Iterator[CodeElement]:48 # BUILTIN49 if inspect.isbuiltin(member):50 pass51 # MODULE52 elif inspect.ismodule(member):53 yield from self._handle_module(member, root_module_name)54 # CLASS55 elif inspect.isclass(member) and inspect.ismodule(parent):56 yield from self._handle_class_on_module(member, parent, root_module_name)57 # METHOD58 elif inspect.ismethod(member) or inspect.isfunction(member):59 yield from self._handle_function_or_method(member, member_name, parent)60 # (Class) ATTRIBUTE61 elif inspect.isclass(parent):62 yield from self._handle_class_attribute(member, member_name, parent)63 def _process_submembers(self, *, parent, root_module_name) -> Iterator[CodeElement]:64 for submember_name, submember_type in inspect.getmembers(parent):65 yield from self._process_member(66 member=submember_type,67 member_name=submember_name,68 root_module_name=root_module_name,69 parent=parent,70 )71 def _handle_module(self, module, root_module_name) -> Iterator[CodeElement]:72 module_name = module.__name__73 # Only traverse under hierarchy74 if not module_name.startswith(root_module_name):75 return None76 filename = get_filename(module)77 # Create Module object78 yield Module(79 name=module_name,...
lb.py
Source:lb.py
...22 data = []23 balancers = self.lb_driver.list_balancers()24 for balancer in balancers:25 # Process instance26 balancer.instances = self._process_member(balancer.list_members())27 data.append(self._process_resource(balancer.__dict__))28 logging.info("Collected {} lb".format(len(data)))29 return data30 def _process_member(self, members):31 instances = []32 for member in members:33 member = member.__dict__34 instances.append({35 "id": member["id"],36 "ip": member["ip"],37 "port": member["port"],38 "extra": member["extra"],39 })40 return instances41 def _process_resource(self, balancer):42 balancer = self.collector._object_to_dict(balancer)43 logging.info("new LoadBalancer name={}".format(balancer["name"]))44 data = {...
seed.py
Source:seed.py
...27 if created:28 self.stdout.write(f"Creating government: {government}")29 members = self._download(f'https://www.nrsr.sk/opendata/1/sk/MP/MembersOfParliament?termNr={data["termNr"]}')30 for member in members:31 self._process_member(government, member)32 def _process_member(self, government: Government, data: Dict):33 member, created = Member.objects.get_or_create(34 name=data['firstname'],35 surname=data['lastName'],36 born_at=parse_datetime(data['birthDate']).date()37 )38 if created:39 self.stdout.write(f"Creating member: {member}")40 party, created = Party.objects.get_or_create(41 name=data['partyDepartmentName']42 )43 if created:44 self.stdout.write(f"Creating party: {party}")45 government_member, created = GovernmentMember.objects.get_or_create(46 government=government,...
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!!