parameters: (val, indent='', time_offset=None, current_time=None, field_filter=None, fixed_numeric_width=None)
docstring: Convert value to string representation
      :param val: to convert to string representation. Most likely a Message.  ``Value``
      :param indent: indentation. If indent is set, then the return value will have a leading \n, ``str``
      :param time_offset: if not None, time fields will be displayed
        as deltas from  time_offset, ``Time``
  
      :param current_time: currently not used. Only provided for API
        compatibility. current_time passes in the current time with
        respect to the message, ``Time``
      :param field_filter: filter the fields that are strified for Messages, ``fn(Message)->iter(str)``
      :returns: string (YAML) representation of message, ``str``
docstring_summary: Convert value to string representation
      :param val: to convert to string representation. Most likely a Message.  ``Value``
      :param indent: indentation. If indent is set, then the return value will have a leading \n, ``str``
      :param time_offset: if not None, time fields will be displayed
        as deltas from  time_offset, ``Time``
docstring_tokens: Convert value to string representation : param val : to convert to string representation . Most likely a Message . Value : param indent : indentation . If indent is set then the return value will have a leading \ n str : param time_offset : if not None time fields will be displayed as deltas from time_offset Time
function: def strify_message(val, indent='', time_offset=None, current_time=None, field_filter=None, fixed_numeric_width=None):
      """
      Convert value to string representation
      :param val: to convert to string representation. Most likely a Message.  ``Value``
      :param indent: indentation. If indent is set, then the return value will have a leading \n, ``str``
      :param time_offset: if not None, time fields will be displayed
        as deltas from  time_offset, ``Time``
  
      :param current_time: currently not used. Only provided for API
        compatibility. current_time passes in the current time with
        respect to the message, ``Time``
      :param field_filter: filter the fields that are strified for Messages, ``fn(Message)->iter(str)``
      :returns: string (YAML) representation of message, ``str``
      """
  
      type_ = type(val)
      if type_ in (int, long, float) and fixed_numeric_width is not None:
          if type_ is float:
              num_str = ('%.' + str(fixed_numeric_width) + 'f') % val
              return num_str[:max(num_str.find('.'), fixed_numeric_width)]
          else:
              return ('%' + str(fixed_numeric_width) + 'd') % val
      elif type_ in (int, long, float, bool):
          return str(val)
      elif isstring(val):
          #TODO: need to escape strings correctly
          if not val:
              return "''"
          return val
      elif isinstance(val, TVal):
          
          if time_offset is not None and isinstance(val, Time):
              val = val-time_offset
  
          if fixed_numeric_width is not None:
              format_str = '%' + str(fixed_numeric_width) + 'd'
              sec_str = '\n%ssecs: ' % indent + (format_str % val.secs)
              nsec_str = '\n%snsecs: ' % indent + (format_str % val.nsecs)
              return sec_str + nsec_str
          else:
              return '\n%ssecs: %s\n%snsecs: %9d'%(indent, val.secs, indent, val.nsecs)
          
      elif type_ in (list, tuple):
          if len(val) == 0:
              return "[]"
          val0 = val[0]
          if type(val0) in (int, float) and fixed_numeric_width is not None:
              list_str = '[' + ''.join(strify_message(v, indent, time_offset, current_time, field_filter, fixed_numeric_width) + ', ' for v in val).rstrip(', ') + ']'
              return list_str
          elif type(val0) in (int, float, str, bool):
              # TODO: escape strings properly
              return str(list(val))
          else:
              pref = indent + '- '
              indent = indent + '  '
              return '\n'+'\n'.join([pref+strify_message(v, indent, time_offset, current_time, field_filter, fixed_numeric_width) for v in val])
      elif isinstance(val, Message):
          # allow caller to select which fields of message are strified
          if field_filter is not None:
              fields = list(field_filter(val))
          else:
              fields = val.__slots__
  
          p = '%s%%s: %%s'%(indent)
          ni = '  '+indent
          if sys.hexversion > 0x03000000: #Python3
              vals = '\n'.join([p%(f,
                                   strify_message(_convert_getattr(val, f, t), ni, time_offset, current_time, field_filter, fixed_numeric_width)) for f,t in zip(val.__slots__, val._slot_types) if f in fields])			
          else: #Python2
              vals = '\n'.join([p%(f,
                                   strify_message(_convert_getattr(val, f, t), ni, time_offset, current_time, field_filter, fixed_numeric_width)) for f,t in itertools.izip(val.__slots__, val._slot_types) if f in fields])
          if indent:
              return '\n'+vals
          else:
              return vals
          
      else:
          return str(val)
function_tokens: def strify_message ( val , indent = '' , time_offset = None , current_time = None , field_filter = None , fixed_numeric_width = None ) : type_ = type ( val ) if type_ in ( int , long , float ) and fixed_numeric_width is not None : if type_ is float : num_str = ( '%.' + str ( fixed_numeric_width ) + 'f' ) % val return num_str [ : max ( num_str . find ( '.' ) , fixed_numeric_width ) ] else : return ( '%' + str ( fixed_numeric_width ) + 'd' ) % val elif type_ in ( int , long , float , bool ) : return str ( val ) elif isstring ( val ) : #TODO: need to escape strings correctly if not val : return "''" return val elif isinstance ( val , TVal ) : if time_offset is not None and isinstance ( val , Time ) : val = val - time_offset if fixed_numeric_width is not None : format_str = '%' + str ( fixed_numeric_width ) + 'd' sec_str = '\n%ssecs: ' % indent + ( format_str % val . secs ) nsec_str = '\n%snsecs: ' % indent + ( format_str % val . nsecs ) return sec_str + nsec_str else : return '\n%ssecs: %s\n%snsecs: %9d' % ( indent , val . secs , indent , val . nsecs ) elif type_ in ( list , tuple ) : if len ( val ) == 0 : return "[]" val0 = val [ 0 ] if type ( val0 ) in ( int , float ) and fixed_numeric_width is not None : list_str = '[' + '' . join ( strify_message ( v , indent , time_offset , current_time , field_filter , fixed_numeric_width ) + ', ' for v in val ) . rstrip ( ', ' ) + ']' return list_str elif type ( val0 ) in ( int , float , str , bool ) : # TODO: escape strings properly return str ( list ( val ) ) else : pref = indent + '- ' indent = indent + '  ' return '\n' + '\n' . join ( [ pref + strify_message ( v , indent , time_offset , current_time , field_filter , fixed_numeric_width ) for v in val ] ) elif isinstance ( val , Message ) : # allow caller to select which fields of message are strified if field_filter is not None : fields = list ( field_filter ( val ) ) else : fields = val . __slots__ p = '%s%%s: %%s' % ( indent ) ni = '  ' + indent if sys . hexversion > 0x03000000 : #Python3 vals = '\n' . join ( [ p % ( f , strify_message ( _convert_getattr ( val , f , t ) , ni , time_offset , current_time , field_filter , fixed_numeric_width ) ) for f , t in zip ( val . __slots__ , val . _slot_types ) if f in fields ] ) else : #Python2 vals = '\n' . join ( [ p % ( f , strify_message ( _convert_getattr ( val , f , t ) , ni , time_offset , current_time , field_filter , fixed_numeric_width ) ) for f , t in itertools . izip ( val . __slots__ , val . _slot_types ) if f in fields ] ) if indent : return '\n' + vals else : return vals else : return str ( val )