(self, dump_dir=None)
Dumps full debug information to disk.

    Full debug information consists of an XML file whose elements are tagged
    with a unique ID, and a stack trace file for each element ID. Each stack
    trace file consists of a stack trace for when the element was created, and
    when each attribute was last modified.

    Args:
      dump_dir: Full path to the directory in which dump files are created.

    Raises:
      ValueError: If neither `dump_dir` nor the global dump path is given. The
        global dump path can be specified either via the
        --pymjcf_debug_full_dump_dir flag or via `debugging.set_full_dump_dir`.
Dumps full debug information to disk.
Dumps full debug information to disk .
def dump_full_debug_info_to_disk(self, dump_dir=None):
    """Dumps full debug information to disk.

    Full debug information consists of an XML file whose elements are tagged
    with a unique ID, and a stack trace file for each element ID. Each stack
    trace file consists of a stack trace for when the element was created, and
    when each attribute was last modified.

    Args:
      dump_dir: Full path to the directory in which dump files are created.

    Raises:
      ValueError: If neither `dump_dir` nor the global dump path is given. The
        global dump path can be specified either via the
        --pymjcf_debug_full_dump_dir flag or via `debugging.set_full_dump_dir`.
    """
    dump_dir = dump_dir or self.default_dump_dir
    if not dump_dir:
      raise ValueError('`dump_dir` is not specified')
    section_separator = '\n' + ('=' * 80) + '\n'
    def dump_stack(header, stack, f):
      indent = '    '
      f.write(header + '\n')
      for stack_entry in stack:
        f.write(indent + '`{}` at {}:{}\n'
                .format(stack_entry.function_name,
                        stack_entry.filename, stack_entry.line_number))
        f.write((indent * 2) + str(stack_entry.text) + '\n')
      f.write(section_separator)
    with open(os.path.join(dump_dir, 'model.xml'), 'w') as f:
      f.write(self._xml_string)
    for elem_id, debug_info in self._debug_info_for_element_ids.items():
      with open(os.path.join(dump_dir, str(elem_id) + '.dump'), 'w') as f:
        f.write('{}:{}\n'.format(DEBUG_METADATA_PREFIX, elem_id))
        f.write(str(debug_info.element) + '\n')
        dump_stack('Element creation', debug_info.init_stack, f)
        for attrib_name, stack in debug_info.attribute_stacks.items():
          attrib_value = (
              debug_info.element.get_attribute_xml_string(attrib_name))
          if stack[-1] == debug_info.init_stack[-1]:
            if attrib_value is not None:
              f.write('Attribute {}="{}"\n'.format(attrib_name, attrib_value))
              f.write('    was set when the element was created\n')
              f.write(section_separator)
          else:
            if attrib_value is not None:
              dump_stack('Attribute {}="{}"'.format(attrib_name, attrib_value),
                         stack, f)
            else:
              dump_stack(
                  'Attribute {} was CLEARED'.format(attrib_name), stack, f)
def dump_full_debug_info_to_disk ( self , dump_dir = None ) : dump_dir = dump_dir or self . default_dump_dir if not dump_dir : raise ValueError ( '`dump_dir` is not specified' ) section_separator = '\n' + ( '=' * 80 ) + '\n' def dump_stack ( header , stack , f ) : indent = '    ' f . write ( header + '\n' ) for stack_entry in stack : f . write ( indent + '`{}` at {}:{}\n' . format ( stack_entry . function_name , stack_entry . filename , stack_entry . line_number ) ) f . write ( ( indent * 2 ) + str ( stack_entry . text ) + '\n' ) f . write ( section_separator ) with open ( os . path . join ( dump_dir , 'model.xml' ) , 'w' ) as f : f . write ( self . _xml_string ) for elem_id , debug_info in self . _debug_info_for_element_ids . items ( ) : with open ( os . path . join ( dump_dir , str ( elem_id ) + '.dump' ) , 'w' ) as f : f . write ( '{}:{}\n' . format ( DEBUG_METADATA_PREFIX , elem_id ) ) f . write ( str ( debug_info . element ) + '\n' ) dump_stack ( 'Element creation' , debug_info . init_stack , f ) for attrib_name , stack in debug_info . attribute_stacks . items ( ) : attrib_value = ( debug_info . element . get_attribute_xml_string ( attrib_name ) ) if stack [ - 1 ] == debug_info . init_stack [ - 1 ] : if attrib_value is not None : f . write ( 'Attribute {}="{}"\n' . format ( attrib_name , attrib_value ) ) f . write ( '    was set when the element was created\n' ) f . write ( section_separator ) else : if attrib_value is not None : dump_stack ( 'Attribute {}="{}"' . format ( attrib_name , attrib_value ) , stack , f ) else : dump_stack ( 'Attribute {} was CLEARED' . format ( attrib_name ) , stack , f )