Best Python code snippet using localstack_python
spec.py
Source:spec.py  
...71            if target_prefix:72                result[target_prefix].append(service.service_name)73        return dict(result)74    @cached_property75    def signing_name_index(self) -> Dict[str, List[ServiceName]]:76        result = defaultdict(list)77        for service in self._services.values():78            result[service.signing_name].append(service.service_name)79        return dict(result)80    @cached_property81    def operations_index(self) -> Dict[str, List[ServiceName]]:82        result = defaultdict(list)83        for service in self._services.values():84            operations = service.operation_names85            if operations:86                for operation in operations:87                    result[operation].append(service.service_name)88        return dict(result)89    @cached_property90    def endpoint_prefix_index(self) -> Dict[str, List[ServiceName]]:91        result = defaultdict(list)92        for service in self._services.values():93            result[service.endpoint_prefix].append(service.service_name)94        return dict(result)95    @cached_property96    def _services(self) -> Dict[ServiceName, ServiceModel]:97        return {service.service_name: service for service in list_services()}98class ServiceCatalog:99    index: ServiceCatalogIndex100    def __init__(self, index: ServiceCatalogIndex = None):101        self.index = index or LazyServiceCatalogIndex()102    @lru_cache(maxsize=512)103    def get(self, name: ServiceName) -> Optional[ServiceModel]:104        return load_service(name)105    @property106    def service_names(self) -> List[ServiceName]:107        return self.index.service_names108    @property109    def target_prefix_index(self) -> Dict[str, List[ServiceName]]:110        return self.index.target_prefix_index111    @property112    def signing_name_index(self) -> Dict[str, List[ServiceName]]:113        return self.index.signing_name_index114    @property115    def operations_index(self) -> Dict[str, List[ServiceName]]:116        return self.index.operations_index117    @property118    def endpoint_prefix_index(self) -> Dict[str, List[ServiceName]]:119        return self.index.endpoint_prefix_index120    def by_target_prefix(self, target_prefix: str) -> List[ServiceName]:121        return self.target_prefix_index.get(target_prefix, [])122    def by_signing_name(self, signing_name: str) -> List[ServiceName]:123        return self.signing_name_index.get(signing_name, [])124    def by_operation(self, operation_name: str) -> List[ServiceName]:125        return self.operations_index.get(operation_name, [])126def build_service_index_cache(file_path: str) -> ServiceCatalogIndex:...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!!
