Commit a4ed3a3b authored by canyonknight's avatar canyonknight Committed by Lukas Fleischer
Browse files

gendummydata.py: Change variable to string to eliminate redundant code



There is no reason the MaintainerUID can't be treated as a string within this
script. By changing to a string an "if" statement can be eliminated.
Signed-off-by: default avatarcanyonknight <canyonknight@gmail.com>
Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent cf2b8223
......@@ -187,20 +187,14 @@ for p in list(seen_pkgs.keys()):
else:
muid = trustedusers[random.randrange(0,len(trustedusers))]
if count % 20 == 0: # every so often, there are orphans...
muid = 0
muid = "NULL"
uuid = genUID() # the submitter/user
if muid == 0:
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES"
" (%d, '%s', '%s', %d, %d, %d, NULL);\n")
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid)
else:
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
" (%d, '%s', '%s', %d, %d, %d, %d);\n")
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
" (%d, '%s', '%s', %d, %d, %d, %s);\n")
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
out.write(s)
count += 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment