nsarchive 0.0.6a0__py3-none-any.whl → 0.0.7a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nsarchive/__init__.py CHANGED
@@ -4,6 +4,7 @@ import deta
4
4
 
5
5
  from .cls.entities import *
6
6
  from .cls.votes import *
7
+ from .cls.bank import *
7
8
 
8
9
  from .cls.exceptions import *
9
10
 
@@ -135,4 +136,35 @@ class RepublicInstance:
135
136
  'choices': vote.choices
136
137
  }
137
138
 
138
- self.votes.put(_data, vote.id.upper())
139
+ self.votes.put(_data, vote.id.upper())
140
+
141
+ class BankInstance:
142
+ def __init__(self, token: str) -> None:
143
+ self.db = deta.Deta(token)
144
+ self.accounts = self.db.Base('accounts')
145
+ self.registry = self.db.Base('banks')
146
+
147
+ def get_account(self, id: str) -> BankAccount:
148
+ id = id.upper()
149
+ _data = self.accounts.get(id)
150
+
151
+ if _data is None:
152
+ return None
153
+
154
+ acc = BankAccount(id)
155
+ acc.amount = _data['amount']
156
+ acc.locked = _data['locked']
157
+ acc.owner = _data['owner_id']
158
+ acc.bank = _data['bank']
159
+
160
+ return acc
161
+
162
+ def save_account(self, acc: BankAccount):
163
+ _data = {
164
+ 'amount': acc.amount,
165
+ 'locked': acc.locked,
166
+ 'owner_id': acc.owner,
167
+ 'bank': acc.bank
168
+ }
169
+
170
+ self.accounts.put(_data, acc.id.upper())
nsarchive/cls/bank.py ADDED
@@ -0,0 +1,7 @@
1
+ class BankAccount:
2
+ def __init__(self, id: str) -> None:
3
+ self.id: str = id
4
+ self.owner: str = '0'
5
+ self.amount: int = 0
6
+ self.locked: bool = False
7
+ self.bank: str = "HexaBank"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nsarchive
3
- Version: 0.0.6a0
3
+ Version: 0.0.7a0
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: happex
@@ -0,0 +1,9 @@
1
+ nsarchive/__init__.py,sha256=3zNWlcKF5Cs5ZCgVY_i4RbHdbMTDVWRlZa_8JtlrqFU,5492
2
+ nsarchive/cls/bank.py,sha256=OactEpRn8PGv7BwnBUbMpzgHqrvv4yx526AMzh9uBO8,220
3
+ nsarchive/cls/entities.py,sha256=mhBHZBtYK1E2dfTDoFHNdw1uu5QsnOc-Utuu5EjtV7c,2556
4
+ nsarchive/cls/exceptions.py,sha256=TrH9PvHhVZi7wap9ZfBLGRWJY3OBCYgWAMnco5uadYY,420
5
+ nsarchive/cls/votes.py,sha256=qaWVgfhk5GBccilFSwoZ0E9qE--IX_3HuOBoQAHD2jA,502
6
+ nsarchive-0.0.7a0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
7
+ nsarchive-0.0.7a0.dist-info/METADATA,sha256=NAWRyMMcf3NkeYj9eSSmF_E52Goabm8ruXA8fr_N2sU,5554
8
+ nsarchive-0.0.7a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
9
+ nsarchive-0.0.7a0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- nsarchive/__init__.py,sha256=cJodmN9NJHLSgID2H02Bxo0Ma8NjQ5SJslcFp_DI8B0,4613
2
- nsarchive/cls/entities.py,sha256=mhBHZBtYK1E2dfTDoFHNdw1uu5QsnOc-Utuu5EjtV7c,2556
3
- nsarchive/cls/exceptions.py,sha256=TrH9PvHhVZi7wap9ZfBLGRWJY3OBCYgWAMnco5uadYY,420
4
- nsarchive/cls/votes.py,sha256=qaWVgfhk5GBccilFSwoZ0E9qE--IX_3HuOBoQAHD2jA,502
5
- nsarchive-0.0.6a0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
6
- nsarchive-0.0.6a0.dist-info/METADATA,sha256=uhyW-Ya7iuqSMy4okCivdZjzURsr-QTVIReKZsYKGYw,5554
7
- nsarchive-0.0.6a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
8
- nsarchive-0.0.6a0.dist-info/RECORD,,