Commit 68a4c64e by Owo Sugiana

Tambah generator Nomor Transaksi Pemda

1 parent 8782e2fe
dist
build
*.egg-info
__pycache__
0.1.6 2020-05-03
----------------
- Baru, class TransactionID untuk pembuatan Nomor Transaksi Pemda (NTP)
0.1.5 2020-04-23
----------------
- Bug fixed DateTimeVar.get_value() dan TimeVar.get_value()
......
from time import time
from random import randrange
# Untuk Nomor Transaksi Pemda
class TransactionID:
def __init__(self, timeout=3):
self.timeout = timeout
def create(self, prefix=''):
awal = time()
while True:
acak = randrange(0, 99999999)
tid = prefix + str(acak).zfill(8)
if not self.is_found(tid):
return tid
if time() - awal > 3:
raise Exception('Timeout saat membuat Transaction ID')
# Override, please
def is_found(self, tid):
pass
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!