Best Python code snippet using localstack_python
scaffold.py
Source:scaffold.py  
...87    def _print_as_class(self, output, base: str, doc=True, quote_types=False):88        output.write(f"class {self.shape.name}({base}):\n")89        q = '"' if quote_types else ""90        if doc:91            self.print_shape_doc(output, self.shape)92        if not self.shape.members:93            output.write("    pass\n")94        for k, v in self.shape.members.items():95            if k in self.shape.required_members:96                output.write(f"    {k}: {q}{v.name}{q}\n")97            else:98                output.write(f"    {k}: Optional[{q}{v.name}{q}]\n")99    def _print_as_typed_dict(self, output, doc=True, quote_types=False):100        name = self.shape.name101        q = '"' if quote_types else ""102        output.write('%s = TypedDict("%s", total=False, fields={\n' % (name, name))103        for k, v in self.shape.members.items():104            if k in self.shape.required_members:105                output.write(f'    "{k}": {q}{v.name}{q},\n')106            else:107                output.write(f'    "{k}": Optional[{q}{v.name}{q}],\n')108        output.write("})")109    def print_shape_doc(self, output, shape):110        html = shape.documentation111        import pypandoc112        doc = pypandoc.convert_text(html, "rst", format="html")113        rst = doc.strip()114        if rst:115            output.write('    """')116            output.write(f"{doc.strip()}\n")117            output.write('    """\n')118    def print_declaration(self, output, doc=True, quote_types=False):119        shape = self.shape120        q = '"' if quote_types else ""121        if isinstance(shape, StructureShape):122            self._print_structure_declaration(output, doc, quote_types)123        elif isinstance(shape, ListShape):...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!!
