MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / Account

Class Account

projects/Python/proto/protoex.py:1771–1905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1769
1770@functools.total_ordering
1771class Account(object):
1772 __slots__ = "id", "name", "state", "wallet", "asset", "orders",
1773
1774 def __init__(self, id=0, name="", state=StateEx.initialized | StateEx.bad | StateEx.sad, wallet=None, asset=None, orders=None):
1775 if wallet is None:
1776 wallet = Balance()
1777 if orders is None:
1778 orders = list()
1779 self.id = id
1780 self.name = name
1781 self.state = state
1782 self.wallet = wallet
1783 self.asset = asset
1784 self.orders = orders
1785
1786 # Struct shallow copy
1787 def copy(self, other):
1788 self.id = other.id
1789 self.name = other.name
1790 self.state = other.state
1791 self.wallet = other.wallet
1792 self.asset = other.asset
1793 self.orders = other.orders
1794 return self
1795
1796 # Struct deep clone
1797 def clone(self):
1798 # Serialize the struct to the FBE stream
1799 writer = AccountModel(fbe.WriteBuffer())
1800 writer.serialize(self)
1801
1802 # Deserialize the struct from the FBE stream
1803 reader = AccountModel(fbe.ReadBuffer())
1804 reader.attach_buffer(writer.buffer)
1805 return reader.deserialize()[0]
1806
1807 def __eq__(self, other):
1808 if not isinstance(self, other.__class__):
1809 return NotImplemented
1810 if not self.id == other.id:
1811 return False
1812 return True
1813
1814 def __lt__(self, other):
1815 if not isinstance(self, other.__class__):
1816 return NotImplemented
1817 if self.id < other.id:
1818 return True
1819 if self.id == other.id:
1820 return False
1821 return False
1822
1823 @property
1824 def __key__(self):
1825 return self.id,
1826
1827 def __hash__(self):
1828 return hash(self.__key__)

Callers 7

__from_json__Method · 0.70
getMethod · 0.70
deserializeMethod · 0.70
getMethod · 0.70
deserializeMethod · 0.70
__init__Method · 0.70
get_fieldsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected