Beispiel #1
0
      else:
         filesBySuffix[suffix] = [filename]

print "Analyzing suffixes for 101repo."
dump = dict()
suffixes = json.load(open(const101.rulesDump, 'r'))["results"]["suffixes"]
filesBySuffix = dict()
tools101.loopOverFiles(fun, True)
filesBySuffix = filesBySuffix.items()
filesBySuffix = sorted(filesBySuffix, reverse=True, key=lambda (ext, list): len(list))
dump["suffixes"] = dict()
dump["suffixes"]["all"] = [ x[0] for x in filesBySuffix ]
dump["suffixes"]["matched"] = [ x[0] for x in filesBySuffix if x[0] in suffixes ]
dump["suffixes"]["unmatched"] = [ x[0] for x in filesBySuffix if not x[0] in suffixes ]
dump["filesBySuffix"] = dict()
dump["filesBySuffix"]["all"] = [ tools101.pair2json(x) for x in filesBySuffix ]
dump["filesBySuffix"]["matched"] = [ tools101.pair2json(x) for x in filesBySuffix if x[0] in suffixes ]
dump["filesBySuffix"]["unmatched"] = [ tools101.pair2json(x) for x in filesBySuffix if not x[0] in suffixes ]
dump["numbersBySuffix"] = dict()
dump["numbersBySuffix"]["all"] = [ tools101.pair2json((x, len(y))) for (x, y) in filesBySuffix ]
dump["numbersBySuffix"]["matched"] = [ tools101.pair2json((x, len(y))) for (x, y) in filesBySuffix if x in suffixes ]
dump["numbersBySuffix"]["unmatched"] = [ tools101.pair2json((x, len(y))) for (x, y) in filesBySuffix if not x in suffixes ]
dump["numbersOfSuffixes"] = dict()
dump["numbersOfSuffixes"]["all"] = len(dump["filesBySuffix"]["all"])
dump["numbersOfSuffixes"]["matched"] = len(dump["filesBySuffix"]["matched"])
dump["numbersOfSuffixes"]["unmatched"] = len(dump["filesBySuffix"]["unmatched"])
tools101.dump(dump,"numbersOfSuffixes")
suffixesFile = open(const101.suffixesDump, 'w')
suffixesFile.write(json.dumps(dump))
exit(0)
Beispiel #2
0
dump = dict()
dump["results"] = dict()
dump["problems"] = problems
dump["numbers"] = numbers

dump["results"]["packages"] = dict()
dump["results"]["packages"]["allPackages"] = sorted(list(both))
dump["results"]["packages"]["definedPackages"] = sorted(list(defined))
dump["results"]["packages"]["usedPackages"] = sorted(list(used))
dump["results"]["packages"]["matchedPackages"] = sorted(list(matched))
dump["results"]["packages"]["unmatchedPackages"] = sorted(list(unmatched))

filesByDef = filesByDef.items()
filesByDef = sorted(filesByDef, reverse=True, key=lambda (pkg, list): len(list))
dump["results"]["filesByDef"] = dict()
dump["results"]["filesByDef"]["allFiles"] = [ tools101.pair2json(x) for x in filesByDef ]
dump["results"]["filesByDef"]["matchedFiles"] = [ tools101.pair2json(x) for x in filesByDef if x[0] in matched ]
dump["results"]["filesByDef"]["unmatchedFiles"] = [ tools101.pair2json(x) for x in filesByDef if x[0] in unmatched ]

filesByUse = filesByUse.items()
filesByUse = sorted(filesByUse, reverse=True, key=lambda (pkg, list): len(list))
dump["results"]["filesByUse"] = dict()
dump["results"]["filesByUse"]["allFiles"] = [ tools101.pair2json(x) for x in filesByUse ]
dump["results"]["filesByUse"]["matchedFiles"] = [ tools101.pair2json(x) for x in filesByUse if x[0] in matched ]
dump["results"]["filesByUse"]["unmatchedFiles"] = [ tools101.pair2json(x) for x in filesByUse if x[0] in unmatched ]

dump["numbers"]["numberOfAllPackages"] = len(both)
dump["numbers"]["numberOfDefinedPackages"] = len(defined)
dump["numbers"]["numberOfUsedPackages"] = len(used)
dump["numbers"]["numberOfMatchedPackages"] = len(matched)
dump["numbers"]["numberOfUnmatchedPackages"] = len(unmatched)
Beispiel #3
0
dump = dict()
suffixes = json.load(open(const101.rulesDump, 'r'))["results"]["suffixes"]
filesBySuffix = dict()
tools101.loopOverFiles(fun, True)
filesBySuffix = filesBySuffix.items()
filesBySuffix = sorted(filesBySuffix,
                       reverse=True,
                       key=lambda (ext, list): len(list))
dump["suffixes"] = dict()
dump["suffixes"]["all"] = [x[0] for x in filesBySuffix]
dump["suffixes"]["matched"] = [x[0] for x in filesBySuffix if x[0] in suffixes]
dump["suffixes"]["unmatched"] = [
    x[0] for x in filesBySuffix if not x[0] in suffixes
]
dump["filesBySuffix"] = dict()
dump["filesBySuffix"]["all"] = [tools101.pair2json(x) for x in filesBySuffix]
dump["filesBySuffix"]["matched"] = [
    tools101.pair2json(x) for x in filesBySuffix if x[0] in suffixes
]
dump["filesBySuffix"]["unmatched"] = [
    tools101.pair2json(x) for x in filesBySuffix if not x[0] in suffixes
]
dump["numbersBySuffix"] = dict()
dump["numbersBySuffix"]["all"] = [
    tools101.pair2json((x, len(y))) for (x, y) in filesBySuffix
]
dump["numbersBySuffix"]["matched"] = [
    tools101.pair2json((x, len(y))) for (x, y) in filesBySuffix
    if x in suffixes
]
dump["numbersBySuffix"]["unmatched"] = [
Beispiel #4
0
dump["numbers"] = numbers

dump["results"]["packages"] = dict()
dump["results"]["packages"]["allPackages"] = sorted(list(both))
dump["results"]["packages"]["definedPackages"] = sorted(list(defined))
dump["results"]["packages"]["usedPackages"] = sorted(list(used))
dump["results"]["packages"]["matchedPackages"] = sorted(list(matched))
dump["results"]["packages"]["unmatchedPackages"] = sorted(list(unmatched))

filesByDef = filesByDef.items()
filesByDef = sorted(filesByDef,
                    reverse=True,
                    key=lambda (pkg, list): len(list))
dump["results"]["filesByDef"] = dict()
dump["results"]["filesByDef"]["allFiles"] = [
    tools101.pair2json(x) for x in filesByDef
]
dump["results"]["filesByDef"]["matchedFiles"] = [
    tools101.pair2json(x) for x in filesByDef if x[0] in matched
]
dump["results"]["filesByDef"]["unmatchedFiles"] = [
    tools101.pair2json(x) for x in filesByDef if x[0] in unmatched
]

filesByUse = filesByUse.items()
filesByUse = sorted(filesByUse,
                    reverse=True,
                    key=lambda (pkg, list): len(list))
dump["results"]["filesByUse"] = dict()
dump["results"]["filesByUse"]["allFiles"] = [
    tools101.pair2json(x) for x in filesByUse