parameters: (self,
                        ast: ast_pb2.AST)
docstring: Generates pybind11 bindings code from CLIF ast.
docstring_summary: Generates pybind11 bindings code from CLIF ast.
docstring_tokens: Generates pybind11 bindings code from CLIF ast .
function: def generate_header(self,
                        ast: ast_pb2.AST) -> Generator[str, None, None]:
      """Generates pybind11 bindings code from CLIF ast."""
      includes = set()
      for decl in ast.decls:
        includes.add(decl.cpp_file)
      yield '#include "third_party/pybind11/include/pybind11/smart_holder.h"'
      yield '#include "clif/python/postconv.h"'
      for include in includes:
        yield f'#include "{include}"'
      yield ''
      for typedef in self._types:
        yield from typedef.generate_type_caster()
      yield ''
  
      for namespace, typedefs in itertools.groupby(
          self._types, lambda gen_type: gen_type.cpp_namespace):
        namespace = namespace.strip(':') or 'clif'
        yield ' '.join('namespace %s {' % ns for ns in namespace.split('::'))
        for t in typedefs:
          yield from t.generate_header()
        yield '} ' * (1 + namespace.count('::')) + ' // namespace ' + namespace
      yield ''
      yield f'// CLIF init_module module_path:{self._module_path}'
function_tokens: def generate_header ( self , ast : ast_pb2 . AST ) -> Generator [ str , None , None ] : includes = set ( ) for decl in ast . decls : includes . add ( decl . cpp_file ) yield '#include "third_party/pybind11/include/pybind11/smart_holder.h"' yield '#include "clif/python/postconv.h"' for include in includes : yield f'#include "{include}"' yield '' for typedef in self . _types : yield from typedef . generate_type_caster ( ) yield '' for namespace , typedefs in itertools . groupby ( self . _types , lambda gen_type : gen_type . cpp_namespace ) : namespace = namespace . strip ( ':' ) or 'clif' yield ' ' . join ( 'namespace %s {' % ns for ns in namespace . split ( '::' ) ) for t in typedefs : yield from t . generate_header ( ) yield '} ' * ( 1 + namespace . count ( '::' ) ) + ' // namespace ' + namespace yield '' yield f'// CLIF init_module module_path:{self._module_path}'