Isolate ussd-related data files in imports
This commit is contained in:
parent
0a59539f9a
commit
0f02dd1b7c
@ -171,6 +171,7 @@ if __name__ == '__main__':
|
|||||||
logg.error('load error for {}: {}'.format(y, e))
|
logg.error('load error for {}: {}'.format(y, e))
|
||||||
continue
|
continue
|
||||||
f.close()
|
f.close()
|
||||||
|
logg.debug('deserializing {} {}'.format(filepath, o))
|
||||||
u = Person.deserialize(o)
|
u = Person.deserialize(o)
|
||||||
|
|
||||||
new_address = register_eth(i, u)
|
new_address = register_eth(i, u)
|
||||||
|
@ -105,7 +105,7 @@ def genId(addr, typ):
|
|||||||
def genDate():
|
def genDate():
|
||||||
|
|
||||||
ts = random.randint(ts_then, ts_now)
|
ts = random.randint(ts_then, ts_now)
|
||||||
return datetime.datetime.fromtimestamp(ts).timestamp()
|
return int(datetime.datetime.fromtimestamp(ts).timestamp())
|
||||||
|
|
||||||
|
|
||||||
def genPhone():
|
def genPhone():
|
||||||
@ -193,6 +193,7 @@ def prepareLocalFilePath(datadir, address):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
base_dir = os.path.join(user_dir, 'old')
|
base_dir = os.path.join(user_dir, 'old')
|
||||||
|
ussd_dir = os.path.join(user_dir, 'ussd')
|
||||||
os.makedirs(base_dir, exist_ok=True)
|
os.makedirs(base_dir, exist_ok=True)
|
||||||
|
|
||||||
fa = open(os.path.join(user_dir, 'balances.csv'), 'w')
|
fa = open(os.path.join(user_dir, 'balances.csv'), 'w')
|
||||||
@ -223,6 +224,8 @@ if __name__ == '__main__':
|
|||||||
f = open('{}/{}'.format(d, uid + '.json'), 'w')
|
f = open('{}/{}'.format(d, uid + '.json'), 'w')
|
||||||
json.dump(o.serialize(), f)
|
json.dump(o.serialize(), f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
d = prepareLocalFilePath(ussd_dir, uid)
|
||||||
x = open('{}/{}'.format(d, uid + '_ussd_data.json'), 'w')
|
x = open('{}/{}'.format(d, uid + '_ussd_data.json'), 'w')
|
||||||
json.dump(ussd_data, x)
|
json.dump(ussd_data, x)
|
||||||
x.close()
|
x.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user