<commit_before>// THIS FILE IS AUTO-GENERATED BY CCGEN
// DO NOT MODIFY

package commandclass

type ID byte

const (
  {{range .CommandClasses}}
  {{.GetConstName}} ID = {{.Key}}{{end}}
)

func (c ID) String() string {
  switch c {
    {{range .CommandClasses}}
    {{if eq .Version 1}}
    case {{.GetConstName}}:
      return "{{.Help}}"
    {{end}}
    {{end}}
    default:
      return fmt.Sprintf("Unknown (0x%X)", byte(c))
  }
}

func Parse(ccVersion uint8, payload []byte) (Command, error) {
  switch {
    {{range $_, $cc := .CommandClasses}}{{if .CanGen}}{{if .Enabled}}{{$version := .Version}}
    case payload[0] == byte({{.GetConstName}}) && ccVersion == {{$version}}:
      switch payload[1] {
        {{range .Commands}}case {{.Key}}:
          command := {{$cc.GetPackageName}}.{{(.GetStructName $cc)}}{}
          if err := command.UnmarshalBinary(payload); err != nil {
            return nil, err
          }
          return &command, nil
        {{end}}default:
          return nil, errors.New("Unknown command in command class {{.Help}}")
      }
    {{end}}{{end}}{{end}}

    default:
      return nil, errors.New("Unknown command class")
  }
}<commit_msg>No longer generate commandclass.Parse<commit_after>// THIS FILE IS AUTO-GENERATED BY CCGEN
// DO NOT MODIFY

package commandclass

const (
  {{range .CommandClasses}}
  {{.GetConstName}} CommandClassID = {{.Key}}{{end}}
)

func (c CommandClassID) String() string {
  switch c {
    {{range .CommandClasses}}
    {{if eq .Version 1}}
    case {{.GetConstName}}:
      return "{{.Help}}"
    {{end}}
    {{end}}
    default:
      return fmt.Sprintf("Unknown (0x%X)", byte(c))
  }
}
{'fraction_non_alphanumeric': 0.18433734939759036, 'fraction_numerical': 0.004216867469879518, 'mean_word_length': 2.8627906976744186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2997903', 'n_tokens_mistral': 540, 'n_tokens_neox': 534, 'n_words': 144}