components/policy/tools/template_writers/writers/writer_unittest_common.py
def GetOutput(self, policy_json, definitions, writer_type):
    '''Generates an output of a writer.

    Args:
      policy_json: Raw policy JSON string.
      definitions: Definitions to create writer configurations.
      writer_type: Writer type (e.g. 'admx'), see template_formatter.py.

    Returns:
      The string of the template created by the writer.
    '''

    # Evaluate policy_json. For convenience, fix indentation in statements like
    # policy_json = '''
    #   {
    #     ...
    #   }''')
    start_idx = 1 if policy_json[0] == '\n' else 0
    policy_data = eval(textwrap.dedent(policy_json[start_idx:]))

    config = writer_configuration.GetConfigurationForBuild(definitions)
    policy_generator = \
        policy_template_generator.PolicyTemplateGenerator(config, policy_data)
    writer = template_formatter.GetWriter(writer_type, config)
    return policy_generator.GetTemplateText(writer)
Generates an output of a writer.

    Args:
      policy_json: Raw policy JSON string.
      definitions: Definitions to create writer configurations.
      writer_type: Writer type (e.g. 'admx'), see template_formatter.py.

    Returns:
      The string of the template created by the writer.
    
Generates an output of a writer.
Generates an output of a writer .
def GetOutput(self, policy_json, definitions, writer_type):
    start_idx = 1 if policy_json[0] == '\n' else 0
    policy_data = eval(textwrap.dedent(policy_json[start_idx:]))
    config = writer_configuration.GetConfigurationForBuild(definitions)
    policy_generator = \
        policy_template_generator.PolicyTemplateGenerator(config, policy_data)
    writer = template_formatter.GetWriter(writer_type, config)
    return policy_generator.GetTemplateText(writer)
def GetOutput ( self , policy_json , definitions , writer_type ) : start_idx = 1 if policy_json [ 0 ] == '\n' else 0 policy_data = eval ( textwrap . dedent ( policy_json [ start_idx : ] ) ) config = writer_configuration . GetConfigurationForBuild ( definitions ) policy_generator = policy_template_generator . PolicyTemplateGenerator ( config , policy_data ) writer = template_formatter . GetWriter ( writer_type , config ) return policy_generator . GetTemplateText ( writer )
Generates an output of a writer.
Generates an output of a writer .
'''Generates an output of a writer.

    Args:
      policy_json: Raw policy JSON string.
      definitions: Definitions to create writer configurations.
      writer_type: Writer type (e.g. 'admx'), see template_formatter.py.

    Returns:
      The string of the template created by the writer.
    ''' # Evaluate policy_json. For convenience, fix indentation in statements like # policy_json = ''' #   { #     ... #   }''')
The string of the template created by the writer.
The string of the template created by the writer .
self
policy_json
Raw policy JSON string.
Raw policy JSON string .
definitions
Definitions to create writer configurations.
Definitions to create writer configurations .
writer_type
Writer type , see template_formatter.py.
Writer type see template_formatter . py .