xync-db 0.24.2__tar.gz → 0.24.3.dev5__tar.gz
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_db-0.24.2 → xync_db-0.24.3.dev5}/PKG-INFO +1 -1
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/models/__init__.py +13 -16
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/.gitignore +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/README.md +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/pyproject.toml +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/config.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/enums.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/exceptions.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/graph.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/i18n.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/login_store.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/logo.png +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/CLAUDE.md +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/0001_initial.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/0002_triggers.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/0003_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/a_actor_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/a_bin_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/a_city_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/a_country_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/c_net_seed.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/cities.json +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/countries.json +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/ranges.csv +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/models/CLAUDE.md +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/py.typed +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/shared.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/__init__.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/actor.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/ad.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/common.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/cred.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/order.py +0 -0
- {xync_db-0.24.2 → xync_db-0.24.3.dev5}/src/xync_db/typs/db/pm.py +0 -0
|
@@ -2463,30 +2463,27 @@ class Card(Model):
|
|
|
2463
2463
|
unique_together = (("bin", "num"),)
|
|
2464
2464
|
|
|
2465
2465
|
@staticmethod
|
|
2466
|
-
def
|
|
2467
|
-
"""
|
|
2466
|
+
def _luhn_sum(digits: str, doubled: int) -> int:
|
|
2467
|
+
"""Сумма Луна: удваивается каждая вторая цифра с конца, начиная с индекса `doubled` (0 или 1)."""
|
|
2468
2468
|
total = 0
|
|
2469
|
-
for i, ch in enumerate(reversed(
|
|
2469
|
+
for i, ch in enumerate(reversed(digits)):
|
|
2470
2470
|
d = int(ch)
|
|
2471
|
-
if i % 2 ==
|
|
2471
|
+
if i % 2 == doubled:
|
|
2472
2472
|
d *= 2
|
|
2473
2473
|
if d > 9:
|
|
2474
2474
|
d -= 9
|
|
2475
2475
|
total += d
|
|
2476
|
-
return total
|
|
2476
|
+
return total
|
|
2477
2477
|
|
|
2478
|
-
@
|
|
2479
|
-
def
|
|
2478
|
+
@classmethod
|
|
2479
|
+
def _luhn_ok(cls, number: str) -> bool:
|
|
2480
|
+
"""Проверка полного номера карты по Луну (контрольная цифра — последняя)."""
|
|
2481
|
+
return cls._luhn_sum(number, 1) % 10 == 0
|
|
2482
|
+
|
|
2483
|
+
@classmethod
|
|
2484
|
+
def _luhn_check_digit(cls, partial: str) -> int:
|
|
2480
2485
|
"""Контрольная цифра Луна для номера БЕЗ неё (`partial` = полный номер минус последняя цифра)."""
|
|
2481
|
-
|
|
2482
|
-
for i, ch in enumerate(reversed(partial)):
|
|
2483
|
-
d = int(ch)
|
|
2484
|
-
if i % 2 == 0:
|
|
2485
|
-
d *= 2
|
|
2486
|
-
if d > 9:
|
|
2487
|
-
d -= 9
|
|
2488
|
-
total += d
|
|
2489
|
-
return (10 - total % 10) % 10
|
|
2486
|
+
return (10 - cls._luhn_sum(partial, 0) % 10) % 10
|
|
2490
2487
|
|
|
2491
2488
|
@classmethod
|
|
2492
2489
|
async def from_number(cls, number: str) -> Card:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|