コード例 #1
0
 def addNewPassword(self, path, password):
     path = h.cleanPath(path)
     if password is None: return False
     if self.passwordEditForbidden(path): return False
     lh, lf = None, h.makePath(h.LOCKS_FOLDER,
                               "_sfl_password_%s" % h.clean(path))
     try:
         passwordFile = h.makePath(self.basePath, path, ".password")
         requiredPasswords = list(self.getPasswords(path))
         requiredPasswords.append(password)
         lh = h.getLockExclusive(lf, 5)
         h.writeToFile(passwordFile,
                       "\n".join(list(set(requiredPasswords))))
         return True
     except:
         print(h.getLastExceptionAndTrace())
         return False
     finally:
         if lh is not None: h.releaseLock(lh)
コード例 #2
0
def getDataPerYear():
    year = request.args.get('year', default='1970', type=str)
    filename = "Data" + year + ".csv"

    df = helper.getDataFrameBasedOnYear(filename)

    attr1 = request.args.get('attr', default='Sex', type=str)
    if attr1 == 'Immigrant':
        attr1 = "Native"
    attr1 += "_Ratio"

    attr2 = request.args.get('profiler', default='PerCapitaIncome', type=str)
    corr, pval = helper.getStats(df, attr1, attr2)

    if (pval < 0.05):
        print("P - value : " + str(pval) + ". STATISTICALLY SIGNIFICANT.")
    else:
        print("P - value : " + str(pval) + ". STATISTICALLY INSIGNIFICANT.")
    helper.writeToFile("stats.txt", corr, pval)
    getStats()
    return df.to_csv()
コード例 #3
0
ファイル: satern.py プロジェクト: tanmaytirpankar/Satire
    del parser
    del lexer
    end_parse_time = time.time()
    parse_time = end_parse_time - start_parse_time
    logger.info(
        "Parsing time : {parse_time} secs".format(parse_time=parse_time))

    ##----- PreProcess to eliminate all redundant defintions ------
    pr1 = time.time()
    helper.PreProcessAST()
    pr2 = time.time()

    ea1 = time.time()
    results = ErrorAnalysis(argList)
    ea2 = time.time()
    helper.writeToFile(results, fout, argList.file, argList.std, argList.sound)
    #writeToFile(results)

    end_exec_time = time.time()
    ##------ End of Analysis Results ------
    fout.write(
        "Optimizer Calls: {num_calls}\n".format(num_calls=Globals.gelpiaID))
    fout.write(
        "Parsing time : {parsing_time}\n".format(parsing_time=parse_time))
    fout.write("PreProcessing time : {preprocess_time}\n".format(
        preprocess_time=pr2 - pr1))
    fout.write("Analysis time : {analysis_time}\n".format(analysis_time=ea2 -
                                                          ea1))
    fout.write("Full time : {full_time}\n".format(full_time=end_exec_time -
                                                  start_exec_time))
    logger.info(
コード例 #4
0
 def setShareForbidden(self, path):
     path = h.cleanPath(path)
     h.writeToFile(h.makePath(self.basePath, path, ".noshare"), "")
コード例 #5
0
 def setDownloadForbidden(self, path):
     path = h.cleanPath(path)
     h.writeToFile(h.makePath(self.basePath, path, ".nodownload"), "")
コード例 #6
0
 def setListingForbidden(self, path):
     path = h.cleanPath(path)
     h.writeToFile(h.makePath(self.basePath, path, ".nolist"), "")
コード例 #7
0
 def setEditAllowed(self, path):
     path = h.cleanPath(path)
     h.writeToFile(h.makePath(self.basePath, path, ".editallowed"), "")