xync-schema 0.6.63__py3-none-any.whl → 0.6.66__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.
xync_schema/models.py CHANGED
@@ -1,3 +1,4 @@
1
+ import sys
1
2
  from datetime import datetime
2
3
  from tortoise import fields
3
4
  from tortoise.queryset import QuerySet
@@ -82,8 +83,6 @@ class Ex(Model):
82
83
  include = "name", "logo"
83
84
 
84
85
  def client(self):
85
- import sys
86
-
87
86
  module_name = f"xync_client.{self.name}.ex"
88
87
  __import__(module_name)
89
88
  client = sys.modules[module_name].ExClient
@@ -94,7 +93,6 @@ class Curex(BaseModel):
94
93
  cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
95
94
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
96
95
  exid: str = fields.CharField(31)
97
- p2p: bool = fields.BooleanField(default=True)
98
96
  # countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
99
97
  # "models.Country", through="curexcountry", backward_key="curexs"
100
98
  # )
@@ -215,8 +213,6 @@ class Agent(Model):
215
213
  computed = ["balance"]
216
214
 
217
215
  def client(self):
218
- import sys
219
-
220
216
  module_name = f"xync_client.{self.ex.name}.agent"
221
217
  __import__(module_name)
222
218
  client = sys.modules[module_name].AgentClient
@@ -231,8 +227,6 @@ class Agent(Model):
231
227
  # return client(self)
232
228
 
233
229
  def asset_client(self):
234
- import sys
235
-
236
230
  module_name = f"xync_client.{self.ex.name}.asset"
237
231
  __import__(module_name)
238
232
  client = sys.modules[module_name].AssetClient
@@ -270,6 +264,11 @@ class Ad(Model, TsTrait):
270
264
  class Meta:
271
265
  table_description = "P2P Advertisements"
272
266
 
267
+ def epyd(self):
268
+ module_name = f"xync_client.{self.ex.name}.pyd"
269
+ __import__(module_name)
270
+ return sys.modules[module_name].AdEpyd
271
+
273
272
 
274
273
  class Pm(Model):
275
274
  name: str = fields.CharField(63, unique=True)
@@ -293,6 +292,11 @@ class Pm(Model):
293
292
  # backward_relations = True
294
293
  # include = "id", "name", "logo", "pmexs__sbp"
295
294
 
295
+ # def epyd(self):
296
+ # module_name = f"xync_client.{self.ex.name}.pyd"
297
+ # __import__(module_name)
298
+ # return sys.modules[module_name].PmEpyd
299
+
296
300
 
297
301
  class Pmcur(Model): # for fiat with no exs tie
298
302
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
@@ -319,7 +323,8 @@ class Pmex(BaseModel): # existence pm in ex with no cur tie
319
323
  ex_id: int
320
324
  exid: str = fields.CharField(63)
321
325
  name: str = fields.CharField(63)
322
- sbp: str = fields.BooleanField(default=False)
326
+
327
+ banks: fields.BackwardFKRelation["PmexBank"]
323
328
 
324
329
  class Meta:
325
330
  unique_together = (("ex_id", "exid"),)
@@ -371,7 +376,11 @@ class Fiat(Model):
371
376
  backward_relations = False
372
377
  include = "id", "pmcur", "detail", "name", "amount"
373
378
 
374
- # # exclude_raw_fields = True
379
+ @staticmethod
380
+ def epyd(ex: Ex):
381
+ module_name = f"xync_client.{ex.name}.pyd"
382
+ __import__(module_name)
383
+ return sys.modules[module_name].FiatEpyd
375
384
 
376
385
 
377
386
  class Fiatex(BaseModel): # existence pm in ex with no cur tie
@@ -424,6 +433,11 @@ class Asset(Model):
424
433
  class PydanticMeta(Model.PydanticMeta):
425
434
  max_recursion: int = 2 # default: 3
426
435
 
436
+ def epyd(self):
437
+ module_name = f"xync_client.{self.agent.ex.name}.pyd"
438
+ __import__(module_name)
439
+ return sys.modules[module_name].AssetEpyd
440
+
427
441
 
428
442
  class Order(Model):
429
443
  id: int = fields.BigIntField(True)
@@ -450,8 +464,6 @@ class Order(Model):
450
464
  return f"{self.fiat.pmcur.pm.name}/{self.fiat_id}:{self.amount:.3g} {self.status.name}"
451
465
 
452
466
  async def client(self):
453
- import sys
454
-
455
467
  if isinstance(self.ad, QuerySet):
456
468
  # noinspection PyTypeChecker
457
469
  self.ad: Ad = await self.ad.prefetch_related("agent__ex")
@@ -464,6 +476,11 @@ class Order(Model):
464
476
  client = sys.modules[f"xync_client.{self.ad.agent.ex.name}.order"].Client
465
477
  return client(self)
466
478
 
479
+ # def epyd(self): # todo: for who?
480
+ # module_name = f"xync_client.{self.ex.name}.pyd"
481
+ # __import__(module_name)
482
+ # return sys.modules[module_name].OrderEpyd
483
+
467
484
  class Meta:
468
485
  table_description = "P2P Orders"
469
486
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xync-schema
3
- Version: 0.6.63
3
+ Version: 0.6.66
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -0,0 +1,8 @@
1
+ xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ xync_schema/enums.py,sha256=la85coRbxXL0HiAgJYpOU4Yyf_atVp6DZSlAV3ICvEk,12207
3
+ xync_schema/models.py,sha256=5iLxd9rBB1B3P5TyUUgUlYmx7Pyefe3e3WRa6GMQ1F4,23780
4
+ xync_schema/pydantic.py,sha256=7uTAqoN3WT1w9RByyBwn78FOkD3nfO9b3UGnR-DWAro,794
5
+ xync_schema-0.6.66.dist-info/METADATA,sha256=cOD2WZPECsdPf28twbLqZWsWy7TLz-OEIrxMjPdOxC0,3985
6
+ xync_schema-0.6.66.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ xync_schema-0.6.66.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
+ xync_schema-0.6.66.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- xync_schema/enums.py,sha256=la85coRbxXL0HiAgJYpOU4Yyf_atVp6DZSlAV3ICvEk,12207
3
- xync_schema/models.py,sha256=2yDjPwOzd7FSE429mM0fEEWcKytNCryy7hDi2k0Ni7o,23095
4
- xync_schema/pydantic.py,sha256=7uTAqoN3WT1w9RByyBwn78FOkD3nfO9b3UGnR-DWAro,794
5
- xync_schema-0.6.63.dist-info/METADATA,sha256=HHDZcpbwTcPsTymsiDQFLuQUfeWzFE9kcpAwjNBHzE4,3985
6
- xync_schema-0.6.63.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- xync_schema-0.6.63.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
- xync_schema-0.6.63.dist-info/RECORD,,