mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Update EditionTracking to be Python 3 compatible.
This commit is contained in:
@@ -70,14 +70,14 @@ def initializeEditions():
|
|||||||
else:
|
else:
|
||||||
mtgDataCards[card].append(setcode)
|
mtgDataCards[card].append(setcode)
|
||||||
|
|
||||||
print "Total Cards Found in all editions", len(mtgDataCards)
|
print("Total Cards Found in all editions", len(mtgDataCards))
|
||||||
print "These sets will be ignored in some output files", ignoredSet
|
print("These sets will be ignored in some output files", ignoredSet)
|
||||||
|
|
||||||
def initializeOracleText():
|
def initializeOracleText():
|
||||||
print "Initializing Oracle text"
|
print("Initializing Oracle text")
|
||||||
oracleDict = None
|
oracleDict = None
|
||||||
if not os.path.exists(allJson):
|
if not os.path.exists(allJson):
|
||||||
print "Need to download Json file..."
|
print("Need to download Json file...")
|
||||||
r = requests.get(allJsonUrl)
|
r = requests.get(allJsonUrl)
|
||||||
with open(allJson, 'w') as f:
|
with open(allJson, 'w') as f:
|
||||||
f.write(r.text.encode("utf-8"))
|
f.write(r.text.encode("utf-8"))
|
||||||
@@ -90,12 +90,12 @@ def initializeOracleText():
|
|||||||
|
|
||||||
|
|
||||||
aes = [k for k in oracleDict.keys() if u'\xc6' in k or u'\xf6' in k]
|
aes = [k for k in oracleDict.keys() if u'\xc6' in k or u'\xf6' in k]
|
||||||
print "Normalizing %s names" % len(aes)
|
print("Normalizing %s names" % len(aes))
|
||||||
for ae in aes:
|
for ae in aes:
|
||||||
data = oracleDict.pop(ae)
|
data = oracleDict.pop(ae)
|
||||||
oracleDict[normalizeOracle(ae)] = data
|
oracleDict[normalizeOracle(ae)] = data
|
||||||
|
|
||||||
print "Found Oracle text for ", len(oracleDict)
|
print("Found Oracle text for ", len(oracleDict))
|
||||||
return oracleDict
|
return oracleDict
|
||||||
|
|
||||||
def normalizeOracle(oracle):
|
def normalizeOracle(oracle):
|
||||||
@@ -128,7 +128,7 @@ def initializeForgeCards():
|
|||||||
def initializeFormats():
|
def initializeFormats():
|
||||||
formats = {}
|
formats = {}
|
||||||
formatLocation = os.path.join(resDir, 'formats', 'Sanctioned')
|
formatLocation = os.path.join(resDir, 'formats', 'Sanctioned')
|
||||||
print "Looking for formats in ", formatLocation
|
print("Looking for formats in ", formatLocation)
|
||||||
for root, dirnames, filenames in os.walk(formatLocation):
|
for root, dirnames, filenames in os.walk(formatLocation):
|
||||||
for fileName in fnmatch.filter(filenames, '*.txt'):
|
for fileName in fnmatch.filter(filenames, '*.txt'):
|
||||||
if fileName not in ['Standard.txt', 'Modern.txt']:
|
if fileName not in ['Standard.txt', 'Modern.txt']:
|
||||||
@@ -184,7 +184,7 @@ def printOverallEditions(totalDataList, setCodeToName, releaseFile=None):
|
|||||||
totalMissing += dataKey[1]
|
totalMissing += dataKey[1]
|
||||||
fullTotal += dataKey[2]
|
fullTotal += dataKey[2]
|
||||||
if dataKey[2] == 0:
|
if dataKey[2] == 0:
|
||||||
print "SetCode unknown", k
|
print("SetCode unknown", k)
|
||||||
continue
|
continue
|
||||||
writeToFiles(setCodeToName[k].lstrip() + ": " + str(dataKey[0]) + " (" + str(dataKey[1]) + ") / " + str(dataKey[2]) + " = " + str(round(dataKey[3], 2)) + "%\n", files)
|
writeToFiles(setCodeToName[k].lstrip() + ": " + str(dataKey[0]) + " (" + str(dataKey[1]) + ") / " + str(dataKey[2]) + " = " + str(round(dataKey[3], 2)) + "%\n", files)
|
||||||
totalPercentage = totalImplemented / fullTotal
|
totalPercentage = totalImplemented / fullTotal
|
||||||
@@ -199,10 +199,10 @@ def printCardSet(implementedSet, missingSet, fileName, setCoverage=None, printIm
|
|||||||
impCount = len(implementedSet)
|
impCount = len(implementedSet)
|
||||||
misCount = len(missingSet)
|
misCount = len(missingSet)
|
||||||
totalCount = impCount + misCount
|
totalCount = impCount + misCount
|
||||||
print fileName, "Counts: ", impCount, misCount, totalCount
|
print(fileName, "Counts: ", impCount, misCount, totalCount)
|
||||||
|
|
||||||
if totalCount == 0:
|
if totalCount == 0:
|
||||||
print "Something definitely wrong, why is total count 0 for ", fileName
|
print("Something definitely wrong, why is total count 0 for ", fileName)
|
||||||
return
|
return
|
||||||
|
|
||||||
if releaseFile:
|
if releaseFile:
|
||||||
@@ -250,7 +250,7 @@ def printDistinctOracle(missingSet, fileName):
|
|||||||
outfile.write("%s\n%s\n\n" % (s, oracle))
|
outfile.write("%s\n%s\n\n" % (s, oracle))
|
||||||
except:
|
except:
|
||||||
outfile.write("%s\n\n" % (s))
|
outfile.write("%s\n\n" % (s))
|
||||||
print "Failed to grab oracle for ", s
|
print("Failed to grab oracle for ", s)
|
||||||
outfile.write("\n")
|
outfile.write("\n")
|
||||||
|
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ if __name__ == '__main__':
|
|||||||
if 'loyalty' in orc:
|
if 'loyalty' in orc:
|
||||||
output.write('Loyalty:' + orc.get('loyalty'))
|
output.write('Loyalty:' + orc.get('loyalty'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "some issue?", str(e)
|
print("some issue?", str(e))
|
||||||
|
|
||||||
# Blah
|
# Blah
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
output.write(text + '\n\n')
|
output.write(text + '\n\n')
|
||||||
except:
|
except:
|
||||||
print everyMissing
|
print(everyMissing)
|
||||||
output.write("\n")
|
output.write("\n")
|
||||||
output.write("Total: " + str(total) + "\n")
|
output.write("Total: " + str(total) + "\n")
|
||||||
output.write("Percentage implemented: " + str(round(percentage,2)) + "%\n")
|
output.write("Percentage implemented: " + str(round(percentage,2)) + "%\n")
|
||||||
@@ -390,4 +390,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
releaseOutput.close()
|
releaseOutput.close()
|
||||||
|
|
||||||
print ("Done!")
|
print("Done!")
|
||||||
|
|||||||
Reference in New Issue
Block a user