(self)
return regex_pattern
Returns a regex pattern for matching against a mido.Message string.
Returns a regex pattern for matching against a mido.Message string.
Returns a regex pattern for matching against a mido . Message string .
def __str__(self):
    """Returns a regex pattern for matching against a mido.Message string."""
    if self._msg is not None:
      regex_pattern = '^' + mido.messages.format_as_string(
          self._msg, include_time=False) + r' time=\d+.\d+$'
    else:
      # Generate regex pattern.
      parts = ['.*' if self._type is None else self._type]
      for name in mido.messages.SPEC_BY_TYPE[self._inferred_types[0]][
          'value_names']:
        if name in self._kwargs:
          parts.append('%s=%d' % (name, self._kwargs[name]))
        else:
          parts.append(r'%s=\d+' % name)
      regex_pattern = '^' + ' '.join(parts) + r' time=\d+.\d+$'
    return regex_pattern
def __str__ ( self ) : if self . _msg is not None : regex_pattern = '^' + mido . messages . format_as_string ( self . _msg , include_time = False ) + r' time=\d+.\d+$' else : # Generate regex pattern. parts = [ '.*' if self . _type is None else self . _type ] for name in mido . messages . SPEC_BY_TYPE [ self . _inferred_types [ 0 ] ] [ 'value_names' ] : if name in self . _kwargs : parts . append ( '%s=%d' % ( name , self . _kwargs [ name ] ) ) else : parts . append ( r'%s=\d+' % name ) regex_pattern = '^' + ' ' . join ( parts ) + r' time=\d+.\d+$' return regex_pattern