MCPcopy Create free account
hub / github.com/Card-Forge/forge / printCardSet

Function printCardSet

forge-gui/tools/EditionTracking.py:200–243  ·  view source on GitHub ↗
(implementedSet, missingSet, fileName, setCoverage=None, printImplemented=False, printMissing=True, releaseFile=None)

Source from the content-addressed store, hash-verified

198 releaseFile.write("[/spoiler]\n\n")
199
200def printCardSet(implementedSet, missingSet, fileName, setCoverage=None, printImplemented=False, printMissing=True, releaseFile=None):
201 # Add another file that will print out whichever set is requested
202 # Convert back to lists so they can be sorted
203 impCount = len(implementedSet)
204 misCount = len(missingSet)
205 totalCount = impCount + misCount
206 print(fileName, "Counts: ", impCount, misCount, totalCount)
207
208 if totalCount == 0:
209 print("Something definitely wrong, why is total count 0 for ", fileName)
210 return
211
212 if releaseFile:
213 releaseFile.write("[spoiler=%s]\n" % fileName)
214
215 filePath = os.path.join(toolsDir, "EditionTrackingResults", fileName)
216 with open(filePath, "w") as outfile:
217 files = [outfile, releaseFile]
218 if setCoverage:
219 writeToFiles(' '.join(setCoverage), files)
220 writeToFiles('\n', files)
221 writeToFiles("Implemented (Missing) / Total = Percentage Implemented\n", files)
222 writeToFiles("%d (%d) / %d = %.2f %%\n" % (impCount, misCount, totalCount, float(impCount)/totalCount*100), files)
223
224 # If you really need to, we can print implemented cards
225 if printImplemented:
226 implemented = list(implementedSet)
227 implemented.sort()
228 outfile.write("\nImplemented (%d):" % impCount)
229 for s in implemented:
230 outfile.write("\n%s" % s)
231
232 # By default Missing will print, but you can disable it
233 if printMissing:
234 missing = list(missingSet)
235 missing.sort()
236 writeToFiles("\nMissing (%d):" % misCount, files)
237 for s in missing:
238 writeToFiles("\n%s" % s, files)
239
240 writeToFiles("\n", files)
241
242 if releaseFile:
243 releaseFile.write("[/spoiler]\n\n")
244
245def printDistinctOracle(missingSet, fileName):
246 filePath = os.path.join(toolsDir, "EditionTrackingResults", fileName)

Callers 1

EditionTracking.pyFile · 0.70

Calls 4

writeToFilesFunction · 0.70
writeMethod · 0.65
joinMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected