Skip to content

Instantly share code, notes, and snippets.

@metacoma
Created July 9, 2024 13:12
Show Gist options
  • Save metacoma/765e3845e823c235f83ebe7532ea58af to your computer and use it in GitHub Desktop.
Save metacoma/765e3845e823c235f83ebe7532ea58af to your computer and use it in GitHub Desktop.
modelina python serialize/desialize
class TmuxPaneIoDocument:
def __init__(self, input):
self._input = input.input
self._output = input.output
self._ps1 = input.ps1
@property
def input(self):
return self._input
@input.setter
def input(self, input):
self._input = input
@property
def output(self):
return self._output
@output.setter
def output(self, output):
self._output = output
@property
def ps1(self):
return self._ps1
@ps1.setter
def ps1(self, ps1):
self._ps1 = ps1
def serializeToJson(self):
return json.dumps(self.__dict__, default=lambda o: o.__dict__, indent=2)
@staticmethod
def deserializeFromJson(json_string):
return TmuxPaneIoDocument(**json.loads(json_string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment