mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
fix: [update 1.4] typo
This commit is contained in:
parent
3272ffa714
commit
309e150b8b
1 changed files with 48 additions and 51 deletions
|
@ -44,24 +44,38 @@ if __name__ == '__main__':
|
|||
index = 0
|
||||
start = time.time()
|
||||
for key in r_serv_metadata.scan_iter('*'):
|
||||
if not 'dup:' in key:
|
||||
if PASTES_FOLDER in key:
|
||||
new_key = key.replace(PASTES_FOLDER, '', 1)
|
||||
|
||||
# a set with this key already exist
|
||||
if r_serv_metadata.exists(new_key):
|
||||
# save data
|
||||
for new_key_value in r_serv_metadata.smembers(key):
|
||||
r_serv_metadata.sadd(new_key, new_key_value)
|
||||
r_serv_metadata.delete(key)
|
||||
index = index + 1
|
||||
|
||||
type = r_serv_metadata.type(key)
|
||||
print(type)
|
||||
if type == 'hash':
|
||||
list_data = r_serv_metadata.hscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
print(key)
|
||||
while list_data[1]:
|
||||
print(list_data[1])
|
||||
for hash_key, value in list_data[1].items():
|
||||
print('-----------------------------')
|
||||
print(key)
|
||||
print(hash_key)
|
||||
print(value)
|
||||
r_serv_metadata.hdel(key, hash_key)
|
||||
if PASTES_FOLDER in hash_key:
|
||||
new_hash = hash_key.replace(PASTES_FOLDER, '', 1)
|
||||
else:
|
||||
new_hash = hash_key
|
||||
if PASTES_FOLDER in value:
|
||||
new_value = value.replace(PASTES_FOLDER, '', 1)
|
||||
else:
|
||||
new_value = value
|
||||
index = index +1
|
||||
r_serv_metadata.hset(key, new_hash, new_value)
|
||||
|
||||
list_data = r_serv_metadata.sscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
|
||||
list_data = r_serv_metadata.hscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
elif type == 'zset':
|
||||
list_data = r_serv_metadata.zscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
while list_data[1]:
|
||||
for elem in list_data[1]:
|
||||
|
@ -74,7 +88,7 @@ if __name__ == '__main__':
|
|||
|
||||
list_data = r_serv_metadata.zscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
|
||||
if not 'dup:' in key:
|
||||
elif type == 'set':
|
||||
list_data = r_serv_metadata.sscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
while list_data[1]:
|
||||
for set_value in list_data[1]:
|
||||
|
@ -84,17 +98,6 @@ if __name__ == '__main__':
|
|||
|
||||
list_data = r_serv_metadata.sscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
|
||||
if PASTES_FOLDER in key:
|
||||
new_key = key.replace(PASTES_FOLDER, '', 1)
|
||||
|
||||
# a set with this key already exist
|
||||
if r_serv_metadata.exists(new_key):
|
||||
# save data
|
||||
for new_key_value in r_serv_metadata.smembers(new_key):
|
||||
r_serv_metadata.sadd(key, new_key_value)
|
||||
r_serv_metadata.rename(key, new_key)
|
||||
index = index + 1
|
||||
|
||||
end = time.time()
|
||||
|
||||
|
||||
|
@ -132,18 +135,12 @@ if __name__ == '__main__':
|
|||
while list_data[1]:
|
||||
for hash_key, value in list_data[1].items():
|
||||
r_serv_onion.hdel(key, hash_key)
|
||||
if PASTES_FOLDER in hash_key:
|
||||
new_hash = hash_key.replace(PASTES_FOLDER, '', 1)
|
||||
else:
|
||||
new_hash = hash_key
|
||||
if PASTES_FOLDER in value:
|
||||
new_value = value.replace(PASTES_FOLDER, '', 1)
|
||||
else:
|
||||
new_value = value
|
||||
index = index +1
|
||||
r_serv_onion.hset(key, new_hash, new_value)
|
||||
|
||||
list_data = r_serv_onion.sscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
list_data = r_serv_onion.hscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
|
||||
list_data = r_serv_onion.sscan(key, 0, '*{}*'.format(PASTES_FOLDER), 1000)
|
||||
while list_data[1]:
|
||||
|
|
Loading…
Reference in a new issue