components/exo/wayland/compatibility_test/wayland_protocol_codegen.py
def expand_template(template: str, context: Mapping[str, Any]) -> str:
    """Expands the template using context, and returns the result"""

    # Loaded from third_party/jinja2 after a sys.path modification
    import jinja2

    env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(os.path.dirname(template)),
        keep_trailing_newline=True,  # newline-terminate generated files
        lstrip_blocks=True,
        trim_blocks=True)  # so don't need {%- -%} everywhere

    # Additional global functions
    env.globals['get_c_arg_for_server_request_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_server_request_arg)
    env.globals['get_c_arg_for_server_event_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_server_event_arg)
    env.globals['get_c_return_type_for_client_request'] = (
        wayland_protocol_c_arg_handling.get_c_return_type_for_client_request)
    env.globals['get_c_arg_for_client_request_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_client_request_arg)
    env.globals['get_c_arg_for_client_event_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_client_event_arg)
    env.globals['get_construction_steps'] = (
        wayland_protocol_construction.get_construction_steps)
    env.globals['get_destructor'] = (
        wayland_protocol_construction.get_destructor)
    env.globals['get_external_interfaces_for_protocol'] = (
        wayland_protocol_externals.get_external_interfaces_for_protocol)
    env.globals['get_minimum_version_to_construct'] = (
        wayland_protocol_construction.get_minimum_version_to_construct)
    env.globals['get_versions_to_test_for_event_delivery'] = (
        wayland_protocol_construction.get_versions_to_test_for_event_delivery)
    env.globals['is_global_interface'] = (
        wayland_protocol_construction.is_global_interface)

    # Additional filters for transforming text
    env.filters['kebab'] = wayland_protocol_identifiers.kebab_case
    env.filters['pascal'] = wayland_protocol_identifiers.pascal_case

    return env.get_template(os.path.basename(template)).render(context)
Expands the template using context, and returns the result
Expands the template using context, and returns the result
Expands the template using context and returns the result
def expand_template(template: str, context: Mapping[str, Any]) -> str:
    import jinja2
    env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(os.path.dirname(template)),
        keep_trailing_newline=True,  
        lstrip_blocks=True,
        trim_blocks=True)  
    env.globals['get_c_arg_for_server_request_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_server_request_arg)
    env.globals['get_c_arg_for_server_event_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_server_event_arg)
    env.globals['get_c_return_type_for_client_request'] = (
        wayland_protocol_c_arg_handling.get_c_return_type_for_client_request)
    env.globals['get_c_arg_for_client_request_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_client_request_arg)
    env.globals['get_c_arg_for_client_event_arg'] = (
        wayland_protocol_c_arg_handling.get_c_arg_for_client_event_arg)
    env.globals['get_construction_steps'] = (
        wayland_protocol_construction.get_construction_steps)
    env.globals['get_destructor'] = (
        wayland_protocol_construction.get_destructor)
    env.globals['get_external_interfaces_for_protocol'] = (
        wayland_protocol_externals.get_external_interfaces_for_protocol)
    env.globals['get_minimum_version_to_construct'] = (
        wayland_protocol_construction.get_minimum_version_to_construct)
    env.globals['get_versions_to_test_for_event_delivery'] = (
        wayland_protocol_construction.get_versions_to_test_for_event_delivery)
    env.globals['is_global_interface'] = (
        wayland_protocol_construction.is_global_interface)
    env.filters['kebab'] = wayland_protocol_identifiers.kebab_case
    env.filters['pascal'] = wayland_protocol_identifiers.pascal_case
    return env.get_template(os.path.basename(template)).render(context)
def expand_template ( template : str , context : Mapping [ str , Any ] ) -> str : import jinja2 env = jinja2 . Environment ( loader = jinja2 . FileSystemLoader ( os . path . dirname ( template ) ) , keep_trailing_newline = True , lstrip_blocks = True , trim_blocks = True ) env . globals [ 'get_c_arg_for_server_request_arg' ] = ( wayland_protocol_c_arg_handling . get_c_arg_for_server_request_arg ) env . globals [ 'get_c_arg_for_server_event_arg' ] = ( wayland_protocol_c_arg_handling . get_c_arg_for_server_event_arg ) env . globals [ 'get_c_return_type_for_client_request' ] = ( wayland_protocol_c_arg_handling . get_c_return_type_for_client_request ) env . globals [ 'get_c_arg_for_client_request_arg' ] = ( wayland_protocol_c_arg_handling . get_c_arg_for_client_request_arg ) env . globals [ 'get_c_arg_for_client_event_arg' ] = ( wayland_protocol_c_arg_handling . get_c_arg_for_client_event_arg ) env . globals [ 'get_construction_steps' ] = ( wayland_protocol_construction . get_construction_steps ) env . globals [ 'get_destructor' ] = ( wayland_protocol_construction . get_destructor ) env . globals [ 'get_external_interfaces_for_protocol' ] = ( wayland_protocol_externals . get_external_interfaces_for_protocol ) env . globals [ 'get_minimum_version_to_construct' ] = ( wayland_protocol_construction . get_minimum_version_to_construct ) env . globals [ 'get_versions_to_test_for_event_delivery' ] = ( wayland_protocol_construction . get_versions_to_test_for_event_delivery ) env . globals [ 'is_global_interface' ] = ( wayland_protocol_construction . is_global_interface ) env . filters [ 'kebab' ] = wayland_protocol_identifiers . kebab_case env . filters [ 'pascal' ] = wayland_protocol_identifiers . pascal_case return env . get_template ( os . path . basename ( template ) ) . render ( context )
Expands the template using context, and returns the result
Expands the template using context and returns the result
"""Expands the template using context, and returns the result""" # Loaded from third_party/jinja2 after a sys.path modification # newline-terminate generated files # so don't need {%- -%} everywhere # Additional global functions # Additional filters for transforming text
template
str
context
Mapping[str, Any]