command.py 619 B

123456789101112131415161718192021222324
  1. from .encode import encode
  2. from .decode import decode
  3. class command(encode):
  4. def __init__(self, content: str) -> None:
  5. self.__content = content
  6. @property
  7. def content(self) -> str:
  8. return self.__content
  9. def encode(self) -> object:
  10. return encoded_command(self._encode_str(self.content))
  11. class encoded_command(decode):
  12. def __init__(self, content: str) -> None:
  13. self.__content = content
  14. @property
  15. def encoded_content(self) -> str:
  16. return self.__content
  17. def decode(self) -> command:
  18. return command(self._decode_str(self.encoded_content))