File: sort_command.py

package info (click to toggle)
pysmartthings 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,268 kB
  • sloc: python: 8,394; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Sort the Command enum."""

import pyperclip
from pysmartthings import Command


def main() -> int:
    """Run the script."""
    commands = {attr.name: attr for attr in Command}
    commands = dict(sorted(commands.items()))
    result = "class Command(StrEnum):"
    result += '\n    """Command model."""\n\n'
    for name, command in commands.items():
        result += f'    {name} = "{command.value}"\n'
    pyperclip.copy(result)
    print(result)
    return 0


if __name__ == "__main__":
    main()