from publish_hits import publish_hit from server_common import openLog, log_d from survey import getSurveyData class Server(Flask): def get_send_file_max_age(self, name): if name in [ "jquery-1.12.0.min.js", "jquery-migrate-1.2.1.min.js", "jquery.jsonrpcclient.js" ]: return 100000 return 0 app = Server(__name__, static_folder="static/", static_url_path="") api = rpc(app, "/api") def isHitActive(hit): return hit.HITStatus in ("Assignable", "Unassignable") def isHitPerHour(hit): creationTime = datetime.strptime(hit.CreationTime, "%Y-%m-%dT%H:%M:%SZ") return datetime.now() - creationTime <= timedelta(hours=1) class ConfiguredExperiment: def __init__(self, expconf): self.name = expconf["ename"] self.args = expconf["args"] self.min_finished_per_lvl = expconf["minFinishedPerLvl"] self.lvls = expconf.get("lvls", None)
from typing import Dict, Any, Optional, TypeVar, List, Tuple, Set T = TypeVar("T") class Server(Flask): def get_send_file_max_age(self, name: str) -> int: if (name in [ 'jquery-1.12.0.min.js', \ 'jquery-migrate-1.2.1.min.js', \ 'jquery.jsonrpcclient.js']): return 100000 return 0 app = Server(__name__, static_folder='frontend/', static_url_path='/game') api = rpc(app, '/api') traces: Dict[str, Dict[str, FlowgameLevel]] = {} ## Utility functions ################################################# def divisionToMul(inv: AstExpr) -> AstExpr: if isinstance(inv, AstBinExpr) and \ inv.op in ['==', '<', '>', '<=', '>=', '!==']: if (isinstance(inv.lhs, AstBinExpr) and inv.lhs.op == 'div' and\ isinstance(inv.lhs.rhs, AstNumber)): return AstBinExpr(inv.lhs.lhs, inv.op, \ AstBinExpr(inv.rhs, '*', inv.lhs.rhs)) if (isinstance(inv.rhs, AstBinExpr) and inv.rhs.op == 'div' and\ isinstance(inv.rhs.rhs, AstNumber)):