code
stringlengths
2k
1.04M
repo_path
stringlengths
5
517
parsed_code
stringlengths
0
1.04M
quality_prob
float64
0.02
0.95
learning_prob
float64
0.02
0.93
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('content_management', '0023_auto_20180424_1227'), ] operations = [ migrations.AlterField( model_name='cataloger', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='cataloger', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='content', name='copyright', field=models.CharField(max_length=500, null=True), ), migrations.AlterField( model_name='content', name='name', field=models.CharField(max_length=300), ), migrations.AlterField( model_name='coverage', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='coverage', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='creator', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='creator', name='name', field=models.CharField(max_length=300, unique=True), ), migrations.AlterField( model_name='directory', name='name', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='directorylayout', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='directorylayout', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='keyword', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='keyword', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='language', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='language', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='subject', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='subject', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='workarea', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='workarea', name='name', field=models.CharField(max_length=100, unique=True), ), ]
build_automation/content_management/migrations/0024_auto_20180428_1833.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('content_management', '0023_auto_20180424_1227'), ] operations = [ migrations.AlterField( model_name='cataloger', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='cataloger', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='content', name='copyright', field=models.CharField(max_length=500, null=True), ), migrations.AlterField( model_name='content', name='name', field=models.CharField(max_length=300), ), migrations.AlterField( model_name='coverage', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='coverage', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='creator', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='creator', name='name', field=models.CharField(max_length=300, unique=True), ), migrations.AlterField( model_name='directory', name='name', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='directorylayout', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='directorylayout', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='keyword', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='keyword', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='language', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='language', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='subject', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='subject', name='name', field=models.CharField(max_length=100, unique=True), ), migrations.AlterField( model_name='workarea', name='description', field=models.CharField(max_length=2000, null=True), ), migrations.AlterField( model_name='workarea', name='name', field=models.CharField(max_length=100, unique=True), ), ]
0.6705
0.120284
import unittest import orca import os.path as path from setup.settings import * from pandas.util.testing import * class Csv: pdf_csv = None odf_csv = None class DataFrameReindexingTest(unittest.TestCase): @classmethod def setUpClass(cls): # configure data directory DATA_DIR = path.abspath(path.join(__file__, "../setup/data")) fileName = 'USPricesSample.csv' data = os.path.join(DATA_DIR, fileName) data = data.replace('\\', '/') # connect to a DolphinDB server orca.connect(HOST, PORT, "admin", "123456") Csv.odf_csv = orca.read_csv(data, dtype={"DLSTCD": np.float32, "DLPRC": np.float32}) # pdf from import Csv.pdf_csv = pd.read_csv(data, parse_dates=[1], dtype={"DLSTCD": np.float32, "DLPRC": np.float32}) Csv.odf_csv = Csv.odf_csv.drop(columns=['DLRET']) Csv.pdf_csv.drop(columns=['DLRET'], inplace=True) @property def pdf_csv(self): return Csv.pdf_csv @property def odf_csv(self): return Csv.odf_csv @property def pdf(self): return pd.DataFrame({ 'a': [1, 2, 3, 4, 5, 6, 7, 8, 9], 'b': [4, 5, 6, 3, 2, 1, 0, 0, 0], }, index=[0, 1, 3, 5, 6, 8, 9, 9, 9]) @property def odf(self): return orca.DataFrame(self.pdf) def test_dataframe_reindexing_selection_label_mainpulation_between_time(self): idx = pd.date_range('2018-04-09', periods=4, freq='1D20min') pdf = pd.DataFrame({'A': [1, 2, 3, 4]}, index=idx) odf = orca.DataFrame(pdf) assert_frame_equal(odf.between_time('0:15', '0:45').to_pandas(), pdf.between_time('0:15', '0:45')) assert_frame_equal(odf.between_time('0:45', '0:15').to_pandas(), pdf.between_time('0:45', '0:15')) def test_dataframe_reindexing_selection_label_mainpulation_take(self): n = np.array([0, 1, 4]) assert_frame_equal(self.odf.take(n).to_pandas(), self.pdf.take(n)) assert_frame_equal(self.odf.take([]).to_pandas(), self.pdf.take([])) assert_frame_equal(self.odf.take([0, 1], axis=1).to_pandas(), self.pdf.take([0, 1], axis=1)) assert_frame_equal(self.odf.take([-1, -2], axis=0).to_pandas(), self.pdf.take([-1, -2], axis=0)) n = np.random.randint(0, 2999, 100) assert_frame_equal(self.odf_csv.take(n).to_pandas(), self.pdf_csv.take(n), check_dtype=False) assert_frame_equal(self.odf_csv.take([0, 1, 5, 7, 11, 15], axis=1).to_pandas(), self.pdf_csv.take([0, 1, 5, 7, 11, 15], axis=1), check_dtype=False) def test_dataframe_reindexing_selection_label_mainpulation_equals(self): pdf = pd.DataFrame({1: [10], 2: [20]}) p_exactly_equal = pd.DataFrame({1: [10], 2: [20]}) p_different_column_type = pd.DataFrame({1.0: [10], 2.0: [20]}) p_different_data_type = pd.DataFrame({1: [10.0], 2: [20.0]}) odf = orca.DataFrame(pdf) o_exactly_equal = orca.DataFrame(p_exactly_equal) o_different_column_type = orca.DataFrame(p_different_column_type) o_different_data_type = orca.DataFrame(p_different_data_type) self.assertEqual(odf.equals(o_exactly_equal), pdf.equals(p_exactly_equal)) self.assertEqual(odf.equals(o_different_column_type), pdf.equals(p_different_column_type)) self.assertEqual(odf.equals(o_different_data_type), pdf.equals(p_different_data_type)) if __name__ == '__main__': unittest.main()
tests/orca_unit_testing/test_dataframe_reindexing_selection.py
import unittest import orca import os.path as path from setup.settings import * from pandas.util.testing import * class Csv: pdf_csv = None odf_csv = None class DataFrameReindexingTest(unittest.TestCase): @classmethod def setUpClass(cls): # configure data directory DATA_DIR = path.abspath(path.join(__file__, "../setup/data")) fileName = 'USPricesSample.csv' data = os.path.join(DATA_DIR, fileName) data = data.replace('\\', '/') # connect to a DolphinDB server orca.connect(HOST, PORT, "admin", "123456") Csv.odf_csv = orca.read_csv(data, dtype={"DLSTCD": np.float32, "DLPRC": np.float32}) # pdf from import Csv.pdf_csv = pd.read_csv(data, parse_dates=[1], dtype={"DLSTCD": np.float32, "DLPRC": np.float32}) Csv.odf_csv = Csv.odf_csv.drop(columns=['DLRET']) Csv.pdf_csv.drop(columns=['DLRET'], inplace=True) @property def pdf_csv(self): return Csv.pdf_csv @property def odf_csv(self): return Csv.odf_csv @property def pdf(self): return pd.DataFrame({ 'a': [1, 2, 3, 4, 5, 6, 7, 8, 9], 'b': [4, 5, 6, 3, 2, 1, 0, 0, 0], }, index=[0, 1, 3, 5, 6, 8, 9, 9, 9]) @property def odf(self): return orca.DataFrame(self.pdf) def test_dataframe_reindexing_selection_label_mainpulation_between_time(self): idx = pd.date_range('2018-04-09', periods=4, freq='1D20min') pdf = pd.DataFrame({'A': [1, 2, 3, 4]}, index=idx) odf = orca.DataFrame(pdf) assert_frame_equal(odf.between_time('0:15', '0:45').to_pandas(), pdf.between_time('0:15', '0:45')) assert_frame_equal(odf.between_time('0:45', '0:15').to_pandas(), pdf.between_time('0:45', '0:15')) def test_dataframe_reindexing_selection_label_mainpulation_take(self): n = np.array([0, 1, 4]) assert_frame_equal(self.odf.take(n).to_pandas(), self.pdf.take(n)) assert_frame_equal(self.odf.take([]).to_pandas(), self.pdf.take([])) assert_frame_equal(self.odf.take([0, 1], axis=1).to_pandas(), self.pdf.take([0, 1], axis=1)) assert_frame_equal(self.odf.take([-1, -2], axis=0).to_pandas(), self.pdf.take([-1, -2], axis=0)) n = np.random.randint(0, 2999, 100) assert_frame_equal(self.odf_csv.take(n).to_pandas(), self.pdf_csv.take(n), check_dtype=False) assert_frame_equal(self.odf_csv.take([0, 1, 5, 7, 11, 15], axis=1).to_pandas(), self.pdf_csv.take([0, 1, 5, 7, 11, 15], axis=1), check_dtype=False) def test_dataframe_reindexing_selection_label_mainpulation_equals(self): pdf = pd.DataFrame({1: [10], 2: [20]}) p_exactly_equal = pd.DataFrame({1: [10], 2: [20]}) p_different_column_type = pd.DataFrame({1.0: [10], 2.0: [20]}) p_different_data_type = pd.DataFrame({1: [10.0], 2: [20.0]}) odf = orca.DataFrame(pdf) o_exactly_equal = orca.DataFrame(p_exactly_equal) o_different_column_type = orca.DataFrame(p_different_column_type) o_different_data_type = orca.DataFrame(p_different_data_type) self.assertEqual(odf.equals(o_exactly_equal), pdf.equals(p_exactly_equal)) self.assertEqual(odf.equals(o_different_column_type), pdf.equals(p_different_column_type)) self.assertEqual(odf.equals(o_different_data_type), pdf.equals(p_different_data_type)) if __name__ == '__main__': unittest.main()
0.609873
0.493958
import sys, os, pwd, string, re, selinux obj = "(\{[^\}]*\}|[^ \t:]*)" allow_regexp = "(allow|dontaudit)[ \t]+%s[ \t]*%s[ \t]*:[ \t]*%s[ \t]*%s" % (obj, obj, obj, obj) awk_script = '/^[[:blank:]]*interface[[:blank:]]*\(/ {\n\ IFACEFILE=FILENAME\n\ IFACENAME = gensub("^[[:blank:]]*interface[[:blank:]]*\\\\(\`?","","g",$0);\n\ IFACENAME = gensub("\'?,.*$","","g",IFACENAME);\n\ }\n\ \n\ /^[[:blank:]]*(allow|dontaudit)[[:blank:]]+.*;[[:blank:]]*$/ {\n\ \n\ if ((length(IFACENAME) > 0) && (IFACEFILE == FILENAME)){\n\ ALLOW = gensub("^[[:blank:]]*","","g",$0)\n\ ALLOW = gensub(";[[:blank:]]*$","","g",$0)\n\ print FILENAME "\\t" IFACENAME "\\t" ALLOW;\n\ }\n\ }\ ' class context: def __init__(self, scontext): self.scontext = scontext con=scontext.split(":") self.user = con[0] self.role = con[1] self.type = con[2] if len(con) > 3: self.mls = con[3] else: self.mls = "s0" def __str__(self): return self.scontext class accessTrans: def __init__(self): self.dict = {} try: fd = open("/usr/share/selinux/devel/include/support/obj_perm_sets.spt") except IOError, error: raise IOError("Reference policy generation requires the policy development package selinux-policy-devel.\n%s" % error) records = fd.read().split("\n") regexp = "^define *\(`([^']*)' *, *` *\{([^}]*)}'" for r in records: m = re.match(regexp,r) if m != None: self.dict[m.groups()[0]] = m.groups()[1].split() fd.close() def get(self, var): l = [] for v in var: if v in self.dict.keys(): l += self.dict[v] else: if v not in ("{", "}"): l.append(v) return l class interfaces: def __init__(self): self.dict = {} trans = accessTrans() (input, output) = os.popen2("awk -f - /usr/share/selinux/devel/include/*/*.if 2> /dev/null") input.write(awk_script) input.close() records = output.read().split("\n") input.close() if len(records) > 0: regexp = "([^ \t]*)[ \t]+([^ \t]*)[ \t]+%s" % allow_regexp for r in records: m = re.match(regexp,r) if m == None: continue val = m.groups() file = os.path.basename(val[0]).split(".")[0] iface = val[1] Scon = val[3].split() Tcon = val[4].split() Class = val[5].split() Access = trans.get(val[6].split()) for s in Scon: for t in Tcon: for c in Class: if (s, t, c) not in self.dict.keys(): self.dict[(s, t, c)] = [] self.dict[(s, t, c)].append((Access, file, iface)) def out(self): keys = self.dict.keys() keys.sort() for k in keys: print k for i in self.dict[k]: print "\t", i def match(self, Scon, Tcon, Class, Access): keys = self.dict.keys() ret = [] if (Scon, Tcon, Class) in keys: for i in self.dict[(Scon, Tcon, Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret if ("$1", Tcon, Class) in keys: for i in self.dict[("$1", Tcon, Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret if (Scon, "$1", Class) in keys: for i in self.dict[(Scon, "$1", Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret else: return ret import glob, imp pluginPath = "/usr/share/selinux/plugins" if not pluginPath in sys.path: sys.path.append(pluginPath) class Analyze: def __init__(self): self.plugins = [] for p in glob.glob("/usr/share/selinux/plugins/*.py"): plugin = os.path.basename(p)[:-3] self.plugins.append(imp.load_module(plugin, *imp.find_module(plugin))) def process(self, AVCS): ret = [] avcs = AVCS for p in self.plugins: if avcs == None: break; r = p.analyze(avcs) if len(r) == 0: continue avcs = r[1] if len(r[0]) > 0: ret.append(r[0]) return ret class serule: def __init__(self, key): self.type = key[0] self.source = key[1] self.target = key[2] self.seclass = key[3] self.access = [] self.avcinfo = {} self.iface = None def add(self, avc): for a in avc[0]: if a not in self.avcinfo.keys(): self.avcinfo[a] = [] self.access.append(a) self.avcinfo[a].append(avc[1:]) def getAccess(self): if len(self.access) == 1: return self.access[0] else: self.access.sort() return "{ " + string.join(self.access) +" }" def getName(self): print self.avcinfo def out(self, verbose = 0): ret = "" ret = ret+"%s %s %s:%s %s;" % (self.type, self.source, self.gettarget(), self.seclass, self.getAccess()) if verbose: keys = self.avcinfo.keys() keys.sort() for i in keys: for x in self.avcinfo[i]: ret = ret+"\n\t#TYPE=AVC MSG=%s " % x[0] if len(x[1]): ret=ret+"COMM=%s " % x[1] if len(x[2]): ret=ret+"NAME=%s " % x[2] ret = ret + " : " + i return ret def gen_reference_policy(self, iface): ret = "" Scon = self.source Tcon = self.gettarget() Class = self.seclass Access = self.getAccess() m = iface.match(Scon,Tcon,Class,Access) if len(m) == 0: return self.out() else: file = m[0][1] ret = "\n#%s\n"% self.out() ret += "optional_policy(`\n" first = True for i in m: if file != i[1]: ret += "')\ngen_require(`%s', `\n" % i[1] file = i[1] first = True if first: ret += "\t%s(%s)\n" % (i[2], Scon) first = False else: ret += "#\t%s(%s)\n" % (i[2], Scon) ret += "');" return ret def gettarget(self): if self.source == self.target: return "self" else: return self.target def warning(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error) sys.stderr.flush() class TERules: def __init__(self, serules): self.VALID_CMDS = ("allow", "dontaudit", "auditallow") self.serules = serules def load(self, input): line = input.readline() while line: rec = line.split() if len(rec) and rec[0] in self.VALID_CMDS: self.add_terule(line) line = input.readline() def add_terule(self, rule): rc = rule.split(":") rules = rc[0].split() type = rules[0] (sources, targets) = self.rules_split(rules[1:]) rules = rc[1].split() (classes, access) = self.rules_split(rules) for scon in sources: for tcon in targets: for seclass in classes: self.serules.add_rule(type, scon, tcon, seclass,access) def rules_split(self, rules): (idx, target ) = self.get_target(0, rules) (idx, subject) = self.get_target(idx, rules) return (target, subject) def get_target(self, i, rule): target = [] if rule[i][0] == "{": for t in rule[i].split("{"): if len(t): target.append(t) i = i+1 for s in rule[i:]: if s.find("}") >= 0: for s1 in s.split("}"): if len(s1): target.append(s1) i = i+1 return (i, target) target.append(s) i = i+1 else: if rule[i].find(";") >= 0: for s1 in rule[i].split(";"): if len(s1): target.append(s1) else: target.append(rule[i]) i = i+1 return (i, target) ALLOW = 0 STYPE = 1 TTYPE = 2 CLASS = 3 COMM = 1 NAME = 3 class SERules: def __init__(self, last_reload = 0, verbose = 0): self.last_reload = last_reload self.initialize() self.gen_ref_policy = False self.verbose = verbose self.AVCS = [] self.INVALID_SIDS = {} def initialize(self): self.seRules = {} self.classes = {} self.types = [] self.roles = [] def load(self, input): dict = [] found = 0 line = input.readline() while line: rec = line.split() for i in rec: if i == "avc:" or i == "message=avc:" or i == "msg='avc:": found = 1 else: if i == "security_compute_sid:": self.security_compute_sid(rec) found = 1 elif i == "type=MAC_POLICY_LOAD" and self.last_reload: self.initialize() break else: dict.append(i) if not found: regexp = "audit\(\d+\.\d+:\d+\): policy loaded" m = re.match(regexp, line) if m !=None: found =1 dict.append("load_policy") dict.append("granted") if found: self.translate(dict) found = 0 dict = [] line = input.readline() def translate(self,dict): AVC = {} AVC["access"] = [] if "load_policy" in dict and self.last_reload: self.initialize() if "granted" in dict: return try: for i in range (0, len(dict)): if dict[i] == "{": i = i+1 while i<len(dict) and dict[i] != "}": AVC["access"].append(dict[i]) i = i+1 continue t = dict[i].split('=') if len(t) < 2: continue AVC[t[0]] = t[1] for i in ("scontext", "tcontext", "tclass"): if i not in AVC.keys(): return if len(AVC["access"]) == 0: return except IndexError, e: warning("Bad AVC Line: %s" % avc) return self.add_allow(AVC) def security_compute_sid(self, rec): dict={} for i in rec: t = i.split('=') if len(t) < 2: continue dict[t[0]]=t[1] try: r = context(dict["scontext"]).role t = context(dict["tcontext"]).type self.add_type(t) self.add_role(r) self.INVALID_SIDS[(r,t)]=rec except: return def add_avc(self, AVC): for a in self.AVCS: if a["tclass"] == AVC["tclass"] and a["access"] == AVC["access"] and a["tcontext"] == AVC["tcontext"] and a["scontext"] == AVC["scontext"] and a["comm"] == AVC["comm"] and a["name"] == AVC["name"]: return self.AVCS.append(AVC) def add_rule(self, rule_type, scon, tcon, tclass, access, msg = "", comm = "", name = ""): AVC = {} AVC["tclass"] = tclass AVC["access"] = access AVC["tcon"] = tcon AVC["scon"] = scon AVC["comm"] = comm AVC["name"] = name self.add_avc(AVC) self.add_class(tclass, access) self.add_type(tcon) self.add_type(scon) key = (rule_type, scon, tcon, seclass) if key not in self.seRules.keys(): self.seRules[key] = serule(key) self.seRules[key].add((access, msg, comm, name )) def add_allow(self, AVC): self.add_class(AVC["tclass"], AVC["access"]) tcontext = context(AVC["tcontext"]) scontext = context(AVC["scontext"]) self.add_type(tcontext.type) self.add_type(scontext.type) self.add_role(scontext.role) key = ("allow", scontext.type, tcontext.type, AVC["tclass"]) if key not in self.seRules.keys(): self.seRules[key] = serule(key) avckeys = AVC.keys() for i in ( "name", "comm", "msg" ): if i not in avckeys: AVC[i] = "" self.add_avc(AVC) self.seRules[key].add((AVC["access"], AVC["msg"], AVC["comm"], AVC["name"])) def add_class(self,seclass, access): if seclass not in self.classes.keys(): self.classes[seclass] = [] for a in access: if a not in self.classes[seclass]: self.classes[seclass].append(a) def add_role(self,role): if role not in self.roles: self.roles.append(role) def add_type(self,type): if type not in self.types: self.types.append(type) def gen_reference_policy(self): self.gen_ref_policy = True self.iface = interfaces() def gen_module(self, module): if self.gen_ref_policy: return "policy_module(%s, 1.0);" % module else: return "module %s 1.0;" % module def gen_requires(self): self.roles.sort() self.types.sort() keys = self.classes.keys() keys.sort() rec = "\n\nrequire {\n" if not self.gen_ref_policy: for i in keys: access = self.classes[i] if len(access) > 1: access.sort() rec += "\tclass %s {" % i for a in access: rec += " %s" % a rec += " }; \n" else: rec += "\tclass %s %s;\n" % (i, access[0]) for i in self.types: rec += "\ttype %s; \n" % i if not self.gen_ref_policy: for i in self.roles: rec += "\trole %s; \n" % i rec += "};\n\n" return rec def analyze(self): a = Analyze() for i in a.process(self.AVCS): print i[0][0] print "" def out(self, require = 0, module = ""): rec = "" if len(self.seRules.keys()) == 0 and len(self.INVALID_SIDS) == 0: raise(ValueError("No AVC messages found.")) if module != "": rec += self.gen_module(module) rec += self.gen_requires() else: if require: rec+=self.gen_requires() for i in self.INVALID_SIDS.keys(): rec += "role %s types %s;\n" % i keys = self.seRules.keys() keys.sort() for i in keys: if self.gen_ref_policy: rec += self.seRules[i].gen_reference_policy(self.iface)+"\n" else: rec += self.seRules[i].out(self.verbose)+"\n" return rec
contrib/sebsd/policycoreutils/audit2allow/avc.py
import sys, os, pwd, string, re, selinux obj = "(\{[^\}]*\}|[^ \t:]*)" allow_regexp = "(allow|dontaudit)[ \t]+%s[ \t]*%s[ \t]*:[ \t]*%s[ \t]*%s" % (obj, obj, obj, obj) awk_script = '/^[[:blank:]]*interface[[:blank:]]*\(/ {\n\ IFACEFILE=FILENAME\n\ IFACENAME = gensub("^[[:blank:]]*interface[[:blank:]]*\\\\(\`?","","g",$0);\n\ IFACENAME = gensub("\'?,.*$","","g",IFACENAME);\n\ }\n\ \n\ /^[[:blank:]]*(allow|dontaudit)[[:blank:]]+.*;[[:blank:]]*$/ {\n\ \n\ if ((length(IFACENAME) > 0) && (IFACEFILE == FILENAME)){\n\ ALLOW = gensub("^[[:blank:]]*","","g",$0)\n\ ALLOW = gensub(";[[:blank:]]*$","","g",$0)\n\ print FILENAME "\\t" IFACENAME "\\t" ALLOW;\n\ }\n\ }\ ' class context: def __init__(self, scontext): self.scontext = scontext con=scontext.split(":") self.user = con[0] self.role = con[1] self.type = con[2] if len(con) > 3: self.mls = con[3] else: self.mls = "s0" def __str__(self): return self.scontext class accessTrans: def __init__(self): self.dict = {} try: fd = open("/usr/share/selinux/devel/include/support/obj_perm_sets.spt") except IOError, error: raise IOError("Reference policy generation requires the policy development package selinux-policy-devel.\n%s" % error) records = fd.read().split("\n") regexp = "^define *\(`([^']*)' *, *` *\{([^}]*)}'" for r in records: m = re.match(regexp,r) if m != None: self.dict[m.groups()[0]] = m.groups()[1].split() fd.close() def get(self, var): l = [] for v in var: if v in self.dict.keys(): l += self.dict[v] else: if v not in ("{", "}"): l.append(v) return l class interfaces: def __init__(self): self.dict = {} trans = accessTrans() (input, output) = os.popen2("awk -f - /usr/share/selinux/devel/include/*/*.if 2> /dev/null") input.write(awk_script) input.close() records = output.read().split("\n") input.close() if len(records) > 0: regexp = "([^ \t]*)[ \t]+([^ \t]*)[ \t]+%s" % allow_regexp for r in records: m = re.match(regexp,r) if m == None: continue val = m.groups() file = os.path.basename(val[0]).split(".")[0] iface = val[1] Scon = val[3].split() Tcon = val[4].split() Class = val[5].split() Access = trans.get(val[6].split()) for s in Scon: for t in Tcon: for c in Class: if (s, t, c) not in self.dict.keys(): self.dict[(s, t, c)] = [] self.dict[(s, t, c)].append((Access, file, iface)) def out(self): keys = self.dict.keys() keys.sort() for k in keys: print k for i in self.dict[k]: print "\t", i def match(self, Scon, Tcon, Class, Access): keys = self.dict.keys() ret = [] if (Scon, Tcon, Class) in keys: for i in self.dict[(Scon, Tcon, Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret if ("$1", Tcon, Class) in keys: for i in self.dict[("$1", Tcon, Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret if (Scon, "$1", Class) in keys: for i in self.dict[(Scon, "$1", Class)]: if Access in i[0]: if i[2].find(Access) >= 0: ret.insert(0, i) else: ret.append(i) return ret else: return ret import glob, imp pluginPath = "/usr/share/selinux/plugins" if not pluginPath in sys.path: sys.path.append(pluginPath) class Analyze: def __init__(self): self.plugins = [] for p in glob.glob("/usr/share/selinux/plugins/*.py"): plugin = os.path.basename(p)[:-3] self.plugins.append(imp.load_module(plugin, *imp.find_module(plugin))) def process(self, AVCS): ret = [] avcs = AVCS for p in self.plugins: if avcs == None: break; r = p.analyze(avcs) if len(r) == 0: continue avcs = r[1] if len(r[0]) > 0: ret.append(r[0]) return ret class serule: def __init__(self, key): self.type = key[0] self.source = key[1] self.target = key[2] self.seclass = key[3] self.access = [] self.avcinfo = {} self.iface = None def add(self, avc): for a in avc[0]: if a not in self.avcinfo.keys(): self.avcinfo[a] = [] self.access.append(a) self.avcinfo[a].append(avc[1:]) def getAccess(self): if len(self.access) == 1: return self.access[0] else: self.access.sort() return "{ " + string.join(self.access) +" }" def getName(self): print self.avcinfo def out(self, verbose = 0): ret = "" ret = ret+"%s %s %s:%s %s;" % (self.type, self.source, self.gettarget(), self.seclass, self.getAccess()) if verbose: keys = self.avcinfo.keys() keys.sort() for i in keys: for x in self.avcinfo[i]: ret = ret+"\n\t#TYPE=AVC MSG=%s " % x[0] if len(x[1]): ret=ret+"COMM=%s " % x[1] if len(x[2]): ret=ret+"NAME=%s " % x[2] ret = ret + " : " + i return ret def gen_reference_policy(self, iface): ret = "" Scon = self.source Tcon = self.gettarget() Class = self.seclass Access = self.getAccess() m = iface.match(Scon,Tcon,Class,Access) if len(m) == 0: return self.out() else: file = m[0][1] ret = "\n#%s\n"% self.out() ret += "optional_policy(`\n" first = True for i in m: if file != i[1]: ret += "')\ngen_require(`%s', `\n" % i[1] file = i[1] first = True if first: ret += "\t%s(%s)\n" % (i[2], Scon) first = False else: ret += "#\t%s(%s)\n" % (i[2], Scon) ret += "');" return ret def gettarget(self): if self.source == self.target: return "self" else: return self.target def warning(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error) sys.stderr.flush() class TERules: def __init__(self, serules): self.VALID_CMDS = ("allow", "dontaudit", "auditallow") self.serules = serules def load(self, input): line = input.readline() while line: rec = line.split() if len(rec) and rec[0] in self.VALID_CMDS: self.add_terule(line) line = input.readline() def add_terule(self, rule): rc = rule.split(":") rules = rc[0].split() type = rules[0] (sources, targets) = self.rules_split(rules[1:]) rules = rc[1].split() (classes, access) = self.rules_split(rules) for scon in sources: for tcon in targets: for seclass in classes: self.serules.add_rule(type, scon, tcon, seclass,access) def rules_split(self, rules): (idx, target ) = self.get_target(0, rules) (idx, subject) = self.get_target(idx, rules) return (target, subject) def get_target(self, i, rule): target = [] if rule[i][0] == "{": for t in rule[i].split("{"): if len(t): target.append(t) i = i+1 for s in rule[i:]: if s.find("}") >= 0: for s1 in s.split("}"): if len(s1): target.append(s1) i = i+1 return (i, target) target.append(s) i = i+1 else: if rule[i].find(";") >= 0: for s1 in rule[i].split(";"): if len(s1): target.append(s1) else: target.append(rule[i]) i = i+1 return (i, target) ALLOW = 0 STYPE = 1 TTYPE = 2 CLASS = 3 COMM = 1 NAME = 3 class SERules: def __init__(self, last_reload = 0, verbose = 0): self.last_reload = last_reload self.initialize() self.gen_ref_policy = False self.verbose = verbose self.AVCS = [] self.INVALID_SIDS = {} def initialize(self): self.seRules = {} self.classes = {} self.types = [] self.roles = [] def load(self, input): dict = [] found = 0 line = input.readline() while line: rec = line.split() for i in rec: if i == "avc:" or i == "message=avc:" or i == "msg='avc:": found = 1 else: if i == "security_compute_sid:": self.security_compute_sid(rec) found = 1 elif i == "type=MAC_POLICY_LOAD" and self.last_reload: self.initialize() break else: dict.append(i) if not found: regexp = "audit\(\d+\.\d+:\d+\): policy loaded" m = re.match(regexp, line) if m !=None: found =1 dict.append("load_policy") dict.append("granted") if found: self.translate(dict) found = 0 dict = [] line = input.readline() def translate(self,dict): AVC = {} AVC["access"] = [] if "load_policy" in dict and self.last_reload: self.initialize() if "granted" in dict: return try: for i in range (0, len(dict)): if dict[i] == "{": i = i+1 while i<len(dict) and dict[i] != "}": AVC["access"].append(dict[i]) i = i+1 continue t = dict[i].split('=') if len(t) < 2: continue AVC[t[0]] = t[1] for i in ("scontext", "tcontext", "tclass"): if i not in AVC.keys(): return if len(AVC["access"]) == 0: return except IndexError, e: warning("Bad AVC Line: %s" % avc) return self.add_allow(AVC) def security_compute_sid(self, rec): dict={} for i in rec: t = i.split('=') if len(t) < 2: continue dict[t[0]]=t[1] try: r = context(dict["scontext"]).role t = context(dict["tcontext"]).type self.add_type(t) self.add_role(r) self.INVALID_SIDS[(r,t)]=rec except: return def add_avc(self, AVC): for a in self.AVCS: if a["tclass"] == AVC["tclass"] and a["access"] == AVC["access"] and a["tcontext"] == AVC["tcontext"] and a["scontext"] == AVC["scontext"] and a["comm"] == AVC["comm"] and a["name"] == AVC["name"]: return self.AVCS.append(AVC) def add_rule(self, rule_type, scon, tcon, tclass, access, msg = "", comm = "", name = ""): AVC = {} AVC["tclass"] = tclass AVC["access"] = access AVC["tcon"] = tcon AVC["scon"] = scon AVC["comm"] = comm AVC["name"] = name self.add_avc(AVC) self.add_class(tclass, access) self.add_type(tcon) self.add_type(scon) key = (rule_type, scon, tcon, seclass) if key not in self.seRules.keys(): self.seRules[key] = serule(key) self.seRules[key].add((access, msg, comm, name )) def add_allow(self, AVC): self.add_class(AVC["tclass"], AVC["access"]) tcontext = context(AVC["tcontext"]) scontext = context(AVC["scontext"]) self.add_type(tcontext.type) self.add_type(scontext.type) self.add_role(scontext.role) key = ("allow", scontext.type, tcontext.type, AVC["tclass"]) if key not in self.seRules.keys(): self.seRules[key] = serule(key) avckeys = AVC.keys() for i in ( "name", "comm", "msg" ): if i not in avckeys: AVC[i] = "" self.add_avc(AVC) self.seRules[key].add((AVC["access"], AVC["msg"], AVC["comm"], AVC["name"])) def add_class(self,seclass, access): if seclass not in self.classes.keys(): self.classes[seclass] = [] for a in access: if a not in self.classes[seclass]: self.classes[seclass].append(a) def add_role(self,role): if role not in self.roles: self.roles.append(role) def add_type(self,type): if type not in self.types: self.types.append(type) def gen_reference_policy(self): self.gen_ref_policy = True self.iface = interfaces() def gen_module(self, module): if self.gen_ref_policy: return "policy_module(%s, 1.0);" % module else: return "module %s 1.0;" % module def gen_requires(self): self.roles.sort() self.types.sort() keys = self.classes.keys() keys.sort() rec = "\n\nrequire {\n" if not self.gen_ref_policy: for i in keys: access = self.classes[i] if len(access) > 1: access.sort() rec += "\tclass %s {" % i for a in access: rec += " %s" % a rec += " }; \n" else: rec += "\tclass %s %s;\n" % (i, access[0]) for i in self.types: rec += "\ttype %s; \n" % i if not self.gen_ref_policy: for i in self.roles: rec += "\trole %s; \n" % i rec += "};\n\n" return rec def analyze(self): a = Analyze() for i in a.process(self.AVCS): print i[0][0] print "" def out(self, require = 0, module = ""): rec = "" if len(self.seRules.keys()) == 0 and len(self.INVALID_SIDS) == 0: raise(ValueError("No AVC messages found.")) if module != "": rec += self.gen_module(module) rec += self.gen_requires() else: if require: rec+=self.gen_requires() for i in self.INVALID_SIDS.keys(): rec += "role %s types %s;\n" % i keys = self.seRules.keys() keys.sort() for i in keys: if self.gen_ref_policy: rec += self.seRules[i].gen_reference_policy(self.iface)+"\n" else: rec += self.seRules[i].out(self.verbose)+"\n" return rec
0.064337
0.147218
from datetime import datetime from enum import IntEnum from typing import Any, Optional, Union from pydisco.http import Http from pydisco.utils import convert_snowflake_to_datetime class UserFlags(IntEnum): """ This enum represents flags that can be added to a user's account. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user#user-object-user-flags """ NONE = 0 """None""" DISCORD_EMPLOYEE = 1 << 0 """Discord Employee.""" PARTNERED_SERVER_OWNER = 1 << 1 """Owner of a partnered Discord server.""" HYPESQUAD_EVENTS = 1 << 2 """HypeSquad Events.""" BUG_HUNTER_LEVEL_1 = 1 << 3 """Bug Hunter Level 1.""" HYPESQUAD_BRAVERY = 1 << 6 """HypeSquad House of Bravery.""" HYPESQUAD_BRILLIANCE = 1 << 7 """HypeSquad House of Brilliance.""" HYPESQUAD_BALANCE = 1 << 8 """HypeSquad House of Balance.""" EARLY_SUPPORTER = 1 << 9 """Early Supporter.""" TEAM_USER = 1 << 10 """Team user.""" BUG_HUNTER_LEVEL_2 = 1 << 14 """Bug Hunter Level 2.""" VERIFIED_BOT = 1 << 16 """Verified Bot.""" EARLY_VERIFIED_DEVELOPER = 1 << 17 """Early verified Bot Developer.""" DISCORD_CERTIFIED_MODERATOR = 1 << 18 """Discord Certified Moderator.""" class PremiumType(IntEnum): """ This enum represents the types of paid user subscriptions. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user#user-object-premium-types """ NONE = 0 """No premium for this user.""" NITRO_CLASSIC = 1 """This user have Nitro Classic subscription.""" FULL_NITRO = 2 """This user have default Nitro subscription.""" class User: """ This class represents users in Discord. Attributes ---------- id : int Unique Snowflake ID for this user. username : str Displayed user's name. discriminator : str Not a unique set of 4 numbers that are required to find the user's account. avatar : str, any The hash string of the user's avatar. bot : bool, optional Is the user a bot? system : bool, optional Is the user a system? mfa_enabled : bool, optional Whether two-factor authentication is enabled? banner : str, any, optional This user's banner hash. accent_color : int, any, optional Hexadecimal value for color of this user. locale : str, optional Localization of the user's client. verified : bool, optional Is the user verified? email : str, any, optional E-mail address for this user. flags : UserFlags, optional Flags this user. premium_type : PremiumType, optional Type of premium user subscription. public_flags : UserFlags, optional Public flags of the user. Methods ------- human : bool Is the user a human? mention : str Mention for this user. created_at : datetime When this user was created. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user """ def __init__(self, data, _http: Http) -> None: self.id: int = int(data.get("id", 0)) self.username: str = data.get("username", None) self.discriminator: str = data.get("discriminator", None) self.avatar: Union[str, Any] = data.get("avatar", None) self.bot: Optional[bool] = data.get("bot", False) self.system: Optional[bool] = data.get("system", False) self.mfa_enabled: Optional[bool] = data.get("mfa_enabled", False) self.banner: Optional[Union[str, Any]] = data.get("banner", None) self.accent_color: Optional[Union[int, Any]] = data.get("accent_color", 0) self.locale: Optional[str] = data.get("locale", None) self.verified: Optional[bool] = data.get("verified", False) self.email: Optional[Union[str, Any]] = data.get("email", None) self.flags: Optional[UserFlags] = UserFlags(data.get("flags", 0)) self.premium_type: Optional[PremiumType] = PremiumType(data.get("premium_type", 0)) self.public_flags: Optional[UserFlags] = UserFlags(data.get("public_flags", 0)) def __str__(self) -> str: return f"{self.username}#{self.discriminator}" @property def created_at(self) -> datetime: """:datetime: When this user was created.""" return convert_snowflake_to_datetime(self.id) @property def mention(self) -> str: """:str: Mention for this user.""" return f"<@{self.id}>" @property def human(self) -> bool: """:bool: Is the user a real person?""" return not (self.bot and self.system)
pydisco/user.py
from datetime import datetime from enum import IntEnum from typing import Any, Optional, Union from pydisco.http import Http from pydisco.utils import convert_snowflake_to_datetime class UserFlags(IntEnum): """ This enum represents flags that can be added to a user's account. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user#user-object-user-flags """ NONE = 0 """None""" DISCORD_EMPLOYEE = 1 << 0 """Discord Employee.""" PARTNERED_SERVER_OWNER = 1 << 1 """Owner of a partnered Discord server.""" HYPESQUAD_EVENTS = 1 << 2 """HypeSquad Events.""" BUG_HUNTER_LEVEL_1 = 1 << 3 """Bug Hunter Level 1.""" HYPESQUAD_BRAVERY = 1 << 6 """HypeSquad House of Bravery.""" HYPESQUAD_BRILLIANCE = 1 << 7 """HypeSquad House of Brilliance.""" HYPESQUAD_BALANCE = 1 << 8 """HypeSquad House of Balance.""" EARLY_SUPPORTER = 1 << 9 """Early Supporter.""" TEAM_USER = 1 << 10 """Team user.""" BUG_HUNTER_LEVEL_2 = 1 << 14 """Bug Hunter Level 2.""" VERIFIED_BOT = 1 << 16 """Verified Bot.""" EARLY_VERIFIED_DEVELOPER = 1 << 17 """Early verified Bot Developer.""" DISCORD_CERTIFIED_MODERATOR = 1 << 18 """Discord Certified Moderator.""" class PremiumType(IntEnum): """ This enum represents the types of paid user subscriptions. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user#user-object-premium-types """ NONE = 0 """No premium for this user.""" NITRO_CLASSIC = 1 """This user have Nitro Classic subscription.""" FULL_NITRO = 2 """This user have default Nitro subscription.""" class User: """ This class represents users in Discord. Attributes ---------- id : int Unique Snowflake ID for this user. username : str Displayed user's name. discriminator : str Not a unique set of 4 numbers that are required to find the user's account. avatar : str, any The hash string of the user's avatar. bot : bool, optional Is the user a bot? system : bool, optional Is the user a system? mfa_enabled : bool, optional Whether two-factor authentication is enabled? banner : str, any, optional This user's banner hash. accent_color : int, any, optional Hexadecimal value for color of this user. locale : str, optional Localization of the user's client. verified : bool, optional Is the user verified? email : str, any, optional E-mail address for this user. flags : UserFlags, optional Flags this user. premium_type : PremiumType, optional Type of premium user subscription. public_flags : UserFlags, optional Public flags of the user. Methods ------- human : bool Is the user a human? mention : str Mention for this user. created_at : datetime When this user was created. See Also -------- Official Discord documentation: https://discord.com/developers/docs/resources/user """ def __init__(self, data, _http: Http) -> None: self.id: int = int(data.get("id", 0)) self.username: str = data.get("username", None) self.discriminator: str = data.get("discriminator", None) self.avatar: Union[str, Any] = data.get("avatar", None) self.bot: Optional[bool] = data.get("bot", False) self.system: Optional[bool] = data.get("system", False) self.mfa_enabled: Optional[bool] = data.get("mfa_enabled", False) self.banner: Optional[Union[str, Any]] = data.get("banner", None) self.accent_color: Optional[Union[int, Any]] = data.get("accent_color", 0) self.locale: Optional[str] = data.get("locale", None) self.verified: Optional[bool] = data.get("verified", False) self.email: Optional[Union[str, Any]] = data.get("email", None) self.flags: Optional[UserFlags] = UserFlags(data.get("flags", 0)) self.premium_type: Optional[PremiumType] = PremiumType(data.get("premium_type", 0)) self.public_flags: Optional[UserFlags] = UserFlags(data.get("public_flags", 0)) def __str__(self) -> str: return f"{self.username}#{self.discriminator}" @property def created_at(self) -> datetime: """:datetime: When this user was created.""" return convert_snowflake_to_datetime(self.id) @property def mention(self) -> str: """:str: Mention for this user.""" return f"<@{self.id}>" @property def human(self) -> bool: """:bool: Is the user a real person?""" return not (self.bot and self.system)
0.919077
0.356783
import torch import torchaudio from torch.utils.data import DataLoader from torch import nn from USDataset import US8KDataset BATCH_SIZE = 64 EPOCHS = 20 LEARNING_RATE = 0.001 ANNOTATIONS_FILE = "UrbanSound8K/metadata/UrbanSound8K.csv" AUDIO_DIR = "UrbanSound8K/audio" SAMPLE_RATE = 44100 NUM_SAMPLES = 44100 device = "cpu" class CNN(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Sequential( nn.Conv2d( in_channels=1, out_channels=8, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(8), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv2 = nn.Sequential( nn.Conv2d( in_channels=8, out_channels=16, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(16), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv3 = nn.Sequential( nn.Conv2d( in_channels=16, out_channels=32, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(32), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv4 = nn.Sequential( nn.Conv2d( in_channels=32, out_channels=64, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(64), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.flatten = nn.Flatten() self.linear = nn.Linear(64, 10) self.softmax = nn.Softmax(dim=1) def forward(self, input_data): x = self.conv1(input_data) x = self.conv2(x) x = self.conv3(x) x = self.conv4(x) x = self.flatten(x) x = self.linear(x) x = self.softmax(x) return x def train(model, train_loader, optimiser, device, epochs): correctly_classified = 0 total = 0 for epochX in range(epochs): print(f"Epoch {epochX + 1}") for input, target in train_loader: input, target = input.to(device), target.to(device) optimiser.zero_grad() output = model(input) _, predicted = torch.max(output, 1) total += target.size(0) correctly_classified += (predicted == target).sum().item() loss = nn.CrossEntropyLoss()(output, target) loss.backward() optimiser.step() accuracy = 100.0 * correctly_classified / total print(' Accuracy in Epoch {}: {:.0f}% \n'.format(epochX, accuracy)) print(f"loss: {loss.item()}") print("---------------------------") print("Finished training") if __name__ == "__main__": # instantiating our dataset object and create data loader mel_spectrogram = torchaudio.transforms.MelSpectrogram( sample_rate=SAMPLE_RATE, n_fft=1024, hop_length=512, n_mels=64 ) usd = US8KDataset(ANNOTATIONS_FILE, AUDIO_DIR, mel_spectrogram, SAMPLE_RATE, NUM_SAMPLES, device) train_dataloader = DataLoader(usd, batch_size=BATCH_SIZE) # construct model and assign it to device cnn = CNN().to(device) print(cnn) optimiser = torch.optim.AdamW(cnn.parameters(), lr=LEARNING_RATE) # train model train(cnn, train_dataloader, optimiser, device, EPOCHS) # save model torch.save(cnn.state_dict(), "trainedCNN.pth") print("Trained feed forward net saved at trainedCNN.pth")
model.py
import torch import torchaudio from torch.utils.data import DataLoader from torch import nn from USDataset import US8KDataset BATCH_SIZE = 64 EPOCHS = 20 LEARNING_RATE = 0.001 ANNOTATIONS_FILE = "UrbanSound8K/metadata/UrbanSound8K.csv" AUDIO_DIR = "UrbanSound8K/audio" SAMPLE_RATE = 44100 NUM_SAMPLES = 44100 device = "cpu" class CNN(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Sequential( nn.Conv2d( in_channels=1, out_channels=8, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(8), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv2 = nn.Sequential( nn.Conv2d( in_channels=8, out_channels=16, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(16), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv3 = nn.Sequential( nn.Conv2d( in_channels=16, out_channels=32, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(32), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.conv4 = nn.Sequential( nn.Conv2d( in_channels=32, out_channels=64, kernel_size=3, stride=2, padding=2, bias=False ), nn.BatchNorm2d(64), nn.ReLU(), nn.MaxPool2d(kernel_size=2) ) self.flatten = nn.Flatten() self.linear = nn.Linear(64, 10) self.softmax = nn.Softmax(dim=1) def forward(self, input_data): x = self.conv1(input_data) x = self.conv2(x) x = self.conv3(x) x = self.conv4(x) x = self.flatten(x) x = self.linear(x) x = self.softmax(x) return x def train(model, train_loader, optimiser, device, epochs): correctly_classified = 0 total = 0 for epochX in range(epochs): print(f"Epoch {epochX + 1}") for input, target in train_loader: input, target = input.to(device), target.to(device) optimiser.zero_grad() output = model(input) _, predicted = torch.max(output, 1) total += target.size(0) correctly_classified += (predicted == target).sum().item() loss = nn.CrossEntropyLoss()(output, target) loss.backward() optimiser.step() accuracy = 100.0 * correctly_classified / total print(' Accuracy in Epoch {}: {:.0f}% \n'.format(epochX, accuracy)) print(f"loss: {loss.item()}") print("---------------------------") print("Finished training") if __name__ == "__main__": # instantiating our dataset object and create data loader mel_spectrogram = torchaudio.transforms.MelSpectrogram( sample_rate=SAMPLE_RATE, n_fft=1024, hop_length=512, n_mels=64 ) usd = US8KDataset(ANNOTATIONS_FILE, AUDIO_DIR, mel_spectrogram, SAMPLE_RATE, NUM_SAMPLES, device) train_dataloader = DataLoader(usd, batch_size=BATCH_SIZE) # construct model and assign it to device cnn = CNN().to(device) print(cnn) optimiser = torch.optim.AdamW(cnn.parameters(), lr=LEARNING_RATE) # train model train(cnn, train_dataloader, optimiser, device, EPOCHS) # save model torch.save(cnn.state_dict(), "trainedCNN.pth") print("Trained feed forward net saved at trainedCNN.pth")
0.931579
0.339007
import argparse import pandas as pd import numpy as np def net_stats(net_df, n_edges, pos_df, neg_df, wt_attr): top_df = net_df.head(n_edges) tp_shape = top_df[ top_df.edge.isin(pos_df.edge) ].shape fp_shape = top_df[ top_df.edge.isin(neg_df.edge) ].shape max_wt = np.max(top_df[wt_attr]) min_wt = np.min(top_df[wt_attr]) ntp = float(tp_shape[0]) nfp = float(fp_shape[0]) nfn = float(pos_df.shape[0]) - ntp ntn = float(neg_df.shape[0]) - nfp stats_dct = { 'Edges': n_edges, 'MaxWt': max_wt, 'MinWt': min_wt, 'TP': ntp, 'FP': nfp, 'TN': ntn, 'FN': nfn, 'Sensitivity/Recall': ntp/(ntp+nfn), 'Specificity': ntn/(ntn+nfp) if (ntn+nfp) > 0 else 1.0, 'Precision': ntp/(ntp+nfp) if (ntp+nfp) > 0 else 1.0, 'Accuracy': (ntp+ntn)/(ntp+ntn+nfp+nfn), 'F1' : (2.0*ntp)/((2*ntp) + nfp + nfn) } return stats_dct def network_stats_df(net_df, pos_df, neg_df, wt_attr): stats_lst = [net_stats(net_df, nx, pos_df, neg_df, wt_attr) for nx in range(100_000, 10_000_000, 100_000)] return pd.DataFrame(data=stats_lst) def network_stats(network_file, pos_file, neg_file, wt_attr): net_df = pd.read_csv(network_file, sep="\t") net_df.sort_values(by=wt_attr, inplace=True, ascending=False) pos_df = pd.read_csv(pos_file) neg_df = pd.read_csv(neg_file) return network_stats_df(net_df, pos_df, neg_df, wt_attr) if __name__ == "__main__": PROG_DESC = """Find Sensitivity Statistics""" ARGPARSER = argparse.ArgumentParser(description=PROG_DESC) ARGPARSER.add_argument("network_file") ARGPARSER.add_argument("pos_file") ARGPARSER.add_argument("neg_file") ARGPARSER.add_argument("output_file") ARGPARSER.add_argument("-t", "--wt_attr", type=str, default='wt', help="name of weight attribute") CMDARGS = ARGPARSER.parse_args() print(CMDARGS.network_file, CMDARGS.pos_file, CMDARGS.neg_file, CMDARGS.output_file, CMDARGS.wt_attr) odf = network_stats(CMDARGS.network_file, CMDARGS.pos_file, CMDARGS.neg_file, CMDARGS.wt_attr) odf.to_csv(CMDARGS.output_file, sep="\t", index=False)
utils/analyse_network.py
import argparse import pandas as pd import numpy as np def net_stats(net_df, n_edges, pos_df, neg_df, wt_attr): top_df = net_df.head(n_edges) tp_shape = top_df[ top_df.edge.isin(pos_df.edge) ].shape fp_shape = top_df[ top_df.edge.isin(neg_df.edge) ].shape max_wt = np.max(top_df[wt_attr]) min_wt = np.min(top_df[wt_attr]) ntp = float(tp_shape[0]) nfp = float(fp_shape[0]) nfn = float(pos_df.shape[0]) - ntp ntn = float(neg_df.shape[0]) - nfp stats_dct = { 'Edges': n_edges, 'MaxWt': max_wt, 'MinWt': min_wt, 'TP': ntp, 'FP': nfp, 'TN': ntn, 'FN': nfn, 'Sensitivity/Recall': ntp/(ntp+nfn), 'Specificity': ntn/(ntn+nfp) if (ntn+nfp) > 0 else 1.0, 'Precision': ntp/(ntp+nfp) if (ntp+nfp) > 0 else 1.0, 'Accuracy': (ntp+ntn)/(ntp+ntn+nfp+nfn), 'F1' : (2.0*ntp)/((2*ntp) + nfp + nfn) } return stats_dct def network_stats_df(net_df, pos_df, neg_df, wt_attr): stats_lst = [net_stats(net_df, nx, pos_df, neg_df, wt_attr) for nx in range(100_000, 10_000_000, 100_000)] return pd.DataFrame(data=stats_lst) def network_stats(network_file, pos_file, neg_file, wt_attr): net_df = pd.read_csv(network_file, sep="\t") net_df.sort_values(by=wt_attr, inplace=True, ascending=False) pos_df = pd.read_csv(pos_file) neg_df = pd.read_csv(neg_file) return network_stats_df(net_df, pos_df, neg_df, wt_attr) if __name__ == "__main__": PROG_DESC = """Find Sensitivity Statistics""" ARGPARSER = argparse.ArgumentParser(description=PROG_DESC) ARGPARSER.add_argument("network_file") ARGPARSER.add_argument("pos_file") ARGPARSER.add_argument("neg_file") ARGPARSER.add_argument("output_file") ARGPARSER.add_argument("-t", "--wt_attr", type=str, default='wt', help="name of weight attribute") CMDARGS = ARGPARSER.parse_args() print(CMDARGS.network_file, CMDARGS.pos_file, CMDARGS.neg_file, CMDARGS.output_file, CMDARGS.wt_attr) odf = network_stats(CMDARGS.network_file, CMDARGS.pos_file, CMDARGS.neg_file, CMDARGS.wt_attr) odf.to_csv(CMDARGS.output_file, sep="\t", index=False)
0.418935
0.205197
import os import re from git import Repo import syncmanagerclient.util.globalproperties as globalproperties class DeletionRegistration: def __init__(self, **kwargs): self.branch_path = kwargs.get('branch_path', None) self.registry_dir = globalproperties.var_dir # first check if directory is a git working tree self.dir = kwargs.get('git_repo_path') self.configs = [] self.mode = kwargs.get('mode', None) self.local_branch_exists = False def get_mode(self): if os.path.isdir(self.dir + '/.git'): # first check if this branch exists self.gitrepo = Repo(self.dir) if not hasattr(self.gitrepo.heads, self.branch_path): print('There is no local branch ' + self.branch_path) self.mode = 'git' return self.mode = 'git' self.local_branch_exists = True return # to be implemented: Unison check def get_config(self): self.get_mode() if not self.mode: return None configs = [] # get remote repo if self.mode == 'git': # fetch url of origin if self.gitrepo.remotes: for remote in self.gitrepo.remotes: remote_urls = [] for remote_url in remote.urls: remote_urls.append(remote_url) if len(remote_urls) > 1: print(f"Multiple urls defined for this remote: {str(remote_urls)}. Skip") continue if len(remote_urls) == 0: print(f"No remote url defined. Skip") continue remote_url = remote_urls[0] config = dict() config['source'] = self.dir config['url'] = remote_url config['remote_repo'] = remote.name self.configs.append(config) elif self.mode == 'unison': # to be implemented pass def register_path(self): self.get_config() if self.mode == 'git': for config in self.configs: remote_repo_name = config.get('remote_repo', None) if not remote_repo_name: continue registry_file = self.get_registry_file_path(remote_repo_name) f = open(registry_file, 'a+') entry = self.dir + '\t' + self.branch_path + '\n' f.write(entry) f.close() def get_registry_file_path(self, repo_name): return self.registry_dir + '/' + self.mode + '.' + repo_name + '.txt' def read_and_flush_registry(self, repo_name): registry_file = self.get_registry_file_path(repo_name) if not os.path.isfile(registry_file): return [] f = open(registry_file, 'r+') entries = [] lines = f.readlines() for line in lines: # replace spaces with tab, in case tab has been replaced by space in the meantime line = re.sub(' +', '\t', line) line = line.strip() if not line: continue entry = line.split('\t') entry[0] = entry[0].strip() entry[1] = entry[1].strip() entries.append(entry) f.seek(0) f.close() os.remove(registry_file) return entries def write_registry(self, repo_name, entries): registry_file = self.get_registry_file_path(repo_name) if len(entries) == 0: return f = open(registry_file, 'w+') for entry in entries: line = '\t'.join(entry) + '\n' f.write(line) f.close()
syncmanagerclient/syncmanagerclient/clients/deletion_registration.py
import os import re from git import Repo import syncmanagerclient.util.globalproperties as globalproperties class DeletionRegistration: def __init__(self, **kwargs): self.branch_path = kwargs.get('branch_path', None) self.registry_dir = globalproperties.var_dir # first check if directory is a git working tree self.dir = kwargs.get('git_repo_path') self.configs = [] self.mode = kwargs.get('mode', None) self.local_branch_exists = False def get_mode(self): if os.path.isdir(self.dir + '/.git'): # first check if this branch exists self.gitrepo = Repo(self.dir) if not hasattr(self.gitrepo.heads, self.branch_path): print('There is no local branch ' + self.branch_path) self.mode = 'git' return self.mode = 'git' self.local_branch_exists = True return # to be implemented: Unison check def get_config(self): self.get_mode() if not self.mode: return None configs = [] # get remote repo if self.mode == 'git': # fetch url of origin if self.gitrepo.remotes: for remote in self.gitrepo.remotes: remote_urls = [] for remote_url in remote.urls: remote_urls.append(remote_url) if len(remote_urls) > 1: print(f"Multiple urls defined for this remote: {str(remote_urls)}. Skip") continue if len(remote_urls) == 0: print(f"No remote url defined. Skip") continue remote_url = remote_urls[0] config = dict() config['source'] = self.dir config['url'] = remote_url config['remote_repo'] = remote.name self.configs.append(config) elif self.mode == 'unison': # to be implemented pass def register_path(self): self.get_config() if self.mode == 'git': for config in self.configs: remote_repo_name = config.get('remote_repo', None) if not remote_repo_name: continue registry_file = self.get_registry_file_path(remote_repo_name) f = open(registry_file, 'a+') entry = self.dir + '\t' + self.branch_path + '\n' f.write(entry) f.close() def get_registry_file_path(self, repo_name): return self.registry_dir + '/' + self.mode + '.' + repo_name + '.txt' def read_and_flush_registry(self, repo_name): registry_file = self.get_registry_file_path(repo_name) if not os.path.isfile(registry_file): return [] f = open(registry_file, 'r+') entries = [] lines = f.readlines() for line in lines: # replace spaces with tab, in case tab has been replaced by space in the meantime line = re.sub(' +', '\t', line) line = line.strip() if not line: continue entry = line.split('\t') entry[0] = entry[0].strip() entry[1] = entry[1].strip() entries.append(entry) f.seek(0) f.close() os.remove(registry_file) return entries def write_registry(self, repo_name, entries): registry_file = self.get_registry_file_path(repo_name) if len(entries) == 0: return f = open(registry_file, 'w+') for entry in entries: line = '\t'.join(entry) + '\n' f.write(line) f.close()
0.221687
0.058615
class ImageFolderDataset(Dataset): def __init__(self, root_path, transform=None, target_window=100, first_k=None, last_k=None, skip_every=1, repeat=1, cache='in_memory', shuffle_mapping=False, forced_mapping=None, real_shuffle=False, batch_size=args.batch_size, logger=print, config={ 'train': { 'transform':None, 'repeat':10}, 'eval': { 'transform': None, 'repeat': 1 } }): self.configs = config self.current_mode = list(config.keys())[0] self.repeat = repeat #config[self.current_mode]['repeat'] self.cache = cache self.batch_size = batch_size self.logger = logger filenames = sorted(os.listdir(root_path)) self.sets = [f.split('_')[-1].split('--')[0] for f in filenames] self.set_lookup = {f: s for f, s in zip(filenames, self.sets)} self.set_list = [] total_labels = 0 for setname in np.unique(self.sets): set_seen = 0 for i, f in enumerate([f for f in filenames if self.set_lookup[f] == setname]): self.set_list.append({ "label": total_labels, "file": f, "order": i }) set_seen += 1 if set_seen % target_window == 0: total_labels += 1 total_labels += 1 self.target_lookup = {s["file"]: s["label"] for s in self.set_list} self.order_lookup = {s["file"]: s["order"] for s in self.set_list} if first_k is not None: filenames = filenames[:first_k] elif last_k is not None: filenames = filenames[-last_k:] filenames = filenames[::skip_every] self.logger(f"Found {len(filenames)} files in {root_path}") self.do_shuffle = real_shuffle if shuffle_mapping: self.init_mapping = np.random.permutation(len(filenames)) else: self.init_mapping = [i for i in range(len(filenames))] if forced_mapping is not None: self.init_mapping = forced_mapping self.logger(f"Using cache strategy '{cache}'") self.files = [] self.filenames = [] with tqdm(self.init_mapping) as pbar: for file_idx in pbar: try: filename = filenames[file_idx] filepath = os.path.join(root_path, filename) self.filenames.append(filename) if cache == 'none': self.files.append(filepath) elif cache == 'bin': bin_root = os.path.join(os.path.dirname(root_path), '_bin_' + os.path.basename(root_path)) if not os.path.exists(bin_root): os.mkdir(bin_root) print('mkdir', bin_root) bin_file = os.path.join( bin_root, filename.split('.')[0] + '.pkl') if not os.path.exists(bin_file): with open(bin_file, 'wb') as f: pickle.dump(imageio.imread(filepath), f) print('dump', bin_file) self.files.append(bin_file) elif cache == 'in_memory': self.files.append(Image.open(filepath).convert('RGB')) except Exception as e: print(f"Failed to load image {filepath}: {e}") self.mapping = [i for i in range(len(self.files))] self.actual_size = len(self.mapping) self.targets = [self.target_lookup[f] for f in self.filenames] self.classes = np.unique(self.targets) self.num_class = len(self.classes) self.transform = transform def __len__(self): return len(self.files) * self.repeat def __getitem__(self, i): i = self.mapping[i % len(self.files)] x = self.files[i] l = self.targets[i] if self.cache == 'none': return Image.open(x).convert('RGB'), l, i elif self.cache == 'bin': with open(x, 'rb') as f: x = pickle.load(f) x = np.ascontiguousarray(x.transpose(2, 0, 1)) x = torch.from_numpy(x).float() / 255 return x, l, i elif self.cache == 'in_memory': return x, l, i def shuffle_mapping(self): # can't easily shuffle and use indexes as labels if self.do_shuffle: random.shuffle(self.mapping) def set_mode(self, name): if name in self.configs: try: for a, v in self.configs[name].items(): if a in self.__dict__: self.logger(f"[INFO]\tSetting {a} to {v}") self.__dict__[a] = v else: self.logger(f"[INFO]\tSetting {a} not found") self.logger(f"[INFO]\tMode switched from '{self.current_mode}' to '{name}'") self.current_mode = name except Exception as e: self.logger(f"[INFO]\tMode switched from '{self.current_mode}' to 'error'") self.current_mode = "error" raise e else: raise AttributeError(f"No {name} config profile found") class FractalLabelPair(ImageFolderDataset): def __getitem__(self, index): img, label, order = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img_1 = self.transform(img) img_2 = self.transform(img) return { "images": (img_1, img_2), "label": label, "order": order } class FractalPair(ImageFolderDataset): def __getitem__(self, index): img, label, order = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img_1 = self.transform(img) img_2 = self.transform(img) return { "images": (img_1, img_2), "order": order } class FractalLabel(ImageFolderDataset): def __getitem__(self, index): img, label = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img = self.transform(img) return { "images": (img), "label": label, "order": order } class CIFAR10Pair(CIFAR10): """CIFAR10 Dataset. """ def __getitem__(self, index): img = self.data[index] img = Image.fromarray(img) if self.transform is not None: img_1 = self.transform(img) img_2 = self.transform(img) return img_1, img_2 class ConfigurableDataLoader(DataLoader): def set_mode(self, name): try: self.dataset.set_mode(name) except Exception as e: print(f"[ERROR]\tFailed to switch to mode {name}:\n{e}")
datasets/contrastive.py
class ImageFolderDataset(Dataset): def __init__(self, root_path, transform=None, target_window=100, first_k=None, last_k=None, skip_every=1, repeat=1, cache='in_memory', shuffle_mapping=False, forced_mapping=None, real_shuffle=False, batch_size=args.batch_size, logger=print, config={ 'train': { 'transform':None, 'repeat':10}, 'eval': { 'transform': None, 'repeat': 1 } }): self.configs = config self.current_mode = list(config.keys())[0] self.repeat = repeat #config[self.current_mode]['repeat'] self.cache = cache self.batch_size = batch_size self.logger = logger filenames = sorted(os.listdir(root_path)) self.sets = [f.split('_')[-1].split('--')[0] for f in filenames] self.set_lookup = {f: s for f, s in zip(filenames, self.sets)} self.set_list = [] total_labels = 0 for setname in np.unique(self.sets): set_seen = 0 for i, f in enumerate([f for f in filenames if self.set_lookup[f] == setname]): self.set_list.append({ "label": total_labels, "file": f, "order": i }) set_seen += 1 if set_seen % target_window == 0: total_labels += 1 total_labels += 1 self.target_lookup = {s["file"]: s["label"] for s in self.set_list} self.order_lookup = {s["file"]: s["order"] for s in self.set_list} if first_k is not None: filenames = filenames[:first_k] elif last_k is not None: filenames = filenames[-last_k:] filenames = filenames[::skip_every] self.logger(f"Found {len(filenames)} files in {root_path}") self.do_shuffle = real_shuffle if shuffle_mapping: self.init_mapping = np.random.permutation(len(filenames)) else: self.init_mapping = [i for i in range(len(filenames))] if forced_mapping is not None: self.init_mapping = forced_mapping self.logger(f"Using cache strategy '{cache}'") self.files = [] self.filenames = [] with tqdm(self.init_mapping) as pbar: for file_idx in pbar: try: filename = filenames[file_idx] filepath = os.path.join(root_path, filename) self.filenames.append(filename) if cache == 'none': self.files.append(filepath) elif cache == 'bin': bin_root = os.path.join(os.path.dirname(root_path), '_bin_' + os.path.basename(root_path)) if not os.path.exists(bin_root): os.mkdir(bin_root) print('mkdir', bin_root) bin_file = os.path.join( bin_root, filename.split('.')[0] + '.pkl') if not os.path.exists(bin_file): with open(bin_file, 'wb') as f: pickle.dump(imageio.imread(filepath), f) print('dump', bin_file) self.files.append(bin_file) elif cache == 'in_memory': self.files.append(Image.open(filepath).convert('RGB')) except Exception as e: print(f"Failed to load image {filepath}: {e}") self.mapping = [i for i in range(len(self.files))] self.actual_size = len(self.mapping) self.targets = [self.target_lookup[f] for f in self.filenames] self.classes = np.unique(self.targets) self.num_class = len(self.classes) self.transform = transform def __len__(self): return len(self.files) * self.repeat def __getitem__(self, i): i = self.mapping[i % len(self.files)] x = self.files[i] l = self.targets[i] if self.cache == 'none': return Image.open(x).convert('RGB'), l, i elif self.cache == 'bin': with open(x, 'rb') as f: x = pickle.load(f) x = np.ascontiguousarray(x.transpose(2, 0, 1)) x = torch.from_numpy(x).float() / 255 return x, l, i elif self.cache == 'in_memory': return x, l, i def shuffle_mapping(self): # can't easily shuffle and use indexes as labels if self.do_shuffle: random.shuffle(self.mapping) def set_mode(self, name): if name in self.configs: try: for a, v in self.configs[name].items(): if a in self.__dict__: self.logger(f"[INFO]\tSetting {a} to {v}") self.__dict__[a] = v else: self.logger(f"[INFO]\tSetting {a} not found") self.logger(f"[INFO]\tMode switched from '{self.current_mode}' to '{name}'") self.current_mode = name except Exception as e: self.logger(f"[INFO]\tMode switched from '{self.current_mode}' to 'error'") self.current_mode = "error" raise e else: raise AttributeError(f"No {name} config profile found") class FractalLabelPair(ImageFolderDataset): def __getitem__(self, index): img, label, order = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img_1 = self.transform(img) img_2 = self.transform(img) return { "images": (img_1, img_2), "label": label, "order": order } class FractalPair(ImageFolderDataset): def __getitem__(self, index): img, label, order = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img_1 = self.transform(img) img_2 = self.transform(img) return { "images": (img_1, img_2), "order": order } class FractalLabel(ImageFolderDataset): def __getitem__(self, index): img, label = super().__getitem__(index) if self.transform is None: self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(data_stats["mean"], data_stats["std"])]) img = self.transform(img) return { "images": (img), "label": label, "order": order } class CIFAR10Pair(CIFAR10): """CIFAR10 Dataset. """ def __getitem__(self, index): img = self.data[index] img = Image.fromarray(img) if self.transform is not None: img_1 = self.transform(img) img_2 = self.transform(img) return img_1, img_2 class ConfigurableDataLoader(DataLoader): def set_mode(self, name): try: self.dataset.set_mode(name) except Exception as e: print(f"[ERROR]\tFailed to switch to mode {name}:\n{e}")
0.522689
0.175256
import typing from dataclasses import dataclass from aiothornode.types import ThorConstants, ThorMimir from services.lib.texts import split_by_camel_case from services.models.base import BaseModelMixin @dataclass class MimirEntry: name: str pretty_name: str real_value: str hard_coded_value: str overridden: bool changed_ts: int is_rune: bool is_blocks: bool is_bool: bool source: str SOURCE_CONST = 'const' SOURCE_MIMIR = 'mimir' SOURCE_BOTH = 'both' @dataclass class MimirChange(BaseModelMixin): kind: str name: str old_value: str new_value: str entry: MimirEntry timestamp: float VALUE_CHANGE = '~' ADDED_MIMIR = '+' REMOVED_MIMIR = '-' def __post_init__(self): self.timestamp = float(self.timestamp) class MimirHolder: def __init__(self) -> None: self.last_constants: ThorConstants = ThorConstants() self.last_mimir: ThorMimir = ThorMimir() self.last_changes: typing.Dict[str, float] = {} self._const_map = {} def mimirize(arr): return set([self.convert_name_to_mimir_key(n) for n in arr]) self._mimir_names_of_block_constants = mimirize(self.BLOCK_CONSTANTS) self._mimir_names_of_rune_constants = mimirize(self.RUNE_CONSTANTS) self._mimir_names_of_bool_constants = mimirize(self.BOOL_CONSTANTS) self._all_names = set() self._mimir_only_names = set() MIMIR_PREFIX = 'mimir//' BLOCK_CONSTANTS = { 'BlocksPerYear', 'FundMigrationInterval', 'ChurnInterval', 'ChurnRetryInterval', 'SigningTransactionPeriod', 'DoubleSignMaxAge', 'LiquidityLockUpBlocks', 'ObservationDelayFlexibility', 'YggFundRetry', 'JailTimeKeygen', 'JailTimeKeysign', 'NodePauseChainBlocks', 'FullImpLossProtectionBlocks', 'TxOutDelayMax', 'MaxTxOutOffset' } RUNE_CONSTANTS = { 'OutboundTransactionFee', 'NativeTransactionFee', 'StagedPoolCost', 'MinRunePoolDepth', 'MinimumBondInRune', 'MinTxOutVolumeThreshold', 'TxOutDelayRate', 'TNSFeePerBlock', 'TNSRegisterFee', 'MAXIMUMLIQUIDITYRUNE', 'MAXLIQUIDITYRUNE', } TRANSLATE_MIMIRS = { 'PAUSELPLTC': 'Pause LP LTC', 'PAUSELPETH': 'Pause LP ETH', 'PAUSELPBCH': 'Pause LP BCH', 'PAUSELPBNB': 'Pause LP BNB', 'PAUSELPBTC': 'Pause LP BTC', 'PAUSELP': 'Pause all LP', 'STOPFUNDYGGDRASIL': 'Stop Fund Yggdrasil', 'STOPSOLVENCYCHECK': 'Stol Solvency Check', 'NUMBEROFNEWNODESPERCHURN': 'Number of New Nodes per Churn', 'MINTSYNTHS': 'Mint Synths', 'HALTBCHCHAIN': 'Halt BCH Chain', 'HALTBCHTRADING': 'Halt BCH Trading', 'HALTBNBCHAIN': 'Halt BNB Chain', 'HALTBNBTRADING': 'Halt BNB Trading', 'HALTBTCCHAIN': 'Halt BTC Chain', 'HALTBTCTRADING': 'Halt BTC Trading', 'HALTETHCHAIN': 'Halt ETH Chain', 'HALTETHTRADING': 'Halt ETH Trading', 'HALTLTCCHAIN': 'Halt LTC Chain', 'HALTLTCTRADING': 'Halt LTC Trading', 'HALTTHORCHAIN': 'Halt ThorChain', 'HALTTRADING': 'Halt All Trading', 'MAXIMUMLIQUIDITYRUNE': 'Maximum Liquidity Rune', 'MAXLIQUIDITYRUNE': 'Max Liquidity Rune', 'MAXUTXOSTOSPEND': 'Max UTXO to Spend', 'THORNAME': 'THOR Name', 'THORNAMES': 'THOR Names', 'STOPSOLVENCYCHECKETH': 'Stop Solvency check ETH', 'STOPSOLVENCYCHECKBNB': 'Stop Solvency check BNB', 'STOPSOLVENCYCHECKLTC': 'Stop Solvency check LTC', 'STOPSOLVENCYCHECKBTC': 'Stop Solvency check BTC', 'STOPSOLVENCYCHECKBCH': 'Stop Solvency check BCH', } BOOL_CONSTANTS = { "HALTBCHCHAIN", "HALTBCHTRADING", "HALTBNBCHAIN", "HALTBNBTRADING", "HALTBTCCHAIN", "HALTBTCTRADING", "HALTETHCHAIN", "HALTETHTRADING", "HALTLTCCHAIN", "HALTLTCTRADING", "HALTTHORCHAIN", "HALTTRADING", "MINTSYNTHS", "PAUSELP", "PAUSELPBCH", "PAUSELPBNB", "PAUSELPBTC", "PAUSELPETH", "PAUSELPLTC", "STOPFUNDYGGDRASIL", "STOPSOLVENCYCHECK", "THORNAME", "THORNAMES", 'STOPSOLVENCYCHECKETH', 'STOPSOLVENCYCHECKBNB', 'STOPSOLVENCYCHECKLTC', 'STOPSOLVENCYCHECKBTC', 'STOPSOLVENCYCHECKBCH', } @staticmethod def convert_name_to_mimir_key(name): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): return name else: return f'{prefix}{name.upper()}' @staticmethod def pure_name(name: str): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): return name[len(prefix):] else: return name.upper() def get_constant(self, name: str, default=0, const_type: typing.Optional[type] = int): raw_hardcoded_value = self.last_constants.constants.get(name, 0) hardcoded_value = const_type(raw_hardcoded_value) if const_type else raw_hardcoded_value mimir_name = MimirHolder.convert_name_to_mimir_key(name) if mimir_name in self.last_mimir.constants: v = self.last_mimir.constants.get(mimir_name, default) return const_type(v) if const_type is not None else v else: return hardcoded_value def get_hardcoded_const(self, name: str, default=None): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): pure_name = name[len(prefix):] for k, v in self.last_constants.constants.items(): if pure_name.upper() == k.upper(): return v return default else: return self.last_constants.constants.get(name) def get_entry(self, name) -> typing.Optional[MimirEntry]: return self._const_map.get(name) def update(self, constants: ThorConstants, mimir: ThorMimir): consts = set(constants.constants.keys()) only_mimir_names = set() overriden_names = set() mimir_like_const_names = set(self.convert_name_to_mimir_key(n) for n in consts) for mimir_name in mimir.constants.keys(): if mimir_name in mimir_like_const_names: overriden_names.add(mimir_name) else: only_mimir_names.add(mimir_name) self._const_map = {} self._all_names = set() self._mimir_only_names = set() for name, value in constants.constants.items(): real_value = value overriden = False source = MimirEntry.SOURCE_CONST mimir_name = self.convert_name_to_mimir_key(name) if mimir_name in overriden_names: overriden = True source = MimirEntry.SOURCE_BOTH real_value = mimir.constants.get(mimir_name) last_change_ts = self.last_changes.get(name, 0) entry = MimirEntry(name, split_by_camel_case(name), real_value, value, overriden, last_change_ts, is_rune=name in self.RUNE_CONSTANTS, is_blocks=name in self.BLOCK_CONSTANTS, is_bool=name in self.BOOL_CONSTANTS, source=source) self._const_map[name] = entry self._const_map[mimir_name] = entry self._all_names.add(name) for name in only_mimir_names: value = mimir.constants.get(name) last_change_ts = self.last_changes.get(name, 0) pure_name = self.pure_name(name) pretty_name = self.TRANSLATE_MIMIRS.get(pure_name, pure_name) entry = MimirEntry(name, pretty_name, value, value, True, last_change_ts, is_rune=name in self._mimir_names_of_rune_constants, is_blocks=name in self._mimir_names_of_block_constants, is_bool=name in self._mimir_names_of_bool_constants, source=MimirEntry.SOURCE_MIMIR) self._const_map[name] = entry self._const_map[pure_name] = entry self._all_names.add(name) self._mimir_only_names.add(name) if constants: self.last_constants = constants if mimir: self.last_mimir = mimir @property def all_entries(self) -> typing.List[MimirEntry]: entries = [self._const_map[name] for name in self._all_names] entries.sort(key=lambda en: en.pretty_name) return entries def register_change_ts(self, name, ts): if name: self.last_changes[name] = ts entry: MimirEntry = self._const_map.get(name) if entry and ts > 0: entry.changed_ts = ts
app/services/models/mimir.py
import typing from dataclasses import dataclass from aiothornode.types import ThorConstants, ThorMimir from services.lib.texts import split_by_camel_case from services.models.base import BaseModelMixin @dataclass class MimirEntry: name: str pretty_name: str real_value: str hard_coded_value: str overridden: bool changed_ts: int is_rune: bool is_blocks: bool is_bool: bool source: str SOURCE_CONST = 'const' SOURCE_MIMIR = 'mimir' SOURCE_BOTH = 'both' @dataclass class MimirChange(BaseModelMixin): kind: str name: str old_value: str new_value: str entry: MimirEntry timestamp: float VALUE_CHANGE = '~' ADDED_MIMIR = '+' REMOVED_MIMIR = '-' def __post_init__(self): self.timestamp = float(self.timestamp) class MimirHolder: def __init__(self) -> None: self.last_constants: ThorConstants = ThorConstants() self.last_mimir: ThorMimir = ThorMimir() self.last_changes: typing.Dict[str, float] = {} self._const_map = {} def mimirize(arr): return set([self.convert_name_to_mimir_key(n) for n in arr]) self._mimir_names_of_block_constants = mimirize(self.BLOCK_CONSTANTS) self._mimir_names_of_rune_constants = mimirize(self.RUNE_CONSTANTS) self._mimir_names_of_bool_constants = mimirize(self.BOOL_CONSTANTS) self._all_names = set() self._mimir_only_names = set() MIMIR_PREFIX = 'mimir//' BLOCK_CONSTANTS = { 'BlocksPerYear', 'FundMigrationInterval', 'ChurnInterval', 'ChurnRetryInterval', 'SigningTransactionPeriod', 'DoubleSignMaxAge', 'LiquidityLockUpBlocks', 'ObservationDelayFlexibility', 'YggFundRetry', 'JailTimeKeygen', 'JailTimeKeysign', 'NodePauseChainBlocks', 'FullImpLossProtectionBlocks', 'TxOutDelayMax', 'MaxTxOutOffset' } RUNE_CONSTANTS = { 'OutboundTransactionFee', 'NativeTransactionFee', 'StagedPoolCost', 'MinRunePoolDepth', 'MinimumBondInRune', 'MinTxOutVolumeThreshold', 'TxOutDelayRate', 'TNSFeePerBlock', 'TNSRegisterFee', 'MAXIMUMLIQUIDITYRUNE', 'MAXLIQUIDITYRUNE', } TRANSLATE_MIMIRS = { 'PAUSELPLTC': 'Pause LP LTC', 'PAUSELPETH': 'Pause LP ETH', 'PAUSELPBCH': 'Pause LP BCH', 'PAUSELPBNB': 'Pause LP BNB', 'PAUSELPBTC': 'Pause LP BTC', 'PAUSELP': 'Pause all LP', 'STOPFUNDYGGDRASIL': 'Stop Fund Yggdrasil', 'STOPSOLVENCYCHECK': 'Stol Solvency Check', 'NUMBEROFNEWNODESPERCHURN': 'Number of New Nodes per Churn', 'MINTSYNTHS': 'Mint Synths', 'HALTBCHCHAIN': 'Halt BCH Chain', 'HALTBCHTRADING': 'Halt BCH Trading', 'HALTBNBCHAIN': 'Halt BNB Chain', 'HALTBNBTRADING': 'Halt BNB Trading', 'HALTBTCCHAIN': 'Halt BTC Chain', 'HALTBTCTRADING': 'Halt BTC Trading', 'HALTETHCHAIN': 'Halt ETH Chain', 'HALTETHTRADING': 'Halt ETH Trading', 'HALTLTCCHAIN': 'Halt LTC Chain', 'HALTLTCTRADING': 'Halt LTC Trading', 'HALTTHORCHAIN': 'Halt ThorChain', 'HALTTRADING': 'Halt All Trading', 'MAXIMUMLIQUIDITYRUNE': 'Maximum Liquidity Rune', 'MAXLIQUIDITYRUNE': 'Max Liquidity Rune', 'MAXUTXOSTOSPEND': 'Max UTXO to Spend', 'THORNAME': 'THOR Name', 'THORNAMES': 'THOR Names', 'STOPSOLVENCYCHECKETH': 'Stop Solvency check ETH', 'STOPSOLVENCYCHECKBNB': 'Stop Solvency check BNB', 'STOPSOLVENCYCHECKLTC': 'Stop Solvency check LTC', 'STOPSOLVENCYCHECKBTC': 'Stop Solvency check BTC', 'STOPSOLVENCYCHECKBCH': 'Stop Solvency check BCH', } BOOL_CONSTANTS = { "HALTBCHCHAIN", "HALTBCHTRADING", "HALTBNBCHAIN", "HALTBNBTRADING", "HALTBTCCHAIN", "HALTBTCTRADING", "HALTETHCHAIN", "HALTETHTRADING", "HALTLTCCHAIN", "HALTLTCTRADING", "HALTTHORCHAIN", "HALTTRADING", "MINTSYNTHS", "PAUSELP", "PAUSELPBCH", "PAUSELPBNB", "PAUSELPBTC", "PAUSELPETH", "PAUSELPLTC", "STOPFUNDYGGDRASIL", "STOPSOLVENCYCHECK", "THORNAME", "THORNAMES", 'STOPSOLVENCYCHECKETH', 'STOPSOLVENCYCHECKBNB', 'STOPSOLVENCYCHECKLTC', 'STOPSOLVENCYCHECKBTC', 'STOPSOLVENCYCHECKBCH', } @staticmethod def convert_name_to_mimir_key(name): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): return name else: return f'{prefix}{name.upper()}' @staticmethod def pure_name(name: str): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): return name[len(prefix):] else: return name.upper() def get_constant(self, name: str, default=0, const_type: typing.Optional[type] = int): raw_hardcoded_value = self.last_constants.constants.get(name, 0) hardcoded_value = const_type(raw_hardcoded_value) if const_type else raw_hardcoded_value mimir_name = MimirHolder.convert_name_to_mimir_key(name) if mimir_name in self.last_mimir.constants: v = self.last_mimir.constants.get(mimir_name, default) return const_type(v) if const_type is not None else v else: return hardcoded_value def get_hardcoded_const(self, name: str, default=None): prefix = MimirHolder.MIMIR_PREFIX if name.startswith(prefix): pure_name = name[len(prefix):] for k, v in self.last_constants.constants.items(): if pure_name.upper() == k.upper(): return v return default else: return self.last_constants.constants.get(name) def get_entry(self, name) -> typing.Optional[MimirEntry]: return self._const_map.get(name) def update(self, constants: ThorConstants, mimir: ThorMimir): consts = set(constants.constants.keys()) only_mimir_names = set() overriden_names = set() mimir_like_const_names = set(self.convert_name_to_mimir_key(n) for n in consts) for mimir_name in mimir.constants.keys(): if mimir_name in mimir_like_const_names: overriden_names.add(mimir_name) else: only_mimir_names.add(mimir_name) self._const_map = {} self._all_names = set() self._mimir_only_names = set() for name, value in constants.constants.items(): real_value = value overriden = False source = MimirEntry.SOURCE_CONST mimir_name = self.convert_name_to_mimir_key(name) if mimir_name in overriden_names: overriden = True source = MimirEntry.SOURCE_BOTH real_value = mimir.constants.get(mimir_name) last_change_ts = self.last_changes.get(name, 0) entry = MimirEntry(name, split_by_camel_case(name), real_value, value, overriden, last_change_ts, is_rune=name in self.RUNE_CONSTANTS, is_blocks=name in self.BLOCK_CONSTANTS, is_bool=name in self.BOOL_CONSTANTS, source=source) self._const_map[name] = entry self._const_map[mimir_name] = entry self._all_names.add(name) for name in only_mimir_names: value = mimir.constants.get(name) last_change_ts = self.last_changes.get(name, 0) pure_name = self.pure_name(name) pretty_name = self.TRANSLATE_MIMIRS.get(pure_name, pure_name) entry = MimirEntry(name, pretty_name, value, value, True, last_change_ts, is_rune=name in self._mimir_names_of_rune_constants, is_blocks=name in self._mimir_names_of_block_constants, is_bool=name in self._mimir_names_of_bool_constants, source=MimirEntry.SOURCE_MIMIR) self._const_map[name] = entry self._const_map[pure_name] = entry self._all_names.add(name) self._mimir_only_names.add(name) if constants: self.last_constants = constants if mimir: self.last_mimir = mimir @property def all_entries(self) -> typing.List[MimirEntry]: entries = [self._const_map[name] for name in self._all_names] entries.sort(key=lambda en: en.pretty_name) return entries def register_change_ts(self, name, ts): if name: self.last_changes[name] = ts entry: MimirEntry = self._const_map.get(name) if entry and ts > 0: entry.changed_ts = ts
0.650689
0.150559
import requests import json from django.shortcuts import render, redirect from django.http import HttpResponse from common.fetching import Fetcher as DataFetcher from common.tokening import TokenManager from .services.summary import ( BatchJobErrorSummary, BatchJobExecutingSummary, BatchJobWaitingSummary, BatchJobWithholdSummary, ) from .services.tables import ( SqlBlocking, SqlLockInfo, SqlInfo, ) # Create your views here. def index(request): """ Some description here. """ if not request.user.is_authenticated: return redirect('/') context = {} context['resource_url'] = request.session.get('resource') token_manager = TokenManager( resource=request.session.get('resource'), tenant=request.session.get('tenant'), client_id=request.session.get('client_id'), client_secret=request.session.get('client_secret'), username=request.session.get('username'), password=request.session.get('password') ) data_fetcher = DataFetcher(token_manager) batch_job_error = BatchJobErrorSummary(data_fetcher) batch_job_error.fetch_data() batch_job_executing = BatchJobExecutingSummary(data_fetcher) batch_job_executing.fetch_data() batch_job_waiting = BatchJobWaitingSummary(data_fetcher) batch_job_waiting.fetch_data() batch_job_withhold = BatchJobWithholdSummary(data_fetcher) batch_job_withhold.fetch_data() print('=========================================> SQL ANALYSES: Comecou',) sql_blocking = SqlBlocking(data_fetcher) sql_blocking.fetch_data() sql_lock_info = SqlLockInfo(data_fetcher) sql_lock_info.fetch_data() sql_info = SqlInfo(data_fetcher) sql_info.fetch_data() print('=========================================> BLOCKING: ', len(sql_blocking.get_context_value())) print('=========================================> LOCK: ', len(sql_lock_info.get_context_value())) print('=========================================> INFO: ', sql_info.get_context_value()) context[batch_job_error.get_context_key()] = batch_job_error.get_context_value() context[batch_job_executing.get_context_key()] = batch_job_executing.get_context_value() context[batch_job_waiting.get_context_key()] = batch_job_waiting.get_context_value() context[batch_job_withhold.get_context_key()] = batch_job_withhold.get_context_value() return render(request, 'sysadmin/index.html', context)
daxboard/sysadmin/views.py
import requests import json from django.shortcuts import render, redirect from django.http import HttpResponse from common.fetching import Fetcher as DataFetcher from common.tokening import TokenManager from .services.summary import ( BatchJobErrorSummary, BatchJobExecutingSummary, BatchJobWaitingSummary, BatchJobWithholdSummary, ) from .services.tables import ( SqlBlocking, SqlLockInfo, SqlInfo, ) # Create your views here. def index(request): """ Some description here. """ if not request.user.is_authenticated: return redirect('/') context = {} context['resource_url'] = request.session.get('resource') token_manager = TokenManager( resource=request.session.get('resource'), tenant=request.session.get('tenant'), client_id=request.session.get('client_id'), client_secret=request.session.get('client_secret'), username=request.session.get('username'), password=request.session.get('password') ) data_fetcher = DataFetcher(token_manager) batch_job_error = BatchJobErrorSummary(data_fetcher) batch_job_error.fetch_data() batch_job_executing = BatchJobExecutingSummary(data_fetcher) batch_job_executing.fetch_data() batch_job_waiting = BatchJobWaitingSummary(data_fetcher) batch_job_waiting.fetch_data() batch_job_withhold = BatchJobWithholdSummary(data_fetcher) batch_job_withhold.fetch_data() print('=========================================> SQL ANALYSES: Comecou',) sql_blocking = SqlBlocking(data_fetcher) sql_blocking.fetch_data() sql_lock_info = SqlLockInfo(data_fetcher) sql_lock_info.fetch_data() sql_info = SqlInfo(data_fetcher) sql_info.fetch_data() print('=========================================> BLOCKING: ', len(sql_blocking.get_context_value())) print('=========================================> LOCK: ', len(sql_lock_info.get_context_value())) print('=========================================> INFO: ', sql_info.get_context_value()) context[batch_job_error.get_context_key()] = batch_job_error.get_context_value() context[batch_job_executing.get_context_key()] = batch_job_executing.get_context_value() context[batch_job_waiting.get_context_key()] = batch_job_waiting.get_context_value() context[batch_job_withhold.get_context_key()] = batch_job_withhold.get_context_value() return render(request, 'sysadmin/index.html', context)
0.340376
0.043164
polls = { 'newsint2_baseline' : ('Interest in news and public affairs', 'Some people seem to follow what\'s going on in government and public affairs most of the time, whether there\'s an election going on or not. Others aren\'t that interested. Would you say you follow what\'s going on in government and public affairs ...?', [[1], [2], [3], [4]], ['Most of the time', 'Some of the time', 'Only now and then', 'Hardly at all']), 'newsint_2016' : ('Political Interest', 'Some people seem to follow what\'s going on in government and public affairs most of the time, whether there\'s an election going on or not. Others aren\'t that interested. Would you say you follow what\'s going on in government and public affairs ...?', [[1], [2], [3], [4]], ['Most of the time', 'Some of the time', 'Only now and then', 'Hardly at all']), 'track_baseline' : ('Direction of the country', 'Would you say things in the country are...', [[1], [2], [3]], ['Generally headed in the right direction', 'Off on the wrong track','Not sure']), 'track_2016' : ('Direction of the country (2016)', 'Would you say things in the country are...', [[1], [2], [3]], ['Generally headed in the right direction', 'Off on the wrong track','Not sure']), 'americatrend_2016' : ('Life in America today for people like R compared to fifty years ago', 'In general, would you say life in America today is better, worse, or about the same as it was fifty years ago for people like you?', [[1], [2], [3], [4]], ['Better', 'About the same', 'Worse', 'Don\'t Know']), 'wealth_2016' : ('Distribution of money and wealth in this country', 'Do you feel that the distribution of money and wealth in this country is fair, or do you feel that the money and wealth in this country should be more evenly distributed among more people?', [[1], [2], [8]], ['Distribution is fair', 'Should be more evenly distributed', 'Don\'t know']), 'values_culture_2016' : ('In America, values and culture of people like R are...', 'In America today, do you feel the values and culture of people like you are:', [[1], [2], [3], [8]], ['Generally becoming more widespread and accepted', 'Holding Steady', 'Generally becoming rarer', 'Don\'t Know']), 'trustgovt_baseline' : ('Trust government to do what\'s right', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'trustgovt_2016' : ('Trust government (2016)', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'trust_people_2016' : ('Most people can/can\'t be trusted', 'Generally speaking, would you say that most people can be trusted or that you can\'t be too careful in dealing with people?', [[1], [2], [8]], ['Can\'t be too careful in dealing with people', 'Most people can be trusted', 'Don\'t know']), 'helpful_people_2016' : ('People try to be helpful or are they mostly just looking out for themselves', 'Would you say that most of the time people try to be helpful, or that they are mostly just looking out for themselves?', [[1], [2], [8]], ['People try to be helpful', 'People are looking out for themselves', 'Don\'t know']), 'obamaapp_baseline' : ('Barack Obama Approval', "Do you approve or dissaprove of the way Barack Obama is handlind his job as president?", [[1],[2],[3],[4],[5]], ['Stronly approve', 'Somewhat approve', 'Somewhat disapprove', 'Strongly disapprove', 'Not Sure']), 'obamaapp_2016' : ('Barack Obama Approval (2016)', "Do you approve or dissaprove of the way <NAME> is handlind his job as president?", [[1],[2],[3],[4],[5]], ['Stronly approve', 'Somewhat approve', 'Somewhat disapprove', 'Strongly disapprove', 'Not Sure']), 'watchtv_baseline' : ('Hours watch TV daily', "On a typical weekday, how many hours of TV do you watch?", [[1],[2],[3],[4]], ['None', '1-2 Hours', '3-4 Hours', 'More than 4 hours']), 'ideo5_baseline' : ('Ideology', "Thinking about politics these days, how would you describe your own political viewpoint?", [[1],[2],[3],[4],[5],[6]], ['Very Liberal', 'Liberal', 'Moderate', 'Conservative', 'Very Conservative', 'Not Sure']), 'imiss_a_baseline' : ('Issue Importance: Iraq War', "How important are the following issues to you -- The War in Iraq?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_b_baseline' : ('Issue Importance: The Economy', "How important are the following issues to you -- The economy?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_c_baseline' : ('Issue Importance: Immigration', "How important are the following issues to you -- Immigration?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_d_baseline' : ('Issue Importance: The Environment', "How important are the following issues to you -- The Environment?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_f_baseline' : ('Issue Importance: Terrorism', "How important are the following issues to you -- Terrorism?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_g_baseline' : ('Issue Importance: Gay Rights', "How important are the following issues to you -- Gay Rights?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_baseline' : ('Issue Importance: Education', "How important are the following issues to you -- Education?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_j_baseline' : ('Issue Importance: Health Care', "How important are the following issues to you -- Health Care?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_m_baseline' : ('Issue Importance: Social Security', "How important are the following issues to you -- Social Security?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_p_baseline' : ('Issue Importance: The Budget Deficit', "How important are the following issues to you -- The Budget Deficit?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_q_baseline' : ('Issue Importance: The War in Afganistan', "How important are the following issues to you -- The War in Afganistan?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_r_baseline' : ('Issue Importance: Taxes', "How important are the following issues to you -- Taxes?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_s_baseline' : ('Issue Importance: Medicare', "How important are the following issues to you -- Medicare?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_t_baseline' : ('Issue Importance: Abortion', "How important are the following issues to you -- Abortion?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_a_2016' : ('Issue Importance: Crime (2016)', "How important are the following issues to you -- Crime?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_b_2016' : ('Issue Importance: The Economy (2016)', "How important are the following issues to you -- The economy?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_c_2016' : ('Issue Importance: Immigration (2016)', "How important are the following issues to you -- Immigration?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_d_2016' : ('Issue Importance: The Environment (2016)', "How important are the following issues to you -- The Environment?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_e_2016' : ('Issue Importance: Religious Liberty (2016)', "How important are the following issues to you -- Religious Liberty?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_f_2016' : ('Issue Importance: Terrorism (2016)', "How important are the following issues to you -- Terrorism?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_g_2016' : ('Issue Importance: Gay Rights (2016)', "How important are the following issues to you -- Gay Rights?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_2016' : ('Issue Importance: Education (2016)', "How important are the following issues to you -- Education?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_2016' : ('Issue Importance: Family and Medical Leave (2016)', "How important are the following issues to you -- Family and Medical Leave?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_j_2016' : ('Issue Importance: Health Care (2016)', "How important are the following issues to you -- Health Care?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_k_2016' : ('Issue Importance: Money in Politics (2016)', "How important are the following issues to you -- Money in Politics?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_l_2016' : ('Issue Importance: Climate Change (2016)', "How important are the following issues to you -- Climate Change?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_m_2016' : ('Issue Importance: Social Security', "How important are the following issues to you -- Social Security?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_n_2016' : ('Issue Importance: Infrastructure Investment', "How important are the following issues to you -- Infrastructure Investment'?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_o_2016' : ('Issue Importance: Jobs', "How important are the following issues to you -- Jobs'?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_p_2016' : ('Issue Importance: The Budget Deficit (2016)', "How important are the following issues to you -- The Budget Deficit?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_q_2016' : ('Issue Importance: Poverty', "How important are the following issues to you -- Poverty?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_r_2016' : ('Issue Importance: Taxes (2016)', "How important are the following issues to you -- Taxes?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_s_2016' : ('Issue Importance: Medicare (2016)', "How important are the following issues to you -- Medicare?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_t_2016' : ('Issue Importance: Abortion (2016)', "How important are the following issues to you -- Abortion?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_u_2016' : ('Issue Importance: The size of Government (2016)', "How important are the following issues to you -- The size of Government?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_x_2016' : ('Issue Importance: Racial Equality (2016)', "How important are the following issues to you -- Racial Equality?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_y_2016' : ('Issue Importance: Gender Equality (2016)', "How important are the following issues to you -- Gender Equality?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imissf_baseline' : ('Most important issues', "Which of these is most important to you?", [[1],[2],[3],[4],[6],[7],[8],[10],[13],[16],[17],[18],[19],[20]], ['The war in Iraq','The economy', 'Immigration', 'The Evironmment','Terrorism', 'Gay Rights','Education','Health Care','Social Security','The Budget Deficit','The War in Afganistan','Taxes','Medicade','Abortion']), 'immi_contribution_baseline' : ('Illegal Immigrants Contribute or Drain', "Overall, do you think illegal immigrants American society or are a drain?", [[1],[2],[3],[4]], ['Mostly make a contribution','Neither', 'Mostly a drain', 'Not Sure']), 'immi_contribution_2016' : ('Illegal Immigrants Contribute or Drain (2016)', "Overall, do you think illegal immigrants American society or are a drain?", [[1],[2],[3],[4]], ['Mostly make a contribution','Neither', 'Mostly a drain', 'Not Sure']), 'immi_naturalize_baseline' : ('Illegal Immigrant Naturalization', "Do you favor or oppose providing a legal way for illegal immigrants already in the United States to become U.S. citizens?", [[1], [2], [3]], ['Favor', 'Oppose', 'Not sure']), 'immi_naturalize_2016' : ('Illegal Immigrant Naturalization (2016)', "Do you favor or oppose providing a legal way for illegal immigrants already in the United States to become U.S. citizens?", [[1], [2], [3]], ['Favor', 'Oppose', 'Not sure']), 'immi_makedifficult_baseline' : ('Harder/Easier to Immigrate', "Do you think it should be easier or harder for foreigners to immigrate to the US?", [[1],[2],[3],[4],[5],[8]], ['Much easier', 'Slightly easier','No change','Slightly Harder','Much harder','Not sure']), 'immi_makedifficult_2016' : ('Harder/Easier to Immigrate (2016)', "Do you think it should be easier or harder for foreigners to immigrate to the US?", [[1],[2],[3],[4],[5],[8]], ['Much easier', 'Slightly easier','No change','Slightly Harder','Much harder','Not sure']), 'abortview3_baseline' : ('Abortion views', "Do you think abortion should be...", [[1],[2],[3],[8]], ['Legal in all cases','Legal in some cases and illegal in others','Illegal in all cases','Not sure']), 'abortview3_2016' : ('Abortion views (2016)', "Do you think abortion should be...", [[1],[2],[3],[8]], ['Legal in all cases','Legal in some cases and illegal in others','Illegal in all cases','Not sure']), 'gaymar2_baseline' : ('Gay Marriage', "Do you favor or oppose allowing gays and lesbians to marry legally?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'gaymar_2016' : ('Gay Marriage (2016)', "Do you favor or oppose allowing gays and lesbians to marry legally?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenalty_baseline' : ('Death Penalty', "Do you favor or oppose the death penatly for persons convicted of murder?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenfreq_baseline' : ('Death Penalty Frequency', "Do you think the death penalty enough?", [[1],[2],[3],[4]], ['Too often', 'About Right', 'Not Often Enough', 'Not Sure']), 'deathpen_2016' : ('Death Penalty (2016)', "Do you favor or oppose the death penatly for persons convicted of murder?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenfreq_2016' : ('Death Penalty Frequency (2016)', "Do you think the death penalty enough?", [[1],[2],[3],[8]], ['Too often', 'About Right', 'Not Often Enough', 'Don\'t Know']), 'taxwealth_baseline' : ('Increase Taxes on Wealthy', "Do you favor raising taxes on families with incomes over 200,000 dollars per year?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'univhealthcov_baseline' : ('Federal government responsibility for healthcare', "Do you think it is the responsibility of the federal government to see to it that everyone has health care coverage?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'univhealthcov_2016' : ('Federal government responsibility for healthcare (2016)', "Do you think it is the responsibility of the federal government to see to it that everyone has health care coverage?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'envwarm_baseline' : ('Existence of Global Warming', "Some people say that global temperatures have been going up slowly over the past 100 years - the phenomenon called global warming. Do you think that global warming is happening?", [[1],[2],[3],[4],[5]], ['Defintely is happening', 'Probably is happening','Probably is not happening','Definitely is not happening', 'Not Sure']), 'envwarm_2016' : ('Existence of Global Warming (2016)', "Some people say that global temperatures have been going up slowly over the past 100 years - the phenomenon called global warming. Do you think that global warming is happening?", [[1],[2],[3],[4],[5]], ['Defintely is happening', 'Probably is happening','Probably is not happening','Definitely is not happening', 'Not Sure']), 'envser2_baseline' : ('Seriousness of Global Warming Problem', "How serious a problem do you think global warming is?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not Very', 'Not Sure']), 'envpoll2_baseline' : ('Cause of global warming', "Do you think global warming has been caused by pollution from human activities (such as emissions from cars and factories) or by natural causes?", [[1],[2],[3]], ['Pollution from human activities','Natural causes not related to human activities','Not sure']), 'envpoll2_2016' : ('Cause of global warming (2016)', "Do you think global warming has been caused by pollution from human activities (such as emissions from cars and factories) or by natural causes?", [[1],[2],[3]], ['Pollution from human activities','Natural causes not related to human activities','Not sure']), 'affirmact_gen_baseline' : ('Favor or oppose affirmative action for women and racial minorities', "Do you generally favor or oppose affirmative action programs for women and racial minorities?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'affirmact_gen_2016' : ('Favor or oppose affirmative action for women and racial minorities (2016)', "Do you generally favor or oppose affirmative action programs for women and racial minorities?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'tradepolicy_baseline' : ('Favor or oppose increasing trade', "Do you favor or oppose increasing trade with other nations?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'tradepolicy_2016' : ('Favor or oppose increasing trade (2016)', "Do you favor or oppose increasing trade with other nations?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'govt_reg_baseline' : ('Level of government regulation', "In general, do you think there of business by the government?", [[1],[2],[3],[8]], ['Too Much', 'About the right amount', 'Too little','Don\'t Know']), 'govt_reg_2016' : ('Level of government regulation (2016)', "In general, do you think there of business by the government?", [[1],[2],[3],[8]], ['Too Much', 'About the right amount','Too little', 'Don\'t Know']), 'pid7_baseline' : ('7 point party ID', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Strong Democrat','Not Very Strong Democrat','Lean Democrat','Independent','Lean Republican','Not very strong Republican','Strong Republican','Not sure']), 'pid7_2016' : ('7 point party ID (2016)', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Strong Democrat','Not Very Strong Democrat','Lean Democrat','Independent','Lean Republican','Not very strong Republican','Strong Republican','Not sure']), 'pid3_baseline' : ('3 point party ID', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5]], ['Democrat','Republican','Independent','Other','Not sure']), 'pid3_2016' : ('3 point party ID (2016)', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5]], ['Democrat','Republican','Independent','Other','Not sure']), 'vote_generic_baseline' : ('Generic Presidential Vote', "If an election for president was going to be held now, would you vote for...", [[1],[2],[3],[4],[5]], ['The Democratic Party','The Republican Party','Other','Not sure','I would not vote']), 'marstat_baseline' : ('Marital Status', "Marital Status", [[1],[2],[3],[4],[5],[6]], ['Married','Separated','Divorced','Widowed','Single','Domestic Partnership']), 'marstat_2016' : ('Marital Status (2016)', "Marital Status", [[1],[2],[3],[4],[5],[6]], ['Married','Separated','Divorced','Widowed','Single','Domestic Partnership']), 'teapartymemb_baseline' : ('Own involvement in Tea Party movement', "Do you think of yourself as a part of the Tea Party movement?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'teapartsup_baseline' : ('Support for Tea Party', "Generally speaking, do you support or oppose the goals of the Tea Party movement?", [[1],[2],[3],[4],[5],[8]], ['Strongly Support', 'Somewhat Support','Neither Support nor Oppose', 'Somewhat Oppose','Strongly Oppose', 'Not Sure']), 'selfdescr_ccap_1_baseline' : ('Self Described Libertarian', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Libertarian", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_2_baseline' : ('Self Described Socialist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Socialist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_3_baseline' : ('Self Described Green', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Green", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_4_baseline' : ('Self Described Environmentalist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Environmentalist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_5_baseline' : ('Self Described Liberal', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Liberal", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_6_baseline' : ('Self Described Moderate', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Moderate", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_7_baseline' : ('Self Described Conservative', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Conservative", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_8_baseline' : ('Self Described Radical', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Radical", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_9_baseline' : ('Self Described Progressive', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Progressive", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_10_baseline' : ('Self Described Traditional', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Traditional", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_11_baseline' : ('Self Described Christian', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Christian", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_12_baseline' : ('Self Described Feminist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Feminist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_13_baseline' : ('Self Described Fundamentalist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Fundamentalist", [[1],[2]], ['Yes', 'No']), 'abortidentity_baseline' : ('Pro-life or Pro-Choice', "Would you call yourself as pro-life or pro-choice?", [[1],[2],[3],[4],[8]], ['Pro-life','Pro-choice','Both','Neither','Not Sure']), 'race_deservemore_baseline': ('Black deservedeness', "Agree or Disagree: over the past few years, Blacks have gotten less than they deserve.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_deservemore_2016': ('Black deservedeness (2016)', "Agree or Disagree: over the past few years, Blacks have gotten less than they deserve.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_overcome_baseline' : ('Irish, Italians, and Jews Overcoming Prejudice', "Agree or Disagree: Irish, Italian, Jewish and other minorities overcame prejudice and worked their way up. Blacks should do the same without any special favors.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_overcome_2016' : ('Irish, Italians, and Jews Overcoming Prejudice (2016)', "Agree or Disagree: Irish, Italian, Jewish and other minorities overcame prejudice and worked their way up. Blacks should do the same without any special favors.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_tryharder_baseline': ('Blacks should try harder', "It's really a matter of some people not trying hard enough; if blacks would only try harder they could be just as well off as whites.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_tryharder_2016': ('Blacks should try harder (2016)', "It's really a matter of some people not trying hard enough; if blacks would only try harder they could be just as well off as whites.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_slave_baseline' : ('Modern day impact of slavery', "Generation of slavery and discrimination have created conditions that make it difficult for black to work their way out of the lower class.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_slave_2016' : ('Modern day impact of slavery', "Generation of slavery and discrimination have created conditions that make it difficult for black to work their way out of the lower class.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'ownorrent_baseline' : ('Own or Rent', "Is the place you live owned or rented?", [[1],[2],[3]], ['Owned', 'Rented', 'Other']), 'reliablevoter_baseline': ('Voting frequency', "How often do you vote?", [[1],[2],[3],[4]], ['Always','Nearly Always', 'Part of the time', 'Seldom']), 'straighttic_baseline' : ('Partisan Voter Reliability', "Do you almost always vote for candidates from the same party or do you sometimes support candidates from different parties?", [[1],[2],[3]], ['Almost always vote Republican','Almost always vote Democrat','Vote for both Democrats and Republicans']), 'voted08_cap_baseline' : ('Voted in 2008 Presidential Election', "Did you happen to vote in the 2008 election?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'presvote08_baseline' : ('2008 Presidential Vote', "Which candidate did you vote for in the 2008 Presidential Election?", [[1],[2],[3,4,5]], ['<NAME>', '<NAME>', 'Other']), 'post_presvote12_2012' : ('2008 Presidential Vote', "Which candidate did you vote for in the 2012 Presidential Election?", [[1],[2],[3],[4],[5]], ['<NAME>', '<NAME>', 'Other', 'Didn\'t Vote in this race', 'Didn\'t vote', 'Not Sure']), 'congvote10_ccap_baseline' : ('2010 Vote', "Did you happen to vote in the 2010 election?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'congvote10_ccap_baseline': ('2010 Congressional Vote', "Which candidate did you vote for in the U.S. House election?", [[1],[2],[3]], ['Democratic','Republican', 'Other']), 'fav_obama_baseline' : ( 'Barack Obama Favorability', "Do you have an unfavorable or favorable opinion on the following people -- Barack Obama", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_hrc_baseline' : ('<NAME> Favorability', "Do you have an unfavorable or favorable opinion on the following people -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'pew_bornagain_baseline' : ('Born Again Christains', "Would you describe yourself as Christian, or not?", [[1],[2]], ['Yes', 'No']), 'pew_bornagain_2016' : ('Born Again Christains (2016)', "Would you describe yourself as Christian, or not?", [[1],[2]], ['Yes', 'No']), 'pew_religimp_' : ('Imporance of religion', "How impotant is religion in your life?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not too imporant', 'Not at all']), 'pew_religimp_2016' : ('Imporance of religion (2016)', "How impotant is religion in your life?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not too imporant', 'Not at all']), 'pew_churchatd_baseline' : ('Church attendance', "Aside from weddings and funerals, how often do you attend religious services?", [[1],[2],[3],[4],[5],[6],[7]], ['More than once a week','Once a week','Once or twice a month','A few times a year','Seldom','Never','Don\'t know']), 'pew_churchatd_2016' : ('Church attendance (2016)', "Aside from weddings and funerals, how often do you attend religious services?", [[1],[2],[3],[4],[5],[6],[7]], ['More than once a week','Once a week','Once or twice a month','A few times a year','Seldom','Never','Don\'t know']), 'pew_prayer_baseline' : ('Frequency of prayer', "People practice their religion in different ways. Outside of attending religious services, how often do you pray?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Several time a day','Once a day','A few times a week','Once a week','A few times a month','Seldom','Never','Don\'t know']), 'pew_prayer_2016' : ('Frequency of prayer (2016)', "People practice their religion in different ways. Outside of attending religious services, how often do you pray?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Several time a day','Once a day','A few times a week','Once a week','A few times a month','Seldom','Never','Don\'t know']), 'religpew_basline' : ('Religion', "What is your present religion, if any?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]], ['Protestant','Roman Catholic','Mormon','Eastern or Greek Orthodox','Jewish','Muslim','Buddhist','Hindu','Athiest','Agnostic','Nothing in Particular','Something else']), 'religpew_2016' : ('Religion (2016)', "What is your present religion, if any?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]], ['Protestant','Roman Catholic','Mormon','Eastern or Greek Orthodox','Jewish','Muslim','Buddhist','Hindu','Athiest','Agnostic','Nothing in Particular','Something else']), 'gunown_baseline' : ('Gun Ownership', "Do you or does anyone in your household own a gun?", [[1],[2]], ['Yes', 'No']), 'gunown_2016' : ('Gun Ownership (2016)', "Do you or does anyone in your household own a gun?", [[1],[2],[3],[8]], ['Personally own a gun', 'Gun in household', 'No Guns', 'Don\'t know']), 'knowgay4_basline' : ('Know an LGBT Person', "Do you personally know anybody who is gay, lesbian, bisexual, or transgender?", [[1],[2]], ['Yes', 'No']), 'gender_baseline' : ('Gender', "Are you male or female?", [[1],[2]], ['Male','Female']), 'race_baseline' : ('Race', "What racial or ethnic group best describes you?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['White','Black','Hispanic','Asian','Native American','Mixed','Other','Middle Eastern']), 'educ_baseline' : ('Education', "What is the highest level of education you have completed?", [[1],[2],[3],[4],[5],[6]], ['No HS', 'High School', 'Some college', '2 year', '4 year', 'Post Grad']), 'employstat2_basline' : ('Employment Status', "What is your employment status?", [[1],[2],[3],[4],[5],[6],[7],[8], [9]], ['Full-time employed','Part-time employed','Self-employed','Unemployed or temporarily laid off','Retired','Permanently disabled','Homemaker', 'Student','Other']), 'employ_2016' : ('Employment Status (2016)', "What is your employment status?", [[1],[2],[3],[4],[5],[6],[7],[8], [9]], ['Full-time employed','Part-time employed','Self-employed','Unemployed or temporarily laid off','Retired','Permanently disabled','Homemaker', 'Student','Other']), 'faminc_baseline' : ('Family Income', "Thinking back over the last year, was your family's annual what income?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[31],[97]], ['<10k', '10-20k', '20-30k','30-40k', '40-50k', '50-60k', '60-70k', '70-80k', '80-100k', '100-120k', '120-150k', '150-200k', '200-250k', '250-350k', '350-500k', '500k+', '150k+', 'Prefer not to say']), 'faminc_2016' : ('Family Income', "Thinking back over the last year, was your family's annual what income?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[31],[97]], ['<10k', '10-20k', '20-30k','30-40k', '40-50k', '50-60k', '60-70k', '70-80k', '80-100k', '100-120k', '120-150k', '150-200k', '200-250k', '250-350k', '350-500k', '500k+', '150k+', 'Prefer not to say']), 'votereg2_2016' : ('Voter Registration', "Are you currently registered to vote?", [[1],[2], [3]], ['Yes', 'No', 'Don\'t Know']), 'turnout16_2016' : ('Voter Turnout', "Did you vote in the election on Tuesday, November 8th?", [[1],[2]], ['Yes', 'No']), 'presvote16post_2016' : ('2016 Presidential Vote', "Who did you vote for in the 2016 Presidential Election?", [[1],[2],[3], [4], [5], [6], [7]], ['<NAME>', '<NAME>', '<NAME>', '<NAME>', '<NAME>', 'Other', 'Didn\'t vote for Pres']), 'vote2016_cand2_2016' : ('Vote for or against', "Was your vote primarily a vote in favor of your choice or was it mostly a vote against the opponent?", [[1],[2]], ['For candidate', 'Against Opponent']), 'Sanders_Trump_2016' : ('Sanders vs. Trump', "If the 2016 election had been a race between <NAME> and <NAME>, who would you have voted for?", [[1],[2],[3]], ['Sanders', 'Trump', 'Don\'t Know']), 'vote_regrets_2016' : ('Voter Regret', "At this point, do you have any regrets about your vote in the 2016 Presidential Election?", [[1],[2]], ['Yes', 'No']), 'fav_trump_2016' : ('Trump Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_cruz_2016' : ('Cruz Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_ryan_2016' : ('Ryan Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_romn_2016' : ('Romney Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_obama_2016' : ('Obama Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_hrc_2016' : ('Hillary Clinton Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_sanders_2016' : ('Sanders Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'RIGGED_SYSTEM_1_2016' : ('Rigged System', "Agree or Disagree: Elections today don't matter; things stay the same no matter who we vote in.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_2_2016' : ('Fair Society', "Agree or Disagree: America is a fair society where everyone has the opportunity to get ahead", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_3_2016' : ('Economic system favors the wealthy', "Agree or Disagree: our economic system is biased in favor of the wealthiest Americans.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_4_2016' : ('Media Trust', "Agree or Disagree: You can't believe what you hear from the mainstream media.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_5_2016' : ('Government Accountability', "Agree or Disagree: People like me don't have any say in what the government does.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'americatrend_2016' : ('Life Better or Worse', "In general, would you say life in America today is better, worse, or about the same for people like you?", [[1],[2],[3],[4]], ['Better','About the same', 'Worse', 'Don\'t Know']), 'trustgovt_2016' : ('Trust government to do what\'s right (2016)', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'immi_muslim_2016' : ('Muslim Ban', "Do you favor or oppose temporarily banning Muslims from other countries from entering the United States?", [[1],[2],[3],[4],[8]], ['Strongly Favor', 'Somewhat Favor', 'Somwhat oppose', 'Strongly oppose', 'Not sure']), 'taxdoug_2016' : ('Raising Taxes for the Wealthy (2016)', "Do you favor raising taxes on families making over 200,000 dollars per year?", [[1],[2],[3]], ['Yes', 'No', 'Don\'t Know']), 'reverse_discrimination_2016' : ('Reverse Discrimination', "Today discrimination against whites has become as big a problem as discrimination against blacks and other minorities.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'ideo5_2016' : ('Ideology (2016)', "Thinking about politics these days, how would you describe your own political viewpoint?", [[1],[2],[3],[4],[5],[6]], ['Very Liberal', 'Liberal', 'Moderate', 'Conservative','Very Conservative', 'Not Sure']), 'pp_primary16_2016' : ('Primary Vote (2016)', "Did you vote in the Presidential Primary this spring?", [[1],[2],[3],[4]], ['Democratic Primary','Republican Primary','Not in either', 'Not sure']), 'pp_demprim16_2016' : ('Democratic Primary (2016)', "Who did you vote for in the Democratic Primary?", [[1],[2],[3],[4]], ['<NAME>', '<NAME>', 'Someone else', 'Don\'t Recall']), 'pp_repprim16_2016' : ('Republican Primary (2016)', "Who did you vote for in the Republican Primary?", [[1],[2],[3],[4],[5],[6]], ['<NAME>', '<NAME>', '<NAME>', '<NAME>', 'Someone else', 'Don\'t recall']), 'ft_black_2016' : ('Feelings about Blacks', "Feelings toward group -- Blacks", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_white_2016' : ('Feelings about Whites', "Feelings toward group -- Whites", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_hisp_2016' : ('Feelings about Hispanics', "Feelings toward group -- Hispanics", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_muslim_2016' : ('Feelings about Muslims', "Feelings toward group -- Muslims", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_fem_2016' : ('Feelings about Feminists', "Feelings toward group -- Feminists", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_immig_2016' : ('Feelings about Immigrants', "Feelings toward group -- Immigrants", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_blm_2016' : ('Feelings about Black Lives Matter', "Feelings toward group -- Black Lives Matter", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_wallst_2016' : ('Feelings about Wall Street Bankers', "Feelings toward group -- Wall Street Bankers", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_gays_2016' : ('Feelings about Gays', "Feelings toward group -- Gays", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_police_2016' : ('Feelings about Police', "Feelings toward group -- Police", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_altright_2016' : ('Feelings about The Alt Right', "Feelings toward group -- The Alt Right", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'birthyr_baseline' : ('Age', "Repondents Age", [[i for i in range(1921, 1951)], [i for i in range(1951, 1971)], [i for i in range(1971, 1986)], [i for i in range(1986, 1995)]], ['18-29', '30-44', '45-64', '65+']) }
polls.py
polls = { 'newsint2_baseline' : ('Interest in news and public affairs', 'Some people seem to follow what\'s going on in government and public affairs most of the time, whether there\'s an election going on or not. Others aren\'t that interested. Would you say you follow what\'s going on in government and public affairs ...?', [[1], [2], [3], [4]], ['Most of the time', 'Some of the time', 'Only now and then', 'Hardly at all']), 'newsint_2016' : ('Political Interest', 'Some people seem to follow what\'s going on in government and public affairs most of the time, whether there\'s an election going on or not. Others aren\'t that interested. Would you say you follow what\'s going on in government and public affairs ...?', [[1], [2], [3], [4]], ['Most of the time', 'Some of the time', 'Only now and then', 'Hardly at all']), 'track_baseline' : ('Direction of the country', 'Would you say things in the country are...', [[1], [2], [3]], ['Generally headed in the right direction', 'Off on the wrong track','Not sure']), 'track_2016' : ('Direction of the country (2016)', 'Would you say things in the country are...', [[1], [2], [3]], ['Generally headed in the right direction', 'Off on the wrong track','Not sure']), 'americatrend_2016' : ('Life in America today for people like R compared to fifty years ago', 'In general, would you say life in America today is better, worse, or about the same as it was fifty years ago for people like you?', [[1], [2], [3], [4]], ['Better', 'About the same', 'Worse', 'Don\'t Know']), 'wealth_2016' : ('Distribution of money and wealth in this country', 'Do you feel that the distribution of money and wealth in this country is fair, or do you feel that the money and wealth in this country should be more evenly distributed among more people?', [[1], [2], [8]], ['Distribution is fair', 'Should be more evenly distributed', 'Don\'t know']), 'values_culture_2016' : ('In America, values and culture of people like R are...', 'In America today, do you feel the values and culture of people like you are:', [[1], [2], [3], [8]], ['Generally becoming more widespread and accepted', 'Holding Steady', 'Generally becoming rarer', 'Don\'t Know']), 'trustgovt_baseline' : ('Trust government to do what\'s right', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'trustgovt_2016' : ('Trust government (2016)', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'trust_people_2016' : ('Most people can/can\'t be trusted', 'Generally speaking, would you say that most people can be trusted or that you can\'t be too careful in dealing with people?', [[1], [2], [8]], ['Can\'t be too careful in dealing with people', 'Most people can be trusted', 'Don\'t know']), 'helpful_people_2016' : ('People try to be helpful or are they mostly just looking out for themselves', 'Would you say that most of the time people try to be helpful, or that they are mostly just looking out for themselves?', [[1], [2], [8]], ['People try to be helpful', 'People are looking out for themselves', 'Don\'t know']), 'obamaapp_baseline' : ('Barack Obama Approval', "Do you approve or dissaprove of the way Barack Obama is handlind his job as president?", [[1],[2],[3],[4],[5]], ['Stronly approve', 'Somewhat approve', 'Somewhat disapprove', 'Strongly disapprove', 'Not Sure']), 'obamaapp_2016' : ('Barack Obama Approval (2016)', "Do you approve or dissaprove of the way <NAME> is handlind his job as president?", [[1],[2],[3],[4],[5]], ['Stronly approve', 'Somewhat approve', 'Somewhat disapprove', 'Strongly disapprove', 'Not Sure']), 'watchtv_baseline' : ('Hours watch TV daily', "On a typical weekday, how many hours of TV do you watch?", [[1],[2],[3],[4]], ['None', '1-2 Hours', '3-4 Hours', 'More than 4 hours']), 'ideo5_baseline' : ('Ideology', "Thinking about politics these days, how would you describe your own political viewpoint?", [[1],[2],[3],[4],[5],[6]], ['Very Liberal', 'Liberal', 'Moderate', 'Conservative', 'Very Conservative', 'Not Sure']), 'imiss_a_baseline' : ('Issue Importance: Iraq War', "How important are the following issues to you -- The War in Iraq?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_b_baseline' : ('Issue Importance: The Economy', "How important are the following issues to you -- The economy?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_c_baseline' : ('Issue Importance: Immigration', "How important are the following issues to you -- Immigration?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_d_baseline' : ('Issue Importance: The Environment', "How important are the following issues to you -- The Environment?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_f_baseline' : ('Issue Importance: Terrorism', "How important are the following issues to you -- Terrorism?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_g_baseline' : ('Issue Importance: Gay Rights', "How important are the following issues to you -- Gay Rights?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_baseline' : ('Issue Importance: Education', "How important are the following issues to you -- Education?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_j_baseline' : ('Issue Importance: Health Care', "How important are the following issues to you -- Health Care?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_m_baseline' : ('Issue Importance: Social Security', "How important are the following issues to you -- Social Security?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_p_baseline' : ('Issue Importance: The Budget Deficit', "How important are the following issues to you -- The Budget Deficit?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_q_baseline' : ('Issue Importance: The War in Afganistan', "How important are the following issues to you -- The War in Afganistan?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_r_baseline' : ('Issue Importance: Taxes', "How important are the following issues to you -- Taxes?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_s_baseline' : ('Issue Importance: Medicare', "How important are the following issues to you -- Medicare?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_t_baseline' : ('Issue Importance: Abortion', "How important are the following issues to you -- Abortion?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_a_2016' : ('Issue Importance: Crime (2016)', "How important are the following issues to you -- Crime?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_b_2016' : ('Issue Importance: The Economy (2016)', "How important are the following issues to you -- The economy?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_c_2016' : ('Issue Importance: Immigration (2016)', "How important are the following issues to you -- Immigration?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_d_2016' : ('Issue Importance: The Environment (2016)', "How important are the following issues to you -- The Environment?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_e_2016' : ('Issue Importance: Religious Liberty (2016)', "How important are the following issues to you -- Religious Liberty?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_f_2016' : ('Issue Importance: Terrorism (2016)', "How important are the following issues to you -- Terrorism?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_g_2016' : ('Issue Importance: Gay Rights (2016)', "How important are the following issues to you -- Gay Rights?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_2016' : ('Issue Importance: Education (2016)', "How important are the following issues to you -- Education?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_h_2016' : ('Issue Importance: Family and Medical Leave (2016)', "How important are the following issues to you -- Family and Medical Leave?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_j_2016' : ('Issue Importance: Health Care (2016)', "How important are the following issues to you -- Health Care?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_k_2016' : ('Issue Importance: Money in Politics (2016)', "How important are the following issues to you -- Money in Politics?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_l_2016' : ('Issue Importance: Climate Change (2016)', "How important are the following issues to you -- Climate Change?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_m_2016' : ('Issue Importance: Social Security', "How important are the following issues to you -- Social Security?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_n_2016' : ('Issue Importance: Infrastructure Investment', "How important are the following issues to you -- Infrastructure Investment'?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_o_2016' : ('Issue Importance: Jobs', "How important are the following issues to you -- Jobs'?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_p_2016' : ('Issue Importance: The Budget Deficit (2016)', "How important are the following issues to you -- The Budget Deficit?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_q_2016' : ('Issue Importance: Poverty', "How important are the following issues to you -- Poverty?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_r_2016' : ('Issue Importance: Taxes (2016)', "How important are the following issues to you -- Taxes?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_s_2016' : ('Issue Importance: Medicare (2016)', "How important are the following issues to you -- Medicare?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_t_2016' : ('Issue Importance: Abortion (2016)', "How important are the following issues to you -- Abortion?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_u_2016' : ('Issue Importance: The size of Government (2016)', "How important are the following issues to you -- The size of Government?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_x_2016' : ('Issue Importance: Racial Equality (2016)', "How important are the following issues to you -- Racial Equality?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imiss_y_2016' : ('Issue Importance: Gender Equality (2016)', "How important are the following issues to you -- Gender Equality?", [[1],[2],[3],[4]], ['Very Important', 'Somewhat Important','Not Very Important', 'Unimportant']), 'imissf_baseline' : ('Most important issues', "Which of these is most important to you?", [[1],[2],[3],[4],[6],[7],[8],[10],[13],[16],[17],[18],[19],[20]], ['The war in Iraq','The economy', 'Immigration', 'The Evironmment','Terrorism', 'Gay Rights','Education','Health Care','Social Security','The Budget Deficit','The War in Afganistan','Taxes','Medicade','Abortion']), 'immi_contribution_baseline' : ('Illegal Immigrants Contribute or Drain', "Overall, do you think illegal immigrants American society or are a drain?", [[1],[2],[3],[4]], ['Mostly make a contribution','Neither', 'Mostly a drain', 'Not Sure']), 'immi_contribution_2016' : ('Illegal Immigrants Contribute or Drain (2016)', "Overall, do you think illegal immigrants American society or are a drain?", [[1],[2],[3],[4]], ['Mostly make a contribution','Neither', 'Mostly a drain', 'Not Sure']), 'immi_naturalize_baseline' : ('Illegal Immigrant Naturalization', "Do you favor or oppose providing a legal way for illegal immigrants already in the United States to become U.S. citizens?", [[1], [2], [3]], ['Favor', 'Oppose', 'Not sure']), 'immi_naturalize_2016' : ('Illegal Immigrant Naturalization (2016)', "Do you favor or oppose providing a legal way for illegal immigrants already in the United States to become U.S. citizens?", [[1], [2], [3]], ['Favor', 'Oppose', 'Not sure']), 'immi_makedifficult_baseline' : ('Harder/Easier to Immigrate', "Do you think it should be easier or harder for foreigners to immigrate to the US?", [[1],[2],[3],[4],[5],[8]], ['Much easier', 'Slightly easier','No change','Slightly Harder','Much harder','Not sure']), 'immi_makedifficult_2016' : ('Harder/Easier to Immigrate (2016)', "Do you think it should be easier or harder for foreigners to immigrate to the US?", [[1],[2],[3],[4],[5],[8]], ['Much easier', 'Slightly easier','No change','Slightly Harder','Much harder','Not sure']), 'abortview3_baseline' : ('Abortion views', "Do you think abortion should be...", [[1],[2],[3],[8]], ['Legal in all cases','Legal in some cases and illegal in others','Illegal in all cases','Not sure']), 'abortview3_2016' : ('Abortion views (2016)', "Do you think abortion should be...", [[1],[2],[3],[8]], ['Legal in all cases','Legal in some cases and illegal in others','Illegal in all cases','Not sure']), 'gaymar2_baseline' : ('Gay Marriage', "Do you favor or oppose allowing gays and lesbians to marry legally?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'gaymar_2016' : ('Gay Marriage (2016)', "Do you favor or oppose allowing gays and lesbians to marry legally?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenalty_baseline' : ('Death Penalty', "Do you favor or oppose the death penatly for persons convicted of murder?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenfreq_baseline' : ('Death Penalty Frequency', "Do you think the death penalty enough?", [[1],[2],[3],[4]], ['Too often', 'About Right', 'Not Often Enough', 'Not Sure']), 'deathpen_2016' : ('Death Penalty (2016)', "Do you favor or oppose the death penatly for persons convicted of murder?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'deathpenfreq_2016' : ('Death Penalty Frequency (2016)', "Do you think the death penalty enough?", [[1],[2],[3],[8]], ['Too often', 'About Right', 'Not Often Enough', 'Don\'t Know']), 'taxwealth_baseline' : ('Increase Taxes on Wealthy', "Do you favor raising taxes on families with incomes over 200,000 dollars per year?", [[1],[2],[3]], ['Favor','Oppose','Not sure']), 'univhealthcov_baseline' : ('Federal government responsibility for healthcare', "Do you think it is the responsibility of the federal government to see to it that everyone has health care coverage?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'univhealthcov_2016' : ('Federal government responsibility for healthcare (2016)', "Do you think it is the responsibility of the federal government to see to it that everyone has health care coverage?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'envwarm_baseline' : ('Existence of Global Warming', "Some people say that global temperatures have been going up slowly over the past 100 years - the phenomenon called global warming. Do you think that global warming is happening?", [[1],[2],[3],[4],[5]], ['Defintely is happening', 'Probably is happening','Probably is not happening','Definitely is not happening', 'Not Sure']), 'envwarm_2016' : ('Existence of Global Warming (2016)', "Some people say that global temperatures have been going up slowly over the past 100 years - the phenomenon called global warming. Do you think that global warming is happening?", [[1],[2],[3],[4],[5]], ['Defintely is happening', 'Probably is happening','Probably is not happening','Definitely is not happening', 'Not Sure']), 'envser2_baseline' : ('Seriousness of Global Warming Problem', "How serious a problem do you think global warming is?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not Very', 'Not Sure']), 'envpoll2_baseline' : ('Cause of global warming', "Do you think global warming has been caused by pollution from human activities (such as emissions from cars and factories) or by natural causes?", [[1],[2],[3]], ['Pollution from human activities','Natural causes not related to human activities','Not sure']), 'envpoll2_2016' : ('Cause of global warming (2016)', "Do you think global warming has been caused by pollution from human activities (such as emissions from cars and factories) or by natural causes?", [[1],[2],[3]], ['Pollution from human activities','Natural causes not related to human activities','Not sure']), 'affirmact_gen_baseline' : ('Favor or oppose affirmative action for women and racial minorities', "Do you generally favor or oppose affirmative action programs for women and racial minorities?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'affirmact_gen_2016' : ('Favor or oppose affirmative action for women and racial minorities (2016)', "Do you generally favor or oppose affirmative action programs for women and racial minorities?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'tradepolicy_baseline' : ('Favor or oppose increasing trade', "Do you favor or oppose increasing trade with other nations?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'tradepolicy_2016' : ('Favor or oppose increasing trade (2016)', "Do you favor or oppose increasing trade with other nations?", [[1],[2],[8]], ['Favor','Oppose','Not Sure']), 'govt_reg_baseline' : ('Level of government regulation', "In general, do you think there of business by the government?", [[1],[2],[3],[8]], ['Too Much', 'About the right amount', 'Too little','Don\'t Know']), 'govt_reg_2016' : ('Level of government regulation (2016)', "In general, do you think there of business by the government?", [[1],[2],[3],[8]], ['Too Much', 'About the right amount','Too little', 'Don\'t Know']), 'pid7_baseline' : ('7 point party ID', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Strong Democrat','Not Very Strong Democrat','Lean Democrat','Independent','Lean Republican','Not very strong Republican','Strong Republican','Not sure']), 'pid7_2016' : ('7 point party ID (2016)', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Strong Democrat','Not Very Strong Democrat','Lean Democrat','Independent','Lean Republican','Not very strong Republican','Strong Republican','Not sure']), 'pid3_baseline' : ('3 point party ID', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5]], ['Democrat','Republican','Independent','Other','Not sure']), 'pid3_2016' : ('3 point party ID (2016)', "Generally speaking, do you think of yourself as a ...?", [[1],[2],[3],[4],[5]], ['Democrat','Republican','Independent','Other','Not sure']), 'vote_generic_baseline' : ('Generic Presidential Vote', "If an election for president was going to be held now, would you vote for...", [[1],[2],[3],[4],[5]], ['The Democratic Party','The Republican Party','Other','Not sure','I would not vote']), 'marstat_baseline' : ('Marital Status', "Marital Status", [[1],[2],[3],[4],[5],[6]], ['Married','Separated','Divorced','Widowed','Single','Domestic Partnership']), 'marstat_2016' : ('Marital Status (2016)', "Marital Status", [[1],[2],[3],[4],[5],[6]], ['Married','Separated','Divorced','Widowed','Single','Domestic Partnership']), 'teapartymemb_baseline' : ('Own involvement in Tea Party movement', "Do you think of yourself as a part of the Tea Party movement?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'teapartsup_baseline' : ('Support for Tea Party', "Generally speaking, do you support or oppose the goals of the Tea Party movement?", [[1],[2],[3],[4],[5],[8]], ['Strongly Support', 'Somewhat Support','Neither Support nor Oppose', 'Somewhat Oppose','Strongly Oppose', 'Not Sure']), 'selfdescr_ccap_1_baseline' : ('Self Described Libertarian', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Libertarian", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_2_baseline' : ('Self Described Socialist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Socialist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_3_baseline' : ('Self Described Green', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Green", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_4_baseline' : ('Self Described Environmentalist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Environmentalist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_5_baseline' : ('Self Described Liberal', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Liberal", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_6_baseline' : ('Self Described Moderate', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Moderate", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_7_baseline' : ('Self Described Conservative', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Conservative", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_8_baseline' : ('Self Described Radical', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Radical", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_9_baseline' : ('Self Described Progressive', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Progressive", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_10_baseline' : ('Self Described Traditional', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Traditional", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_11_baseline' : ('Self Described Christian', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Christian", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_12_baseline' : ('Self Described Feminist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Feminist", [[1],[2]], ['Yes', 'No']), 'selfdescr_ccap_13_baseline' : ('Self Described Fundamentalist', "Here are some words that people might use to describe themselves. Which of the following words, if any, would you use to describe yourself? Fundamentalist", [[1],[2]], ['Yes', 'No']), 'abortidentity_baseline' : ('Pro-life or Pro-Choice', "Would you call yourself as pro-life or pro-choice?", [[1],[2],[3],[4],[8]], ['Pro-life','Pro-choice','Both','Neither','Not Sure']), 'race_deservemore_baseline': ('Black deservedeness', "Agree or Disagree: over the past few years, Blacks have gotten less than they deserve.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_deservemore_2016': ('Black deservedeness (2016)', "Agree or Disagree: over the past few years, Blacks have gotten less than they deserve.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_overcome_baseline' : ('Irish, Italians, and Jews Overcoming Prejudice', "Agree or Disagree: Irish, Italian, Jewish and other minorities overcame prejudice and worked their way up. Blacks should do the same without any special favors.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_overcome_2016' : ('Irish, Italians, and Jews Overcoming Prejudice (2016)', "Agree or Disagree: Irish, Italian, Jewish and other minorities overcame prejudice and worked their way up. Blacks should do the same without any special favors.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_tryharder_baseline': ('Blacks should try harder', "It's really a matter of some people not trying hard enough; if blacks would only try harder they could be just as well off as whites.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_tryharder_2016': ('Blacks should try harder (2016)', "It's really a matter of some people not trying hard enough; if blacks would only try harder they could be just as well off as whites.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_slave_baseline' : ('Modern day impact of slavery', "Generation of slavery and discrimination have created conditions that make it difficult for black to work their way out of the lower class.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'race_slave_2016' : ('Modern day impact of slavery', "Generation of slavery and discrimination have created conditions that make it difficult for black to work their way out of the lower class.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'ownorrent_baseline' : ('Own or Rent', "Is the place you live owned or rented?", [[1],[2],[3]], ['Owned', 'Rented', 'Other']), 'reliablevoter_baseline': ('Voting frequency', "How often do you vote?", [[1],[2],[3],[4]], ['Always','Nearly Always', 'Part of the time', 'Seldom']), 'straighttic_baseline' : ('Partisan Voter Reliability', "Do you almost always vote for candidates from the same party or do you sometimes support candidates from different parties?", [[1],[2],[3]], ['Almost always vote Republican','Almost always vote Democrat','Vote for both Democrats and Republicans']), 'voted08_cap_baseline' : ('Voted in 2008 Presidential Election', "Did you happen to vote in the 2008 election?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'presvote08_baseline' : ('2008 Presidential Vote', "Which candidate did you vote for in the 2008 Presidential Election?", [[1],[2],[3,4,5]], ['<NAME>', '<NAME>', 'Other']), 'post_presvote12_2012' : ('2008 Presidential Vote', "Which candidate did you vote for in the 2012 Presidential Election?", [[1],[2],[3],[4],[5]], ['<NAME>', '<NAME>', 'Other', 'Didn\'t Vote in this race', 'Didn\'t vote', 'Not Sure']), 'congvote10_ccap_baseline' : ('2010 Vote', "Did you happen to vote in the 2010 election?", [[1],[2],[8]], ['Yes','No','Not Sure']), 'congvote10_ccap_baseline': ('2010 Congressional Vote', "Which candidate did you vote for in the U.S. House election?", [[1],[2],[3]], ['Democratic','Republican', 'Other']), 'fav_obama_baseline' : ( 'Barack Obama Favorability', "Do you have an unfavorable or favorable opinion on the following people -- Barack Obama", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_hrc_baseline' : ('<NAME> Favorability', "Do you have an unfavorable or favorable opinion on the following people -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'pew_bornagain_baseline' : ('Born Again Christains', "Would you describe yourself as Christian, or not?", [[1],[2]], ['Yes', 'No']), 'pew_bornagain_2016' : ('Born Again Christains (2016)', "Would you describe yourself as Christian, or not?", [[1],[2]], ['Yes', 'No']), 'pew_religimp_' : ('Imporance of religion', "How impotant is religion in your life?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not too imporant', 'Not at all']), 'pew_religimp_2016' : ('Imporance of religion (2016)', "How impotant is religion in your life?", [[1],[2],[3],[4]], ['Very', 'Somewhat', 'Not too imporant', 'Not at all']), 'pew_churchatd_baseline' : ('Church attendance', "Aside from weddings and funerals, how often do you attend religious services?", [[1],[2],[3],[4],[5],[6],[7]], ['More than once a week','Once a week','Once or twice a month','A few times a year','Seldom','Never','Don\'t know']), 'pew_churchatd_2016' : ('Church attendance (2016)', "Aside from weddings and funerals, how often do you attend religious services?", [[1],[2],[3],[4],[5],[6],[7]], ['More than once a week','Once a week','Once or twice a month','A few times a year','Seldom','Never','Don\'t know']), 'pew_prayer_baseline' : ('Frequency of prayer', "People practice their religion in different ways. Outside of attending religious services, how often do you pray?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Several time a day','Once a day','A few times a week','Once a week','A few times a month','Seldom','Never','Don\'t know']), 'pew_prayer_2016' : ('Frequency of prayer (2016)', "People practice their religion in different ways. Outside of attending religious services, how often do you pray?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['Several time a day','Once a day','A few times a week','Once a week','A few times a month','Seldom','Never','Don\'t know']), 'religpew_basline' : ('Religion', "What is your present religion, if any?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]], ['Protestant','Roman Catholic','Mormon','Eastern or Greek Orthodox','Jewish','Muslim','Buddhist','Hindu','Athiest','Agnostic','Nothing in Particular','Something else']), 'religpew_2016' : ('Religion (2016)', "What is your present religion, if any?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]], ['Protestant','Roman Catholic','Mormon','Eastern or Greek Orthodox','Jewish','Muslim','Buddhist','Hindu','Athiest','Agnostic','Nothing in Particular','Something else']), 'gunown_baseline' : ('Gun Ownership', "Do you or does anyone in your household own a gun?", [[1],[2]], ['Yes', 'No']), 'gunown_2016' : ('Gun Ownership (2016)', "Do you or does anyone in your household own a gun?", [[1],[2],[3],[8]], ['Personally own a gun', 'Gun in household', 'No Guns', 'Don\'t know']), 'knowgay4_basline' : ('Know an LGBT Person', "Do you personally know anybody who is gay, lesbian, bisexual, or transgender?", [[1],[2]], ['Yes', 'No']), 'gender_baseline' : ('Gender', "Are you male or female?", [[1],[2]], ['Male','Female']), 'race_baseline' : ('Race', "What racial or ethnic group best describes you?", [[1],[2],[3],[4],[5],[6],[7],[8]], ['White','Black','Hispanic','Asian','Native American','Mixed','Other','Middle Eastern']), 'educ_baseline' : ('Education', "What is the highest level of education you have completed?", [[1],[2],[3],[4],[5],[6]], ['No HS', 'High School', 'Some college', '2 year', '4 year', 'Post Grad']), 'employstat2_basline' : ('Employment Status', "What is your employment status?", [[1],[2],[3],[4],[5],[6],[7],[8], [9]], ['Full-time employed','Part-time employed','Self-employed','Unemployed or temporarily laid off','Retired','Permanently disabled','Homemaker', 'Student','Other']), 'employ_2016' : ('Employment Status (2016)', "What is your employment status?", [[1],[2],[3],[4],[5],[6],[7],[8], [9]], ['Full-time employed','Part-time employed','Self-employed','Unemployed or temporarily laid off','Retired','Permanently disabled','Homemaker', 'Student','Other']), 'faminc_baseline' : ('Family Income', "Thinking back over the last year, was your family's annual what income?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[31],[97]], ['<10k', '10-20k', '20-30k','30-40k', '40-50k', '50-60k', '60-70k', '70-80k', '80-100k', '100-120k', '120-150k', '150-200k', '200-250k', '250-350k', '350-500k', '500k+', '150k+', 'Prefer not to say']), 'faminc_2016' : ('Family Income', "Thinking back over the last year, was your family's annual what income?", [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[31],[97]], ['<10k', '10-20k', '20-30k','30-40k', '40-50k', '50-60k', '60-70k', '70-80k', '80-100k', '100-120k', '120-150k', '150-200k', '200-250k', '250-350k', '350-500k', '500k+', '150k+', 'Prefer not to say']), 'votereg2_2016' : ('Voter Registration', "Are you currently registered to vote?", [[1],[2], [3]], ['Yes', 'No', 'Don\'t Know']), 'turnout16_2016' : ('Voter Turnout', "Did you vote in the election on Tuesday, November 8th?", [[1],[2]], ['Yes', 'No']), 'presvote16post_2016' : ('2016 Presidential Vote', "Who did you vote for in the 2016 Presidential Election?", [[1],[2],[3], [4], [5], [6], [7]], ['<NAME>', '<NAME>', '<NAME>', '<NAME>', '<NAME>', 'Other', 'Didn\'t vote for Pres']), 'vote2016_cand2_2016' : ('Vote for or against', "Was your vote primarily a vote in favor of your choice or was it mostly a vote against the opponent?", [[1],[2]], ['For candidate', 'Against Opponent']), 'Sanders_Trump_2016' : ('Sanders vs. Trump', "If the 2016 election had been a race between <NAME> and <NAME>, who would you have voted for?", [[1],[2],[3]], ['Sanders', 'Trump', 'Don\'t Know']), 'vote_regrets_2016' : ('Voter Regret', "At this point, do you have any regrets about your vote in the 2016 Presidential Election?", [[1],[2]], ['Yes', 'No']), 'fav_trump_2016' : ('Trump Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_cruz_2016' : ('Cruz Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_ryan_2016' : ('Ryan Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_romn_2016' : ('Romney Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_obama_2016' : ('Obama Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_hrc_2016' : ('Hillary Clinton Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'fav_sanders_2016' : ('Sanders Favorability', "Do you have a favorable or unfavorable view of the following person -- <NAME>", [[1],[2],[3],[4],[8]], ['Very favorable','Somewhat favorable','Somewhat unfavorable','Very unfavorable','Don\'t know']), 'RIGGED_SYSTEM_1_2016' : ('Rigged System', "Agree or Disagree: Elections today don't matter; things stay the same no matter who we vote in.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_2_2016' : ('Fair Society', "Agree or Disagree: America is a fair society where everyone has the opportunity to get ahead", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_3_2016' : ('Economic system favors the wealthy', "Agree or Disagree: our economic system is biased in favor of the wealthiest Americans.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_4_2016' : ('Media Trust', "Agree or Disagree: You can't believe what you hear from the mainstream media.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'RIGGED_SYSTEM_5_2016' : ('Government Accountability', "Agree or Disagree: People like me don't have any say in what the government does.", [[1],[2],[3],[4]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree']), 'americatrend_2016' : ('Life Better or Worse', "In general, would you say life in America today is better, worse, or about the same for people like you?", [[1],[2],[3],[4]], ['Better','About the same', 'Worse', 'Don\'t Know']), 'trustgovt_2016' : ('Trust government to do what\'s right (2016)', 'How much of the time do you think you can trust the government in Washington to do what is right?', [[1], [2], [3]], ['Just about always', 'Most of the time', 'Some of the time']), 'immi_muslim_2016' : ('Muslim Ban', "Do you favor or oppose temporarily banning Muslims from other countries from entering the United States?", [[1],[2],[3],[4],[8]], ['Strongly Favor', 'Somewhat Favor', 'Somwhat oppose', 'Strongly oppose', 'Not sure']), 'taxdoug_2016' : ('Raising Taxes for the Wealthy (2016)', "Do you favor raising taxes on families making over 200,000 dollars per year?", [[1],[2],[3]], ['Yes', 'No', 'Don\'t Know']), 'reverse_discrimination_2016' : ('Reverse Discrimination', "Today discrimination against whites has become as big a problem as discrimination against blacks and other minorities.", [[1],[2],[3],[4],[5]], ['Strongly Agree', 'Agree', 'Don\'t know','Disagree', 'Strongly Disagree']), 'ideo5_2016' : ('Ideology (2016)', "Thinking about politics these days, how would you describe your own political viewpoint?", [[1],[2],[3],[4],[5],[6]], ['Very Liberal', 'Liberal', 'Moderate', 'Conservative','Very Conservative', 'Not Sure']), 'pp_primary16_2016' : ('Primary Vote (2016)', "Did you vote in the Presidential Primary this spring?", [[1],[2],[3],[4]], ['Democratic Primary','Republican Primary','Not in either', 'Not sure']), 'pp_demprim16_2016' : ('Democratic Primary (2016)', "Who did you vote for in the Democratic Primary?", [[1],[2],[3],[4]], ['<NAME>', '<NAME>', 'Someone else', 'Don\'t Recall']), 'pp_repprim16_2016' : ('Republican Primary (2016)', "Who did you vote for in the Republican Primary?", [[1],[2],[3],[4],[5],[6]], ['<NAME>', '<NAME>', '<NAME>', '<NAME>', 'Someone else', 'Don\'t recall']), 'ft_black_2016' : ('Feelings about Blacks', "Feelings toward group -- Blacks", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_white_2016' : ('Feelings about Whites', "Feelings toward group -- Whites", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_hisp_2016' : ('Feelings about Hispanics', "Feelings toward group -- Hispanics", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_muslim_2016' : ('Feelings about Muslims', "Feelings toward group -- Muslims", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_fem_2016' : ('Feelings about Feminists', "Feelings toward group -- Feminists", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_immig_2016' : ('Feelings about Immigrants', "Feelings toward group -- Immigrants", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_blm_2016' : ('Feelings about Black Lives Matter', "Feelings toward group -- Black Lives Matter", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_wallst_2016' : ('Feelings about Wall Street Bankers', "Feelings toward group -- Wall Street Bankers", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_gays_2016' : ('Feelings about Gays', "Feelings toward group -- Gays", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_police_2016' : ('Feelings about Police', "Feelings toward group -- Police", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'ft_altright_2016' : ('Feelings about The Alt Right', "Feelings toward group -- The Alt Right", [[0], [i for i in range(1,25)], [25], [i for i in range(26,50)], [50], [i for i in range(51,75)], [75], [i for i in range(76,100)], [100]], ['Very Cold', 'Cold', 'Fairly cold', 'Somewhat cold','No feeling at all', 'Somewhat warm', 'Fairly warm', 'Warm', 'Very warm']), 'birthyr_baseline' : ('Age', "Repondents Age", [[i for i in range(1921, 1951)], [i for i in range(1951, 1971)], [i for i in range(1971, 1986)], [i for i in range(1986, 1995)]], ['18-29', '30-44', '45-64', '65+']) }
0.272702
0.59884
import logging from apel.db.records.storage import StorageRecord from apel.db.records.group_attribute import GroupAttributeRecord from apel.common.datetime_utils import parse_timestamp from xml_parser import XMLParser, XMLParserException log = logging.getLogger(__name__) class StarParser(XMLParser): ''' Parser for Storage Accounting Records For documentation please visit: https://twiki.cern.ch/twiki/bin/view/EMI/StorageAccounting ''' NAMESPACE = "http://eu-emi.eu/namespaces/2011/02/storagerecord" def get_records(self): """ Returns list of parsed records from STAR file. Please notice that this parser _requires_ valid structure of XML document, including namespace information and prefixes in XML tag (like urf:StorageUsageRecord). """ records = [] xml_storage_records = self.doc.getElementsByTagNameNS( self.NAMESPACE, 'StorageUsageRecord') if len(xml_storage_records) == 0: raise XMLParserException('File does not contain StAR records!') for xml_storage_record in xml_storage_records: # get record and associated attributes record, group_attributes = self.parseStarRecord(xml_storage_record) # add all of them to the record list records.append(record) records += group_attributes return records def parseStarRecord(self, xml_storage_record): """ Parses single entry for Storage Accounting Record. Uses a dictionary containing fields from the storage record and methods to extract them from the XML. Returns a list of StorageRecords (plus GroupAttributeRecords if there are GroupAttributes that have an attributeType that is NOT subgroup or role). """ functions = { 'RecordId': lambda nodes: self.getAttr( nodes['RecordIdentity'][0], 'recordId'), 'CreateTime': lambda nodes: parse_timestamp(self.getAttr( nodes['RecordIdentity'][0], 'createTime')), 'StorageSystem': lambda nodes: self.getText( nodes['StorageSystem'][0].childNodes), 'Site': lambda nodes: self.getText( nodes['Site'][0].childNodes), 'StorageShare': lambda nodes: self.getText( nodes['StorageShare'][0].childNodes), 'StorageMedia': lambda nodes: self.getText( nodes['StorageMedia'][0].childNodes), 'StorageClass': lambda nodes: self.getText( nodes['StorageClass'][0].childNodes), 'FileCount': lambda nodes: self.getText( nodes['FileCount'][0].childNodes), 'DirectoryPath': lambda nodes: self.getText( nodes['DirectoryPath'][0].childNodes), 'LocalUser': lambda nodes: self.getText( nodes['LocalUser'][0].childNodes), 'LocalGroup': lambda nodes: self.getText( nodes['LocalGroup'][0].childNodes), 'UserIdentity': lambda nodes: self.getText( nodes['UserIdentity'][0].childNodes), 'Group': lambda nodes: self.getText( nodes['Group'][0].childNodes), 'SubGroup': lambda nodes: self.getText(self.getTagByAttr( nodes['SubGroup'], 'attributeType', 'subgroup')[0].childNodes), 'Role': lambda nodes: self.getText(self.getTagByAttr( nodes['Role'], 'attributeType', 'role')[0].childNodes), 'StartTime': lambda nodes: parse_timestamp(self.getText( nodes['StartTime'][0].childNodes)), 'EndTime': lambda nodes: parse_timestamp(self.getText( nodes['EndTime'][0].childNodes)), 'ResourceCapacityUsed': lambda nodes: self.getText( nodes['ResourceCapacityUsed'][0].childNodes), 'LogicalCapacityUsed': lambda nodes: self.getText( nodes['LogicalCapacityUsed'][0].childNodes), 'ResourceCapacityAllocated': lambda nodes: self.getText( nodes['ResourceCapacityAllocated'][0].childNodes) } # Here we copy keys from functions. # We only want to change 'RecordId' to 'RecordIdentity'. nodes = {}.fromkeys(map(lambda f: f == 'RecordId' and 'RecordIdentity' or f, [S for S in functions])) # nodes = {}.fromkeys(functions.keys()) data = {} for node in nodes: if node in ('SubGroup', 'Role'): # For these attributes we need to dig into the GroupAttribute # elements to get the values so we save the whole elements. nodes[node] = xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, 'GroupAttribute') else: nodes[node] = xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, node) # empty list = element have not been found in XML file for field in functions: try: data[field] = functions[field](nodes) except (IndexError, KeyError), e: log.debug("Failed to get field %s: %s", field, e) sr = StorageRecord() sr.set_all(data) return sr, self.parseGroupAttributes( xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, 'GroupAttribute'), sr.get_field('RecordId')) def parseGroupAttributes(self, nodes, star_record_id): """ Return a list of GroupAttributeRecords associated with a StarRecord. Only returns records for attributeTypes other than subgroup and role as those two types are stored in the StarRecord. """ ret = [] for node in nodes: attr_type = self.getAttr(node, 'attributeType') # Only create records for types other than subgroup and role if attr_type not in ('subgroup', 'role'): group_attr = GroupAttributeRecord() group_attr.set_field('StarRecordID', star_record_id) group_attr.set_field('AttributeType', attr_type) attr_value = self.getText(node.childNodes) group_attr.set_field('AttributeValue', attr_value) ret.append(group_attr) return ret
apel/db/loader/star_parser.py
import logging from apel.db.records.storage import StorageRecord from apel.db.records.group_attribute import GroupAttributeRecord from apel.common.datetime_utils import parse_timestamp from xml_parser import XMLParser, XMLParserException log = logging.getLogger(__name__) class StarParser(XMLParser): ''' Parser for Storage Accounting Records For documentation please visit: https://twiki.cern.ch/twiki/bin/view/EMI/StorageAccounting ''' NAMESPACE = "http://eu-emi.eu/namespaces/2011/02/storagerecord" def get_records(self): """ Returns list of parsed records from STAR file. Please notice that this parser _requires_ valid structure of XML document, including namespace information and prefixes in XML tag (like urf:StorageUsageRecord). """ records = [] xml_storage_records = self.doc.getElementsByTagNameNS( self.NAMESPACE, 'StorageUsageRecord') if len(xml_storage_records) == 0: raise XMLParserException('File does not contain StAR records!') for xml_storage_record in xml_storage_records: # get record and associated attributes record, group_attributes = self.parseStarRecord(xml_storage_record) # add all of them to the record list records.append(record) records += group_attributes return records def parseStarRecord(self, xml_storage_record): """ Parses single entry for Storage Accounting Record. Uses a dictionary containing fields from the storage record and methods to extract them from the XML. Returns a list of StorageRecords (plus GroupAttributeRecords if there are GroupAttributes that have an attributeType that is NOT subgroup or role). """ functions = { 'RecordId': lambda nodes: self.getAttr( nodes['RecordIdentity'][0], 'recordId'), 'CreateTime': lambda nodes: parse_timestamp(self.getAttr( nodes['RecordIdentity'][0], 'createTime')), 'StorageSystem': lambda nodes: self.getText( nodes['StorageSystem'][0].childNodes), 'Site': lambda nodes: self.getText( nodes['Site'][0].childNodes), 'StorageShare': lambda nodes: self.getText( nodes['StorageShare'][0].childNodes), 'StorageMedia': lambda nodes: self.getText( nodes['StorageMedia'][0].childNodes), 'StorageClass': lambda nodes: self.getText( nodes['StorageClass'][0].childNodes), 'FileCount': lambda nodes: self.getText( nodes['FileCount'][0].childNodes), 'DirectoryPath': lambda nodes: self.getText( nodes['DirectoryPath'][0].childNodes), 'LocalUser': lambda nodes: self.getText( nodes['LocalUser'][0].childNodes), 'LocalGroup': lambda nodes: self.getText( nodes['LocalGroup'][0].childNodes), 'UserIdentity': lambda nodes: self.getText( nodes['UserIdentity'][0].childNodes), 'Group': lambda nodes: self.getText( nodes['Group'][0].childNodes), 'SubGroup': lambda nodes: self.getText(self.getTagByAttr( nodes['SubGroup'], 'attributeType', 'subgroup')[0].childNodes), 'Role': lambda nodes: self.getText(self.getTagByAttr( nodes['Role'], 'attributeType', 'role')[0].childNodes), 'StartTime': lambda nodes: parse_timestamp(self.getText( nodes['StartTime'][0].childNodes)), 'EndTime': lambda nodes: parse_timestamp(self.getText( nodes['EndTime'][0].childNodes)), 'ResourceCapacityUsed': lambda nodes: self.getText( nodes['ResourceCapacityUsed'][0].childNodes), 'LogicalCapacityUsed': lambda nodes: self.getText( nodes['LogicalCapacityUsed'][0].childNodes), 'ResourceCapacityAllocated': lambda nodes: self.getText( nodes['ResourceCapacityAllocated'][0].childNodes) } # Here we copy keys from functions. # We only want to change 'RecordId' to 'RecordIdentity'. nodes = {}.fromkeys(map(lambda f: f == 'RecordId' and 'RecordIdentity' or f, [S for S in functions])) # nodes = {}.fromkeys(functions.keys()) data = {} for node in nodes: if node in ('SubGroup', 'Role'): # For these attributes we need to dig into the GroupAttribute # elements to get the values so we save the whole elements. nodes[node] = xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, 'GroupAttribute') else: nodes[node] = xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, node) # empty list = element have not been found in XML file for field in functions: try: data[field] = functions[field](nodes) except (IndexError, KeyError), e: log.debug("Failed to get field %s: %s", field, e) sr = StorageRecord() sr.set_all(data) return sr, self.parseGroupAttributes( xml_storage_record.getElementsByTagNameNS( self.NAMESPACE, 'GroupAttribute'), sr.get_field('RecordId')) def parseGroupAttributes(self, nodes, star_record_id): """ Return a list of GroupAttributeRecords associated with a StarRecord. Only returns records for attributeTypes other than subgroup and role as those two types are stored in the StarRecord. """ ret = [] for node in nodes: attr_type = self.getAttr(node, 'attributeType') # Only create records for types other than subgroup and role if attr_type not in ('subgroup', 'role'): group_attr = GroupAttributeRecord() group_attr.set_field('StarRecordID', star_record_id) group_attr.set_field('AttributeType', attr_type) attr_value = self.getText(node.childNodes) group_attr.set_field('AttributeValue', attr_value) ret.append(group_attr) return ret
0.456894
0.232795
import sys import ast import vim import os.path import pkgutil class Pin: def __init__(self): self.cWORD = vim.eval("expand('<cWORD>')") self.cword = vim.eval("expand('<cword>')") self.cline = vim.eval("getline('.')") if self.cWORD in ["import", "from", "as"]: raise ValueError( "The current word is an import statement keyword: " "'import', 'from', 'as'." ) def navigate(self): # Parse the current line into an abstract syntax tree. This should # fail if the current line is not syntactically correct Python 2. try: self.lineTree = ast.parse(self.cline) except SyntaxError as se: print se raise ImportError( "Import navigation failed. There is a syntax error on the " "cursor's line.\n\n" "Note: PIN only considers the current line of source code the " "cursor is on.\n" "Is this line a syntactically correct import statement?" ) except TypeError as te: print te raise ImportError( "Import navigation failed. There are null bytes on the cursor's " "line.\n\n" "Note: PIN only considers the current line of source code the " "cursor is on.\n" ) importTree = self.extractImportTree(self.lineTree) module = self.extractModule(importTree) package = pkgutil.get_loader(module) if package is None: raise ImportError("This module cannot be loaded.") if os.path.isdir(package.filename): if os.path.isfile(os.path.join(package.filename, "__init__.py")): filename = os.path.join(package.filename, "__init__.py") else: raise ValueError("Unable to locate the module's file") else: filename = package.filename vim.command("tabnew {file}".format(file=filename)) def extractImportTree(self, tree): """ Return the subtree rooted at the import statement containing the descendant cword. """ # Extract the subtree rooted at the Import or ImportFrom node # associated to the lexeme given by cword. # If there is no import statement in lineTree raise a ValueError def checkNames(tree): for node in ast.walk(tree): if isinstance(node, ast.alias) and\ (node.name == self.cword or\ node.asname == self.cword or\ node.name == self.cWORD): return True return False if len(tree.body) == 1: node = tree.body[0] if isinstance(node, ast.Import) or\ isinstance(node, ast.ImportFrom): return node for node in ast.walk(tree): if isinstance(node, ast.Import) and checkNames(node): return node if isinstance(node, ast.ImportFrom) and\ (checkNames(node) or self.cWORD == node.module): return node raise ValueError("The current word is not part of an import statement") # Extract the module that contains cword; this may be cword itself. def extractModule(self, tree): """ Return the module name containing cword """ if isinstance(tree, ast.Import): return self.extractModuleFromImport(tree) else: return self.extractModuleFromImportFrom(tree) def extractModuleFromImport(self, tree): """ Return the name of the module containing cword. tree must be an ast.Import node. It is therefore the case that for one of tree's ast.alias nodes: 1) cword and cWORD are equal to the asname of the alias OR 2) cWORD is equal to the name of the alias and cword is equal to one of the dot delimited name components """ if not isinstance(tree, ast.Import): raise TypeError("Did not receive an ast.Import node.") for node in tree.names: if self.cword == node.asname: return node.name if self.cWORD in [node.name, node.asname]: return node.name raise ValueError( "ast.Import node tree does not contain a descendant " "with the current word under the cursor." ) def extractModuleFromImportFrom(self, tree): """ Return the name of the module containing cword. tree must be an ast.ImportFrom node. Therefore either: 1) cWORD is equal to the tree's module attribute and cword is equal to one of the dot delimited components of module OR 2) cword and cWORD are equal to the name or asname of one of the ast.alias child nodes of tree """ if not isinstance(tree, ast.ImportFrom): raise TypeError("Did not receive an ast.ImportFrom node.") if tree.module is None: packagePath = os.path.dirname(vim.eval("expand('%:p')")) sys.path.append(packagePath) module = os.path.basename(packagePath) tree.module = module if self.cWORD == '.': self.cWORD = module if self.cWORD == tree.module: return self.cWORD for node in tree.names: if self.cword in [node.name, node.asname]: if pkgutil.get_loader(node.name) is not None: return node.name else: return tree.module raise ValueError( "ast.ImportFrom node tree does not contain a descendant " "with the current word under the cursor." ) try: Pin().navigate() except ImportError as ie: print ie except ValueError as ve: print ve except TypeError as te: print te
ftplugin/python/pin.py
import sys import ast import vim import os.path import pkgutil class Pin: def __init__(self): self.cWORD = vim.eval("expand('<cWORD>')") self.cword = vim.eval("expand('<cword>')") self.cline = vim.eval("getline('.')") if self.cWORD in ["import", "from", "as"]: raise ValueError( "The current word is an import statement keyword: " "'import', 'from', 'as'." ) def navigate(self): # Parse the current line into an abstract syntax tree. This should # fail if the current line is not syntactically correct Python 2. try: self.lineTree = ast.parse(self.cline) except SyntaxError as se: print se raise ImportError( "Import navigation failed. There is a syntax error on the " "cursor's line.\n\n" "Note: PIN only considers the current line of source code the " "cursor is on.\n" "Is this line a syntactically correct import statement?" ) except TypeError as te: print te raise ImportError( "Import navigation failed. There are null bytes on the cursor's " "line.\n\n" "Note: PIN only considers the current line of source code the " "cursor is on.\n" ) importTree = self.extractImportTree(self.lineTree) module = self.extractModule(importTree) package = pkgutil.get_loader(module) if package is None: raise ImportError("This module cannot be loaded.") if os.path.isdir(package.filename): if os.path.isfile(os.path.join(package.filename, "__init__.py")): filename = os.path.join(package.filename, "__init__.py") else: raise ValueError("Unable to locate the module's file") else: filename = package.filename vim.command("tabnew {file}".format(file=filename)) def extractImportTree(self, tree): """ Return the subtree rooted at the import statement containing the descendant cword. """ # Extract the subtree rooted at the Import or ImportFrom node # associated to the lexeme given by cword. # If there is no import statement in lineTree raise a ValueError def checkNames(tree): for node in ast.walk(tree): if isinstance(node, ast.alias) and\ (node.name == self.cword or\ node.asname == self.cword or\ node.name == self.cWORD): return True return False if len(tree.body) == 1: node = tree.body[0] if isinstance(node, ast.Import) or\ isinstance(node, ast.ImportFrom): return node for node in ast.walk(tree): if isinstance(node, ast.Import) and checkNames(node): return node if isinstance(node, ast.ImportFrom) and\ (checkNames(node) or self.cWORD == node.module): return node raise ValueError("The current word is not part of an import statement") # Extract the module that contains cword; this may be cword itself. def extractModule(self, tree): """ Return the module name containing cword """ if isinstance(tree, ast.Import): return self.extractModuleFromImport(tree) else: return self.extractModuleFromImportFrom(tree) def extractModuleFromImport(self, tree): """ Return the name of the module containing cword. tree must be an ast.Import node. It is therefore the case that for one of tree's ast.alias nodes: 1) cword and cWORD are equal to the asname of the alias OR 2) cWORD is equal to the name of the alias and cword is equal to one of the dot delimited name components """ if not isinstance(tree, ast.Import): raise TypeError("Did not receive an ast.Import node.") for node in tree.names: if self.cword == node.asname: return node.name if self.cWORD in [node.name, node.asname]: return node.name raise ValueError( "ast.Import node tree does not contain a descendant " "with the current word under the cursor." ) def extractModuleFromImportFrom(self, tree): """ Return the name of the module containing cword. tree must be an ast.ImportFrom node. Therefore either: 1) cWORD is equal to the tree's module attribute and cword is equal to one of the dot delimited components of module OR 2) cword and cWORD are equal to the name or asname of one of the ast.alias child nodes of tree """ if not isinstance(tree, ast.ImportFrom): raise TypeError("Did not receive an ast.ImportFrom node.") if tree.module is None: packagePath = os.path.dirname(vim.eval("expand('%:p')")) sys.path.append(packagePath) module = os.path.basename(packagePath) tree.module = module if self.cWORD == '.': self.cWORD = module if self.cWORD == tree.module: return self.cWORD for node in tree.names: if self.cword in [node.name, node.asname]: if pkgutil.get_loader(node.name) is not None: return node.name else: return tree.module raise ValueError( "ast.ImportFrom node tree does not contain a descendant " "with the current word under the cursor." ) try: Pin().navigate() except ImportError as ie: print ie except ValueError as ve: print ve except TypeError as te: print te
0.41561
0.236197
from bio2bel_mirtarbase.manager import _build_entrez_map from bio2bel_mirtarbase.models import Evidence, HGNC, MIRBASE, Mirna, NCBIGENE, Species, Target from pybel import BELGraph from pybel.constants import FUNCTION, IDENTIFIER, NAME, NAMESPACE from pybel.dsl import BaseAbundance, mirna, rna from tests.constants import TemporaryFilledCacheMixin hif1a_symbol = 'HIF1A' hif1a_hgnc_name = rna(name=hif1a_symbol, namespace=HGNC) hif1a_hgnc_identifier = rna(identifier='4910', namespace=HGNC) hif1a_entrez_name = rna(name='3091', namespace=NCBIGENE) hif1a_entrez_identifier = rna(identifier='3091', namespace=NCBIGENE) mi2_data = mirna(name='hsa-miR-20a-5p', namespace=MIRBASE) mi5_data = mirna(name='mmu-miR-124-3p', namespace=MIRBASE) class TestBuildDatabase(TemporaryFilledCacheMixin): """Test the database.""" def test_count_human_genes(self): """Test the number of genes in Bio2BEL HGNC.""" self.assertEqual(2, self.hgnc_manager.count_human_genes()) def test_count_mirnas(self): """Test the number of miRNAs.""" self.assertEqual(5, self.manager.count_mirnas()) def test_count_targets(self): """Test the number of targets.""" self.assertEqual(6, self.manager.count_targets()) def test_count_interactions(self): """Test the number of interactions.""" self.assertEqual(6, self.manager.count_interactions()) def test_count_evidences(self): """Test the number of evidences.""" self.assertEqual(10, self.manager.count_evidences()) def test_count_species(self): """Test the number of species.""" self.assertEqual(3, self.manager.session.query(Species).count()) def test_count_hgnc(self): """Test the number of human genes.""" self.assertEqual(2, len(self.hgnc_manager.hgnc())) def test_get_cxcr4_by_entrez(self): """Test getting cxcr4 by its Entrez gene identifier.""" models = self.hgnc_manager.hgnc(entrez='7852') self.assertEqual(1, len(models)) model = models[0] self.assertIsNotNone(model) self.assertEqual('CXCR4', model.symbol) self.assertEqual('7852', model.entrez) def test_get_hif1a_by_entrez(self): """Test getting hif1a by its Entrez gene identifier.""" models = self.hgnc_manager.hgnc(entrez='3091') self.assertEqual(1, len(models)) model = models[0] self.assertIsNotNone(model) self.assertEqual('HIF1A', model.symbol) self.assertEqual('3091', model.entrez) def test_build_map(self): """Test building an Entrez map.""" emap = _build_entrez_map(self.hgnc_manager) self.assertEqual(2, len(emap)) self.assertIn('7852', emap) self.assertIn('3091', emap) def test_evidence(self): """Test the populate function of the database manager.""" ev2 = self.manager.session.query(Evidence).filter(Evidence.reference == '18619591').first() self.assertIsNotNone(ev2) self.assertEqual("Luciferase reporter assay//qRT-PCR//Western blot//Reporter assay;Microarray", ev2.experiment) def check_mir5(self, model: Mirna): """Help check the model has the right information for mmu-miR-124-3p.""" self.assertIsNotNone(model) self.assertEqual("mmu-miR-124-3p", model.name) self.assertTrue(any('MIRT000005' == interaction.mirtarbase_id for interaction in model.interactions)) bel_data = model.as_bel() self.assertEqual(mi5_data.function, bel_data.function) self.assertEqual(mi5_data.name, bel_data.name) self.assertEqual(mi5_data.namespace, bel_data.namespace) def test_mirna_by_mirtarbase_id(self): """Test getting an miRNA by a miRTarBase relationship identifier.""" mi5 = self.manager.query_mirna_by_mirtarbase_identifier('MIRT000005') self.check_mir5(mi5) def check_mir2(self, model: Mirna): """Help check the model has the right information for mmu-miR-124-3p.""" self.assertIsNotNone(model) self.assertEqual("hsa-miR-20a-5p", model.name) self.assertEqual(2, len(model.interactions)) self.assertTrue(any('MIRT000002' == interaction.mirtarbase_id for interaction in model.interactions)) bel_data = model.as_bel() self.assertEqual(mi2_data[FUNCTION], bel_data[FUNCTION]) self.assertEqual(mi2_data[NAME], bel_data[NAME]) self.assertEqual(mi2_data[NAMESPACE], bel_data[NAMESPACE]) def test_mirna_2_by_mirtarbase_id(self): """Test getting an miRNA by a miRTarBase relationship identifier.""" mi2 = self.manager.query_mirna_by_mirtarbase_identifier('MIRT000002') self.check_mir2(mi2) def test_target(self): """Test getting a target by Entrez Gene identifier.""" target = self.manager.query_target_by_entrez_id('7852') self.assertIsNotNone(target) self.assertEqual("CXCR4", target.name) self.assertIsNotNone(target.hgnc_id) self.assertEqual("2561", target.hgnc_id) def check_hif1a(self, model: Target): """Help check the model has all the right information for HIF1A. :type model: Target """ self.assertIsNotNone(model) self.assertEqual('HIF1A', model.name) self.assertIsNotNone(model.hgnc_id) self.assertEqual('4910', model.hgnc_id) self.assertIsNotNone(model.hgnc_symbol) self.assertEqual('HIF1A', model.hgnc_symbol) self.assertIsNotNone(model.entrez_id) self.assertEqual('3091', model.entrez_id) self.assertEqual(1, len(model.interactions)) # all different evidences to hsa-miR-20a-5p def test_target_by_entrez(self): """Test getting a target by Entrez Gene identifier.""" model = self.manager.query_target_by_entrez_id('3091') self.check_hif1a(model) def test_target_by_hgnc_id(self): """Test getting a target by Entrez Gene identifier.""" model = self.manager.query_target_by_hgnc_identifier('4910') self.check_hif1a(model) def test_target_by_hgnc_symbol(self): """Test getting a target by HGNC symbol.""" model = self.manager.query_target_by_hgnc_symbol(hif1a_symbol) self.check_hif1a(model) def help_enrich_hif1a(self, node: BaseAbundance): """Help check that different versions of HIF1A can be enriched properly. :param pybel.dsl.BaseAbundance node: A PyBEL data dictionary """ self.assertIsInstance(node, BaseAbundance) self.assertTrue(NAME in node or IDENTIFIER in node, msg='Node missing information: {}'.format(node)) graph = BELGraph() graph.add_node_from_data(node) self.assertEqual(1, graph.number_of_nodes()) self.assertEqual(0, graph.number_of_edges()) self.manager.enrich_rnas(graph) # should enrich with the HIF1A - hsa-miR-20a-5p interaction self.assertEqual(2, graph.number_of_nodes(), msg=f""" Nodes: {", ".join(map(str, graph))} """) self.assertEqual(3, graph.number_of_edges()) self.assertIn(mi2_data, graph) self.assertTrue(graph.has_edge(mi2_data, node)) def test_enrich_hgnc_symbol(self): """Test enrichment of an HGNC gene symbol node.""" self.help_enrich_hif1a(hif1a_hgnc_name) def test_enrich_hgnc_identifier(self): """Test enrichment of an HGNC identifier node.""" self.help_enrich_hif1a(hif1a_hgnc_identifier) def test_enrich_entrez_name(self): """Test enrichment of an Entrez Gene node.""" self.help_enrich_hif1a(hif1a_entrez_name) def test_enrich_entrez_id(self): """Test enrichment of an Entrez Gene node.""" self.help_enrich_hif1a(hif1a_entrez_identifier)
tests/test_build_db.py
from bio2bel_mirtarbase.manager import _build_entrez_map from bio2bel_mirtarbase.models import Evidence, HGNC, MIRBASE, Mirna, NCBIGENE, Species, Target from pybel import BELGraph from pybel.constants import FUNCTION, IDENTIFIER, NAME, NAMESPACE from pybel.dsl import BaseAbundance, mirna, rna from tests.constants import TemporaryFilledCacheMixin hif1a_symbol = 'HIF1A' hif1a_hgnc_name = rna(name=hif1a_symbol, namespace=HGNC) hif1a_hgnc_identifier = rna(identifier='4910', namespace=HGNC) hif1a_entrez_name = rna(name='3091', namespace=NCBIGENE) hif1a_entrez_identifier = rna(identifier='3091', namespace=NCBIGENE) mi2_data = mirna(name='hsa-miR-20a-5p', namespace=MIRBASE) mi5_data = mirna(name='mmu-miR-124-3p', namespace=MIRBASE) class TestBuildDatabase(TemporaryFilledCacheMixin): """Test the database.""" def test_count_human_genes(self): """Test the number of genes in Bio2BEL HGNC.""" self.assertEqual(2, self.hgnc_manager.count_human_genes()) def test_count_mirnas(self): """Test the number of miRNAs.""" self.assertEqual(5, self.manager.count_mirnas()) def test_count_targets(self): """Test the number of targets.""" self.assertEqual(6, self.manager.count_targets()) def test_count_interactions(self): """Test the number of interactions.""" self.assertEqual(6, self.manager.count_interactions()) def test_count_evidences(self): """Test the number of evidences.""" self.assertEqual(10, self.manager.count_evidences()) def test_count_species(self): """Test the number of species.""" self.assertEqual(3, self.manager.session.query(Species).count()) def test_count_hgnc(self): """Test the number of human genes.""" self.assertEqual(2, len(self.hgnc_manager.hgnc())) def test_get_cxcr4_by_entrez(self): """Test getting cxcr4 by its Entrez gene identifier.""" models = self.hgnc_manager.hgnc(entrez='7852') self.assertEqual(1, len(models)) model = models[0] self.assertIsNotNone(model) self.assertEqual('CXCR4', model.symbol) self.assertEqual('7852', model.entrez) def test_get_hif1a_by_entrez(self): """Test getting hif1a by its Entrez gene identifier.""" models = self.hgnc_manager.hgnc(entrez='3091') self.assertEqual(1, len(models)) model = models[0] self.assertIsNotNone(model) self.assertEqual('HIF1A', model.symbol) self.assertEqual('3091', model.entrez) def test_build_map(self): """Test building an Entrez map.""" emap = _build_entrez_map(self.hgnc_manager) self.assertEqual(2, len(emap)) self.assertIn('7852', emap) self.assertIn('3091', emap) def test_evidence(self): """Test the populate function of the database manager.""" ev2 = self.manager.session.query(Evidence).filter(Evidence.reference == '18619591').first() self.assertIsNotNone(ev2) self.assertEqual("Luciferase reporter assay//qRT-PCR//Western blot//Reporter assay;Microarray", ev2.experiment) def check_mir5(self, model: Mirna): """Help check the model has the right information for mmu-miR-124-3p.""" self.assertIsNotNone(model) self.assertEqual("mmu-miR-124-3p", model.name) self.assertTrue(any('MIRT000005' == interaction.mirtarbase_id for interaction in model.interactions)) bel_data = model.as_bel() self.assertEqual(mi5_data.function, bel_data.function) self.assertEqual(mi5_data.name, bel_data.name) self.assertEqual(mi5_data.namespace, bel_data.namespace) def test_mirna_by_mirtarbase_id(self): """Test getting an miRNA by a miRTarBase relationship identifier.""" mi5 = self.manager.query_mirna_by_mirtarbase_identifier('MIRT000005') self.check_mir5(mi5) def check_mir2(self, model: Mirna): """Help check the model has the right information for mmu-miR-124-3p.""" self.assertIsNotNone(model) self.assertEqual("hsa-miR-20a-5p", model.name) self.assertEqual(2, len(model.interactions)) self.assertTrue(any('MIRT000002' == interaction.mirtarbase_id for interaction in model.interactions)) bel_data = model.as_bel() self.assertEqual(mi2_data[FUNCTION], bel_data[FUNCTION]) self.assertEqual(mi2_data[NAME], bel_data[NAME]) self.assertEqual(mi2_data[NAMESPACE], bel_data[NAMESPACE]) def test_mirna_2_by_mirtarbase_id(self): """Test getting an miRNA by a miRTarBase relationship identifier.""" mi2 = self.manager.query_mirna_by_mirtarbase_identifier('MIRT000002') self.check_mir2(mi2) def test_target(self): """Test getting a target by Entrez Gene identifier.""" target = self.manager.query_target_by_entrez_id('7852') self.assertIsNotNone(target) self.assertEqual("CXCR4", target.name) self.assertIsNotNone(target.hgnc_id) self.assertEqual("2561", target.hgnc_id) def check_hif1a(self, model: Target): """Help check the model has all the right information for HIF1A. :type model: Target """ self.assertIsNotNone(model) self.assertEqual('HIF1A', model.name) self.assertIsNotNone(model.hgnc_id) self.assertEqual('4910', model.hgnc_id) self.assertIsNotNone(model.hgnc_symbol) self.assertEqual('HIF1A', model.hgnc_symbol) self.assertIsNotNone(model.entrez_id) self.assertEqual('3091', model.entrez_id) self.assertEqual(1, len(model.interactions)) # all different evidences to hsa-miR-20a-5p def test_target_by_entrez(self): """Test getting a target by Entrez Gene identifier.""" model = self.manager.query_target_by_entrez_id('3091') self.check_hif1a(model) def test_target_by_hgnc_id(self): """Test getting a target by Entrez Gene identifier.""" model = self.manager.query_target_by_hgnc_identifier('4910') self.check_hif1a(model) def test_target_by_hgnc_symbol(self): """Test getting a target by HGNC symbol.""" model = self.manager.query_target_by_hgnc_symbol(hif1a_symbol) self.check_hif1a(model) def help_enrich_hif1a(self, node: BaseAbundance): """Help check that different versions of HIF1A can be enriched properly. :param pybel.dsl.BaseAbundance node: A PyBEL data dictionary """ self.assertIsInstance(node, BaseAbundance) self.assertTrue(NAME in node or IDENTIFIER in node, msg='Node missing information: {}'.format(node)) graph = BELGraph() graph.add_node_from_data(node) self.assertEqual(1, graph.number_of_nodes()) self.assertEqual(0, graph.number_of_edges()) self.manager.enrich_rnas(graph) # should enrich with the HIF1A - hsa-miR-20a-5p interaction self.assertEqual(2, graph.number_of_nodes(), msg=f""" Nodes: {", ".join(map(str, graph))} """) self.assertEqual(3, graph.number_of_edges()) self.assertIn(mi2_data, graph) self.assertTrue(graph.has_edge(mi2_data, node)) def test_enrich_hgnc_symbol(self): """Test enrichment of an HGNC gene symbol node.""" self.help_enrich_hif1a(hif1a_hgnc_name) def test_enrich_hgnc_identifier(self): """Test enrichment of an HGNC identifier node.""" self.help_enrich_hif1a(hif1a_hgnc_identifier) def test_enrich_entrez_name(self): """Test enrichment of an Entrez Gene node.""" self.help_enrich_hif1a(hif1a_entrez_name) def test_enrich_entrez_id(self): """Test enrichment of an Entrez Gene node.""" self.help_enrich_hif1a(hif1a_entrez_identifier)
0.724675
0.430866
class Word2Sequence: UNK_TAG="<UNK>" PAD_TAG = "<PAD>" UNK = 0 PAD = 1 ''' 1.初始化dict词典,加入初始字符,count词频统计 ''' def __init__(self): self.dict={ self.UNK_TAG:self.UNK, self.PAD_TAG:self.PAD } self.counter={} ''' 2.接收单个wordlist,统计进词频count ''' def fit(self,word_list): for word in word_list: self.counter[word]=self.counter.get(word,0)+1 ''' 3.根据词频,造词典:最小,最大词频,词个数 ''' def build_vocab(self,min_count=1,max_count=None,max_features=None): ''' :param min_count: 入库的最小词频 :param max_count: 入库的最大词频 :param max_features: 整个词库的大小 :return: ''' # 1.过滤counter if min_count is not None: self.counter={word:count for word,count in self.counter.items() if count>min_count} if max_count is not None: self.counter={word:count for word,count in self.counter.items() if count<max_count} if max_features is not None: self.counter=dict(sorted(self.counter.items(),reverse=True,key=lambda x:x[-1])[:max_features]) # 根据counter,建立词典 # 2.遍历counter,不断加入dict,key是word,value是索引,即dict的长度 for word in self.counter: self.dict[word]=len(self.dict) # 3.不仅创建dict,还要创建reverse_dict self.reverse_dict=dict(zip(self.dict.values(),self.dict.keys())) ''' 4.接收文本,转数字序列:wordlist>sequence ''' def transform(self,word_list,sequence_max=10): # 1.规定序列长度,短了补,长了切 word_list_len=len(word_list) if word_list_len>sequence_max: word_list=word_list[:sequence_max] if word_list_len<sequence_max: #填充数组 word_list=word_list+[self.PAD_TAG]*(sequence_max-len(word_list)) # print(word_list) # 最后转成数字列表 return [self.dict.get(word,self.UNK) for word in word_list] ''' 5.接收数字序列,转文本 ''' def inverse_transform(self,sequence_list): # 1.接收索引列表,调用self.reverse_dict转成真实文本word_list word_list=[self.reverse_dict.get(index,self.UNK_TAG) for index in sequence_list] return word_list def __len__(self): return len(self.dict)
src/search/sort/word_to_sequence.py
class Word2Sequence: UNK_TAG="<UNK>" PAD_TAG = "<PAD>" UNK = 0 PAD = 1 ''' 1.初始化dict词典,加入初始字符,count词频统计 ''' def __init__(self): self.dict={ self.UNK_TAG:self.UNK, self.PAD_TAG:self.PAD } self.counter={} ''' 2.接收单个wordlist,统计进词频count ''' def fit(self,word_list): for word in word_list: self.counter[word]=self.counter.get(word,0)+1 ''' 3.根据词频,造词典:最小,最大词频,词个数 ''' def build_vocab(self,min_count=1,max_count=None,max_features=None): ''' :param min_count: 入库的最小词频 :param max_count: 入库的最大词频 :param max_features: 整个词库的大小 :return: ''' # 1.过滤counter if min_count is not None: self.counter={word:count for word,count in self.counter.items() if count>min_count} if max_count is not None: self.counter={word:count for word,count in self.counter.items() if count<max_count} if max_features is not None: self.counter=dict(sorted(self.counter.items(),reverse=True,key=lambda x:x[-1])[:max_features]) # 根据counter,建立词典 # 2.遍历counter,不断加入dict,key是word,value是索引,即dict的长度 for word in self.counter: self.dict[word]=len(self.dict) # 3.不仅创建dict,还要创建reverse_dict self.reverse_dict=dict(zip(self.dict.values(),self.dict.keys())) ''' 4.接收文本,转数字序列:wordlist>sequence ''' def transform(self,word_list,sequence_max=10): # 1.规定序列长度,短了补,长了切 word_list_len=len(word_list) if word_list_len>sequence_max: word_list=word_list[:sequence_max] if word_list_len<sequence_max: #填充数组 word_list=word_list+[self.PAD_TAG]*(sequence_max-len(word_list)) # print(word_list) # 最后转成数字列表 return [self.dict.get(word,self.UNK) for word in word_list] ''' 5.接收数字序列,转文本 ''' def inverse_transform(self,sequence_list): # 1.接收索引列表,调用self.reverse_dict转成真实文本word_list word_list=[self.reverse_dict.get(index,self.UNK_TAG) for index in sequence_list] return word_list def __len__(self): return len(self.dict)
0.182826
0.403449
from abc import abstractmethod from collections import OrderedDict from django.utils.translation import ugettext from datawinners.search.index_utils import es_unique_id_code_field_name, es_questionnaire_field_name from datawinners.search.submission_index_constants import SubmissionIndexConstants from datawinners.utils import translate from mangrove.form_model.form_model import header_fields class SubmissionHeader(): def __init__(self, form_model, language='en'): self.form_model = form_model self.language = language def get_header_dict(self): header_dict = OrderedDict() header_dict.update(self.update_static_header_info()) def key_attribute(field): return field.code entity_questions = self.form_model.entity_questions entity_question_dict = dict((field.code, field) for field in entity_questions) headers = header_fields(self.form_model, key_attribute) for field_code, val in headers.items(): key = es_questionnaire_field_name(field_code, self.form_model.id) if field_code in entity_question_dict.keys(): self.add_unique_id_field(entity_question_dict.get(field_code), header_dict) else: header_dict.update({key: val}) return header_dict def add_unique_id_field(self, unique_id_field, header_dict): unique_id_question_code = unique_id_field.code subject_title = unique_id_field.unique_id_type unique_id_field_name = es_questionnaire_field_name(unique_id_question_code, self.form_model.id) header_dict.update({unique_id_field_name: unique_id_field.label}) header_dict.update({es_unique_id_code_field_name(unique_id_field_name): "%s ID" % subject_title}) def get_header_field_names(self): return self.get_header_dict().keys() def get_header_field_dict(self): return self.get_header_dict() @abstractmethod def update_static_header_info(self): pass class SubmissionAnalysisHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) return header_dict class AllSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({"date_updated": translate("Updated Date", self.language, ugettext)}) header_dict.update({"status": translate("Status", self.language, ugettext)}) return header_dict class SuccessSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) return header_dict class ErroredSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({"error_msg": translate("Error Message", self.language, ugettext)}) return header_dict class HeaderFactory(): def __init__(self, form_model, language='en'): self.header_to_class_dict = {"all": AllSubmissionHeader, "deleted": AllSubmissionHeader, "analysis": SubmissionAnalysisHeader, "success": SuccessSubmissionHeader, "error": ErroredSubmissionHeader} self.form_model = form_model self.language = language def create_header(self, submission_type): header_class = self.header_to_class_dict.get(submission_type) return header_class(self.form_model, self.language)
datawinners/search/submission_headers.py
from abc import abstractmethod from collections import OrderedDict from django.utils.translation import ugettext from datawinners.search.index_utils import es_unique_id_code_field_name, es_questionnaire_field_name from datawinners.search.submission_index_constants import SubmissionIndexConstants from datawinners.utils import translate from mangrove.form_model.form_model import header_fields class SubmissionHeader(): def __init__(self, form_model, language='en'): self.form_model = form_model self.language = language def get_header_dict(self): header_dict = OrderedDict() header_dict.update(self.update_static_header_info()) def key_attribute(field): return field.code entity_questions = self.form_model.entity_questions entity_question_dict = dict((field.code, field) for field in entity_questions) headers = header_fields(self.form_model, key_attribute) for field_code, val in headers.items(): key = es_questionnaire_field_name(field_code, self.form_model.id) if field_code in entity_question_dict.keys(): self.add_unique_id_field(entity_question_dict.get(field_code), header_dict) else: header_dict.update({key: val}) return header_dict def add_unique_id_field(self, unique_id_field, header_dict): unique_id_question_code = unique_id_field.code subject_title = unique_id_field.unique_id_type unique_id_field_name = es_questionnaire_field_name(unique_id_question_code, self.form_model.id) header_dict.update({unique_id_field_name: unique_id_field.label}) header_dict.update({es_unique_id_code_field_name(unique_id_field_name): "%s ID" % subject_title}) def get_header_field_names(self): return self.get_header_dict().keys() def get_header_field_dict(self): return self.get_header_dict() @abstractmethod def update_static_header_info(self): pass class SubmissionAnalysisHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) return header_dict class AllSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({"date_updated": translate("Updated Date", self.language, ugettext)}) header_dict.update({"status": translate("Status", self.language, ugettext)}) return header_dict class SuccessSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) return header_dict class ErroredSubmissionHeader(SubmissionHeader): def update_static_header_info(self): header_dict = OrderedDict() header_dict.update({SubmissionIndexConstants.DATASENDER_ID_KEY: translate("Datasender Id", self.language, ugettext)}) header_dict.update({SubmissionIndexConstants.DATASENDER_NAME_KEY: translate("Data Sender", self.language, ugettext)}) header_dict.update({"date": translate("Submission Date", self.language, ugettext)}) header_dict.update({"error_msg": translate("Error Message", self.language, ugettext)}) return header_dict class HeaderFactory(): def __init__(self, form_model, language='en'): self.header_to_class_dict = {"all": AllSubmissionHeader, "deleted": AllSubmissionHeader, "analysis": SubmissionAnalysisHeader, "success": SuccessSubmissionHeader, "error": ErroredSubmissionHeader} self.form_model = form_model self.language = language def create_header(self, submission_type): header_class = self.header_to_class_dict.get(submission_type) return header_class(self.form_model, self.language)
0.633637
0.131424
__all__ = ['test_endpoints', 'construct_method_to_params_dict', 'construct_request_type_filter', 'check_request_type_filter', 'determine_request_type_from_fields', 'determine_method_request_types', 'construct_method_to_params_map', 'construct_method_info_dict'] # Cell from tqdm import tqdm from warnings import warn from functools import reduce from . import rawgen, specgen, raw, utils # Cell def test_endpoints( default_kwargs: dict ): methods_to_test = [func for func in dir(raw) if 'get_' in func] stream_to_df = dict() for method_to_test in tqdm(methods_to_test): method_func = getattr(raw, method_to_test) func_kwargs = dict(zip(method_func.__code__.co_varnames, method_func.__defaults__)) for kwarg, value in default_kwargs.items(): if kwarg in func_kwargs.keys(): func_kwargs.update({kwarg: value}) r = method_func(**func_kwargs) df = utils.parse_xml_response(r) stream_to_df[method_to_test.split('_')[1]] = df streams_without_content = [] for stream, df in stream_to_df.items(): if df.size == 0: streams_without_content += [stream] return streams_without_content if len(streams_without_content) > 0: warn(f"The following data streams returned no content data: {', '.join(streams_without_content)}") return stream_to_df # Cell def construct_method_to_params_dict(API_yaml): method_to_params = reduce(lambda k, v: {**k, **v}, [ { f'{k}_{rawgen.clean_path_name(stream)}': { parameter['name']: rawgen.extract_parameter_example(parameter) for parameter in v['parameters'] } for k, v in method.items() if k in ['get', 'post'] } for stream, method in API_yaml['paths'].items() ]) return method_to_params # Cell def construct_request_type_filter( has_start_time: bool, has_end_time: bool, has_start_date: bool, has_end_date: bool, has_date: bool, has_SP: bool, has_year: bool, has_month: bool, has_week: bool ): request_type_filter = { 'year': (has_year + has_month + has_week == 1) and (has_year == 1), 'month': (has_year + has_month == 1) and (has_month == 1), 'week': (has_year + has_week == 1) and (has_week == 1), 'year_and_month': has_year + has_month == 2, 'year_and_week': has_year + has_week == 2, 'SP_and_date': has_SP + has_date == 2, 'date_range': has_start_time + has_end_time + has_start_date + has_end_date == 2, 'date_time_range': has_start_time + has_end_time + has_start_date + has_end_date == 4, 'non_temporal': has_start_time + has_end_time + has_start_date + has_end_date + has_SP + has_date + has_year + has_month == 0, } return request_type_filter def check_request_type_filter( field_names: list, request_type_filter: dict, has_start_time: bool, has_end_time: bool, has_start_date: bool, has_end_date: bool, has_date: bool, has_SP: bool, has_year: bool, has_month: bool, has_week: bool ): """ Checks the validity of the specified stream parameters The following conditions will raise an error: * has month without a year * has only one of start/end time * has only one of start/end date * has only one settlement period or date * filter does not contain only one request type """ filter_str = f'\n\nFilter:\n{request_type_filter}\n\nField Names:\n{", ".join(field_names)}' assert {(False, True): True, (False, False): False, (True, True): False, (True, False): False}[(has_year, has_month)] == False, 'Cannot provide a month without a year' + filter_str assert {(False, True): True, (False, False): False, (True, True): False, (True, False): False}[(has_year, has_week)] == False, 'Cannot provide a week without a year' + filter_str assert has_start_time + has_end_time != 1, 'Only one of start/end time was provided' + filter_str assert has_start_date + has_end_date != 1, 'Only one of start/end date was provided' + filter_str assert (has_SP + has_date != 1) or (has_start_date + has_end_date == 2), 'Only one of date/SP was provided' + filter_str assert sum(request_type_filter.values()) == 1, 'Request type could not be determined\n\nFilter' + filter_str return def determine_request_type_from_fields( field_names: list, start_time_cols: list=['StartTime'], end_time_cols: list=['EndTime'], start_date_cols: list=['StartDate', 'FromSettlementDate', 'FromDate'], end_date_cols: list=['EndDate', 'ToSettlementDate', 'ToDate'], date_cols: list=['SettlementDate', 'ImplementationDate', 'DecommissioningDate', 'Date', 'startTimeOfHalfHrPeriod'], SP_cols: list=['SettlementPeriod', 'Period', 'settlementPeriod'], year_cols: list=['Year'], month_cols: list=['Month', 'MonthName'], week_cols: list=['Week'] ): has_start_time = bool(set(field_names).intersection(set(start_time_cols))) has_end_time = bool(set(field_names).intersection(set(end_time_cols))) has_start_date = bool(set(field_names).intersection(set(start_date_cols))) has_end_date = bool(set(field_names).intersection(set(end_date_cols))) has_date = bool(set(field_names).intersection(set(date_cols))) has_SP = bool(set(field_names).intersection(set(SP_cols))) has_year = bool(set(field_names).intersection(set(year_cols))) has_month = bool(set(field_names).intersection(set(month_cols))) has_week = bool(set(field_names).intersection(set(week_cols))) request_type_filter = construct_request_type_filter( has_start_time, has_end_time, has_start_date, has_end_date, has_date, has_SP, has_year, has_month, has_week ) check_request_type_filter( field_names, request_type_filter, has_start_time, has_end_time, has_start_date, has_end_date, has_date, has_SP, has_year, has_month, has_week ) request_type = [k for k, v in request_type_filter.items() if v==True][0] return request_type # Cell def determine_method_request_types(method_to_params): method_to_request_type = dict() for method in method_to_params.keys(): field_names = list(method_to_params[method].keys()) method_to_request_type[method] = determine_request_type_from_fields(field_names) return method_to_request_type # Cell def construct_method_to_params_map(method_to_params): standardised_params_map = { 'start_time': ['StartTime'], 'end_time': ['EndTime'], 'start_date': ['StartDate', 'FromSettlementDate', 'FromDate'], 'end_date': ['EndDate', 'ToSettlementDate', 'ToDate'], 'date': ['SettlementDate', 'ImplementationDate', 'DecommissioningDate', 'Date', 'startTimeOfHalfHrPeriod'], 'SP': ['SettlementPeriod', 'Period', 'settlementPeriod'], 'year': ['Year'], 'month': ['Month', 'MonthName'], 'week': ['Week'] } method_to_params_map = dict() for method, params in method_to_params.items(): method_to_params_map[method] = dict() for param in params.keys(): for standardised_param, bmrs_params in standardised_params_map.items(): if param in bmrs_params: method_to_params_map[method][standardised_param] = param return method_to_params_map # Cell def construct_method_info_dict(API_yaml_fp: str): API_yaml = specgen.load_API_yaml(API_yaml_fp) method_to_params = construct_method_to_params_dict(API_yaml) method_to_request_type = determine_method_request_types(method_to_params) method_to_params_map = construct_method_to_params_map(method_to_params) method_info = dict() for method, params in method_to_params.items(): method_info[method] = dict() method_info[method]['request_type'] = method_to_request_type[method] method_info[method]['kwargs_map'] = method_to_params_map[method] method_info[method]['func_kwargs'] = { ( {v: k for k, v in method_to_params_map[method].items()}[k] if k in method_to_params_map[method].values() else k ): v for k, v in method_to_params[method].items() } return method_info
ElexonDataPortal/dev/clientprep.py
__all__ = ['test_endpoints', 'construct_method_to_params_dict', 'construct_request_type_filter', 'check_request_type_filter', 'determine_request_type_from_fields', 'determine_method_request_types', 'construct_method_to_params_map', 'construct_method_info_dict'] # Cell from tqdm import tqdm from warnings import warn from functools import reduce from . import rawgen, specgen, raw, utils # Cell def test_endpoints( default_kwargs: dict ): methods_to_test = [func for func in dir(raw) if 'get_' in func] stream_to_df = dict() for method_to_test in tqdm(methods_to_test): method_func = getattr(raw, method_to_test) func_kwargs = dict(zip(method_func.__code__.co_varnames, method_func.__defaults__)) for kwarg, value in default_kwargs.items(): if kwarg in func_kwargs.keys(): func_kwargs.update({kwarg: value}) r = method_func(**func_kwargs) df = utils.parse_xml_response(r) stream_to_df[method_to_test.split('_')[1]] = df streams_without_content = [] for stream, df in stream_to_df.items(): if df.size == 0: streams_without_content += [stream] return streams_without_content if len(streams_without_content) > 0: warn(f"The following data streams returned no content data: {', '.join(streams_without_content)}") return stream_to_df # Cell def construct_method_to_params_dict(API_yaml): method_to_params = reduce(lambda k, v: {**k, **v}, [ { f'{k}_{rawgen.clean_path_name(stream)}': { parameter['name']: rawgen.extract_parameter_example(parameter) for parameter in v['parameters'] } for k, v in method.items() if k in ['get', 'post'] } for stream, method in API_yaml['paths'].items() ]) return method_to_params # Cell def construct_request_type_filter( has_start_time: bool, has_end_time: bool, has_start_date: bool, has_end_date: bool, has_date: bool, has_SP: bool, has_year: bool, has_month: bool, has_week: bool ): request_type_filter = { 'year': (has_year + has_month + has_week == 1) and (has_year == 1), 'month': (has_year + has_month == 1) and (has_month == 1), 'week': (has_year + has_week == 1) and (has_week == 1), 'year_and_month': has_year + has_month == 2, 'year_and_week': has_year + has_week == 2, 'SP_and_date': has_SP + has_date == 2, 'date_range': has_start_time + has_end_time + has_start_date + has_end_date == 2, 'date_time_range': has_start_time + has_end_time + has_start_date + has_end_date == 4, 'non_temporal': has_start_time + has_end_time + has_start_date + has_end_date + has_SP + has_date + has_year + has_month == 0, } return request_type_filter def check_request_type_filter( field_names: list, request_type_filter: dict, has_start_time: bool, has_end_time: bool, has_start_date: bool, has_end_date: bool, has_date: bool, has_SP: bool, has_year: bool, has_month: bool, has_week: bool ): """ Checks the validity of the specified stream parameters The following conditions will raise an error: * has month without a year * has only one of start/end time * has only one of start/end date * has only one settlement period or date * filter does not contain only one request type """ filter_str = f'\n\nFilter:\n{request_type_filter}\n\nField Names:\n{", ".join(field_names)}' assert {(False, True): True, (False, False): False, (True, True): False, (True, False): False}[(has_year, has_month)] == False, 'Cannot provide a month without a year' + filter_str assert {(False, True): True, (False, False): False, (True, True): False, (True, False): False}[(has_year, has_week)] == False, 'Cannot provide a week without a year' + filter_str assert has_start_time + has_end_time != 1, 'Only one of start/end time was provided' + filter_str assert has_start_date + has_end_date != 1, 'Only one of start/end date was provided' + filter_str assert (has_SP + has_date != 1) or (has_start_date + has_end_date == 2), 'Only one of date/SP was provided' + filter_str assert sum(request_type_filter.values()) == 1, 'Request type could not be determined\n\nFilter' + filter_str return def determine_request_type_from_fields( field_names: list, start_time_cols: list=['StartTime'], end_time_cols: list=['EndTime'], start_date_cols: list=['StartDate', 'FromSettlementDate', 'FromDate'], end_date_cols: list=['EndDate', 'ToSettlementDate', 'ToDate'], date_cols: list=['SettlementDate', 'ImplementationDate', 'DecommissioningDate', 'Date', 'startTimeOfHalfHrPeriod'], SP_cols: list=['SettlementPeriod', 'Period', 'settlementPeriod'], year_cols: list=['Year'], month_cols: list=['Month', 'MonthName'], week_cols: list=['Week'] ): has_start_time = bool(set(field_names).intersection(set(start_time_cols))) has_end_time = bool(set(field_names).intersection(set(end_time_cols))) has_start_date = bool(set(field_names).intersection(set(start_date_cols))) has_end_date = bool(set(field_names).intersection(set(end_date_cols))) has_date = bool(set(field_names).intersection(set(date_cols))) has_SP = bool(set(field_names).intersection(set(SP_cols))) has_year = bool(set(field_names).intersection(set(year_cols))) has_month = bool(set(field_names).intersection(set(month_cols))) has_week = bool(set(field_names).intersection(set(week_cols))) request_type_filter = construct_request_type_filter( has_start_time, has_end_time, has_start_date, has_end_date, has_date, has_SP, has_year, has_month, has_week ) check_request_type_filter( field_names, request_type_filter, has_start_time, has_end_time, has_start_date, has_end_date, has_date, has_SP, has_year, has_month, has_week ) request_type = [k for k, v in request_type_filter.items() if v==True][0] return request_type # Cell def determine_method_request_types(method_to_params): method_to_request_type = dict() for method in method_to_params.keys(): field_names = list(method_to_params[method].keys()) method_to_request_type[method] = determine_request_type_from_fields(field_names) return method_to_request_type # Cell def construct_method_to_params_map(method_to_params): standardised_params_map = { 'start_time': ['StartTime'], 'end_time': ['EndTime'], 'start_date': ['StartDate', 'FromSettlementDate', 'FromDate'], 'end_date': ['EndDate', 'ToSettlementDate', 'ToDate'], 'date': ['SettlementDate', 'ImplementationDate', 'DecommissioningDate', 'Date', 'startTimeOfHalfHrPeriod'], 'SP': ['SettlementPeriod', 'Period', 'settlementPeriod'], 'year': ['Year'], 'month': ['Month', 'MonthName'], 'week': ['Week'] } method_to_params_map = dict() for method, params in method_to_params.items(): method_to_params_map[method] = dict() for param in params.keys(): for standardised_param, bmrs_params in standardised_params_map.items(): if param in bmrs_params: method_to_params_map[method][standardised_param] = param return method_to_params_map # Cell def construct_method_info_dict(API_yaml_fp: str): API_yaml = specgen.load_API_yaml(API_yaml_fp) method_to_params = construct_method_to_params_dict(API_yaml) method_to_request_type = determine_method_request_types(method_to_params) method_to_params_map = construct_method_to_params_map(method_to_params) method_info = dict() for method, params in method_to_params.items(): method_info[method] = dict() method_info[method]['request_type'] = method_to_request_type[method] method_info[method]['kwargs_map'] = method_to_params_map[method] method_info[method]['func_kwargs'] = { ( {v: k for k, v in method_to_params_map[method].items()}[k] if k in method_to_params_map[method].values() else k ): v for k, v in method_to_params[method].items() } return method_info
0.684475
0.428413
from unittest import TestCase import httpretty from click.testing import CliRunner from arcsecond import cli from arcsecond.api.error import ArcsecondError from arcsecond.config import config_file_clear_section from tests.utils import make_successful_login, mock_http_get, mock_http_post class DatasetsInOrganisationsTestCase(TestCase): def setUp(self): config_file_clear_section('test') httpretty.enable() def tearDown(self): httpretty.disable() def test_datasets_list_unlogged(self): """As a simple user, I must not be able to access the list of datasets of an organisation.""" runner = CliRunner() make_successful_login(runner) result = runner.invoke(cli.datasets, ['--organisation', 'saao', '--debug', '--test']) assert result.exit_code != 0 and isinstance(result.exception, ArcsecondError) def test_organisation_GET_datasets_list_logged_but_wrong_organisation(self): """No matter role I have, accessing an unknown organisation must fail.""" runner = CliRunner() make_successful_login(runner, 'saao', 'superadmin') result = runner.invoke(cli.datasets, ['--organisation', 'dummy', '--debug', '--test']) assert result.exit_code != 0 and isinstance(result.exception, ArcsecondError) def test_organisation_GET_datasets_list_valid_role(self): """As a SAAO member, I must be able to access the list of datasets.""" runner = CliRunner() make_successful_login(runner, 'saao', 'member') mock_http_get('/saao/datasets/', '[]') result = runner.invoke(cli.datasets, ['--organisation', 'saao', '--debug', '--test']) assert result.exit_code == 0 and not result.exception def test_organisation_POST_datasets_list_valid_member_role(self): """As a SAAO superadmin, I must be able to create a dataset.""" runner = CliRunner() make_successful_login(runner, 'saao', 'member') mock_http_post('/saao/datasets/', '[]') result = runner.invoke(cli.datasets, ['create', '--organisation', 'saao', '--debug', '--test']) assert result.exit_code == 0 and not result.exception
tests/cli/test_datasets_organisations.py
from unittest import TestCase import httpretty from click.testing import CliRunner from arcsecond import cli from arcsecond.api.error import ArcsecondError from arcsecond.config import config_file_clear_section from tests.utils import make_successful_login, mock_http_get, mock_http_post class DatasetsInOrganisationsTestCase(TestCase): def setUp(self): config_file_clear_section('test') httpretty.enable() def tearDown(self): httpretty.disable() def test_datasets_list_unlogged(self): """As a simple user, I must not be able to access the list of datasets of an organisation.""" runner = CliRunner() make_successful_login(runner) result = runner.invoke(cli.datasets, ['--organisation', 'saao', '--debug', '--test']) assert result.exit_code != 0 and isinstance(result.exception, ArcsecondError) def test_organisation_GET_datasets_list_logged_but_wrong_organisation(self): """No matter role I have, accessing an unknown organisation must fail.""" runner = CliRunner() make_successful_login(runner, 'saao', 'superadmin') result = runner.invoke(cli.datasets, ['--organisation', 'dummy', '--debug', '--test']) assert result.exit_code != 0 and isinstance(result.exception, ArcsecondError) def test_organisation_GET_datasets_list_valid_role(self): """As a SAAO member, I must be able to access the list of datasets.""" runner = CliRunner() make_successful_login(runner, 'saao', 'member') mock_http_get('/saao/datasets/', '[]') result = runner.invoke(cli.datasets, ['--organisation', 'saao', '--debug', '--test']) assert result.exit_code == 0 and not result.exception def test_organisation_POST_datasets_list_valid_member_role(self): """As a SAAO superadmin, I must be able to create a dataset.""" runner = CliRunner() make_successful_login(runner, 'saao', 'member') mock_http_post('/saao/datasets/', '[]') result = runner.invoke(cli.datasets, ['create', '--organisation', 'saao', '--debug', '--test']) assert result.exit_code == 0 and not result.exception
0.612773
0.414425
import os import qrcode from telegram.ext import Updater, CommandHandler, ConversationHandler, MessageHandler, Filters from telegram import ChatAction # Una variable para que el Bot se quede esperando el texto del QR INPUT_TEXT = 0 def start(update, context): update.message.reply_text('Bienvenido a el Bot de Prueba, que desea hacer hoy?\n\n' 'Usa /qr para generar un codigo QR') # Despues de el start, le hace este comando, para el inicio del Bot #aqui define una variable def qr_command_handler(update,context): update.message.reply_text('Enviame un texto para hacer el codigo QR') return INPUT_TEXT def generate_qr(text): filename = text + '.jpg' img = qrcode.make(text) img.save(filename) return filename def send_qr(filename, chat): chat.send_action( action=ChatAction.UPLOAD_PHOTO, timeout=None ) chat.send_photo( photo=open(filename, 'rb') ) os.unlink(filename) def input_text(update, context): text = update.message.text print(text) #funcion que genera el codigo QR filename = generate_qr(text) chat = update.message.chat print(chat) print(filename) #funcion que envio el codigo QR el usuario. send_qr(filename, chat) return ConversationHandler.END if __name__ == '__main__': # Aqui se defiene el Toiken que Genera el FatherBot, para el Bot # con un /revoque, puede hacer otro token. updater = Updater(token='<KEY>', use_context=True) dp = updater.dispatcher # Con esto inicia el Bot, para que puede iniciar dp.add_handler(CommandHandler('start', start)) #incia la concersacion con el la persona el Bot dp.add_handler(ConversationHandler( entry_points=[ CommandHandler('qr',qr_command_handler) ], # Es en los momentos que el Bot esta esperando los estados de la coversacion states={ INPUT_TEXT: [MessageHandler(Filters.text, input_text)] }, fallbacks=[] )) updater.start_polling() updater.idle()
bot.py
import os import qrcode from telegram.ext import Updater, CommandHandler, ConversationHandler, MessageHandler, Filters from telegram import ChatAction # Una variable para que el Bot se quede esperando el texto del QR INPUT_TEXT = 0 def start(update, context): update.message.reply_text('Bienvenido a el Bot de Prueba, que desea hacer hoy?\n\n' 'Usa /qr para generar un codigo QR') # Despues de el start, le hace este comando, para el inicio del Bot #aqui define una variable def qr_command_handler(update,context): update.message.reply_text('Enviame un texto para hacer el codigo QR') return INPUT_TEXT def generate_qr(text): filename = text + '.jpg' img = qrcode.make(text) img.save(filename) return filename def send_qr(filename, chat): chat.send_action( action=ChatAction.UPLOAD_PHOTO, timeout=None ) chat.send_photo( photo=open(filename, 'rb') ) os.unlink(filename) def input_text(update, context): text = update.message.text print(text) #funcion que genera el codigo QR filename = generate_qr(text) chat = update.message.chat print(chat) print(filename) #funcion que envio el codigo QR el usuario. send_qr(filename, chat) return ConversationHandler.END if __name__ == '__main__': # Aqui se defiene el Toiken que Genera el FatherBot, para el Bot # con un /revoque, puede hacer otro token. updater = Updater(token='<KEY>', use_context=True) dp = updater.dispatcher # Con esto inicia el Bot, para que puede iniciar dp.add_handler(CommandHandler('start', start)) #incia la concersacion con el la persona el Bot dp.add_handler(ConversationHandler( entry_points=[ CommandHandler('qr',qr_command_handler) ], # Es en los momentos que el Bot esta esperando los estados de la coversacion states={ INPUT_TEXT: [MessageHandler(Filters.text, input_text)] }, fallbacks=[] )) updater.start_polling() updater.idle()
0.332852
0.090173
import kernel from kernel.Interfaces.IStoreManager import IStoreManager import jsonpickle import os import numpy as np class JsonStoreManager(IStoreManager): def __init__(self): """ Constructor that initializes entity """ super().__init__() self.refresh() def refresh(self): """ Reloads file with new information, in particular recreates the user collection and all info associated. """ root = kernel.get_connection_string() path_to_user = os.path.join(root, "users.json") try: f = open(path_to_user, "r") json = f.read() frozen = jsonpickle.decode(json) self.__users__ = frozen.__users__ except Exception as e: print("Initial users file not found") finally: if 'f' in locals() and f is not None: f.close() @staticmethod def version(): return 1.0 def get_user(self, user_id): try: for user_to_search in self.get_users(): if user_to_search.get_id() == int(user_id): return user_to_search except Exception as e: return None return None def get_users(self): return self.__users__ def add_user(self, user): max_id = 0 if len(self.__users__) > 0: max_id = max(self.__users__, key=lambda t: t.get_id()).get_id() user.set_id(max_id + 1) self.__users__.append(user) def remove_user(self, user): self.__users__.remove(user) def update_user(self, user): for i, user_to_update in enumerate(self.get_users()): if user_to_update.get_id() == user.get_id(): self.__users__[i] = user def get_user_folders(self, user_id): """ Get the user folder and creates them if necessary. :param user_id: User id related to these folders. :return: 3 folders, the user folder, the command folder to store EEG information and the model folder. """ root = kernel.get_connection_string() user = self.get_user(user_id) path_to_user = os.path.join(root, str(user.get_id()) + "_" + str(user.get_name())) os.makedirs(path_to_user, exist_ok=True) path_to_command = os.path.join(path_to_user, "cmd") os.makedirs(path_to_command, exist_ok=True) path_to_model = os.path.join(path_to_user, "model") os.makedirs(path_to_model, exist_ok=True) return path_to_user, path_to_command, path_to_model def save_command(self, user_id, command): """ Saves command in command folder. :param user_id: User id to find user folder. :param command: Command folder to save. """ path_to_user, path_to_command, _ = self.get_user_folders(user_id) path_data = os.path.join(path_to_command, str(command.get_id())) np.savetxt(path_data, command.get_eeg()) def load_command(self, user_id, command): """ Loads a command using EEG saved file data. :param user_id: User id to find user folder. :param command: Command folder to save. :return: """ _, path_to_command, _ = self.get_user_folders(user_id) path_data = os.path.join(path_to_command, str(command.get_id())) try: data = np.loadtxt(path_data) command.set_eeg(data) except Exception as e: print("No se ha podido cargar el archivo EEG") return None return command def save(self): """ Saves all information in users.json file. """ try: frozen = jsonpickle.encode(self) root = kernel.get_connection_string() path_to_user = os.path.join(root, "users.json") f = open(path_to_user, "w+") f.write(frozen) f.close() except Exception: print("Error guardando datos") def get_model_folder(self, user_id): """ Returns model folder. :param user_id: User id to find user folder. :return: Model folder. """ _, _, path_to_model = self.get_user_folders(user_id) return path_to_model
backend/managers/JsonStoreManager.py
import kernel from kernel.Interfaces.IStoreManager import IStoreManager import jsonpickle import os import numpy as np class JsonStoreManager(IStoreManager): def __init__(self): """ Constructor that initializes entity """ super().__init__() self.refresh() def refresh(self): """ Reloads file with new information, in particular recreates the user collection and all info associated. """ root = kernel.get_connection_string() path_to_user = os.path.join(root, "users.json") try: f = open(path_to_user, "r") json = f.read() frozen = jsonpickle.decode(json) self.__users__ = frozen.__users__ except Exception as e: print("Initial users file not found") finally: if 'f' in locals() and f is not None: f.close() @staticmethod def version(): return 1.0 def get_user(self, user_id): try: for user_to_search in self.get_users(): if user_to_search.get_id() == int(user_id): return user_to_search except Exception as e: return None return None def get_users(self): return self.__users__ def add_user(self, user): max_id = 0 if len(self.__users__) > 0: max_id = max(self.__users__, key=lambda t: t.get_id()).get_id() user.set_id(max_id + 1) self.__users__.append(user) def remove_user(self, user): self.__users__.remove(user) def update_user(self, user): for i, user_to_update in enumerate(self.get_users()): if user_to_update.get_id() == user.get_id(): self.__users__[i] = user def get_user_folders(self, user_id): """ Get the user folder and creates them if necessary. :param user_id: User id related to these folders. :return: 3 folders, the user folder, the command folder to store EEG information and the model folder. """ root = kernel.get_connection_string() user = self.get_user(user_id) path_to_user = os.path.join(root, str(user.get_id()) + "_" + str(user.get_name())) os.makedirs(path_to_user, exist_ok=True) path_to_command = os.path.join(path_to_user, "cmd") os.makedirs(path_to_command, exist_ok=True) path_to_model = os.path.join(path_to_user, "model") os.makedirs(path_to_model, exist_ok=True) return path_to_user, path_to_command, path_to_model def save_command(self, user_id, command): """ Saves command in command folder. :param user_id: User id to find user folder. :param command: Command folder to save. """ path_to_user, path_to_command, _ = self.get_user_folders(user_id) path_data = os.path.join(path_to_command, str(command.get_id())) np.savetxt(path_data, command.get_eeg()) def load_command(self, user_id, command): """ Loads a command using EEG saved file data. :param user_id: User id to find user folder. :param command: Command folder to save. :return: """ _, path_to_command, _ = self.get_user_folders(user_id) path_data = os.path.join(path_to_command, str(command.get_id())) try: data = np.loadtxt(path_data) command.set_eeg(data) except Exception as e: print("No se ha podido cargar el archivo EEG") return None return command def save(self): """ Saves all information in users.json file. """ try: frozen = jsonpickle.encode(self) root = kernel.get_connection_string() path_to_user = os.path.join(root, "users.json") f = open(path_to_user, "w+") f.write(frozen) f.close() except Exception: print("Error guardando datos") def get_model_folder(self, user_id): """ Returns model folder. :param user_id: User id to find user folder. :return: Model folder. """ _, _, path_to_model = self.get_user_folders(user_id) return path_to_model
0.387922
0.097864
from optparse import OptionParser from struct import * import sys import os.path import time import binascii MAGIC = 0x27051956 IMG_NAME_LENGTH = 32 archs = {'invalid':0, 'alpha':1, 'arm':2, 'x86':3, 'ia64':4, 'm68k':12, 'microblaze':14, 'mips':5, 'mips64':6, 'nios':13, 'nios2':15, 'powerpc':7, 'ppc':7, 's390':8, 'sh':9, 'sparc':10, 'sparc64':11, 'blackfin':16, 'arv32':17, 'st200':18 } oss = {'invalid':0, 'openbsd':1, 'netbsd':2, 'freebsd':3, '4_4bsd':4, 'linux':5, 'svr4':6, 'esix':7, 'solaris':8, 'irix':9, 'sco':10, 'dell':11, 'ncr':12, 'lynos':13, 'vxworks':14, 'psos':15, 'qnx':16, 'u-boot':17, 'rtems':18, 'artos':19, 'unity':20, 'integrity':21 } types = {'invalid':0, 'standalone':1, 'kernel':2, 'ramdisk':3, 'multi':4, 'firmware':5,'script':6, 'filesystem':7, 'flat_dt':8 } comps = {'none':0, 'bzip2':2, 'gzip':1, 'lzma':3 } usage = "usage: %prog [options] image" parser = OptionParser(usage=usage) parser.add_option("-A","--arch", dest="arch", default="powerpc", help="set architecture to 'arch'", metavar="ARCH") parser.add_option("-O","--os", dest="os", default="linux", help="set operating system to 'os'", metavar="OS") parser.add_option("-T","--type", dest="type", default="kernel", help="set image type to 'type'", metavar="TYPE") parser.add_option("-C","--comp", dest="comp", default="gzip", help="set compression type 'comp'", metavar="COMP") parser.add_option("-a","--addr", dest="addr", default="0", help="set load address to 'addr' (hex)", metavar="ADDR") parser.add_option("-e","--ep", dest="ep", default="0", help="set entry point to 'ep' (hex)", metavar="EP") parser.add_option("-n","--name", dest="name", default="", help="set image name to 'name'", metavar="NAME") parser.add_option("-d","--datafile", dest="datafile", help="use image data from 'datafile'", metavar="DATAFILE") parser.add_option("-x","--xip", action="store_true", dest="xip", default=False, help="set XIP (execute in place)") (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() if options.arch not in archs: print "Invalid architecture specified, aborting" sys.exit(2) if options.os not in oss: print "Invalid operating system specified, aborting" sys.exit(2) if options.comp not in comps: print "Invalid compression specified, aborting" sys.exit(2) if options.type not in types: print "Invalid image type specified, aborting" sys.exit(2) try: inputsize = os.path.getsize(options.datafile) inputfile = open(options.datafile, 'rb') except IOError: print "Invalid datafile specified, aborting" sys.exit(2) try: outputfile = open(args[0],'wb') except IOError: print "Error opening output file for writing, aborting" sys.exit(1) struct = Struct("!IIIIIIIBBBB"+str(IMG_NAME_LENGTH)+"s") outputfile.seek(struct.size); inputcrc = 0; while True: inputblock = inputfile.read(4096) if not inputblock: break inputcrc = binascii.crc32(inputblock, inputcrc) outputfile.write(inputblock) inputcrc = inputcrc & 0xffffffff structdata = struct.pack(MAGIC, 0, int(time.time()), inputsize, int(options.addr,16), int(options.ep,16), inputcrc, oss[options.os], archs[options.arch], types[options.type], comps[options.comp], options.name) headercrc = binascii.crc32(structdata) & 0xFFFFFFFF structdata = struct.pack(MAGIC, headercrc, int(time.time()), inputsize, int(options.addr,16), int(options.ep,16), inputcrc, oss[options.os], archs[options.arch], types[options.type], comps[options.comp], options.name) outputfile.seek(0) outputfile.write(structdata) outputfile.close() inputfile.close()
mkimage.py
from optparse import OptionParser from struct import * import sys import os.path import time import binascii MAGIC = 0x27051956 IMG_NAME_LENGTH = 32 archs = {'invalid':0, 'alpha':1, 'arm':2, 'x86':3, 'ia64':4, 'm68k':12, 'microblaze':14, 'mips':5, 'mips64':6, 'nios':13, 'nios2':15, 'powerpc':7, 'ppc':7, 's390':8, 'sh':9, 'sparc':10, 'sparc64':11, 'blackfin':16, 'arv32':17, 'st200':18 } oss = {'invalid':0, 'openbsd':1, 'netbsd':2, 'freebsd':3, '4_4bsd':4, 'linux':5, 'svr4':6, 'esix':7, 'solaris':8, 'irix':9, 'sco':10, 'dell':11, 'ncr':12, 'lynos':13, 'vxworks':14, 'psos':15, 'qnx':16, 'u-boot':17, 'rtems':18, 'artos':19, 'unity':20, 'integrity':21 } types = {'invalid':0, 'standalone':1, 'kernel':2, 'ramdisk':3, 'multi':4, 'firmware':5,'script':6, 'filesystem':7, 'flat_dt':8 } comps = {'none':0, 'bzip2':2, 'gzip':1, 'lzma':3 } usage = "usage: %prog [options] image" parser = OptionParser(usage=usage) parser.add_option("-A","--arch", dest="arch", default="powerpc", help="set architecture to 'arch'", metavar="ARCH") parser.add_option("-O","--os", dest="os", default="linux", help="set operating system to 'os'", metavar="OS") parser.add_option("-T","--type", dest="type", default="kernel", help="set image type to 'type'", metavar="TYPE") parser.add_option("-C","--comp", dest="comp", default="gzip", help="set compression type 'comp'", metavar="COMP") parser.add_option("-a","--addr", dest="addr", default="0", help="set load address to 'addr' (hex)", metavar="ADDR") parser.add_option("-e","--ep", dest="ep", default="0", help="set entry point to 'ep' (hex)", metavar="EP") parser.add_option("-n","--name", dest="name", default="", help="set image name to 'name'", metavar="NAME") parser.add_option("-d","--datafile", dest="datafile", help="use image data from 'datafile'", metavar="DATAFILE") parser.add_option("-x","--xip", action="store_true", dest="xip", default=False, help="set XIP (execute in place)") (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() if options.arch not in archs: print "Invalid architecture specified, aborting" sys.exit(2) if options.os not in oss: print "Invalid operating system specified, aborting" sys.exit(2) if options.comp not in comps: print "Invalid compression specified, aborting" sys.exit(2) if options.type not in types: print "Invalid image type specified, aborting" sys.exit(2) try: inputsize = os.path.getsize(options.datafile) inputfile = open(options.datafile, 'rb') except IOError: print "Invalid datafile specified, aborting" sys.exit(2) try: outputfile = open(args[0],'wb') except IOError: print "Error opening output file for writing, aborting" sys.exit(1) struct = Struct("!IIIIIIIBBBB"+str(IMG_NAME_LENGTH)+"s") outputfile.seek(struct.size); inputcrc = 0; while True: inputblock = inputfile.read(4096) if not inputblock: break inputcrc = binascii.crc32(inputblock, inputcrc) outputfile.write(inputblock) inputcrc = inputcrc & 0xffffffff structdata = struct.pack(MAGIC, 0, int(time.time()), inputsize, int(options.addr,16), int(options.ep,16), inputcrc, oss[options.os], archs[options.arch], types[options.type], comps[options.comp], options.name) headercrc = binascii.crc32(structdata) & 0xFFFFFFFF structdata = struct.pack(MAGIC, headercrc, int(time.time()), inputsize, int(options.addr,16), int(options.ep,16), inputcrc, oss[options.os], archs[options.arch], types[options.type], comps[options.comp], options.name) outputfile.seek(0) outputfile.write(structdata) outputfile.close() inputfile.close()
0.214527
0.094803
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Menu', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=50, verbose_name='name')), ], options={ 'verbose_name': 'menu', 'verbose_name_plural': 'menus', }, ), migrations.CreateModel( name='MenuItem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('caption', models.CharField(max_length=50, verbose_name='caption')), ('url', models.CharField(blank=True, max_length=200, verbose_name='URL')), ('named_url', models.CharField(blank=True, max_length=200, verbose_name='named URL')), ('level', models.IntegerField(default=0, editable=False, verbose_name='level')), ('rank', models.IntegerField(default=0, editable=False, verbose_name='rank')), ('menu', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contained_items', to='treemenus.Menu', verbose_name='menu')), ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='treemenus.MenuItem', verbose_name='parent')), ], ), migrations.AddField( model_name='menu', name='root_item', field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='is_root_item_of', to='treemenus.MenuItem', verbose_name='root item'), ), ]
treemenus/migrations/0001_initial.py
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Menu', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=50, verbose_name='name')), ], options={ 'verbose_name': 'menu', 'verbose_name_plural': 'menus', }, ), migrations.CreateModel( name='MenuItem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('caption', models.CharField(max_length=50, verbose_name='caption')), ('url', models.CharField(blank=True, max_length=200, verbose_name='URL')), ('named_url', models.CharField(blank=True, max_length=200, verbose_name='named URL')), ('level', models.IntegerField(default=0, editable=False, verbose_name='level')), ('rank', models.IntegerField(default=0, editable=False, verbose_name='rank')), ('menu', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contained_items', to='treemenus.Menu', verbose_name='menu')), ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='treemenus.MenuItem', verbose_name='parent')), ], ), migrations.AddField( model_name='menu', name='root_item', field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='is_root_item_of', to='treemenus.MenuItem', verbose_name='root item'), ), ]
0.568655
0.114715
import contextlib import pathlib import tempfile import typing from foodx_devops_tools.pipeline_config import load_template_context @contextlib.contextmanager def context_files( content: typing.Dict[str, typing.Dict[str, str]] ) -> typing.Generator[typing.List[pathlib.Path], None, None]: dir_paths = set() file_paths = set() with tempfile.TemporaryDirectory() as base_path: for this_dir, file_data in content.items(): dir_path = pathlib.Path(base_path) / this_dir dir_path.mkdir(parents=True) dir_paths.add(dir_path) for file_name, file_content in file_data.items(): this_file = dir_path / file_name with this_file.open("w") as f: f.write(file_content) file_paths.add(this_file) yield dir_paths, file_paths def test_load_files(): file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1v s1k2: s1k2v s2: s2k1: s2k1v """, "f2": """--- context: s3: s3k1: s3k1v """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert len(result.context) == 3 assert result.context == { "s1": { "s1k1": "s1k1v", "s1k2": "s1k2v", }, "s2": {"s2k1": "s2k1v"}, "s3": {"s3k1": "s3k1v"}, } def test_load_dirs(): file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1v s1k2: s1k2v s2: s2k1: s2k1v """, "f2": """--- context: s3: s3k1: s3k1v """, }, "b": { "f1": """--- context: s1: s1k3: s1k3v s4: s4k1: s4k1v """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert len(result.context) == 4 assert result.context == { "s1": { "s1k1": "s1k1v", "s1k2": "s1k2v", "s1k3": "s1k3v", }, "s2": {"s2k1": "s2k1v"}, "s3": {"s3k1": "s3k1v"}, "s4": {"s4k1": "s4k1v"}, } def test_deep_merge(): """yaml object data should be merged across all levels in the data.""" file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1kk1: v1 """, "f2": """--- context: s1: s1k1: s1k1kk2: s1k1kkk1: v2 """, }, "b": { "f1": """--- context: s1: s1k1: s1k1kk2: s1k1kkk2: v3 """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert result.context == { "s1": { "s1k1": { "s1k1kk1": "v1", "s1k1kk2": { "s1k1kkk1": "v2", "s1k1kkk2": "v3", }, }, }, }
tests/ci/unit_tests/pipeline_config/test_template_context.py
import contextlib import pathlib import tempfile import typing from foodx_devops_tools.pipeline_config import load_template_context @contextlib.contextmanager def context_files( content: typing.Dict[str, typing.Dict[str, str]] ) -> typing.Generator[typing.List[pathlib.Path], None, None]: dir_paths = set() file_paths = set() with tempfile.TemporaryDirectory() as base_path: for this_dir, file_data in content.items(): dir_path = pathlib.Path(base_path) / this_dir dir_path.mkdir(parents=True) dir_paths.add(dir_path) for file_name, file_content in file_data.items(): this_file = dir_path / file_name with this_file.open("w") as f: f.write(file_content) file_paths.add(this_file) yield dir_paths, file_paths def test_load_files(): file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1v s1k2: s1k2v s2: s2k1: s2k1v """, "f2": """--- context: s3: s3k1: s3k1v """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert len(result.context) == 3 assert result.context == { "s1": { "s1k1": "s1k1v", "s1k2": "s1k2v", }, "s2": {"s2k1": "s2k1v"}, "s3": {"s3k1": "s3k1v"}, } def test_load_dirs(): file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1v s1k2: s1k2v s2: s2k1: s2k1v """, "f2": """--- context: s3: s3k1: s3k1v """, }, "b": { "f1": """--- context: s1: s1k3: s1k3v s4: s4k1: s4k1v """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert len(result.context) == 4 assert result.context == { "s1": { "s1k1": "s1k1v", "s1k2": "s1k2v", "s1k3": "s1k3v", }, "s2": {"s2k1": "s2k1v"}, "s3": {"s3k1": "s3k1v"}, "s4": {"s4k1": "s4k1v"}, } def test_deep_merge(): """yaml object data should be merged across all levels in the data.""" file_text = { "a": { "f1": """--- context: s1: s1k1: s1k1kk1: v1 """, "f2": """--- context: s1: s1k1: s1k1kk2: s1k1kkk1: v2 """, }, "b": { "f1": """--- context: s1: s1k1: s1k1kk2: s1k1kkk2: v3 """, }, } with context_files(file_text) as (dir_paths, file_paths): result = load_template_context(file_paths) assert result.context == { "s1": { "s1k1": { "s1k1kk1": "v1", "s1k1kk2": { "s1k1kkk1": "v2", "s1k1kkk2": "v3", }, }, }, }
0.566258
0.294665
from typing import Optional, Union from matchsticks.game_types import Move from matchsticks.utils import generate_allowed class Game(object): def __init__(self, num_layers: int = 4) -> None: """ A game of matchsticks. :param num_layers: The number of layers of (odd numbers of) matchsticks you want to start the game with. """ # Check for valid number of layers if not 1 <= num_layers <= 8: print("Please choose a number of layers between 1 and 8 inclusive") raise ValueError # Store the number of layers so we can reset the game later self._num_layers = num_layers # Create the starting layers self._state = list(map(lambda x: int(x * 2 + 1), range(num_layers))) # Generate allowed moves reference (to be used by get_allowed) self._allowed_reference = generate_allowed(num_layers * 2 - 1) # print("starting allowed are", self._allowed_reference) def is_still_on(self) -> bool: """ Checks whether the game is still going or not :return: Whether or not the game is still happening """ return not not self._state def get_allowed(self) -> list[Move]: """ Generate the allowed moves for the given layers. :return: A list of lists of allowed moves, in the format (layer, low_idx, high_idx), all 1-indexed """ allowed = [] for i, layer_n in enumerate(self._state): together = list(map(lambda tup: (i + 1,) + tup, self._allowed_reference[layer_n - 1])) allowed += together return allowed def get_state(self) -> tuple[int]: """ Getter method for game state. :return: 3-tuple representing the game state. """ return tuple(self._state) def is_allowed(self, move: Move) -> bool: """ Check if a given move is valid. :param move: The move, written as a triple (layer_i, low_idx, high_idx). :return: True for valid move, False otherwise. """ layer_i, low, high = move # Make layer 0-indexed layer_i -= 1 return ( 0 <= layer_i < len(self._state) and 1 <= low <= high <= self._state[layer_i] ) def play_move(self, move: Move) -> bool: """ Play a move. :param move: A tuple containing your move, in the format (layer_i, low_idx, high_idx), where: - layer_i is the index of the layer you want to play on (1-indexed). - low_idx is the index of the lowest matchstick to cross off (1-indexed). - high_idx is the index of the highest matchstick to cross off (1-indexed. :return: whether or not the game is still going """ if not self.is_allowed(move): raise Exception(f"The move ({move}) is not a valid move.") layer_i, low_idx, high_idx = move # Make the layer 0-indexed layer_i -= 1 # Perform move # TODO: make this use the same code as imagine_move (no code duplication ideally) active_layer = self._state.pop(layer_i) left_result = low_idx - 1 right_result = active_layer - high_idx if left_result > 0: self._state.append(left_result) if right_result > 0: self._state.append(right_result) self._state.sort() # Return False if the game is over, # and True if the game is still going return self.is_still_on() def reset(self, position: Optional[Union[list[int], tuple[int]]] = None) -> None: """ Reset the game to the original configuration. :return: """ if position: self._state = list(position) else: self._state = list(map(lambda x: int(x * 2 + 1), range(self._num_layers))) def end(self) -> None: # TODO: make this work with clicking on the 'x' """ End the game prematurely. :return: """ self._state = None
matchsticks/game.py
from typing import Optional, Union from matchsticks.game_types import Move from matchsticks.utils import generate_allowed class Game(object): def __init__(self, num_layers: int = 4) -> None: """ A game of matchsticks. :param num_layers: The number of layers of (odd numbers of) matchsticks you want to start the game with. """ # Check for valid number of layers if not 1 <= num_layers <= 8: print("Please choose a number of layers between 1 and 8 inclusive") raise ValueError # Store the number of layers so we can reset the game later self._num_layers = num_layers # Create the starting layers self._state = list(map(lambda x: int(x * 2 + 1), range(num_layers))) # Generate allowed moves reference (to be used by get_allowed) self._allowed_reference = generate_allowed(num_layers * 2 - 1) # print("starting allowed are", self._allowed_reference) def is_still_on(self) -> bool: """ Checks whether the game is still going or not :return: Whether or not the game is still happening """ return not not self._state def get_allowed(self) -> list[Move]: """ Generate the allowed moves for the given layers. :return: A list of lists of allowed moves, in the format (layer, low_idx, high_idx), all 1-indexed """ allowed = [] for i, layer_n in enumerate(self._state): together = list(map(lambda tup: (i + 1,) + tup, self._allowed_reference[layer_n - 1])) allowed += together return allowed def get_state(self) -> tuple[int]: """ Getter method for game state. :return: 3-tuple representing the game state. """ return tuple(self._state) def is_allowed(self, move: Move) -> bool: """ Check if a given move is valid. :param move: The move, written as a triple (layer_i, low_idx, high_idx). :return: True for valid move, False otherwise. """ layer_i, low, high = move # Make layer 0-indexed layer_i -= 1 return ( 0 <= layer_i < len(self._state) and 1 <= low <= high <= self._state[layer_i] ) def play_move(self, move: Move) -> bool: """ Play a move. :param move: A tuple containing your move, in the format (layer_i, low_idx, high_idx), where: - layer_i is the index of the layer you want to play on (1-indexed). - low_idx is the index of the lowest matchstick to cross off (1-indexed). - high_idx is the index of the highest matchstick to cross off (1-indexed. :return: whether or not the game is still going """ if not self.is_allowed(move): raise Exception(f"The move ({move}) is not a valid move.") layer_i, low_idx, high_idx = move # Make the layer 0-indexed layer_i -= 1 # Perform move # TODO: make this use the same code as imagine_move (no code duplication ideally) active_layer = self._state.pop(layer_i) left_result = low_idx - 1 right_result = active_layer - high_idx if left_result > 0: self._state.append(left_result) if right_result > 0: self._state.append(right_result) self._state.sort() # Return False if the game is over, # and True if the game is still going return self.is_still_on() def reset(self, position: Optional[Union[list[int], tuple[int]]] = None) -> None: """ Reset the game to the original configuration. :return: """ if position: self._state = list(position) else: self._state = list(map(lambda x: int(x * 2 + 1), range(self._num_layers))) def end(self) -> None: # TODO: make this work with clicking on the 'x' """ End the game prematurely. :return: """ self._state = None
0.837736
0.618723
import logging import sys import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select import Select import settings import utils logging.info("starting teetime booking application") #calculate date / time values dates = utils.days_to_dates(settings.DAYS) min_seconds = utils.timestr_to_seconds(settings.INTERVAL[0]) max_seconds = utils.timestr_to_seconds(settings.INTERVAL[1]) if not dates: logging.info('no dates to book found, exiting') sys.exit() from pyvirtualdisplay import Display display = Display(visible=0, size=(800, 600)) display.start() logging.info('initializing browser') browser = webdriver.Firefox() browser.get(settings.BASE_URL) time.sleep(2) browser.find_element_by_id("btnSignIn").click() time.sleep(2) logging.info('logging in') username = browser.find_element_by_id("txtLogInName") password = browser.find_element_by_id("txtPassword") username.send_keys(settings.USERNAME) time.sleep(1) password.send_keys(settings.PASSWORD) time.sleep(1) browser.find_element_by_id("btnLogIn").click() logging.info('logged in') for date in dates: found_slot = False logging.info('searching tee times for %s' % date.strftime('%m/%d/%Y')) browser.find_element_by_id("rdpSearchStartDate_popupButton").click() time.sleep(1) calendar = browser.find_element_by_id("rdpSearchStartDate_dateInput") calendar.click() calendar.clear() time.sleep(1) calendar.send_keys(date.strftime('%m/%d/%Y')) calendar.send_keys(Keys.ENTER) time.sleep(16) #wait for the ajax call to complete logging.info('selecting number of players: %s' % settings.PLAYERS) select = Select(browser.find_element_by_id("ddlSearchPlayers")) select.select_by_visible_text(str(settings.PLAYERS)) time.sleep(16) #wait for the ajax call to complete elements = [] try: elements.extend(browser.find_elements_by_class_name("pnlReservationSearch_PreLoaded_Even")) except: pass try: elements.extend(browser.find_elements_by_class_name("pnlReservationSearch_PreLoaded_Odd")) except: pass if not elements: logging.warning('could not find any available tee times for %s' % date.strftime('%m/%d/%Y')) continue elements = utils.sort_elements(elements) for element in elements: tms = element.find_elements_by_class_name('PodLabel_TeeTime')[0] text = tms.get_attribute('innerHTML') logging.info('checking timeslot: %s' % text) seconds = utils.timestr_to_seconds(text) if min_seconds <= seconds <= max_seconds: #book found_slot = True logging.info('found timeslot: %s, booking it' % text) button_class = 'PodButton_Reserve%d' % settings.PLAYERS element.find_elements_by_class_name(button_class)[0].click() time.sleep(16) #use this to confirm browser.find_element_by_id('chkPolicyAgreement').click() time.sleep(1) browser.find_element_by_id('btn_process').click() time.sleep(1) browser.find_element_by_id('btnFinish').click() logging.info('booked timeslot %s' % text) #TODO: lblConfirmationNumber time.sleep(16) #use this to cancel #browser.find_element_by_id('btnCancelReservation').click() break if found_slot: break else: logging.warning('could not find any matching timeslot for %s' % date.strftime('%m/%d/%Y')) logging.info('closing browser') browser.close() time.sleep(1) logging.info('exiting') display.stop()
teetime.py
import logging import sys import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select import Select import settings import utils logging.info("starting teetime booking application") #calculate date / time values dates = utils.days_to_dates(settings.DAYS) min_seconds = utils.timestr_to_seconds(settings.INTERVAL[0]) max_seconds = utils.timestr_to_seconds(settings.INTERVAL[1]) if not dates: logging.info('no dates to book found, exiting') sys.exit() from pyvirtualdisplay import Display display = Display(visible=0, size=(800, 600)) display.start() logging.info('initializing browser') browser = webdriver.Firefox() browser.get(settings.BASE_URL) time.sleep(2) browser.find_element_by_id("btnSignIn").click() time.sleep(2) logging.info('logging in') username = browser.find_element_by_id("txtLogInName") password = browser.find_element_by_id("txtPassword") username.send_keys(settings.USERNAME) time.sleep(1) password.send_keys(settings.PASSWORD) time.sleep(1) browser.find_element_by_id("btnLogIn").click() logging.info('logged in') for date in dates: found_slot = False logging.info('searching tee times for %s' % date.strftime('%m/%d/%Y')) browser.find_element_by_id("rdpSearchStartDate_popupButton").click() time.sleep(1) calendar = browser.find_element_by_id("rdpSearchStartDate_dateInput") calendar.click() calendar.clear() time.sleep(1) calendar.send_keys(date.strftime('%m/%d/%Y')) calendar.send_keys(Keys.ENTER) time.sleep(16) #wait for the ajax call to complete logging.info('selecting number of players: %s' % settings.PLAYERS) select = Select(browser.find_element_by_id("ddlSearchPlayers")) select.select_by_visible_text(str(settings.PLAYERS)) time.sleep(16) #wait for the ajax call to complete elements = [] try: elements.extend(browser.find_elements_by_class_name("pnlReservationSearch_PreLoaded_Even")) except: pass try: elements.extend(browser.find_elements_by_class_name("pnlReservationSearch_PreLoaded_Odd")) except: pass if not elements: logging.warning('could not find any available tee times for %s' % date.strftime('%m/%d/%Y')) continue elements = utils.sort_elements(elements) for element in elements: tms = element.find_elements_by_class_name('PodLabel_TeeTime')[0] text = tms.get_attribute('innerHTML') logging.info('checking timeslot: %s' % text) seconds = utils.timestr_to_seconds(text) if min_seconds <= seconds <= max_seconds: #book found_slot = True logging.info('found timeslot: %s, booking it' % text) button_class = 'PodButton_Reserve%d' % settings.PLAYERS element.find_elements_by_class_name(button_class)[0].click() time.sleep(16) #use this to confirm browser.find_element_by_id('chkPolicyAgreement').click() time.sleep(1) browser.find_element_by_id('btn_process').click() time.sleep(1) browser.find_element_by_id('btnFinish').click() logging.info('booked timeslot %s' % text) #TODO: lblConfirmationNumber time.sleep(16) #use this to cancel #browser.find_element_by_id('btnCancelReservation').click() break if found_slot: break else: logging.warning('could not find any matching timeslot for %s' % date.strftime('%m/%d/%Y')) logging.info('closing browser') browser.close() time.sleep(1) logging.info('exiting') display.stop()
0.09268
0.055285
import logging import numpy as np import onnx import os import tempfile import torch import unittest from fairseq import models from pytorch_translate import rnn # noqa from pytorch_translate.ensemble_export import ( DecoderBatchedStepEnsemble, DecoderStepEnsemble, EncoderEnsemble, BeamSearch ) from pytorch_translate.test import utils as test_utils from caffe2.python.onnx import backend as caffe2_backend logger = logging.getLogger(__name__) class TestONNX(unittest.TestCase): def _test_ensemble_encoder_export(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) tmp_dir = tempfile.mkdtemp() encoder_pb_path = os.path.join(tmp_dir, 'encoder.pb') encoder_ensemble.onnx_export(encoder_pb_path) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) with open(encoder_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_encoder = caffe2_backend.prepare(onnx_model) caffe2_encoder_outputs = onnx_encoder.run( ( src_tokens.numpy(), src_lengths.numpy(), ), ) for i in range(len(pytorch_encoder_outputs)): caffe2_out_value = caffe2_encoder_outputs[i] pytorch_out_value = pytorch_encoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) encoder_ensemble.save_to_db( os.path.join(tmp_dir, 'encoder.predictor_export'), ) def test_ensemble_encoder_export_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_ensemble_encoder_export(test_args) def test_ensemble_encoder_export_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_ensemble_encoder_export(test_args) def _test_ensemble_encoder_object_export(self, encoder_ensemble): tmp_dir = tempfile.mkdtemp() encoder_pb_path = os.path.join(tmp_dir, 'encoder.pb') encoder_ensemble.onnx_export(encoder_pb_path) src_dict = encoder_ensemble.models[0].src_dict token_list = [src_dict.unk()] * 4 + [src_dict.eos()] src_tokens = torch.LongTensor( np.array(token_list, dtype='int64').reshape(-1, 1), ) src_lengths = torch.IntTensor( np.array([len(token_list)], dtype='int32'), ) pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) with open(encoder_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_encoder = caffe2_backend.prepare(onnx_model) srclen = src_tokens.size(1) beam_size = 1 src_tokens = src_tokens.repeat(1, beam_size).view(-1, srclen).numpy() src_lengths = src_lengths.repeat(beam_size).numpy() caffe2_encoder_outputs = onnx_encoder.run( ( src_tokens, src_lengths, ), ) for i in range(len(pytorch_encoder_outputs)): caffe2_out_value = caffe2_encoder_outputs[i] pytorch_out_value = pytorch_encoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) encoder_ensemble.save_to_db( os.path.join(tmp_dir, 'encoder.predictor_export'), ) def _test_full_ensemble_export(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) decoder_step_ensemble = DecoderStepEnsemble( model_list, beam_size=5, ) tmp_dir = tempfile.mkdtemp() decoder_step_pb_path = os.path.join(tmp_dir, 'decoder_step.pb') decoder_step_ensemble.onnx_export( decoder_step_pb_path, pytorch_encoder_outputs, ) # single EOS input_token = torch.LongTensor( np.array([[model_list[0].dst_dict.eos()]]), ) timestep = torch.LongTensor(np.array([[0]])) pytorch_decoder_outputs = decoder_step_ensemble( input_token, timestep, *pytorch_encoder_outputs ) with open(decoder_step_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_decoder = caffe2_backend.prepare(onnx_model) decoder_inputs_numpy = [input_token.numpy(), timestep.numpy()] for tensor in pytorch_encoder_outputs: decoder_inputs_numpy.append(tensor.detach().numpy()) caffe2_decoder_outputs = onnx_decoder.run(tuple(decoder_inputs_numpy)) for i in range(len(pytorch_decoder_outputs)): caffe2_out_value = caffe2_decoder_outputs[i] pytorch_out_value = pytorch_decoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) decoder_step_ensemble.save_to_db( os.path.join(tmp_dir, 'decoder_step.predictor_export'), pytorch_encoder_outputs, ) def test_full_ensemble_export_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_full_ensemble_export(test_args) def test_full_ensemble_export_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_full_ensemble_export(test_args) def _test_batched_beam_decoder_step(self, test_args): beam_size = 5 samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) decoder_step_ensemble = DecoderBatchedStepEnsemble( model_list, beam_size=beam_size, ) tmp_dir = tempfile.mkdtemp() decoder_step_pb_path = os.path.join(tmp_dir, 'decoder_step.pb') decoder_step_ensemble.onnx_export( decoder_step_pb_path, pytorch_encoder_outputs, ) # single EOS in flat array input_tokens = torch.LongTensor( np.array([model_list[0].dst_dict.eos()]), ) prev_scores = torch.FloatTensor(np.array([0.0])) timestep = torch.LongTensor(np.array([0])) pytorch_first_step_outputs = decoder_step_ensemble( input_tokens, prev_scores, timestep, *pytorch_encoder_outputs ) # next step inputs (input_tokesn shape: [beam_size]) next_input_tokens = torch.LongTensor( np.array([i for i in range(4, 9)]), ) next_prev_scores = pytorch_first_step_outputs[1] next_timestep = timestep + 1 next_states = list(pytorch_first_step_outputs[4:]) # Tile these for the next timestep for i in range(len(model_list)): next_states[i] = next_states[i].repeat(1, beam_size, 1) pytorch_next_step_outputs = decoder_step_ensemble( next_input_tokens, next_prev_scores, next_timestep, *next_states ) with open(decoder_step_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_decoder = caffe2_backend.prepare(onnx_model) decoder_inputs_numpy = [ next_input_tokens.numpy(), next_prev_scores.detach().numpy(), next_timestep.detach().numpy(), ] for tensor in next_states: decoder_inputs_numpy.append(tensor.detach().numpy()) caffe2_next_step_outputs = onnx_decoder.run( tuple(decoder_inputs_numpy), ) for i in range(len(pytorch_next_step_outputs)): caffe2_out_value = caffe2_next_step_outputs[i] pytorch_out_value = pytorch_next_step_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) def test_batched_beam_decoder_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_batched_beam_decoder_step(test_args) def test_batched_beam_decoder_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_batched_beam_decoder_step(test_args) def _test_full_beam_decoder(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model( test_args, src_dict, tgt_dict)) bs = BeamSearch(model_list, src_tokens, src_lengths, beam_size=6) prev_token = torch.LongTensor([0]) prev_scores = torch.FloatTensor([0.0]) attn_weights = torch.zeros(11) prev_hypos_indices = torch.zeros(6, dtype=torch.int64) outs = bs(src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])) import io f = io.BytesIO() torch.onnx._export( bs, (src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])), f, export_params=True, verbose=False, example_outputs=outs) torch.onnx._export_to_pretty_string( bs, (src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])), f, export_params=True, verbose=False, example_outputs=outs) f.seek(0) import onnx onnx_model = onnx.load(f) c2_model = caffe2_backend.prepare(onnx_model) c2_model.run((src_tokens.numpy(), src_lengths.numpy(), prev_token.numpy(), prev_scores.numpy(), attn_weights.numpy(), prev_hypos_indices.numpy(), np.array([20]))) @unittest.skip('Probably needs updated PyTorch') def test_full_beam_decoder(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_full_beam_decoder(test_args)
pytorch_translate/test/test_onnx.py
import logging import numpy as np import onnx import os import tempfile import torch import unittest from fairseq import models from pytorch_translate import rnn # noqa from pytorch_translate.ensemble_export import ( DecoderBatchedStepEnsemble, DecoderStepEnsemble, EncoderEnsemble, BeamSearch ) from pytorch_translate.test import utils as test_utils from caffe2.python.onnx import backend as caffe2_backend logger = logging.getLogger(__name__) class TestONNX(unittest.TestCase): def _test_ensemble_encoder_export(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) tmp_dir = tempfile.mkdtemp() encoder_pb_path = os.path.join(tmp_dir, 'encoder.pb') encoder_ensemble.onnx_export(encoder_pb_path) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) with open(encoder_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_encoder = caffe2_backend.prepare(onnx_model) caffe2_encoder_outputs = onnx_encoder.run( ( src_tokens.numpy(), src_lengths.numpy(), ), ) for i in range(len(pytorch_encoder_outputs)): caffe2_out_value = caffe2_encoder_outputs[i] pytorch_out_value = pytorch_encoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) encoder_ensemble.save_to_db( os.path.join(tmp_dir, 'encoder.predictor_export'), ) def test_ensemble_encoder_export_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_ensemble_encoder_export(test_args) def test_ensemble_encoder_export_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_ensemble_encoder_export(test_args) def _test_ensemble_encoder_object_export(self, encoder_ensemble): tmp_dir = tempfile.mkdtemp() encoder_pb_path = os.path.join(tmp_dir, 'encoder.pb') encoder_ensemble.onnx_export(encoder_pb_path) src_dict = encoder_ensemble.models[0].src_dict token_list = [src_dict.unk()] * 4 + [src_dict.eos()] src_tokens = torch.LongTensor( np.array(token_list, dtype='int64').reshape(-1, 1), ) src_lengths = torch.IntTensor( np.array([len(token_list)], dtype='int32'), ) pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) with open(encoder_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_encoder = caffe2_backend.prepare(onnx_model) srclen = src_tokens.size(1) beam_size = 1 src_tokens = src_tokens.repeat(1, beam_size).view(-1, srclen).numpy() src_lengths = src_lengths.repeat(beam_size).numpy() caffe2_encoder_outputs = onnx_encoder.run( ( src_tokens, src_lengths, ), ) for i in range(len(pytorch_encoder_outputs)): caffe2_out_value = caffe2_encoder_outputs[i] pytorch_out_value = pytorch_encoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) encoder_ensemble.save_to_db( os.path.join(tmp_dir, 'encoder.predictor_export'), ) def _test_full_ensemble_export(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) decoder_step_ensemble = DecoderStepEnsemble( model_list, beam_size=5, ) tmp_dir = tempfile.mkdtemp() decoder_step_pb_path = os.path.join(tmp_dir, 'decoder_step.pb') decoder_step_ensemble.onnx_export( decoder_step_pb_path, pytorch_encoder_outputs, ) # single EOS input_token = torch.LongTensor( np.array([[model_list[0].dst_dict.eos()]]), ) timestep = torch.LongTensor(np.array([[0]])) pytorch_decoder_outputs = decoder_step_ensemble( input_token, timestep, *pytorch_encoder_outputs ) with open(decoder_step_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_decoder = caffe2_backend.prepare(onnx_model) decoder_inputs_numpy = [input_token.numpy(), timestep.numpy()] for tensor in pytorch_encoder_outputs: decoder_inputs_numpy.append(tensor.detach().numpy()) caffe2_decoder_outputs = onnx_decoder.run(tuple(decoder_inputs_numpy)) for i in range(len(pytorch_decoder_outputs)): caffe2_out_value = caffe2_decoder_outputs[i] pytorch_out_value = pytorch_decoder_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) decoder_step_ensemble.save_to_db( os.path.join(tmp_dir, 'decoder_step.predictor_export'), pytorch_encoder_outputs, ) def test_full_ensemble_export_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_full_ensemble_export(test_args) def test_full_ensemble_export_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_full_ensemble_export(test_args) def _test_batched_beam_decoder_step(self, test_args): beam_size = 5 samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model(test_args, src_dict, tgt_dict)) encoder_ensemble = EncoderEnsemble(model_list) # test equivalence # The discrepancy in types here is a temporary expedient. # PyTorch indexing requires int64 while support for tracing # pack_padded_sequence() requires int32. sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() pytorch_encoder_outputs = encoder_ensemble(src_tokens, src_lengths) decoder_step_ensemble = DecoderBatchedStepEnsemble( model_list, beam_size=beam_size, ) tmp_dir = tempfile.mkdtemp() decoder_step_pb_path = os.path.join(tmp_dir, 'decoder_step.pb') decoder_step_ensemble.onnx_export( decoder_step_pb_path, pytorch_encoder_outputs, ) # single EOS in flat array input_tokens = torch.LongTensor( np.array([model_list[0].dst_dict.eos()]), ) prev_scores = torch.FloatTensor(np.array([0.0])) timestep = torch.LongTensor(np.array([0])) pytorch_first_step_outputs = decoder_step_ensemble( input_tokens, prev_scores, timestep, *pytorch_encoder_outputs ) # next step inputs (input_tokesn shape: [beam_size]) next_input_tokens = torch.LongTensor( np.array([i for i in range(4, 9)]), ) next_prev_scores = pytorch_first_step_outputs[1] next_timestep = timestep + 1 next_states = list(pytorch_first_step_outputs[4:]) # Tile these for the next timestep for i in range(len(model_list)): next_states[i] = next_states[i].repeat(1, beam_size, 1) pytorch_next_step_outputs = decoder_step_ensemble( next_input_tokens, next_prev_scores, next_timestep, *next_states ) with open(decoder_step_pb_path, 'r+b') as f: onnx_model = onnx.load(f) onnx_decoder = caffe2_backend.prepare(onnx_model) decoder_inputs_numpy = [ next_input_tokens.numpy(), next_prev_scores.detach().numpy(), next_timestep.detach().numpy(), ] for tensor in next_states: decoder_inputs_numpy.append(tensor.detach().numpy()) caffe2_next_step_outputs = onnx_decoder.run( tuple(decoder_inputs_numpy), ) for i in range(len(pytorch_next_step_outputs)): caffe2_out_value = caffe2_next_step_outputs[i] pytorch_out_value = pytorch_next_step_outputs[i].data.numpy() np.testing.assert_allclose( caffe2_out_value, pytorch_out_value, rtol=1e-4, atol=1e-6, ) def test_batched_beam_decoder_default(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_batched_beam_decoder_step(test_args) def test_batched_beam_decoder_vocab_reduction(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) lexical_dictionaries = test_utils.create_lexical_dictionaries() test_args.vocab_reduction_params = { 'lexical_dictionaries': lexical_dictionaries, 'num_top_words': 5, 'max_translation_candidates_per_word': 1, } self._test_batched_beam_decoder_step(test_args) def _test_full_beam_decoder(self, test_args): samples, src_dict, tgt_dict = test_utils.prepare_inputs(test_args) sample = next(samples) src_tokens = sample['net_input']['src_tokens'][0:1].t() src_lengths = sample['net_input']['src_lengths'][0:1].int() num_models = 3 model_list = [] for _ in range(num_models): model_list.append(models.build_model( test_args, src_dict, tgt_dict)) bs = BeamSearch(model_list, src_tokens, src_lengths, beam_size=6) prev_token = torch.LongTensor([0]) prev_scores = torch.FloatTensor([0.0]) attn_weights = torch.zeros(11) prev_hypos_indices = torch.zeros(6, dtype=torch.int64) outs = bs(src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])) import io f = io.BytesIO() torch.onnx._export( bs, (src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])), f, export_params=True, verbose=False, example_outputs=outs) torch.onnx._export_to_pretty_string( bs, (src_tokens, src_lengths, prev_token, prev_scores, attn_weights, prev_hypos_indices, torch.LongTensor([20])), f, export_params=True, verbose=False, example_outputs=outs) f.seek(0) import onnx onnx_model = onnx.load(f) c2_model = caffe2_backend.prepare(onnx_model) c2_model.run((src_tokens.numpy(), src_lengths.numpy(), prev_token.numpy(), prev_scores.numpy(), attn_weights.numpy(), prev_hypos_indices.numpy(), np.array([20]))) @unittest.skip('Probably needs updated PyTorch') def test_full_beam_decoder(self): test_args = test_utils.ModelParamsDict( encoder_bidirectional=True, sequence_lstm=True, ) self._test_full_beam_decoder(test_args)
0.466359
0.390592
from __future__ import print_function from amuse.units import units, nbody_system from amuse.datamodel import Particle from amuse.community.athena.interface import Athena from amuse.community.hermite.interface import Hermite from matplotlib import pyplot def hydro_grid_in_potential_well(mass=1 | units.MSun, length=100 | units.AU): converter = nbody_system.nbody_to_si(mass, length) # calculate density in field based on solar wind # gives a very low number molar_mass_hydrogen_proton = 1 | units.g / units.mol density_hydrogen_in_stellar_wind = 10 | 1 / units.cm**3 particles_per_mol = 6.022e23 | 1 / units.mol density_hydrogen_in_stellar_wind_in_moles = ( density_hydrogen_in_stellar_wind / particles_per_mol ) density_gas = 100 * ( density_hydrogen_in_stellar_wind_in_moles * molar_mass_hydrogen_proton ).as_quantity_in(units.MSun / units.AU**3) # override with higher number for plotting density_gas = 1e-3 | units.MSun / units.AU**3 instance = Athena(converter) instance.initialize_code() instance.parameters.nx = 50 instance.parameters.ny = 50 instance.parameters.nz = 1 instance.parameters.length_x = length instance.parameters.length_y = length instance.parameters.length_z = length instance.parameters.x_boundary_conditions = ("periodic", "periodic") instance.parameters.y_boundary_conditions = ("periodic", "periodic") instance.parameters.z_boundary_conditions = ("outflow", "outflow") # instance.stopping_conditions.number_of_steps_detection.enable() instance.set_has_external_gravitational_potential(1) instance.commit_parameters() grid_in_memory = instance.grid.copy() grid_in_memory.rho = density_gas pressure = 1 | units.Pa grid_in_memory.energy = pressure / (instance.parameters.gamma - 1) channel = grid_in_memory.new_channel_to(instance.grid) channel.copy() instance.initialize_grid() particle = Particle( mass=mass, position=length * [0.5, 0.5, 0.5], velocity=[0.0, 0.0, 0.0] | units.kms ) gravity = Hermite(converter) dx = (grid_in_memory.x[1][0][0] - grid_in_memory.x[0] [0][0]).as_quantity_in(units.AU) gravity.parameters.epsilon_squared = dx**2 gravity.particles.add_particle(particle) potential = gravity.get_potential_at_point( 0 * instance.potential_grid.x.flatten(), instance.potential_grid.x.flatten(), instance.potential_grid.y.flatten(), instance.potential_grid.z.flatten() ) potential = potential.reshape(instance.potential_grid.x.shape) instance.potential_grid.potential = potential instance.evolve_model(100 | units.yr) print(instance.get_timestep().value_in(units.yr)) value_to_plot = instance.grid.rho[:, :, 0].value_in( units.MSun / units.AU**3) # value_to_plot = potential[...,...,0].value_in(potential.unit) plot_grid(value_to_plot) def plot_grid(x): figure = pyplot.figure(figsize=(6, 6)) plot = figure.add_subplot(1, 1, 1) mappable = plot.imshow(x, origin='lower') pyplot.colorbar(mappable) # figure.savefig('orszag_tang.png') pyplot.show() if __name__ == '__main__': hydro_grid_in_potential_well()
examples/simple/grid_potential.py
from __future__ import print_function from amuse.units import units, nbody_system from amuse.datamodel import Particle from amuse.community.athena.interface import Athena from amuse.community.hermite.interface import Hermite from matplotlib import pyplot def hydro_grid_in_potential_well(mass=1 | units.MSun, length=100 | units.AU): converter = nbody_system.nbody_to_si(mass, length) # calculate density in field based on solar wind # gives a very low number molar_mass_hydrogen_proton = 1 | units.g / units.mol density_hydrogen_in_stellar_wind = 10 | 1 / units.cm**3 particles_per_mol = 6.022e23 | 1 / units.mol density_hydrogen_in_stellar_wind_in_moles = ( density_hydrogen_in_stellar_wind / particles_per_mol ) density_gas = 100 * ( density_hydrogen_in_stellar_wind_in_moles * molar_mass_hydrogen_proton ).as_quantity_in(units.MSun / units.AU**3) # override with higher number for plotting density_gas = 1e-3 | units.MSun / units.AU**3 instance = Athena(converter) instance.initialize_code() instance.parameters.nx = 50 instance.parameters.ny = 50 instance.parameters.nz = 1 instance.parameters.length_x = length instance.parameters.length_y = length instance.parameters.length_z = length instance.parameters.x_boundary_conditions = ("periodic", "periodic") instance.parameters.y_boundary_conditions = ("periodic", "periodic") instance.parameters.z_boundary_conditions = ("outflow", "outflow") # instance.stopping_conditions.number_of_steps_detection.enable() instance.set_has_external_gravitational_potential(1) instance.commit_parameters() grid_in_memory = instance.grid.copy() grid_in_memory.rho = density_gas pressure = 1 | units.Pa grid_in_memory.energy = pressure / (instance.parameters.gamma - 1) channel = grid_in_memory.new_channel_to(instance.grid) channel.copy() instance.initialize_grid() particle = Particle( mass=mass, position=length * [0.5, 0.5, 0.5], velocity=[0.0, 0.0, 0.0] | units.kms ) gravity = Hermite(converter) dx = (grid_in_memory.x[1][0][0] - grid_in_memory.x[0] [0][0]).as_quantity_in(units.AU) gravity.parameters.epsilon_squared = dx**2 gravity.particles.add_particle(particle) potential = gravity.get_potential_at_point( 0 * instance.potential_grid.x.flatten(), instance.potential_grid.x.flatten(), instance.potential_grid.y.flatten(), instance.potential_grid.z.flatten() ) potential = potential.reshape(instance.potential_grid.x.shape) instance.potential_grid.potential = potential instance.evolve_model(100 | units.yr) print(instance.get_timestep().value_in(units.yr)) value_to_plot = instance.grid.rho[:, :, 0].value_in( units.MSun / units.AU**3) # value_to_plot = potential[...,...,0].value_in(potential.unit) plot_grid(value_to_plot) def plot_grid(x): figure = pyplot.figure(figsize=(6, 6)) plot = figure.add_subplot(1, 1, 1) mappable = plot.imshow(x, origin='lower') pyplot.colorbar(mappable) # figure.savefig('orszag_tang.png') pyplot.show() if __name__ == '__main__': hydro_grid_in_potential_well()
0.861378
0.400867
from django.shortcuts import render from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponse import googlemaps from vets.models import VetSpot gmaps = googlemaps.Client(key='AIzaSyA0tl-yTrvyi_9UESPKQ27Ny4L0ONoktj8') def index(request): return render_to_response('search_page.html', context_instance=RequestContext(request)) def search_by_place(request): keyw= "" loc = "" if request.method == 'POST': loc = request.POST.get('location', '') keyw = request.POST.get('what', '') if not loc: return render_to_response('missing_location.html', context_instance=RequestContext(request)) geocode_result = gmaps.geocode(loc) if not geocode_result: return render_to_response('incorrect_location.html', context_instance=RequestContext(request)) lat = float(geocode_result[0]['geometry']['location']['lat']) lon = float(geocode_result[0]['geometry']['location']['lng']) if keyw : search_result = gmaps.places( keyw, location=(lat,lon), types='veterinary_care', radius = 10000) else: search_result = gmaps.places( 'animal', location=(lat,lon), types='veterinary_care', radius = 10000) out = display_map_with_result(request, search_result, loc) return HttpResponse(out) def locate_around_me(request, lat, lon): lat = float(lat) lon = float(lon) search_result = gmaps.places('animal', location=(lat,lon), types='veterinary_care', radius = 10000) reverse_geocode_result = gmaps.reverse_geocode((lat, lon)) loc = reverse_geocode_result[0]['formatted_address'] out = display_map_with_result(request, search_result, loc) return HttpResponse(out) def display_map_with_result(request, search_result, place): vslist = [] for r in search_result['results']: vs = VetSpot() vs.name = str(r['name']) vs.address = r['formatted_address'] vs.latitude = r['geometry']['location']['lat'] vs.longitude = r['geometry']['location']['lng'] vs.place_id = r['place_id'] if 'rating' in r.keys(): vs.rating = r['rating'] if 'opening_hours' in r.keys(): if str(r['opening_hours']['open_now']).lower == "true": vs.opennow = True vslist.append(vs) return render(request, 'poi_list.html', {'pois': vslist, 'place': place}) def details(request, p_id): detail_result = gmaps.place(p_id) info = detail_result['result'] lat = info['geometry']['location']['lat'] lon = info['geometry']['location']['lng'] display_info = {} display_info['Name'] = info['name'] display_info['Address'] = info['formatted_address'] if 'formatted_phone_number' in info.keys(): display_info['Phone'] = info['formatted_phone_number'] if 'international_phone_number' in info.keys(): display_info['International'] = info['international_phone_number'] if 'opening_hours' in info.keys(): display_info['Hours'] = info['opening_hours'] if 'permanently_closed' in info.keys(): display_info['permanently_closed'] = info['permanently_closed'] if 'photos' in info.keys(): display_info['photos'] = info['photos'] if 'price_level' in info.keys(): display_info['expense'] = info['price_level'] if 'rating' in info.keys(): display_info['rating'] = info['rating'] if 'reviews' in info.keys(): display_info['reviews'] = info['reviews'] if 'website' in info.keys(): display_info['website'] = info['website'] if 'vicinity' in info.keys(): display_info['vicinity'] = info['vicinity'] if 'url' in info.keys(): display_info['url'] = info['url'] return render(request, 'place_details.html', {'details': display_info, 'lat': lat, 'lon': lon, 'pid': p_id})
petcare/vets/views.py
from django.shortcuts import render from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponse import googlemaps from vets.models import VetSpot gmaps = googlemaps.Client(key='AIzaSyA0tl-yTrvyi_9UESPKQ27Ny4L0ONoktj8') def index(request): return render_to_response('search_page.html', context_instance=RequestContext(request)) def search_by_place(request): keyw= "" loc = "" if request.method == 'POST': loc = request.POST.get('location', '') keyw = request.POST.get('what', '') if not loc: return render_to_response('missing_location.html', context_instance=RequestContext(request)) geocode_result = gmaps.geocode(loc) if not geocode_result: return render_to_response('incorrect_location.html', context_instance=RequestContext(request)) lat = float(geocode_result[0]['geometry']['location']['lat']) lon = float(geocode_result[0]['geometry']['location']['lng']) if keyw : search_result = gmaps.places( keyw, location=(lat,lon), types='veterinary_care', radius = 10000) else: search_result = gmaps.places( 'animal', location=(lat,lon), types='veterinary_care', radius = 10000) out = display_map_with_result(request, search_result, loc) return HttpResponse(out) def locate_around_me(request, lat, lon): lat = float(lat) lon = float(lon) search_result = gmaps.places('animal', location=(lat,lon), types='veterinary_care', radius = 10000) reverse_geocode_result = gmaps.reverse_geocode((lat, lon)) loc = reverse_geocode_result[0]['formatted_address'] out = display_map_with_result(request, search_result, loc) return HttpResponse(out) def display_map_with_result(request, search_result, place): vslist = [] for r in search_result['results']: vs = VetSpot() vs.name = str(r['name']) vs.address = r['formatted_address'] vs.latitude = r['geometry']['location']['lat'] vs.longitude = r['geometry']['location']['lng'] vs.place_id = r['place_id'] if 'rating' in r.keys(): vs.rating = r['rating'] if 'opening_hours' in r.keys(): if str(r['opening_hours']['open_now']).lower == "true": vs.opennow = True vslist.append(vs) return render(request, 'poi_list.html', {'pois': vslist, 'place': place}) def details(request, p_id): detail_result = gmaps.place(p_id) info = detail_result['result'] lat = info['geometry']['location']['lat'] lon = info['geometry']['location']['lng'] display_info = {} display_info['Name'] = info['name'] display_info['Address'] = info['formatted_address'] if 'formatted_phone_number' in info.keys(): display_info['Phone'] = info['formatted_phone_number'] if 'international_phone_number' in info.keys(): display_info['International'] = info['international_phone_number'] if 'opening_hours' in info.keys(): display_info['Hours'] = info['opening_hours'] if 'permanently_closed' in info.keys(): display_info['permanently_closed'] = info['permanently_closed'] if 'photos' in info.keys(): display_info['photos'] = info['photos'] if 'price_level' in info.keys(): display_info['expense'] = info['price_level'] if 'rating' in info.keys(): display_info['rating'] = info['rating'] if 'reviews' in info.keys(): display_info['reviews'] = info['reviews'] if 'website' in info.keys(): display_info['website'] = info['website'] if 'vicinity' in info.keys(): display_info['vicinity'] = info['vicinity'] if 'url' in info.keys(): display_info['url'] = info['url'] return render(request, 'place_details.html', {'details': display_info, 'lat': lat, 'lon': lon, 'pid': p_id})
0.272896
0.125065
from bs4 import BeautifulSoup import time import requests from random import randint class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def offlineMode(): try: file = open("quotes.txt","r") except: print 'Nothing found in offline data' def compareResult(): file = open("result.txt","r") data = file.read().splitlines() file.close() if data[-1] == max(data): print 'It is your highest score' else: print bcolors.BOLD+bcolors.OKGREEN+'Your highest score is: '+str(max(data))+bcolors.ENDC def addResult(result): file = open("result.txt","a+") file.write(result+'\n') file.close() def testingArea(real,typed): wordCount = 0 wrongCount = 0 for i in xrange(len(real)): for j in xrange(len(real[i])): if real[i][j] == typed[i][j]: if real[i][j] == ' ': pass else: wordCount += 1 else: wrongCount += 1 return wordCount,wrongCount def randomNum(mx): return randint(1,mx) def getQuotes(): que = [] check = [] x = randomNum(219) url = "http://www.values.com/inspirational-quotes?page="+str(x) r = requests.get(url) soup = BeautifulSoup(r.content) h = soup.find_all("h6") for i in xrange(2): y = randomNum(len(h)) while True: if y in que: y = randomNum(len(h)) else: break check.append(str(h[y-1].text)) file = open("quotes.txt","a+") file.write(str(h[y-1].text)+'\n') file.close() que.append(y) return check print bcolors.OKBLUE+'\n\n\nQypo - Make typing interesting'+bcolors.ENDC print bcolors.OKBLUE+'"Increase your typing speed by reading quotes"'+bcolors.ENDC raw_input(bcolors.WARNING+'Press Enter to continue...'+bcolors.ENDC) print bcolors.OKBLUE+'\nTip: Make sure everything is exactly typed same.'+bcolors.ENDC try: text = getQuotes() except: xx = 1 while True: print 'Trying . . .',xx try: text = getQuotes() break except: xx+=1 if xx == 5: print 'Internet is dead I guess' print 'Want to try offline ? [Y]es / [N]o' en = raw_input() if en == 'Y': offlineMode() elif en == 'N': print 'Ok Bye' break print bcolors.BOLD+bcolors.FAIL+'\n\nAll ready'+bcolors.ENDC print bcolors.FAIL+'Starting in '+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'3'+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'2'+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'1'+bcolors.ENDC time.sleep(1) print '\n' totalTime = 0 totalWords = 0 testingArea = [] for i in text: t = time.time() print '--------------------------\n' print bcolors.BOLD+i+bcolors.ENDC print '\n--------------------------' test = raw_input() print time.time() -t totalTime += time.time() -t testingArea.append(test) time.sleep(1) wordc = 0 wrongc = 0 #wordc,wrongc = testingArea(text,testing for i in xrange(len(text)): for j in xrange(len(text[i])): try: if text[i][j] == testingArea[i][j]: if text[i][j] == ' ': pass else: wordc += 1 else: wrongc += 1 except: wrongc += 1 if wrongc >= 1: print bcolors.BOLD+bcolors.FAIL+'\n\nYou failed. Better luck next time'+bcolors.ENDC else: grosswpm = ((wordc+wrongc)/5)/(totalTime/60) print bcolors.OKGREEN+'\n\n\nTotal time: ' + str(totalTime)+bcolors.ENDC print bcolors.OKGREEN+'Gross WPM: '+ str(grosswpm)+bcolors.ENDC print bcolors.FAIL+'Total Errors: '+str(wrongc)+bcolors.ENDC print bcolors.OKGREEN+'Total words:' +str(wordc)+bcolors.ENDC netwpm = grosswpm - (wrongc/(totalTime/60)) print bcolors.BOLD+bcolors.OKGREEN+'\nOverall your Typing Speed is: '+str(netwpm)+'\n\n'+bcolors.ENDC addResult(str(netwpm)) compareResult()
learntype.py
from bs4 import BeautifulSoup import time import requests from random import randint class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def offlineMode(): try: file = open("quotes.txt","r") except: print 'Nothing found in offline data' def compareResult(): file = open("result.txt","r") data = file.read().splitlines() file.close() if data[-1] == max(data): print 'It is your highest score' else: print bcolors.BOLD+bcolors.OKGREEN+'Your highest score is: '+str(max(data))+bcolors.ENDC def addResult(result): file = open("result.txt","a+") file.write(result+'\n') file.close() def testingArea(real,typed): wordCount = 0 wrongCount = 0 for i in xrange(len(real)): for j in xrange(len(real[i])): if real[i][j] == typed[i][j]: if real[i][j] == ' ': pass else: wordCount += 1 else: wrongCount += 1 return wordCount,wrongCount def randomNum(mx): return randint(1,mx) def getQuotes(): que = [] check = [] x = randomNum(219) url = "http://www.values.com/inspirational-quotes?page="+str(x) r = requests.get(url) soup = BeautifulSoup(r.content) h = soup.find_all("h6") for i in xrange(2): y = randomNum(len(h)) while True: if y in que: y = randomNum(len(h)) else: break check.append(str(h[y-1].text)) file = open("quotes.txt","a+") file.write(str(h[y-1].text)+'\n') file.close() que.append(y) return check print bcolors.OKBLUE+'\n\n\nQypo - Make typing interesting'+bcolors.ENDC print bcolors.OKBLUE+'"Increase your typing speed by reading quotes"'+bcolors.ENDC raw_input(bcolors.WARNING+'Press Enter to continue...'+bcolors.ENDC) print bcolors.OKBLUE+'\nTip: Make sure everything is exactly typed same.'+bcolors.ENDC try: text = getQuotes() except: xx = 1 while True: print 'Trying . . .',xx try: text = getQuotes() break except: xx+=1 if xx == 5: print 'Internet is dead I guess' print 'Want to try offline ? [Y]es / [N]o' en = raw_input() if en == 'Y': offlineMode() elif en == 'N': print 'Ok Bye' break print bcolors.BOLD+bcolors.FAIL+'\n\nAll ready'+bcolors.ENDC print bcolors.FAIL+'Starting in '+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'3'+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'2'+bcolors.ENDC time.sleep(1) print bcolors.FAIL+'1'+bcolors.ENDC time.sleep(1) print '\n' totalTime = 0 totalWords = 0 testingArea = [] for i in text: t = time.time() print '--------------------------\n' print bcolors.BOLD+i+bcolors.ENDC print '\n--------------------------' test = raw_input() print time.time() -t totalTime += time.time() -t testingArea.append(test) time.sleep(1) wordc = 0 wrongc = 0 #wordc,wrongc = testingArea(text,testing for i in xrange(len(text)): for j in xrange(len(text[i])): try: if text[i][j] == testingArea[i][j]: if text[i][j] == ' ': pass else: wordc += 1 else: wrongc += 1 except: wrongc += 1 if wrongc >= 1: print bcolors.BOLD+bcolors.FAIL+'\n\nYou failed. Better luck next time'+bcolors.ENDC else: grosswpm = ((wordc+wrongc)/5)/(totalTime/60) print bcolors.OKGREEN+'\n\n\nTotal time: ' + str(totalTime)+bcolors.ENDC print bcolors.OKGREEN+'Gross WPM: '+ str(grosswpm)+bcolors.ENDC print bcolors.FAIL+'Total Errors: '+str(wrongc)+bcolors.ENDC print bcolors.OKGREEN+'Total words:' +str(wordc)+bcolors.ENDC netwpm = grosswpm - (wrongc/(totalTime/60)) print bcolors.BOLD+bcolors.OKGREEN+'\nOverall your Typing Speed is: '+str(netwpm)+'\n\n'+bcolors.ENDC addResult(str(netwpm)) compareResult()
0.056986
0.076477
import importlib from pydashery import Widget def find_function(search_def): """ Dynamically load the function based on the search definition. :param str search_def: A string to tell us the function to load, e.g. module:funcname or module.path:class.staticmethod :raises ValueError: In case configuration is invalid :return function: A function """ try: module_name, funcspec = search_def.split(":") except ValueError: raise ValueError("Function definition \"{}\" is not valid.".format( search_def )) try: module = importlib.import_module(module_name) except ImportError: raise ValueError( "Function definition \"{}\" is not valid. The module specified " "was not found.".format( search_def ) ) if "." in funcspec: class_name, func_name = funcspec.split(".") try: source = getattr(module, class_name) except AttributeError: raise ValueError( "Function definition \"{}\" is not valid. The module does not " "contain the specified class.".format( search_def ) ) else: source = module func_name = funcspec try: func = getattr(source, func_name) except AttributeError: raise ValueError( "Function definition \"{}\" is not valid. The function specified " "could not be found.".format( search_def ) ) return func class FunctionResultWidget(Widget): TYPE = "FunctionResult" TEMPLATE = "functionresult.html" DEFAULT_SETTINGS = { "update_minutes": 1.0 } def get_update_interval(self): return float(self.settings["update_minutes"]) * 60.0 def update(self): self.set_value(self.get_result()) def get_result(self): f = find_function(self.settings["func"]) return f()
backend/widgets/functionresult.py
import importlib from pydashery import Widget def find_function(search_def): """ Dynamically load the function based on the search definition. :param str search_def: A string to tell us the function to load, e.g. module:funcname or module.path:class.staticmethod :raises ValueError: In case configuration is invalid :return function: A function """ try: module_name, funcspec = search_def.split(":") except ValueError: raise ValueError("Function definition \"{}\" is not valid.".format( search_def )) try: module = importlib.import_module(module_name) except ImportError: raise ValueError( "Function definition \"{}\" is not valid. The module specified " "was not found.".format( search_def ) ) if "." in funcspec: class_name, func_name = funcspec.split(".") try: source = getattr(module, class_name) except AttributeError: raise ValueError( "Function definition \"{}\" is not valid. The module does not " "contain the specified class.".format( search_def ) ) else: source = module func_name = funcspec try: func = getattr(source, func_name) except AttributeError: raise ValueError( "Function definition \"{}\" is not valid. The function specified " "could not be found.".format( search_def ) ) return func class FunctionResultWidget(Widget): TYPE = "FunctionResult" TEMPLATE = "functionresult.html" DEFAULT_SETTINGS = { "update_minutes": 1.0 } def get_update_interval(self): return float(self.settings["update_minutes"]) * 60.0 def update(self): self.set_value(self.get_result()) def get_result(self): f = find_function(self.settings["func"]) return f()
0.547222
0.395426
from enum import Enum from typing import Dict, List from robot.board import Board class PinMode(Enum): """A pin-mode for a pin on the servo board.""" INPUT = 'Z' INPUT_PULLUP = 'P' OUTPUT_HIGH = 'H' OUTPUT_LOW = 'L' class PinValue(Enum): """A value state for a pin on the servo board.""" HIGH = 'H' LOW = 'L' class Servo: """A servo output on a ``ServoBoard``.""" def __init__(self, servo_id, set_pos, get_pos): self.servo_id = servo_id self._set_pos = set_pos self._get_pos = get_pos @property def position(self) -> float: """The configured position the servo output.""" return self._get_pos() @position.setter def position(self, position): if position > 1 or position < -1: raise ValueError("servo position must be between -1 and 1") self._set_pos(position) class Gpio: """A general-purpose input-output pin on a ``ServoBoard``.""" def __init__(self, pin_id, pin_read, pin_mode_get, pin_mode_set): self._pin_id = pin_id self._pin_read = pin_read self._pin_mode_get = pin_mode_get self._pin_mode_set = pin_mode_set @property def mode(self) -> PinMode: """The ``PinMode`` the pin is currently in.""" return PinMode(self._pin_mode_get()) @mode.setter def mode(self, mode: PinMode): """ Set the mode the pin should be in. :param mode: The ``PinMode`` to set the pin to. """ if mode not in ( PinMode.INPUT, PinMode.INPUT_PULLUP, PinMode.OUTPUT_HIGH, PinMode.OUTPUT_LOW, ): raise ValueError("Mode should be a valid 'PinMode', got {!r}".format(mode)) self._pin_mode_set(mode) def read(self) -> PinValue: """Read the current ``PinValue`` of the pin.""" valid_read_modes = (PinMode.INPUT, PinMode.INPUT_PULLUP) if self._pin_mode_get() not in valid_read_modes: raise Exception( "Pin mode needs to be in a valid read ``PinMode`` to be read. " "Valid modes are: {}.".format( ", ".join(str(x) for x in valid_read_modes), ), ) return self._pin_read() class ArduinoError(Exception): """Base class for exceptions fed back from the ``ServoBoard`` (arduino).""" pass class CommandError(ArduinoError): """The servo assembly experienced an error in processing a command.""" pass class InvalidResponse(ArduinoError): """The servo assembly emitted a response which could not be processed.""" pass class ServoBoard(Board): """ A servo board, providing access to ``Servo``s and ``Gpio`` pins. This is an arduino with a servo shield attached. """ def __init__(self, socket_path): super().__init__(socket_path) servo_ids = range(0, 16) # servos with a port 0-15 gpio_pins = range(2, 14) # gpio pins 2-13 self._servos = {} # type: Dict[int, Servo] for x in servo_ids: self._servos[x] = Servo( x, (lambda pos, x=x: self._set_servo_pos(x, pos)), (lambda x=x: self._get_servo_pos(x)), ) self._gpios = { x: Gpio( x, (lambda x=x: self._read_pin(x)), (lambda x=x: self._get_pin_mode(x)), (lambda value, x=x: self._set_pin_mode(x, value)), ) for x in gpio_pins } # type: Dict[int, Gpio] def direct_command(self, command_name: str, *args) -> List[str]: """ Issue a command directly to the arduino. :Example: >>> # arrives on the arduino as "my-command 4" >>> servo_board.direct_command('my-command', 4) ["first line response from my command", "second line"] The arguments to this method are bundled as a list and passed to robotd. We expect to immediately get back a response message (as well as the usual status blob) which contains either valid data from the arduino or a description of the failure. """ command = (command_name,) + args response = self._send_and_receive({'command': command})['response'] status = response['status'] # consume the broadcast status self._receive() if status == 'ok': return response['data'] else: for cls in (CommandError, InvalidResponse): if cls.__name__ == response['type']: raise cls(response['description']) raise ArduinoError(response['description']) # Servo code @property def servos(self) -> Dict[int, Servo]: """List of ``Servo`` outputs for the servo board.""" return self._servos def _set_servo_pos(self, servo: int, pos: float): self._send_and_receive({'servos': {servo: pos}}) def _get_servo_pos(self, servo: int) -> float: data = self._send_and_receive({}) values = data['servos'] return float(values[str(servo)]) # GPIO code @property def gpios(self) -> Dict[int, Gpio]: """List of ``Gpio`` pins for the servo board.""" return self._gpios def _read_pin(self, pin) -> PinValue: # request a check for that pin by trying to set it to None data = self._send_and_receive({'read-pins': [pin]}) # example data value: # {'pin-values':{2:'high'}} values = data['pin-values'] return PinValue(values[str(pin)]) def _get_pin_mode(self, pin) -> PinMode: data = self._send_and_receive({}) # example data value: # {'pins':{2:'pullup'}} values = data['pins'] return PinMode(values[str(pin)]) def _set_pin_mode(self, pin, value: PinMode): self._send_and_receive({'pins': {pin: value.value}}) def read_analogue(self) -> Dict[str, float]: """Read analogue values from the connected board.""" command = {'read-analogue': True} return self._send_and_receive(command)['analogue-values'] def read_ultrasound(self, trigger_pin, echo_pin): """ Read an ultrasound value from an ultrasound sensor. :param trigger_pin: The pin number on the servo board that the sensor's trigger pin is connected to. :param echo_pin: The pin number on the servo board that the sensor's echo pin is connected to. """ command = {'read-ultrasound': [trigger_pin, echo_pin]} return float(self._send_and_receive(command)['ultrasound'])
robot/servo.py
from enum import Enum from typing import Dict, List from robot.board import Board class PinMode(Enum): """A pin-mode for a pin on the servo board.""" INPUT = 'Z' INPUT_PULLUP = 'P' OUTPUT_HIGH = 'H' OUTPUT_LOW = 'L' class PinValue(Enum): """A value state for a pin on the servo board.""" HIGH = 'H' LOW = 'L' class Servo: """A servo output on a ``ServoBoard``.""" def __init__(self, servo_id, set_pos, get_pos): self.servo_id = servo_id self._set_pos = set_pos self._get_pos = get_pos @property def position(self) -> float: """The configured position the servo output.""" return self._get_pos() @position.setter def position(self, position): if position > 1 or position < -1: raise ValueError("servo position must be between -1 and 1") self._set_pos(position) class Gpio: """A general-purpose input-output pin on a ``ServoBoard``.""" def __init__(self, pin_id, pin_read, pin_mode_get, pin_mode_set): self._pin_id = pin_id self._pin_read = pin_read self._pin_mode_get = pin_mode_get self._pin_mode_set = pin_mode_set @property def mode(self) -> PinMode: """The ``PinMode`` the pin is currently in.""" return PinMode(self._pin_mode_get()) @mode.setter def mode(self, mode: PinMode): """ Set the mode the pin should be in. :param mode: The ``PinMode`` to set the pin to. """ if mode not in ( PinMode.INPUT, PinMode.INPUT_PULLUP, PinMode.OUTPUT_HIGH, PinMode.OUTPUT_LOW, ): raise ValueError("Mode should be a valid 'PinMode', got {!r}".format(mode)) self._pin_mode_set(mode) def read(self) -> PinValue: """Read the current ``PinValue`` of the pin.""" valid_read_modes = (PinMode.INPUT, PinMode.INPUT_PULLUP) if self._pin_mode_get() not in valid_read_modes: raise Exception( "Pin mode needs to be in a valid read ``PinMode`` to be read. " "Valid modes are: {}.".format( ", ".join(str(x) for x in valid_read_modes), ), ) return self._pin_read() class ArduinoError(Exception): """Base class for exceptions fed back from the ``ServoBoard`` (arduino).""" pass class CommandError(ArduinoError): """The servo assembly experienced an error in processing a command.""" pass class InvalidResponse(ArduinoError): """The servo assembly emitted a response which could not be processed.""" pass class ServoBoard(Board): """ A servo board, providing access to ``Servo``s and ``Gpio`` pins. This is an arduino with a servo shield attached. """ def __init__(self, socket_path): super().__init__(socket_path) servo_ids = range(0, 16) # servos with a port 0-15 gpio_pins = range(2, 14) # gpio pins 2-13 self._servos = {} # type: Dict[int, Servo] for x in servo_ids: self._servos[x] = Servo( x, (lambda pos, x=x: self._set_servo_pos(x, pos)), (lambda x=x: self._get_servo_pos(x)), ) self._gpios = { x: Gpio( x, (lambda x=x: self._read_pin(x)), (lambda x=x: self._get_pin_mode(x)), (lambda value, x=x: self._set_pin_mode(x, value)), ) for x in gpio_pins } # type: Dict[int, Gpio] def direct_command(self, command_name: str, *args) -> List[str]: """ Issue a command directly to the arduino. :Example: >>> # arrives on the arduino as "my-command 4" >>> servo_board.direct_command('my-command', 4) ["first line response from my command", "second line"] The arguments to this method are bundled as a list and passed to robotd. We expect to immediately get back a response message (as well as the usual status blob) which contains either valid data from the arduino or a description of the failure. """ command = (command_name,) + args response = self._send_and_receive({'command': command})['response'] status = response['status'] # consume the broadcast status self._receive() if status == 'ok': return response['data'] else: for cls in (CommandError, InvalidResponse): if cls.__name__ == response['type']: raise cls(response['description']) raise ArduinoError(response['description']) # Servo code @property def servos(self) -> Dict[int, Servo]: """List of ``Servo`` outputs for the servo board.""" return self._servos def _set_servo_pos(self, servo: int, pos: float): self._send_and_receive({'servos': {servo: pos}}) def _get_servo_pos(self, servo: int) -> float: data = self._send_and_receive({}) values = data['servos'] return float(values[str(servo)]) # GPIO code @property def gpios(self) -> Dict[int, Gpio]: """List of ``Gpio`` pins for the servo board.""" return self._gpios def _read_pin(self, pin) -> PinValue: # request a check for that pin by trying to set it to None data = self._send_and_receive({'read-pins': [pin]}) # example data value: # {'pin-values':{2:'high'}} values = data['pin-values'] return PinValue(values[str(pin)]) def _get_pin_mode(self, pin) -> PinMode: data = self._send_and_receive({}) # example data value: # {'pins':{2:'pullup'}} values = data['pins'] return PinMode(values[str(pin)]) def _set_pin_mode(self, pin, value: PinMode): self._send_and_receive({'pins': {pin: value.value}}) def read_analogue(self) -> Dict[str, float]: """Read analogue values from the connected board.""" command = {'read-analogue': True} return self._send_and_receive(command)['analogue-values'] def read_ultrasound(self, trigger_pin, echo_pin): """ Read an ultrasound value from an ultrasound sensor. :param trigger_pin: The pin number on the servo board that the sensor's trigger pin is connected to. :param echo_pin: The pin number on the servo board that the sensor's echo pin is connected to. """ command = {'read-ultrasound': [trigger_pin, echo_pin]} return float(self._send_and_receive(command)['ultrasound'])
0.928198
0.432962
from django.contrib.auth.decorators import login_required from django.http import HttpResponse import datetime from openpyxl import Workbook import xlwt from dashboard.sheet_builder import NewSheetBuilder from dashboard.utils import extract_list_from_sheet, controlePlanosSheetFiller, cotachSheetFiller from .models import * @login_required(login_url='login') def exportarProjetosExcel(request, cron_id): unidades = Unidade.objects.all() cronograma = Cronograma.objects.get(id = cron_id) filename = f"Resumo Sistema - Planos de ação - {cronograma.inicio_servicos.strftime(f'%d')} a {cronograma.fim_servicos.strftime(f'%d de %B')}" response = HttpResponse(content_type='application/ms-excel') response['Content-Disposition'] = f'attachment; filename="{filename}.xls"' wb = xlwt.Workbook(encoding='utf-8') controlePlanosSheetFiller(wb.add_sheet('CONTROLE'),cronograma,unidades) cotachSheetFiller(wb.add_sheet("COTAxCH"), cronograma, unidades ) wb.save(response) return response @login_required(login_url='login') def exportarVagasExcel(request, cron_id, dia): dia = datetime.datetime.strptime(dia, f"%Y-%m-%d").date() vagas = Vaga.objects.filter(dia = dia) filename = "Vagas "+dia.strftime(f"%d-%m-%Y") response = HttpResponse(content_type='application/ms-excel') response['Content-Disposition'] = f'attachment; filename="{filename}.xlsx"' wb = Workbook() sheet = wb.active sheet.title="Vagas" if not vagas.exists(): wb.save(response) return response sb = NewSheetBuilder(sheet) sb.set_col_widths([10,10,35,30,10,10]) sb.write_header([ {'text':'DATA'}, {'text':'UNIDADE'}, {'text':'ATIVIDADE'}, {'text':'RESPONSÁVEL'}, {'text':'HORÁRIO'}, {'text':'CH'}]) sb.enter() for vaga in vagas: sb.write_cell(date_format(vaga.dia, "d-M")) sb.write_cell(vaga.unidade.sigla, style = sb.get_random_color_style(vaga.unidade.id)) sb.write_cell(vaga.atividade) sb.write_cell(vaga.responsavel) sb.write_cell(vaga.horario, style=None if vaga.carga_horaria==12 else 'highlight_') sb.write_cell(vaga.carga_horaria, carr_ret=True) wb.save(response) return response
projetos/reports.py
from django.contrib.auth.decorators import login_required from django.http import HttpResponse import datetime from openpyxl import Workbook import xlwt from dashboard.sheet_builder import NewSheetBuilder from dashboard.utils import extract_list_from_sheet, controlePlanosSheetFiller, cotachSheetFiller from .models import * @login_required(login_url='login') def exportarProjetosExcel(request, cron_id): unidades = Unidade.objects.all() cronograma = Cronograma.objects.get(id = cron_id) filename = f"Resumo Sistema - Planos de ação - {cronograma.inicio_servicos.strftime(f'%d')} a {cronograma.fim_servicos.strftime(f'%d de %B')}" response = HttpResponse(content_type='application/ms-excel') response['Content-Disposition'] = f'attachment; filename="{filename}.xls"' wb = xlwt.Workbook(encoding='utf-8') controlePlanosSheetFiller(wb.add_sheet('CONTROLE'),cronograma,unidades) cotachSheetFiller(wb.add_sheet("COTAxCH"), cronograma, unidades ) wb.save(response) return response @login_required(login_url='login') def exportarVagasExcel(request, cron_id, dia): dia = datetime.datetime.strptime(dia, f"%Y-%m-%d").date() vagas = Vaga.objects.filter(dia = dia) filename = "Vagas "+dia.strftime(f"%d-%m-%Y") response = HttpResponse(content_type='application/ms-excel') response['Content-Disposition'] = f'attachment; filename="{filename}.xlsx"' wb = Workbook() sheet = wb.active sheet.title="Vagas" if not vagas.exists(): wb.save(response) return response sb = NewSheetBuilder(sheet) sb.set_col_widths([10,10,35,30,10,10]) sb.write_header([ {'text':'DATA'}, {'text':'UNIDADE'}, {'text':'ATIVIDADE'}, {'text':'RESPONSÁVEL'}, {'text':'HORÁRIO'}, {'text':'CH'}]) sb.enter() for vaga in vagas: sb.write_cell(date_format(vaga.dia, "d-M")) sb.write_cell(vaga.unidade.sigla, style = sb.get_random_color_style(vaga.unidade.id)) sb.write_cell(vaga.atividade) sb.write_cell(vaga.responsavel) sb.write_cell(vaga.horario, style=None if vaga.carga_horaria==12 else 'highlight_') sb.write_cell(vaga.carga_horaria, carr_ret=True) wb.save(response) return response
0.36886
0.069007
from version import __version__ import re import os import unittest import logging def SlashContrl(strpath): ''' Solves windows - os.path normalize fail for i.e. tests\\tests, considers \t an escape sequence. :filters:: ['\\r', '\\t', '\\f', '\\a', '\\v']. :return: true path [str] *other specific escape chars not filtered* ''' if not strpath or strpath == ' ': return None cntrls = ['r', 't', 'f', 'a', 'v'] res = None dbblstr = None for ct in cntrls: res = re.search('[\\' + ct + ']', strpath) if res: dbblstr = strpath[0:res.start()] + r'\\' + ct + strpath[res.end():] if not dbblstr: return None return os.path.normpath(os.path.abspath(dbblstr)) return os.path.normpath(os.path.abspath(strpath)) #pylint: disable=attribute-defined-outside-init #pylint: disable=invalid-name <EMAIL>("skipping TestCaseDoubleSlash") class TestCaseDoubleSlash(unittest.TestCase): @classmethod def setUpClass(cls): cls.cwd = os.getcwd() cls.pardir = os.path.dirname(os.getcwd()) tdir = '\\Tests' if 'Tests' in os.getcwd(): logging.warn('\n pardir {}'.format(cls.pardir)) cls.parStrs = {'0':'Tests\rtest.py', '1': '..\\Tests\test.py', '2': '.\\Tests/fest.py', '3': '.\\tests\ttest.py' } cls.resultStrs = {'0':os.path.join(cls.cwd + tdir + '\\rtest.py'), '1':os.path.join(os.path.dirname(cls.cwd) + tdir + \ '\\test.py'), '2':os.path.join(cls.cwd + tdir + '\\fest.py'), '3':os.path.join(cls.cwd + '\\tests\\ttest.py') } #logging.warn('\n dict slsh 3 {}'.format(cls.resultStrs['3'])) cls.cwd = os.getcwd() print("\n\t" + cls.__name__ + " set-up") @classmethod def tearDownClass(cls): print "\n" + cls.__name__ + " tear down" def setUp(self): print("\n" + self.id() + " Set-up") def tearDown(self): print "\n" + self.id() + " Tear down" def test_backslash_and_Controls_0(self): par = self.parStrs['0'] ret = self.resultStrs['0'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_1(self): par = self.parStrs['1'] ret = self.resultStrs['1'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_2(self): par = self.parStrs['2'] ret = self.resultStrs['2'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_3(self): par = self.parStrs['3'] ret = self.resultStrs['3'] self.assertEqual(SlashContrl(par), ret) if __name__ == '__main__': tests = unittest.TestLoader().loadTestsFromTestCase(TestCaseDoubleSlash) result = unittest.TextTestRunner(verbosity=3).run(tests) status = 'OK' if result.wasSuccessful() else 'FAILED (failures = ' + \ str(len(result.failures)) + ')\n' + 'ERRORS (errors = ' + \ str(len(result.errors)) + ')\n' print('\nRan {} tests \n\n{}' \ .format(result.testsRun, status)) if result.failures: print(('Fails:' + '\n {}'*len(result.failures)) \ .format(*result.failures)) if result.errors: print(('Errs:' + '\n{}'*len(result.errors[0])) \ .format(*result.errors[0])) #pylint: enable=attribute-defined-outside-init #pylint: enable=invalid-name
regt.py
from version import __version__ import re import os import unittest import logging def SlashContrl(strpath): ''' Solves windows - os.path normalize fail for i.e. tests\\tests, considers \t an escape sequence. :filters:: ['\\r', '\\t', '\\f', '\\a', '\\v']. :return: true path [str] *other specific escape chars not filtered* ''' if not strpath or strpath == ' ': return None cntrls = ['r', 't', 'f', 'a', 'v'] res = None dbblstr = None for ct in cntrls: res = re.search('[\\' + ct + ']', strpath) if res: dbblstr = strpath[0:res.start()] + r'\\' + ct + strpath[res.end():] if not dbblstr: return None return os.path.normpath(os.path.abspath(dbblstr)) return os.path.normpath(os.path.abspath(strpath)) #pylint: disable=attribute-defined-outside-init #pylint: disable=invalid-name <EMAIL>("skipping TestCaseDoubleSlash") class TestCaseDoubleSlash(unittest.TestCase): @classmethod def setUpClass(cls): cls.cwd = os.getcwd() cls.pardir = os.path.dirname(os.getcwd()) tdir = '\\Tests' if 'Tests' in os.getcwd(): logging.warn('\n pardir {}'.format(cls.pardir)) cls.parStrs = {'0':'Tests\rtest.py', '1': '..\\Tests\test.py', '2': '.\\Tests/fest.py', '3': '.\\tests\ttest.py' } cls.resultStrs = {'0':os.path.join(cls.cwd + tdir + '\\rtest.py'), '1':os.path.join(os.path.dirname(cls.cwd) + tdir + \ '\\test.py'), '2':os.path.join(cls.cwd + tdir + '\\fest.py'), '3':os.path.join(cls.cwd + '\\tests\\ttest.py') } #logging.warn('\n dict slsh 3 {}'.format(cls.resultStrs['3'])) cls.cwd = os.getcwd() print("\n\t" + cls.__name__ + " set-up") @classmethod def tearDownClass(cls): print "\n" + cls.__name__ + " tear down" def setUp(self): print("\n" + self.id() + " Set-up") def tearDown(self): print "\n" + self.id() + " Tear down" def test_backslash_and_Controls_0(self): par = self.parStrs['0'] ret = self.resultStrs['0'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_1(self): par = self.parStrs['1'] ret = self.resultStrs['1'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_2(self): par = self.parStrs['2'] ret = self.resultStrs['2'] self.assertEqual(SlashContrl(par), ret) def test_backslash_and_Controls_3(self): par = self.parStrs['3'] ret = self.resultStrs['3'] self.assertEqual(SlashContrl(par), ret) if __name__ == '__main__': tests = unittest.TestLoader().loadTestsFromTestCase(TestCaseDoubleSlash) result = unittest.TextTestRunner(verbosity=3).run(tests) status = 'OK' if result.wasSuccessful() else 'FAILED (failures = ' + \ str(len(result.failures)) + ')\n' + 'ERRORS (errors = ' + \ str(len(result.errors)) + ')\n' print('\nRan {} tests \n\n{}' \ .format(result.testsRun, status)) if result.failures: print(('Fails:' + '\n {}'*len(result.failures)) \ .format(*result.failures)) if result.errors: print(('Errs:' + '\n{}'*len(result.errors[0])) \ .format(*result.errors[0])) #pylint: enable=attribute-defined-outside-init #pylint: enable=invalid-name
0.324235
0.099645
from __future__ import annotations from typing import TYPE_CHECKING, Union, Optional from enum import Enum from asyncio import Event from random import sample import discord from rtlib import sendableString from .music import Music, is_url if TYPE_CHECKING: from .__init__ import MusicCog class NotAddedReason(Enum): "キューに追加することに失敗した際に呼ばれる関数です。" list_very_many = 1 queue_many = 2 class LoopMode(Enum): "ループのモードの設定です。" none = 1 all = 2 one = 3 class Player: "音楽再生にサーバー毎に使う音楽プレイヤーのクラスです。" def __init__(self, cog: MusicCog, guild: discord.Guild, voice_client: discord.VoiceClient): self.cog, self.guild = cog, guild self.queues: list[Music] = [] self._loop = LoopMode.none self.channel: Optional[discord.TextChannel] = None self.vc = voice_client self._volume, self._skipped = 1.0, False self._stopped = Event() self._stopped.set() self._closing = False def print(self, *args, **kwargs): "デバッグ用とかっこつけるためのprintです。" self.cog.print(f"[{self}]", *args, **kwargs) @property def length(self) -> int: "キューの長さを取得します。ただのエイリアス" return len(self.queues) async def add_from_url(self, author: discord.Member, url: str) -> Optional[ Union[NotAddedReason, Exception, list[Music]] ]: "キューにURLから音楽を追加します。" if isinstance((data := await Music.from_url( self.cog, author, url, self.cog.max(self.guild) )), Exception): # 取得に失敗したのならエラーを起こす。 return data elif isinstance(data, tuple): # もし取得結果が複数あるなら if not is_url(url): # もし検索結果が返ってきたのならそれをそのまま返す。 return data[0] # 量制限の確認をする。 if self.length + (queues_length := len(data[0])) > self.cog.max(author): return NotAddedReason.queue_many else: self.print("Adding %s queues, Author: %s" % (queues_length, author)) self.queues.extend(data[0]) if data[1]: return NotAddedReason.list_very_many else: # 通常 self.print("Adding queue: %s" % data) return self.add(data) def add(self, music: Music) -> Optional[NotAddedReason]: "渡されたMusicをqueueに追加します。" self.print("Adding queue: %s" % music) if self.length >= self.cog.max(self.guild): return NotAddedReason.queue_many else: self.queues.append(music) @property def now(self) -> Optional[Music]: "あるなら現在再生中のキューのMusicを返します。" self._assert_vc() if self.queues and self.vc: return self.queues[0] def _process_closed_queue(self): # 音楽再生終了後のキューの処理をする。 if self.vc.is_connected() and not self._skipped: if self._loop == LoopMode.all: self.queues.append(self.queues.pop(0)) elif self._loop == LoopMode.none: del self.queues[0] else: del self.queues[0] self._skipped = False async def _after_play(self, e: Exception): # 音楽再生終了後の後始末をする。 self.print("Finished to play a music") if e and self.channel is not None: self.print("Error:", e) await self.channel.send( {"ja": f"何かしらエラーが発生して再生に失敗しました。\ncode: `{e}`", "en": f"Something went wrong.\ncode: `{e}`"} ) # 音源のお片付けをしてキューのcloseをしてキューを消す。 self.print("Cleaning...") await self.queues[0].stop(self._process_closed_queue) self._stopped.set() # 次のキューがあれば再生を行う。 if self.queues: await self.play() def _assert_vc(self): # VCに接続済みかチェックをします。 assert self.vc is not None, "接続されていません。" async def play(self): """現在登録されているキューの一番最初にある曲を再生します。 再生終了後にまだキューがある場合はもう一度この関数が呼ばれます。""" self._assert_vc() # キューを取って経過時間がわかるようにする。 queue = self.queues[0] queue.start() # sourceを用意する。 self.print("Loading music source...") source = await queue.make_source() # 音量を変更する。 source.volume = self._volume self.print("Playing music...") self._stopped.clear() self.vc.play( source, after=lambda e: self.cog.bot.loop.create_task( self._after_play(e) ) ) def _assert_playing(self): assert self.vc.is_playing(), "現在は何も再生していません。" def pause(self) -> bool: "再生を一時停止します。二度目は再開します。" self._assert_vc() if self.now is not None: self.now.toggle_pause() if self.vc.is_paused(): self.vc.resume() return True else: self._assert_vc() self.vc.pause() return False def skip(self): "次のキューにスキップします。" self._assert_playing() self._skipped = True self.vc.stop() @property def volume(self) -> float: """音量を取得します。パーセントで返されます。 代入することで音量の変更することができます。""" return self._volume * 100 @volume.setter def volume(self, volume: int): self._volume = volume / 100 # もし音楽の再生中なら再生中のものの音量を変更する。 if self.vc.is_playing(): self.vc.source.volume = self._volume def shuffle(self): "キューをシャッフルします。" if self.queues: self.queues[1:] = sample(self.queues[1:], len(self.queues[1:])) def loop(self, mode: Optional[LoopMode] = None) -> LoopMode: "ループを設定します。" if mode is None: if self._loop == LoopMode.none: self._loop = LoopMode.one elif self._loop == LoopMode.one: self._loop = LoopMode.all else: self._loop = LoopMode.none else: self._loop = mode return self._loop async def wait_until_stopped(self) -> None: "再生が停止するまで待機をします。" await self._stopped.wait() async def disconnect( self, reason: Optional[sendableString] = None, force: bool = False ): "お片付けをして切断をします。" self._assert_vc() self.print("Disconnecting...") self._closing = True # キューが二個以上あるならキューを一個以外全部消す。 if len(self.queues) > 1: self.queues = self.queues[:1] # 再生の停止をする。 if self.vc.is_connected(): await self.vc.disconnect(force=force) await self.wait_until_stopped() # もし理由があるなら送信しておく。 if self.channel is not None and reason is not None: try: await self.channel.send(reason) except Exception: ... self.cog.bot.loop.call_soon(self.cog.remove_player, self.guild.id) self.print("Done") def __del__(self): if self.vc is not None and self.vc.is_connected(): # 予期せずにこのクラスのインスタンスが消されたかつボイスチャンネルに接続してる場合は切断を行う。 # 念の為のメモリリーク防止用のもの。 self.cog.bot.loop.create_task( self.disconnect( {"ja": "何らかの原因により再生が停止されました。", "en": "Something went wrong when playing a music."} ), name=f"{self}.disconnect" ) def __str__(self): return f"<Player Guild={self.guild} now={self.now}>"
cogs/music/player.py
from __future__ import annotations from typing import TYPE_CHECKING, Union, Optional from enum import Enum from asyncio import Event from random import sample import discord from rtlib import sendableString from .music import Music, is_url if TYPE_CHECKING: from .__init__ import MusicCog class NotAddedReason(Enum): "キューに追加することに失敗した際に呼ばれる関数です。" list_very_many = 1 queue_many = 2 class LoopMode(Enum): "ループのモードの設定です。" none = 1 all = 2 one = 3 class Player: "音楽再生にサーバー毎に使う音楽プレイヤーのクラスです。" def __init__(self, cog: MusicCog, guild: discord.Guild, voice_client: discord.VoiceClient): self.cog, self.guild = cog, guild self.queues: list[Music] = [] self._loop = LoopMode.none self.channel: Optional[discord.TextChannel] = None self.vc = voice_client self._volume, self._skipped = 1.0, False self._stopped = Event() self._stopped.set() self._closing = False def print(self, *args, **kwargs): "デバッグ用とかっこつけるためのprintです。" self.cog.print(f"[{self}]", *args, **kwargs) @property def length(self) -> int: "キューの長さを取得します。ただのエイリアス" return len(self.queues) async def add_from_url(self, author: discord.Member, url: str) -> Optional[ Union[NotAddedReason, Exception, list[Music]] ]: "キューにURLから音楽を追加します。" if isinstance((data := await Music.from_url( self.cog, author, url, self.cog.max(self.guild) )), Exception): # 取得に失敗したのならエラーを起こす。 return data elif isinstance(data, tuple): # もし取得結果が複数あるなら if not is_url(url): # もし検索結果が返ってきたのならそれをそのまま返す。 return data[0] # 量制限の確認をする。 if self.length + (queues_length := len(data[0])) > self.cog.max(author): return NotAddedReason.queue_many else: self.print("Adding %s queues, Author: %s" % (queues_length, author)) self.queues.extend(data[0]) if data[1]: return NotAddedReason.list_very_many else: # 通常 self.print("Adding queue: %s" % data) return self.add(data) def add(self, music: Music) -> Optional[NotAddedReason]: "渡されたMusicをqueueに追加します。" self.print("Adding queue: %s" % music) if self.length >= self.cog.max(self.guild): return NotAddedReason.queue_many else: self.queues.append(music) @property def now(self) -> Optional[Music]: "あるなら現在再生中のキューのMusicを返します。" self._assert_vc() if self.queues and self.vc: return self.queues[0] def _process_closed_queue(self): # 音楽再生終了後のキューの処理をする。 if self.vc.is_connected() and not self._skipped: if self._loop == LoopMode.all: self.queues.append(self.queues.pop(0)) elif self._loop == LoopMode.none: del self.queues[0] else: del self.queues[0] self._skipped = False async def _after_play(self, e: Exception): # 音楽再生終了後の後始末をする。 self.print("Finished to play a music") if e and self.channel is not None: self.print("Error:", e) await self.channel.send( {"ja": f"何かしらエラーが発生して再生に失敗しました。\ncode: `{e}`", "en": f"Something went wrong.\ncode: `{e}`"} ) # 音源のお片付けをしてキューのcloseをしてキューを消す。 self.print("Cleaning...") await self.queues[0].stop(self._process_closed_queue) self._stopped.set() # 次のキューがあれば再生を行う。 if self.queues: await self.play() def _assert_vc(self): # VCに接続済みかチェックをします。 assert self.vc is not None, "接続されていません。" async def play(self): """現在登録されているキューの一番最初にある曲を再生します。 再生終了後にまだキューがある場合はもう一度この関数が呼ばれます。""" self._assert_vc() # キューを取って経過時間がわかるようにする。 queue = self.queues[0] queue.start() # sourceを用意する。 self.print("Loading music source...") source = await queue.make_source() # 音量を変更する。 source.volume = self._volume self.print("Playing music...") self._stopped.clear() self.vc.play( source, after=lambda e: self.cog.bot.loop.create_task( self._after_play(e) ) ) def _assert_playing(self): assert self.vc.is_playing(), "現在は何も再生していません。" def pause(self) -> bool: "再生を一時停止します。二度目は再開します。" self._assert_vc() if self.now is not None: self.now.toggle_pause() if self.vc.is_paused(): self.vc.resume() return True else: self._assert_vc() self.vc.pause() return False def skip(self): "次のキューにスキップします。" self._assert_playing() self._skipped = True self.vc.stop() @property def volume(self) -> float: """音量を取得します。パーセントで返されます。 代入することで音量の変更することができます。""" return self._volume * 100 @volume.setter def volume(self, volume: int): self._volume = volume / 100 # もし音楽の再生中なら再生中のものの音量を変更する。 if self.vc.is_playing(): self.vc.source.volume = self._volume def shuffle(self): "キューをシャッフルします。" if self.queues: self.queues[1:] = sample(self.queues[1:], len(self.queues[1:])) def loop(self, mode: Optional[LoopMode] = None) -> LoopMode: "ループを設定します。" if mode is None: if self._loop == LoopMode.none: self._loop = LoopMode.one elif self._loop == LoopMode.one: self._loop = LoopMode.all else: self._loop = LoopMode.none else: self._loop = mode return self._loop async def wait_until_stopped(self) -> None: "再生が停止するまで待機をします。" await self._stopped.wait() async def disconnect( self, reason: Optional[sendableString] = None, force: bool = False ): "お片付けをして切断をします。" self._assert_vc() self.print("Disconnecting...") self._closing = True # キューが二個以上あるならキューを一個以外全部消す。 if len(self.queues) > 1: self.queues = self.queues[:1] # 再生の停止をする。 if self.vc.is_connected(): await self.vc.disconnect(force=force) await self.wait_until_stopped() # もし理由があるなら送信しておく。 if self.channel is not None and reason is not None: try: await self.channel.send(reason) except Exception: ... self.cog.bot.loop.call_soon(self.cog.remove_player, self.guild.id) self.print("Done") def __del__(self): if self.vc is not None and self.vc.is_connected(): # 予期せずにこのクラスのインスタンスが消されたかつボイスチャンネルに接続してる場合は切断を行う。 # 念の為のメモリリーク防止用のもの。 self.cog.bot.loop.create_task( self.disconnect( {"ja": "何らかの原因により再生が停止されました。", "en": "Something went wrong when playing a music."} ), name=f"{self}.disconnect" ) def __str__(self): return f"<Player Guild={self.guild} now={self.now}>"
0.776962
0.169234
from __future__ import annotations import abc import numpy as np from pyrsistent.typing import PMap as PMapT from pyrsistent import pmap from typing import Union, Tuple, Any, FrozenSet, List from dataclasses import dataclass from functools import cached_property, cache from more_itertools import zip_equal as zip from pytools import UniqueNameGenerator IntegralT = Union[int, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64] INT_CLASSES = (int, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64) ShapeComponentT = Union[IntegralT, "SizeParam"] ShapeT = Tuple[ShapeComponentT, ...] @dataclass(frozen=True, eq=True, repr=True) class VeryLongAxis: """ Describes a dimension length which is to be assumed to be very large. """ # TODO: Record the threshold over which an axis could be considered as # "VeryLong." @dataclass(frozen=True, eq=True, repr=True) class SizeParam: name: str @dataclass(frozen=True, repr=True, eq=True) class EinsumAxisAccess(abc.ABC): """ Base class for axis access types in an einsum expression. """ @dataclass(frozen=True, repr=True, eq=True) class FreeAxis(EinsumAxisAccess): """ Records the axis of an einsum argument over which contraction is not performed. .. attribute:: output_index Position of the corresponding index in the einsum's output. """ output_index: int @dataclass(frozen=True, repr=True, eq=True) class SummationAxis(EinsumAxisAccess): """ Records an index in an einsum expression over which reduction is performed. Sometimes also referred to as an axis with a corresponding "dummy index" in Ricci Calculus. .. attribute:: index An integer which is unique to a reduction index of an einsum. """ index: int @dataclass(frozen=True, eq=True, repr=True) class FusedEinsum: """ A fused einsum expression. .. attribute:: shape .. attribute:: ndim .. automethod:: index_to_dim_length .. automethod:: get_subscripts """ arg_shapes: Tuple[ShapeT, ...] value_to_dtype: PMapT[str, np.dtype[Any]] access_descriptors: Tuple[Tuple[EinsumAxisAccess, ...], ...] use_matrix: Tuple[Tuple[FrozenSet[str], ...], ...] index_names: PMapT[EinsumAxisAccess, str] @property def noutputs(self) -> int: return len(self.use_matrix) @cache def index_to_dim_length(self) -> PMapT[EinsumAxisAccess, ShapeComponentT]: index_to_dim = {} for arg_shape, arg_axes in zip(self.arg_shapes, self.access_descriptors): for dim, index in zip(arg_shape, arg_axes): if dim not in index_to_dim: index_to_dim[index] = dim else: assert dim == index_to_dim[index] return pmap(index_to_dim) @cached_property def shape(self) -> ShapeT: free_index_to_dim = {idx: dim for idx, dim in self.index_to_dim_length().items() if isinstance(idx, FreeAxis)} assert all(FreeAxis(idim) in free_index_to_dim for idim in range(len(free_index_to_dim))) return tuple(dim for _, dim in sorted(free_index_to_dim.items(), key=lambda x: x[0].output_index)) @property def ndim(self) -> int: return len(self.shape) @cache def get_subscripts(self) -> str: """ Returns the subscripts used in the building the *einsum* from it. """ return (",".join("".join(self.index_names[axis] for axis in axes) for axes in self.access_descriptors) + "->" + "".join(self.index_names[FreeAxis(i)] for i in range(self.ndim)) ) def copy(self, **kwargs: Any) -> FusedEinsum: from dataclasses import replace return replace(self, **kwargs) class Argument(abc.ABC): """ An abstract class denoting an argument to an einsum in :class:`ContractionSchedule`. See :attr:`ContractionSchedule.arguments`. """ @dataclass(frozen=True, eq=True, repr=True) class IntermediateResult(Argument): """ An :class:`Argument` representing an intermediate result available during the current contraction. """ name: str @dataclass(frozen=True, eq=True, repr=True) class EinsumOperand(Argument): """ An :class:`Argument` representing the *ioperand*-th argument that was passed to the parent einsum whose :class:`ContractionSchedule` is being specified. """ ioperand: int @dataclass(frozen=True, eq=True, repr=True) class ContractionSchedule: """ Records the schedule in which contractions are to be performed in an einsum as a series of einsums with the i-th einsum having subscript ``subscript[i]`` operating on ``arguments[i]`` and writing its result to ``result_names[i]``. .. attribute:: result_names Names of the result generated by each .. attribute:: arguments A :class:`tuple` containing :class:`tuple` of :class:`` for each contraction in the schedule. .. attribute:: nsteps """ subscripts: Tuple[str, ...] result_names: Tuple[str, ...] arguments: Tuple[Tuple[Argument, ...], ...] def __post_init__(self) -> None: assert len(self.subscripts) == len(self.result_names) == len(self.arguments) @property def nsteps(self) -> int: """ Returns the number of steps involved in scheduling the einsum. """ return len(self.subscripts) def copy(self, **kwargs: Any) -> ContractionSchedule: from dataclasses import replace return replace(self, **kwargs) def get_trivial_contraction_schedule(einsum: FusedEinsum) -> ContractionSchedule: """ Returns the :class:`ContractionSchedule` for *einsum* scheduled as a single contraction. """ return ContractionSchedule((einsum.get_subscripts(),), ("_fe_out",), (tuple(EinsumOperand(i) for i, _ in enumerate(einsum.arg_shapes)),) ) def get_opt_einsum_contraction_schedule(expr: FusedEinsum, **opt_einsum_kwargs: Any, ) -> ContractionSchedule: """ Returns a :class:`ContractionSchedule` as computed by :func:`opt_einsum.contract_path`. :param opt_einsum_kwargs: kwargs to be passed to :func:`opt_einsum.contract_path`. .. note:: The following defaults are populated in *opt_einsum_kwargs*, if left unspecified: - ``optimize="optimal"`` - ``use_blas=False`` """ import opt_einsum from feinsum.make_einsum import array long_dim_length = opt_einsum_kwargs.pop("long_dim_length", 1_000_000) if "optimize" not in opt_einsum_kwargs: opt_einsum_kwargs["optimize"] = "optimal" if "use_blas" not in opt_einsum_kwargs: opt_einsum_kwargs["use_blas"] = False _, path = opt_einsum.contract_path(expr.get_subscripts(), *[array([d if isinstance(op_shape, INT_CLASSES) else long_dim_length for d in op_shape], "float64") for op_shape in expr.arg_shapes], **opt_einsum_kwargs) current_args: List[Argument] = [ EinsumOperand(i) for i in range(path.input_subscripts.count(",") + 1)] vng = UniqueNameGenerator() subscripts: List[str] = [] result_names: List[str] = [] arguments: List[Tuple[Argument, ...]] = [] for contraction in path.contraction_list: arg_indices, _, subscript, _, _ = contraction arguments.append(tuple(current_args[idx] for idx in arg_indices)) subscripts.append(subscript) result_names.append(vng("_fe_tmp")) current_args = ([arg for idx, arg in enumerate(current_args) if idx not in arg_indices] + [IntermediateResult(result_names[-1])]) assert len(current_args) == 1 result_names[-1] = vng("_fe_out") return ContractionSchedule(tuple(subscripts), tuple(result_names), tuple(arguments))
src/feinsum/einsum.py
from __future__ import annotations import abc import numpy as np from pyrsistent.typing import PMap as PMapT from pyrsistent import pmap from typing import Union, Tuple, Any, FrozenSet, List from dataclasses import dataclass from functools import cached_property, cache from more_itertools import zip_equal as zip from pytools import UniqueNameGenerator IntegralT = Union[int, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64] INT_CLASSES = (int, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64) ShapeComponentT = Union[IntegralT, "SizeParam"] ShapeT = Tuple[ShapeComponentT, ...] @dataclass(frozen=True, eq=True, repr=True) class VeryLongAxis: """ Describes a dimension length which is to be assumed to be very large. """ # TODO: Record the threshold over which an axis could be considered as # "VeryLong." @dataclass(frozen=True, eq=True, repr=True) class SizeParam: name: str @dataclass(frozen=True, repr=True, eq=True) class EinsumAxisAccess(abc.ABC): """ Base class for axis access types in an einsum expression. """ @dataclass(frozen=True, repr=True, eq=True) class FreeAxis(EinsumAxisAccess): """ Records the axis of an einsum argument over which contraction is not performed. .. attribute:: output_index Position of the corresponding index in the einsum's output. """ output_index: int @dataclass(frozen=True, repr=True, eq=True) class SummationAxis(EinsumAxisAccess): """ Records an index in an einsum expression over which reduction is performed. Sometimes also referred to as an axis with a corresponding "dummy index" in Ricci Calculus. .. attribute:: index An integer which is unique to a reduction index of an einsum. """ index: int @dataclass(frozen=True, eq=True, repr=True) class FusedEinsum: """ A fused einsum expression. .. attribute:: shape .. attribute:: ndim .. automethod:: index_to_dim_length .. automethod:: get_subscripts """ arg_shapes: Tuple[ShapeT, ...] value_to_dtype: PMapT[str, np.dtype[Any]] access_descriptors: Tuple[Tuple[EinsumAxisAccess, ...], ...] use_matrix: Tuple[Tuple[FrozenSet[str], ...], ...] index_names: PMapT[EinsumAxisAccess, str] @property def noutputs(self) -> int: return len(self.use_matrix) @cache def index_to_dim_length(self) -> PMapT[EinsumAxisAccess, ShapeComponentT]: index_to_dim = {} for arg_shape, arg_axes in zip(self.arg_shapes, self.access_descriptors): for dim, index in zip(arg_shape, arg_axes): if dim not in index_to_dim: index_to_dim[index] = dim else: assert dim == index_to_dim[index] return pmap(index_to_dim) @cached_property def shape(self) -> ShapeT: free_index_to_dim = {idx: dim for idx, dim in self.index_to_dim_length().items() if isinstance(idx, FreeAxis)} assert all(FreeAxis(idim) in free_index_to_dim for idim in range(len(free_index_to_dim))) return tuple(dim for _, dim in sorted(free_index_to_dim.items(), key=lambda x: x[0].output_index)) @property def ndim(self) -> int: return len(self.shape) @cache def get_subscripts(self) -> str: """ Returns the subscripts used in the building the *einsum* from it. """ return (",".join("".join(self.index_names[axis] for axis in axes) for axes in self.access_descriptors) + "->" + "".join(self.index_names[FreeAxis(i)] for i in range(self.ndim)) ) def copy(self, **kwargs: Any) -> FusedEinsum: from dataclasses import replace return replace(self, **kwargs) class Argument(abc.ABC): """ An abstract class denoting an argument to an einsum in :class:`ContractionSchedule`. See :attr:`ContractionSchedule.arguments`. """ @dataclass(frozen=True, eq=True, repr=True) class IntermediateResult(Argument): """ An :class:`Argument` representing an intermediate result available during the current contraction. """ name: str @dataclass(frozen=True, eq=True, repr=True) class EinsumOperand(Argument): """ An :class:`Argument` representing the *ioperand*-th argument that was passed to the parent einsum whose :class:`ContractionSchedule` is being specified. """ ioperand: int @dataclass(frozen=True, eq=True, repr=True) class ContractionSchedule: """ Records the schedule in which contractions are to be performed in an einsum as a series of einsums with the i-th einsum having subscript ``subscript[i]`` operating on ``arguments[i]`` and writing its result to ``result_names[i]``. .. attribute:: result_names Names of the result generated by each .. attribute:: arguments A :class:`tuple` containing :class:`tuple` of :class:`` for each contraction in the schedule. .. attribute:: nsteps """ subscripts: Tuple[str, ...] result_names: Tuple[str, ...] arguments: Tuple[Tuple[Argument, ...], ...] def __post_init__(self) -> None: assert len(self.subscripts) == len(self.result_names) == len(self.arguments) @property def nsteps(self) -> int: """ Returns the number of steps involved in scheduling the einsum. """ return len(self.subscripts) def copy(self, **kwargs: Any) -> ContractionSchedule: from dataclasses import replace return replace(self, **kwargs) def get_trivial_contraction_schedule(einsum: FusedEinsum) -> ContractionSchedule: """ Returns the :class:`ContractionSchedule` for *einsum* scheduled as a single contraction. """ return ContractionSchedule((einsum.get_subscripts(),), ("_fe_out",), (tuple(EinsumOperand(i) for i, _ in enumerate(einsum.arg_shapes)),) ) def get_opt_einsum_contraction_schedule(expr: FusedEinsum, **opt_einsum_kwargs: Any, ) -> ContractionSchedule: """ Returns a :class:`ContractionSchedule` as computed by :func:`opt_einsum.contract_path`. :param opt_einsum_kwargs: kwargs to be passed to :func:`opt_einsum.contract_path`. .. note:: The following defaults are populated in *opt_einsum_kwargs*, if left unspecified: - ``optimize="optimal"`` - ``use_blas=False`` """ import opt_einsum from feinsum.make_einsum import array long_dim_length = opt_einsum_kwargs.pop("long_dim_length", 1_000_000) if "optimize" not in opt_einsum_kwargs: opt_einsum_kwargs["optimize"] = "optimal" if "use_blas" not in opt_einsum_kwargs: opt_einsum_kwargs["use_blas"] = False _, path = opt_einsum.contract_path(expr.get_subscripts(), *[array([d if isinstance(op_shape, INT_CLASSES) else long_dim_length for d in op_shape], "float64") for op_shape in expr.arg_shapes], **opt_einsum_kwargs) current_args: List[Argument] = [ EinsumOperand(i) for i in range(path.input_subscripts.count(",") + 1)] vng = UniqueNameGenerator() subscripts: List[str] = [] result_names: List[str] = [] arguments: List[Tuple[Argument, ...]] = [] for contraction in path.contraction_list: arg_indices, _, subscript, _, _ = contraction arguments.append(tuple(current_args[idx] for idx in arg_indices)) subscripts.append(subscript) result_names.append(vng("_fe_tmp")) current_args = ([arg for idx, arg in enumerate(current_args) if idx not in arg_indices] + [IntermediateResult(result_names[-1])]) assert len(current_args) == 1 result_names[-1] = vng("_fe_out") return ContractionSchedule(tuple(subscripts), tuple(result_names), tuple(arguments))
0.780913
0.54952
import tensorflow as tf from typing import Tuple ##- def unet(input_size: Tuple[int,int,int] =(256, 256, 1)) -> tf.keras.Model: """Construct a basic U-Net model for baseline experiments. Params: input_size (tuple): image size to segment: (wodth, height, n_channels) Return: keras.model.Model: a Model with the basic U-Net architecture. The model is not trained """ inputs = tf.keras.Input(input_size) conv1 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(inputs) conv1 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv1) pool1 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv1) conv2 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool1) conv2 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv2) pool2 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv2) conv3 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool2) conv3 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv3) pool3 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv3) conv4 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool3) conv4 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv4) drop4 = tf.keras.layers.Dropout(0.5)(conv4) pool4 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(drop4) conv5 = tf.keras.layers.Conv2D(1024, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool4) conv5 = tf.keras.layers.Conv2D(1024, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv5) drop5 = tf.keras.layers.Dropout(0.5)(conv5) up6 = tf.keras.layers.Conv2D(512, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(drop5)) merge6 = tf.keras.layers.concatenate([drop4, up6], axis=3) conv6 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge6) conv6 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv6) up7 = tf.keras.layers.Conv2D(256, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv6)) merge7 = tf.keras.layers.concatenate([conv3, up7], axis=3) conv7 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge7) conv7 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv7) up8 = tf.keras.layers.Conv2D(128, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv7)) merge8 = tf.keras.layers.concatenate([conv2, up8], axis=3) conv8 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge8) conv8 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv8) up9 = tf.keras.layers.Conv2D(64, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv8)) merge9 = tf.keras.layers.concatenate([conv1, up9], axis=3) conv9 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge9) conv9 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv9) conv9 = tf.keras.layers.Conv2D(2, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv9) conv10 = tf.keras.layers.Conv2D(1, 1, activation='sigmoid')(conv9) model = tf.keras.Model(inputs=inputs, outputs=conv10) # model.compile(optimizer=tf.keras.optimizers.Adam(lr=1e-4), loss='binary_crossentropy', metrics=['accuracy']) # model.summary() return model ##-
cpm/unet/basic.py
import tensorflow as tf from typing import Tuple ##- def unet(input_size: Tuple[int,int,int] =(256, 256, 1)) -> tf.keras.Model: """Construct a basic U-Net model for baseline experiments. Params: input_size (tuple): image size to segment: (wodth, height, n_channels) Return: keras.model.Model: a Model with the basic U-Net architecture. The model is not trained """ inputs = tf.keras.Input(input_size) conv1 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(inputs) conv1 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv1) pool1 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv1) conv2 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool1) conv2 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv2) pool2 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv2) conv3 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool2) conv3 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv3) pool3 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(conv3) conv4 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool3) conv4 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv4) drop4 = tf.keras.layers.Dropout(0.5)(conv4) pool4 = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(drop4) conv5 = tf.keras.layers.Conv2D(1024, 3, activation='relu', padding='same', kernel_initializer='he_normal')(pool4) conv5 = tf.keras.layers.Conv2D(1024, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv5) drop5 = tf.keras.layers.Dropout(0.5)(conv5) up6 = tf.keras.layers.Conv2D(512, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(drop5)) merge6 = tf.keras.layers.concatenate([drop4, up6], axis=3) conv6 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge6) conv6 = tf.keras.layers.Conv2D(512, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv6) up7 = tf.keras.layers.Conv2D(256, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv6)) merge7 = tf.keras.layers.concatenate([conv3, up7], axis=3) conv7 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge7) conv7 = tf.keras.layers.Conv2D(256, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv7) up8 = tf.keras.layers.Conv2D(128, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv7)) merge8 = tf.keras.layers.concatenate([conv2, up8], axis=3) conv8 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge8) conv8 = tf.keras.layers.Conv2D(128, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv8) up9 = tf.keras.layers.Conv2D(64, 2, activation='relu', padding='same', kernel_initializer='he_normal')( tf.keras.layers.UpSampling2D(size=(2, 2))(conv8)) merge9 = tf.keras.layers.concatenate([conv1, up9], axis=3) conv9 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(merge9) conv9 = tf.keras.layers.Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv9) conv9 = tf.keras.layers.Conv2D(2, 3, activation='relu', padding='same', kernel_initializer='he_normal')(conv9) conv10 = tf.keras.layers.Conv2D(1, 1, activation='sigmoid')(conv9) model = tf.keras.Model(inputs=inputs, outputs=conv10) # model.compile(optimizer=tf.keras.optimizers.Adam(lr=1e-4), loss='binary_crossentropy', metrics=['accuracy']) # model.summary() return model ##-
0.940503
0.856272
import os from decouple import config import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') CLIENT_ID = config('CLIENT_ID') CLIENT_SECRET = config('CLIENT_SECRET') GEOPOSITION_GOOGLE_MAPS_API_KEY = config('GEOPOSITION_GOOGLE_MAPS_API_KEY') LOCATION_FIELD = { 'map.provider': 'google', 'map.zoom': 15, 'search.provider': 'google', 'provider.google.api': '//maps.google.com/maps/api/js?sensor=false', 'provider.google.api_key': config('GEOPOSITION_GOOGLE_MAPS_API_KEY'), 'provider.google.map.type': 'ROADMAP', } GEOPOSITION_MAP_OPTIONS = { 'minZoom': 3, 'maxZoom': 15, } GEOPOSITION_MARKER_OPTIONS = { 'cursor': 'move' } # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['booky-ride.herokuapp.com', '127.0.0.1'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'driver.apps.DriverConfig', 'rider.apps.RiderConfig', 'bootstrap3', 'geoposition', 'cart', ] SITE_ID = 1 MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', # Custom middleware 'booky.middleware.OnlineNowMiddleware', ] ROOT_URLCONF = 'booky.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'booky.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'uber', 'USER': 'erick', 'PASSWORD':'<PASSWORD>', } } db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Africa/Nairobi' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
booky/settings.py
import os from decouple import config import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') CLIENT_ID = config('CLIENT_ID') CLIENT_SECRET = config('CLIENT_SECRET') GEOPOSITION_GOOGLE_MAPS_API_KEY = config('GEOPOSITION_GOOGLE_MAPS_API_KEY') LOCATION_FIELD = { 'map.provider': 'google', 'map.zoom': 15, 'search.provider': 'google', 'provider.google.api': '//maps.google.com/maps/api/js?sensor=false', 'provider.google.api_key': config('GEOPOSITION_GOOGLE_MAPS_API_KEY'), 'provider.google.map.type': 'ROADMAP', } GEOPOSITION_MAP_OPTIONS = { 'minZoom': 3, 'maxZoom': 15, } GEOPOSITION_MARKER_OPTIONS = { 'cursor': 'move' } # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['booky-ride.herokuapp.com', '127.0.0.1'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'driver.apps.DriverConfig', 'rider.apps.RiderConfig', 'bootstrap3', 'geoposition', 'cart', ] SITE_ID = 1 MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', # Custom middleware 'booky.middleware.OnlineNowMiddleware', ] ROOT_URLCONF = 'booky.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'booky.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'uber', 'USER': 'erick', 'PASSWORD':'<PASSWORD>', } } db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Africa/Nairobi' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
0.376738
0.067886
import unittest from language_detector import detect_language from language_detector.languages import LANGUAGES class TestLanguageDetector(unittest.TestCase): def test_detect_language_spanish(self): text = """ <NAME> (Rosario, 24 de junio de 1987), conocido como <NAME>, es un futbolista argentino11 que juega como delantero en el Fútbol Club Barcelona y en la selección argentina, de la que es capitán. Considerado con frecuencia el mejor jugador del mundo y calificado en el ámbito deportivo como el más grande de todos los tiempos, Messi es el único futbolista en la historia que ha ganado cinco veces el FIFA Balón de Oro –cuatro de ellos en forma consecutiva– y el primero en recibir tres Botas de Oro. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'Spanish') def test_detect_language_german(self): text = """ Messi spielt seit seinem 14. Lebensjahr für den FC Barcelona. Mit 24 Jahren wurde er Rekordtorschütze des FC Barcelona, mit 25 der jüngste Spieler in der La-Liga-Geschichte, der 200 Tore erzielte. Inzwischen hat Messi als einziger Spieler mehr als 300 Erstligatore erzielt und ist damit Rekordtorschütze der Primera División. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'German') def test_detect_language_mixed_languages(self): text = """ # spanish <NAME> (Rosario, 24 de junio de 1987), conocido como <NAME>, es un futbolista argentino11 que juega como delantero en el Fútbol Club Barcelona y en la selección argentina, de la que es capitán. # german Messi spielt seit seinem 14. Lebensjahr für den FC Barcelona. Mit 24 Jahren wurde er Rekordtorschütze des FC Barcelona, mit 25 der jüngste Spieler in der La-Liga-Geschichte, der 200 Tore erzielte. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'Spanish') def test_detect_language_english(self): # NOTE: You will first need to define a new "English" language # in the languages.py module. text = """ # english <NAME> 'Leo' Messi is an Argentine professional footballer who plays as a forward for Spanish club FC Barcelona and the Argentina national team. Often considered the best player in the world and rated by many in the sport as the greatest of all time, Messi is the only football player in history to win five FIFA Ballons, four of which he won consecutively, and the first player to win three European Golden Shoes. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'English')
tests/test_main.py
import unittest from language_detector import detect_language from language_detector.languages import LANGUAGES class TestLanguageDetector(unittest.TestCase): def test_detect_language_spanish(self): text = """ <NAME> (Rosario, 24 de junio de 1987), conocido como <NAME>, es un futbolista argentino11 que juega como delantero en el Fútbol Club Barcelona y en la selección argentina, de la que es capitán. Considerado con frecuencia el mejor jugador del mundo y calificado en el ámbito deportivo como el más grande de todos los tiempos, Messi es el único futbolista en la historia que ha ganado cinco veces el FIFA Balón de Oro –cuatro de ellos en forma consecutiva– y el primero en recibir tres Botas de Oro. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'Spanish') def test_detect_language_german(self): text = """ Messi spielt seit seinem 14. Lebensjahr für den FC Barcelona. Mit 24 Jahren wurde er Rekordtorschütze des FC Barcelona, mit 25 der jüngste Spieler in der La-Liga-Geschichte, der 200 Tore erzielte. Inzwischen hat Messi als einziger Spieler mehr als 300 Erstligatore erzielt und ist damit Rekordtorschütze der Primera División. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'German') def test_detect_language_mixed_languages(self): text = """ # spanish <NAME> (Rosario, 24 de junio de 1987), conocido como <NAME>, es un futbolista argentino11 que juega como delantero en el Fútbol Club Barcelona y en la selección argentina, de la que es capitán. # german Messi spielt seit seinem 14. Lebensjahr für den FC Barcelona. Mit 24 Jahren wurde er Rekordtorschütze des FC Barcelona, mit 25 der jüngste Spieler in der La-Liga-Geschichte, der 200 Tore erzielte. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'Spanish') def test_detect_language_english(self): # NOTE: You will first need to define a new "English" language # in the languages.py module. text = """ # english <NAME> 'Leo' Messi is an Argentine professional footballer who plays as a forward for Spanish club FC Barcelona and the Argentina national team. Often considered the best player in the world and rated by many in the sport as the greatest of all time, Messi is the only football player in history to win five FIFA Ballons, four of which he won consecutively, and the first player to win three European Golden Shoes. """ result = detect_language(text, LANGUAGES) self.assertEqual(result, 'English')
0.416441
0.511595
import torch import torch.nn as nn from torch.autograd import Function import torch.nn.functional as F import torch.nn.init as init from torch.autograd import Variable import math class NormalizeLayer(torch.nn.Module): """Standardize the channels of a batch of images by subtracting the dataset mean and dividing by the dataset standard deviation. """ def __init__(self, means, sds): """ :param means: the channel means :param sds: the channel standard deviations """ super(NormalizeLayer, self).__init__() self.means = torch.tensor(means).cuda() self.sds = torch.tensor(sds).cuda() def forward(self, input): (batch_size, num_channels, height, width) = input.shape means = self.means.repeat((batch_size, height, width, 1)).permute(0, 3, 1, 2) sds = self.sds.repeat((batch_size, height, width, 1)).permute(0, 3, 1, 2) return (input - means)/sds class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d( in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) self.shortcut = nn.Sequential() if stride != 1 or in_planes != self.expansion*planes: self.shortcut = nn.Sequential( nn.Conv2d(in_planes, self.expansion*planes, kernel_size=1, stride=stride, bias=False), nn.BatchNorm2d(self.expansion*planes) ) def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = self.bn2(self.conv2(out)) out += self.shortcut(x) out = F.relu(out) return out class Bottleneck(nn.Module): expansion = 4 def __init__(self, in_planes, planes, stride=1): super(Bottleneck, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) self.conv3 = nn.Conv2d(planes, self.expansion * planes, kernel_size=1, bias=False) self.bn3 = nn.BatchNorm2d(self.expansion*planes) self.shortcut = nn.Sequential() if stride != 1 or in_planes != self.expansion*planes: self.shortcut = nn.Sequential( nn.Conv2d(in_planes, self.expansion*planes, kernel_size=1, stride=stride, bias=False), nn.BatchNorm2d(self.expansion*planes) ) def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = F.relu(self.bn2(self.conv2(out))) out = self.bn3(self.conv3(out)) out += self.shortcut(x) out = F.relu(out) return out class ResNet(nn.Module): # ResNet34 def __init__(self, means, sds, block=BasicBlock, num_blocks=[3, 4, 6, 3], num_classes=10): super(ResNet, self).__init__() self.normalize_layer = NormalizeLayer(means, sds) self.in_planes = 64 self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(64) self.layer1 = self._make_layer(block, 64, num_blocks[0], stride=1) self.layer2 = self._make_layer(block, 128, num_blocks[1], stride=2) self.layer3 = self._make_layer(block, 256, num_blocks[2], stride=2) self.layer4 = self._make_layer(block, 512, num_blocks[3], stride=2) self.linear = nn.Linear(512*block.expansion, num_classes) def _make_layer(self, block, planes, num_blocks, stride): strides = [stride] + [1]*(num_blocks-1) layers = [] for stride in strides: layers.append(block(self.in_planes, planes, stride)) self.in_planes = planes * block.expansion return nn.Sequential(*layers) def get_feature(self, x): out = self.normalize_layer(x) out = F.relu(self.bn1(self.conv1(out))) out = self.layer1(out) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = F.avg_pool2d(out, 4) out = out.view(out.size(0), -1) return out def forward(self, x): out = self.normalize_layer(x) out = F.relu(self.bn1(self.conv1(out))) out = self.layer1(out) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = F.avg_pool2d(out, 4) out = out.view(out.size(0), -1) out = self.linear(out) return out
RMC/models/resnet.py
import torch import torch.nn as nn from torch.autograd import Function import torch.nn.functional as F import torch.nn.init as init from torch.autograd import Variable import math class NormalizeLayer(torch.nn.Module): """Standardize the channels of a batch of images by subtracting the dataset mean and dividing by the dataset standard deviation. """ def __init__(self, means, sds): """ :param means: the channel means :param sds: the channel standard deviations """ super(NormalizeLayer, self).__init__() self.means = torch.tensor(means).cuda() self.sds = torch.tensor(sds).cuda() def forward(self, input): (batch_size, num_channels, height, width) = input.shape means = self.means.repeat((batch_size, height, width, 1)).permute(0, 3, 1, 2) sds = self.sds.repeat((batch_size, height, width, 1)).permute(0, 3, 1, 2) return (input - means)/sds class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d( in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) self.shortcut = nn.Sequential() if stride != 1 or in_planes != self.expansion*planes: self.shortcut = nn.Sequential( nn.Conv2d(in_planes, self.expansion*planes, kernel_size=1, stride=stride, bias=False), nn.BatchNorm2d(self.expansion*planes) ) def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = self.bn2(self.conv2(out)) out += self.shortcut(x) out = F.relu(out) return out class Bottleneck(nn.Module): expansion = 4 def __init__(self, in_planes, planes, stride=1): super(Bottleneck, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(planes) self.conv3 = nn.Conv2d(planes, self.expansion * planes, kernel_size=1, bias=False) self.bn3 = nn.BatchNorm2d(self.expansion*planes) self.shortcut = nn.Sequential() if stride != 1 or in_planes != self.expansion*planes: self.shortcut = nn.Sequential( nn.Conv2d(in_planes, self.expansion*planes, kernel_size=1, stride=stride, bias=False), nn.BatchNorm2d(self.expansion*planes) ) def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = F.relu(self.bn2(self.conv2(out))) out = self.bn3(self.conv3(out)) out += self.shortcut(x) out = F.relu(out) return out class ResNet(nn.Module): # ResNet34 def __init__(self, means, sds, block=BasicBlock, num_blocks=[3, 4, 6, 3], num_classes=10): super(ResNet, self).__init__() self.normalize_layer = NormalizeLayer(means, sds) self.in_planes = 64 self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(64) self.layer1 = self._make_layer(block, 64, num_blocks[0], stride=1) self.layer2 = self._make_layer(block, 128, num_blocks[1], stride=2) self.layer3 = self._make_layer(block, 256, num_blocks[2], stride=2) self.layer4 = self._make_layer(block, 512, num_blocks[3], stride=2) self.linear = nn.Linear(512*block.expansion, num_classes) def _make_layer(self, block, planes, num_blocks, stride): strides = [stride] + [1]*(num_blocks-1) layers = [] for stride in strides: layers.append(block(self.in_planes, planes, stride)) self.in_planes = planes * block.expansion return nn.Sequential(*layers) def get_feature(self, x): out = self.normalize_layer(x) out = F.relu(self.bn1(self.conv1(out))) out = self.layer1(out) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = F.avg_pool2d(out, 4) out = out.view(out.size(0), -1) return out def forward(self, x): out = self.normalize_layer(x) out = F.relu(self.bn1(self.conv1(out))) out = self.layer1(out) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = F.avg_pool2d(out, 4) out = out.view(out.size(0), -1) out = self.linear(out) return out
0.964111
0.73137
import datetime import webparser import puzzleraw import wordmatch class Puzzle: def __init__(self, date="", psid=""): now = datetime.datetime.now() if len(date) is 0: date = str(now.year) + "-" + str(now.month) + "-" + str(now.day) if len(psid) is 0: psid = "100000252" self.date = date url = "https://data.puzzlexperts.com/puzzleapp/data.php?psid=" + psid + "&date=" + date array = webparser.WebParser(url).parse_to_array() raw = puzzleraw.PuzzleRaw(array) pairs = raw.make_pairs() self.scheme = pairs[0] self.words = pairs[1] """ Finds occurrences of the character in a line """ @staticmethod def find_indexes(line, char): indexes = [] for i in range(0, len(line)): if line[i] is char: indexes.append(i) return indexes """ Finds occurrences of the character in the grid """ def find_occurrences(self, char): loc = [] for i in range(len(self.scheme)): loc.append([i, self.find_indexes(self.scheme[i], char)]) return loc """ Returns adjacent slots (relative to a slot) """ def get_near(self, index, line_index): scheme = self.scheme near = [] index_not_first = index > 0 index_not_last = len(scheme) > line_index and index < len(scheme[line_index]) - 1 line_not_first = line_index > 0 line_not_last = line_index < len(scheme) - 1 if index_not_first: near.append([index - 1, line_index, "left"]) if index_not_last: near.append([index + 1, line_index, "right"]) if line_not_first: near.append([index, line_index - 1, "up"]) if index_not_first: near.append([index - 1, line_index - 1, "up,left"]) if index_not_last: near.append([index + 1, line_index - 1, "up,right"]) if line_not_last: near.append([index, line_index + 1, "down"]) if index_not_first: near.append([index - 1, line_index + 1, "down,left"]) if index_not_last: near.append([index + 1, line_index + 1, "down,right"]) return near """ Finds occurrences of the character in the adjacent slots (relative to a slot) """ def find_near_occurrences(self, char, index, line_index): occurrences = [] for near in self.get_near(index, line_index): if self.scheme[near[1]][near[0]] is char: occurrences.append(near) return occurrences """ Finds occurrences of string given a direction and a location """ def match_word_part(self, word_part, index, line_index, direction): if len(word_part) is 1: return [index, line_index] word_part = word_part[1:len(word_part)] switch = { "left": [line_index, index - 1], "right": [line_index, index + 1], "up": [line_index - 1, index], "up,left": [line_index - 1, index - 1], "up,right": [line_index - 1, index + 1], "down": [line_index + 1, index], "down,left": [line_index + 1, index - 1], "down,right": [line_index + 1, index + 1] } next_loc = switch[direction] try: slot = self.scheme[next_loc[0]][next_loc[1]] return self.match_word_part(word_part, next_loc[1], next_loc[0], direction) if slot is word_part[0] else False except IndexError: return False """ Finds the word inside of the grid """ def match(self, word): if word[0] is " ": word = word[1:len(word)] formatted_word = word.replace(" ", "") first_char = formatted_word[0] for occurrence in self.find_occurrences(first_char): line_index = occurrence[0] for index in occurrence[1]: for near in self.find_near_occurrences(formatted_word[1], index, line_index): match = self.match_word_part(formatted_word, index, occurrence[0], near[2]) if match: return wordmatch.WordMatch(word, [index, line_index], [match[0], match[1]], near[2])
puzzle.py
import datetime import webparser import puzzleraw import wordmatch class Puzzle: def __init__(self, date="", psid=""): now = datetime.datetime.now() if len(date) is 0: date = str(now.year) + "-" + str(now.month) + "-" + str(now.day) if len(psid) is 0: psid = "100000252" self.date = date url = "https://data.puzzlexperts.com/puzzleapp/data.php?psid=" + psid + "&date=" + date array = webparser.WebParser(url).parse_to_array() raw = puzzleraw.PuzzleRaw(array) pairs = raw.make_pairs() self.scheme = pairs[0] self.words = pairs[1] """ Finds occurrences of the character in a line """ @staticmethod def find_indexes(line, char): indexes = [] for i in range(0, len(line)): if line[i] is char: indexes.append(i) return indexes """ Finds occurrences of the character in the grid """ def find_occurrences(self, char): loc = [] for i in range(len(self.scheme)): loc.append([i, self.find_indexes(self.scheme[i], char)]) return loc """ Returns adjacent slots (relative to a slot) """ def get_near(self, index, line_index): scheme = self.scheme near = [] index_not_first = index > 0 index_not_last = len(scheme) > line_index and index < len(scheme[line_index]) - 1 line_not_first = line_index > 0 line_not_last = line_index < len(scheme) - 1 if index_not_first: near.append([index - 1, line_index, "left"]) if index_not_last: near.append([index + 1, line_index, "right"]) if line_not_first: near.append([index, line_index - 1, "up"]) if index_not_first: near.append([index - 1, line_index - 1, "up,left"]) if index_not_last: near.append([index + 1, line_index - 1, "up,right"]) if line_not_last: near.append([index, line_index + 1, "down"]) if index_not_first: near.append([index - 1, line_index + 1, "down,left"]) if index_not_last: near.append([index + 1, line_index + 1, "down,right"]) return near """ Finds occurrences of the character in the adjacent slots (relative to a slot) """ def find_near_occurrences(self, char, index, line_index): occurrences = [] for near in self.get_near(index, line_index): if self.scheme[near[1]][near[0]] is char: occurrences.append(near) return occurrences """ Finds occurrences of string given a direction and a location """ def match_word_part(self, word_part, index, line_index, direction): if len(word_part) is 1: return [index, line_index] word_part = word_part[1:len(word_part)] switch = { "left": [line_index, index - 1], "right": [line_index, index + 1], "up": [line_index - 1, index], "up,left": [line_index - 1, index - 1], "up,right": [line_index - 1, index + 1], "down": [line_index + 1, index], "down,left": [line_index + 1, index - 1], "down,right": [line_index + 1, index + 1] } next_loc = switch[direction] try: slot = self.scheme[next_loc[0]][next_loc[1]] return self.match_word_part(word_part, next_loc[1], next_loc[0], direction) if slot is word_part[0] else False except IndexError: return False """ Finds the word inside of the grid """ def match(self, word): if word[0] is " ": word = word[1:len(word)] formatted_word = word.replace(" ", "") first_char = formatted_word[0] for occurrence in self.find_occurrences(first_char): line_index = occurrence[0] for index in occurrence[1]: for near in self.find_near_occurrences(formatted_word[1], index, line_index): match = self.match_word_part(formatted_word, index, occurrence[0], near[2]) if match: return wordmatch.WordMatch(word, [index, line_index], [match[0], match[1]], near[2])
0.4856
0.392977
import os import requests import time from tests.integration import TestsBase from tests.integration.test_file_storage import VALID_KML, NOT_WELL_FORMED_KML class TestVarnish(TestsBase): ''' Testing the Varnish 'security' configuration. As some settings are IP address dependant, we use an external HTTP Proxy to make the queries. ''' def hash(self, bits=96): assert bits % 8 == 0 return os.urandom(bits / 8).encode('hex') def timestamp(self): return int(round(time.time() * 1000.0)) def setUp(self): super(TestVarnish, self).setUp() self.registry = self.testapp.app.registry try: os.environ["http_proxy"] = self.registry.settings['http_proxy'] self.api_url = 'http:%s' % self.registry.settings['api_url'] self.alti_url = 'http:%s' % self.registry.settings['alti_url'] self.wmts_public_host = 'http://' + self.registry.settings['wmts_public_host'] + '/' except KeyError as e: raise e def tearDown(self): if "http_proxy" in os.environ: del os.environ["http_proxy"] super(TestVarnish, self).tearDown() def has_geometric_attributes(self, attrs): geometric_attrs = ['x', 'y', 'lon', 'lat', 'geom_st_box2d'] return len(set(geometric_attrs).intersection(attrs)) > 0 class TestHeight(TestVarnish): def test_height_no_referer(self): payload = {'easting': 600000.0, 'northing': 200000.0, '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/height', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_height_good_referer(self): payload = {'easting': 600000.0, 'northing': 200000.0, '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/height', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestProfile(TestVarnish): def test_profile_json_no_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/profile.json', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_profile_json_good_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/profile.json', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) def test_profile_csv_no_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/profile.csv', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_profile_csv_good_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/profile.csv', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestMapproxyGetTile(TestVarnish): ''' See https://github.com/geoadmin/mf-chsdi3/issues/873 ''' def test_mapproxy_no_referer(self): payload = {'_id': self.hash()} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_mapproxy_bad_referer(self): payload = {'_id': self.hash()} headers = {'referer': 'http://gooffy-referer.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers=headers) self.assertEqual(resp.status_code, 403) def test_mapproxy_good_referer(self): payload = {'_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestFilestorage(TestVarnish): def test_post_filestorage_no_referer(self): resp = requests.post(self.api_url + '/files', VALID_KML, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_post_filestorage_good_referer(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 200) self.assertIn('adminId', resp.json()) self.assertIn('fileId', resp.json()) def test_post_filestorage_wrong_referer(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://foo.bar', 'User-Agent': 'mf-geaodmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 403) def test_post_filestorage_wrong_content_type(self): headers = {'Content-Type': 'application/xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 415) def test_post_filestorage_not_well_formed(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', NOT_WELL_FORMED_KML, headers=headers) self.assertEqual(resp.status_code, 415) def test_post_filestorage_too_big(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} current_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(current_dir, '../integration', 'big.kml')) as f: data = f.read() resp = requests.post(self.api_url + '/files', data, headers=headers) self.assertEqual(resp.status_code, 413)
tests/e2e/test_varnish.py
import os import requests import time from tests.integration import TestsBase from tests.integration.test_file_storage import VALID_KML, NOT_WELL_FORMED_KML class TestVarnish(TestsBase): ''' Testing the Varnish 'security' configuration. As some settings are IP address dependant, we use an external HTTP Proxy to make the queries. ''' def hash(self, bits=96): assert bits % 8 == 0 return os.urandom(bits / 8).encode('hex') def timestamp(self): return int(round(time.time() * 1000.0)) def setUp(self): super(TestVarnish, self).setUp() self.registry = self.testapp.app.registry try: os.environ["http_proxy"] = self.registry.settings['http_proxy'] self.api_url = 'http:%s' % self.registry.settings['api_url'] self.alti_url = 'http:%s' % self.registry.settings['alti_url'] self.wmts_public_host = 'http://' + self.registry.settings['wmts_public_host'] + '/' except KeyError as e: raise e def tearDown(self): if "http_proxy" in os.environ: del os.environ["http_proxy"] super(TestVarnish, self).tearDown() def has_geometric_attributes(self, attrs): geometric_attrs = ['x', 'y', 'lon', 'lat', 'geom_st_box2d'] return len(set(geometric_attrs).intersection(attrs)) > 0 class TestHeight(TestVarnish): def test_height_no_referer(self): payload = {'easting': 600000.0, 'northing': 200000.0, '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/height', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_height_good_referer(self): payload = {'easting': 600000.0, 'northing': 200000.0, '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/height', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestProfile(TestVarnish): def test_profile_json_no_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/profile.json', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_profile_json_good_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/profile.json', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) def test_profile_csv_no_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} resp = requests.get(self.alti_url + '/rest/services/profile.csv', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_profile_csv_good_referer(self): payload = {'geom': '{"type":"LineString","coordinates":[[550050,206550],[556950,204150],[561050,207950]]}', '_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.alti_url + '/rest/services/profile.csv', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestMapproxyGetTile(TestVarnish): ''' See https://github.com/geoadmin/mf-chsdi3/issues/873 ''' def test_mapproxy_no_referer(self): payload = {'_id': self.hash()} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_mapproxy_bad_referer(self): payload = {'_id': self.hash()} headers = {'referer': 'http://gooffy-referer.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers=headers) self.assertEqual(resp.status_code, 403) def test_mapproxy_good_referer(self): payload = {'_id': self.hash()} headers = {'referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.get(self.wmts_public_host + '/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/13/4265/2883.jpeg', params=payload, headers=headers) self.assertEqual(resp.status_code, 200) class TestFilestorage(TestVarnish): def test_post_filestorage_no_referer(self): resp = requests.post(self.api_url + '/files', VALID_KML, headers={'User-Agent': 'mf-geoadmin/python'}) self.assertEqual(resp.status_code, 403) def test_post_filestorage_good_referer(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 200) self.assertIn('adminId', resp.json()) self.assertIn('fileId', resp.json()) def test_post_filestorage_wrong_referer(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://foo.bar', 'User-Agent': 'mf-geaodmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 403) def test_post_filestorage_wrong_content_type(self): headers = {'Content-Type': 'application/xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', VALID_KML, headers=headers) self.assertEqual(resp.status_code, 415) def test_post_filestorage_not_well_formed(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} resp = requests.post(self.api_url + '/files', NOT_WELL_FORMED_KML, headers=headers) self.assertEqual(resp.status_code, 415) def test_post_filestorage_too_big(self): headers = {'Content-Type': 'application/vnd.google-earth.kml+xml', 'Referer': 'http://unittest.geo.admin.ch', 'User-Agent': 'mf-geoadmin/python'} current_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(current_dir, '../integration', 'big.kml')) as f: data = f.read() resp = requests.post(self.api_url + '/files', data, headers=headers) self.assertEqual(resp.status_code, 413)
0.470737
0.174059
import re import json from collections import defaultdict from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse, FormRequest from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader from product_spiders.utils import extract_price class TranscatSpider(BaseSpider): name = 'transcat.com' allowed_domains = ['transcat.com'] start_urls = ('http://www.transcat.com/Catalog/default.aspx',) start_urls = ('http://www.transcat.com/Catalog/ProductSearch.aspx?SearchType=Combo&Mfg=&Cat=CL&SubCat=',) def __init__(self, *args, **kwargs): super(TranscatSpider, self).__init__(*args, **kwargs) self.page_seen = defaultdict(dict) def parse(self, response): hxs = HtmlXPathSelector(response) if response.url == self.start_urls[0]: cats = hxs.select('//td[@class="catalog-list"]/strong/a/@href').extract() for cat in cats: yield Request(urljoin_rfc(get_base_url(response), cat)) pages = set(hxs.select('//tr[@class="Numbering"]//a/@href').re('_doPostBack\(.*,.*(Page\$\d+).*\)')) for page in pages: if not page in self.page_seen[response.url]: self.page_seen[response.url][page] = True r = FormRequest.from_response(response, formname='aspnetForm', formdata={'__EVENTTARGET': 'ctl00$ContentPlaceHolderMiddle$TabContainer1$TabPanel2$grdSearch', '__EVENTARGUMENT': page}, dont_click=True) yield r for product in self.parse_products(hxs, response): yield product def parse_products(self, hxs, response): products = hxs.select('//table[@class="SearchGrid"]//td/a[contains(@href, "productdetail.aspx")]/../..') for product in products: loader = ProductLoader(item=Product(), selector=product) url = product.select('.//a[contains(@href, "productdetail.aspx")]/@href').extract()[0] url = urljoin_rfc(get_base_url(response), url) loader.add_value('url', url) loader.add_xpath('name', './/td[position() = 2]//a[contains(@href, "productdetail.aspx")]/text()') loader.add_xpath('price', './/td[position() = 3]//text()') yield loader.load_item()
portfolio/Python/scrapy/instrumart/transcat.py
import re import json from collections import defaultdict from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse, FormRequest from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader from product_spiders.utils import extract_price class TranscatSpider(BaseSpider): name = 'transcat.com' allowed_domains = ['transcat.com'] start_urls = ('http://www.transcat.com/Catalog/default.aspx',) start_urls = ('http://www.transcat.com/Catalog/ProductSearch.aspx?SearchType=Combo&Mfg=&Cat=CL&SubCat=',) def __init__(self, *args, **kwargs): super(TranscatSpider, self).__init__(*args, **kwargs) self.page_seen = defaultdict(dict) def parse(self, response): hxs = HtmlXPathSelector(response) if response.url == self.start_urls[0]: cats = hxs.select('//td[@class="catalog-list"]/strong/a/@href').extract() for cat in cats: yield Request(urljoin_rfc(get_base_url(response), cat)) pages = set(hxs.select('//tr[@class="Numbering"]//a/@href').re('_doPostBack\(.*,.*(Page\$\d+).*\)')) for page in pages: if not page in self.page_seen[response.url]: self.page_seen[response.url][page] = True r = FormRequest.from_response(response, formname='aspnetForm', formdata={'__EVENTTARGET': 'ctl00$ContentPlaceHolderMiddle$TabContainer1$TabPanel2$grdSearch', '__EVENTARGUMENT': page}, dont_click=True) yield r for product in self.parse_products(hxs, response): yield product def parse_products(self, hxs, response): products = hxs.select('//table[@class="SearchGrid"]//td/a[contains(@href, "productdetail.aspx")]/../..') for product in products: loader = ProductLoader(item=Product(), selector=product) url = product.select('.//a[contains(@href, "productdetail.aspx")]/@href').extract()[0] url = urljoin_rfc(get_base_url(response), url) loader.add_value('url', url) loader.add_xpath('name', './/td[position() = 2]//a[contains(@href, "productdetail.aspx")]/text()') loader.add_xpath('price', './/td[position() = 3]//text()') yield loader.load_item()
0.275714
0.072472
import numpy as np from scipy import ndimage as nd from nilabels.tools.aux_methods.utils_nib import set_new_data def contour_from_array_at_label(im_arr, lab, thr=0.3, omit_axis=None, verbose=0): """ Get the contour of a single label :param im_arr: input array with segmentation :param lab: considered label :param thr: threshold (default 0.3) increase to increase the contour thickness. :param omit_axis: a directional axis preference for the contour creation, to avoid "walls" when scrolling the 3d image in a particular direction. None if no preference axis is expected. :param verbose: :return: boolean mask with the array labels. """ if verbose > 0: print('Getting contour for label {}'.format(lab)) array_label_l = im_arr == lab assert isinstance(array_label_l, np.ndarray) gra = np.gradient(array_label_l.astype(np.bool).astype(np.float64)) if omit_axis is None: thresholded_gra = np.sqrt(gra[0] ** 2 + gra[1] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'x': thresholded_gra = np.sqrt(gra[1] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'y': thresholded_gra = np.sqrt(gra[0] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'z': thresholded_gra = np.sqrt(gra[0] ** 2 + gra[1] ** 2) > thr else: raise IOError return thresholded_gra def contour_from_segmentation(im_segm, omit_axis=None, verbose=0): """ From an input nibabel image segmentation, returns the contour of each segmented region with the original label. :param im_segm: :param omit_axis: a directional axis preference for the contour creation, to avoid "walls" when scrolling the 3d image in a particular direction. None if no preference axis is expected. :param verbose: 0 no, 1 yes. :return: return the contour of the provided segmentation """ list_labels = sorted(list(set(im_segm.get_data().flat)))[1:] output_arr = np.zeros_like(im_segm.get_data(), dtype=im_segm.get_data_dtype()) for la in list_labels: output_arr += contour_from_array_at_label(im_segm.get_data(), la, omit_axis=omit_axis, verbose=verbose) return set_new_data(im_segm, output_arr.astype(np.bool) * im_segm.get_data(), new_dtype=im_segm.get_data_dtype()) def get_xyz_borders_of_a_label(segm_arr, label): """ :param segm_arr: array representing a segmentation :param label: a single integer label :return: box coordinates containing the given label in the segmentation, None if the label is not present. """ assert segm_arr.ndim == 3 if label not in segm_arr: return None X, Y, Z = np.where(segm_arr == label) return [np.min(X), np.max(X), np.min(Y), np.max(Y), np.min(Z), np.max(Z)] def get_internal_contour_with_erosion_at_label(segm_arr, lab, thickness=1): """ Get the internal contour for a given thickness. :param segm_arr: input segmentation where to extract the contour :param lab: label to extract the contour :param thickness: final thickness of the segmentation :return: image with only the contour of the given input image. """ im_lab = segm_arr == lab return (im_lab ^ nd.morphology.binary_erosion(im_lab, iterations=thickness).astype(np.bool)).astype(segm_arr.dtype) * lab
nilabels/tools/detections/contours.py
import numpy as np from scipy import ndimage as nd from nilabels.tools.aux_methods.utils_nib import set_new_data def contour_from_array_at_label(im_arr, lab, thr=0.3, omit_axis=None, verbose=0): """ Get the contour of a single label :param im_arr: input array with segmentation :param lab: considered label :param thr: threshold (default 0.3) increase to increase the contour thickness. :param omit_axis: a directional axis preference for the contour creation, to avoid "walls" when scrolling the 3d image in a particular direction. None if no preference axis is expected. :param verbose: :return: boolean mask with the array labels. """ if verbose > 0: print('Getting contour for label {}'.format(lab)) array_label_l = im_arr == lab assert isinstance(array_label_l, np.ndarray) gra = np.gradient(array_label_l.astype(np.bool).astype(np.float64)) if omit_axis is None: thresholded_gra = np.sqrt(gra[0] ** 2 + gra[1] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'x': thresholded_gra = np.sqrt(gra[1] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'y': thresholded_gra = np.sqrt(gra[0] ** 2 + gra[2] ** 2) > thr elif omit_axis == 'z': thresholded_gra = np.sqrt(gra[0] ** 2 + gra[1] ** 2) > thr else: raise IOError return thresholded_gra def contour_from_segmentation(im_segm, omit_axis=None, verbose=0): """ From an input nibabel image segmentation, returns the contour of each segmented region with the original label. :param im_segm: :param omit_axis: a directional axis preference for the contour creation, to avoid "walls" when scrolling the 3d image in a particular direction. None if no preference axis is expected. :param verbose: 0 no, 1 yes. :return: return the contour of the provided segmentation """ list_labels = sorted(list(set(im_segm.get_data().flat)))[1:] output_arr = np.zeros_like(im_segm.get_data(), dtype=im_segm.get_data_dtype()) for la in list_labels: output_arr += contour_from_array_at_label(im_segm.get_data(), la, omit_axis=omit_axis, verbose=verbose) return set_new_data(im_segm, output_arr.astype(np.bool) * im_segm.get_data(), new_dtype=im_segm.get_data_dtype()) def get_xyz_borders_of_a_label(segm_arr, label): """ :param segm_arr: array representing a segmentation :param label: a single integer label :return: box coordinates containing the given label in the segmentation, None if the label is not present. """ assert segm_arr.ndim == 3 if label not in segm_arr: return None X, Y, Z = np.where(segm_arr == label) return [np.min(X), np.max(X), np.min(Y), np.max(Y), np.min(Z), np.max(Z)] def get_internal_contour_with_erosion_at_label(segm_arr, lab, thickness=1): """ Get the internal contour for a given thickness. :param segm_arr: input segmentation where to extract the contour :param lab: label to extract the contour :param thickness: final thickness of the segmentation :return: image with only the contour of the given input image. """ im_lab = segm_arr == lab return (im_lab ^ nd.morphology.binary_erosion(im_lab, iterations=thickness).astype(np.bool)).astype(segm_arr.dtype) * lab
0.870556
0.799873
import ast import requests import configparser from flask import Flask, request, jsonify, render_template from flask import Flask, request from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) a = 5.0 b = 5.0 c = 5.0 d = 5.0 e = 5.0 f = 5.0 g = 5.0 h = 5.0 i = 5.0 j = 5.0 k = 5.0 l = 5.0 m = 5.0 n = 5.0 o = 5.0 p = 5.0 q = 5.0 r = 5.0 av = 0.0 def refresh_average(): global av av = (a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r) / 18 / 10 if av > 1: av = 1.0 return av elif av < 0: av = 0 else: return av def parse_webhook(webhook_data): data = ast.literal_eval(webhook_data) return data @app.route('/', methods=['GET']) @cross_origin() def index(): if request.method == 'GET': print('Here is the current av') return jsonify({'_result': str(refresh_average())}) else: return {"code": "success"} @app.route('/rsi_h', methods=['POST']) @cross_origin() def rsi_h(): if request.method == 'POST': print('rsi sell alert received') global a global c a = 10 c = 5 refresh_average() print(refresh_average()) return {"code": "success"} else: return {"code": "success"} @app.route('/rsi_l', methods=['POST']) @cross_origin() def rsi_l(): if request.method == 'POST': print('rsi buy alert received') global c global a c = 0 a = 5 refresh_average() return {"code": "success"} else: return {"code": "success"} @app.route('/rsi_mfi_h', methods=['POST']) @cross_origin() def api_rsi_mfi_h_trigger(): if request.method == 'POST': print('rsi sell alert received') global d global e d = 15 e = 5 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/rsi_mfi_l', methods=['POST']) @cross_origin() def api_rsi_mfi_l_trigger(): if request.method == 'POST': print('rsi buy alert received') global e global d d = 5 e = -5 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_h', methods=['POST']) @cross_origin() def api_rsi_stoch_k_h_trigger(): if request.method == 'POST': print('stoch sell alert received') global f global g g = 5 f = 20 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_l', methods=['POST']) @cross_origin() def api_rsi_stoch_k_l_trigger(): if request.method == 'POST': print('stoch buy alert received') global g global f f = 5 g = -10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_mu', methods=['POST']) @cross_origin() def api_rsi_stoch_k_mu_trigger(): if request.method == 'POST': print('stoch buy alert received') global h global i i = 5 h = 0 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_md', methods=['POST']) def api_rsi_stoch_k_md_trigger(): if request.method == 'POST': print('stoch sell alert received') global i global h h = 5 i = 10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_diamond', methods=['POST']) def api_rsi_sell_diamond_trigger(): if request.method == 'POST': print('sell diamond alert received') global j global k k = 5 j = 30 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_diamond', methods=['POST']) def api_rsi_buy_diamond_trigger(): if request.method == 'POST': print('buy diamond alert received') global k global j global r r = 5 j = 5 k = -20 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle', methods=['POST']) def api_rsi_sell_red_circle_trigger(): if request.method == 'POST': print('sell alert recieved') global l global k global n k = 5 n = 5 l = 12 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle_5m', methods=['POST']) def api_rsi_sell_red_circle_5_trigger(): if request.method == 'POST': print('sell alert recieved') global m global o o = 5 m = 10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle', methods=['POST']) def api_rsi_buy_green_circle_trigger(): if request.method == 'POST': print('buy alert recieved') global n global l global j j = 5 l = 5 n = -2 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle_5', methods=['POST']) def api_rsi_buy_green_circle_5_trigger(): if request.method == 'POST': print('buy alert recieved') global o global m m = 5 o = 0 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle_div', methods=['POST']) def api_rsi_sell_red_circle_div_trigger(): if request.method == 'POST': print('sell alert recieved') global p global q q = 5 p = 30 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle_div', methods=['POST']) def api_rsi_buy_green_circle_div_trigger(): if request.method == 'POST': print('buy alert recieved') global q global p global r p = 5 q = -20 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/gold_buy', methods=['POST']) def api_rsi_gold_buy_trigger(): if request.method == 'POST': print('gold alert recieved') global r global q global k q = 5 k = 5 r = 35 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} if __name__ == '__main__': app.run(host="0.0.0.0", port=5000)
main.py
import ast import requests import configparser from flask import Flask, request, jsonify, render_template from flask import Flask, request from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) a = 5.0 b = 5.0 c = 5.0 d = 5.0 e = 5.0 f = 5.0 g = 5.0 h = 5.0 i = 5.0 j = 5.0 k = 5.0 l = 5.0 m = 5.0 n = 5.0 o = 5.0 p = 5.0 q = 5.0 r = 5.0 av = 0.0 def refresh_average(): global av av = (a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r) / 18 / 10 if av > 1: av = 1.0 return av elif av < 0: av = 0 else: return av def parse_webhook(webhook_data): data = ast.literal_eval(webhook_data) return data @app.route('/', methods=['GET']) @cross_origin() def index(): if request.method == 'GET': print('Here is the current av') return jsonify({'_result': str(refresh_average())}) else: return {"code": "success"} @app.route('/rsi_h', methods=['POST']) @cross_origin() def rsi_h(): if request.method == 'POST': print('rsi sell alert received') global a global c a = 10 c = 5 refresh_average() print(refresh_average()) return {"code": "success"} else: return {"code": "success"} @app.route('/rsi_l', methods=['POST']) @cross_origin() def rsi_l(): if request.method == 'POST': print('rsi buy alert received') global c global a c = 0 a = 5 refresh_average() return {"code": "success"} else: return {"code": "success"} @app.route('/rsi_mfi_h', methods=['POST']) @cross_origin() def api_rsi_mfi_h_trigger(): if request.method == 'POST': print('rsi sell alert received') global d global e d = 15 e = 5 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/rsi_mfi_l', methods=['POST']) @cross_origin() def api_rsi_mfi_l_trigger(): if request.method == 'POST': print('rsi buy alert received') global e global d d = 5 e = -5 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_h', methods=['POST']) @cross_origin() def api_rsi_stoch_k_h_trigger(): if request.method == 'POST': print('stoch sell alert received') global f global g g = 5 f = 20 refresh_average() return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_l', methods=['POST']) @cross_origin() def api_rsi_stoch_k_l_trigger(): if request.method == 'POST': print('stoch buy alert received') global g global f f = 5 g = -10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_mu', methods=['POST']) @cross_origin() def api_rsi_stoch_k_mu_trigger(): if request.method == 'POST': print('stoch buy alert received') global h global i i = 5 h = 0 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/stoch_k_md', methods=['POST']) def api_rsi_stoch_k_md_trigger(): if request.method == 'POST': print('stoch sell alert received') global i global h h = 5 i = 10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_diamond', methods=['POST']) def api_rsi_sell_diamond_trigger(): if request.method == 'POST': print('sell diamond alert received') global j global k k = 5 j = 30 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_diamond', methods=['POST']) def api_rsi_buy_diamond_trigger(): if request.method == 'POST': print('buy diamond alert received') global k global j global r r = 5 j = 5 k = -20 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle', methods=['POST']) def api_rsi_sell_red_circle_trigger(): if request.method == 'POST': print('sell alert recieved') global l global k global n k = 5 n = 5 l = 12 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle_5m', methods=['POST']) def api_rsi_sell_red_circle_5_trigger(): if request.method == 'POST': print('sell alert recieved') global m global o o = 5 m = 10 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle', methods=['POST']) def api_rsi_buy_green_circle_trigger(): if request.method == 'POST': print('buy alert recieved') global n global l global j j = 5 l = 5 n = -2 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle_5', methods=['POST']) def api_rsi_buy_green_circle_5_trigger(): if request.method == 'POST': print('buy alert recieved') global o global m m = 5 o = 0 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/sell_red_circle_div', methods=['POST']) def api_rsi_sell_red_circle_div_trigger(): if request.method == 'POST': print('sell alert recieved') global p global q q = 5 p = 30 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/buy_green_circle_div', methods=['POST']) def api_rsi_buy_green_circle_div_trigger(): if request.method == 'POST': print('buy alert recieved') global q global p global r p = 5 q = -20 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} @app.route('/gold_buy', methods=['POST']) def api_rsi_gold_buy_trigger(): if request.method == 'POST': print('gold alert recieved') global r global q global k q = 5 k = 5 r = 35 refresh_average() print(refresh_average()) return {"code": "success"} else: print('do nothing') return {"code": "success"} if __name__ == '__main__': app.run(host="0.0.0.0", port=5000)
0.095941
0.097648
import lasagne import theano import lasagne.layers as L import theano.tensor as T import numpy as np import sys import time from deep_dialog import dialog_config from collections import Counter, defaultdict, deque import random import cPickle as pkl EPS = 1e-10 def categorical_sample(probs, mode='sample'): if mode=='max': return np.argmax(probs) else: x = np.random.uniform() s = probs[0] i = 0 while s<x: i += 1 try: s += probs[i] except IndexError: sys.stderr.write('Sample out of Bounds!! Probs = {} Sample = {}\n'.format(probs, x)) return i-1 return i def ordered_sample(probs, N, mode='sample'): if mode=='max': return np.argsort(probs)[::-1][:N] else: p = np.copy(probs) pop = range(len(probs)) sample = [] for i in range(N): s = categorical_sample(p) sample.append(pop[s]) del pop[s] p = np.delete(p,s) p = p/p.sum() return sample def aggregate_rewards(rewards,discount): running_add = 0. for t in xrange(1,len(rewards)): running_add += rewards[t]*discount**(t-1) return running_add class E2ERLAgent: def _init_model(self, in_size, out_size, slot_sizes, db, \ n_hid=10, learning_rate_sl=0.005, learning_rate_rl=0.005, batch_size=32, ment=0.1, \ inputtype='full', sl='e2e', rl='e2e'): self.in_size = in_size self.out_size = out_size self.slot_sizes = slot_sizes self.batch_size = batch_size self.learning_rate = learning_rate_rl self.n_hid = n_hid self.r_hid = self.n_hid self.sl = sl self.rl = rl table = db.table counts = db.counts m_unk = [db.inv_counts[s][-1] for s in dialog_config.inform_slots] prior = [db.priors[s] for s in dialog_config.inform_slots] unknown = [db.unks[s] for s in dialog_config.inform_slots] ids = [db.ids[s] for s in dialog_config.inform_slots] input_var, turn_mask, act_mask, reward_var = T.ftensor3('in'), T.bmatrix('tm'), \ T.btensor3('am'), T.fvector('r') T_var, N_var = T.as_tensor_variable(table), T.as_tensor_variable(counts) db_index_var = T.imatrix('db') db_index_switch = T.bvector('s') l_mask_in = L.InputLayer(shape=(None,None), input_var=turn_mask) flat_mask = T.reshape(turn_mask, (turn_mask.shape[0]*turn_mask.shape[1],1)) def _smooth(p): p_n = p+EPS return p_n/(p_n.sum(axis=1)[:,np.newaxis]) def _add_unk(p,m,N): # p: B x V, m- num missing, N- total, p0: 1 x V t_unk = T.as_tensor_variable(float(m)/N) ps = p*(1.-t_unk) return T.concatenate([ps, T.tile(t_unk, (ps.shape[0],1))], axis=1) def kl_divergence(p,q): p_n = _smooth(p) return -T.sum(q*T.log(p_n), axis=1) # belief tracking l_in = L.InputLayer(shape=(None,None,self.in_size), input_var=input_var) p_vars = [] pu_vars = [] phi_vars = [] p_targets = [] phi_targets = [] hid_in_vars = [] hid_out_vars = [] bt_loss = T.as_tensor_variable(0.) kl_loss = [] x_loss = [] self.trackers = [] for i,s in enumerate(dialog_config.inform_slots): hid_in = T.fmatrix('h') l_rnn = L.GRULayer(l_in, self.r_hid, hid_init=hid_in, \ mask_input=l_mask_in, grad_clipping=10.) # B x H x D l_b_in = L.ReshapeLayer(l_rnn, (input_var.shape[0]*input_var.shape[1], self.r_hid)) # BH x D hid_out = L.get_output(l_rnn)[:,-1,:] p_targ = T.ftensor3('p_target_'+s) p_t = T.reshape(p_targ, (p_targ.shape[0]*p_targ.shape[1],self.slot_sizes[i])) phi_targ = T.fmatrix('phi_target'+s) phi_t = T.reshape(phi_targ, (phi_targ.shape[0]*phi_targ.shape[1], 1)) l_b = L.DenseLayer(l_b_in, self.slot_sizes[i], nonlinearity=lasagne.nonlinearities.softmax) l_phi = L.DenseLayer(l_b_in, 1, nonlinearity=lasagne.nonlinearities.sigmoid) phi = T.clip(L.get_output(l_phi), 0.01, 0.99) p = L.get_output(l_b) p_u = _add_unk(p, m_unk[i], db.N) kl_loss.append(T.sum(flat_mask.flatten()*kl_divergence(p, p_t))/T.sum(flat_mask)) x_loss.append(T.sum(flat_mask*lasagne.objectives.binary_crossentropy(phi,phi_t))/ T.sum(flat_mask)) bt_loss += kl_loss[-1] + x_loss[-1] p_vars.append(p) pu_vars.append(p_u) phi_vars.append(phi) p_targets.append(p_targ) phi_targets.append(phi_targ) hid_in_vars.append(hid_in) hid_out_vars.append(hid_out) self.trackers.append(l_b) self.trackers.append(l_phi) self.bt_params = L.get_all_params(self.trackers) def check_db(pv, phi, Tb, N): O = T.alloc(0.,pv[0].shape[0],Tb.shape[0]) # BH x T.shape[0] for i,p in enumerate(pv): p_dc = T.tile(phi[i], (1, Tb.shape[0])) O += T.log(p_dc*(1./db.table.shape[0]) + \ (1.-p_dc)*(p[:,Tb[:,i]]/N[np.newaxis,:,i])) Op = T.exp(O)#+EPS # BH x T.shape[0] Os = T.sum(Op, axis=1)[:,np.newaxis] # BH x 1 return Op/Os def entropy(p): p = _smooth(p) return -T.sum(p*T.log(p), axis=-1) def weighted_entropy(p,q,p0,unks,idd): w = T.dot(idd,q.transpose()) # Pi x BH u = p0[np.newaxis,:]*(q[:,unks].sum(axis=1)[:,np.newaxis]) # BH x Pi p_tilde = w.transpose()+u return entropy(p_tilde) p_db = check_db(pu_vars, phi_vars, T_var, N_var) # BH x T.shape[0] if inputtype=='entropy': H_vars = [weighted_entropy(pv,p_db,prior[i],unknown[i],ids[i]) \ for i,pv in enumerate(p_vars)] H_db = entropy(p_db) phv = [ph[:,0] for ph in phi_vars] t_in = T.stacklists(H_vars+phv+[H_db]).transpose() # BH x 2M+1 t_in_resh = T.reshape(t_in, (turn_mask.shape[0], turn_mask.shape[1], \ t_in.shape[1])) # B x H x 2M+1 l_in_pol = L.InputLayer( shape=(None,None,2*len(dialog_config.inform_slots)+1), \ input_var=t_in_resh) else: in_reshaped = T.reshape(input_var, (input_var.shape[0]*input_var.shape[1], \ input_var.shape[2])) prev_act = in_reshaped[:,-len(dialog_config.inform_slots):] t_in = T.concatenate(pu_vars+phi_vars+[p_db,prev_act], axis=1) # BH x D-sum+A t_in_resh = T.reshape(t_in, (turn_mask.shape[0], turn_mask.shape[1], \ t_in.shape[1])) # B x H x D-sum l_in_pol = L.InputLayer(shape=(None,None,sum(self.slot_sizes)+ \ 3*len(dialog_config.inform_slots)+ \ table.shape[0]), input_var=t_in_resh) pol_in = T.fmatrix('pol-h') l_pol_rnn = L.GRULayer(l_in_pol, n_hid, hid_init=pol_in, mask_input=l_mask_in, grad_clipping=10.) # B x H x D pol_out = L.get_output(l_pol_rnn)[:,-1,:] l_den_in = L.ReshapeLayer(l_pol_rnn, (turn_mask.shape[0]*turn_mask.shape[1], n_hid)) # BH x D l_out = L.DenseLayer(l_den_in, self.out_size, \ nonlinearity=lasagne.nonlinearities.softmax) # BH x A self.network = l_out self.pol_params = L.get_all_params(self.network) self.params = self.bt_params + self.pol_params # db loss p_db_reshaped = T.reshape(p_db, (turn_mask.shape[0],turn_mask.shape[1],table.shape[0])) p_db_final = p_db_reshaped[:,-1,:] # B x T.shape[0] p_db_final = _smooth(p_db_final) ix = T.tile(T.arange(p_db_final.shape[0]),(db_index_var.shape[1],1)).transpose() sample_probs = p_db_final[ix,db_index_var] # B x K if dialog_config.SUCCESS_MAX_RANK==1: log_db_probs = T.log(sample_probs).sum(axis=1) else: cum_probs,_ = theano.scan(fn=lambda x, prev: x+prev, \ outputs_info=T.zeros_like(sample_probs[:,0]), \ sequences=sample_probs[:,:-1].transpose()) cum_probs = T.clip(cum_probs.transpose(), 0., 1.-1e-5) # B x K-1 log_db_probs = T.log(sample_probs).sum(axis=1) - T.log(1.-cum_probs).sum(axis=1) # B log_db_probs = log_db_probs * db_index_switch # rl probs = L.get_output(self.network) # BH x A probs = _smooth(probs) out_probs = T.reshape(probs, (turn_mask.shape[0],turn_mask.shape[1],self.out_size)) # B x H x A log_probs = T.log(out_probs) act_probs = (log_probs*act_mask).sum(axis=2) # B x H ep_probs = (act_probs*turn_mask).sum(axis=1) # B H_probs = -T.sum(T.sum(out_probs*log_probs,axis=2),axis=1) # B self.act_loss = -T.mean(ep_probs*reward_var) self.db_loss = -T.mean(log_db_probs*reward_var) self.reg_loss = -T.mean(ment*H_probs) self.loss = self.act_loss + self.db_loss + self.reg_loss self.inps = [input_var, turn_mask, act_mask, reward_var, db_index_var, db_index_switch, \ pol_in] + hid_in_vars self.obj_fn = theano.function(self.inps, self.loss, on_unused_input='warn') self.act_fn = theano.function([input_var,turn_mask,pol_in]+hid_in_vars, \ [out_probs,p_db,pol_out]+pu_vars+phi_vars+hid_out_vars, on_unused_input='warn') self.debug_fn = theano.function(self.inps, [probs, p_db, self.loss], on_unused_input='warn') self._rl_train_fn(self.learning_rate) ## sl sl_loss = 0. + bt_loss - T.mean(ep_probs) if self.sl=='e2e': sl_updates = lasagne.updates.rmsprop(sl_loss, self.params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) elif self.sl=='bel': sl_updates = lasagne.updates.rmsprop(sl_loss, self.bt_params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) else: sl_updates = lasagne.updates.rmsprop(sl_loss, self.pol_params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) sl_inps = [input_var, turn_mask, act_mask, pol_in] + p_targets + phi_targets + hid_in_vars self.sl_train_fn = theano.function(sl_inps, [sl_loss]+kl_loss+x_loss, updates=sl_updates, \ on_unused_input='warn') self.sl_obj_fn = theano.function(sl_inps, sl_loss, on_unused_input='warn') def _rl_train_fn(self, lr): if self.rl=='e2e': updates = lasagne.updates.rmsprop(self.loss, self.params, learning_rate=lr, epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) elif self.rl=='bel': updates = lasagne.updates.rmsprop(self.loss, self.bt_params, learning_rate=lr, \ epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) else: updates = lasagne.updates.rmsprop(self.loss, self.pol_params, learning_rate=lr, \ epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) self.train_fn = theano.function(self.inps, [self.act_loss,self.db_loss,self.reg_loss], \ updates=updates) def train(self, inp, tur, act, rew, db, dbs, pin, hin): return self.train_fn(inp, tur, act, rew, db, dbs, pin, *hin) def evaluate(self, inp, tur, act, rew, db, dbs, pin, hin): return self.obj_fn(inp, tur, act, rew, db, dbs, pin, *hin) def act(self, inp, pin, hin, mode='sample'): tur = np.ones((inp.shape[0],inp.shape[1])).astype('int8') outs = self.act_fn(inp, tur, pin, *hin) act_p, db_p, p_out = outs[0], outs[1], outs[2] n_slots = len(dialog_config.inform_slots) pv = outs[3:3+n_slots] phiv = outs[3+n_slots:3+2*n_slots] h_out = outs[3+2*n_slots:] action = categorical_sample(act_p.flatten(), mode=mode) if action==self.out_size-1: db_sample = ordered_sample(db_p.flatten(), dialog_config.SUCCESS_MAX_RANK, mode=mode) else: db_sample = [] return action, db_sample, db_p.flatten(), p_out, h_out, pv, phiv def sl_train(self, inp, tur, act, pin, ptargets, phitargets, hin): return self.sl_train_fn(inp, tur, act, pin, *ptargets+phitargets+hin) def sl_evaluate(self, inp, tur, act, pin, ptargets, phitargets, hin): return self.sl_obj_fn(inp, tur, act, pin, *ptargets+phitargets+hin) def anneal_lr(self): self.learning_rate /= 2. self._rl_train_fn(self.learning_rate) def _debug(self, inp, tur, act, rew, beliefs): print 'Input = {}, Action = {}, Reward = {}'.format(inp, act, rew) out = self.debug_fn(inp, tur, act, rew, *beliefs) for item in out: print item def _init_experience_pool(self, pool): self.input_pool = deque([], pool) self.actmask_pool = deque([], pool) self.reward_pool = deque([], pool) self.db_pool = deque([], pool) self.dbswitch_pool = deque([], pool) self.turnmask_pool = deque([], pool) self.ptarget_pool = deque([], pool) self.phitarget_pool = deque([], pool) def add_to_pool(self, inp, turn, act, rew, db, dbs, ptargets, phitargets): self.input_pool.append(inp) self.actmask_pool.append(act) self.reward_pool.append(rew) self.db_pool.append(db) self.dbswitch_pool.append(dbs) self.turnmask_pool.append(turn) self.ptarget_pool.append(ptargets) self.phitarget_pool.append(phitargets) def _get_minibatch(self, N): n = min(N, len(self.input_pool)) index = random.sample(range(len(self.input_pool)), n) i = [self.input_pool[ii] for ii in index] a = [self.actmask_pool[ii] for ii in index] r = [self.reward_pool[ii] for ii in index] d = [self.db_pool[ii] for ii in index] ds = [self.dbswitch_pool[ii] for ii in index] t = [self.turnmask_pool[ii] for ii in index] p = [self.ptarget_pool[ii] for ii in index] pp = [np.asarray([row[ii] for row in p], dtype='float32') for ii in range(len(p[0]))] ph = [self.phitarget_pool[ii] for ii in index] pph = [np.asarray([row[ii] for row in ph], dtype='float32') for ii in range(len(ph[0]))] return np.asarray(i, dtype='float32'), \ np.asarray(t, dtype='int8'), \ np.asarray(a, dtype='int8'), \ np.asarray(r, dtype='float32'), \ np.asarray(d, dtype='int32'), \ np.asarray(ds, dtype='int8'), \ pp, pph def update(self, verbose=False, regime='RL'): i, t, a, r, d, ds, p, ph = self._get_minibatch(self.batch_size) hi = [np.zeros((1,self.r_hid)).astype('float32') \ for s in dialog_config.inform_slots] pi = np.zeros((1,self.n_hid)).astype('float32') if verbose: print i, t, a, r, d, ds, p, ph, hi if regime=='RL': r -= np.mean(r) al,dl,rl = self.train(i,t,a,r,d,ds,pi,hi) g = al+dl+rl else: g = self.sl_train(i,t,a,pi,p,ph,hi) return g def eval_objective(self, N): try: obj = self.evaluate(self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b) except AttributeError: self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b = self._get_minibatch(N) obj = self.evaluate(self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b) return obj def load_model(self, load_path): with open(load_path, 'r') as f: data = pkl.load(f) L.set_all_param_values(self.network, data) for item in self.trackers: data = pkl.load(f) L.set_all_param_values(item, data) def save_model(self, save_path): with open(save_path, 'w') as f: data = L.get_all_param_values(self.network) pkl.dump(data, f) for item in self.trackers: data = L.get_all_param_values(item) pkl.dump(data, f)
deep_dialog/agents/agent_lu_rl.py
import lasagne import theano import lasagne.layers as L import theano.tensor as T import numpy as np import sys import time from deep_dialog import dialog_config from collections import Counter, defaultdict, deque import random import cPickle as pkl EPS = 1e-10 def categorical_sample(probs, mode='sample'): if mode=='max': return np.argmax(probs) else: x = np.random.uniform() s = probs[0] i = 0 while s<x: i += 1 try: s += probs[i] except IndexError: sys.stderr.write('Sample out of Bounds!! Probs = {} Sample = {}\n'.format(probs, x)) return i-1 return i def ordered_sample(probs, N, mode='sample'): if mode=='max': return np.argsort(probs)[::-1][:N] else: p = np.copy(probs) pop = range(len(probs)) sample = [] for i in range(N): s = categorical_sample(p) sample.append(pop[s]) del pop[s] p = np.delete(p,s) p = p/p.sum() return sample def aggregate_rewards(rewards,discount): running_add = 0. for t in xrange(1,len(rewards)): running_add += rewards[t]*discount**(t-1) return running_add class E2ERLAgent: def _init_model(self, in_size, out_size, slot_sizes, db, \ n_hid=10, learning_rate_sl=0.005, learning_rate_rl=0.005, batch_size=32, ment=0.1, \ inputtype='full', sl='e2e', rl='e2e'): self.in_size = in_size self.out_size = out_size self.slot_sizes = slot_sizes self.batch_size = batch_size self.learning_rate = learning_rate_rl self.n_hid = n_hid self.r_hid = self.n_hid self.sl = sl self.rl = rl table = db.table counts = db.counts m_unk = [db.inv_counts[s][-1] for s in dialog_config.inform_slots] prior = [db.priors[s] for s in dialog_config.inform_slots] unknown = [db.unks[s] for s in dialog_config.inform_slots] ids = [db.ids[s] for s in dialog_config.inform_slots] input_var, turn_mask, act_mask, reward_var = T.ftensor3('in'), T.bmatrix('tm'), \ T.btensor3('am'), T.fvector('r') T_var, N_var = T.as_tensor_variable(table), T.as_tensor_variable(counts) db_index_var = T.imatrix('db') db_index_switch = T.bvector('s') l_mask_in = L.InputLayer(shape=(None,None), input_var=turn_mask) flat_mask = T.reshape(turn_mask, (turn_mask.shape[0]*turn_mask.shape[1],1)) def _smooth(p): p_n = p+EPS return p_n/(p_n.sum(axis=1)[:,np.newaxis]) def _add_unk(p,m,N): # p: B x V, m- num missing, N- total, p0: 1 x V t_unk = T.as_tensor_variable(float(m)/N) ps = p*(1.-t_unk) return T.concatenate([ps, T.tile(t_unk, (ps.shape[0],1))], axis=1) def kl_divergence(p,q): p_n = _smooth(p) return -T.sum(q*T.log(p_n), axis=1) # belief tracking l_in = L.InputLayer(shape=(None,None,self.in_size), input_var=input_var) p_vars = [] pu_vars = [] phi_vars = [] p_targets = [] phi_targets = [] hid_in_vars = [] hid_out_vars = [] bt_loss = T.as_tensor_variable(0.) kl_loss = [] x_loss = [] self.trackers = [] for i,s in enumerate(dialog_config.inform_slots): hid_in = T.fmatrix('h') l_rnn = L.GRULayer(l_in, self.r_hid, hid_init=hid_in, \ mask_input=l_mask_in, grad_clipping=10.) # B x H x D l_b_in = L.ReshapeLayer(l_rnn, (input_var.shape[0]*input_var.shape[1], self.r_hid)) # BH x D hid_out = L.get_output(l_rnn)[:,-1,:] p_targ = T.ftensor3('p_target_'+s) p_t = T.reshape(p_targ, (p_targ.shape[0]*p_targ.shape[1],self.slot_sizes[i])) phi_targ = T.fmatrix('phi_target'+s) phi_t = T.reshape(phi_targ, (phi_targ.shape[0]*phi_targ.shape[1], 1)) l_b = L.DenseLayer(l_b_in, self.slot_sizes[i], nonlinearity=lasagne.nonlinearities.softmax) l_phi = L.DenseLayer(l_b_in, 1, nonlinearity=lasagne.nonlinearities.sigmoid) phi = T.clip(L.get_output(l_phi), 0.01, 0.99) p = L.get_output(l_b) p_u = _add_unk(p, m_unk[i], db.N) kl_loss.append(T.sum(flat_mask.flatten()*kl_divergence(p, p_t))/T.sum(flat_mask)) x_loss.append(T.sum(flat_mask*lasagne.objectives.binary_crossentropy(phi,phi_t))/ T.sum(flat_mask)) bt_loss += kl_loss[-1] + x_loss[-1] p_vars.append(p) pu_vars.append(p_u) phi_vars.append(phi) p_targets.append(p_targ) phi_targets.append(phi_targ) hid_in_vars.append(hid_in) hid_out_vars.append(hid_out) self.trackers.append(l_b) self.trackers.append(l_phi) self.bt_params = L.get_all_params(self.trackers) def check_db(pv, phi, Tb, N): O = T.alloc(0.,pv[0].shape[0],Tb.shape[0]) # BH x T.shape[0] for i,p in enumerate(pv): p_dc = T.tile(phi[i], (1, Tb.shape[0])) O += T.log(p_dc*(1./db.table.shape[0]) + \ (1.-p_dc)*(p[:,Tb[:,i]]/N[np.newaxis,:,i])) Op = T.exp(O)#+EPS # BH x T.shape[0] Os = T.sum(Op, axis=1)[:,np.newaxis] # BH x 1 return Op/Os def entropy(p): p = _smooth(p) return -T.sum(p*T.log(p), axis=-1) def weighted_entropy(p,q,p0,unks,idd): w = T.dot(idd,q.transpose()) # Pi x BH u = p0[np.newaxis,:]*(q[:,unks].sum(axis=1)[:,np.newaxis]) # BH x Pi p_tilde = w.transpose()+u return entropy(p_tilde) p_db = check_db(pu_vars, phi_vars, T_var, N_var) # BH x T.shape[0] if inputtype=='entropy': H_vars = [weighted_entropy(pv,p_db,prior[i],unknown[i],ids[i]) \ for i,pv in enumerate(p_vars)] H_db = entropy(p_db) phv = [ph[:,0] for ph in phi_vars] t_in = T.stacklists(H_vars+phv+[H_db]).transpose() # BH x 2M+1 t_in_resh = T.reshape(t_in, (turn_mask.shape[0], turn_mask.shape[1], \ t_in.shape[1])) # B x H x 2M+1 l_in_pol = L.InputLayer( shape=(None,None,2*len(dialog_config.inform_slots)+1), \ input_var=t_in_resh) else: in_reshaped = T.reshape(input_var, (input_var.shape[0]*input_var.shape[1], \ input_var.shape[2])) prev_act = in_reshaped[:,-len(dialog_config.inform_slots):] t_in = T.concatenate(pu_vars+phi_vars+[p_db,prev_act], axis=1) # BH x D-sum+A t_in_resh = T.reshape(t_in, (turn_mask.shape[0], turn_mask.shape[1], \ t_in.shape[1])) # B x H x D-sum l_in_pol = L.InputLayer(shape=(None,None,sum(self.slot_sizes)+ \ 3*len(dialog_config.inform_slots)+ \ table.shape[0]), input_var=t_in_resh) pol_in = T.fmatrix('pol-h') l_pol_rnn = L.GRULayer(l_in_pol, n_hid, hid_init=pol_in, mask_input=l_mask_in, grad_clipping=10.) # B x H x D pol_out = L.get_output(l_pol_rnn)[:,-1,:] l_den_in = L.ReshapeLayer(l_pol_rnn, (turn_mask.shape[0]*turn_mask.shape[1], n_hid)) # BH x D l_out = L.DenseLayer(l_den_in, self.out_size, \ nonlinearity=lasagne.nonlinearities.softmax) # BH x A self.network = l_out self.pol_params = L.get_all_params(self.network) self.params = self.bt_params + self.pol_params # db loss p_db_reshaped = T.reshape(p_db, (turn_mask.shape[0],turn_mask.shape[1],table.shape[0])) p_db_final = p_db_reshaped[:,-1,:] # B x T.shape[0] p_db_final = _smooth(p_db_final) ix = T.tile(T.arange(p_db_final.shape[0]),(db_index_var.shape[1],1)).transpose() sample_probs = p_db_final[ix,db_index_var] # B x K if dialog_config.SUCCESS_MAX_RANK==1: log_db_probs = T.log(sample_probs).sum(axis=1) else: cum_probs,_ = theano.scan(fn=lambda x, prev: x+prev, \ outputs_info=T.zeros_like(sample_probs[:,0]), \ sequences=sample_probs[:,:-1].transpose()) cum_probs = T.clip(cum_probs.transpose(), 0., 1.-1e-5) # B x K-1 log_db_probs = T.log(sample_probs).sum(axis=1) - T.log(1.-cum_probs).sum(axis=1) # B log_db_probs = log_db_probs * db_index_switch # rl probs = L.get_output(self.network) # BH x A probs = _smooth(probs) out_probs = T.reshape(probs, (turn_mask.shape[0],turn_mask.shape[1],self.out_size)) # B x H x A log_probs = T.log(out_probs) act_probs = (log_probs*act_mask).sum(axis=2) # B x H ep_probs = (act_probs*turn_mask).sum(axis=1) # B H_probs = -T.sum(T.sum(out_probs*log_probs,axis=2),axis=1) # B self.act_loss = -T.mean(ep_probs*reward_var) self.db_loss = -T.mean(log_db_probs*reward_var) self.reg_loss = -T.mean(ment*H_probs) self.loss = self.act_loss + self.db_loss + self.reg_loss self.inps = [input_var, turn_mask, act_mask, reward_var, db_index_var, db_index_switch, \ pol_in] + hid_in_vars self.obj_fn = theano.function(self.inps, self.loss, on_unused_input='warn') self.act_fn = theano.function([input_var,turn_mask,pol_in]+hid_in_vars, \ [out_probs,p_db,pol_out]+pu_vars+phi_vars+hid_out_vars, on_unused_input='warn') self.debug_fn = theano.function(self.inps, [probs, p_db, self.loss], on_unused_input='warn') self._rl_train_fn(self.learning_rate) ## sl sl_loss = 0. + bt_loss - T.mean(ep_probs) if self.sl=='e2e': sl_updates = lasagne.updates.rmsprop(sl_loss, self.params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) elif self.sl=='bel': sl_updates = lasagne.updates.rmsprop(sl_loss, self.bt_params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) else: sl_updates = lasagne.updates.rmsprop(sl_loss, self.pol_params, \ learning_rate=learning_rate_sl, epsilon=1e-4) sl_updates_with_mom = lasagne.updates.apply_momentum(sl_updates) sl_inps = [input_var, turn_mask, act_mask, pol_in] + p_targets + phi_targets + hid_in_vars self.sl_train_fn = theano.function(sl_inps, [sl_loss]+kl_loss+x_loss, updates=sl_updates, \ on_unused_input='warn') self.sl_obj_fn = theano.function(sl_inps, sl_loss, on_unused_input='warn') def _rl_train_fn(self, lr): if self.rl=='e2e': updates = lasagne.updates.rmsprop(self.loss, self.params, learning_rate=lr, epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) elif self.rl=='bel': updates = lasagne.updates.rmsprop(self.loss, self.bt_params, learning_rate=lr, \ epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) else: updates = lasagne.updates.rmsprop(self.loss, self.pol_params, learning_rate=lr, \ epsilon=1e-4) updates_with_mom = lasagne.updates.apply_momentum(updates) self.train_fn = theano.function(self.inps, [self.act_loss,self.db_loss,self.reg_loss], \ updates=updates) def train(self, inp, tur, act, rew, db, dbs, pin, hin): return self.train_fn(inp, tur, act, rew, db, dbs, pin, *hin) def evaluate(self, inp, tur, act, rew, db, dbs, pin, hin): return self.obj_fn(inp, tur, act, rew, db, dbs, pin, *hin) def act(self, inp, pin, hin, mode='sample'): tur = np.ones((inp.shape[0],inp.shape[1])).astype('int8') outs = self.act_fn(inp, tur, pin, *hin) act_p, db_p, p_out = outs[0], outs[1], outs[2] n_slots = len(dialog_config.inform_slots) pv = outs[3:3+n_slots] phiv = outs[3+n_slots:3+2*n_slots] h_out = outs[3+2*n_slots:] action = categorical_sample(act_p.flatten(), mode=mode) if action==self.out_size-1: db_sample = ordered_sample(db_p.flatten(), dialog_config.SUCCESS_MAX_RANK, mode=mode) else: db_sample = [] return action, db_sample, db_p.flatten(), p_out, h_out, pv, phiv def sl_train(self, inp, tur, act, pin, ptargets, phitargets, hin): return self.sl_train_fn(inp, tur, act, pin, *ptargets+phitargets+hin) def sl_evaluate(self, inp, tur, act, pin, ptargets, phitargets, hin): return self.sl_obj_fn(inp, tur, act, pin, *ptargets+phitargets+hin) def anneal_lr(self): self.learning_rate /= 2. self._rl_train_fn(self.learning_rate) def _debug(self, inp, tur, act, rew, beliefs): print 'Input = {}, Action = {}, Reward = {}'.format(inp, act, rew) out = self.debug_fn(inp, tur, act, rew, *beliefs) for item in out: print item def _init_experience_pool(self, pool): self.input_pool = deque([], pool) self.actmask_pool = deque([], pool) self.reward_pool = deque([], pool) self.db_pool = deque([], pool) self.dbswitch_pool = deque([], pool) self.turnmask_pool = deque([], pool) self.ptarget_pool = deque([], pool) self.phitarget_pool = deque([], pool) def add_to_pool(self, inp, turn, act, rew, db, dbs, ptargets, phitargets): self.input_pool.append(inp) self.actmask_pool.append(act) self.reward_pool.append(rew) self.db_pool.append(db) self.dbswitch_pool.append(dbs) self.turnmask_pool.append(turn) self.ptarget_pool.append(ptargets) self.phitarget_pool.append(phitargets) def _get_minibatch(self, N): n = min(N, len(self.input_pool)) index = random.sample(range(len(self.input_pool)), n) i = [self.input_pool[ii] for ii in index] a = [self.actmask_pool[ii] for ii in index] r = [self.reward_pool[ii] for ii in index] d = [self.db_pool[ii] for ii in index] ds = [self.dbswitch_pool[ii] for ii in index] t = [self.turnmask_pool[ii] for ii in index] p = [self.ptarget_pool[ii] for ii in index] pp = [np.asarray([row[ii] for row in p], dtype='float32') for ii in range(len(p[0]))] ph = [self.phitarget_pool[ii] for ii in index] pph = [np.asarray([row[ii] for row in ph], dtype='float32') for ii in range(len(ph[0]))] return np.asarray(i, dtype='float32'), \ np.asarray(t, dtype='int8'), \ np.asarray(a, dtype='int8'), \ np.asarray(r, dtype='float32'), \ np.asarray(d, dtype='int32'), \ np.asarray(ds, dtype='int8'), \ pp, pph def update(self, verbose=False, regime='RL'): i, t, a, r, d, ds, p, ph = self._get_minibatch(self.batch_size) hi = [np.zeros((1,self.r_hid)).astype('float32') \ for s in dialog_config.inform_slots] pi = np.zeros((1,self.n_hid)).astype('float32') if verbose: print i, t, a, r, d, ds, p, ph, hi if regime=='RL': r -= np.mean(r) al,dl,rl = self.train(i,t,a,r,d,ds,pi,hi) g = al+dl+rl else: g = self.sl_train(i,t,a,pi,p,ph,hi) return g def eval_objective(self, N): try: obj = self.evaluate(self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b) except AttributeError: self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b = self._get_minibatch(N) obj = self.evaluate(self.eval_i, self.eval_t, self.eval_a, self.eval_r, self.eval_b) return obj def load_model(self, load_path): with open(load_path, 'r') as f: data = pkl.load(f) L.set_all_param_values(self.network, data) for item in self.trackers: data = pkl.load(f) L.set_all_param_values(item, data) def save_model(self, save_path): with open(save_path, 'w') as f: data = L.get_all_param_values(self.network) pkl.dump(data, f) for item in self.trackers: data = L.get_all_param_values(item) pkl.dump(data, f)
0.257485
0.213992
"""Low-level, core functionality for DayDream""" __all__ = ['DayDreamError', 'Reference', 'Aggregator'] from copy import copy, deepcopy from functools import reduce from operator import add from typing import Any, AbstractSet, Set, Optional, Union class DayDreamError(Exception): """Error for package-specific issues.""" class Reference: """Creates a reference to an attribute present in a parent class. :param name: name of the referenced attribute :param target: type or name of the object with the referenced attribute :param modifier: this is added to the dereferenced value """ def dereference(self, instance: Any) -> Any: """Dereference an attribute on the instance. :param instance: object whose attribute is referenced :return: value of the referenced attribute """ result = self._dereference_name(instance) try: modifier = self._modifier.dereference(instance) # type: ignore except (AttributeError, TypeError): if result is self: raise TypeError('Instance type is not referenced') if self._modifier is not None: result = result + self._modifier else: if result is self: result = deepcopy(result) # pylint: disable=protected-access result._modifier = modifier else: result = result + modifier return result @property def name(self) -> str: """Returns the name of the referenced attribute.""" return self._name def __init__(self, name: str, target: Union[type, str], modifier: Any = None) -> None: self._name = name self._target = target self._modifier = modifier def __repr__(self) -> str: return (type(self).__name__ + f'({repr(self._name)}, {self._type_name()}, ' + f'{repr(self._modifier)})') def __eq__(self, other: Any) -> bool: if isinstance(other, type(self)): # pylint: disable-msg=protected-access result = (self._name == other._name and self._target == other._target and self._modifier == other._modifier) else: result = NotImplemented return result def __add__(self, other: Any) -> 'Reference': if self._modifier is None: modifier = other else: modifier = self._modifier + other return type(self)(self._name, self._target, modifier) __radd__ = __add__ def _refers_to(self, instance: Any) -> bool: if not isinstance(instance, type): instance = type(instance) if isinstance(self._target, type): result = issubclass(instance, self._target) elif isinstance(self._target, str): result = instance.__name__ == self._target else: raise NotImplementedError('Internal state is unexpected.') return result def _dereference_name(self, instance): if self._refers_to(instance): result = getattr(instance, self._name) else: result = self return result def _type_name(self): if isinstance(self._target, str): type_name = repr(self._target) else: type_name = self._target.__name__ return type_name def _is_private(name: str) -> bool: """Return true if the name is private. :param name: name of an attribute """ return name.startswith('_') def _is_public(name: str) -> bool: """Return true if the name is not private, i.e. is public. :param name: name of an attribute """ return not name.startswith('_') class Aggregator: """Aggregate values from all objects attached to an instance. This overrides attribute look up and allows combining (through addition) values defined both on a particular instance and on its attributes. This is used to allow multiple different sources to modify a value. For example, a character's strength is partially inherent and is possibly modified by their race and levels in particular classes. This class defines the interface by which all of these can be made aware of each other with minimal boilerplate. To manage this, a character will be an aggregator and have its own `strength` attribute (i.e. the inherent part of its strength) and will add to this value any attribute that also defines a `strength` attribute. In this way, a class and a race that both define `strength` will be added to the strength present on the character yielding a total for that ability score. """ def __init_subclass__(cls, ignore: Optional[AbstractSet[str]] = None) -> None: """Setup attributes to access directly.""" super().__init_subclass__() if ignore is None: cls._ignore: Set[str] = set() else: cls._ignore = set(ignore) cls._instance_names: Set[str] = {k for k, v in vars(cls).items() if isinstance(v, property)} def __init__(self) -> None: """Initialize attribute name tracker.""" super().__init__() self._instance_names = copy(self._instance_names) def __setattr__(self, name: str, value: Any) -> None: """Track any attributes that are added to an instance.""" if _is_public(name) and name not in self._known_names: self._instance_names.add(name) super().__setattr__(name, value) def __getattribute__(self, name: str) -> Any: """Aggregate value from each attribute if allowed.""" if _is_private(name) or name in super().__getattribute__('_ignore'): result = super().__getattribute__(name) else: values = [] try: values.append(super().__getattribute__(name)) except AttributeError: pass for name_other in super().__getattribute__('_instance_names'): if name_other != name: attribute = super().__getattribute__(name_other) if hasattr(attribute, name): values.append(getattr(attribute, name)) if values: result = reduce(add, values) else: raise AttributeError(f'The desired attribute {name} could not' f' be found') try: result = result.dereference(self) except (AttributeError, TypeError): pass return result def __delattr__(self, name: str) -> None: """Remove deleted attributes from tracker.""" super().__delattr__(name) self._instance_names.remove(name) @property def _known_names(self) -> Set[str]: """Return all known names.""" return self._ignore | self._instance_names
defn/core.py
"""Low-level, core functionality for DayDream""" __all__ = ['DayDreamError', 'Reference', 'Aggregator'] from copy import copy, deepcopy from functools import reduce from operator import add from typing import Any, AbstractSet, Set, Optional, Union class DayDreamError(Exception): """Error for package-specific issues.""" class Reference: """Creates a reference to an attribute present in a parent class. :param name: name of the referenced attribute :param target: type or name of the object with the referenced attribute :param modifier: this is added to the dereferenced value """ def dereference(self, instance: Any) -> Any: """Dereference an attribute on the instance. :param instance: object whose attribute is referenced :return: value of the referenced attribute """ result = self._dereference_name(instance) try: modifier = self._modifier.dereference(instance) # type: ignore except (AttributeError, TypeError): if result is self: raise TypeError('Instance type is not referenced') if self._modifier is not None: result = result + self._modifier else: if result is self: result = deepcopy(result) # pylint: disable=protected-access result._modifier = modifier else: result = result + modifier return result @property def name(self) -> str: """Returns the name of the referenced attribute.""" return self._name def __init__(self, name: str, target: Union[type, str], modifier: Any = None) -> None: self._name = name self._target = target self._modifier = modifier def __repr__(self) -> str: return (type(self).__name__ + f'({repr(self._name)}, {self._type_name()}, ' + f'{repr(self._modifier)})') def __eq__(self, other: Any) -> bool: if isinstance(other, type(self)): # pylint: disable-msg=protected-access result = (self._name == other._name and self._target == other._target and self._modifier == other._modifier) else: result = NotImplemented return result def __add__(self, other: Any) -> 'Reference': if self._modifier is None: modifier = other else: modifier = self._modifier + other return type(self)(self._name, self._target, modifier) __radd__ = __add__ def _refers_to(self, instance: Any) -> bool: if not isinstance(instance, type): instance = type(instance) if isinstance(self._target, type): result = issubclass(instance, self._target) elif isinstance(self._target, str): result = instance.__name__ == self._target else: raise NotImplementedError('Internal state is unexpected.') return result def _dereference_name(self, instance): if self._refers_to(instance): result = getattr(instance, self._name) else: result = self return result def _type_name(self): if isinstance(self._target, str): type_name = repr(self._target) else: type_name = self._target.__name__ return type_name def _is_private(name: str) -> bool: """Return true if the name is private. :param name: name of an attribute """ return name.startswith('_') def _is_public(name: str) -> bool: """Return true if the name is not private, i.e. is public. :param name: name of an attribute """ return not name.startswith('_') class Aggregator: """Aggregate values from all objects attached to an instance. This overrides attribute look up and allows combining (through addition) values defined both on a particular instance and on its attributes. This is used to allow multiple different sources to modify a value. For example, a character's strength is partially inherent and is possibly modified by their race and levels in particular classes. This class defines the interface by which all of these can be made aware of each other with minimal boilerplate. To manage this, a character will be an aggregator and have its own `strength` attribute (i.e. the inherent part of its strength) and will add to this value any attribute that also defines a `strength` attribute. In this way, a class and a race that both define `strength` will be added to the strength present on the character yielding a total for that ability score. """ def __init_subclass__(cls, ignore: Optional[AbstractSet[str]] = None) -> None: """Setup attributes to access directly.""" super().__init_subclass__() if ignore is None: cls._ignore: Set[str] = set() else: cls._ignore = set(ignore) cls._instance_names: Set[str] = {k for k, v in vars(cls).items() if isinstance(v, property)} def __init__(self) -> None: """Initialize attribute name tracker.""" super().__init__() self._instance_names = copy(self._instance_names) def __setattr__(self, name: str, value: Any) -> None: """Track any attributes that are added to an instance.""" if _is_public(name) and name not in self._known_names: self._instance_names.add(name) super().__setattr__(name, value) def __getattribute__(self, name: str) -> Any: """Aggregate value from each attribute if allowed.""" if _is_private(name) or name in super().__getattribute__('_ignore'): result = super().__getattribute__(name) else: values = [] try: values.append(super().__getattribute__(name)) except AttributeError: pass for name_other in super().__getattribute__('_instance_names'): if name_other != name: attribute = super().__getattribute__(name_other) if hasattr(attribute, name): values.append(getattr(attribute, name)) if values: result = reduce(add, values) else: raise AttributeError(f'The desired attribute {name} could not' f' be found') try: result = result.dereference(self) except (AttributeError, TypeError): pass return result def __delattr__(self, name: str) -> None: """Remove deleted attributes from tracker.""" super().__delattr__(name) self._instance_names.remove(name) @property def _known_names(self) -> Set[str]: """Return all known names.""" return self._ignore | self._instance_names
0.89785
0.333693
import typing from .error import fatalError, warnOrError class Named: def __init__( self, name: str, context: "Named" = None, private: bool = False, inner: bool = False ): self._name: str = name sep = "$" if inner else "." self._longname: str = ( f"{context.longname}{sep}{name}" if context is not None else self._name ) self._private: bool = private or inner @property def name(self) -> str: return self._name @property def longname(self) -> str: return self._longname @property def llvm_name(self) -> str: prefix = "_priv$" if self._private else "" return f"{prefix}{self._longname}" @property def llvm_value(self) -> str: pass def extend(self, name: str) -> str: return f"{self._longname}.{name}" @property def qualified(self) -> bool: return self._longname.count(".") > 0 def defined_at(self): pass def type(self): pass class Value(Named): pass class Constant(Named): pass class Scope: def __init__(self, parent: typing.Optional["Scope"] = None, share_temps: bool = True): self._parent: typing.Optional["Scope"] = parent self._values: typing.Dict[str, Named] = {} self._share_temps: bool = share_temps self._tmpname: int = 0 @property def next_tmp(self) -> int: tmp = self._tmpname self._tmpname += 1 return tmp def llvm_temp(self) -> str: if self._share_temps and self._parent: return self._parent.llvm_temp() return f"%{self.next_tmp}" def exists(self, name: str) -> bool: if name in self._values: return True if self._parent is None: return False return self._parent.exists(name) def get(self, name: str, usage) -> Named: if name in self._values: return self._values[name] if self._parent is None: fatalError("Unknown symbol", name=name, used=usage) return self._parent.get(name, usage) def add(self, item: Named): if item.name in self._values: fatalError( "redefined value", name=item.name, new_def=item.defined_at(), defined=self._values[item.name].defined_at(), ) if self._parent and self._parent.exists(item.name): warnOrError( "shadowing existing name", name=item.name, new_def=item.defined_at(), defined=self.get(item.name, None).defined_at(), ) self._values[item.name] = item
bareAST/bare/scope.py
import typing from .error import fatalError, warnOrError class Named: def __init__( self, name: str, context: "Named" = None, private: bool = False, inner: bool = False ): self._name: str = name sep = "$" if inner else "." self._longname: str = ( f"{context.longname}{sep}{name}" if context is not None else self._name ) self._private: bool = private or inner @property def name(self) -> str: return self._name @property def longname(self) -> str: return self._longname @property def llvm_name(self) -> str: prefix = "_priv$" if self._private else "" return f"{prefix}{self._longname}" @property def llvm_value(self) -> str: pass def extend(self, name: str) -> str: return f"{self._longname}.{name}" @property def qualified(self) -> bool: return self._longname.count(".") > 0 def defined_at(self): pass def type(self): pass class Value(Named): pass class Constant(Named): pass class Scope: def __init__(self, parent: typing.Optional["Scope"] = None, share_temps: bool = True): self._parent: typing.Optional["Scope"] = parent self._values: typing.Dict[str, Named] = {} self._share_temps: bool = share_temps self._tmpname: int = 0 @property def next_tmp(self) -> int: tmp = self._tmpname self._tmpname += 1 return tmp def llvm_temp(self) -> str: if self._share_temps and self._parent: return self._parent.llvm_temp() return f"%{self.next_tmp}" def exists(self, name: str) -> bool: if name in self._values: return True if self._parent is None: return False return self._parent.exists(name) def get(self, name: str, usage) -> Named: if name in self._values: return self._values[name] if self._parent is None: fatalError("Unknown symbol", name=name, used=usage) return self._parent.get(name, usage) def add(self, item: Named): if item.name in self._values: fatalError( "redefined value", name=item.name, new_def=item.defined_at(), defined=self._values[item.name].defined_at(), ) if self._parent and self._parent.exists(item.name): warnOrError( "shadowing existing name", name=item.name, new_def=item.defined_at(), defined=self.get(item.name, None).defined_at(), ) self._values[item.name] = item
0.635109
0.19789
import calc_postion import datetime import backend import json import io from baselib import error_print from flask import Flask, render_template, make_response from flask import request from flask_restful import reqparse, abort, Api, Resource app = Flask(__name__) api_loader = Api(app) parser = reqparse.RequestParser() for pa in ['la1', 'lo1', 'd1', 'la2', 'lo2', 'd2', 'la3', 'lo3', 'd3', 'EP', 'data', 'name', 'id', 'task', 'start', 'end', 'tunit', 'count', 'device', 'action', 'latitude', 'longitude', 'sign', 'gender', 'country', 'province', 'city', 'ocount', 'pcount', ]: parser.add_argument(pa) def html_template(page): args = parser.parse_args() args['name_js'] = page + '.js' args['name_css'] = page + '.css' return render_template('points_template.html', **args) def html(page): args = parser.parse_args() args['name_js'] = page + '.js' args['name_css'] = page + '.css' if not args["id"]: args["id"] = '' return render_template('template_html.html', **args) ## For debug show demo page @app.route('/demo', methods=['GET']) def demo(): return html("demo") ## Show calc points page @app.route('/cpoints', methods=['GET']) def cpoints(): return html_template("cpoints") ## Show calc points page @app.route('/opoints', methods=['GET']) def opoints(): return html_template("opoints") ## Show near points page @app.route('/npoints', methods=['GET']) def npoints(): return html_template("npoints") ## Show device points page @app.route('/dpoints', methods=['GET']) def dpoints(): return html_template("dpoints") @app.route('/name', methods=['GET']) def js_page(): return html("name") @app.route('/calc', methods=['GET']) def calc(): args = parser.parse_args() try: la1 = float(args['la1']) lo1 = float(args['lo1']) d1 = float(args['d1']) la2 = float(args['la2']) lo2 = float(args['lo2']) d2 = float(args['d2']) la3 = float(args['la3']) lo3 = float(args['lo3']) d3 = float(args['d3']) EP = 100 if args['EP']: EP = float(args['EP']) if not EP: EP = 100 r = calc_postion.calc(la1, lo1, d1, la2, lo2, d2, la3, lo3, d3, EP) if not r: return '{"success": 0}' # calc return '{{"success": 1, "la":{0}, "lo":{1}, "dis":{2} }}'.format( r[0], r[1], r[2] ) except Exception as e: return '{"success": 0}' @app.route("/upload", methods=['GET', 'POST']) def upload(): args = parser.parse_args() try: if 'data' not in args or not args['data']: return '{"success": 0}' if backend.unique_push_data(args['data']): return '{"success": 1}' except Exception as e: print("{0} {1}".format(__name__, e)) pass return '{"success": 0}' @app.route("/show", methods=['GET', 'POST']) def show(): args = parser.parse_args() try: ret = backend.unique_show_search(args) if ret: data = { "success": 1, "data": ret} ret = json.dumps(data, indent= None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/result", methods=['GET', 'POST']) def result(): args = parser.parse_args() if 'id' not in args or not args['id']: return '{"success": 0}' try: ret = backend.unique_check_and_calc(args['id'], args['start'], args['end'], args['tunit']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) pass return '{"success": 0}' @app.route("/near", methods=['GET', 'POST']) def near(): args = parser.parse_args() try: latitude = float(args['latitude']) longitude = float(args['longitude']) count = int(args['count']) if not count: count = 20 if latitude and longitude: ret = backend.unique_NearPoint(latitude,longitude, count) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/origin", methods=['GET', 'POST']) def origin(): args = parser.parse_args() if 'id' not in args or not args['id']: return '{"success": 0}' try: ret = backend.unique_origin_points(args['id'], args['start'], args['end']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/device", methods=['GET', 'POST']) def device(): args = parser.parse_args() a = 'get' task = "node" if args['action']: a = args['action'].lower() if args['task'] and len(args['task']): task = args['task'] if a == 'setall': ret = backend.unique_setall_device(task, args['data']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret return '{"success": 0}' if a == 'getall': ret = backend.unique_get_device_all(task) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret if not args['device']: return '{"success": 0}' if a == 'set' and args['latitude'] and args['longitude']: if backend.unique_set_device(task, args['device'], float(args['latitude']), float(args['longitude'])): return '{"success": 1}' elif a == 'delete': if backend.unique_delete_device(task, args['device']): return '{"success": 1}' else: ret = backend.unique_get_device(task, args['device']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret return '{"success": 0}' @app.route("/becareful", methods=['GET', 'POST']) def becareful(): args = parser.parse_args() action = args["action"] name = args["name"] i = args["id"] if name != "IknowPasswoRd" or i != "RisIngRiRi": return '{"success": 0}' if action not in ["users", "device", "points"]: return '{"success": 0}' ret = backend.unique_delete_information(action) if ret: return '{"success": 1}' return '{"success": 0}' #main enter global_main_enter = {} for key in ["cpoints", "opoints", "npoints", "dpoints"]: global_main_enter[key] = html_template for key in ["demo", "name"]: global_main_enter[key] = html global_main_enter["calc"] = calc ## Show Main page @app.route('/', methods=['GET']) def index(): return html_template("index") @app.route("/<action>", methods=['GET', 'POST']) def enter(action): try: action = action.lower() except Exception as e: error_print(e) abort(404) return if action not in global_main_enter: abort(404) return function = global_main_enter[action] return function(action)
gpsmap/work_app.py
import calc_postion import datetime import backend import json import io from baselib import error_print from flask import Flask, render_template, make_response from flask import request from flask_restful import reqparse, abort, Api, Resource app = Flask(__name__) api_loader = Api(app) parser = reqparse.RequestParser() for pa in ['la1', 'lo1', 'd1', 'la2', 'lo2', 'd2', 'la3', 'lo3', 'd3', 'EP', 'data', 'name', 'id', 'task', 'start', 'end', 'tunit', 'count', 'device', 'action', 'latitude', 'longitude', 'sign', 'gender', 'country', 'province', 'city', 'ocount', 'pcount', ]: parser.add_argument(pa) def html_template(page): args = parser.parse_args() args['name_js'] = page + '.js' args['name_css'] = page + '.css' return render_template('points_template.html', **args) def html(page): args = parser.parse_args() args['name_js'] = page + '.js' args['name_css'] = page + '.css' if not args["id"]: args["id"] = '' return render_template('template_html.html', **args) ## For debug show demo page @app.route('/demo', methods=['GET']) def demo(): return html("demo") ## Show calc points page @app.route('/cpoints', methods=['GET']) def cpoints(): return html_template("cpoints") ## Show calc points page @app.route('/opoints', methods=['GET']) def opoints(): return html_template("opoints") ## Show near points page @app.route('/npoints', methods=['GET']) def npoints(): return html_template("npoints") ## Show device points page @app.route('/dpoints', methods=['GET']) def dpoints(): return html_template("dpoints") @app.route('/name', methods=['GET']) def js_page(): return html("name") @app.route('/calc', methods=['GET']) def calc(): args = parser.parse_args() try: la1 = float(args['la1']) lo1 = float(args['lo1']) d1 = float(args['d1']) la2 = float(args['la2']) lo2 = float(args['lo2']) d2 = float(args['d2']) la3 = float(args['la3']) lo3 = float(args['lo3']) d3 = float(args['d3']) EP = 100 if args['EP']: EP = float(args['EP']) if not EP: EP = 100 r = calc_postion.calc(la1, lo1, d1, la2, lo2, d2, la3, lo3, d3, EP) if not r: return '{"success": 0}' # calc return '{{"success": 1, "la":{0}, "lo":{1}, "dis":{2} }}'.format( r[0], r[1], r[2] ) except Exception as e: return '{"success": 0}' @app.route("/upload", methods=['GET', 'POST']) def upload(): args = parser.parse_args() try: if 'data' not in args or not args['data']: return '{"success": 0}' if backend.unique_push_data(args['data']): return '{"success": 1}' except Exception as e: print("{0} {1}".format(__name__, e)) pass return '{"success": 0}' @app.route("/show", methods=['GET', 'POST']) def show(): args = parser.parse_args() try: ret = backend.unique_show_search(args) if ret: data = { "success": 1, "data": ret} ret = json.dumps(data, indent= None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/result", methods=['GET', 'POST']) def result(): args = parser.parse_args() if 'id' not in args or not args['id']: return '{"success": 0}' try: ret = backend.unique_check_and_calc(args['id'], args['start'], args['end'], args['tunit']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) pass return '{"success": 0}' @app.route("/near", methods=['GET', 'POST']) def near(): args = parser.parse_args() try: latitude = float(args['latitude']) longitude = float(args['longitude']) count = int(args['count']) if not count: count = 20 if latitude and longitude: ret = backend.unique_NearPoint(latitude,longitude, count) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/origin", methods=['GET', 'POST']) def origin(): args = parser.parse_args() if 'id' not in args or not args['id']: return '{"success": 0}' try: ret = backend.unique_origin_points(args['id'], args['start'], args['end']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret except Exception as e: print("{0} {1}".format(__name__, e)) return '{"success": 0}' @app.route("/device", methods=['GET', 'POST']) def device(): args = parser.parse_args() a = 'get' task = "node" if args['action']: a = args['action'].lower() if args['task'] and len(args['task']): task = args['task'] if a == 'setall': ret = backend.unique_setall_device(task, args['data']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret return '{"success": 0}' if a == 'getall': ret = backend.unique_get_device_all(task) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret if not args['device']: return '{"success": 0}' if a == 'set' and args['latitude'] and args['longitude']: if backend.unique_set_device(task, args['device'], float(args['latitude']), float(args['longitude'])): return '{"success": 1}' elif a == 'delete': if backend.unique_delete_device(task, args['device']): return '{"success": 1}' else: ret = backend.unique_get_device(task, args['device']) if ret: data = {"success": 1, "data": ret} ret = json.dumps(data, indent=None) return ret return '{"success": 0}' @app.route("/becareful", methods=['GET', 'POST']) def becareful(): args = parser.parse_args() action = args["action"] name = args["name"] i = args["id"] if name != "IknowPasswoRd" or i != "RisIngRiRi": return '{"success": 0}' if action not in ["users", "device", "points"]: return '{"success": 0}' ret = backend.unique_delete_information(action) if ret: return '{"success": 1}' return '{"success": 0}' #main enter global_main_enter = {} for key in ["cpoints", "opoints", "npoints", "dpoints"]: global_main_enter[key] = html_template for key in ["demo", "name"]: global_main_enter[key] = html global_main_enter["calc"] = calc ## Show Main page @app.route('/', methods=['GET']) def index(): return html_template("index") @app.route("/<action>", methods=['GET', 'POST']) def enter(action): try: action = action.lower() except Exception as e: error_print(e) abort(404) return if action not in global_main_enter: abort(404) return function = global_main_enter[action] return function(action)
0.243642
0.143638
from functools import partial import time import os import sys import threading import resotolib.proc from typing import List, Dict from .config import add_config from resotolib.config import Config from resotolib.logger import log, setup_logger, add_args as logging_add_args from resotolib.jwt import add_args as jwt_add_args from resotolib.baseplugin import BaseCollectorPlugin, PluginType from resotolib.web import WebServer from resotolib.web.metrics import WebApp from resotolib.utils import log_stats, increase_limits from resotolib.args import ArgumentParser from resotolib.core import add_args as core_add_args, resotocore, wait_for_resotocore from resotolib.core.ca import TLSData from resotolib.core.actions import CoreActions from resotolib.core.tasks import CoreTasks from resotoworker.pluginloader import PluginLoader from resotoworker.collect import collect_and_send from resotoworker.cleanup import cleanup from resotoworker.tag import core_tag_tasks_processor from resotolib.event import ( add_event_listener, Event, EventType, ) # This will be used in main() and shutdown() shutdown_event = threading.Event() collect_event = threading.Event() def main() -> None: setup_logger("resotoworker") # Try to run in a new process group and # ignore if not possible for whatever reason try: os.setpgid(0, 0) except Exception: pass resotolib.proc.parent_pid = os.getpid() arg_parser = ArgumentParser( description="resoto worker", env_args_prefix="RESOTOWORKER_", ) add_args(arg_parser) jwt_add_args(arg_parser) logging_add_args(arg_parser) core_add_args(arg_parser) Config.add_args(arg_parser) TLSData.add_args(arg_parser) # Find resoto Plugins in the resoto.plugins module plugin_loader = PluginLoader() plugin_loader.add_plugin_args(arg_parser) # At this point the CLI, all Plugins as well as the WebServer have # added their args to the arg parser arg_parser.parse_args() try: wait_for_resotocore(resotocore.http_uri) except TimeoutError as e: log.fatal(f"Failed to connect to resotocore: {e}") sys.exit(1) tls_data = None if resotocore.is_secure: tls_data = TLSData( common_name=ArgumentParser.args.subscriber_id, resotocore_uri=resotocore.http_uri, ) tls_data.start() config = Config( ArgumentParser.args.subscriber_id, resotocore_uri=resotocore.http_uri, tls_data=tls_data, ) add_config(config) plugin_loader.add_plugin_config(config) config.load_config() # Handle Ctrl+c and other means of termination/shutdown resotolib.proc.initializer() add_event_listener(EventType.SHUTDOWN, shutdown, blocking=False) # Try to increase nofile and nproc limits increase_limits() web_server_args = {} if tls_data: web_server_args = { "ssl_cert": tls_data.cert_path, "ssl_key": tls_data.key_path, } web_server = WebServer( WebApp(mountpoint=Config.resotoworker.web_path), web_host=Config.resotoworker.web_host, web_port=Config.resotoworker.web_port, **web_server_args, ) web_server.daemon = True web_server.start() core_actions = CoreActions( identifier=f"{ArgumentParser.args.subscriber_id}-collector", resotocore_uri=resotocore.http_uri, resotocore_ws_uri=resotocore.ws_uri, actions={ "collect": { "timeout": Config.resotoworker.timeout, "wait_for_completion": True, }, "cleanup": { "timeout": Config.resotoworker.timeout, "wait_for_completion": True, }, }, message_processor=partial(core_actions_processor, plugin_loader, tls_data), tls_data=tls_data, ) task_queue_filter = {} if len(Config.resotoworker.collector) > 0: task_queue_filter = {"cloud": list(Config.resotoworker.collector)} core_tasks = CoreTasks( identifier=f"{ArgumentParser.args.subscriber_id}-tagger", resotocore_ws_uri=resotocore.ws_uri, tasks=["tag"], task_queue_filter=task_queue_filter, message_processor=core_tag_tasks_processor, tls_data=tls_data, ) core_actions.start() core_tasks.start() for Plugin in plugin_loader.plugins(PluginType.ACTION): try: log.debug(f"Starting action plugin {Plugin}") plugin = Plugin(tls_data=tls_data) plugin.start() except Exception as e: log.exception(f"Caught unhandled persistent Plugin exception {e}") # We wait for the shutdown Event to be set() and then end the program # While doing so we print the list of active threads once per 15 minutes shutdown_event.wait() web_server.shutdown() time.sleep(1) # everything gets 1000ms to shutdown gracefully before we force it resotolib.proc.kill_children(resotolib.proc.SIGTERM, ensure_death=True) log.info("Shutdown complete") os._exit(0) def core_actions_processor( plugin_loader: PluginLoader, tls_data: TLSData, message: Dict ) -> None: collectors: List[BaseCollectorPlugin] = plugin_loader.plugins(PluginType.COLLECTOR) if not isinstance(message, dict): log.error(f"Invalid message: {message}") return kind = message.get("kind") message_type = message.get("message_type") data = message.get("data") log.debug(f"Received message of kind {kind}, type {message_type}, data: {data}") if kind == "action": try: if message_type == "collect": start_time = time.time() collect_and_send(collectors, tls_data=tls_data) run_time = int(time.time() - start_time) log.info(f"Collect ran for {run_time} seconds") elif message_type == "cleanup": start_time = time.time() cleanup(tls_data=tls_data) run_time = int(time.time() - start_time) log.info(f"Cleanup ran for {run_time} seconds") else: raise ValueError(f"Unknown message type {message_type}") except Exception as e: log.exception(f"Failed to {message_type}: {e}") reply_kind = "action_error" else: reply_kind = "action_done" reply_message = { "kind": reply_kind, "message_type": message_type, "data": data, } return reply_message def shutdown(event: Event) -> None: reason = event.data.get("reason") emergency = event.data.get("emergency") if emergency: resotolib.proc.emergency_shutdown(reason) current_pid = os.getpid() if current_pid != resotolib.proc.parent_pid: return if reason is None: reason = "unknown reason" log.info( ( f"Received shut down event {event.event_type}:" f" {reason} - killing all threads and child processes" ) ) shutdown_event.set() # and then end the program def force_shutdown(delay: int = 10) -> None: time.sleep(delay) log_stats() log.error( ( "Some child process or thread timed out during shutdown" " - forcing shutdown completion" ) ) os._exit(0) def add_args(arg_parser: ArgumentParser) -> None: arg_parser.add_argument( "--subscriber-id", help="Unique subscriber ID (default: resoto.worker)", default="resoto.worker", dest="subscriber_id", type=str, ) if __name__ == "__main__": main()
resotoworker/resotoworker/__main__.py
from functools import partial import time import os import sys import threading import resotolib.proc from typing import List, Dict from .config import add_config from resotolib.config import Config from resotolib.logger import log, setup_logger, add_args as logging_add_args from resotolib.jwt import add_args as jwt_add_args from resotolib.baseplugin import BaseCollectorPlugin, PluginType from resotolib.web import WebServer from resotolib.web.metrics import WebApp from resotolib.utils import log_stats, increase_limits from resotolib.args import ArgumentParser from resotolib.core import add_args as core_add_args, resotocore, wait_for_resotocore from resotolib.core.ca import TLSData from resotolib.core.actions import CoreActions from resotolib.core.tasks import CoreTasks from resotoworker.pluginloader import PluginLoader from resotoworker.collect import collect_and_send from resotoworker.cleanup import cleanup from resotoworker.tag import core_tag_tasks_processor from resotolib.event import ( add_event_listener, Event, EventType, ) # This will be used in main() and shutdown() shutdown_event = threading.Event() collect_event = threading.Event() def main() -> None: setup_logger("resotoworker") # Try to run in a new process group and # ignore if not possible for whatever reason try: os.setpgid(0, 0) except Exception: pass resotolib.proc.parent_pid = os.getpid() arg_parser = ArgumentParser( description="resoto worker", env_args_prefix="RESOTOWORKER_", ) add_args(arg_parser) jwt_add_args(arg_parser) logging_add_args(arg_parser) core_add_args(arg_parser) Config.add_args(arg_parser) TLSData.add_args(arg_parser) # Find resoto Plugins in the resoto.plugins module plugin_loader = PluginLoader() plugin_loader.add_plugin_args(arg_parser) # At this point the CLI, all Plugins as well as the WebServer have # added their args to the arg parser arg_parser.parse_args() try: wait_for_resotocore(resotocore.http_uri) except TimeoutError as e: log.fatal(f"Failed to connect to resotocore: {e}") sys.exit(1) tls_data = None if resotocore.is_secure: tls_data = TLSData( common_name=ArgumentParser.args.subscriber_id, resotocore_uri=resotocore.http_uri, ) tls_data.start() config = Config( ArgumentParser.args.subscriber_id, resotocore_uri=resotocore.http_uri, tls_data=tls_data, ) add_config(config) plugin_loader.add_plugin_config(config) config.load_config() # Handle Ctrl+c and other means of termination/shutdown resotolib.proc.initializer() add_event_listener(EventType.SHUTDOWN, shutdown, blocking=False) # Try to increase nofile and nproc limits increase_limits() web_server_args = {} if tls_data: web_server_args = { "ssl_cert": tls_data.cert_path, "ssl_key": tls_data.key_path, } web_server = WebServer( WebApp(mountpoint=Config.resotoworker.web_path), web_host=Config.resotoworker.web_host, web_port=Config.resotoworker.web_port, **web_server_args, ) web_server.daemon = True web_server.start() core_actions = CoreActions( identifier=f"{ArgumentParser.args.subscriber_id}-collector", resotocore_uri=resotocore.http_uri, resotocore_ws_uri=resotocore.ws_uri, actions={ "collect": { "timeout": Config.resotoworker.timeout, "wait_for_completion": True, }, "cleanup": { "timeout": Config.resotoworker.timeout, "wait_for_completion": True, }, }, message_processor=partial(core_actions_processor, plugin_loader, tls_data), tls_data=tls_data, ) task_queue_filter = {} if len(Config.resotoworker.collector) > 0: task_queue_filter = {"cloud": list(Config.resotoworker.collector)} core_tasks = CoreTasks( identifier=f"{ArgumentParser.args.subscriber_id}-tagger", resotocore_ws_uri=resotocore.ws_uri, tasks=["tag"], task_queue_filter=task_queue_filter, message_processor=core_tag_tasks_processor, tls_data=tls_data, ) core_actions.start() core_tasks.start() for Plugin in plugin_loader.plugins(PluginType.ACTION): try: log.debug(f"Starting action plugin {Plugin}") plugin = Plugin(tls_data=tls_data) plugin.start() except Exception as e: log.exception(f"Caught unhandled persistent Plugin exception {e}") # We wait for the shutdown Event to be set() and then end the program # While doing so we print the list of active threads once per 15 minutes shutdown_event.wait() web_server.shutdown() time.sleep(1) # everything gets 1000ms to shutdown gracefully before we force it resotolib.proc.kill_children(resotolib.proc.SIGTERM, ensure_death=True) log.info("Shutdown complete") os._exit(0) def core_actions_processor( plugin_loader: PluginLoader, tls_data: TLSData, message: Dict ) -> None: collectors: List[BaseCollectorPlugin] = plugin_loader.plugins(PluginType.COLLECTOR) if not isinstance(message, dict): log.error(f"Invalid message: {message}") return kind = message.get("kind") message_type = message.get("message_type") data = message.get("data") log.debug(f"Received message of kind {kind}, type {message_type}, data: {data}") if kind == "action": try: if message_type == "collect": start_time = time.time() collect_and_send(collectors, tls_data=tls_data) run_time = int(time.time() - start_time) log.info(f"Collect ran for {run_time} seconds") elif message_type == "cleanup": start_time = time.time() cleanup(tls_data=tls_data) run_time = int(time.time() - start_time) log.info(f"Cleanup ran for {run_time} seconds") else: raise ValueError(f"Unknown message type {message_type}") except Exception as e: log.exception(f"Failed to {message_type}: {e}") reply_kind = "action_error" else: reply_kind = "action_done" reply_message = { "kind": reply_kind, "message_type": message_type, "data": data, } return reply_message def shutdown(event: Event) -> None: reason = event.data.get("reason") emergency = event.data.get("emergency") if emergency: resotolib.proc.emergency_shutdown(reason) current_pid = os.getpid() if current_pid != resotolib.proc.parent_pid: return if reason is None: reason = "unknown reason" log.info( ( f"Received shut down event {event.event_type}:" f" {reason} - killing all threads and child processes" ) ) shutdown_event.set() # and then end the program def force_shutdown(delay: int = 10) -> None: time.sleep(delay) log_stats() log.error( ( "Some child process or thread timed out during shutdown" " - forcing shutdown completion" ) ) os._exit(0) def add_args(arg_parser: ArgumentParser) -> None: arg_parser.add_argument( "--subscriber-id", help="Unique subscriber ID (default: resoto.worker)", default="resoto.worker", dest="subscriber_id", type=str, ) if __name__ == "__main__": main()
0.405802
0.08882
import numpy as np class OneHiddenLayerNN: """ @brief: One hidden layer neural network with batch gradient descent. Currently supporting only relu, tanh and sigmoid activation functions. """ def __init__(self, number_of_neurons, batch_size = 20, hidden_activation='relu', out_activation='sigmoid', epochs=100, learning_rate=0.1): """ :param number_of_neurons: number of neurons in hidden layer. :param batch_size: batch size. :param hidden_activation: hidden layer activation function. :param out_activation: out layer activation function. :param epochs: how many times do gradient descent. :param learning_rate: learning rate. """ self.nn_size = number_of_neurons self.epochs = epochs self.alpha = learning_rate self.W_h = None self.W_out = None self.batch_size = batch_size self.hidden_func = hidden_activation self.out_func = out_activation @staticmethod def __activation(z, func_name): """ :param z: dot(X, W_h). :param func_name: function name to compute. :return: activation_function(z). """ if func_name == 'relu': # relu = max(0, z). return np.maximum(z, 0) elif func_name == 'tanh': # tanh = (e^z - e(-z)) / (e^z + e(-z)). return np.tanh(z) elif func_name == 'sigmoid': # sigmoid = 1 / (1 + e^(-z)). return 1 / (1 + np.exp(-z)) @staticmethod def __d_activation(func_out, func_name): """ :param func_out: dot(prev_layer, W_current). :param func_name: function name to compute. :return: derivative of activation function. """ if func_name == 'relu': # d(relu) = 1 if relu > 0 else 0. func_o_tmp = func_out.copy() func_o_tmp[func_out <= 0] = 0 func_o_tmp[func_out > 0] = 1 return func_o_tmp elif func_name == 'tanh': # d(tanh) = 1 - tanh^2. return 1 - func_out * func_out elif func_name == 'sigmoid': # d(sigmoid) = sigmoid * (1 - sigmoid). return func_out * (1 - func_out) @staticmethod def __loss(a_out, a): """ :param a_out: network output. :param a: desired output. :return: sum of squared difference normalized. """ return np.sum(np.square(a_out - a)) / a.shape[0] def __d_out(self, a_h, a_o, a): """ :param a_h: hidden output. :param a_o: net_out. :param a: desired out. :return: d(Loss) / d(W_out(i, k)) = SUM_i((d(Loss) / d(a_o(i)) * (d(a_o(i)) / d(W_out(i, k)). (d(a_o(i)) / d(W_out(i, k)) != 0 if and only if i == k because of z = SUM(a_h(i) * W_out(j, i) => d(Loss) / d(W_out(i, k)) = (d(Loss) / d(a_o(k)) * (d(a_o(k)) / d(W_out(i, k)) = (2 * (a_o(k) - a(k))) * ((d(activation(z) / d(z)) * (d(z) / d(W_out(i, k))) = (2 * (a_o(k) - a(k))) * a_h(i) * (d(activation(z)) / d(z)) """ d_loss = np.dot(a_h.T, (2.0 * (a_o - a) * self.__d_activation(a_o, self.out_func))) return self.alpha * d_loss / a.shape[0] def _d_hidden(self, X, a_h, a_o, a): """ :param X: input. :param a_h: hidden output. :param a_o: net_out. :param a: desired out. :return: d(Loss) / d(W_h(i, k)) = SUM_p((d(Loss) / d(a_o(p))) * SUM_j((d(a_o(p)) / d(a_h(j)) * (d(a_h(j)) / d(W_h(i, k)))) = SUM_p((d(Loss) / d(a_o(p))) * (d(a_o(p)) / d(a_h(k)) * (d(a_h(k)) / d(W_h(i, k))) d(Loss) / d(a_o(p)) = 2 * (a_o(p) - a(p)) d(a_o(p)) / d(a_h(k)) = ((d(activation_out(z) / d(z)) * W_out(k, p) where z = a_o(p) d(a_h(k)) / d(W_h(i, k)) = X(i) * (d(activation_hidden(z)) / d(z)) where z = a_h(k) """ # W_out[1:] because first row is bias. d_loss = np.dot(X.T, np.dot(2.0 * (a_o - a) * self.__d_activation(a_o, self.out_func), self.W_out[1:].T) * self.__d_activation(a_h, self.hidden_func)) return self.alpha * d_loss / a.shape[0] @staticmethod def __add_bias(X): """ :param X: input. :return: concatenate ones to input to get bias term. """ bias = np.ones((X.shape[0], 1)) return np.concatenate((bias, X), axis=1) def __forward_backward_prop(self, X, y): """ :param X: input. :param y: ground truth. :return: updated weights. """ # multiply input by weights. z_h = np.dot(X, self.W_h) # apply activation function. a_h = self.__activation(z_h, self.hidden_func) # add 1 to hidden layer to get bias term. a_h_b = self.__add_bias(a_h) # multiply previous layer output by weights of current layer. z_o = np.dot(a_h_b, self.W_out) # apply activation function. a_o = self.__activation(z_o, self.out_func) # calculate derivatives. d_out = self.__d_out(a_h_b, a_o, y) d_hidden = self._d_hidden(X, a_h, a_o, y) # update weights using calculated gradients. self.W_out -= d_out self.W_h -= d_hidden def fit(self, X, y): """ :param X: input. shape = (number_of_examples, features). :param y: output. shape = (number_of_examples, classes). """ # add 1 to input layer to get bias term. X = self.__add_bias(X) # multiplying by sqrt(2.0 / input_shape_size) for vanishing exploding gradients. (<NAME>. deep learning course). # put bias in weights. self.W_h = np.random.randn(X.shape[1], self.nn_size) * np.sqrt(2.0 / X.shape[1]) self.W_out = np.random.randn(self.nn_size + 1, y.shape[1]) * np.sqrt(2.0 / (self.nn_size + 1)) batch_iters = int(X.shape[0] / self.batch_size) batch_rem = X.shape[0] - self.batch_size * batch_iters for i in range(self.epochs): # update weights in every batch. for j in range(batch_iters): x_batch = X[j * self.batch_size : (j + 1) * self.batch_size, :] y_batch = y[j * self.batch_size : (j + 1) * self.batch_size, :] self.__forward_backward_prop(x_batch, y_batch) x_batch = X[-batch_rem:] y_batch = y[-batch_rem:] self.__forward_backward_prop(x_batch, y_batch) # print loss in end of epoch. if i % 100 == 0: a_o = self.predict_prob(X) print("Loss = " + str(self.__loss(a_o, y))) def predict_prob(self, X): """ :param X: input to predict. :return: output vector of probabilities. """ z_h = np.dot(X, self.W_h) a_h = self.__activation(z_h, self.hidden_func) a_h_b = self.__add_bias(a_h) z_o = np.dot(a_h_b, self.W_out) a_o = self.__activation(z_o, self.out_func) return a_o def predict(self, X): """ :param X: input to predict. :return: class that has max probability. """ a_o = self.predict_prob(X) max_value = max(a_o) max_index = np.where(max_value == a_o)[0] print("Max probability is class " + str(max_index) + " with probability " + str(max_value))
one_hidden_layer_nn.py
import numpy as np class OneHiddenLayerNN: """ @brief: One hidden layer neural network with batch gradient descent. Currently supporting only relu, tanh and sigmoid activation functions. """ def __init__(self, number_of_neurons, batch_size = 20, hidden_activation='relu', out_activation='sigmoid', epochs=100, learning_rate=0.1): """ :param number_of_neurons: number of neurons in hidden layer. :param batch_size: batch size. :param hidden_activation: hidden layer activation function. :param out_activation: out layer activation function. :param epochs: how many times do gradient descent. :param learning_rate: learning rate. """ self.nn_size = number_of_neurons self.epochs = epochs self.alpha = learning_rate self.W_h = None self.W_out = None self.batch_size = batch_size self.hidden_func = hidden_activation self.out_func = out_activation @staticmethod def __activation(z, func_name): """ :param z: dot(X, W_h). :param func_name: function name to compute. :return: activation_function(z). """ if func_name == 'relu': # relu = max(0, z). return np.maximum(z, 0) elif func_name == 'tanh': # tanh = (e^z - e(-z)) / (e^z + e(-z)). return np.tanh(z) elif func_name == 'sigmoid': # sigmoid = 1 / (1 + e^(-z)). return 1 / (1 + np.exp(-z)) @staticmethod def __d_activation(func_out, func_name): """ :param func_out: dot(prev_layer, W_current). :param func_name: function name to compute. :return: derivative of activation function. """ if func_name == 'relu': # d(relu) = 1 if relu > 0 else 0. func_o_tmp = func_out.copy() func_o_tmp[func_out <= 0] = 0 func_o_tmp[func_out > 0] = 1 return func_o_tmp elif func_name == 'tanh': # d(tanh) = 1 - tanh^2. return 1 - func_out * func_out elif func_name == 'sigmoid': # d(sigmoid) = sigmoid * (1 - sigmoid). return func_out * (1 - func_out) @staticmethod def __loss(a_out, a): """ :param a_out: network output. :param a: desired output. :return: sum of squared difference normalized. """ return np.sum(np.square(a_out - a)) / a.shape[0] def __d_out(self, a_h, a_o, a): """ :param a_h: hidden output. :param a_o: net_out. :param a: desired out. :return: d(Loss) / d(W_out(i, k)) = SUM_i((d(Loss) / d(a_o(i)) * (d(a_o(i)) / d(W_out(i, k)). (d(a_o(i)) / d(W_out(i, k)) != 0 if and only if i == k because of z = SUM(a_h(i) * W_out(j, i) => d(Loss) / d(W_out(i, k)) = (d(Loss) / d(a_o(k)) * (d(a_o(k)) / d(W_out(i, k)) = (2 * (a_o(k) - a(k))) * ((d(activation(z) / d(z)) * (d(z) / d(W_out(i, k))) = (2 * (a_o(k) - a(k))) * a_h(i) * (d(activation(z)) / d(z)) """ d_loss = np.dot(a_h.T, (2.0 * (a_o - a) * self.__d_activation(a_o, self.out_func))) return self.alpha * d_loss / a.shape[0] def _d_hidden(self, X, a_h, a_o, a): """ :param X: input. :param a_h: hidden output. :param a_o: net_out. :param a: desired out. :return: d(Loss) / d(W_h(i, k)) = SUM_p((d(Loss) / d(a_o(p))) * SUM_j((d(a_o(p)) / d(a_h(j)) * (d(a_h(j)) / d(W_h(i, k)))) = SUM_p((d(Loss) / d(a_o(p))) * (d(a_o(p)) / d(a_h(k)) * (d(a_h(k)) / d(W_h(i, k))) d(Loss) / d(a_o(p)) = 2 * (a_o(p) - a(p)) d(a_o(p)) / d(a_h(k)) = ((d(activation_out(z) / d(z)) * W_out(k, p) where z = a_o(p) d(a_h(k)) / d(W_h(i, k)) = X(i) * (d(activation_hidden(z)) / d(z)) where z = a_h(k) """ # W_out[1:] because first row is bias. d_loss = np.dot(X.T, np.dot(2.0 * (a_o - a) * self.__d_activation(a_o, self.out_func), self.W_out[1:].T) * self.__d_activation(a_h, self.hidden_func)) return self.alpha * d_loss / a.shape[0] @staticmethod def __add_bias(X): """ :param X: input. :return: concatenate ones to input to get bias term. """ bias = np.ones((X.shape[0], 1)) return np.concatenate((bias, X), axis=1) def __forward_backward_prop(self, X, y): """ :param X: input. :param y: ground truth. :return: updated weights. """ # multiply input by weights. z_h = np.dot(X, self.W_h) # apply activation function. a_h = self.__activation(z_h, self.hidden_func) # add 1 to hidden layer to get bias term. a_h_b = self.__add_bias(a_h) # multiply previous layer output by weights of current layer. z_o = np.dot(a_h_b, self.W_out) # apply activation function. a_o = self.__activation(z_o, self.out_func) # calculate derivatives. d_out = self.__d_out(a_h_b, a_o, y) d_hidden = self._d_hidden(X, a_h, a_o, y) # update weights using calculated gradients. self.W_out -= d_out self.W_h -= d_hidden def fit(self, X, y): """ :param X: input. shape = (number_of_examples, features). :param y: output. shape = (number_of_examples, classes). """ # add 1 to input layer to get bias term. X = self.__add_bias(X) # multiplying by sqrt(2.0 / input_shape_size) for vanishing exploding gradients. (<NAME>. deep learning course). # put bias in weights. self.W_h = np.random.randn(X.shape[1], self.nn_size) * np.sqrt(2.0 / X.shape[1]) self.W_out = np.random.randn(self.nn_size + 1, y.shape[1]) * np.sqrt(2.0 / (self.nn_size + 1)) batch_iters = int(X.shape[0] / self.batch_size) batch_rem = X.shape[0] - self.batch_size * batch_iters for i in range(self.epochs): # update weights in every batch. for j in range(batch_iters): x_batch = X[j * self.batch_size : (j + 1) * self.batch_size, :] y_batch = y[j * self.batch_size : (j + 1) * self.batch_size, :] self.__forward_backward_prop(x_batch, y_batch) x_batch = X[-batch_rem:] y_batch = y[-batch_rem:] self.__forward_backward_prop(x_batch, y_batch) # print loss in end of epoch. if i % 100 == 0: a_o = self.predict_prob(X) print("Loss = " + str(self.__loss(a_o, y))) def predict_prob(self, X): """ :param X: input to predict. :return: output vector of probabilities. """ z_h = np.dot(X, self.W_h) a_h = self.__activation(z_h, self.hidden_func) a_h_b = self.__add_bias(a_h) z_o = np.dot(a_h_b, self.W_out) a_o = self.__activation(z_o, self.out_func) return a_o def predict(self, X): """ :param X: input to predict. :return: class that has max probability. """ a_o = self.predict_prob(X) max_value = max(a_o) max_index = np.where(max_value == a_o)[0] print("Max probability is class " + str(max_index) + " with probability " + str(max_value))
0.883513
0.687918
import time import os import psycopg2 import csv import pandas as pd import re import tweepy import json from datetime import timedelta from datetime import datetime from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from collections import defaultdict def twitter_str_to_dt(dt_str): return datetime.strptime(dt_str, "%a %b %d %H:%M:%S +0000 %Y") def open_tweepy_api(twitter_c_key=None, twitter_c_key_secret=None, twitter_a_key=None, twitter_a_key_secret=None, credentials=None): # This is a little stupid. if credentials: creds = {} for line in open(credentials).readlines(): key, value = line.strip().split("=") creds[key] = value twitter_c_key = creds['twitter_c_key'] twitter_c_key_secret = creds['twitter_c_key_secret'] twitter_a_key = creds['twitter_a_key'] twitter_a_key_secret = creds['twitter_a_key_secret'] #authorize twitter, initialize tweepy auth = tweepy.OAuthHandler(twitter_c_key, twitter_c_key_secret) auth.set_access_token(twitter_a_key, twitter_a_key_secret) api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) return api def open_database(database_name, db_config_file, overwrite_db=False, owner='example', admins=[], named_cursor=None, itersize=None,): # Parse the database credentials out of the file database_config = {"database": database_name} for line in open(db_config_file).readlines(): key, value = line.strip().split("=") database_config[key] = value # cursor.execute("select * from information_schema.tables where table_name=%s", ('mytable',)) if overwrite_db: create_statement = """CREATE DATABASE {db} WITH OWNER = {owner} ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1; """.format(db=database_name, owner=owner) public_permissions = """GRANT TEMPORARY, CONNECT ON DATABASE {db} TO PUBLIC;""".format(db=database_name) owner_permissions = """GRANT ALL ON DATABASE {db} TO {user};""".format(db=database_name, user=owner) admin_permissions = [] for admin in admins: admin_permissions += ['\nGRANT TEMPORARY ON DATABASE {db} to {user}'.format(db=database_name, user=admin)] all_commands = [create_statement] + [public_permissions] + [owner_permissions] + admin_permissions create_database_config = database_config create_database_config['database'] = 'postgres' database = psycopg2.connect(**database_config) database.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) cursor = database.cursor(cursor_factory=psycopg2.extras.DictCursor) for command in all_commands: cursor.execute(command) database.commit() cursor.close() database.close() # Connect to the database and get a cursor object database = psycopg2.connect(**database_config) cursor = database.cursor(cursor_factory=psycopg2.extras.DictCursor, name=named_cursor) if itersize is not None: cursor.itersize = itersize return database, cursor def get_column_header_dict(input_column_csv): column_header_dict = {} with open(input_column_csv, 'r') as readfile: reader = csv.reader(readfile, delimiter=',') next(reader) # This line skips the header row. for row in reader: column_header_dict[row[0]] = {'type': row[2], 'json_fieldname': row[1], 'clean': row[4], 'instructions': row[5]} if column_header_dict[row[0]]['clean'] == 'TRUE': column_header_dict[row[0]]['clean'] = True else: column_header_dict[row[0]]['clean'] = False return column_header_dict def close_database(cursor, database, commit=True): # Close everything cursor.close() if commit: database.commit() database.close() def clean(s): # Fix bytes/str mixing from earlier in code: if type(s) is bytes: s = s.decode('utf-8') # Replace weird characters that make Postgres unhappy s = s.replace("\x00", "") if s else None # re_pattern = re.compile(u"\u0000", re.UNICODE) # s = re_pattern.sub(u'\u0000', '') # add_item = re.sub(r'(?<!\\)\\(?!["\\/bfnrt]|u[0-9a-fA-F]{4})', r'', add_item) s = re.sub(r'(?<!\\)\\u0000', r'', s) if s else None return s def c(u): # Encode unicode so it plays nice with the string formatting return u.encode('utf8') def get_last_modified(json_file): return os.path.getmtime(json_file) def within_time_bounds(json_file, start_time, end_time): json_modified_time = get_last_modified(json_file) return (json_modified_time >= time.mktime(start_time.timetuple())) and (json_modified_time <= (time.mktime(end_time.timetuple()) + timedelta(days=1).total_seconds())) def save_to_csv(rows, output_filename, column_headers=None): with open(output_filename, 'w') as outfile: writer = csv.writer(outfile, delimiter=',') if column_headers is None: writer.writerow(rows[0].keys()) else: writer.writerow(column_headers) for item in rows: if column_headers is None: # This might not work if dictionaries don't pull out keys in same order. writer.writerow(item.values()) else: output_row = [item[column] for column in column_headers] writer.writerow(output_row) return def load_from_csv(input_csv, time_columns=[]): with open(input_csv, 'r') as readfile: reader = csv.reader(readfile, delimiter=',') output_dict_list = [] header = next(reader) for row in reader: output_dict = {} for idx, item in enumerate(row): # Time conversion is a little inefficient. But who cares! if header[idx] in time_columns: item = datetime.strptime(item, "%Y-%m-%d %H:%M:%S") output_dict[header[idx]] = item output_dict_list += [output_dict] return output_dict_list def list_on_key(dict_list, key): """ Is there a one-liner for this? """ return_list = [] for sub_dict in dict_list: return_list += [sub_dict[key]] return return_list def extract_entity_to_column(): return def to_list_of_dicts(cursor): results = cursor.fetchall() dict_result = [] for row in results: dict_result.append(dict(row)) return dict_result def to_pandas(cursor, dtype=None): results = cursor.fetchall() column_headers = list(results[0].keys()) if not dtype: data_frame = pd.DataFrame(results) else: new_results = [] for result in results: new_results += [[str(x) if x else None for x in result]] data_frame = pd.DataFrame(new_results, dtype='str') data_frame.columns = column_headers return data_frame def sort_json(input_file, output_file=None, reverse=False, key='created_at', format=None): if output_file is None: output_file = input_file with open(input_file, "r") as f: json_dict = json.load(f) if key == 'created_at': json_dict.sort(reverse=reverse, key=lambda t: twitter_str_to_dt(t[key])) else: json_dict.sort(reverse=reverse, key=lambda t: t[key]) with open(output_file, 'w') as f: json.dump(json_dict, f) return def write_json(input_file, output_file=None): return def format_json(input_file, output_file=None, json_format='newlines'): if output_file is None: output_file = input_file with open(input_file, "r") as f: json_dict = json.load(f) if json_format == 'newlines': with open(output_file, "w") as openfile: openfile.write("[\n") for idx, tweet in enumerate(json_dict): json.dump(tweet, openfile) if idx == len(json_dict) - 1: openfile.write('\n') else: openfile.write(",\n") openfile.write("]") return def sample_json_to_csv(input_directories, number, keys): return def int_dict(): return defaultdict(int) def set_dict(): return defaultdict(set) def dict_dict(): return defaultdict(dict) def list_dict(): return defaultdict(dict) def sql_type_dictionary(): """ Return a dictionary of PSQL types for typical column names in Twitter2SQL databases. """ type_dict = {'user_id': 'bigint', 'tweet': 'TEXT', 'user_name': 'TEXT', 'user_screen_name': 'TEXT', 'in_reply_to_status_id': 'bigint', 'created_at': 'timestamptz', 'in_reply_to_user_screen_name': 'TEXT', 'in_reply_to_user_id': 'bigint'} return type_dict
twitter2sql/core/util.py
import time import os import psycopg2 import csv import pandas as pd import re import tweepy import json from datetime import timedelta from datetime import datetime from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from collections import defaultdict def twitter_str_to_dt(dt_str): return datetime.strptime(dt_str, "%a %b %d %H:%M:%S +0000 %Y") def open_tweepy_api(twitter_c_key=None, twitter_c_key_secret=None, twitter_a_key=None, twitter_a_key_secret=None, credentials=None): # This is a little stupid. if credentials: creds = {} for line in open(credentials).readlines(): key, value = line.strip().split("=") creds[key] = value twitter_c_key = creds['twitter_c_key'] twitter_c_key_secret = creds['twitter_c_key_secret'] twitter_a_key = creds['twitter_a_key'] twitter_a_key_secret = creds['twitter_a_key_secret'] #authorize twitter, initialize tweepy auth = tweepy.OAuthHandler(twitter_c_key, twitter_c_key_secret) auth.set_access_token(twitter_a_key, twitter_a_key_secret) api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) return api def open_database(database_name, db_config_file, overwrite_db=False, owner='example', admins=[], named_cursor=None, itersize=None,): # Parse the database credentials out of the file database_config = {"database": database_name} for line in open(db_config_file).readlines(): key, value = line.strip().split("=") database_config[key] = value # cursor.execute("select * from information_schema.tables where table_name=%s", ('mytable',)) if overwrite_db: create_statement = """CREATE DATABASE {db} WITH OWNER = {owner} ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1; """.format(db=database_name, owner=owner) public_permissions = """GRANT TEMPORARY, CONNECT ON DATABASE {db} TO PUBLIC;""".format(db=database_name) owner_permissions = """GRANT ALL ON DATABASE {db} TO {user};""".format(db=database_name, user=owner) admin_permissions = [] for admin in admins: admin_permissions += ['\nGRANT TEMPORARY ON DATABASE {db} to {user}'.format(db=database_name, user=admin)] all_commands = [create_statement] + [public_permissions] + [owner_permissions] + admin_permissions create_database_config = database_config create_database_config['database'] = 'postgres' database = psycopg2.connect(**database_config) database.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) cursor = database.cursor(cursor_factory=psycopg2.extras.DictCursor) for command in all_commands: cursor.execute(command) database.commit() cursor.close() database.close() # Connect to the database and get a cursor object database = psycopg2.connect(**database_config) cursor = database.cursor(cursor_factory=psycopg2.extras.DictCursor, name=named_cursor) if itersize is not None: cursor.itersize = itersize return database, cursor def get_column_header_dict(input_column_csv): column_header_dict = {} with open(input_column_csv, 'r') as readfile: reader = csv.reader(readfile, delimiter=',') next(reader) # This line skips the header row. for row in reader: column_header_dict[row[0]] = {'type': row[2], 'json_fieldname': row[1], 'clean': row[4], 'instructions': row[5]} if column_header_dict[row[0]]['clean'] == 'TRUE': column_header_dict[row[0]]['clean'] = True else: column_header_dict[row[0]]['clean'] = False return column_header_dict def close_database(cursor, database, commit=True): # Close everything cursor.close() if commit: database.commit() database.close() def clean(s): # Fix bytes/str mixing from earlier in code: if type(s) is bytes: s = s.decode('utf-8') # Replace weird characters that make Postgres unhappy s = s.replace("\x00", "") if s else None # re_pattern = re.compile(u"\u0000", re.UNICODE) # s = re_pattern.sub(u'\u0000', '') # add_item = re.sub(r'(?<!\\)\\(?!["\\/bfnrt]|u[0-9a-fA-F]{4})', r'', add_item) s = re.sub(r'(?<!\\)\\u0000', r'', s) if s else None return s def c(u): # Encode unicode so it plays nice with the string formatting return u.encode('utf8') def get_last_modified(json_file): return os.path.getmtime(json_file) def within_time_bounds(json_file, start_time, end_time): json_modified_time = get_last_modified(json_file) return (json_modified_time >= time.mktime(start_time.timetuple())) and (json_modified_time <= (time.mktime(end_time.timetuple()) + timedelta(days=1).total_seconds())) def save_to_csv(rows, output_filename, column_headers=None): with open(output_filename, 'w') as outfile: writer = csv.writer(outfile, delimiter=',') if column_headers is None: writer.writerow(rows[0].keys()) else: writer.writerow(column_headers) for item in rows: if column_headers is None: # This might not work if dictionaries don't pull out keys in same order. writer.writerow(item.values()) else: output_row = [item[column] for column in column_headers] writer.writerow(output_row) return def load_from_csv(input_csv, time_columns=[]): with open(input_csv, 'r') as readfile: reader = csv.reader(readfile, delimiter=',') output_dict_list = [] header = next(reader) for row in reader: output_dict = {} for idx, item in enumerate(row): # Time conversion is a little inefficient. But who cares! if header[idx] in time_columns: item = datetime.strptime(item, "%Y-%m-%d %H:%M:%S") output_dict[header[idx]] = item output_dict_list += [output_dict] return output_dict_list def list_on_key(dict_list, key): """ Is there a one-liner for this? """ return_list = [] for sub_dict in dict_list: return_list += [sub_dict[key]] return return_list def extract_entity_to_column(): return def to_list_of_dicts(cursor): results = cursor.fetchall() dict_result = [] for row in results: dict_result.append(dict(row)) return dict_result def to_pandas(cursor, dtype=None): results = cursor.fetchall() column_headers = list(results[0].keys()) if not dtype: data_frame = pd.DataFrame(results) else: new_results = [] for result in results: new_results += [[str(x) if x else None for x in result]] data_frame = pd.DataFrame(new_results, dtype='str') data_frame.columns = column_headers return data_frame def sort_json(input_file, output_file=None, reverse=False, key='created_at', format=None): if output_file is None: output_file = input_file with open(input_file, "r") as f: json_dict = json.load(f) if key == 'created_at': json_dict.sort(reverse=reverse, key=lambda t: twitter_str_to_dt(t[key])) else: json_dict.sort(reverse=reverse, key=lambda t: t[key]) with open(output_file, 'w') as f: json.dump(json_dict, f) return def write_json(input_file, output_file=None): return def format_json(input_file, output_file=None, json_format='newlines'): if output_file is None: output_file = input_file with open(input_file, "r") as f: json_dict = json.load(f) if json_format == 'newlines': with open(output_file, "w") as openfile: openfile.write("[\n") for idx, tweet in enumerate(json_dict): json.dump(tweet, openfile) if idx == len(json_dict) - 1: openfile.write('\n') else: openfile.write(",\n") openfile.write("]") return def sample_json_to_csv(input_directories, number, keys): return def int_dict(): return defaultdict(int) def set_dict(): return defaultdict(set) def dict_dict(): return defaultdict(dict) def list_dict(): return defaultdict(dict) def sql_type_dictionary(): """ Return a dictionary of PSQL types for typical column names in Twitter2SQL databases. """ type_dict = {'user_id': 'bigint', 'tweet': 'TEXT', 'user_name': 'TEXT', 'user_screen_name': 'TEXT', 'in_reply_to_status_id': 'bigint', 'created_at': 'timestamptz', 'in_reply_to_user_screen_name': 'TEXT', 'in_reply_to_user_id': 'bigint'} return type_dict
0.299617
0.059811
from fastapi import HTTPException from iso639 import languages import pytest from textblob import TextBlob from app.internal.translation import ( _detect_text_language, _get_language_code, _get_user_language, translate_text, translate_text_for_user ) TEXT = [ ("Привет мой друг", "english", "russian"), ("Hola mi amigo", "english", "spanish"), ("Bonjour, mon ami", "english", "french"), ("Hallo, me<NAME>", "english", "german"), ] @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_original_lang(text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert "Hello my friend" == answer assert TextBlob(text).detect_language() == languages.get( name=original_lang.capitalize()).alpha2 assert TextBlob(answer).detect_language() == languages.get( name=target_lang.capitalize()).alpha2 @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_without_original_lang( text, target_lang, original_lang): answer = translate_text(text, target_lang) assert "Hello my friend" == answer assert TextBlob(answer).detect_language() == languages.get( name=target_lang.capitalize()).alpha2 @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_identical_original_and_target_lang( text, target_lang, original_lang): answer = translate_text(text, original_lang, original_lang) assert answer == text @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_same_original_target_lang_without_original_lang( text, target_lang, original_lang): answer = translate_text(text, original_lang) assert answer == text def test_translate_text_without_text_with_original_target_lang(): answer = translate_text("", "english", "russian") assert answer == "" def test_translate_text_without_text_without_original_lang(): answer = translate_text("", "english") assert answer == "" def test_get_language_code(): answer = _get_language_code("english") assert answer == "en" def test_get_user_language(user, session): user_id = user.id answer = _get_user_language(user_id, session=session) assert user_id == 1 assert answer.lower() == "english" @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_for_valid_user( text, target_lang, original_lang, session, user): user_id = user.id answer = translate_text_for_user(text, session, user_id) assert answer == "Hello my friend" def test_translate_text_for_invalid_user(session, user): user_id = user.id answer = translate_text_for_user("Привет мой друг", session, user_id + 1) assert answer == "Привет мой друг" def test_detect_text_language(): answer = _detect_text_language("Hello my friend") assert answer == "en" @pytest.mark.parametrize("text, target_lang, original_lang", [("Hoghhflaff", "english", "spanish"), ("Bdonfdjourr", "english", "french"), ("Hafdllnnc", "english", "german"), ]) def test_translate_text_with_text_impossible_to_translate( text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert answer == text @pytest.mark.parametrize("text, target_lang, original_lang", [("@Здравствуй#мой$друг!", "english", "russian"), ("@Hola#mi$amigo!", "english", "spanish"), ("@Bonjour#mon$ami!", "english", "french"), ("@Hallo#mein$Freund!", "english", "german"), ]) def test_translate_text_with_symbols(text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert "@ Hello # my $ friend!" == answer @pytest.mark.parametrize("text, target_lang, original_lang", [("Привет мой друг", "italian", "spanish"), ("Hola mi amigo", "english", "russian"), ("Bonjour, mon ami", "russian", "german"), ("Ciao amico", "french", "german") ]) def test_translate_text_with_with_incorrect_lang( text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert answer == text def test_get_user_language_for_invalid_user(session, user): user_id = user.id + 1 answer = _get_user_language(user_id, session=session) assert not answer def test_get_user_language_for_invalid_language(session, user): user.language_id = 34 session.commit() with pytest.raises(HTTPException): _get_user_language(user.id, session=session)
tests/test_translation.py
from fastapi import HTTPException from iso639 import languages import pytest from textblob import TextBlob from app.internal.translation import ( _detect_text_language, _get_language_code, _get_user_language, translate_text, translate_text_for_user ) TEXT = [ ("Привет мой друг", "english", "russian"), ("Hola mi amigo", "english", "spanish"), ("Bonjour, mon ami", "english", "french"), ("Hallo, me<NAME>", "english", "german"), ] @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_original_lang(text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert "Hello my friend" == answer assert TextBlob(text).detect_language() == languages.get( name=original_lang.capitalize()).alpha2 assert TextBlob(answer).detect_language() == languages.get( name=target_lang.capitalize()).alpha2 @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_without_original_lang( text, target_lang, original_lang): answer = translate_text(text, target_lang) assert "Hello my friend" == answer assert TextBlob(answer).detect_language() == languages.get( name=target_lang.capitalize()).alpha2 @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_identical_original_and_target_lang( text, target_lang, original_lang): answer = translate_text(text, original_lang, original_lang) assert answer == text @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_with_same_original_target_lang_without_original_lang( text, target_lang, original_lang): answer = translate_text(text, original_lang) assert answer == text def test_translate_text_without_text_with_original_target_lang(): answer = translate_text("", "english", "russian") assert answer == "" def test_translate_text_without_text_without_original_lang(): answer = translate_text("", "english") assert answer == "" def test_get_language_code(): answer = _get_language_code("english") assert answer == "en" def test_get_user_language(user, session): user_id = user.id answer = _get_user_language(user_id, session=session) assert user_id == 1 assert answer.lower() == "english" @pytest.mark.parametrize("text, target_lang, original_lang", TEXT) def test_translate_text_for_valid_user( text, target_lang, original_lang, session, user): user_id = user.id answer = translate_text_for_user(text, session, user_id) assert answer == "Hello my friend" def test_translate_text_for_invalid_user(session, user): user_id = user.id answer = translate_text_for_user("Привет мой друг", session, user_id + 1) assert answer == "Привет мой друг" def test_detect_text_language(): answer = _detect_text_language("Hello my friend") assert answer == "en" @pytest.mark.parametrize("text, target_lang, original_lang", [("Hoghhflaff", "english", "spanish"), ("Bdonfdjourr", "english", "french"), ("Hafdllnnc", "english", "german"), ]) def test_translate_text_with_text_impossible_to_translate( text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert answer == text @pytest.mark.parametrize("text, target_lang, original_lang", [("@Здравствуй#мой$друг!", "english", "russian"), ("@Hola#mi$amigo!", "english", "spanish"), ("@Bonjour#mon$ami!", "english", "french"), ("@Hallo#mein$Freund!", "english", "german"), ]) def test_translate_text_with_symbols(text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert "@ Hello # my $ friend!" == answer @pytest.mark.parametrize("text, target_lang, original_lang", [("Привет мой друг", "italian", "spanish"), ("Hola mi amigo", "english", "russian"), ("Bonjour, mon ami", "russian", "german"), ("Ciao amico", "french", "german") ]) def test_translate_text_with_with_incorrect_lang( text, target_lang, original_lang): answer = translate_text(text, target_lang, original_lang) assert answer == text def test_get_user_language_for_invalid_user(session, user): user_id = user.id + 1 answer = _get_user_language(user_id, session=session) assert not answer def test_get_user_language_for_invalid_language(session, user): user.language_id = 34 session.commit() with pytest.raises(HTTPException): _get_user_language(user.id, session=session)
0.503418
0.333246
import json import os import copy from Evaluate import cocoTools sourceJsonPath = './rainSnowGt.json' destDir = '' with open('./splitSequenceTranslator.json') as f: splitSequenceTranslator = json.load(f) # List rain removal methods here methods = ['baseline', 'Fu2017', 'GargNayar/Median', 'GargNayar/STCorr', 'IDCGAN', 'Kang2012', 'Kim2015-blur'] with open(sourceJsonPath, 'r') as f: sourceGt = json.load(f) for method in methods: methodGt = copy.deepcopy(sourceGt) removedImageIds = dict() if 'images' in methodGt: images = [] imageList = methodGt['images'] for image in imageList: methodImage = image imageNumber = image['file_name'].split('-')[-1] number = int(imageNumber.replace('.png','')) if number >= 40 and number <= 5990: scene = image['file_name'].split('/')[0] sequence = image['file_name'].split('/')[1] if 'baseline' not in method: newMethodPath = os.path.join(destDir, scene, sequence, method, imageNumber) methodImage['file_name'] = newMethodPath images.append(methodImage) else: removedImageIds[image['id']] = image['id'] # Does't really matter what the entry is, only interested in key if 'annotations' in methodGt: annotations = [] for annotation in methodGt['annotations']: if annotation['image_id'] not in removedImageIds: annotations.append(annotation) else: print("Removed annotation " + str(annotation['id']) + ' for image ' + str(annotation['image_id'])) methodGt['images'] = images methodGt['annotations'] = annotations # Also make sure to remove the annotations at the removed image ID's outputPath = os.path.join(destDir, method.replace('/', '-') + '.json') with open(os.path.join(destDir, method.replace('/', '-') + '.json'), 'w') as f: json.dump(methodGt, f) cocoTools.removeInstancesInsideDontCare('P:/Private/Traffic safety/Data/RainSnow/PixelLevelAnnotationsOriginal', outputPath, splitSequenceTranslator, destDir)
InstanceSegmentation/copyJsonForRainSnow.py
import json import os import copy from Evaluate import cocoTools sourceJsonPath = './rainSnowGt.json' destDir = '' with open('./splitSequenceTranslator.json') as f: splitSequenceTranslator = json.load(f) # List rain removal methods here methods = ['baseline', 'Fu2017', 'GargNayar/Median', 'GargNayar/STCorr', 'IDCGAN', 'Kang2012', 'Kim2015-blur'] with open(sourceJsonPath, 'r') as f: sourceGt = json.load(f) for method in methods: methodGt = copy.deepcopy(sourceGt) removedImageIds = dict() if 'images' in methodGt: images = [] imageList = methodGt['images'] for image in imageList: methodImage = image imageNumber = image['file_name'].split('-')[-1] number = int(imageNumber.replace('.png','')) if number >= 40 and number <= 5990: scene = image['file_name'].split('/')[0] sequence = image['file_name'].split('/')[1] if 'baseline' not in method: newMethodPath = os.path.join(destDir, scene, sequence, method, imageNumber) methodImage['file_name'] = newMethodPath images.append(methodImage) else: removedImageIds[image['id']] = image['id'] # Does't really matter what the entry is, only interested in key if 'annotations' in methodGt: annotations = [] for annotation in methodGt['annotations']: if annotation['image_id'] not in removedImageIds: annotations.append(annotation) else: print("Removed annotation " + str(annotation['id']) + ' for image ' + str(annotation['image_id'])) methodGt['images'] = images methodGt['annotations'] = annotations # Also make sure to remove the annotations at the removed image ID's outputPath = os.path.join(destDir, method.replace('/', '-') + '.json') with open(os.path.join(destDir, method.replace('/', '-') + '.json'), 'w') as f: json.dump(methodGt, f) cocoTools.removeInstancesInsideDontCare('P:/Private/Traffic safety/Data/RainSnow/PixelLevelAnnotationsOriginal', outputPath, splitSequenceTranslator, destDir)
0.250271
0.17849
import abc import spar_python.query_generation.query_schema as qs """ This class represents the vertical integration of creating aggregators for queries, refining the queries within the batch, and writing the selected queries and their results to the results database within one object. """ class QueryBatch(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def __init__(self, *args): """ Queries, and args needed to initialize that BOQ """ pass @abc.abstractmethod def produce_queries(self): """ Returns the query dicts that the bob is based around, used primarily for debugging purposes """ pass @abc.abstractmethod def make_aggregator(self): """ Returns a gen_choose aggregator which wraps the associated aggregators for the queries contained in the query batch """ pass @abc.abstractmethod def refine_queries(self, agg_result): """ Takes in the results of the aggregators and refines queries. Selects which queries should be recorded in the results database. To discard a query it simple does not add it to the refined list of queries and their results. It then sets that equal to self.refined_queries_results. It also returns a list of the refined queries and their results, which can be ignored or used at top level. """ pass @abc.abstractmethod def process_results(self, agg_results, db_object, query_file_handle, refined_queries = None): """ Takes in the aggregator results, with those results, determines which queries in the batch are 'interesting' it then instantiates query_results for those queries and uses it to write it to the results database. Refine arguement is a list of already refined queries if the user does not wish to rely on the pre-defined refine queries function """ @staticmethod def _print_query(q, query_file_handler): """ Prints passed in query in specific format to the passed in file. This is here so that it can toggle between * and id easily for now """ sql_line = '%d SELECT * FROM main WHERE %s\n' % \ (q[qs.QRY_QID], q['where_clause'].replace('\'\'','\'')) query_file_handler.write(sql_line)
spar_python/query_generation/BOQs/query_batch.py
import abc import spar_python.query_generation.query_schema as qs """ This class represents the vertical integration of creating aggregators for queries, refining the queries within the batch, and writing the selected queries and their results to the results database within one object. """ class QueryBatch(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def __init__(self, *args): """ Queries, and args needed to initialize that BOQ """ pass @abc.abstractmethod def produce_queries(self): """ Returns the query dicts that the bob is based around, used primarily for debugging purposes """ pass @abc.abstractmethod def make_aggregator(self): """ Returns a gen_choose aggregator which wraps the associated aggregators for the queries contained in the query batch """ pass @abc.abstractmethod def refine_queries(self, agg_result): """ Takes in the results of the aggregators and refines queries. Selects which queries should be recorded in the results database. To discard a query it simple does not add it to the refined list of queries and their results. It then sets that equal to self.refined_queries_results. It also returns a list of the refined queries and their results, which can be ignored or used at top level. """ pass @abc.abstractmethod def process_results(self, agg_results, db_object, query_file_handle, refined_queries = None): """ Takes in the aggregator results, with those results, determines which queries in the batch are 'interesting' it then instantiates query_results for those queries and uses it to write it to the results database. Refine arguement is a list of already refined queries if the user does not wish to rely on the pre-defined refine queries function """ @staticmethod def _print_query(q, query_file_handler): """ Prints passed in query in specific format to the passed in file. This is here so that it can toggle between * and id easily for now """ sql_line = '%d SELECT * FROM main WHERE %s\n' % \ (q[qs.QRY_QID], q['where_clause'].replace('\'\'','\'')) query_file_handler.write(sql_line)
0.740456
0.403596
from sentiment_analysis import SentiStrength from question_analysis.post import Post import json import os class FeatureAnalysis: def __init__(self,request={},config_file="config_question_analysis.json"): in_file=open(os.path.dirname(os.path.abspath(__file__))+'/'+config_file,"r") self.__config=json.loads(in_file.read()) in_file.close() if request=={}: raise Exception("Empty body") else: self.__post = Post(request) self.__code_snippet = False self.__weekday = None self.__gmt_hour = None self.__body_length = 0 self.__title_length= 0 self.__sentiment_positive_score= False self.__sentiment_negative_score= False self.__n_tag = False self.__avg_upperchars_ppost = 0 self.__url = False self.__avg_upperchars_ppost_disc = None self.__user_reputation = None def extract_features(self): self.__analyze_features() return { "CodeSnippet":str(self.__code_snippet), "Weekday": self.__weekday, "GMTHour": self.__gmt_hour, "BodyLength":self.__body_length, "TitleLength": self.__title_length, "SentimentPositiveScore": str(self.__sentiment_positive_score), "SentimentNegativeScore": str(self.__sentiment_negative_score), "NTag": str(self.__n_tag), "AvgUpperCharsPPost":self.__avg_upperchars_ppost, "URL": str(self.__url), "AvgUpperCharsPPostDisc":self.__avg_upperchars_ppost_disc, "UserReputation":self.__user_reputation } def __analyze_features(self): #CodeSnippet if len(self.__post.code) > 0: self.__code_snippet= True #Weekday self.__weekday = self.__is_weekend() #GMTHour self.__gmt_hour = self.__get_day_time() #BodyLength self.__body_length = self.__assign_cluster(self.__get_text_length(self.__post.body), self.__config["body_length_clusters"]) self.__title_length = self.__assign_cluster(self.__get_text_length(self.__post.title), self.__config["title_length_clusters"]) #SentimentScore senti_scores=SentiStrength('EN').get_sentiment(self.__post.title +" "+self.__post.body) self.__sentiment_positive_score,self.__sentiment_negative_score= self.__get_sentiment_scores(senti_scores) #Ntag if len(self.__post.tags) > 1: self.__n_tag = True #AvgUpperCharsPPost self.__avg_upperchars_ppost = str(((self.__get_uppercase_ratio(self.__post.body) + self.__get_uppercase_ratio(self.__post.title))/2), ) #AvgUpperCharsPPost cluster self.__avg_upperchars_ppost_disc= self.__assign_cluster(float(self.__avg_upperchars_ppost),self.__config["uppercase_clusters"]) #URL if len(self.__post.url) > 0: self.__url= True self.__user_reputation = self.__assign_cluster(self.__post.reputation, self.__config["reputation_clusters"]) def __is_weekend(self): if int(self.__post.day) == 0 or int(self.__post.day) == 6: return 'Weekend' else: return 'Weekday' def __get_day_time(self): int_hour = int(self.__post.hour) if int_hour >= 12 and int_hour <= 17: return 'Afternoon' elif int_hour >= 18 and int_hour <= 22: return 'Evening' elif int_hour >= 23 or int_hour <= 5: return 'Nigth' else: return 'Morning' def __assign_cluster(self,n,clusters): if n == 0: return min(clusters.keys(),key=(lambda k: clusters[k])) for key,value in clusters.items(): if n >= value[0] and n < value[1]: return key def __get_text_length(self,text): return len(text.replace(" ", "")) def __get_sentiment_scores(self,scores): positive= False negative= False positive_score= float(scores['positive']) negative_score= float(scores['negative']) if positive_score > 1: positive = True if negative_score < -1: negative = True return positive,negative def __get_uppercase_ratio(self,text): ratio=0 upper_char=sum(1 for c in text if c.isupper()) if upper_char !=0: ratio=upper_char/len(text) return ratio
src/question_analysis/feature_analysis.py
from sentiment_analysis import SentiStrength from question_analysis.post import Post import json import os class FeatureAnalysis: def __init__(self,request={},config_file="config_question_analysis.json"): in_file=open(os.path.dirname(os.path.abspath(__file__))+'/'+config_file,"r") self.__config=json.loads(in_file.read()) in_file.close() if request=={}: raise Exception("Empty body") else: self.__post = Post(request) self.__code_snippet = False self.__weekday = None self.__gmt_hour = None self.__body_length = 0 self.__title_length= 0 self.__sentiment_positive_score= False self.__sentiment_negative_score= False self.__n_tag = False self.__avg_upperchars_ppost = 0 self.__url = False self.__avg_upperchars_ppost_disc = None self.__user_reputation = None def extract_features(self): self.__analyze_features() return { "CodeSnippet":str(self.__code_snippet), "Weekday": self.__weekday, "GMTHour": self.__gmt_hour, "BodyLength":self.__body_length, "TitleLength": self.__title_length, "SentimentPositiveScore": str(self.__sentiment_positive_score), "SentimentNegativeScore": str(self.__sentiment_negative_score), "NTag": str(self.__n_tag), "AvgUpperCharsPPost":self.__avg_upperchars_ppost, "URL": str(self.__url), "AvgUpperCharsPPostDisc":self.__avg_upperchars_ppost_disc, "UserReputation":self.__user_reputation } def __analyze_features(self): #CodeSnippet if len(self.__post.code) > 0: self.__code_snippet= True #Weekday self.__weekday = self.__is_weekend() #GMTHour self.__gmt_hour = self.__get_day_time() #BodyLength self.__body_length = self.__assign_cluster(self.__get_text_length(self.__post.body), self.__config["body_length_clusters"]) self.__title_length = self.__assign_cluster(self.__get_text_length(self.__post.title), self.__config["title_length_clusters"]) #SentimentScore senti_scores=SentiStrength('EN').get_sentiment(self.__post.title +" "+self.__post.body) self.__sentiment_positive_score,self.__sentiment_negative_score= self.__get_sentiment_scores(senti_scores) #Ntag if len(self.__post.tags) > 1: self.__n_tag = True #AvgUpperCharsPPost self.__avg_upperchars_ppost = str(((self.__get_uppercase_ratio(self.__post.body) + self.__get_uppercase_ratio(self.__post.title))/2), ) #AvgUpperCharsPPost cluster self.__avg_upperchars_ppost_disc= self.__assign_cluster(float(self.__avg_upperchars_ppost),self.__config["uppercase_clusters"]) #URL if len(self.__post.url) > 0: self.__url= True self.__user_reputation = self.__assign_cluster(self.__post.reputation, self.__config["reputation_clusters"]) def __is_weekend(self): if int(self.__post.day) == 0 or int(self.__post.day) == 6: return 'Weekend' else: return 'Weekday' def __get_day_time(self): int_hour = int(self.__post.hour) if int_hour >= 12 and int_hour <= 17: return 'Afternoon' elif int_hour >= 18 and int_hour <= 22: return 'Evening' elif int_hour >= 23 or int_hour <= 5: return 'Nigth' else: return 'Morning' def __assign_cluster(self,n,clusters): if n == 0: return min(clusters.keys(),key=(lambda k: clusters[k])) for key,value in clusters.items(): if n >= value[0] and n < value[1]: return key def __get_text_length(self,text): return len(text.replace(" ", "")) def __get_sentiment_scores(self,scores): positive= False negative= False positive_score= float(scores['positive']) negative_score= float(scores['negative']) if positive_score > 1: positive = True if negative_score < -1: negative = True return positive,negative def __get_uppercase_ratio(self,text): ratio=0 upper_char=sum(1 for c in text if c.isupper()) if upper_char !=0: ratio=upper_char/len(text) return ratio
0.174762
0.132374
import os from india_wris.base import WaterQualityBase DATASET_NAME = 'India_WRIS_Surface' ## Defining MCF and TMCF template nodes SOLUTE_MCF_NODES = """Node: dcid:Concentration_{variable}_BodyOfWater_SurfaceWater name: Concentration of {variable}, SurfaceWater typeOf: dcs:StatisticalVariable populationType: dcs:BodyOfWater contaminatedThing: dcs:SurfaceWater contaminant: dcs:{variable} measuredProperty: dcs:concentration measurementMethod: dcs:WRIS_India statType: dcs:measuredValue """ CHEMPROP_MCF_NODES = """Node: dcid:{variable}_BodyOfWater_SurfaceWater name: {variable}, Surface Water typeOf: dcs:StatisticalVariable populationType: dcs:BodyOfWater waterSource: dcs:SurfaceWater measuredProperty: dcs:{dcid} measurementMethod: dcs:WRIS_India statType: dcs:measuredValue """ TMCF_ISOCODE = """Node: E:{dataset_name}->E0 dcid: C:{dataset_name}->dcid typeOf: dcs:WaterQualitySite Node: E:{dataset_name}->E1 typeOf: dcs:Place lgdCode: C:{dataset_name}->DistrictCode """ SOLUTE_TMCF_NODES = """Node: E:{dataset_name}->E{index} typeOf: dcid:StatVarObservation observationDate: C:{dataset_name}->Month observationAbout: E:{dataset_name}->E0 containedIn: E:{dataset_name}->E1 observationPeriod: "P1M" variableMeasured: dcid:Concentration_{variable}_BodyOfWater_SurfaceWater measuredProperty: dcs:concentration value: C:{dataset_name}->"{name}" """ CHEMPROP_TMCF_NODES = """Node: E:{dataset_name}->E{index} typeOf: dcid:StatVarObservation observationDate: C:{dataset_name}->Month observationAbout: E:{dataset_name}->E0 containedIn: E:{dataset_name}->E1 observationPeriod: "P1M" variableMeasured: dcid:{variable}_BodyOfWater_SurfaceWater measuredProperty: dcs:{dcid} value: C:{dataset_name}->"{name}" """ UNIT = """unit: dcid:{unit} """ template_strings = { 'solute_mcf': SOLUTE_MCF_NODES, 'solute_tmcf': SOLUTE_TMCF_NODES, 'chemprop_mcf': CHEMPROP_MCF_NODES, 'chemprop_tmcf': CHEMPROP_TMCF_NODES, 'site_dcid': TMCF_ISOCODE, 'unit_node': UNIT } preprocessor = WaterQualityBase(dataset_name=DATASET_NAME, util_names='surfaceWater', template_strings=template_strings) preprocessor.create_dcids_in_csv() preprocessor.create_mcfs()
scripts/india_wris/India_WRIS_Surface/preprocess.py
import os from india_wris.base import WaterQualityBase DATASET_NAME = 'India_WRIS_Surface' ## Defining MCF and TMCF template nodes SOLUTE_MCF_NODES = """Node: dcid:Concentration_{variable}_BodyOfWater_SurfaceWater name: Concentration of {variable}, SurfaceWater typeOf: dcs:StatisticalVariable populationType: dcs:BodyOfWater contaminatedThing: dcs:SurfaceWater contaminant: dcs:{variable} measuredProperty: dcs:concentration measurementMethod: dcs:WRIS_India statType: dcs:measuredValue """ CHEMPROP_MCF_NODES = """Node: dcid:{variable}_BodyOfWater_SurfaceWater name: {variable}, Surface Water typeOf: dcs:StatisticalVariable populationType: dcs:BodyOfWater waterSource: dcs:SurfaceWater measuredProperty: dcs:{dcid} measurementMethod: dcs:WRIS_India statType: dcs:measuredValue """ TMCF_ISOCODE = """Node: E:{dataset_name}->E0 dcid: C:{dataset_name}->dcid typeOf: dcs:WaterQualitySite Node: E:{dataset_name}->E1 typeOf: dcs:Place lgdCode: C:{dataset_name}->DistrictCode """ SOLUTE_TMCF_NODES = """Node: E:{dataset_name}->E{index} typeOf: dcid:StatVarObservation observationDate: C:{dataset_name}->Month observationAbout: E:{dataset_name}->E0 containedIn: E:{dataset_name}->E1 observationPeriod: "P1M" variableMeasured: dcid:Concentration_{variable}_BodyOfWater_SurfaceWater measuredProperty: dcs:concentration value: C:{dataset_name}->"{name}" """ CHEMPROP_TMCF_NODES = """Node: E:{dataset_name}->E{index} typeOf: dcid:StatVarObservation observationDate: C:{dataset_name}->Month observationAbout: E:{dataset_name}->E0 containedIn: E:{dataset_name}->E1 observationPeriod: "P1M" variableMeasured: dcid:{variable}_BodyOfWater_SurfaceWater measuredProperty: dcs:{dcid} value: C:{dataset_name}->"{name}" """ UNIT = """unit: dcid:{unit} """ template_strings = { 'solute_mcf': SOLUTE_MCF_NODES, 'solute_tmcf': SOLUTE_TMCF_NODES, 'chemprop_mcf': CHEMPROP_MCF_NODES, 'chemprop_tmcf': CHEMPROP_TMCF_NODES, 'site_dcid': TMCF_ISOCODE, 'unit_node': UNIT } preprocessor = WaterQualityBase(dataset_name=DATASET_NAME, util_names='surfaceWater', template_strings=template_strings) preprocessor.create_dcids_in_csv() preprocessor.create_mcfs()
0.40592
0.418697
set_name(0x8007B9C0, "GetTpY__FUs", SN_NOWARN) set_name(0x8007B9DC, "GetTpX__FUs", SN_NOWARN) set_name(0x8007B9E8, "Remove96__Fv", SN_NOWARN) set_name(0x8007BA20, "AppMain", SN_NOWARN) set_name(0x8007BAC0, "MAIN_RestartGameTask__Fv", SN_NOWARN) set_name(0x8007BAEC, "GameTask__FP4TASK", SN_NOWARN) set_name(0x8007BBD4, "MAIN_MainLoop__Fv", SN_NOWARN) set_name(0x8007BC1C, "CheckMaxArgs__Fv", SN_NOWARN) set_name(0x8007BC50, "GPUQ_InitModule__Fv", SN_NOWARN) set_name(0x8007BC5C, "GPUQ_FlushQ__Fv", SN_NOWARN) set_name(0x8007BDD0, "GPUQ_LoadImage__FP4RECTli", SN_NOWARN) set_name(0x8007BE84, "GPUQ_DiscardHandle__Fl", SN_NOWARN) set_name(0x8007BF24, "GPUQ_LoadClutAddr__FiiiPv", SN_NOWARN) set_name(0x8007BFC0, "GPUQ_MoveImage__FP4RECTii", SN_NOWARN) set_name(0x8007C060, "PRIM_Open__FiiiP10SCREEN_ENVUl", SN_NOWARN) set_name(0x8007C17C, "InitPrimBuffer__FP11PRIM_BUFFERii", SN_NOWARN) set_name(0x8007C258, "PRIM_Clip__FP4RECTi", SN_NOWARN) set_name(0x8007C380, "PRIM_GetCurrentScreen__Fv", SN_NOWARN) set_name(0x8007C38C, "PRIM_FullScreen__Fi", SN_NOWARN) set_name(0x8007C3C8, "PRIM_Flush__Fv", SN_NOWARN) set_name(0x8007C5DC, "PRIM_GetCurrentOtList__Fv", SN_NOWARN) set_name(0x8007C5E8, "ClearPbOnDrawSync", SN_NOWARN) set_name(0x8007C624, "ClearedYet__Fv", SN_NOWARN) set_name(0x8007C630, "PrimDrawSycnCallBack", SN_NOWARN) set_name(0x8007C650, "SendDispEnv__Fv", SN_NOWARN) set_name(0x8007C674, "PRIM_GetNextPolyF4__Fv", SN_NOWARN) set_name(0x8007C68C, "PRIM_GetNextPolyFt4__Fv", SN_NOWARN) set_name(0x8007C6A4, "PRIM_GetNextPolyGt4__Fv", SN_NOWARN) set_name(0x8007C6BC, "PRIM_GetNextPolyG4__Fv", SN_NOWARN) set_name(0x8007C6D4, "PRIM_GetNextPolyF3__Fv", SN_NOWARN) set_name(0x8007C6EC, "PRIM_GetNextDrArea__Fv", SN_NOWARN) set_name(0x8007C704, "ClipRect__FRC4RECTR4RECT", SN_NOWARN) set_name(0x8007C818, "IsColiding__FRC4RECTT0", SN_NOWARN) set_name(0x8007C880, "VID_AfterDisplay__Fv", SN_NOWARN) set_name(0x8007C8A0, "VID_ScrOn__Fv", SN_NOWARN) set_name(0x8007C8C8, "VID_DoThisNextSync__FPFv_v", SN_NOWARN) set_name(0x8007C920, "VID_NextSyncRoutHasExecuted__Fv", SN_NOWARN) set_name(0x8007C92C, "VID_GetTick__Fv", SN_NOWARN) set_name(0x8007C938, "VID_DispEnvSend", SN_NOWARN) set_name(0x8007C974, "VID_SetXYOff__Fii", SN_NOWARN) set_name(0x8007C984, "VID_GetXOff__Fv", SN_NOWARN) set_name(0x8007C990, "VID_GetYOff__Fv", SN_NOWARN) set_name(0x8007C99C, "VID_SetDBuffer__Fb", SN_NOWARN) set_name(0x8007CB0C, "MyFilter__FUlUlPCc", SN_NOWARN) set_name(0x8007CB14, "SlowMemMove__FPvT0Ul", SN_NOWARN) set_name(0x8007CB34, "GetTpY__FUs_addr_8007CB34", SN_NOWARN) set_name(0x8007CB50, "GetTpX__FUs_addr_8007CB50", SN_NOWARN) set_name(0x8007CB5C, "SYSI_GetFs__Fv", SN_NOWARN) set_name(0x8007CB68, "SYSI_GetOverlayFs__Fv", SN_NOWARN) set_name(0x8007CB74, "SortOutFileSystem__Fv", SN_NOWARN) set_name(0x8007CCB0, "MemCb__FlPvUlPCcii", SN_NOWARN) set_name(0x8007CCD0, "Spanker__Fv", SN_NOWARN) set_name(0x8007CD10, "GaryLiddon__Fv", SN_NOWARN) set_name(0x8007CD18, "ReadPad__Fi", SN_NOWARN) set_name(0x8007CE74, "DummyPoll__Fv", SN_NOWARN) set_name(0x8007CE7C, "DaveOwens__Fv", SN_NOWARN) set_name(0x8007CEA4, "GetCur__C4CPad", SN_NOWARN) set_name(0x8007CECC, "CheckActive__4CPad", SN_NOWARN) set_name(0x8007CED8, "GetTpY__FUs_addr_8007CED8", SN_NOWARN) set_name(0x8007CEF4, "GetTpX__FUs_addr_8007CEF4", SN_NOWARN) set_name(0x8007CF00, "TimSwann__Fv", SN_NOWARN) set_name(0x8007CF08, "__6FileIOUl", SN_NOWARN) set_name(0x8007CF58, "___6FileIO", SN_NOWARN) set_name(0x8007CFAC, "Read__6FileIOPCcUl", SN_NOWARN) set_name(0x8007D114, "FileLen__6FileIOPCc", SN_NOWARN) set_name(0x8007D178, "FileNotFound__6FileIOPCc", SN_NOWARN) set_name(0x8007D198, "StreamFile__6FileIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007D278, "ReadAtAddr__6FileIOPCcPUci", SN_NOWARN) set_name(0x8007D33C, "DumpOldPath__6FileIO", SN_NOWARN) set_name(0x8007D3A0, "SetSearchPath__6FileIOPCc", SN_NOWARN) set_name(0x8007D47C, "FindFile__6FileIOPCcPc", SN_NOWARN) set_name(0x8007D590, "CopyPathItem__6FileIOPcPCc", SN_NOWARN) set_name(0x8007D638, "LockSearchPath__6FileIO", SN_NOWARN) set_name(0x8007D690, "UnlockSearchPath__6FileIO", SN_NOWARN) set_name(0x8007D6E8, "SearchPathExists__6FileIO", SN_NOWARN) set_name(0x8007D6FC, "Save__6FileIOPCcPUci", SN_NOWARN) set_name(0x8007D738, "__4PCIOUl", SN_NOWARN) set_name(0x8007D7A0, "___4PCIO", SN_NOWARN) set_name(0x8007D7F8, "FileExists__4PCIOPCc", SN_NOWARN) set_name(0x8007D83C, "LoReadFileAtAddr__4PCIOPCcPUci", SN_NOWARN) set_name(0x8007D900, "GetFileLength__4PCIOPCc", SN_NOWARN) set_name(0x8007D9B8, "LoSave__4PCIOPCcPUci", SN_NOWARN) set_name(0x8007DA8C, "LoStreamFile__4PCIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007DC9C, "__6SysObj", SN_NOWARN) set_name(0x8007DCB4, "__nw__6SysObji", SN_NOWARN) set_name(0x8007DCE0, "__nw__6SysObjiUl", SN_NOWARN) set_name(0x8007DD5C, "__dl__6SysObjPv", SN_NOWARN) set_name(0x8007DDC8, "__5DatIOUl", SN_NOWARN) set_name(0x8007DE04, "___5DatIO", SN_NOWARN) set_name(0x8007DE5C, "FileExists__5DatIOPCc", SN_NOWARN) set_name(0x8007DE9C, "LoReadFileAtAddr__5DatIOPCcPUci", SN_NOWARN) set_name(0x8007DF5C, "GetFileLength__5DatIOPCc", SN_NOWARN) set_name(0x8007E010, "LoSave__5DatIOPCcPUci", SN_NOWARN) set_name(0x8007E0B8, "LoStreamFile__5DatIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007E2C4, "__7TextDat", SN_NOWARN) set_name(0x8007E304, "___7TextDat", SN_NOWARN) set_name(0x8007E34C, "Use__7TextDat", SN_NOWARN) set_name(0x8007E540, "TpLoadCallBack__FPUciib", SN_NOWARN) set_name(0x8007E610, "StreamLoadTP__7TextDat", SN_NOWARN) set_name(0x8007E6C8, "FinishedUsing__7TextDat", SN_NOWARN) set_name(0x8007E724, "MakeBlockOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007E794, "MakeOffsetTab__C9CBlockHdr", SN_NOWARN) set_name(0x8007E8C0, "SetUVTp__7TextDatP9FRAME_HDRP8POLY_FT4ii", SN_NOWARN) set_name(0x8007E9C0, "PrintMonster__7TextDatiiibi", SN_NOWARN) set_name(0x8007EDCC, "PrepareFt4__7TextDatP8POLY_FT4iiiii", SN_NOWARN) set_name(0x8007F038, "GetDecompBufffer__7TextDati", SN_NOWARN) set_name(0x8007F198, "SetUVTpGT4__7TextDatP9FRAME_HDRP8POLY_GT4ii", SN_NOWARN) set_name(0x8007F298, "PrepareGt4__7TextDatP8POLY_GT4iiiii", SN_NOWARN) set_name(0x8007F4F0, "SetUVTpGT3__7TextDatP9FRAME_HDRP8POLY_GT3", SN_NOWARN) set_name(0x8007F574, "PrepareGt3__7TextDatP8POLY_GT3iii", SN_NOWARN) set_name(0x8007F73C, "PrintFt4__7TextDatiiiiii", SN_NOWARN) set_name(0x8007F890, "PrintGt4__7TextDatiiiiii", SN_NOWARN) set_name(0x8007F9E4, "PrintGt3__7TextDatiiii", SN_NOWARN) set_name(0x8007FAC8, "DecompFrame__7TextDatP9FRAME_HDR", SN_NOWARN) set_name(0x8007FC20, "MakeCreatureOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007FD60, "MakePalOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007FE5C, "InitData__7TextDat", SN_NOWARN) set_name(0x8007FE88, "DumpData__7TextDat", SN_NOWARN) set_name(0x8007FFD0, "GM_UseTexData__Fi", SN_NOWARN) set_name(0x800800F0, "GM_FinishedUsing__FP7TextDat", SN_NOWARN) set_name(0x80080144, "SetPal__7TextDatP9FRAME_HDRP8POLY_FT4", SN_NOWARN) set_name(0x80080208, "GetFrNum__7TextDatiiii", SN_NOWARN) set_name(0x8008025C, "IsDirAliased__7TextDatiii", SN_NOWARN) set_name(0x800802B4, "DoDecompRequests__7TextDat", SN_NOWARN) set_name(0x800803D8, "FindDecompArea__7TextDatR4RECT", SN_NOWARN) set_name(0x800804B0, "GetFileInfo__7TextDati", SN_NOWARN) set_name(0x80080500, "GetSize__C15CCreatureAction", SN_NOWARN) set_name(0x80080528, "GetFrNum__C15CCreatureActionii", SN_NOWARN) set_name(0x800805D0, "InitDirRemap__15CCreatureAction", SN_NOWARN) set_name(0x80080690, "GetFrNum__C12CCreatureHdriii", SN_NOWARN) set_name(0x800806D4, "GetAction__C12CCreatureHdri", SN_NOWARN) set_name(0x80080764, "InitActionDirRemaps__12CCreatureHdr", SN_NOWARN) set_name(0x800807D4, "GetSize__C12CCreatureHdr", SN_NOWARN) set_name(0x80080840, "LoadDat__C13CTextFileInfo", SN_NOWARN) set_name(0x80080890, "LoadHdr__C13CTextFileInfo", SN_NOWARN) set_name(0x800808B8, "GetFile__C13CTextFileInfoPc", SN_NOWARN) set_name(0x80080954, "HasFile__C13CTextFileInfoPc", SN_NOWARN) set_name(0x800809BC, "Un64__FPUcT0l", SN_NOWARN) set_name(0x80080A90, "__7CScreen", SN_NOWARN) set_name(0x80080AC4, "Load__7CScreeniii", SN_NOWARN) set_name(0x80080D64, "Unload__7CScreen", SN_NOWARN) set_name(0x80080D88, "Display__7CScreeniiii", SN_NOWARN) set_name(0x80081068, "SetRect__5CPartR7TextDatR4RECT", SN_NOWARN) set_name(0x800810E4, "GetBoundingBox__6CBlockR7TextDatR4RECT", SN_NOWARN) set_name(0x80081240, "_GLOBAL__D_DatPool", SN_NOWARN) set_name(0x80081298, "_GLOBAL__I_DatPool", SN_NOWARN) set_name(0x800812EC, "PRIM_GetPrim__FPP8POLY_GT3", SN_NOWARN) set_name(0x80081368, "PRIM_GetPrim__FPP8POLY_GT4", SN_NOWARN) set_name(0x800813E4, "PRIM_GetPrim__FPP8POLY_FT4", SN_NOWARN) set_name(0x80081460, "CanXferFrame__C7TextDat", SN_NOWARN) set_name(0x80081488, "CanXferPal__C7TextDat", SN_NOWARN) set_name(0x800814B0, "IsLoaded__C7TextDat", SN_NOWARN) set_name(0x800814BC, "GetTexNum__C7TextDat", SN_NOWARN) set_name(0x800814C8, "GetCreature__7TextDati", SN_NOWARN) set_name(0x80081540, "GetNumOfCreatures__7TextDat", SN_NOWARN) set_name(0x80081554, "SetFileInfo__7TextDatPC13CTextFileInfoi", SN_NOWARN) set_name(0x80081560, "GetNumOfFrames__7TextDat", SN_NOWARN) set_name(0x80081574, "GetPal__7TextDati", SN_NOWARN) set_name(0x80081590, "GetFr__7TextDati", SN_NOWARN) set_name(0x800815AC, "GetName__C13CTextFileInfo", SN_NOWARN) set_name(0x800815B8, "HasDat__C13CTextFileInfo", SN_NOWARN) set_name(0x800815E0, "HasTp__C13CTextFileInfo", SN_NOWARN) set_name(0x80081608, "GetSize__C6CBlock", SN_NOWARN) set_name(0x8008161C, "__4CdIOUl", SN_NOWARN) set_name(0x80081660, "___4CdIO", SN_NOWARN) set_name(0x800816B8, "FileExists__4CdIOPCc", SN_NOWARN) set_name(0x800816DC, "LoReadFileAtAddr__4CdIOPCcPUci", SN_NOWARN) set_name(0x80081760, "GetFileLength__4CdIOPCc", SN_NOWARN) set_name(0x80081784, "LoSave__4CdIOPCcPUci", SN_NOWARN) set_name(0x80081864, "LoStreamCallBack__Fi", SN_NOWARN) set_name(0x80081874, "CD_GetCdlFILE__FPCcP7CdlFILE", SN_NOWARN) set_name(0x800819C0, "LoStreamFile__4CdIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x80081C9C, "LoAsyncStreamFile__4CdIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x80081DFC, "BL_InitEAC__Fv", SN_NOWARN) set_name(0x80081EE8, "BL_ReadFile__FPcUl", SN_NOWARN) set_name(0x80082014, "BL_AsyncReadFile__FPcUl", SN_NOWARN) set_name(0x80082188, "BL_LoadDirectory__Fv", SN_NOWARN) set_name(0x800822B0, "BL_LoadStreamDir__Fv", SN_NOWARN) set_name(0x80082590, "BL_MakeFilePosTab__FPUcUl", SN_NOWARN) set_name(0x80082690, "BL_FindStreamFile__FPcc", SN_NOWARN) set_name(0x8008285C, "BL_FileExists__FPcc", SN_NOWARN) set_name(0x80082880, "BL_FileLength__FPcc", SN_NOWARN) set_name(0x800828B4, "BL_LoadFileAtAddr__FPcPUcc", SN_NOWARN) set_name(0x8008299C, "BL_AsyncLoadDone__Fv", SN_NOWARN) set_name(0x800829A8, "BL_WaitForAsyncFinish__Fv", SN_NOWARN) set_name(0x800829F4, "BL_AsyncLoadCallBack__Fi", SN_NOWARN) set_name(0x80082A24, "BL_LoadFileAsync__FPcc", SN_NOWARN) set_name(0x80082B9C, "BL_AsyncLoadFileAtAddr__FPcPUcc", SN_NOWARN) set_name(0x80082C64, "BL_OpenStreamFile__FPcc", SN_NOWARN) set_name(0x80082C90, "BL_CloseStreamFile__FP6STRHDR", SN_NOWARN) set_name(0x80082CC8, "LZNP_Decode__FPUcT0", SN_NOWARN) set_name(0x80082D9C, "Tmalloc__Fi", SN_NOWARN) set_name(0x80082EC0, "Tfree__FPv", SN_NOWARN) set_name(0x80082F70, "InitTmalloc__Fv", SN_NOWARN) set_name(0x80082F98, "strupr__FPc", SN_NOWARN) set_name(0x80082FEC, "PauseTask__FP4TASK", SN_NOWARN) set_name(0x80083038, "GetPausePad__Fv", SN_NOWARN) set_name(0x8008312C, "TryPadForPause__Fi", SN_NOWARN) set_name(0x80083158, "DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x800833D8, "DoPausedMessage__14CPauseMessages", SN_NOWARN) set_name(0x800836F0, "DoQuitMessage__14CPauseMessages", SN_NOWARN) set_name(0x80083810, "AreYouSureMessage__14CPauseMessages", SN_NOWARN) set_name(0x80083914, "PA_SetPauseOk__Fb", SN_NOWARN) set_name(0x80083924, "PA_GetPauseOk__Fv", SN_NOWARN) set_name(0x80083930, "MY_PausePrint__17CTempPauseMessageiPciP4RECT", SN_NOWARN) set_name(0x80083A7C, "InitPrintQuitMessage__17CTempPauseMessage", SN_NOWARN) set_name(0x80083A84, "PrintQuitMessage__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083BA0, "LeavePrintQuitMessage__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083BA8, "InitPrintAreYouSure__17CTempPauseMessage", SN_NOWARN) set_name(0x80083BB0, "PrintAreYouSure__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083CCC, "LeavePrintAreYouSure__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083CD4, "InitPrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083CDC, "ShowInActive__17CTempPauseMessage", SN_NOWARN) set_name(0x80083DBC, "PrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083F0C, "LeavePrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083F14, "___17CTempPauseMessage", SN_NOWARN) set_name(0x80083F3C, "_GLOBAL__D_DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x80083F64, "_GLOBAL__I_DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x80083F8C, "__17CTempPauseMessage", SN_NOWARN) set_name(0x80083FD0, "___14CPauseMessages", SN_NOWARN) set_name(0x80084004, "__14CPauseMessages", SN_NOWARN) set_name(0x80084018, "SetRGB__6DialogUcUcUc", SN_NOWARN) set_name(0x80084038, "SetBack__6Dialogi", SN_NOWARN) set_name(0x80084040, "SetBorder__6Dialogi", SN_NOWARN) set_name(0x80084048, "___6Dialog", SN_NOWARN) set_name(0x80084070, "__6Dialog", SN_NOWARN) set_name(0x800840CC, "GetDown__C4CPad", SN_NOWARN) set_name(0x800840F4, "GetUp__C4CPad", SN_NOWARN) set_name(0x8008411C, "CheckActive__4CPad_addr_8008411C", SN_NOWARN) set_name(0x80084128, "ReadPadStream__Fv", SN_NOWARN) set_name(0x80084240, "PAD_Handler__Fv", SN_NOWARN) set_name(0x80084408, "PAD_GetPad__FiUc", SN_NOWARN) set_name(0x800844A4, "NewVal__4CPadUs", SN_NOWARN) set_name(0x800845DC, "BothNewVal__4CPadUsUs", SN_NOWARN) set_name(0x80084738, "Trans__4CPadUs", SN_NOWARN) set_name(0x8008485C, "_GLOBAL__I_Pad0", SN_NOWARN) set_name(0x80084894, "SetPadType__4CPadUc", SN_NOWARN) set_name(0x8008489C, "CheckActive__4CPad_addr_8008489C", SN_NOWARN) set_name(0x800848A8, "SetActive__4CPadUc", SN_NOWARN) set_name(0x800848B0, "SetBothFlag__4CPadUc", SN_NOWARN) set_name(0x800848B8, "__4CPadi", SN_NOWARN) set_name(0x800848EC, "Flush__4CPad", SN_NOWARN) set_name(0x80084910, "Set__7FontTab", SN_NOWARN) set_name(0x800849AC, "InitPrinty__Fv", SN_NOWARN) set_name(0x80084A4C, "SetTextDat__5CFontP7TextDat", SN_NOWARN) set_name(0x80084A54, "PrintChar__5CFontUsUscUcUcUc", SN_NOWARN) set_name(0x80084BEC, "Print__5CFontiiPc8TXT_JUSTP4RECTUcUcUc", SN_NOWARN) set_name(0x80085218, "GetStrWidth__5CFontPc", SN_NOWARN) set_name(0x800852CC, "SetChar__5CFontiUs", SN_NOWARN) set_name(0x80085330, "SetOTpos__5CFonti", SN_NOWARN) set_name(0x8008533C, "ClearFont__5CFont", SN_NOWARN) set_name(0x80085360, "IsDefined__5CFontUc", SN_NOWARN) set_name(0x80085380, "GetCharFrameNum__5CFontc", SN_NOWARN) set_name(0x80085398, "GetCharWidth__5CFontc", SN_NOWARN) set_name(0x800853F0, "Init__5CFont", SN_NOWARN) set_name(0x80085424, "GetFr__7TextDati_addr_80085424", SN_NOWARN) set_name(0x80085440, "TrimCol__Fs", SN_NOWARN) set_name(0x80085478, "DialogPrint__Fiiiiiiiiii", SN_NOWARN) set_name(0x80085DF8, "GetDropShadowG4__FUcUcUcUcUcUcUcUcUcUcUcUc", SN_NOWARN) set_name(0x80085F30, "DropShadows__Fiiii", SN_NOWARN) set_name(0x800861D4, "InitDialog__Fv", SN_NOWARN) set_name(0x8008630C, "GetSizes__6Dialog", SN_NOWARN) set_name(0x80086590, "Back__6Dialogiiii", SN_NOWARN) set_name(0x80087750, "Line__6Dialogiii", SN_NOWARN) set_name(0x80087968, "GetPal__7TextDati_addr_80087968", SN_NOWARN) set_name(0x80087984, "GetFr__7TextDati_addr_80087984", SN_NOWARN) set_name(0x800879A0, "ATT_DoAttract__Fv", SN_NOWARN) set_name(0x80087AF0, "CreatePlayersFromFeData__FR9FE_CREATE", SN_NOWARN) set_name(0x80087BBC, "UpdateSel__FPUsUsPUc", SN_NOWARN) set_name(0x80087BFC, "CycleSelCols__Fv", SN_NOWARN) set_name(0x80087DB4, "FindTownCreature__7CBlocksi", SN_NOWARN) set_name(0x80087E28, "FindCreature__7CBlocksi", SN_NOWARN) set_name(0x80087E7C, "__7CBlocksiiiii", SN_NOWARN) set_name(0x80087FD0, "SetTownersGraphics__7CBlocks", SN_NOWARN) set_name(0x80088008, "SetMonsterGraphics__7CBlocksii", SN_NOWARN) set_name(0x800880D0, "___7CBlocks", SN_NOWARN) set_name(0x80088158, "DumpGt4s__7CBlocks", SN_NOWARN) set_name(0x800881C0, "DumpRects__7CBlocks", SN_NOWARN) set_name(0x80088228, "SetGraphics__7CBlocksPP7TextDatPii", SN_NOWARN) set_name(0x80088284, "DumpGraphics__7CBlocksPP7TextDatPi", SN_NOWARN) set_name(0x800882D4, "PrintBlockOutline__7CBlocksiiiii", SN_NOWARN) set_name(0x80088620, "Load__7CBlocksi", SN_NOWARN) set_name(0x800886CC, "MakeRectTable__7CBlocks", SN_NOWARN) set_name(0x800887A0, "MakeGt4Table__7CBlocks", SN_NOWARN) set_name(0x800888A8, "MakeGt4__7CBlocksP8POLY_GT4P9FRAME_HDR", SN_NOWARN) set_name(0x800889E8, "GetBlock__7CBlocksi", SN_NOWARN) set_name(0x80088A60, "Print__7CBlocks", SN_NOWARN) set_name(0x80088A88, "SetXY__7CBlocksii", SN_NOWARN) set_name(0x80088AB0, "GetXY__7CBlocksPiT1", SN_NOWARN) set_name(0x80088AC8, "PrintMap__7CBlocksii", SN_NOWARN) set_name(0x80089FB8, "PrintGameSprites__7CBlocksiiiii", SN_NOWARN) set_name(0x8008A128, "PrintGameSprites__7CBlocksP8map_infoiiiiiii", SN_NOWARN) set_name(0x8008AF2C, "PrintSprites__7CBlocksP8map_infoiiiiiii", SN_NOWARN) set_name(0x8008B680, "PrintSprites__7CBlocksiiiii", SN_NOWARN) set_name(0x8008B7F0, "ScrToWorldX__7CBlocksii", SN_NOWARN) set_name(0x8008B804, "ScrToWorldY__7CBlocksii", SN_NOWARN) set_name(0x8008B818, "SetScrollTarget__7CBlocksii", SN_NOWARN) set_name(0x8008B8DC, "DoScroll__7CBlocks", SN_NOWARN) set_name(0x8008B960, "SetPlayerPosBlocks__7CBlocksiii", SN_NOWARN) set_name(0x8008BA00, "GetScrXY__7CBlocksR4RECTiiii", SN_NOWARN) set_name(0x8008BAD4, "ShadScaleSkew__7CBlocksP8POLY_FT4", SN_NOWARN) set_name(0x8008BB54, "WorldToScrX__7CBlocksii", SN_NOWARN) set_name(0x8008BB5C, "WorldToScrY__7CBlocksii", SN_NOWARN) set_name(0x8008BB70, "BL_GetCurrentBlocks__Fv", SN_NOWARN) set_name(0x8008BB7C, "PRIM_GetPrim__FPP8POLY_FT4_addr_8008BB7C", SN_NOWARN) set_name(0x8008BBF8, "GetHighlightCol__FiPiUsUsUs", SN_NOWARN) set_name(0x8008BC40, "PRIM_GetCopy__FP8POLY_FT4", SN_NOWARN) set_name(0x8008BC7C, "GetHighlightCol__FiPcUsUsUs", SN_NOWARN) set_name(0x8008BCC4, "PRIM_GetPrim__FPP8POLY_GT4_addr_8008BCC4", SN_NOWARN) set_name(0x8008BD40, "PRIM_GetPrim__FPP7LINE_F2", SN_NOWARN) set_name(0x8008BDBC, "PRIM_CopyPrim__FP8POLY_FT4T0", SN_NOWARN) set_name(0x8008BDE4, "GetCreature__14TownToCreaturei", SN_NOWARN) set_name(0x8008BE00, "SetItemGraphics__7CBlocksi", SN_NOWARN) set_name(0x8008BE28, "SetObjGraphics__7CBlocksi", SN_NOWARN) set_name(0x8008BE50, "DumpItems__7CBlocks", SN_NOWARN) set_name(0x8008BE74, "DumpObjs__7CBlocks", SN_NOWARN) set_name(0x8008BE98, "DumpMonsters__7CBlocks", SN_NOWARN) set_name(0x8008BEC0, "GetNumOfBlocks__7CBlocks", SN_NOWARN) set_name(0x8008BECC, "CopyToGt4__9LittleGt4P8POLY_GT4", SN_NOWARN) set_name(0x8008BF64, "InitFromGt4__9LittleGt4P8POLY_GT4ii", SN_NOWARN) set_name(0x8008BFF4, "GetNumOfFrames__7TextDatii", SN_NOWARN) set_name(0x8008C02C, "GetCreature__7TextDati_addr_8008C02C", SN_NOWARN) set_name(0x8008C0A4, "GetNumOfCreatures__7TextDat_addr_8008C0A4", SN_NOWARN) set_name(0x8008C0B8, "SetFileInfo__7TextDatPC13CTextFileInfoi_addr_8008C0B8", SN_NOWARN) set_name(0x8008C0C4, "GetPal__7TextDati_addr_8008C0C4", SN_NOWARN) set_name(0x8008C0E0, "GetFr__7TextDati_addr_8008C0E0", SN_NOWARN) set_name(0x8008C0FC, "OVR_IsMemcardOverlayBlank__Fv", SN_NOWARN) set_name(0x8008C128, "OVR_LoadPregame__Fv", SN_NOWARN) set_name(0x8008C150, "OVR_LoadFrontend__Fv", SN_NOWARN) set_name(0x8008C178, "OVR_LoadGame__Fv", SN_NOWARN) set_name(0x8008C1A0, "OVR_LoadFmv__Fv", SN_NOWARN) set_name(0x8008C1C8, "OVR_LoadMemcard__Fv", SN_NOWARN) set_name(0x8008C1F4, "ClearOutOverlays__Fv", SN_NOWARN) set_name(0x8008C24C, "ClearOut__7Overlay", SN_NOWARN) set_name(0x8008C310, "Load__7Overlay", SN_NOWARN) set_name(0x8008C380, "OVR_GetCurrentOverlay__Fv", SN_NOWARN) set_name(0x8008C38C, "LoadOver__FR7Overlay", SN_NOWARN) set_name(0x8008C3E0, "_GLOBAL__I_OVR_Open__Fv", SN_NOWARN) set_name(0x8008C550, "GetOverType__7Overlay", SN_NOWARN) set_name(0x8008C55C, "StevesDummyPoll__Fv", SN_NOWARN) set_name(0x8008C564, "Lambo__Fv", SN_NOWARN) set_name(0x8008C56C, "__7CPlayerbi", SN_NOWARN) set_name(0x8008C650, "___7CPlayer", SN_NOWARN) set_name(0x8008C6A8, "Load__7CPlayeri", SN_NOWARN) set_name(0x8008C704, "SetBlockXY__7CPlayerR7CBlocksR12PlayerStruct", SN_NOWARN) set_name(0x8008C850, "SetScrollTarget__7CPlayerR12PlayerStructR7CBlocks", SN_NOWARN) set_name(0x8008CC7C, "GetNumOfSpellAnims__FR12PlayerStruct", SN_NOWARN) set_name(0x8008CCFC, "Print__7CPlayerR12PlayerStructR7CBlocks", SN_NOWARN) set_name(0x8008D1D4, "FindAction__7CPlayerR12PlayerStruct", SN_NOWARN) set_name(0x8008D250, "FindActionEnum__7CPlayerR12PlayerStruct", SN_NOWARN) set_name(0x8008D2CC, "Init__7CPlayer", SN_NOWARN) set_name(0x8008D2D4, "Dump__7CPlayer", SN_NOWARN) set_name(0x8008D2DC, "PRIM_GetPrim__FPP8POLY_FT4_addr_8008D2DC", SN_NOWARN) set_name(0x8008D358, "PRIM_GetCopy__FP8POLY_FT4_addr_8008D358", SN_NOWARN) set_name(0x8008D394, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_8008D394", SN_NOWARN) set_name(0x8008D3BC, "GetPlrOt__7CBlocksi", SN_NOWARN) set_name(0x8008D3D0, "SetDecompArea__7TextDatiiii", SN_NOWARN) set_name(0x8008D3E8, "GetNumOfFrames__7TextDatii_addr_8008D3E8", SN_NOWARN) set_name(0x8008D420, "GetNumOfActions__7TextDati", SN_NOWARN) set_name(0x8008D444, "GetCreature__7TextDati_addr_8008D444", SN_NOWARN) set_name(0x8008D4BC, "GetNumOfCreatures__7TextDat_addr_8008D4BC", SN_NOWARN) set_name(0x8008D4D0, "SetFileInfo__7TextDatPC13CTextFileInfoi_addr_8008D4D0", SN_NOWARN) set_name(0x8008D4DC, "PROF_Open__Fv", SN_NOWARN) set_name(0x8008D51C, "PROF_State__Fv", SN_NOWARN) set_name(0x8008D528, "PROF_On__Fv", SN_NOWARN) set_name(0x8008D538, "PROF_Off__Fv", SN_NOWARN) set_name(0x8008D544, "PROF_CpuEnd__Fv", SN_NOWARN) set_name(0x8008D574, "PROF_CpuStart__Fv", SN_NOWARN) set_name(0x8008D598, "PROF_DrawStart__Fv", SN_NOWARN) set_name(0x8008D5BC, "PROF_DrawEnd__Fv", SN_NOWARN) set_name(0x8008D5EC, "PROF_Draw__FPUl", SN_NOWARN) set_name(0x8008D7E0, "PROF_Restart__Fv", SN_NOWARN) set_name(0x8008D800, "PSX_WndProc__FUilUl", SN_NOWARN) set_name(0x8008D8C0, "PSX_PostWndProc__FUilUl", SN_NOWARN) set_name(0x8008D970, "GoBackLevel__Fv", SN_NOWARN) set_name(0x8008D9E8, "GoWarpLevel__Fv", SN_NOWARN) set_name(0x8008DA20, "PostLoadGame__Fv", SN_NOWARN) set_name(0x8008DABC, "GoLoadGame__Fv", SN_NOWARN) set_name(0x8008DB18, "PostNewLevel__Fv", SN_NOWARN) set_name(0x8008DBB4, "GoNewLevel__Fv", SN_NOWARN) set_name(0x8008DC08, "PostGoBackLevel__Fv", SN_NOWARN) set_name(0x8008DCA0, "GoForwardLevel__Fv", SN_NOWARN) set_name(0x8008DCF8, "PostGoForwardLevel__Fv", SN_NOWARN) set_name(0x8008DD90, "GoNewGame__Fv", SN_NOWARN) set_name(0x8008DDE0, "PostNewGame__Fv", SN_NOWARN) set_name(0x8008DE18, "LevelToLevelInit__Fv", SN_NOWARN) set_name(0x8008DE60, "GetPal__6GPaneli", SN_NOWARN) set_name(0x8008DEA4, "__6GPaneli", SN_NOWARN) set_name(0x8008DEFC, "DrawFlask__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E37C, "DrawSpeedBar__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E800, "DrawSpell__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E9A0, "DrawMsgWindow__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E9EC, "DrawDurThingy__6GPaneliiP10ItemStructi", SN_NOWARN) set_name(0x8008EDA8, "DrawDurIcon__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008EE9C, "Print__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008EFA0, "GetPal__7TextDati_addr_8008EFA0", SN_NOWARN) set_name(0x8008EFBC, "GetFr__7TextDati_addr_8008EFBC", SN_NOWARN) set_name(0x8008EFD8, "PrintCDWaitTask__FP4TASK", SN_NOWARN) set_name(0x8008F090, "InitCDWaitIcon__Fv", SN_NOWARN) set_name(0x8008F0C4, "STR_Debug__FP6SFXHDRPce", SN_NOWARN) set_name(0x8008F0D8, "STR_SystemTask__FP4TASK", SN_NOWARN) set_name(0x8008F120, "STR_AllocBuffer__Fv", SN_NOWARN) set_name(0x8008F174, "STR_Init__Fv", SN_NOWARN) set_name(0x8008F294, "STR_InitStream__Fv", SN_NOWARN) set_name(0x8008F3CC, "STR_PlaySound__FUscic", SN_NOWARN) set_name(0x8008F508, "STR_setvolume__FP6SFXHDR", SN_NOWARN) set_name(0x8008F560, "STR_PlaySFX__FP6SFXHDR", SN_NOWARN) set_name(0x8008F66C, "STR_pauseall__Fv", SN_NOWARN) set_name(0x8008F6BC, "STR_resumeall__Fv", SN_NOWARN) set_name(0x8008F70C, "STR_CloseStream__FP6SFXHDR", SN_NOWARN) set_name(0x8008F790, "STR_SoundCommand__FP6SFXHDRi", SN_NOWARN) set_name(0x8008F89C, "STR_Command__FP6SFXHDR", SN_NOWARN) set_name(0x8008FA48, "STR_DMAControl__FP6SFXHDR", SN_NOWARN) set_name(0x8008FB10, "STR_PlayStream__FP6SFXHDRPUci", SN_NOWARN) set_name(0x8008FCEC, "STR_AsyncWeeTASK__FP4TASK", SN_NOWARN) set_name(0x8008FFEC, "STR_AsyncTASK__FP4TASK", SN_NOWARN) set_name(0x80090420, "STR_StreamMainTask__FP6SFXHDRc", SN_NOWARN) set_name(0x80090528, "SND_Monitor__FP4TASK", SN_NOWARN) set_name(0x800905B4, "SPU_Init__Fv", SN_NOWARN) set_name(0x800906C0, "SND_FindChannel__Fv", SN_NOWARN) set_name(0x8009072C, "SND_ClearBank__Fv", SN_NOWARN) set_name(0x800907A4, "SndLoadCallBack__FPUciib", SN_NOWARN) set_name(0x8009081C, "SND_LoadBank__Fi", SN_NOWARN) set_name(0x80090950, "SND_FindSFX__FUs", SN_NOWARN) set_name(0x800909A4, "SND_StopSnd__Fi", SN_NOWARN) set_name(0x800909C8, "SND_IsSfxPlaying__Fi", SN_NOWARN) set_name(0x80090A04, "SND_RemapSnd__Fi", SN_NOWARN) set_name(0x80090A78, "SND_PlaySnd__FUsiii", SN_NOWARN) set_name(0x80090C34, "AS_CallBack0__Fi", SN_NOWARN) set_name(0x80090C48, "AS_CallBack1__Fi", SN_NOWARN) set_name(0x80090C5C, "AS_WasLastBlock__FiP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090D38, "AS_OpenStream__FP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090DD8, "AS_GetBlock__FP6SFXHDR", SN_NOWARN) set_name(0x80090DE4, "AS_CloseStream__FP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090E10, "AS_LoopStream__FiP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090F30, "SCR_NeedHighlightPal__FUsUsi", SN_NOWARN) set_name(0x80090F64, "Init__13PalCollectionPC7InitPos", SN_NOWARN) set_name(0x80090FF4, "FindPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x800910D0, "NewPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x80091150, "MakePal__8PalEntryUsUsi", SN_NOWARN) set_name(0x800911F0, "GetHighlightPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x80091284, "UpdatePals__13PalCollection", SN_NOWARN) set_name(0x800912F8, "SCR_Handler__Fv", SN_NOWARN) set_name(0x80091320, "GetNumOfObjs__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x80091328, "GetObj__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x80091364, "Init__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x800913C8, "MoveFromUsedToUnused__t10Collection2Z8PalEntryi20P8PalEntry", SN_NOWARN) set_name(0x80091420, "MoveFromUnusedToUsed__t10Collection2Z8PalEntryi20P8PalEntry", SN_NOWARN) set_name(0x80091478, "Set__8PalEntryUsUsi", SN_NOWARN) set_name(0x8009148C, "Set__8PalEntryRC7InitPos", SN_NOWARN) set_name(0x800914B8, "SetJustUsed__8PalEntryb", SN_NOWARN) set_name(0x800914C0, "Init__8PalEntry", SN_NOWARN) set_name(0x800914C8, "GetClut__C8PalEntry", SN_NOWARN) set_name(0x800914D4, "IsEqual__C8PalEntryUsUsi", SN_NOWARN) set_name(0x8009150C, "GetNext__Ct11TLinkedList1Z8PalEntry", SN_NOWARN) set_name(0x80091518, "AddToList__t11TLinkedList1Z8PalEntryPP8PalEntry", SN_NOWARN) set_name(0x80091538, "DetachFromList__t11TLinkedList1Z8PalEntryPP8PalEntry", SN_NOWARN) set_name(0x80091584, "stub__FPcPv", SN_NOWARN) set_name(0x8009158C, "new_eprint__FPcT0i", SN_NOWARN) set_name(0x800915C0, "TonysGameTask__FP4TASK", SN_NOWARN) set_name(0x80091648, "SetAmbientLight__Fv", SN_NOWARN) set_name(0x800916CC, "print_demo_task__FP4TASK", SN_NOWARN) set_name(0x800918D8, "TonysDummyPoll__Fv", SN_NOWARN) set_name(0x800918FC, "load_demo_pad_data__FUl", SN_NOWARN) set_name(0x8009195C, "save_demo_pad_data__FUl", SN_NOWARN) set_name(0x800919BC, "set_pad_record_play__Fi", SN_NOWARN) set_name(0x80091A30, "start_demo__Fv", SN_NOWARN) set_name(0x80091ACC, "SetQuest__Fv", SN_NOWARN) set_name(0x80091AF4, "CurrCheatStr__Fv", SN_NOWARN) set_name(0x80091B14, "tony__Fv", SN_NOWARN) set_name(0x80091B4C, "GLUE_SetMonsterList__Fi", SN_NOWARN) set_name(0x80091B58, "GLUE_GetMonsterList__Fv", SN_NOWARN) set_name(0x80091B64, "GLUE_SuspendGame__Fv", SN_NOWARN) set_name(0x80091BB8, "GLUE_ResumeGame__Fv", SN_NOWARN) set_name(0x80091C0C, "GLUE_PreTown__Fv", SN_NOWARN) set_name(0x80091C70, "GLUE_PreDun__Fv", SN_NOWARN) set_name(0x80091CBC, "GLUE_Finished__Fv", SN_NOWARN) set_name(0x80091CC8, "GLUE_SetFinished__Fb", SN_NOWARN) set_name(0x80091CD4, "GLUE_StartBg__Fibi", SN_NOWARN) set_name(0x80091D58, "GLUE_SetShowGameScreenFlag__Fb", SN_NOWARN) set_name(0x80091D68, "GLUE_SetHomingScrollFlag__Fb", SN_NOWARN) set_name(0x80091D78, "GLUE_SetShowPanelFlag__Fb", SN_NOWARN) set_name(0x80091D88, "DoShowPanelGFX__FP6GPanelT0", SN_NOWARN) set_name(0x80091E60, "BgTask__FP4TASK", SN_NOWARN) set_name(0x800923C0, "FindPlayerChar__FPc", SN_NOWARN) set_name(0x80092458, "FindPlayerChar__Fiii", SN_NOWARN) set_name(0x800924B4, "FindPlayerChar__FP12PlayerStruct", SN_NOWARN) set_name(0x800924E4, "FindPlayerChar__FP12PlayerStructb", SN_NOWARN) set_name(0x80092544, "MakeSurePlayerDressedProperly__FR7CPlayerR12PlayerStructb", SN_NOWARN) set_name(0x800925C4, "GLUE_GetCurrentList__Fi", SN_NOWARN) set_name(0x80092670, "GetTexId__7CPlayer", SN_NOWARN) set_name(0x8009267C, "SetTown__7CBlocksb", SN_NOWARN) set_name(0x80092684, "MoveToScrollTarget__7CBlocks", SN_NOWARN) set_name(0x80092698, "SetDemoKeys__FPi", SN_NOWARN) set_name(0x80092770, "RestoreDemoKeys__FPi", SN_NOWARN) set_name(0x80092800, "get_action_str__Fii", SN_NOWARN) set_name(0x80092878, "get_key_pad__Fi", SN_NOWARN) set_name(0x800928B0, "checkvalid__Fv", SN_NOWARN) set_name(0x80092914, "RemoveCtrlScreen__Fv", SN_NOWARN) set_name(0x8009297C, "Init_ctrl_pos__Fv", SN_NOWARN) set_name(0x80092A34, "remove_padval__Fi", SN_NOWARN) set_name(0x80092A74, "remove_comboval__Fi", SN_NOWARN) set_name(0x80092AB4, "set_buttons__Fii", SN_NOWARN) set_name(0x80092C08, "restore_controller_settings__Fv", SN_NOWARN) set_name(0x80092C50, "only_one_button__Fi", SN_NOWARN) set_name(0x80092C7C, "main_ctrl_setup__Fv", SN_NOWARN) set_name(0x8009312C, "PrintCtrlString__FiiUcic", SN_NOWARN) set_name(0x80093628, "DrawCtrlSetup__Fv", SN_NOWARN) set_name(0x80093AE4, "_GLOBAL__D_ctrlflag", SN_NOWARN) set_name(0x80093B0C, "_GLOBAL__I_ctrlflag", SN_NOWARN) set_name(0x80093B34, "GetTick__C4CPad", SN_NOWARN) set_name(0x80093B5C, "GetDown__C4CPad_addr_80093B5C", SN_NOWARN) set_name(0x80093B84, "GetUp__C4CPad_addr_80093B84", SN_NOWARN) set_name(0x80093BAC, "SetPadTickMask__4CPadUs", SN_NOWARN) set_name(0x80093BB4, "SetPadTick__4CPadUs", SN_NOWARN) set_name(0x80093BBC, "SetRGB__6DialogUcUcUc_addr_80093BBC", SN_NOWARN) set_name(0x80093BDC, "SetBorder__6Dialogi_addr_80093BDC", SN_NOWARN) set_name(0x80093BE4, "SetOTpos__6Dialogi", SN_NOWARN) set_name(0x80093BF0, "___6Dialog_addr_80093BF0", SN_NOWARN) set_name(0x80093C18, "__6Dialog_addr_80093C18", SN_NOWARN) set_name(0x80093C74, "switchnight__FP4TASK", SN_NOWARN) set_name(0x80093CC0, "city_lights__FP4TASK", SN_NOWARN) set_name(0x80093E14, "color_cycle__FP4TASK", SN_NOWARN) set_name(0x80093F58, "ReInitDFL__Fv", SN_NOWARN) set_name(0x80093F90, "DrawFlameLogo__Fv", SN_NOWARN) set_name(0x80094334, "TitleScreen__FP7CScreen", SN_NOWARN) set_name(0x80094388, "TryCreaturePrint__Fiiiiiii", SN_NOWARN) set_name(0x800945EC, "TryWater__FiiP8POLY_GT4i", SN_NOWARN) set_name(0x800947C4, "nightgfx__FibiP8POLY_GT4i", SN_NOWARN) set_name(0x80094850, "PRIM_GetCopy__FP8POLY_FT4_addr_80094850", SN_NOWARN) set_name(0x8009488C, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_8009488C", SN_NOWARN) set_name(0x800948B4, "PRIM_GetPrim__FPP8POLY_FT4_addr_800948B4", SN_NOWARN) set_name(0x80094930, "GetNumOfActions__7TextDati_addr_80094930", SN_NOWARN) set_name(0x80094954, "GetCreature__7TextDati_addr_80094954", SN_NOWARN) set_name(0x800949CC, "GetNumOfCreatures__7TextDat_addr_800949CC", SN_NOWARN) set_name(0x800949E0, "DaveLDummyPoll__Fv", SN_NOWARN) set_name(0x800949E8, "DaveL__Fv", SN_NOWARN) set_name(0x80094A10, "DoReflection__FP8POLY_FT4iii", SN_NOWARN) set_name(0x80094CFC, "mteleportfx__Fv", SN_NOWARN) set_name(0x80094FFC, "invistimer__Fv", SN_NOWARN) set_name(0x800950D4, "setUVparams__FP8POLY_FT4P9FRAME_HDR", SN_NOWARN) set_name(0x80095164, "drawparticle__Fiiiiii", SN_NOWARN) set_name(0x80095354, "drawpolyF4__Fiiiiii", SN_NOWARN) set_name(0x80095488, "drawpolyG4__Fiiiiiiii", SN_NOWARN) set_name(0x80095658, "particlejump__Fv", SN_NOWARN) set_name(0x80095808, "particleglow__Fv", SN_NOWARN) set_name(0x800958FC, "doparticlejump__Fv", SN_NOWARN) set_name(0x8009593C, "StartPartJump__Fiiiiii", SN_NOWARN) set_name(0x80095AA4, "doparticlechain__Fiiiiiiiiiiii", SN_NOWARN) set_name(0x80095EA0, "ParticleBlob__FP13MissileStructiiii", SN_NOWARN) set_name(0x80095F38, "ParticleMissile__FP13MissileStructiiii", SN_NOWARN) set_name(0x80095FF8, "Teleportfx__Fiiiiiiii", SN_NOWARN) set_name(0x800962EC, "ResurrectFX__Fiiii", SN_NOWARN) set_name(0x80096514, "ParticleExp__FP13MissileStructiiii", SN_NOWARN) set_name(0x800965B0, "GetPlrPos__11SPELLFX_DATP12PlayerStruct", SN_NOWARN) set_name(0x800966D4, "healFX__Fv", SN_NOWARN) set_name(0x80096810, "HealStart__Fi", SN_NOWARN) set_name(0x80096844, "HealotherStart__Fi", SN_NOWARN) set_name(0x8009687C, "TeleStart__Fi", SN_NOWARN) set_name(0x800968D8, "PhaseStart__Fi", SN_NOWARN) set_name(0x8009690C, "PhaseEnd__Fi", SN_NOWARN) set_name(0x80096938, "ApocInit__11SPELLFX_DATP12PlayerStruct", SN_NOWARN) set_name(0x80096B14, "ApocaStart__Fi", SN_NOWARN) set_name(0x80096B6C, "DaveLTask__FP4TASK", SN_NOWARN) set_name(0x80096C08, "PRIM_GetPrim__FPP7POLY_G4", SN_NOWARN) set_name(0x80096C84, "PRIM_GetPrim__FPP7POLY_F4", SN_NOWARN) set_name(0x80096D00, "PRIM_GetPrim__FPP8POLY_FT4_addr_80096D00", SN_NOWARN) set_name(0x80096D7C, "GetPlayer__7CPlayeri", SN_NOWARN) set_name(0x80096DCC, "GetLastOtPos__C7CPlayer", SN_NOWARN) set_name(0x80096DD8, "GetFr__7TextDati_addr_80096DD8", SN_NOWARN) set_name(0x80096DF4, "DrawArrow__Fii", SN_NOWARN) set_name(0x80096FF8, "show_spell_dir__Fi", SN_NOWARN) set_name(0x80097490, "release_spell__Fi", SN_NOWARN) set_name(0x80097504, "select_belt_item__Fi", SN_NOWARN) set_name(0x8009750C, "any_belt_items__Fv", SN_NOWARN) set_name(0x80097574, "get_last_inv__Fv", SN_NOWARN) set_name(0x800976A4, "get_next_inv__Fv", SN_NOWARN) set_name(0x800977DC, "pad_func_up__Fi", SN_NOWARN) set_name(0x80097808, "pad_func_down__Fi", SN_NOWARN) set_name(0x80097834, "pad_func_left__Fi", SN_NOWARN) set_name(0x8009783C, "pad_func_right__Fi", SN_NOWARN) set_name(0x80097844, "pad_func_select__Fi", SN_NOWARN) set_name(0x80097900, "pad_func_Attack__Fi", SN_NOWARN) set_name(0x80097D8C, "pad_func_Action__Fi", SN_NOWARN) set_name(0x800980D8, "InitTargetCursor__Fi", SN_NOWARN) set_name(0x800981E0, "RemoveTargetCursor__Fi", SN_NOWARN) set_name(0x80098270, "pad_func_Cast_Spell__Fi", SN_NOWARN) set_name(0x80098670, "pad_func_Use_Item__Fi", SN_NOWARN) set_name(0x80098730, "pad_func_Chr__Fi", SN_NOWARN) set_name(0x80098838, "pad_func_Inv__Fi", SN_NOWARN) set_name(0x80098930, "pad_func_SplBook__Fi", SN_NOWARN) set_name(0x80098A1C, "pad_func_QLog__Fi", SN_NOWARN) set_name(0x80098AA0, "pad_func_SpellBook__Fi", SN_NOWARN) set_name(0x80098B38, "pad_func_AutoMap__Fi", SN_NOWARN) set_name(0x80098BF4, "pad_func_Quick_Spell__Fi", SN_NOWARN) set_name(0x80098C70, "check_inv__FiPci", SN_NOWARN) set_name(0x80098E38, "pad_func_Quick_Use_Health__Fi", SN_NOWARN) set_name(0x80098E60, "pad_func_Quick_Use_Mana__Fi", SN_NOWARN) set_name(0x80098E88, "get_max_find_size__FPici", SN_NOWARN) set_name(0x80098FC8, "sort_gold__Fi", SN_NOWARN) set_name(0x800990D4, "DrawObjSelector__Fi", SN_NOWARN) set_name(0x80099954, "DrawObjTask__FP4TASK", SN_NOWARN) set_name(0x80099A30, "add_area_find_object__Fciii", SN_NOWARN) set_name(0x80099B3C, "CheckRangeObject__Fiici", SN_NOWARN) set_name(0x80099EFC, "CheckArea__FiiicUci", SN_NOWARN) set_name(0x8009A1D4, "PlacePlayer__FiiiUc", SN_NOWARN) set_name(0x8009A3F8, "_GLOBAL__D_gplayer", SN_NOWARN) set_name(0x8009A420, "_GLOBAL__I_gplayer", SN_NOWARN) set_name(0x8009A448, "SetRGB__6DialogUcUcUc_addr_8009A448", SN_NOWARN) set_name(0x8009A468, "SetBack__6Dialogi_addr_8009A468", SN_NOWARN) set_name(0x8009A470, "SetBorder__6Dialogi_addr_8009A470", SN_NOWARN) set_name(0x8009A478, "___6Dialog_addr_8009A478", SN_NOWARN) set_name(0x8009A4A0, "__6Dialog_addr_8009A4A0", SN_NOWARN) set_name(0x8009A4FC, "GetTick__C4CPad_addr_8009A4FC", SN_NOWARN) set_name(0x8009A524, "GetDown__C4CPad_addr_8009A524", SN_NOWARN) set_name(0x8009A54C, "GetCur__C4CPad_addr_8009A54C", SN_NOWARN) set_name(0x8009A574, "SetPadTickMask__4CPadUs_addr_8009A574", SN_NOWARN) set_name(0x8009A57C, "SetPadTick__4CPadUs_addr_8009A57C", SN_NOWARN) set_name(0x8009A584, "DEC_AddAsDecRequestor__FP7TextDat", SN_NOWARN) set_name(0x8009A600, "DEC_RemoveAsDecRequestor__FP7TextDat", SN_NOWARN) set_name(0x8009A658, "DEC_DoDecompRequests__Fv", SN_NOWARN) set_name(0x8009A6B4, "FindThisTd__FP7TextDat", SN_NOWARN) set_name(0x8009A6EC, "FindEmptyIndex__Fv", SN_NOWARN) set_name(0x8009A724, "UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009A784, "IsGameLoading__Fv", SN_NOWARN) set_name(0x8009A790, "PutUpCutScreenTSK__FP4TASK", SN_NOWARN) set_name(0x8009AC04, "PutUpCutScreen__Fi", SN_NOWARN) set_name(0x8009ACC4, "TakeDownCutScreen__Fv", SN_NOWARN) set_name(0x8009AD50, "FinishProgress__Fv", SN_NOWARN) set_name(0x8009ADB4, "PRIM_GetPrim__FPP7POLY_G4_addr_8009ADB4", SN_NOWARN) set_name(0x8009AE30, "_GLOBAL__D_UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009AE68, "_GLOBAL__I_UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009AEA0, "SetRGB__6DialogUcUcUc_addr_8009AEA0", SN_NOWARN) set_name(0x8009AEC0, "SetBack__6Dialogi_addr_8009AEC0", SN_NOWARN) set_name(0x8009AEC8, "SetBorder__6Dialogi_addr_8009AEC8", SN_NOWARN) set_name(0x8009AED0, "___6Dialog_addr_8009AED0", SN_NOWARN) set_name(0x8009AEF8, "__6Dialog_addr_8009AEF8", SN_NOWARN) set_name(0x8009AF54, "___7CScreen", SN_NOWARN) set_name(0x8009AF74, "init_mem_card__FPFii_vUc", SN_NOWARN) set_name(0x8009B1AC, "memcard_event__Fii", SN_NOWARN) set_name(0x8009B1B4, "init_card__Fib", SN_NOWARN) set_name(0x8009B274, "ping_card__Fi", SN_NOWARN) set_name(0x8009B308, "CardUpdateTask__FP4TASK", SN_NOWARN) set_name(0x8009B340, "MemcardON__Fv", SN_NOWARN) set_name(0x8009B3B0, "MemcardOFF__Fv", SN_NOWARN) set_name(0x8009B400, "CheckSavedOptions__Fv", SN_NOWARN) set_name(0x8009B488, "card_removed__Fi", SN_NOWARN) set_name(0x8009B4B0, "read_card_block__Fii", SN_NOWARN) set_name(0x8009B4F8, "test_hw_event__Fv", SN_NOWARN) set_name(0x8009B578, "PrintSelectBack__FbT0", SN_NOWARN) set_name(0x8009B6F8, "DrawDialogBox__FiiP4RECTiiii", SN_NOWARN) set_name(0x8009B7DC, "DrawSpinner__FiiUcUcUciiibiT8", SN_NOWARN) set_name(0x8009BCD0, "DrawMenu__Fi", SN_NOWARN) set_name(0x8009C960, "who_pressed__Fi", SN_NOWARN) set_name(0x8009C9E8, "ShowCharacterFiles__Fv", SN_NOWARN) set_name(0x8009CFEC, "MemcardPad__Fv", SN_NOWARN) set_name(0x8009D664, "SoundPad__Fv", SN_NOWARN) set_name(0x8009DE80, "CentrePad__Fv", SN_NOWARN) set_name(0x8009E2D8, "CalcVolumes__Fv", SN_NOWARN) set_name(0x8009E410, "SetLoadedVolumes__Fv", SN_NOWARN) set_name(0x8009E498, "GetVolumes__Fv", SN_NOWARN) set_name(0x8009E534, "PrintInfoMenu__Fv", SN_NOWARN) set_name(0x8009E6DC, "SeedPad__Fv", SN_NOWARN) set_name(0x8009E960, "DrawOptions__FP4TASK", SN_NOWARN) set_name(0x8009F234, "ToggleOptions__Fv", SN_NOWARN) set_name(0x8009F2EC, "FormatPad__Fv", SN_NOWARN) set_name(0x8009F61C, "ActivateMemcard__Fv", SN_NOWARN) set_name(0x8009F6A0, "PRIM_GetPrim__FPP7POLY_G4_addr_8009F6A0", SN_NOWARN) set_name(0x8009F71C, "GetTick__C4CPad_addr_8009F71C", SN_NOWARN) set_name(0x8009F744, "GetDown__C4CPad_addr_8009F744", SN_NOWARN) set_name(0x8009F76C, "GetUp__C4CPad_addr_8009F76C", SN_NOWARN) set_name(0x8009F794, "SetPadTickMask__4CPadUs_addr_8009F794", SN_NOWARN) set_name(0x8009F79C, "SetPadTick__4CPadUs_addr_8009F79C", SN_NOWARN) set_name(0x8009F7A4, "Flush__4CPad_addr_8009F7A4", SN_NOWARN) set_name(0x8009F7C8, "SetRGB__6DialogUcUcUc_addr_8009F7C8", SN_NOWARN) set_name(0x8009F7E8, "SetBack__6Dialogi_addr_8009F7E8", SN_NOWARN) set_name(0x8009F7F0, "SetBorder__6Dialogi_addr_8009F7F0", SN_NOWARN) set_name(0x8009F7F8, "___6Dialog_addr_8009F7F8", SN_NOWARN) set_name(0x8009F820, "__6Dialog_addr_8009F820", SN_NOWARN) set_name(0x8009F87C, "GetFr__7TextDati_addr_8009F87C", SN_NOWARN) set_name(0x8009F898, "BirdDistanceOK__Fiiii", SN_NOWARN) set_name(0x8009F8F0, "AlterBirdPos__FP10BIRDSTRUCTUc", SN_NOWARN) set_name(0x8009FA34, "BirdWorld__FP10BIRDSTRUCTii", SN_NOWARN) set_name(0x8009FAB0, "BirdScared__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FC3C, "GetPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FC90, "BIRD_StartHop__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FDF8, "BIRD_DoHop__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FEFC, "BIRD_StartPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FF68, "BIRD_DoPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FFEC, "BIRD_DoScatter__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0098, "CheckDirOk__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A01A8, "BIRD_StartScatter__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0254, "BIRD_StartFly__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A02F8, "BIRD_DoFly__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A05A4, "BIRD_StartLanding__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A05FC, "BIRD_DoLanding__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0668, "PlaceFlock__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0754, "ProcessFlock__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0884, "InitBird__Fv", SN_NOWARN) set_name(0x800A095C, "ProcessBird__Fv", SN_NOWARN) set_name(0x800A0AB4, "GetBirdFrame__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0B50, "bscale__FP8POLY_FT4i", SN_NOWARN) set_name(0x800A0C80, "doshadow__FP10BIRDSTRUCTii", SN_NOWARN) set_name(0x800A0D8C, "DrawLBird__Fv", SN_NOWARN) set_name(0x800A0F98, "PRIM_GetPrim__FPP8POLY_FT4_addr_800A0F98", SN_NOWARN) set_name(0x800A1014, "PlayFMV__FPcii", SN_NOWARN) set_name(0x800A10E8, "play_movie", SN_NOWARN) set_name(0x800A11A4, "DisplayMonsterTypes__Fv", SN_NOWARN) set_name(0x800A1640, "GetDown__C4CPad_addr_800A1640", SN_NOWARN) set_name(0x800A1668, "GetNumOfFrames__7TextDatii_addr_800A1668", SN_NOWARN) set_name(0x800A16A0, "GetCreature__7TextDati_addr_800A16A0", SN_NOWARN) set_name(0x800A1718, "GetNumOfCreatures__7TextDat_addr_800A1718", SN_NOWARN) set_name(0x800A172C, "GetFr__7TextDati_addr_800A172C", SN_NOWARN) set_name(0x800A1748, "LoadKanjiFont__FPc", SN_NOWARN) set_name(0x800A1838, "LoadKanjiIndex__FPc", SN_NOWARN) set_name(0x800A1948, "FreeKanji__Fv", SN_NOWARN) set_name(0x800A19D0, "LoadKanji__F10LANG_DB_NO", SN_NOWARN) set_name(0x800A1AA4, "getb__FUs", SN_NOWARN) set_name(0x800A1B14, "_get_font__FPUsUsUs", SN_NOWARN) set_name(0x800A1BE4, "KPrintChar__FUsUsUcUcUs", SN_NOWARN) set_name(0x800A1D50, "PRIM_GetPrim__FPP8POLY_FT4_addr_800A1D50", SN_NOWARN) set_name(0x800A1DCC, "writeblock__FP5block", SN_NOWARN) set_name(0x800A1EB4, "PAK_DoPak__FPUcT0i", SN_NOWARN) set_name(0x800A20F4, "PAK_DoUnpak__FPUcT0", SN_NOWARN) set_name(0x800A2194, "fputc__5blockUc", SN_NOWARN) set_name(0x800A21BC, "HelpPad__Fv", SN_NOWARN) set_name(0x800A22C4, "InitHelp__Fv", SN_NOWARN) set_name(0x800A2308, "GetControlKey__FiPb", SN_NOWARN) set_name(0x800A23B0, "CheckStr__FPcT0i", SN_NOWARN) set_name(0x800A2484, "DisplayHelp__Fv", SN_NOWARN) set_name(0x800A2848, "DrawHelp__Fv", SN_NOWARN) set_name(0x800A28E4, "_GLOBAL__D_DrawHelp__Fv", SN_NOWARN) set_name(0x800A290C, "_GLOBAL__I_DrawHelp__Fv", SN_NOWARN) set_name(0x800A2934, "SetRGB__6DialogUcUcUc_addr_800A2934", SN_NOWARN) set_name(0x800A2954, "SetBorder__6Dialogi_addr_800A2954", SN_NOWARN) set_name(0x800A295C, "___6Dialog_addr_800A295C", SN_NOWARN) set_name(0x800A2984, "__6Dialog_addr_800A2984", SN_NOWARN) set_name(0x800A29E0, "GetCharWidth__5CFontc_addr_800A29E0", SN_NOWARN) set_name(0x800A2A38, "GetFr__7TextDati_addr_800A2A38", SN_NOWARN) set_name(0x800A2A54, "GetTick__C4CPad_addr_800A2A54", SN_NOWARN) set_name(0x800A2A7C, "GetDown__C4CPad_addr_800A2A7C", SN_NOWARN) set_name(0x800A2AA4, "SetPadTickMask__4CPadUs_addr_800A2AA4", SN_NOWARN) set_name(0x800A2AAC, "SetPadTick__4CPadUs_addr_800A2AAC", SN_NOWARN) set_name(0x8002E8B0, "TrimCol__Fs_addr_8002E8B0", SN_NOWARN) set_name(0x8002E8E8, "DrawSpellCel__FllUclUc", SN_NOWARN) set_name(0x8002F408, "SetSpellTrans__Fc", SN_NOWARN) set_name(0x8002F414, "DrawSpellBookTSK__FP4TASK", SN_NOWARN) set_name(0x8002F4B0, "DrawSpeedSpellTSK__FP4TASK", SN_NOWARN) set_name(0x8002F554, "ToggleSpell__Fi", SN_NOWARN) set_name(0x8002F608, "DrawSpellList__Fv", SN_NOWARN) set_name(0x800301CC, "SetSpell__Fi", SN_NOWARN) set_name(0x800302A0, "AddPanelString__FPCci", SN_NOWARN) set_name(0x80030350, "ClearPanel__Fv", SN_NOWARN) set_name(0x80030380, "InitPanelStr__Fv", SN_NOWARN) set_name(0x800303A0, "InitControlPan__Fv", SN_NOWARN) set_name(0x800305C0, "DrawCtrlPan__Fv", SN_NOWARN) set_name(0x800305EC, "DoAutoMap__Fv", SN_NOWARN) set_name(0x80030660, "CheckPanelInfo__Fv", SN_NOWARN) set_name(0x80030D80, "FreeControlPan__Fv", SN_NOWARN) set_name(0x80030E90, "CPrintString__FiPci", SN_NOWARN) set_name(0x80030FAC, "PrintInfo__Fv", SN_NOWARN) set_name(0x80031268, "DrawInfoBox__FP4RECT", SN_NOWARN) set_name(0x8003191C, "MY_PlrStringXY__Fv", SN_NOWARN) set_name(0x80031E6C, "ADD_PlrStringXY__FPCcc", SN_NOWARN) set_name(0x80031F14, "DrawPlus__Fii", SN_NOWARN) set_name(0x8003207C, "ChrCheckValidButton__Fi", SN_NOWARN) set_name(0x80032158, "DrawArrows__Fv", SN_NOWARN) set_name(0x80032250, "BuildChr__Fv", SN_NOWARN) set_name(0x80033528, "DrawChr__Fv", SN_NOWARN) set_name(0x80033984, "DrawChrTSK__FP4TASK", SN_NOWARN) set_name(0x80033A68, "DrawLevelUpIcon__Fi", SN_NOWARN) set_name(0x80033AFC, "CheckChrBtns__Fv", SN_NOWARN) set_name(0x80033E68, "DrawDurIcon4Item__FPC10ItemStructii", SN_NOWARN) set_name(0x80033EEC, "RedBack__Fv", SN_NOWARN) set_name(0x80033FD4, "PrintSBookStr__FiiUcPCcUc", SN_NOWARN) set_name(0x8003406C, "GetSBookTrans__FiUc", SN_NOWARN) set_name(0x80034284, "DrawSpellBook__Fv", SN_NOWARN) set_name(0x80034C60, "CheckSBook__Fv", SN_NOWARN) set_name(0x80034E94, "get_pieces_str__Fi", SN_NOWARN) set_name(0x80034EC8, "_GLOBAL__D_DrawLevelUpFlag", SN_NOWARN) set_name(0x80034EF0, "_GLOBAL__I_DrawLevelUpFlag", SN_NOWARN) set_name(0x80034F2C, "GetTick__C4CPad_addr_80034F2C", SN_NOWARN) set_name(0x80034F54, "GetDown__C4CPad_addr_80034F54", SN_NOWARN) set_name(0x80034F7C, "SetPadTickMask__4CPadUs_addr_80034F7C", SN_NOWARN) set_name(0x80034F84, "SetPadTick__4CPadUs_addr_80034F84", SN_NOWARN) set_name(0x80034F8C, "SetRGB__6DialogUcUcUc_addr_80034F8C", SN_NOWARN) set_name(0x80034FAC, "SetBack__6Dialogi_addr_80034FAC", SN_NOWARN) set_name(0x80034FB4, "SetBorder__6Dialogi_addr_80034FB4", SN_NOWARN) set_name(0x80034FBC, "___6Dialog_addr_80034FBC", SN_NOWARN) set_name(0x80034FE4, "__6Dialog_addr_80034FE4", SN_NOWARN) set_name(0x80035040, "GetPal__7TextDati_addr_80035040", SN_NOWARN) set_name(0x8003505C, "GetFr__7TextDati_addr_8003505C", SN_NOWARN) set_name(0x80035078, "InitCursor__Fv", SN_NOWARN) set_name(0x80035080, "FreeCursor__Fv", SN_NOWARN) set_name(0x80035088, "SetICursor__Fi", SN_NOWARN) set_name(0x800350E4, "SetCursor__Fi", SN_NOWARN) set_name(0x80035148, "NewCursor__Fi", SN_NOWARN) set_name(0x80035168, "InitLevelCursor__Fv", SN_NOWARN) set_name(0x800351C8, "CheckTown__Fv", SN_NOWARN) set_name(0x80035454, "CheckRportal__Fv", SN_NOWARN) set_name(0x800356B4, "CheckCursMove__Fv", SN_NOWARN) set_name(0x800356BC, "InitDead__Fv", SN_NOWARN) set_name(0x800358B8, "AddDead__Fiici", SN_NOWARN) set_name(0x80035900, "FreeGameMem__Fv", SN_NOWARN) set_name(0x80035950, "start_game__FUi", SN_NOWARN) set_name(0x800359AC, "free_game__Fv", SN_NOWARN) set_name(0x80035A20, "LittleStart__FUcUc", SN_NOWARN) set_name(0x80035AE4, "StartGame__FUcUc", SN_NOWARN) set_name(0x80035CCC, "run_game_loop__FUi", SN_NOWARN) set_name(0x80035E3C, "TryIconCurs__Fv", SN_NOWARN) set_name(0x80036218, "DisableInputWndProc__FUlUilUl", SN_NOWARN) set_name(0x80036220, "GM_Game__FUlUilUl", SN_NOWARN) set_name(0x800362D0, "LoadLvlGFX__Fv", SN_NOWARN) set_name(0x8003636C, "LoadAllGFX__Fv", SN_NOWARN) set_name(0x8003638C, "CreateLevel__Fi", SN_NOWARN) set_name(0x80036484, "LoCreateLevel__FPv", SN_NOWARN) set_name(0x8003660C, "ClearOutDungeonMap__Fv", SN_NOWARN) set_name(0x800366E8, "LoadGameLevel__FUci", SN_NOWARN) set_name(0x80037044, "game_logic__Fv", SN_NOWARN) set_name(0x80037150, "timeout_cursor__FUc", SN_NOWARN) set_name(0x800371F8, "game_loop__FUc", SN_NOWARN) set_name(0x80037230, "alloc_plr__Fv", SN_NOWARN) set_name(0x80037238, "plr_encrypt__FUc", SN_NOWARN) set_name(0x80037240, "assert_fail__FiPCcT1", SN_NOWARN) set_name(0x80037260, "assert_fail__FiPCc", SN_NOWARN) set_name(0x80037280, "app_fatal", SN_NOWARN) set_name(0x800372B0, "DoMemCardFromFrontEnd__Fv", SN_NOWARN) set_name(0x800372D8, "DoMemCardFromInGame__Fv", SN_NOWARN) set_name(0x80037300, "GetActiveTowner__Fi", SN_NOWARN) set_name(0x80037354, "SetTownerGPtrs__FPUcPPUc", SN_NOWARN) set_name(0x80037374, "NewTownerAnim__FiPUcii", SN_NOWARN) set_name(0x800373BC, "InitTownerInfo__FilUciiici", SN_NOWARN) set_name(0x8003751C, "InitQstSnds__Fi", SN_NOWARN) set_name(0x800375D4, "InitSmith__Fv", SN_NOWARN) set_name(0x80037700, "InitBarOwner__Fv", SN_NOWARN) set_name(0x80037834, "InitTownDead__Fv", SN_NOWARN) set_name(0x80037964, "InitWitch__Fv", SN_NOWARN) set_name(0x80037A94, "InitBarmaid__Fv", SN_NOWARN) set_name(0x80037BC4, "InitBoy__Fv", SN_NOWARN) set_name(0x80037CFC, "InitHealer__Fv", SN_NOWARN) set_name(0x80037E2C, "InitTeller__Fv", SN_NOWARN) set_name(0x80037F5C, "InitDrunk__Fv", SN_NOWARN) set_name(0x8003808C, "InitCows__Fv", SN_NOWARN) set_name(0x80038350, "InitTowners__Fv", SN_NOWARN) set_name(0x800383DC, "FreeTownerGFX__Fv", SN_NOWARN) set_name(0x80038480, "TownCtrlMsg__Fi", SN_NOWARN) set_name(0x800385B0, "TownBlackSmith__Fv", SN_NOWARN) set_name(0x800385E4, "TownBarOwner__Fv", SN_NOWARN) set_name(0x80038618, "TownDead__Fv", SN_NOWARN) set_name(0x80038700, "TownHealer__Fv", SN_NOWARN) set_name(0x80038728, "TownStory__Fv", SN_NOWARN) set_name(0x80038750, "TownDrunk__Fv", SN_NOWARN) set_name(0x80038778, "TownBoy__Fv", SN_NOWARN) set_name(0x800387A0, "TownWitch__Fv", SN_NOWARN) set_name(0x800387C8, "TownBarMaid__Fv", SN_NOWARN) set_name(0x800387F0, "TownCow__Fv", SN_NOWARN) set_name(0x80038818, "ProcessTowners__Fv", SN_NOWARN) set_name(0x80038A68, "PlrHasItem__FiiRi", SN_NOWARN) set_name(0x80038B3C, "CowSFX__Fi", SN_NOWARN) set_name(0x80038C58, "TownerTalk__Fii", SN_NOWARN) set_name(0x80038C98, "TalkToTowner__Fii", SN_NOWARN) set_name(0x8003A16C, "effect_is_playing__Fi", SN_NOWARN) set_name(0x8003A174, "stream_stop__Fv", SN_NOWARN) set_name(0x8003A1C8, "stream_play__FP4TSFXll", SN_NOWARN) set_name(0x8003A2B8, "stream_update__Fv", SN_NOWARN) set_name(0x8003A2C0, "sfx_stop__Fv", SN_NOWARN) set_name(0x8003A2DC, "InitMonsterSND__Fi", SN_NOWARN) set_name(0x8003A334, "FreeMonsterSnd__Fv", SN_NOWARN) set_name(0x8003A33C, "calc_snd_position__FiiPlT2", SN_NOWARN) set_name(0x8003A440, "PlaySFX_priv__FP4TSFXUcii", SN_NOWARN) set_name(0x8003A53C, "PlayEffect__Fii", SN_NOWARN) set_name(0x8003A680, "RndSFX__Fi", SN_NOWARN) set_name(0x8003A718, "PlaySFX__Fi", SN_NOWARN) set_name(0x8003A758, "PlaySfxLoc__Fiii", SN_NOWARN) set_name(0x8003A7AC, "sound_stop__Fv", SN_NOWARN) set_name(0x8003A844, "sound_update__Fv", SN_NOWARN) set_name(0x8003A878, "priv_sound_init__FUc", SN_NOWARN) set_name(0x8003A8BC, "sound_init__Fv", SN_NOWARN) set_name(0x8003A964, "GetDirection__Fiiii", SN_NOWARN) set_name(0x8003AA08, "SetRndSeed__Fl", SN_NOWARN) set_name(0x8003AA18, "GetRndSeed__Fv", SN_NOWARN) set_name(0x8003AA60, "random__Fil", SN_NOWARN) set_name(0x8003AACC, "DiabloAllocPtr__FUl", SN_NOWARN) set_name(0x8003AB18, "mem_free_dbg__FPv", SN_NOWARN) set_name(0x8003AB68, "LoadFileInMem__FPCcPUl", SN_NOWARN) set_name(0x8003AB70, "PlayInGameMovie__FPCc", SN_NOWARN) set_name(0x8003AB78, "Enter__9CCritSect", SN_NOWARN) set_name(0x8003AB80, "InitDiabloMsg__Fc", SN_NOWARN) set_name(0x8003AC14, "ClrDiabloMsg__Fv", SN_NOWARN) set_name(0x8003AC40, "DrawDiabloMsg__Fv", SN_NOWARN) set_name(0x8003AD4C, "interface_msg_pump__Fv", SN_NOWARN) set_name(0x8003AD54, "ShowProgress__FUi", SN_NOWARN) set_name(0x8003B28C, "InitAllItemsUseable__Fv", SN_NOWARN) set_name(0x8003B2C4, "InitItemGFX__Fv", SN_NOWARN) set_name(0x8003B2F0, "ItemPlace__Fii", SN_NOWARN) set_name(0x8003B3B8, "AddInitItems__Fv", SN_NOWARN) set_name(0x8003B5D0, "InitItems__Fv", SN_NOWARN) set_name(0x8003B7A8, "CalcPlrItemVals__FiUc", SN_NOWARN) set_name(0x8003C258, "CalcPlrScrolls__Fi", SN_NOWARN) set_name(0x8003C5D8, "CalcPlrStaff__FP12PlayerStruct", SN_NOWARN) set_name(0x8003C674, "CalcSelfItems__Fi", SN_NOWARN) set_name(0x8003C7D4, "ItemMinStats__FPC12PlayerStructPC10ItemStruct", SN_NOWARN) set_name(0x8003C820, "CalcPlrItemMin__Fi", SN_NOWARN) set_name(0x8003C900, "CalcPlrBookVals__Fi", SN_NOWARN) set_name(0x8003CB94, "CalcPlrInv__FiUc", SN_NOWARN) set_name(0x8003CC58, "SetPlrHandItem__FP10ItemStructi", SN_NOWARN) set_name(0x8003CD70, "GetPlrHandSeed__FP10ItemStruct", SN_NOWARN) set_name(0x8003CD9C, "GetGoldSeed__FiP10ItemStruct", SN_NOWARN) set_name(0x8003CF18, "SetPlrHandSeed__FP10ItemStructi", SN_NOWARN) set_name(0x8003CF20, "SetPlrHandGoldCurs__FP10ItemStruct", SN_NOWARN) set_name(0x8003CF50, "CreatePlrItems__Fi", SN_NOWARN) set_name(0x8003D38C, "ItemSpaceOk__Fii", SN_NOWARN) set_name(0x8003D664, "GetItemSpace__Fiic", SN_NOWARN) set_name(0x8003D890, "GetSuperItemSpace__Fiic", SN_NOWARN) set_name(0x8003D9F8, "GetSuperItemLoc__FiiRiT2", SN_NOWARN) set_name(0x8003DAC0, "CalcItemValue__Fi", SN_NOWARN) set_name(0x8003DB78, "GetBookSpell__Fii", SN_NOWARN) set_name(0x8003DDE0, "GetStaffPower__FiiiUc", SN_NOWARN) set_name(0x8003DFD0, "GetStaffSpell__FiiUc", SN_NOWARN) set_name(0x8003E284, "GetItemAttrs__Fiii", SN_NOWARN) set_name(0x8003E7D0, "RndPL__Fii", SN_NOWARN) set_name(0x8003E808, "PLVal__Fiiiii", SN_NOWARN) set_name(0x8003E87C, "SaveItemPower__Fiiiiiii", SN_NOWARN) set_name(0x8003FFA8, "GetItemPower__FiiilUc", SN_NOWARN) set_name(0x80040410, "GetItemBonus__FiiiiUc", SN_NOWARN) set_name(0x8004050C, "SetupItem__Fi", SN_NOWARN) set_name(0x80040614, "RndItem__Fi", SN_NOWARN) set_name(0x80040858, "RndUItem__Fi", SN_NOWARN) set_name(0x80040A98, "RndAllItems__Fv", SN_NOWARN) set_name(0x80040C0C, "RndTypeItems__Fii", SN_NOWARN) set_name(0x80040D0C, "CheckUnique__FiiiUc", SN_NOWARN) set_name(0x80040EBC, "GetUniqueItem__Fii", SN_NOWARN) set_name(0x80041164, "SpawnUnique__Fiii", SN_NOWARN) set_name(0x8004129C, "ItemRndDur__Fi", SN_NOWARN) set_name(0x8004132C, "SetupAllItems__FiiiiiUcUcUc", SN_NOWARN) set_name(0x80041638, "SpawnItem__FiiiUc", SN_NOWARN) set_name(0x80041880, "CreateItem__Fiii", SN_NOWARN) set_name(0x800419B0, "CreateRndItem__FiiUcUcUc", SN_NOWARN) set_name(0x80041AF8, "SetupAllUseful__Fiii", SN_NOWARN) set_name(0x80041BD0, "CreateRndUseful__FiiiUc", SN_NOWARN) set_name(0x80041C90, "CreateTypeItem__FiiUciiUcUc", SN_NOWARN) set_name(0x80041DD4, "RecreateEar__FiUsiUciiiiii", SN_NOWARN) set_name(0x80041FC0, "SpawnQuestItem__Fiiiii", SN_NOWARN) set_name(0x80042234, "SpawnRock__Fv", SN_NOWARN) set_name(0x800423F4, "RespawnItem__FiUc", SN_NOWARN) set_name(0x800425AC, "DeleteItem__Fii", SN_NOWARN) set_name(0x80042600, "ItemDoppel__Fv", SN_NOWARN) set_name(0x800426C8, "ProcessItems__Fv", SN_NOWARN) set_name(0x800428D0, "FreeItemGFX__Fv", SN_NOWARN) set_name(0x800428D8, "GetItemStr__Fi", SN_NOWARN) set_name(0x80042A80, "CheckIdentify__Fii", SN_NOWARN) set_name(0x80042B70, "RepairItem__FP10ItemStructi", SN_NOWARN) set_name(0x80042C40, "DoRepair__Fii", SN_NOWARN) set_name(0x80042D04, "RechargeItem__FP10ItemStructi", SN_NOWARN) set_name(0x80042D74, "DoRecharge__Fii", SN_NOWARN) set_name(0x80042E74, "PrintItemOil__Fc", SN_NOWARN) set_name(0x80042F68, "PrintItemPower__FcPC10ItemStruct", SN_NOWARN) set_name(0x80043624, "PrintUString__FiiUcPcc", SN_NOWARN) set_name(0x8004362C, "PrintItemMisc__FPC10ItemStruct", SN_NOWARN) set_name(0x800437B8, "PrintItemDetails__FPC10ItemStruct", SN_NOWARN) set_name(0x80043B28, "PrintItemDur__FPC10ItemStruct", SN_NOWARN) set_name(0x80043E38, "CastScroll__Fii", SN_NOWARN) set_name(0x80043E50, "UseItem__Fiii", SN_NOWARN) set_name(0x80044468, "StoreStatOk__FP10ItemStruct", SN_NOWARN) set_name(0x800444FC, "PremiumItemOk__Fi", SN_NOWARN) set_name(0x80044578, "RndPremiumItem__Fii", SN_NOWARN) set_name(0x80044680, "SpawnOnePremium__Fii", SN_NOWARN) set_name(0x800448A0, "SpawnPremium__Fi", SN_NOWARN) set_name(0x80044AE4, "WitchBookLevel__Fi", SN_NOWARN) set_name(0x80044C34, "SpawnStoreGold__Fv", SN_NOWARN) set_name(0x80044CB8, "RecalcStoreStats__Fv", SN_NOWARN) set_name(0x80044E58, "ItemNoFlippy__Fv", SN_NOWARN) set_name(0x80044EBC, "CreateSpellBook__FiiiUcUc", SN_NOWARN) set_name(0x8004504C, "CreateMagicArmor__FiiiiUcUc", SN_NOWARN) set_name(0x800451C8, "CreateMagicWeapon__FiiiiUcUc", SN_NOWARN) set_name(0x80045344, "DrawUniqueInfo__Fv", SN_NOWARN) set_name(0x800454B8, "MakeItemStr__FP10ItemStructUsUs", SN_NOWARN) set_name(0x800456B8, "veclen2__Fii", SN_NOWARN) set_name(0x80045720, "set_light_bands__Fv", SN_NOWARN) set_name(0x8004579C, "SetLightFX__FiisssUcUcUc", SN_NOWARN) set_name(0x80045808, "DoLighting__Fiiii", SN_NOWARN) set_name(0x800464B8, "DoUnLight__Fv", SN_NOWARN) set_name(0x80046700, "DoUnVision__Fiii", SN_NOWARN) set_name(0x800467C4, "DoVision__FiiiUcUc", SN_NOWARN) set_name(0x80046CD4, "FreeLightTable__Fv", SN_NOWARN) set_name(0x80046CDC, "InitLightTable__Fv", SN_NOWARN) set_name(0x80046CE4, "MakeLightTable__Fv", SN_NOWARN) set_name(0x80046CEC, "InitLightMax__Fv", SN_NOWARN) set_name(0x80046D10, "InitLighting__Fv", SN_NOWARN) set_name(0x80046D54, "AddLight__Fiii", SN_NOWARN) set_name(0x80046DC0, "AddUnLight__Fi", SN_NOWARN) set_name(0x80046DF0, "ChangeLightRadius__Fii", SN_NOWARN) set_name(0x80046E1C, "ChangeLightXY__Fiii", SN_NOWARN) set_name(0x80046E58, "light_fix__Fi", SN_NOWARN) set_name(0x80046E60, "ChangeLightOff__Fiii", SN_NOWARN) set_name(0x80046E94, "ChangeLight__Fiiii", SN_NOWARN) set_name(0x80046ECC, "ChangeLightColour__Fii", SN_NOWARN) set_name(0x80046EF4, "ProcessLightList__Fv", SN_NOWARN) set_name(0x80047018, "SavePreLighting__Fv", SN_NOWARN) set_name(0x80047020, "InitVision__Fv", SN_NOWARN) set_name(0x80047070, "AddVision__FiiiUc", SN_NOWARN) set_name(0x800470EC, "ChangeVisionRadius__Fii", SN_NOWARN) set_name(0x800471A0, "ChangeVisionXY__Fiii", SN_NOWARN) set_name(0x80047220, "ProcessVisionList__Fv", SN_NOWARN) set_name(0x80047420, "FreeQuestText__Fv", SN_NOWARN) set_name(0x80047428, "InitQuestText__Fv", SN_NOWARN) set_name(0x80047434, "CalcTextSpeed__FPCc", SN_NOWARN) set_name(0x80047588, "InitQTextMsg__Fi", SN_NOWARN) set_name(0x80047730, "DrawQTextBack__Fv", SN_NOWARN) set_name(0x800477A0, "DrawQTextTSK__FP4TASK", SN_NOWARN) set_name(0x800478E0, "DrawQText__Fv", SN_NOWARN) set_name(0x80047C4C, "_GLOBAL__D_QBack", SN_NOWARN) set_name(0x80047C74, "_GLOBAL__I_QBack", SN_NOWARN) set_name(0x80047C9C, "SetRGB__6DialogUcUcUc_addr_80047C9C", SN_NOWARN) set_name(0x80047CBC, "SetBorder__6Dialogi_addr_80047CBC", SN_NOWARN) set_name(0x80047CC4, "___6Dialog_addr_80047CC4", SN_NOWARN) set_name(0x80047CEC, "__6Dialog_addr_80047CEC", SN_NOWARN) set_name(0x80047D48, "GetCharWidth__5CFontc_addr_80047D48", SN_NOWARN) set_name(0x80047DA0, "GetDown__C4CPad_addr_80047DA0", SN_NOWARN) set_name(0x80047DC8, "GetFr__7TextDati_addr_80047DC8", SN_NOWARN) set_name(0x80047DE4, "nullmissile__Fiiiiiicii", SN_NOWARN) set_name(0x80047DEC, "FuncNULL__FP13MissileStructiii", SN_NOWARN) set_name(0x80047DF4, "delta_init__Fv", SN_NOWARN) set_name(0x80047E54, "delta_kill_monster__FiUcUcUc", SN_NOWARN) set_name(0x80047EF0, "delta_monster_hp__FilUc", SN_NOWARN) set_name(0x80047F74, "delta_sync_golem__FPC9TCmdGolemiUc", SN_NOWARN) set_name(0x80048004, "delta_leave_sync__FUc", SN_NOWARN) set_name(0x80048330, "delta_sync_object__FiUcUc", SN_NOWARN) set_name(0x80048390, "delta_get_item__FPC9TCmdGItemUc", SN_NOWARN) set_name(0x80048554, "delta_put_item__FPC9TCmdPItemiiUc", SN_NOWARN) set_name(0x800486DC, "delta_portal_inited__Fi", SN_NOWARN) set_name(0x80048700, "delta_quest_inited__Fi", SN_NOWARN) set_name(0x80048724, "DeltaAddItem__Fi", SN_NOWARN) set_name(0x80048938, "DeltaExportData__FPc", SN_NOWARN) set_name(0x800489E0, "DeltaImportData__FPc", SN_NOWARN) set_name(0x80048A8C, "DeltaSaveLevel__Fv", SN_NOWARN) set_name(0x80048B88, "NetSendCmd__FUcUc", SN_NOWARN) set_name(0x80048BB0, "NetSendCmdGolem__FUcUcUcUclUc", SN_NOWARN) set_name(0x80048BFC, "NetSendCmdLoc__FUcUcUcUc", SN_NOWARN) set_name(0x80048C2C, "NetSendCmdLocParam1__FUcUcUcUcUs", SN_NOWARN) set_name(0x80048C64, "NetSendCmdLocParam2__FUcUcUcUcUsUs", SN_NOWARN) set_name(0x80048CA4, "NetSendCmdLocParam3__FUcUcUcUcUsUsUs", SN_NOWARN) set_name(0x80048CEC, "NetSendCmdParam1__FUcUcUs", SN_NOWARN) set_name(0x80048D18, "NetSendCmdParam2__FUcUcUsUs", SN_NOWARN) set_name(0x80048D48, "NetSendCmdParam3__FUcUcUsUsUs", SN_NOWARN) set_name(0x80048D80, "NetSendCmdQuest__FUcUc", SN_NOWARN) set_name(0x80048DF4, "NetSendCmdGItem__FUcUcUcUcUc", SN_NOWARN) set_name(0x80048F28, "NetSendCmdGItem2__FUcUcUcUcPC9TCmdGItem", SN_NOWARN) set_name(0x80048FA4, "NetSendCmdReq2__FUcUcUcPC9TCmdGItem", SN_NOWARN) set_name(0x80048FFC, "NetSendCmdExtra__FPC9TCmdGItem", SN_NOWARN) set_name(0x80049064, "NetSendCmdPItem__FUcUcUcUc", SN_NOWARN) set_name(0x8004916C, "NetSendCmdChItem__FUcUc", SN_NOWARN) set_name(0x80049210, "NetSendCmdDelItem__FUcUc", SN_NOWARN) set_name(0x80049240, "NetSendCmdDItem__FUci", SN_NOWARN) set_name(0x80049354, "i_own_level__Fi", SN_NOWARN) set_name(0x8004935C, "NetSendCmdDamage__FUcUcUl", SN_NOWARN) set_name(0x80049390, "delta_open_portal__FiUcUcUcUcUc", SN_NOWARN) set_name(0x800493EC, "delta_close_portal__Fi", SN_NOWARN) set_name(0x8004942C, "check_update_plr__Fi", SN_NOWARN) set_name(0x80049434, "On_WALKXY__FPC4TCmdi", SN_NOWARN) set_name(0x800494B4, "On_ADDSTR__FPC4TCmdi", SN_NOWARN) set_name(0x800494E4, "On_ADDMAG__FPC4TCmdi", SN_NOWARN) set_name(0x80049514, "On_ADDDEX__FPC4TCmdi", SN_NOWARN) set_name(0x80049544, "On_ADDVIT__FPC4TCmdi", SN_NOWARN) set_name(0x80049574, "On_SBSPELL__FPC4TCmdi", SN_NOWARN) set_name(0x800495E8, "On_GOTOGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049670, "On_REQUESTGITEM__FPC4TCmdi", SN_NOWARN) set_name(0x800497B0, "On_GETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049980, "On_GOTOAGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049A08, "On_REQUESTAGITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049B3C, "On_AGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049D04, "On_ITEMEXTRA__FPC4TCmdi", SN_NOWARN) set_name(0x80049D50, "On_PUTITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049E68, "On_SYNCPUTITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049F68, "On_RESPAWNITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049FC0, "On_SATTACKXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A04C, "On_SPELLXYD__FPC4TCmdi", SN_NOWARN) set_name(0x8004A134, "On_SPELLXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A20C, "On_TSPELLXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A2E8, "On_OPOBJXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A3C8, "On_DISARMXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A4A8, "On_OPOBJT__FPC4TCmdi", SN_NOWARN) set_name(0x8004A4F4, "On_ATTACKID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A628, "On_SPELLID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A6F0, "On_SPELLPID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A7B0, "On_TSPELLID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A874, "On_TSPELLPID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A938, "On_KNOCKBACK__FPC4TCmdi", SN_NOWARN) set_name(0x8004A980, "On_RESURRECT__FPC4TCmdi", SN_NOWARN) set_name(0x8004A9B8, "On_HEALOTHER__FPC4TCmdi", SN_NOWARN) set_name(0x8004A9E0, "On_TALKXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004AA68, "On_NEWLVL__FPC4TCmdi", SN_NOWARN) set_name(0x8004AA98, "On_WARP__FPC4TCmdi", SN_NOWARN) set_name(0x8004AB8C, "On_MONSTDEATH__FPC4TCmdi", SN_NOWARN) set_name(0x8004ABF8, "On_KILLGOLEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004AC64, "On_AWAKEGOLEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004AD7C, "On_MONSTDAMAGE__FPC4TCmdi", SN_NOWARN) set_name(0x8004AE68, "On_PLRDEAD__FPC4TCmdi", SN_NOWARN) set_name(0x8004AEB0, "On_PLRDAMAGE__FPC4TCmdi", SN_NOWARN) set_name(0x8004B06C, "On_OPENDOOR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B0E8, "On_CLOSEDOOR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B164, "On_OPERATEOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B1E0, "On_PLROPOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B25C, "On_BREAKOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2D4, "On_CHANGEPLRITEMS__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2DC, "On_DELPLRITEMS__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2E4, "On_PLRLEVEL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2EC, "On_DROPITEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004B344, "On_PLAYER_JOINLEVEL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B5BC, "On_ACTIVATEPORTAL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B74C, "On_DEACTIVATEPORTAL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B79C, "On_RETOWN__FPC4TCmdi", SN_NOWARN) set_name(0x8004B7E4, "On_SETSTR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B824, "On_SETDEX__FPC4TCmdi", SN_NOWARN) set_name(0x8004B864, "On_SETMAG__FPC4TCmdi", SN_NOWARN) set_name(0x8004B8A4, "On_SETVIT__FPC4TCmdi", SN_NOWARN) set_name(0x8004B8E4, "On_SYNCQUEST__FPC4TCmdi", SN_NOWARN) set_name(0x8004B92C, "On_ENDSHIELD__FPC4TCmdi", SN_NOWARN) set_name(0x8004BA08, "ParseCmd__FiPC4TCmd", SN_NOWARN) set_name(0x8004BE28, "GetDLevel__Fib", SN_NOWARN) set_name(0x8004BEB8, "ReleaseDLevel__FP6DLevel", SN_NOWARN) set_name(0x8004BEF0, "NetSendLoPri__FPCUcUc", SN_NOWARN) set_name(0x8004BF1C, "InitLevelType__Fi", SN_NOWARN) set_name(0x8004BF68, "SetupLocalCoords__Fv", SN_NOWARN) set_name(0x8004C0F8, "InitNewSeed__Fl", SN_NOWARN) set_name(0x8004C16C, "NetInit__FUcPUc", SN_NOWARN) set_name(0x8004C3C0, "PostAddL1Door__Fiiii", SN_NOWARN) set_name(0x8004C4F8, "PostAddL2Door__Fiiii", SN_NOWARN) set_name(0x8004C644, "PostAddArmorStand__Fi", SN_NOWARN) set_name(0x8004C6CC, "PostTorchLocOK__Fii", SN_NOWARN) set_name(0x8004C70C, "PostAddObjLight__Fii", SN_NOWARN) set_name(0x8004C7B0, "PostObjObjAddSwitch__Fiiii", SN_NOWARN) set_name(0x8004C840, "InitObjectGFX__Fv", SN_NOWARN) set_name(0x8004CA5C, "FreeObjectGFX__Fv", SN_NOWARN) set_name(0x8004CA68, "DeleteObject__Fii", SN_NOWARN) set_name(0x8004CB20, "SetupObject__Fiiii", SN_NOWARN) set_name(0x8004CDA4, "SetObjMapRange__Fiiiiii", SN_NOWARN) set_name(0x8004CE04, "SetBookMsg__Fii", SN_NOWARN) set_name(0x8004CE2C, "AddObject__Fiii", SN_NOWARN) set_name(0x8004CF38, "PostAddObject__Fiii", SN_NOWARN) set_name(0x8004D044, "Obj_Light__Fii", SN_NOWARN) set_name(0x8004D254, "Obj_Circle__Fi", SN_NOWARN) set_name(0x8004D590, "Obj_StopAnim__Fi", SN_NOWARN) set_name(0x8004D5F4, "DrawExpl__Fiiiiiccc", SN_NOWARN) set_name(0x8004D8D0, "DrawObjExpl__FP12ObjectStructiii", SN_NOWARN) set_name(0x8004D940, "Obj_Door__Fi", SN_NOWARN) set_name(0x8004DAD4, "Obj_Sarc__Fi", SN_NOWARN) set_name(0x8004DB20, "ActivateTrapLine__Fii", SN_NOWARN) set_name(0x8004DC44, "Obj_FlameTrap__Fi", SN_NOWARN) set_name(0x8004DF14, "Obj_Trap__Fi", SN_NOWARN) set_name(0x8004E264, "Obj_BCrossDamage__Fi", SN_NOWARN) set_name(0x8004E4F4, "ProcessObjects__Fv", SN_NOWARN) set_name(0x8004E7D0, "ObjSetMicro__Fiii", SN_NOWARN) set_name(0x8004E808, "ObjSetMini__Fiii", SN_NOWARN) set_name(0x8004E8DC, "ObjL1Special__Fiiii", SN_NOWARN) set_name(0x8004E8E4, "ObjL2Special__Fiiii", SN_NOWARN) set_name(0x8004E8EC, "DoorSet__Fiii", SN_NOWARN) set_name(0x8004EB6C, "RedoPlayerVision__Fv", SN_NOWARN) set_name(0x8004EC10, "OperateL1RDoor__FiiUc", SN_NOWARN) set_name(0x8004EFB4, "OperateL1LDoor__FiiUc", SN_NOWARN) set_name(0x8004F38C, "OperateL2RDoor__FiiUc", SN_NOWARN) set_name(0x8004F724, "OperateL2LDoor__FiiUc", SN_NOWARN) set_name(0x8004FABC, "OperateL3RDoor__FiiUc", SN_NOWARN) set_name(0x8004FDC4, "OperateL3LDoor__FiiUc", SN_NOWARN) set_name(0x800500CC, "MonstCheckDoors__Fi", SN_NOWARN) set_name(0x800505C8, "PostAddL1Objs__Fiiii", SN_NOWARN) set_name(0x80050700, "PostAddL2Objs__Fiiii", SN_NOWARN) set_name(0x80050814, "ObjChangeMap__Fiiii", SN_NOWARN) set_name(0x800509CC, "DRLG_MRectTrans__Fiiii", SN_NOWARN) set_name(0x80050A78, "ObjChangeMapResync__Fiiii", SN_NOWARN) set_name(0x80050BFC, "OperateL1Door__FiiUc", SN_NOWARN) set_name(0x80050D58, "OperateLever__Fii", SN_NOWARN) set_name(0x80050F44, "OperateBook__Fii", SN_NOWARN) set_name(0x8005146C, "OperateBookLever__Fii", SN_NOWARN) set_name(0x800519FC, "OperateSChambBk__Fii", SN_NOWARN) set_name(0x80051C3C, "OperateChest__FiiUc", SN_NOWARN) set_name(0x8005200C, "OperateMushPatch__Fii", SN_NOWARN) set_name(0x800521D8, "OperateInnSignChest__Fii", SN_NOWARN) set_name(0x8005238C, "OperateSlainHero__FiiUc", SN_NOWARN) set_name(0x800525E0, "OperateTrapLvr__Fi", SN_NOWARN) set_name(0x800527B0, "OperateSarc__FiiUc", SN_NOWARN) set_name(0x80052968, "OperateL2Door__FiiUc", SN_NOWARN) set_name(0x80052AC4, "OperateL3Door__FiiUc", SN_NOWARN) set_name(0x80052C20, "LoadMapObjs__FPUcii", SN_NOWARN) set_name(0x80052D28, "OperatePedistal__Fii", SN_NOWARN) set_name(0x80053240, "TryDisarm__Fii", SN_NOWARN) set_name(0x80053404, "ItemMiscIdIdx__Fi", SN_NOWARN) set_name(0x80053474, "OperateShrine__Fiii", SN_NOWARN) set_name(0x80055A44, "OperateSkelBook__FiiUc", SN_NOWARN) set_name(0x80055BC0, "OperateBookCase__FiiUc", SN_NOWARN) set_name(0x80055DC4, "OperateDecap__FiiUc", SN_NOWARN) set_name(0x80055EAC, "OperateArmorStand__FiiUc", SN_NOWARN) set_name(0x8005601C, "FindValidShrine__Fi", SN_NOWARN) set_name(0x8005610C, "OperateGoatShrine__Fiii", SN_NOWARN) set_name(0x800561B4, "OperateCauldron__Fiii", SN_NOWARN) set_name(0x80056258, "OperateFountains__Fii", SN_NOWARN) set_name(0x80056804, "OperateWeaponRack__FiiUc", SN_NOWARN) set_name(0x800569B0, "OperateStoryBook__Fii", SN_NOWARN) set_name(0x80056AA0, "OperateLazStand__Fii", SN_NOWARN) set_name(0x80056C04, "OperateObject__FiiUc", SN_NOWARN) set_name(0x8005703C, "SyncOpL1Door__Fiii", SN_NOWARN) set_name(0x80057150, "SyncOpL2Door__Fiii", SN_NOWARN) set_name(0x80057264, "SyncOpL3Door__Fiii", SN_NOWARN) set_name(0x80057378, "SyncOpObject__Fiii", SN_NOWARN) set_name(0x80057578, "BreakCrux__Fi", SN_NOWARN) set_name(0x80057768, "BreakBarrel__FiiiUcUc", SN_NOWARN) set_name(0x80057CBC, "BreakObject__Fii", SN_NOWARN) set_name(0x80057E1C, "SyncBreakObj__Fii", SN_NOWARN) set_name(0x80057E78, "SyncL1Doors__Fi", SN_NOWARN) set_name(0x80057F90, "SyncCrux__Fi", SN_NOWARN) set_name(0x800580C8, "SyncLever__Fi", SN_NOWARN) set_name(0x80058144, "SyncQSTLever__Fi", SN_NOWARN) set_name(0x80058250, "SyncPedistal__Fi", SN_NOWARN) set_name(0x800583AC, "SyncL2Doors__Fi", SN_NOWARN) set_name(0x80058514, "SyncL3Doors__Fi", SN_NOWARN) set_name(0x80058640, "SyncObjectAnim__Fi", SN_NOWARN) set_name(0x80058780, "GetObjectStr__Fi", SN_NOWARN) set_name(0x80058B9C, "RestoreObjectLight__Fv", SN_NOWARN) set_name(0x80058DB8, "GetNumOfFrames__7TextDatii_addr_80058DB8", SN_NOWARN) set_name(0x80058DF0, "GetCreature__7TextDati_addr_80058DF0", SN_NOWARN) set_name(0x80058E68, "GetNumOfCreatures__7TextDat_addr_80058E68", SN_NOWARN) set_name(0x80058E7C, "FindPath__FPFiii_UciiiiiPc", SN_NOWARN) set_name(0x80058E84, "game_2_ui_class__FPC12PlayerStruct", SN_NOWARN) set_name(0x80058EB0, "game_2_ui_player__FPC12PlayerStructP11_uiheroinfoUc", SN_NOWARN) set_name(0x80058F64, "SetupLocalPlayer__Fv", SN_NOWARN) set_name(0x80058F84, "ismyplr__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FC8, "plrind__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FDC, "InitPlayerGFX__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FFC, "FreePlayerGFX__FP12PlayerStruct", SN_NOWARN) set_name(0x80059004, "NewPlrAnim__FP12PlayerStructiii", SN_NOWARN) set_name(0x80059020, "ClearPlrPVars__FP12PlayerStruct", SN_NOWARN) set_name(0x80059044, "SetPlrAnims__FP12PlayerStruct", SN_NOWARN) set_name(0x80059280, "CreatePlayer__FP12PlayerStructc", SN_NOWARN) set_name(0x8005969C, "CalcStatDiff__FP12PlayerStruct", SN_NOWARN) set_name(0x80059704, "NextPlrLevel__FP12PlayerStruct", SN_NOWARN) set_name(0x80059874, "AddPlrExperience__FP12PlayerStructil", SN_NOWARN) set_name(0x80059A80, "AddPlrMonstExper__Filc", SN_NOWARN) set_name(0x80059B04, "InitPlayer__FP12PlayerStructUc", SN_NOWARN) set_name(0x80059EA4, "InitMultiView__Fv", SN_NOWARN) set_name(0x80059EAC, "CheckLeighSolid__Fii", SN_NOWARN) set_name(0x80059F44, "SolidLoc__Fii", SN_NOWARN) set_name(0x80059FCC, "PlrClrTrans__Fii", SN_NOWARN) set_name(0x8005A060, "PlrDoTrans__Fii", SN_NOWARN) set_name(0x8005A154, "SetPlayerOld__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A168, "StartStand__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A1F4, "StartWalkStand__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A258, "PM_ChangeLightOff__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A294, "PM_ChangeOffset__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A2C0, "StartAttack__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A3F8, "StartPlrBlock__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A490, "StartSpell__FP12PlayerStructiii", SN_NOWARN) set_name(0x8005A62C, "RemovePlrFromMap__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A74C, "StartPlrHit__FP12PlayerStructiUc", SN_NOWARN) set_name(0x8005A86C, "RespawnDeadItem__FP10ItemStructii", SN_NOWARN) set_name(0x8005AA08, "PlrDeadItem__FP12PlayerStructP10ItemStructii", SN_NOWARN) set_name(0x8005ABD0, "StartPlayerKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005AED8, "DropHalfPlayersGold__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B320, "StartPlrKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005B478, "SyncPlrKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005B498, "RemovePlrMissiles__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B780, "InitLevelChange__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B844, "StartNewLvl__FP12PlayerStructii", SN_NOWARN) set_name(0x8005B988, "RestartTownLvl__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BA18, "StartWarpLvl__FP12PlayerStructi", SN_NOWARN) set_name(0x8005BAD4, "PM_DoStand__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BADC, "ChkPlrOffsets__Fiiii", SN_NOWARN) set_name(0x8005BB64, "PM_DoWalk__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BED0, "WeaponDur__FP12PlayerStructi", SN_NOWARN) set_name(0x8005C070, "PlrHitMonst__FP12PlayerStructi", SN_NOWARN) set_name(0x8005C6A0, "PlrHitPlr__FP12PlayerStructc", SN_NOWARN) set_name(0x8005CA50, "PlrHitObj__FP12PlayerStructii", SN_NOWARN) set_name(0x8005CAE0, "PM_DoAttack__FP12PlayerStruct", SN_NOWARN) set_name(0x8005CE6C, "PM_DoRangeAttack__FP12PlayerStruct", SN_NOWARN) set_name(0x8005CF6C, "ShieldDur__FP12PlayerStruct", SN_NOWARN) set_name(0x8005D030, "PM_DoBlock__FP12PlayerStruct", SN_NOWARN) set_name(0x8005D0D0, "do_spell_anim__FiiiP12PlayerStruct", SN_NOWARN) set_name(0x8005E094, "PM_DoSpell__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E3D4, "ArmorDur__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E4D4, "PM_DoGotHit__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E550, "PM_DoDeath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E690, "PM_DoNewLvl__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E698, "CheckNewPath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005EAD8, "PlrDeathModeOK__Fi", SN_NOWARN) set_name(0x8005EB40, "ValidatePlayer__Fv", SN_NOWARN) set_name(0x8005F028, "CheckCheatStats__FP12PlayerStruct", SN_NOWARN) set_name(0x8005F0C4, "ProcessPlayers__Fv", SN_NOWARN) set_name(0x8005F3F8, "ClrPlrPath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005F420, "PosOkPlayer__FP12PlayerStructii", SN_NOWARN) set_name(0x8005F5C8, "MakePlrPath__FP12PlayerStructiiUc", SN_NOWARN) set_name(0x8005F5D0, "CheckPlrSpell__Fv", SN_NOWARN) set_name(0x8005F9E0, "SyncInitPlrPos__FP12PlayerStruct", SN_NOWARN) set_name(0x8005FB08, "SyncInitPlr__FP12PlayerStruct", SN_NOWARN) set_name(0x8005FB38, "CheckStats__Fi", SN_NOWARN) set_name(0x8005FCD4, "ModifyPlrStr__Fii", SN_NOWARN) set_name(0x8005FDF0, "ModifyPlrMag__Fii", SN_NOWARN) set_name(0x8005FEDC, "ModifyPlrDex__Fii", SN_NOWARN) set_name(0x8005FFC0, "ModifyPlrVit__Fii", SN_NOWARN) set_name(0x8006009C, "SetPlayerHitPoints__FP12PlayerStructi", SN_NOWARN) set_name(0x800600E0, "SetPlrStr__Fii", SN_NOWARN) set_name(0x800601BC, "SetPlrMag__Fii", SN_NOWARN) set_name(0x8006022C, "SetPlrDex__Fii", SN_NOWARN) set_name(0x80060308, "SetPlrVit__Fii", SN_NOWARN) set_name(0x80060374, "InitDungMsgs__FP12PlayerStruct", SN_NOWARN) set_name(0x8006037C, "PlayDungMsgs__Fv", SN_NOWARN) set_name(0x800606AC, "CreatePlrItems__FP12PlayerStruct", SN_NOWARN) set_name(0x800606D4, "WorldToOffset__FP12PlayerStructii", SN_NOWARN) set_name(0x80060718, "SetSpdbarGoldCurs__FP12PlayerStructi", SN_NOWARN) set_name(0x8006074C, "GetSpellLevel__FP12PlayerStructi", SN_NOWARN) set_name(0x80060780, "BreakObject__FP12PlayerStructi", SN_NOWARN) set_name(0x800607B4, "CalcPlrInv__FP12PlayerStructUc", SN_NOWARN) set_name(0x800607E8, "RemoveSpdBarItem__FP12PlayerStructi", SN_NOWARN) set_name(0x8006081C, "M_StartKill__FiP12PlayerStruct", SN_NOWARN) set_name(0x80060854, "SetGoldCurs__FP12PlayerStructi", SN_NOWARN) set_name(0x80060888, "HealStart__FP12PlayerStruct", SN_NOWARN) set_name(0x800608B0, "HealotherStart__FP12PlayerStruct", SN_NOWARN) set_name(0x800608D8, "CalculateGold__FP12PlayerStruct", SN_NOWARN) set_name(0x80060900, "M_StartHit__FiP12PlayerStructi", SN_NOWARN) set_name(0x80060948, "TeleStart__FP12PlayerStruct", SN_NOWARN) set_name(0x80060970, "PhaseStart__FP12PlayerStruct", SN_NOWARN) set_name(0x80060998, "RemoveInvItem__FP12PlayerStructi", SN_NOWARN) set_name(0x800609CC, "PhaseEnd__FP12PlayerStruct", SN_NOWARN) set_name(0x800609F4, "OperateObject__FP12PlayerStructiUc", SN_NOWARN) set_name(0x80060A38, "TryDisarm__FP12PlayerStructi", SN_NOWARN) set_name(0x80060A6C, "TalkToTowner__FP12PlayerStructi", SN_NOWARN) set_name(0x80060AA0, "PosOkPlayer__Fiii", SN_NOWARN) set_name(0x80060AEC, "CalcStatDiff__Fi", SN_NOWARN) set_name(0x80060B38, "StartNewLvl__Fiii", SN_NOWARN) set_name(0x80060B84, "CreatePlayer__Fic", SN_NOWARN) set_name(0x80060BD8, "StartStand__Fii", SN_NOWARN) set_name(0x80060C24, "SetPlayerHitPoints__Fii", SN_NOWARN) set_name(0x80060C70, "MakePlrPath__FiiiUc", SN_NOWARN) set_name(0x80060CC0, "StartWarpLvl__Fii", SN_NOWARN) set_name(0x80060D0C, "SyncPlrKill__Fii", SN_NOWARN) set_name(0x80060D58, "StartPlrKill__Fii", SN_NOWARN) set_name(0x80060DA4, "NewPlrAnim__Fiiii", SN_NOWARN) set_name(0x80060DF0, "AddPlrExperience__Fiil", SN_NOWARN) set_name(0x80060E3C, "StartPlrBlock__Fii", SN_NOWARN) set_name(0x80060E88, "StartPlrHit__FiiUc", SN_NOWARN) set_name(0x80060ED8, "StartSpell__Fiiii", SN_NOWARN) set_name(0x80060F24, "InitPlayer__FiUc", SN_NOWARN) set_name(0x80060F74, "PM_ChangeLightOff__Fi", SN_NOWARN) set_name(0x80060FC0, "CheckNewPath__Fi", SN_NOWARN) set_name(0x8006100C, "FreePlayerGFX__Fi", SN_NOWARN) set_name(0x80061058, "InitDungMsgs__Fi", SN_NOWARN) set_name(0x800610A4, "InitPlayerGFX__Fi", SN_NOWARN) set_name(0x800610F0, "SyncInitPlrPos__Fi", SN_NOWARN) set_name(0x8006113C, "SetPlrAnims__Fi", SN_NOWARN) set_name(0x80061188, "ClrPlrPath__Fi", SN_NOWARN) set_name(0x800611D4, "SyncInitPlr__Fi", SN_NOWARN) set_name(0x80061220, "RestartTownLvl__Fi", SN_NOWARN) set_name(0x8006126C, "SetPlayerOld__Fi", SN_NOWARN) set_name(0x800612B8, "GetGoldSeed__FP12PlayerStructP10ItemStruct", SN_NOWARN) set_name(0x800612EC, "PRIM_GetPrim__FPP8POLY_FT4_addr_800612EC", SN_NOWARN) set_name(0x80061368, "GetPlayer__7CPlayeri_addr_80061368", SN_NOWARN) set_name(0x800613B8, "GetLastOtPos__C7CPlayer_addr_800613B8", SN_NOWARN) set_name(0x800613C4, "GetLastScrY__C7CPlayer", SN_NOWARN) set_name(0x800613D0, "GetLastScrX__C7CPlayer", SN_NOWARN) set_name(0x800613DC, "TSK_Lava2Water__FP4TASK", SN_NOWARN) set_name(0x80061628, "CheckQuests__Fv", SN_NOWARN) set_name(0x80061ADC, "ForceQuests__Fv", SN_NOWARN) set_name(0x80061C80, "QuestStatus__Fi", SN_NOWARN) set_name(0x80061D14, "CheckQuestKill__FiUc", SN_NOWARN) set_name(0x800622F4, "SetReturnLvlPos__Fv", SN_NOWARN) set_name(0x80062404, "GetReturnLvlPos__Fv", SN_NOWARN) set_name(0x80062458, "ResyncMPQuests__Fv", SN_NOWARN) set_name(0x80062594, "ResyncQuests__Fv", SN_NOWARN) set_name(0x80062AF4, "PrintQLString__FiiUcPcc", SN_NOWARN) set_name(0x80062D20, "DrawQuestLog__Fv", SN_NOWARN) set_name(0x80062EE8, "DrawQuestLogTSK__FP4TASK", SN_NOWARN) set_name(0x80062F80, "StartQuestlog__Fv", SN_NOWARN) set_name(0x80063098, "QuestlogUp__Fv", SN_NOWARN) set_name(0x800630EC, "QuestlogDown__Fv", SN_NOWARN) set_name(0x80063158, "RemoveQLog__Fv", SN_NOWARN) set_name(0x800631D0, "QuestlogEnter__Fv", SN_NOWARN) set_name(0x80063294, "QuestlogESC__Fv", SN_NOWARN) set_name(0x800632BC, "SetMultiQuest__FiiUci", SN_NOWARN) set_name(0x8006333C, "_GLOBAL__D_questlog", SN_NOWARN) set_name(0x80063364, "_GLOBAL__I_questlog", SN_NOWARN) set_name(0x8006338C, "GetBlockTexDat__7CBlocks", SN_NOWARN) set_name(0x80063398, "SetRGB__6DialogUcUcUc_addr_80063398", SN_NOWARN) set_name(0x800633B8, "SetBack__6Dialogi_addr_800633B8", SN_NOWARN) set_name(0x800633C0, "SetBorder__6Dialogi_addr_800633C0", SN_NOWARN) set_name(0x800633C8, "___6Dialog_addr_800633C8", SN_NOWARN) set_name(0x800633F0, "__6Dialog_addr_800633F0", SN_NOWARN) set_name(0x8006344C, "GetPal__7TextDati_addr_8006344C", SN_NOWARN) set_name(0x80063468, "GetFr__7TextDati_addr_80063468", SN_NOWARN) set_name(0x80063484, "DrawView__Fii", SN_NOWARN) set_name(0x8006364C, "DrawAndBlit__Fv", SN_NOWARN) set_name(0x80063778, "FreeStoreMem__Fv", SN_NOWARN) set_name(0x80063780, "DrawSTextBack__Fv", SN_NOWARN) set_name(0x800637F0, "PrintSString__FiiUcPcci", SN_NOWARN) set_name(0x80063BE4, "DrawSLine__Fi", SN_NOWARN) set_name(0x80063C78, "ClearSText__Fii", SN_NOWARN) set_name(0x80063D10, "AddSLine__Fi", SN_NOWARN) set_name(0x80063D60, "AddSTextVal__Fii", SN_NOWARN) set_name(0x80063D88, "AddSText__FiiUcPccUc", SN_NOWARN) set_name(0x80063E3C, "PrintStoreItem__FPC10ItemStructic", SN_NOWARN) set_name(0x800642C4, "StoreAutoPlace__Fv", SN_NOWARN) set_name(0x800648E4, "S_StartSmith__Fv", SN_NOWARN) set_name(0x80064A6C, "S_ScrollSBuy__Fi", SN_NOWARN) set_name(0x80064C24, "S_StartSBuy__Fv", SN_NOWARN) set_name(0x80064D54, "S_ScrollSPBuy__Fi", SN_NOWARN) set_name(0x80064F74, "S_StartSPBuy__Fv", SN_NOWARN) set_name(0x800650C4, "SmithSellOk__Fi", SN_NOWARN) set_name(0x800651A8, "S_ScrollSSell__Fi", SN_NOWARN) set_name(0x800653D0, "S_StartSSell__Fv", SN_NOWARN) set_name(0x80065800, "SmithRepairOk__Fi", SN_NOWARN) set_name(0x800658A4, "AddStoreHoldRepair__FP10ItemStructi", SN_NOWARN) set_name(0x80065A84, "S_StartSRepair__Fv", SN_NOWARN) set_name(0x80065F54, "S_StartWitch__Fv", SN_NOWARN) set_name(0x80066094, "S_ScrollWBuy__Fi", SN_NOWARN) set_name(0x8006626C, "S_StartWBuy__Fv", SN_NOWARN) set_name(0x80066398, "WitchSellOk__Fi", SN_NOWARN) set_name(0x800664BC, "S_StartWSell__Fv", SN_NOWARN) set_name(0x80066B14, "WitchRechargeOk__Fi", SN_NOWARN) set_name(0x80066B9C, "AddStoreHoldRecharge__FG10ItemStructi", SN_NOWARN) set_name(0x80066D1C, "S_StartWRecharge__Fv", SN_NOWARN) set_name(0x8006713C, "S_StartNoMoney__Fv", SN_NOWARN) set_name(0x800671A4, "S_StartNoRoom__Fv", SN_NOWARN) set_name(0x80067204, "S_StartConfirm__Fv", SN_NOWARN) set_name(0x8006757C, "S_StartBoy__Fv", SN_NOWARN) set_name(0x8006770C, "S_StartBBoy__Fv", SN_NOWARN) set_name(0x80067894, "S_StartHealer__Fv", SN_NOWARN) set_name(0x80067A68, "S_ScrollHBuy__Fi", SN_NOWARN) set_name(0x80067BD4, "S_StartHBuy__Fv", SN_NOWARN) set_name(0x80067CF4, "S_StartStory__Fv", SN_NOWARN) set_name(0x80067DE4, "IdItemOk__FP10ItemStruct", SN_NOWARN) set_name(0x80067E18, "AddStoreHoldId__FG10ItemStructi", SN_NOWARN) set_name(0x80067EEC, "S_StartSIdentify__Fv", SN_NOWARN) set_name(0x8006894C, "S_StartIdShow__Fv", SN_NOWARN) set_name(0x80068B20, "S_StartTalk__Fv", SN_NOWARN) set_name(0x80068D50, "S_StartTavern__Fv", SN_NOWARN) set_name(0x80068E48, "S_StartBarMaid__Fv", SN_NOWARN) set_name(0x80068F1C, "S_StartDrunk__Fv", SN_NOWARN) set_name(0x80068FF0, "StartStore__Fc", SN_NOWARN) set_name(0x800692D8, "DrawSText__Fv", SN_NOWARN) set_name(0x80069318, "DrawSTextTSK__FP4TASK", SN_NOWARN) set_name(0x800693E0, "DoThatDrawSText__Fv", SN_NOWARN) set_name(0x8006958C, "STextESC__Fv", SN_NOWARN) set_name(0x80069700, "STextUp__Fv", SN_NOWARN) set_name(0x80069898, "STextDown__Fv", SN_NOWARN) set_name(0x80069A48, "S_SmithEnter__Fv", SN_NOWARN) set_name(0x80069B1C, "SetGoldCurs__Fii", SN_NOWARN) set_name(0x80069B98, "SetSpdbarGoldCurs__Fii", SN_NOWARN) set_name(0x80069C14, "TakePlrsMoney__Fl", SN_NOWARN) set_name(0x8006A060, "SmithBuyItem__Fv", SN_NOWARN) set_name(0x8006A254, "S_SBuyEnter__Fv", SN_NOWARN) set_name(0x8006A478, "SmithBuyPItem__Fv", SN_NOWARN) set_name(0x8006A600, "S_SPBuyEnter__Fv", SN_NOWARN) set_name(0x8006A830, "StoreGoldFit__Fi", SN_NOWARN) set_name(0x8006AAE8, "PlaceStoreGold__Fl", SN_NOWARN) set_name(0x8006AD4C, "StoreSellItem__Fv", SN_NOWARN) set_name(0x8006B040, "S_SSellEnter__Fv", SN_NOWARN) set_name(0x8006B144, "SmithRepairItem__Fv", SN_NOWARN) set_name(0x8006B3B4, "S_SRepairEnter__Fv", SN_NOWARN) set_name(0x8006B510, "S_WitchEnter__Fv", SN_NOWARN) set_name(0x8006B5C0, "WitchBuyItem__Fv", SN_NOWARN) set_name(0x8006B7C0, "S_WBuyEnter__Fv", SN_NOWARN) set_name(0x8006B9AC, "S_WSellEnter__Fv", SN_NOWARN) set_name(0x8006BAB0, "WitchRechargeItem__Fv", SN_NOWARN) set_name(0x8006BC28, "S_WRechargeEnter__Fv", SN_NOWARN) set_name(0x8006BD84, "S_BoyEnter__Fv", SN_NOWARN) set_name(0x8006BEBC, "BoyBuyItem__Fv", SN_NOWARN) set_name(0x8006BF40, "HealerBuyItem__Fv", SN_NOWARN) set_name(0x8006C1E4, "S_BBuyEnter__Fv", SN_NOWARN) set_name(0x8006C3CC, "StoryIdItem__Fv", SN_NOWARN) set_name(0x8006C718, "S_ConfirmEnter__Fv", SN_NOWARN) set_name(0x8006C834, "S_HealerEnter__Fv", SN_NOWARN) set_name(0x8006C8CC, "S_HBuyEnter__Fv", SN_NOWARN) set_name(0x8006CAD8, "S_StoryEnter__Fv", SN_NOWARN) set_name(0x8006CB70, "S_SIDEnter__Fv", SN_NOWARN) set_name(0x8006CCEC, "S_TalkEnter__Fv", SN_NOWARN) set_name(0x8006CEE4, "S_TavernEnter__Fv", SN_NOWARN) set_name(0x8006CF54, "S_BarmaidEnter__Fv", SN_NOWARN) set_name(0x8006CFC4, "S_DrunkEnter__Fv", SN_NOWARN) set_name(0x8006D034, "STextEnter__Fv", SN_NOWARN) set_name(0x8006D1F8, "CheckStoreBtn__Fv", SN_NOWARN) set_name(0x8006D2D0, "ReleaseStoreBtn__Fv", SN_NOWARN) set_name(0x8006D2E4, "_GLOBAL__D_pSTextBoxCels", SN_NOWARN) set_name(0x8006D30C, "_GLOBAL__I_pSTextBoxCels", SN_NOWARN) set_name(0x8006D334, "GetDown__C4CPad_addr_8006D334", SN_NOWARN) set_name(0x8006D35C, "SetRGB__6DialogUcUcUc_addr_8006D35C", SN_NOWARN) set_name(0x8006D37C, "SetBorder__6Dialogi_addr_8006D37C", SN_NOWARN) set_name(0x8006D384, "___6Dialog_addr_8006D384", SN_NOWARN) set_name(0x8006D3AC, "__6Dialog_addr_8006D3AC", SN_NOWARN) set_name(0x8006D408, "T_DrawView__Fii", SN_NOWARN) set_name(0x8006D5B8, "T_FillSector__FPUcT0iiiib", SN_NOWARN) set_name(0x8006D7B0, "T_FillTile__FPUciii", SN_NOWARN) set_name(0x8006D8A0, "T_Pass3__Fv", SN_NOWARN) set_name(0x8006DC60, "CreateTown__Fi", SN_NOWARN) set_name(0x8006DDC8, "GRL_LoadFileInMemSig__FPCcPUl", SN_NOWARN) set_name(0x8006DEAC, "GRL_StripDir__FPcPCc", SN_NOWARN) set_name(0x8006DF44, "InitVPTriggers__Fv", SN_NOWARN) set_name(0x8006DF8C, "ForceTownTrig__Fv", SN_NOWARN) set_name(0x8006E2A4, "ForceL1Trig__Fv", SN_NOWARN) set_name(0x8006E554, "ForceL2Trig__Fv", SN_NOWARN) set_name(0x8006E9B4, "ForceL3Trig__Fv", SN_NOWARN) set_name(0x8006EE30, "ForceL4Trig__Fv", SN_NOWARN) set_name(0x8006F33C, "Freeupstairs__Fv", SN_NOWARN) set_name(0x8006F3FC, "ForceSKingTrig__Fv", SN_NOWARN) set_name(0x8006F4F0, "ForceSChambTrig__Fv", SN_NOWARN) set_name(0x8006F5E4, "ForcePWaterTrig__Fv", SN_NOWARN) set_name(0x8006F6D8, "CheckTrigForce__Fv", SN_NOWARN) set_name(0x8006F9E0, "FadeGameOut__Fv", SN_NOWARN) set_name(0x8006FA7C, "IsTrigger__Fii", SN_NOWARN) set_name(0x8006FAE0, "CheckTriggers__Fi", SN_NOWARN) set_name(0x8006FFFC, "GetManaAmount__Fii", SN_NOWARN) set_name(0x800702C4, "UseMana__Fii", SN_NOWARN) set_name(0x80070408, "CheckSpell__FiicUc", SN_NOWARN) set_name(0x800704A8, "CastSpell__Fiiiiiiii", SN_NOWARN) set_name(0x80070754, "DoResurrect__Fii", SN_NOWARN) set_name(0x80070A08, "DoHealOther__Fii", SN_NOWARN) set_name(0x80070C6C, "snd_update__FUc", SN_NOWARN) set_name(0x80070C74, "snd_get_volume__FPCcPl", SN_NOWARN) set_name(0x80070CDC, "snd_stop_snd__FP4TSnd", SN_NOWARN) set_name(0x80070CFC, "snd_play_snd__FP4TSFXll", SN_NOWARN) set_name(0x80070D5C, "snd_play_msnd__FUsll", SN_NOWARN) set_name(0x80070DEC, "snd_init__FUl", SN_NOWARN) set_name(0x80070E3C, "music_stop__Fv", SN_NOWARN) set_name(0x80070E80, "music_fade__Fv", SN_NOWARN) set_name(0x80070EC0, "music_start__Fi", SN_NOWARN) set_name(0x80070F44, "music_hold__Fv", SN_NOWARN) set_name(0x80070FA4, "music_release__Fv", SN_NOWARN) set_name(0x80070FF4, "snd_playing__Fi", SN_NOWARN) set_name(0x80071014, "ClrCursor__Fi", SN_NOWARN) set_name(0x80071064, "flyabout__7GamePad", SN_NOWARN) set_name(0x80071520, "CloseInvChr__Fv", SN_NOWARN) set_name(0x80071570, "LeftOf__Fi", SN_NOWARN) set_name(0x80071588, "RightOf__Fi", SN_NOWARN) set_name(0x800715A4, "WorldToOffset__Fiii", SN_NOWARN) set_name(0x80071650, "pad_UpIsUpRight__Fic", SN_NOWARN) set_name(0x80071714, "__7GamePadi", SN_NOWARN) set_name(0x80071808, "SetMoveStyle__7GamePadc", SN_NOWARN) set_name(0x80071810, "SetDownButton__7GamePadiPFi_v", SN_NOWARN) set_name(0x80071854, "SetComboDownButton__7GamePadiPFi_v", SN_NOWARN) set_name(0x80071898, "SetAllButtons__7GamePadP11KEY_ASSIGNS", SN_NOWARN) set_name(0x80071AF8, "GetAllButtons__7GamePadP11KEY_ASSIGNS", SN_NOWARN) set_name(0x80071CA8, "GetActionButton__7GamePadPFi_v", SN_NOWARN) set_name(0x80071D04, "SetUpAction__7GamePadPFi_vT1", SN_NOWARN) set_name(0x80071D40, "RunFunc__7GamePadi", SN_NOWARN) set_name(0x80071E04, "ButtonDown__7GamePadi", SN_NOWARN) set_name(0x80072210, "TestButtons__7GamePad", SN_NOWARN) set_name(0x80072354, "CheckCentre__FP12PlayerStructi", SN_NOWARN) set_name(0x80072448, "CheckDirs__7GamePadi", SN_NOWARN) set_name(0x80072560, "CheckSide__7GamePadi", SN_NOWARN) set_name(0x800725B4, "CheckBodge__7GamePadi", SN_NOWARN) set_name(0x800729C0, "walk__7GamePadc", SN_NOWARN) set_name(0x80072CD8, "check_around_player__7GamePad", SN_NOWARN) set_name(0x800730B8, "show_combos__7GamePad", SN_NOWARN) set_name(0x80073258, "Handle__7GamePad", SN_NOWARN) set_name(0x80073930, "GamePadTask__FP4TASK", SN_NOWARN) set_name(0x800739FC, "PostGamePad__Fiiii", SN_NOWARN) set_name(0x80073B0C, "Init_GamePad__Fv", SN_NOWARN) set_name(0x80073B3C, "InitGamePadVars__Fv", SN_NOWARN) set_name(0x80073BCC, "SetWalkStyle__Fii", SN_NOWARN) set_name(0x80073C3C, "GetPadStyle__Fi", SN_NOWARN) set_name(0x80073C60, "_GLOBAL__I_flyflag", SN_NOWARN) set_name(0x80073C98, "MoveToScrollTarget__7CBlocks_addr_80073C98", SN_NOWARN) set_name(0x80073CAC, "GetDown__C4CPad_addr_80073CAC", SN_NOWARN) set_name(0x80073CD4, "GetUp__C4CPad_addr_80073CD4", SN_NOWARN) set_name(0x80073CFC, "GetCur__C4CPad_addr_80073CFC", SN_NOWARN) set_name(0x80073D24, "DoGameTestStuff__Fv", SN_NOWARN) set_name(0x80073D50, "DoInitGameStuff__Fv", SN_NOWARN) set_name(0x80073D84, "SMemAlloc", SN_NOWARN) set_name(0x80073DA4, "SMemFree", SN_NOWARN) set_name(0x80073DC4, "GRL_InitGwin__Fv", SN_NOWARN) set_name(0x80073DD0, "GRL_SetWindowProc__FPFUlUilUl_Ul", SN_NOWARN) set_name(0x80073DE0, "GRL_CallWindowProc__FUlUilUl", SN_NOWARN) set_name(0x80073E08, "GRL_PostMessage__FUlUilUl", SN_NOWARN) set_name(0x80073EB4, "Msg2Txt__Fi", SN_NOWARN) set_name(0x80073EFC, "LANG_GetLang__Fv", SN_NOWARN) set_name(0x80073F08, "LANG_SetDb__F10LANG_DB_NO", SN_NOWARN) set_name(0x80074074, "GetStr__Fi", SN_NOWARN) set_name(0x800740DC, "LANG_ReloadMainTXT__Fv", SN_NOWARN) set_name(0x80074110, "LANG_SetLang__F9LANG_TYPE", SN_NOWARN) set_name(0x80074274, "DumpCurrentText__Fv", SN_NOWARN) set_name(0x800742CC, "CalcNumOfStrings__FPPc", SN_NOWARN) set_name(0x800742D8, "GetLangFileName__F9LANG_TYPEPc", SN_NOWARN) set_name(0x800743A0, "GetLangFileNameExt__F9LANG_TYPE", SN_NOWARN) set_name(0x80074420, "TempPrintMissile__FiiiiiiiiccUcUcUcc", SN_NOWARN) set_name(0x80074858, "FuncTOWN__FP13MissileStructiii", SN_NOWARN) set_name(0x800749D8, "FuncRPORTAL__FP13MissileStructiii", SN_NOWARN) set_name(0x80074B38, "FuncFIREBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80074BD0, "FuncHBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80074C80, "FuncLIGHTNING__FP13MissileStructiii", SN_NOWARN) set_name(0x80074CE4, "FuncGUARDIAN__FP13MissileStructiii", SN_NOWARN) set_name(0x80074DFC, "FuncFIREWALL__FP13MissileStructiii", SN_NOWARN) set_name(0x80074E94, "FuncFIREMOVE__FP13MissileStructiii", SN_NOWARN) set_name(0x80074F2C, "FuncFLAME__FP13MissileStructiii", SN_NOWARN) set_name(0x80074F94, "FuncARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x80075034, "FuncFARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x80075114, "FuncLARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x800751EC, "FuncMAGMABALL__FP13MissileStructiii", SN_NOWARN) set_name(0x8007527C, "FuncBONESPIRIT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075398, "FuncACID__FP13MissileStructiii", SN_NOWARN) set_name(0x80075434, "FuncACIDSPLAT__FP13MissileStructiii", SN_NOWARN) set_name(0x8007549C, "FuncACIDPUD__FP13MissileStructiii", SN_NOWARN) set_name(0x80075504, "FuncFLARE__FP13MissileStructiii", SN_NOWARN) set_name(0x80075668, "FuncFLAREXP__FP13MissileStructiii", SN_NOWARN) set_name(0x800757AC, "FuncCBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075814, "FuncBOOM__FP13MissileStructiii", SN_NOWARN) set_name(0x8007586C, "FuncELEMENT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075938, "FuncMISEXP__FP13MissileStructiii", SN_NOWARN) set_name(0x8007599C, "FuncRHINO__FP13MissileStructiii", SN_NOWARN) set_name(0x800759A4, "FuncFLASH__FP13MissileStructiii", SN_NOWARN) set_name(0x80075ECC, "FuncMANASHIELD__FP13MissileStructiii", SN_NOWARN) set_name(0x80075F74, "FuncFLASH2__FP13MissileStructiii", SN_NOWARN) set_name(0x80075F7C, "FuncRESURRECTBEAM__FP13MissileStructiii", SN_NOWARN) set_name(0x80075FB0, "FuncWEAPEXP__FP13MissileStructiii", SN_NOWARN) set_name(0x80075FD4, "PRIM_GetPrim__FPP8POLY_FT4_addr_80075FD4", SN_NOWARN) set_name(0x80076050, "GetPlayer__7CPlayeri_addr_80076050", SN_NOWARN) set_name(0x800760A0, "GetLastOtPos__C7CPlayer_addr_800760A0", SN_NOWARN) set_name(0x800760AC, "GetLastScrY__C7CPlayer_addr_800760AC", SN_NOWARN) set_name(0x800760B8, "GetLastScrX__C7CPlayer_addr_800760B8", SN_NOWARN) set_name(0x800760C4, "GetNumOfFrames__7TextDat_addr_800760C4", SN_NOWARN) set_name(0x800760D8, "GetFr__7TextDati_addr_800760D8", SN_NOWARN) set_name(0x800760F4, "ML_Init__Fv", SN_NOWARN) set_name(0x8007612C, "ML_GetList__Fi", SN_NOWARN) set_name(0x800761AC, "ML_SetRandomList__Fi", SN_NOWARN) set_name(0x80076244, "ML_SetList__Fii", SN_NOWARN) set_name(0x800762F4, "ML_GetPresetMonsters__FiPiUl", SN_NOWARN) set_name(0x800764B0, "DefaultObjPrint__FP12ObjectStructiiP7TextDatiii", SN_NOWARN) set_name(0x80076644, "LightObjPrint__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800766FC, "DoorObjPrint__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076990, "DrawLightSpark__Fiii", SN_NOWARN) set_name(0x80076A68, "PrintOBJ_L1LIGHT__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076AF0, "PrintOBJ_SKFIRE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B1C, "PrintOBJ_LEVER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B48, "PrintOBJ_CHEST1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B74, "PrintOBJ_CHEST2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BA0, "PrintOBJ_CHEST3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BCC, "PrintOBJ_CANDLE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BF0, "PrintOBJ_CANDLE2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C14, "PrintOBJ_CANDLEO__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C40, "PrintOBJ_BANNERL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C6C, "PrintOBJ_BANNERM__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C98, "PrintOBJ_BANNERR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076CC4, "PrintOBJ_SKPILE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076CF0, "PrintOBJ_SKSTICK1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D1C, "PrintOBJ_SKSTICK2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D48, "PrintOBJ_SKSTICK3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D74, "PrintOBJ_SKSTICK4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DA0, "PrintOBJ_SKSTICK5__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DCC, "PrintOBJ_CRUX1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DF8, "PrintOBJ_CRUX2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E24, "PrintOBJ_CRUX3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E50, "PrintOBJ_STAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E7C, "PrintOBJ_ANGEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076EA8, "PrintOBJ_BOOK2L__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076ED4, "PrintOBJ_BCROSS__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F00, "PrintOBJ_NUDEW2R__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F2C, "PrintOBJ_SWITCHSKL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F58, "PrintOBJ_TNUDEM1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F84, "PrintOBJ_TNUDEM2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076FB0, "PrintOBJ_TNUDEM3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076FDC, "PrintOBJ_TNUDEM4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077008, "PrintOBJ_TNUDEW1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077034, "PrintOBJ_TNUDEW2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077060, "PrintOBJ_TNUDEW3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007708C, "PrintOBJ_TORTURE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800770B8, "PrintOBJ_TORTURE2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800770E4, "PrintOBJ_TORTURE3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077110, "PrintOBJ_TORTURE4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007713C, "PrintOBJ_TORTURE5__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077168, "PrintOBJ_BOOK2R__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077194, "PrintTorchStick__Fiiii", SN_NOWARN) set_name(0x80077228, "PrintOBJ_TORCHL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800772B8, "PrintOBJ_TORCHR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077348, "PrintOBJ_TORCHL2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800773D8, "PrintOBJ_TORCHR2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077468, "PrintOBJ_SARC__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077494, "PrintOBJ_FLAMEHOLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800774C0, "PrintOBJ_FLAMELVR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800774EC, "PrintOBJ_WATER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077518, "PrintOBJ_BOOKLVR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077544, "PrintOBJ_TRAPL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077570, "PrintOBJ_TRAPR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007759C, "PrintOBJ_BOOKSHELF__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800775C8, "PrintOBJ_WEAPRACK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800775F4, "PrintOBJ_BARREL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077620, "PrintOBJ_BARRELEX__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077778, "PrintOBJ_SHRINEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077844, "PrintOBJ_SHRINER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077910, "PrintOBJ_SKELBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007793C, "PrintOBJ_BOOKCASEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077968, "PrintOBJ_BOOKCASER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077994, "PrintOBJ_BOOKSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800779C0, "PrintOBJ_BOOKCANDLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800779E4, "PrintOBJ_BLOODFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A10, "PrintOBJ_DECAP__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A3C, "PrintOBJ_TCHEST1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A68, "PrintOBJ_TCHEST2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A94, "PrintOBJ_TCHEST3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077AC0, "PrintOBJ_BLINDBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077AEC, "PrintOBJ_BLOODBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B18, "PrintOBJ_PEDISTAL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B44, "PrintOBJ_PURIFYINGFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B70, "PrintOBJ_ARMORSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B9C, "PrintOBJ_ARMORSTANDN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077BC8, "PrintOBJ_GOATSHRINE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077BF4, "PrintOBJ_CAULDRON__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C20, "PrintOBJ_MURKYFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C4C, "PrintOBJ_TEARFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C78, "PrintOBJ_ALTBOY__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077CA4, "PrintOBJ_MCIRCLE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077E38, "PrintOBJ_STORYBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077FC0, "PrintOBJ_STORYCANDLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077FE4, "PrintOBJ_STEELTOME__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078010, "PrintOBJ_WARARMOR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007803C, "PrintOBJ_WARWEAP__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078068, "PrintOBJ_TBCROSS__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078094, "PrintOBJ_WEAPONRACK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800780C0, "PrintOBJ_WEAPONRACKN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800780EC, "PrintOBJ_MUSHPATCH__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078118, "PrintOBJ_LAZSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078144, "PrintOBJ_SLAINHERO__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078170, "PrintOBJ_SIGNCHEST__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007819C, "PRIM_GetCopy__FP8POLY_FT4_addr_8007819C", SN_NOWARN) set_name(0x800781D8, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_800781D8", SN_NOWARN) set_name(0x80078200, "PRIM_GetPrim__FPP8POLY_FT4_addr_80078200", SN_NOWARN) set_name(0x8007827C, "GetBlockTexDat__7CBlocks_addr_8007827C", SN_NOWARN) set_name(0x80078288, "GetNumOfFrames__7TextDatii_addr_80078288", SN_NOWARN) set_name(0x800782C0, "GetCreature__7TextDati_addr_800782C0", SN_NOWARN) set_name(0x80078338, "GetNumOfCreatures__7TextDat_addr_80078338", SN_NOWARN) set_name(0x8007834C, "GetFr__7TextDati_addr_8007834C", SN_NOWARN) set_name(0x80078368, "gamemenu_on__Fv", SN_NOWARN) set_name(0x80078370, "gamemenu_off__Fv", SN_NOWARN) set_name(0x80078378, "LoadPalette__FPCc", SN_NOWARN) set_name(0x80078380, "LoadRndLvlPal__Fi", SN_NOWARN) set_name(0x80078388, "ResetPal__Fv", SN_NOWARN) set_name(0x80078390, "SetFadeLevel__Fi", SN_NOWARN) set_name(0x800783C0, "GetFadeState__Fv", SN_NOWARN) set_name(0x800783CC, "SetPolyXY__FP8POLY_GT4PUc", SN_NOWARN) set_name(0x800784E8, "SmearScreen__Fv", SN_NOWARN) set_name(0x800784F0, "DrawFadedScreen__Fv", SN_NOWARN) set_name(0x80078544, "BlackPalette__Fv", SN_NOWARN) set_name(0x80078600, "PaletteFadeInTask__FP4TASK", SN_NOWARN) set_name(0x80078690, "PaletteFadeIn__Fi", SN_NOWARN) set_name(0x800786E8, "PaletteFadeOutTask__FP4TASK", SN_NOWARN) set_name(0x80078798, "PaletteFadeOut__Fi", SN_NOWARN) set_name(0x800787EC, "M_CheckEFlag__Fi", SN_NOWARN) set_name(0x8007880C, "M_ClearSquares__Fi", SN_NOWARN) set_name(0x80078978, "IsSkel__Fi", SN_NOWARN) set_name(0x800789B4, "NewMonsterAnim__FiR10AnimStructii", SN_NOWARN) set_name(0x80078A00, "M_Ranged__Fi", SN_NOWARN) set_name(0x80078A48, "M_Talker__Fi", SN_NOWARN) set_name(0x80078AA8, "M_Enemy__Fi", SN_NOWARN) set_name(0x8007901C, "ClearMVars__Fi", SN_NOWARN) set_name(0x80079090, "InitMonster__Fiiiii", SN_NOWARN) set_name(0x800794DC, "AddMonster__FiiiiUc", SN_NOWARN) set_name(0x8007958C, "M_StartStand__Fii", SN_NOWARN) set_name(0x800796D0, "M_UpdateLeader__Fi", SN_NOWARN) set_name(0x800797C8, "ActivateSpawn__Fiiii", SN_NOWARN) set_name(0x80079870, "SpawnSkeleton__Fiii", SN_NOWARN) set_name(0x80079A60, "M_StartSpStand__Fii", SN_NOWARN) set_name(0x80079B40, "PosOkMonst__Fiii", SN_NOWARN) set_name(0x80079DBC, "CanPut__Fii", SN_NOWARN) set_name(0x8007A0C4, "GetAutomapType__FiiUc", SN_NOWARN) set_name(0x8007A3C0, "SetAutomapView__Fii", SN_NOWARN) set_name(0x8007A810, "lAddMissile__Fiiici", SN_NOWARN) set_name(0x8007A9E4, "AddWarpMissile__Fiii", SN_NOWARN) set_name(0x8007AB2C, "SyncPortals__Fv", SN_NOWARN) set_name(0x8007AC34, "AddInTownPortal__Fi", SN_NOWARN) set_name(0x8007AC6C, "ActivatePortal__FiiiiiUc", SN_NOWARN) set_name(0x8007ACDC, "DeactivatePortal__Fi", SN_NOWARN) set_name(0x8007ACFC, "PortalOnLevel__Fi", SN_NOWARN) set_name(0x8007AD34, "DelMis__Fii", SN_NOWARN) set_name(0x8007AD94, "RemovePortalMissile__Fi", SN_NOWARN) set_name(0x8007AF10, "SetCurrentPortal__Fi", SN_NOWARN) set_name(0x8007AF1C, "GetPortalLevel__Fv", SN_NOWARN) set_name(0x8007B0C0, "GetPortalLvlPos__Fv", SN_NOWARN) set_name(0x8007B170, "__13CompLevelMaps", SN_NOWARN) set_name(0x8007B1D8, "___13CompLevelMaps", SN_NOWARN) set_name(0x8007B258, "Init__13CompLevelMaps", SN_NOWARN) set_name(0x8007B288, "InitAllMaps__13CompLevelMaps", SN_NOWARN) set_name(0x8007B2D0, "GetMap__13CompLevelMapsi", SN_NOWARN) set_name(0x8007B344, "ReleaseMap__13CompLevelMapsP6DLevel", SN_NOWARN) set_name(0x8007B3E8, "Init__4AMap", SN_NOWARN) set_name(0x8007B450, "GetMap__4AMap", SN_NOWARN) set_name(0x8007B570, "ReleaseMap__4AMapP6DLevel", SN_NOWARN) set_name(0x8007B600, "CheckMapNum__13CompLevelMapsi", SN_NOWARN) set_name(0x8007B634, "___4AMap", SN_NOWARN) set_name(0x8007B67C, "__4AMap", SN_NOWARN) set_name(0x8007B6B0, "GO_DoGameOver__Fv", SN_NOWARN) set_name(0x8007B6F4, "GameOverTask__FP4TASK", SN_NOWARN) set_name(0x8007B7B0, "PrintGameOver__Fv", SN_NOWARN) set_name(0x8007B890, "SetRGB__6DialogUcUcUc_addr_8007B890", SN_NOWARN) set_name(0x8007B8B0, "SetBack__6Dialogi_addr_8007B8B0", SN_NOWARN) set_name(0x8007B8B8, "SetBorder__6Dialogi_addr_8007B8B8", SN_NOWARN) set_name(0x8007B8C0, "___6Dialog_addr_8007B8C0", SN_NOWARN) set_name(0x8007B8E8, "__6Dialog_addr_8007B8E8", SN_NOWARN) set_name(0x8007B944, "VER_InitVersion__Fv", SN_NOWARN) set_name(0x8007B988, "VER_GetVerString__Fv", SN_NOWARN) set_name(0x8007B998, "CharPair2Num__FPc", SN_NOWARN) set_name(0x8001E6A8, "TICK_InitModule", SN_NOWARN) set_name(0x8001E6C8, "TICK_Set", SN_NOWARN) set_name(0x8001E6D8, "TICK_Get", SN_NOWARN) set_name(0x8001E6E8, "TICK_Update", SN_NOWARN) set_name(0x8001E708, "TICK_GetAge", SN_NOWARN) set_name(0x8001E734, "TICK_GetDateString", SN_NOWARN) set_name(0x8001E744, "TICK_GetTimeString", SN_NOWARN) set_name(0x8001E754, "GU_InitModule", SN_NOWARN) set_name(0x8001E780, "GU_SetRndSeed", SN_NOWARN) set_name(0x8001E7B0, "GU_GetRnd", SN_NOWARN) set_name(0x8001E840, "GU_GetSRnd", SN_NOWARN) set_name(0x8001E860, "GU_GetRndRange", SN_NOWARN) set_name(0x8001E89C, "GU_AlignVal", SN_NOWARN) set_name(0x8001E8C0, "main", SN_NOWARN) set_name(0x8001E910, "DBG_OpenModule", SN_NOWARN) set_name(0x8001E918, "DBG_PollHost", SN_NOWARN) set_name(0x8001E920, "DBG_Halt", SN_NOWARN) set_name(0x8001E928, "DBG_SendMessage", SN_NOWARN) set_name(0x8001E940, "DBG_SetMessageHandler", SN_NOWARN) set_name(0x8001E950, "DBG_Error", SN_NOWARN) set_name(0x8001E97C, "DBG_SetErrorFunc", SN_NOWARN) set_name(0x8001E98C, "SendPsyqString", SN_NOWARN) set_name(0x8001E994, "DBG_SetPollRoutine", SN_NOWARN) set_name(0x8001E9A4, "GTIMSYS_GetTimer", SN_NOWARN) set_name(0x8001E9C8, "GTIMSYS_ResetTimer", SN_NOWARN) set_name(0x8001E9EC, "GTIMSYS_InitTimer", SN_NOWARN) set_name(0x8001EC20, "DoEpi", SN_NOWARN) set_name(0x8001EC70, "DoPro", SN_NOWARN) set_name(0x8001ECC0, "TSK_OpenModule", SN_NOWARN) set_name(0x8001ED34, "TSK_AddTask", SN_NOWARN) set_name(0x8001EF1C, "TSK_DoTasks", SN_NOWARN) set_name(0x8001F0DC, "TSK_Sleep", SN_NOWARN) set_name(0x8001F1B8, "ReturnToSchedulerIfCurrentTask", SN_NOWARN) set_name(0x8001F240, "TSK_Die", SN_NOWARN) set_name(0x8001F26C, "TSK_Kill", SN_NOWARN) set_name(0x8001F2BC, "TSK_GetFirstActive", SN_NOWARN) set_name(0x8001F2CC, "TSK_IsStackCorrupted", SN_NOWARN) set_name(0x8001F348, "TSK_JumpAndResetStack", SN_NOWARN) set_name(0x8001F390, "TSK_RepointProc", SN_NOWARN) set_name(0x8001F3D4, "TSK_GetCurrentTask", SN_NOWARN) set_name(0x8001F3E4, "TSK_IsCurrentTask", SN_NOWARN) set_name(0x8001F3FC, "TSK_Exist", SN_NOWARN) set_name(0x8001F454, "TSK_SetExecFilter", SN_NOWARN) set_name(0x8001F46C, "TSK_ClearExecFilter", SN_NOWARN) set_name(0x8001F490, "TSK_KillTasks", SN_NOWARN) set_name(0x8001F590, "TSK_IterateTasks", SN_NOWARN) set_name(0x8001F608, "TSK_MakeTaskInactive", SN_NOWARN) set_name(0x8001F61C, "TSK_MakeTaskActive", SN_NOWARN) set_name(0x8001F630, "TSK_MakeTaskImmortal", SN_NOWARN) set_name(0x8001F644, "TSK_MakeTaskMortal", SN_NOWARN) set_name(0x8001F658, "TSK_IsTaskActive", SN_NOWARN) set_name(0x8001F66C, "TSK_IsTaskMortal", SN_NOWARN) set_name(0x8001F680, "DetachFromList", SN_NOWARN) set_name(0x8001F6CC, "AddToList", SN_NOWARN) set_name(0x8001F6EC, "LoTskKill", SN_NOWARN) set_name(0x8001F75C, "ExecuteTask", SN_NOWARN) set_name(0x8001F7AC, "TSK_SetDoTasksPrologue", SN_NOWARN) set_name(0x8001F7C4, "TSK_SetDoTasksEpilogue", SN_NOWARN) set_name(0x8001F7DC, "TSK_SetTaskPrologue", SN_NOWARN) set_name(0x8001F7F4, "TSK_SetTaskEpilogue", SN_NOWARN) set_name(0x8001F80C, "TSK_SetEpiProFilter", SN_NOWARN) set_name(0x8001F824, "TSK_ClearEpiProFilter", SN_NOWARN) set_name(0x8001F858, "TSK_SetExtraStackProtection", SN_NOWARN) set_name(0x8001F868, "TSK_SetStackFloodCallback", SN_NOWARN) set_name(0x8001F880, "TSK_SetExtraStackSize", SN_NOWARN) set_name(0x8001F8A8, "ExtraMarkStack", SN_NOWARN) set_name(0x8001F8D4, "CheckExtraStack", SN_NOWARN) set_name(0x8001F910, "GSYS_GetWorkMemInfo", SN_NOWARN) set_name(0x8001F920, "GSYS_SetStackAndJump", SN_NOWARN) set_name(0x8001F95C, "GSYS_MarkStack", SN_NOWARN) set_name(0x8001F96C, "GSYS_IsStackCorrupted", SN_NOWARN) set_name(0x8001F984, "GSYS_InitMachine", SN_NOWARN) set_name(0x8001F9D8, "GSYS_CheckPtr", SN_NOWARN) set_name(0x8001FA0C, "GSYS_IsStackOutOfBounds", SN_NOWARN) set_name(0x8001FA88, "GAL_SetErrorChecking", SN_NOWARN) set_name(0x8001FA98, "GAL_SplitBlock", SN_NOWARN) set_name(0x8001FBCC, "GAL_InitModule", SN_NOWARN) set_name(0x8001FC84, "GAL_AddMemType", SN_NOWARN) set_name(0x8001FDA4, "GAL_Alloc", SN_NOWARN) set_name(0x8001FF3C, "GAL_Lock", SN_NOWARN) set_name(0x8001FF9C, "GAL_Unlock", SN_NOWARN) set_name(0x80020018, "GAL_Free", SN_NOWARN) set_name(0x800200B8, "GAL_GetFreeMem", SN_NOWARN) set_name(0x8002012C, "GAL_GetUsedMem", SN_NOWARN) set_name(0x800201A0, "GAL_LargestFreeBlock", SN_NOWARN) set_name(0x8002021C, "AttachHdrToList", SN_NOWARN) set_name(0x8002023C, "DetachHdrFromList", SN_NOWARN) set_name(0x80020288, "IsActiveValidHandle", SN_NOWARN) set_name(0x800202B8, "AlignPtr", SN_NOWARN) set_name(0x800202E8, "AlignSize", SN_NOWARN) set_name(0x80020318, "FindClosestSizedBlock", SN_NOWARN) set_name(0x80020370, "FindHighestMemBlock", SN_NOWARN) set_name(0x800203D8, "FindLowestMemBlock", SN_NOWARN) set_name(0x80020440, "GetMemInitInfoBlockFromType", SN_NOWARN) set_name(0x8002047C, "MergeToEmptyList", SN_NOWARN) set_name(0x80020550, "GAL_AllocAt", SN_NOWARN) set_name(0x8002062C, "LoAlloc", SN_NOWARN) set_name(0x800207C4, "FindBlockInTheseBounds", SN_NOWARN) set_name(0x80020830, "GetFreeMemHdrBlock", SN_NOWARN) set_name(0x800208B8, "ReleaseMemHdrBlock", SN_NOWARN) set_name(0x800208F8, "GAL_IterateEmptyMem", SN_NOWARN) set_name(0x8002097C, "GAL_IterateUsedMem", SN_NOWARN) set_name(0x80020A18, "GAL_SetMemName", SN_NOWARN) set_name(0x80020A80, "GAL_TotalMem", SN_NOWARN) set_name(0x80020AD4, "GAL_MemBase", SN_NOWARN) set_name(0x80020B28, "GAL_DefragMem", SN_NOWARN) set_name(0x80020BAC, "GSetError", SN_NOWARN) set_name(0x80020C08, "GAL_CheckMem", SN_NOWARN) set_name(0x80020D04, "CheckCollisions", SN_NOWARN) set_name(0x80020DB0, "AreBlocksColliding", SN_NOWARN) set_name(0x80020E08, "GAL_GetErrorText", SN_NOWARN) set_name(0x80020E38, "GAL_GetLastErrorCode", SN_NOWARN) set_name(0x80020E48, "GAL_GetLastErrorText", SN_NOWARN) set_name(0x80020E70, "GAL_HowManyEmptyRegions", SN_NOWARN) set_name(0x80020ED8, "GAL_HowManyUsedRegions", SN_NOWARN) set_name(0x80020F40, "GAL_SetTimeStamp", SN_NOWARN) set_name(0x80020F50, "GAL_IncTimeStamp", SN_NOWARN) set_name(0x80020F70, "GAL_GetTimeStamp", SN_NOWARN) set_name(0x80020F80, "GAL_AlignSizeToType", SN_NOWARN) set_name(0x80020FD0, "GAL_AllocMultiStruct", SN_NOWARN) set_name(0x80021020, "GAL_ProcessMultiStruct", SN_NOWARN) set_name(0x800210CC, "GAL_GetSize", SN_NOWARN) set_name(0x80021120, "GazDefragMem", SN_NOWARN) set_name(0x80021288, "PutBlocksInRegionIntoList", SN_NOWARN) set_name(0x8002132C, "CollideRegions", SN_NOWARN) set_name(0x80021360, "DeleteEmptyBlocks", SN_NOWARN) set_name(0x800213CC, "GetRegion", SN_NOWARN) set_name(0x800214C4, "FindNextBlock", SN_NOWARN) set_name(0x80021500, "ShuffleBlocks", SN_NOWARN) set_name(0x80021590, "PutAllLockedBlocksOntoList", SN_NOWARN) set_name(0x8002160C, "SortMemHdrListByAddr", SN_NOWARN) set_name(0x800216C0, "GraftMemHdrList", SN_NOWARN) set_name(0x8002171C, "GAL_MemDump", SN_NOWARN) set_name(0x80021790, "GAL_SetVerbosity", SN_NOWARN) set_name(0x800217A0, "CountFreeBlocks", SN_NOWARN) set_name(0x800217CC, "SetBlockName", SN_NOWARN) set_name(0x80021814, "GAL_GetNumFreeHeaders", SN_NOWARN) set_name(0x80021824, "GAL_GetLastTypeAlloced", SN_NOWARN) set_name(0x80021834, "GAL_SetAllocFilter", SN_NOWARN) set_name(0x8002184C, "GAL_SortUsedRegionsBySize", SN_NOWARN) set_name(0x800218A0, "SortSize", SN_NOWARN) set_name(0x800218B0, "SortMemHdrList", SN_NOWARN) set_name(0x80023C6C, "vsprintf", SN_NOWARN) set_name(0x80023CB8, "_doprnt", SN_NOWARN) set_name(0x8012CDC8, "NumOfMonsterListLevels", SN_NOWARN) set_name(0x800A9BE0, "AllLevels", SN_NOWARN) set_name(0x8012CAAC, "NumsLEV1M1A", SN_NOWARN) set_name(0x8012CAB0, "NumsLEV1M1B", SN_NOWARN) set_name(0x8012CAB4, "NumsLEV1M1C", SN_NOWARN) set_name(0x8012CABC, "NumsLEV2M2A", SN_NOWARN) set_name(0x8012CAC0, "NumsLEV2M2B", SN_NOWARN) set_name(0x8012CAC4, "NumsLEV2M2C", SN_NOWARN) set_name(0x8012CAC8, "NumsLEV2M2D", SN_NOWARN) set_name(0x8012CACC, "NumsLEV2M2QA", SN_NOWARN) set_name(0x8012CAD0, "NumsLEV2M2QB", SN_NOWARN) set_name(0x8012CAD4, "NumsLEV3M3A", SN_NOWARN) set_name(0x8012CAD8, "NumsLEV3M3QA", SN_NOWARN) set_name(0x8012CADC, "NumsLEV3M3B", SN_NOWARN) set_name(0x8012CAE0, "NumsLEV3M3C", SN_NOWARN) set_name(0x8012CAE4, "NumsLEV4M4A", SN_NOWARN) set_name(0x8012CAE8, "NumsLEV4M4QA", SN_NOWARN) set_name(0x8012CAEC, "NumsLEV4M4B", SN_NOWARN) set_name(0x8012CAF0, "NumsLEV4M4QB", SN_NOWARN) set_name(0x8012CAF8, "NumsLEV4M4C", SN_NOWARN) set_name(0x8012CAFC, "NumsLEV4M4QC", SN_NOWARN) set_name(0x8012CB04, "NumsLEV4M4D", SN_NOWARN) set_name(0x8012CB08, "NumsLEV5M5A", SN_NOWARN) set_name(0x8012CB0C, "NumsLEV5M5B", SN_NOWARN) set_name(0x8012CB10, "NumsLEV5M5C", SN_NOWARN) set_name(0x8012CB14, "NumsLEV5M5D", SN_NOWARN) set_name(0x8012CB18, "NumsLEV5M5E", SN_NOWARN) set_name(0x8012CB1C, "NumsLEV5M5F", SN_NOWARN) set_name(0x8012CB20, "NumsLEV5M5QA", SN_NOWARN) set_name(0x8012CB24, "NumsLEV6M6A", SN_NOWARN) set_name(0x8012CB2C, "NumsLEV6M6B", SN_NOWARN) set_name(0x8012CB30, "NumsLEV6M6C", SN_NOWARN) set_name(0x8012CB34, "NumsLEV6M6D", SN_NOWARN) set_name(0x8012CB38, "NumsLEV6M6E", SN_NOWARN) set_name(0x8012CB3C, "NumsLEV6M6QA", SN_NOWARN) set_name(0x8012CB40, "NumsLEV7M7A", SN_NOWARN) set_name(0x8012CB44, "NumsLEV7M7B", SN_NOWARN) set_name(0x8012CB48, "NumsLEV7M7C", SN_NOWARN) set_name(0x8012CB4C, "NumsLEV7M7D", SN_NOWARN) set_name(0x8012CB50, "NumsLEV7M7E", SN_NOWARN) set_name(0x8012CB54, "NumsLEV8M8QA", SN_NOWARN) set_name(0x8012CB58, "NumsLEV8M8A", SN_NOWARN) set_name(0x8012CB5C, "NumsLEV8M8B", SN_NOWARN) set_name(0x8012CB60, "NumsLEV8M8C", SN_NOWARN) set_name(0x8012CB64, "NumsLEV8M8D", SN_NOWARN) set_name(0x8012CB68, "NumsLEV8M8E", SN_NOWARN) set_name(0x8012CB6C, "NumsLEV9M9A", SN_NOWARN) set_name(0x8012CB70, "NumsLEV9M9B", SN_NOWARN) set_name(0x8012CB74, "NumsLEV9M9C", SN_NOWARN) set_name(0x8012CB78, "NumsLEV9M9D", SN_NOWARN) set_name(0x8012CB7C, "NumsLEV10M10A", SN_NOWARN) set_name(0x8012CB80, "NumsLEV10M10B", SN_NOWARN) set_name(0x8012CB84, "NumsLEV10M10C", SN_NOWARN) set_name(0x8012CB88, "NumsLEV10M10D", SN_NOWARN) set_name(0x8012CB8C, "NumsLEV10M10QA", SN_NOWARN) set_name(0x8012CB90, "NumsLEV11M11A", SN_NOWARN) set_name(0x8012CB94, "NumsLEV11M11B", SN_NOWARN) set_name(0x8012CB98, "NumsLEV11M11C", SN_NOWARN) set_name(0x8012CB9C, "NumsLEV11M11D", SN_NOWARN) set_name(0x8012CBA0, "NumsLEV11M11E", SN_NOWARN) set_name(0x8012CBA4, "NumsLEV12M12A", SN_NOWARN) set_name(0x8012CBA8, "NumsLEV12M12B", SN_NOWARN) set_name(0x8012CBAC, "NumsLEV12M12C", SN_NOWARN) set_name(0x8012CBB0, "NumsLEV12M12D", SN_NOWARN) set_name(0x8012CBB4, "NumsLEV13M13A", SN_NOWARN) set_name(0x8012CBB8, "NumsLEV13M13B", SN_NOWARN) set_name(0x8012CBBC, "NumsLEV13M13QB", SN_NOWARN) set_name(0x8012CBC0, "NumsLEV13M13C", SN_NOWARN) set_name(0x8012CBC4, "NumsLEV13M13D", SN_NOWARN) set_name(0x8012CBC8, "NumsLEV14M14A", SN_NOWARN) set_name(0x8012CBCC, "NumsLEV14M14B", SN_NOWARN) set_name(0x8012CBD0, "NumsLEV14M14QB", SN_NOWARN) set_name(0x8012CBD4, "NumsLEV14M14C", SN_NOWARN) set_name(0x8012CBD8, "NumsLEV14M14D", SN_NOWARN) set_name(0x8012CBDC, "NumsLEV14M14E", SN_NOWARN) set_name(0x8012CBE0, "NumsLEV15M15A", SN_NOWARN) set_name(0x8012CBE4, "NumsLEV15M15B", SN_NOWARN) set_name(0x8012CBE8, "NumsLEV15M15C", SN_NOWARN) set_name(0x8012CBEC, "NumsLEV15M15QA", SN_NOWARN) set_name(0x8012CBF0, "NumsLEV16M16D", SN_NOWARN) set_name(0x800A9700, "ChoiceListLEV1", SN_NOWARN) set_name(0x800A9730, "ChoiceListLEV2", SN_NOWARN) set_name(0x800A9790, "ChoiceListLEV3", SN_NOWARN) set_name(0x800A97D0, "ChoiceListLEV4", SN_NOWARN) set_name(0x800A9840, "ChoiceListLEV5", SN_NOWARN) set_name(0x800A98B0, "ChoiceListLEV6", SN_NOWARN) set_name(0x800A9910, "ChoiceListLEV7", SN_NOWARN) set_name(0x800A9960, "ChoiceListLEV8", SN_NOWARN) set_name(0x800A99C0, "ChoiceListLEV9", SN_NOWARN) set_name(0x800A9A00, "ChoiceListLEV10", SN_NOWARN) set_name(0x800A9A50, "ChoiceListLEV11", SN_NOWARN) set_name(0x800A9AA0, "ChoiceListLEV12", SN_NOWARN) set_name(0x800A9AE0, "ChoiceListLEV13", SN_NOWARN) set_name(0x800A9B30, "ChoiceListLEV14", SN_NOWARN) set_name(0x800A9B90, "ChoiceListLEV15", SN_NOWARN) set_name(0x800A9BD0, "ChoiceListLEV16", SN_NOWARN) set_name(0x8012E688, "GameTaskPtr", SN_NOWARN) set_name(0x800A9C60, "AllArgs", SN_NOWARN) set_name(0x8012CDD8, "ArgsSoFar", SN_NOWARN) set_name(0x8012CDE8, "ThisOt", SN_NOWARN) set_name(0x8012CDEC, "ThisPrimAddr", SN_NOWARN) set_name(0x8012E68C, "hndPrimBuffers", SN_NOWARN) set_name(0x8012E690, "PrimBuffers", SN_NOWARN) set_name(0x8012E694, "BufferDepth", SN_NOWARN) set_name(0x8012E695, "WorkRamId", SN_NOWARN) set_name(0x8012E696, "ScrNum", SN_NOWARN) set_name(0x8012E698, "Screens", SN_NOWARN) set_name(0x8012E69C, "PbToClear", SN_NOWARN) set_name(0x8012E6A0, "BufferNum", SN_NOWARN) set_name(0x8012CDF0, "AddrToAvoid", SN_NOWARN) set_name(0x8012E6A1, "LastBuffer", SN_NOWARN) set_name(0x8012E6A4, "DispEnvToPut", SN_NOWARN) set_name(0x8012E6A8, "ThisOtSize", SN_NOWARN) set_name(0x8012CDF4, "ScrRect", SN_NOWARN) set_name(0x8012E6AC, "VidWait", SN_NOWARN) set_name(0x8012EB28, "screen", SN_NOWARN) set_name(0x8012E6B0, "VbFunc", SN_NOWARN) set_name(0x8012E6B4, "VidTick", SN_NOWARN) set_name(0x8012E6B8, "VXOff", SN_NOWARN) set_name(0x8012E6BC, "VYOff", SN_NOWARN) set_name(0x8012CE08, "Gaz", SN_NOWARN) set_name(0x8012CE0C, "LastFmem", SN_NOWARN) set_name(0x8012CDFC, "GSYS_MemStart", SN_NOWARN) set_name(0x8012CE00, "GSYS_MemEnd", SN_NOWARN) set_name(0x800A9FA8, "PsxMem", SN_NOWARN) set_name(0x800A9FD0, "PsxFastMem", SN_NOWARN) set_name(0x8012CE04, "LowestFmem", SN_NOWARN) set_name(0x8012CE1C, "FileSYS", SN_NOWARN) set_name(0x8012E6C0, "FileSystem", SN_NOWARN) set_name(0x8012E6C4, "OverlayFileSystem", SN_NOWARN) set_name(0x8012CE36, "DavesPad", SN_NOWARN) set_name(0x8012CE38, "DavesPadDeb", SN_NOWARN) set_name(0x800A9FF8, "_6FileIO_FileToLoad", SN_NOWARN) set_name(0x8012EC08, "MyFT4", SN_NOWARN) set_name(0x800AA89C, "AllDats", SN_NOWARN) set_name(0x8012CE88, "TpW", SN_NOWARN) set_name(0x8012CE8C, "TpH", SN_NOWARN) set_name(0x8012CE90, "TpXDest", SN_NOWARN) set_name(0x8012CE94, "TpYDest", SN_NOWARN) set_name(0x8012CE98, "R", SN_NOWARN) set_name(0x800AAE5C, "MyGT4", SN_NOWARN) set_name(0x800AAE90, "MyGT3", SN_NOWARN) set_name(0x800AA02C, "DatPool", SN_NOWARN) set_name(0x8012CEAC, "ChunkGot", SN_NOWARN) set_name(0x800AAEB8, "STREAM_DIR", SN_NOWARN) set_name(0x800AAEC8, "STREAM_BIN", SN_NOWARN) set_name(0x800AAED8, "EAC_DirectoryCache", SN_NOWARN) set_name(0x8012CEC0, "BL_NoLumpFiles", SN_NOWARN) set_name(0x8012CEC4, "BL_NoStreamFiles", SN_NOWARN) set_name(0x8012CEC8, "LFileTab", SN_NOWARN) set_name(0x8012CECC, "SFileTab", SN_NOWARN) set_name(0x8012CED0, "FileLoaded", SN_NOWARN) set_name(0x8012CEF4, "NoTAllocs", SN_NOWARN) set_name(0x800AB004, "MemBlock", SN_NOWARN) set_name(0x8012E6D0, "CanPause", SN_NOWARN) set_name(0x8012E6D4, "Paused", SN_NOWARN) set_name(0x8012E6D8, "InActivePad", SN_NOWARN) set_name(0x8012EC30, "PBack", SN_NOWARN) set_name(0x800AB26C, "RawPadData0", SN_NOWARN) set_name(0x800AB290, "RawPadData1", SN_NOWARN) set_name(0x800AB2B4, "demo_buffer", SN_NOWARN) set_name(0x8012CF10, "demo_pad_time", SN_NOWARN) set_name(0x8012CF14, "demo_pad_count", SN_NOWARN) set_name(0x800AB194, "Pad0", SN_NOWARN) set_name(0x800AB200, "Pad1", SN_NOWARN) set_name(0x8012CF18, "demo_finish", SN_NOWARN) set_name(0x8012CF1C, "cac_pad", SN_NOWARN) set_name(0x8012CF3C, "CharFt4", SN_NOWARN) set_name(0x8012CF40, "CharFrm", SN_NOWARN) set_name(0x8012CF29, "WHITER", SN_NOWARN) set_name(0x8012CF2A, "WHITEG", SN_NOWARN) set_name(0x8012CF2B, "WHITEB", SN_NOWARN) set_name(0x8012CF2C, "BLUER", SN_NOWARN) set_name(0x8012CF2D, "BLUEG", SN_NOWARN) set_name(0x8012CF2E, "BLUEB", SN_NOWARN) set_name(0x8012CF2F, "REDR", SN_NOWARN) set_name(0x8012CF30, "REDG", SN_NOWARN) set_name(0x8012CF31, "REDB", SN_NOWARN) set_name(0x8012CF32, "GOLDR", SN_NOWARN) set_name(0x8012CF33, "GOLDG", SN_NOWARN) set_name(0x8012CF34, "GOLDB", SN_NOWARN) set_name(0x800AB638, "MediumFont", SN_NOWARN) set_name(0x800AB854, "LargeFont", SN_NOWARN) set_name(0x8012CF38, "buttoncol", SN_NOWARN) set_name(0x800ABA70, "LFontTab", SN_NOWARN) set_name(0x800ABB24, "LFont", SN_NOWARN) set_name(0x800ABB34, "MFontTab", SN_NOWARN) set_name(0x800ABC6C, "MFont", SN_NOWARN) set_name(0x8012CF55, "DialogRed", SN_NOWARN) set_name(0x8012CF56, "DialogGreen", SN_NOWARN) set_name(0x8012CF57, "DialogBlue", SN_NOWARN) set_name(0x8012CF58, "DialogTRed", SN_NOWARN) set_name(0x8012CF59, "DialogTGreen", SN_NOWARN) set_name(0x8012CF5A, "DialogTBlue", SN_NOWARN) set_name(0x8012CF5C, "DialogTData", SN_NOWARN) set_name(0x8012CF60, "DialogBackGfx", SN_NOWARN) set_name(0x8012CF64, "DialogBackW", SN_NOWARN) set_name(0x8012CF68, "DialogBackH", SN_NOWARN) set_name(0x8012CF6C, "DialogBorderGfx", SN_NOWARN) set_name(0x8012CF70, "DialogBorderTLW", SN_NOWARN) set_name(0x8012CF74, "DialogBorderTLH", SN_NOWARN) set_name(0x8012CF78, "DialogBorderTRW", SN_NOWARN) set_name(0x8012CF7C, "DialogBorderTRH", SN_NOWARN) set_name(0x8012CF80, "DialogBorderBLW", SN_NOWARN) set_name(0x8012CF84, "DialogBorderBLH", SN_NOWARN) set_name(0x8012CF88, "DialogBorderBRW", SN_NOWARN) set_name(0x8012CF8C, "DialogBorderBRH", SN_NOWARN) set_name(0x8012CF90, "DialogBorderTW", SN_NOWARN) set_name(0x8012CF94, "DialogBorderTH", SN_NOWARN) set_name(0x8012CF98, "DialogBorderBW", SN_NOWARN) set_name(0x8012CF9C, "DialogBorderBH", SN_NOWARN) set_name(0x8012CFA0, "DialogBorderLW", SN_NOWARN) set_name(0x8012CFA4, "DialogBorderLH", SN_NOWARN) set_name(0x8012CFA8, "DialogBorderRW", SN_NOWARN) set_name(0x8012CFAC, "DialogBorderRH", SN_NOWARN) set_name(0x8012CFB0, "DialogBevelGfx", SN_NOWARN) set_name(0x8012CFB4, "DialogBevelCW", SN_NOWARN) set_name(0x8012CFB8, "DialogBevelCH", SN_NOWARN) set_name(0x8012CFBC, "DialogBevelLRW", SN_NOWARN) set_name(0x8012CFC0, "DialogBevelLRH", SN_NOWARN) set_name(0x8012CFC4, "DialogBevelUDW", SN_NOWARN) set_name(0x8012CFC8, "DialogBevelUDH", SN_NOWARN) set_name(0x8012CFCC, "MY_DialogOTpos", SN_NOWARN) set_name(0x8012E6DC, "DialogGBack", SN_NOWARN) set_name(0x8012E6DD, "GShadeX", SN_NOWARN) set_name(0x8012E6DE, "GShadeY", SN_NOWARN) set_name(0x8012E6E4, "RandBTab", SN_NOWARN) set_name(0x800ABCBC, "Cxy", SN_NOWARN) set_name(0x8012CF4F, "BORDERR", SN_NOWARN) set_name(0x8012CF50, "BORDERG", SN_NOWARN) set_name(0x8012CF51, "BORDERB", SN_NOWARN) set_name(0x8012CF52, "BACKR", SN_NOWARN) set_name(0x8012CF53, "BACKG", SN_NOWARN) set_name(0x8012CF54, "BACKB", SN_NOWARN) set_name(0x800ABC7C, "GShadeTab", SN_NOWARN) set_name(0x8012CF4D, "GShadePX", SN_NOWARN) set_name(0x8012CF4E, "GShadePY", SN_NOWARN) set_name(0x8012CFD9, "PlayDemoFlag", SN_NOWARN) set_name(0x8012EC40, "rgbb", SN_NOWARN) set_name(0x8012EC70, "rgbt", SN_NOWARN) set_name(0x8012E6EC, "blockr", SN_NOWARN) set_name(0x8012E6F0, "blockg", SN_NOWARN) set_name(0x8012E6F4, "blockb", SN_NOWARN) set_name(0x8012E6F8, "InfraFlag", SN_NOWARN) set_name(0x8012E6FC, "blank_bit", SN_NOWARN) set_name(0x8012CFED, "P1ObjSelCount", SN_NOWARN) set_name(0x8012CFEE, "P2ObjSelCount", SN_NOWARN) set_name(0x8012CFEF, "P12ObjSelCount", SN_NOWARN) set_name(0x8012CFF0, "P1ItemSelCount", SN_NOWARN) set_name(0x8012CFF1, "P2ItemSelCount", SN_NOWARN) set_name(0x8012CFF2, "P12ItemSelCount", SN_NOWARN) set_name(0x8012CFF3, "P1MonstSelCount", SN_NOWARN) set_name(0x8012CFF4, "P2MonstSelCount", SN_NOWARN) set_name(0x8012CFF5, "P12MonstSelCount", SN_NOWARN) set_name(0x8012CFF6, "P1ObjSelCol", SN_NOWARN) set_name(0x8012CFF8, "P2ObjSelCol", SN_NOWARN) set_name(0x8012CFFA, "P12ObjSelCol", SN_NOWARN) set_name(0x8012CFFC, "P1ItemSelCol", SN_NOWARN) set_name(0x8012CFFE, "P2ItemSelCol", SN_NOWARN) set_name(0x8012D000, "P12ItemSelCol", SN_NOWARN) set_name(0x8012D002, "P1MonstSelCol", SN_NOWARN) set_name(0x8012D004, "P2MonstSelCol", SN_NOWARN) set_name(0x8012D006, "P12MonstSelCol", SN_NOWARN) set_name(0x8012D008, "CurrentBlocks", SN_NOWARN) set_name(0x800ABD2C, "TownConv", SN_NOWARN) set_name(0x8012D024, "CurrentOverlay", SN_NOWARN) set_name(0x80122750, "HaltTab", SN_NOWARN) set_name(0x8012ECA0, "FrontEndOver", SN_NOWARN) set_name(0x8012ECB0, "PregameOver", SN_NOWARN) set_name(0x8012ECC0, "GameOver", SN_NOWARN) set_name(0x8012ECD0, "FmvOver", SN_NOWARN) set_name(0x8012E700, "OWorldX", SN_NOWARN) set_name(0x8012E704, "OWorldY", SN_NOWARN) set_name(0x8012E708, "WWorldX", SN_NOWARN) set_name(0x8012E70C, "WWorldY", SN_NOWARN) set_name(0x801227CC, "TxyAdd", SN_NOWARN) set_name(0x8012D048, "GXAdj2", SN_NOWARN) set_name(0x8012E710, "TimePerFrame", SN_NOWARN) set_name(0x8012E714, "CpuStart", SN_NOWARN) set_name(0x8012E718, "CpuTime", SN_NOWARN) set_name(0x8012E71C, "DrawTime", SN_NOWARN) set_name(0x8012E720, "DrawStart", SN_NOWARN) set_name(0x8012E724, "LastCpuTime", SN_NOWARN) set_name(0x8012E728, "LastDrawTime", SN_NOWARN) set_name(0x8012E72C, "DrawArea", SN_NOWARN) set_name(0x8012D050, "ProfOn", SN_NOWARN) set_name(0x800ABD44, "LevPals", SN_NOWARN) set_name(0x80122928, "Level2Bgdata", SN_NOWARN) set_name(0x800ABD58, "DefP1PanelXY", SN_NOWARN) set_name(0x800ABDAC, "DefP1PanelXY2", SN_NOWARN) set_name(0x800ABE00, "DefP2PanelXY", SN_NOWARN) set_name(0x800ABE54, "DefP2PanelXY2", SN_NOWARN) set_name(0x800ABEA8, "SpeedBarGfxTable", SN_NOWARN) set_name(0x8012D078, "hof", SN_NOWARN) set_name(0x8012D07C, "mof", SN_NOWARN) set_name(0x800ABF70, "SFXTab", SN_NOWARN) set_name(0x800AC070, "STR_Buffer", SN_NOWARN) set_name(0x8012D0B0, "Time", SN_NOWARN) set_name(0x8012D0B4, "CDWAIT", SN_NOWARN) set_name(0x800BE070, "voice_attr", SN_NOWARN) set_name(0x800BE0B0, "STRSave", SN_NOWARN) set_name(0x8012E730, "SavePause", SN_NOWARN) set_name(0x8012D089, "NoActiveStreams", SN_NOWARN) set_name(0x8012D08C, "STRInit", SN_NOWARN) set_name(0x8012D090, "frame_rate", SN_NOWARN) set_name(0x8012D094, "CDAngle", SN_NOWARN) set_name(0x8012D0D8, "SFXNotPlayed", SN_NOWARN) set_name(0x8012D0D9, "SFXNotInBank", SN_NOWARN) set_name(0x8012ECE0, "spu_management", SN_NOWARN) set_name(0x8012EDF0, "rev_attr", SN_NOWARN) set_name(0x8012E738, "NoSfx", SN_NOWARN) set_name(0x8012EE10, "CHStatus", SN_NOWARN) set_name(0x8012D0C4, "BankOffsets", SN_NOWARN) set_name(0x8012D0C8, "OffsetHandle", SN_NOWARN) set_name(0x8012D0CC, "BankBase", SN_NOWARN) set_name(0x8012D0D0, "SPU_Done", SN_NOWARN) set_name(0x80122CD0, "SFXRemapTab", SN_NOWARN) set_name(0x8012D0D4, "NoSNDRemaps", SN_NOWARN) set_name(0x800BE130, "ThePals", SN_NOWARN) set_name(0x80122D7C, "InitialPositions", SN_NOWARN) set_name(0x8012D11C, "demo_level", SN_NOWARN) set_name(0x8012EE40, "buff", SN_NOWARN) set_name(0x8012D120, "old_val", SN_NOWARN) set_name(0x8012D124, "DemoTask", SN_NOWARN) set_name(0x8012D128, "DemoGameTask", SN_NOWARN) set_name(0x8012D12C, "tonys", SN_NOWARN) set_name(0x8012D104, "demo_load", SN_NOWARN) set_name(0x8012D108, "demo_record_load", SN_NOWARN) set_name(0x8012D10C, "level_record", SN_NOWARN) set_name(0x8012D110, "demo_fade_finished", SN_NOWARN) set_name(0x8012D113, "demo_which", SN_NOWARN) set_name(0x800BE35C, "demolevel", SN_NOWARN) set_name(0x8012D111, "quest_cheat_num", SN_NOWARN) set_name(0x8012D112, "cheat_quest_flag", SN_NOWARN) set_name(0x8012D100, "moo_moo", SN_NOWARN) set_name(0x800BE31C, "quest_seed", SN_NOWARN) set_name(0x8012D114, "demo_flash", SN_NOWARN) set_name(0x8012D118, "tonys_Task", SN_NOWARN) set_name(0x8012D288, "DoShowPanel", SN_NOWARN) set_name(0x8012D28C, "DoDrawBg", SN_NOWARN) set_name(0x8012E73C, "GlueFinished", SN_NOWARN) set_name(0x8012E740, "DoHomingScroll", SN_NOWARN) set_name(0x8012E744, "TownerGfx", SN_NOWARN) set_name(0x8012E748, "CurrentMonsterList", SN_NOWARN) set_name(0x8012D139, "started_grtask", SN_NOWARN) set_name(0x800BE370, "PlayerInfo", SN_NOWARN) set_name(0x8012D290, "ArmourChar", SN_NOWARN) set_name(0x80122E70, "WepChar", SN_NOWARN) set_name(0x8012D294, "CharChar", SN_NOWARN) set_name(0x8012E74C, "ctrl_select_line", SN_NOWARN) set_name(0x8012E74D, "ctrl_select_side", SN_NOWARN) set_name(0x8012E74E, "ckeyheld", SN_NOWARN) set_name(0x8012E754, "CtrlRect", SN_NOWARN) set_name(0x8012D2A8, "ctrlflag", SN_NOWARN) set_name(0x800BE7E4, "txt_actions", SN_NOWARN) set_name(0x800BE73C, "pad_txt", SN_NOWARN) set_name(0x8012D2A4, "toppos", SN_NOWARN) set_name(0x8012EE60, "CtrlBack", SN_NOWARN) set_name(0x800BE914, "controller_defaults", SN_NOWARN) set_name(0x8012D314, "gr_scrxoff", SN_NOWARN) set_name(0x8012D318, "gr_scryoff", SN_NOWARN) set_name(0x8012D320, "water_clut", SN_NOWARN) set_name(0x8012D323, "visible_level", SN_NOWARN) set_name(0x8012D311, "last_type", SN_NOWARN) set_name(0x8012D325, "daylight", SN_NOWARN) set_name(0x8012D322, "cow_in_sight", SN_NOWARN) set_name(0x8012D31C, "water_count", SN_NOWARN) set_name(0x8012D324, "lastrnd", SN_NOWARN) set_name(0x8012D328, "call_clock", SN_NOWARN) set_name(0x8012D338, "TitleAnimCount", SN_NOWARN) set_name(0x8012D33C, "flametick", SN_NOWARN) set_name(0x800BE9AC, "ypos", SN_NOWARN) set_name(0x800BE9C4, "frmlist", SN_NOWARN) set_name(0x800BE9DC, "xoff", SN_NOWARN) set_name(0x8012D340, "startx", SN_NOWARN) set_name(0x8012D344, "hellomumflag", SN_NOWARN) set_name(0x800BEA14, "SpellFXDat", SN_NOWARN) set_name(0x8012EE70, "PartArray", SN_NOWARN) set_name(0x8012E75C, "partOtPos", SN_NOWARN) set_name(0x8012D364, "SetParticle", SN_NOWARN) set_name(0x8012D368, "p1partexecnum", SN_NOWARN) set_name(0x8012D36C, "p2partexecnum", SN_NOWARN) set_name(0x800BE9F4, "JumpArray", SN_NOWARN) set_name(0x8012D370, "partjumpflag", SN_NOWARN) set_name(0x8012D374, "partglowflag", SN_NOWARN) set_name(0x8012D378, "partcolour", SN_NOWARN) set_name(0x8012D37C, "anyfuckingmenus", SN_NOWARN) set_name(0x800BEAA4, "SplTarget", SN_NOWARN) set_name(0x8012D39D, "select_flag", SN_NOWARN) set_name(0x8012E760, "SelectRect", SN_NOWARN) set_name(0x8012E768, "item_select", SN_NOWARN) set_name(0x8012D3A0, "QSpell", SN_NOWARN) set_name(0x8012D3A4, "_spltotype", SN_NOWARN) set_name(0x8012D3A8, "force_attack", SN_NOWARN) set_name(0x8012D390, "gplayer", SN_NOWARN) set_name(0x8012F0B0, "SelectBack", SN_NOWARN) set_name(0x8012D394, "mana_order", SN_NOWARN) set_name(0x8012D398, "health_order", SN_NOWARN) set_name(0x8012D39C, "birdcheck", SN_NOWARN) set_name(0x8012F0C0, "DecRequestors", SN_NOWARN) set_name(0x8012E76C, "progress", SN_NOWARN) set_name(0x80122FFC, "Level2CutScreen", SN_NOWARN) set_name(0x8012F0E8, "Scr", SN_NOWARN) set_name(0x8012D3C8, "CutScreenTSK", SN_NOWARN) set_name(0x8012D3CC, "GameLoading", SN_NOWARN) set_name(0x8012F168, "LBack", SN_NOWARN) set_name(0x800BEAD4, "block_buf", SN_NOWARN) set_name(0x8012D3E8, "card_ev0", SN_NOWARN) set_name(0x8012D3EC, "card_ev1", SN_NOWARN) set_name(0x8012D3F0, "card_ev2", SN_NOWARN) set_name(0x8012D3F4, "card_ev3", SN_NOWARN) set_name(0x8012D3F8, "card_ev10", SN_NOWARN) set_name(0x8012D3FC, "card_ev11", SN_NOWARN) set_name(0x8012D400, "card_ev12", SN_NOWARN) set_name(0x8012D404, "card_ev13", SN_NOWARN) set_name(0x8012D408, "card_dirty", SN_NOWARN) set_name(0x8012D410, "MemcardTask", SN_NOWARN) set_name(0x8012E770, "card_event", SN_NOWARN) set_name(0x8012D3E4, "mem_card_event_handler", SN_NOWARN) set_name(0x8012D3DC, "MemCardActive", SN_NOWARN) set_name(0x8012D3E0, "never_hooked_events", SN_NOWARN) set_name(0x8012D46C, "MasterVol", SN_NOWARN) set_name(0x8012D470, "MusicVol", SN_NOWARN) set_name(0x8012D474, "SoundVol", SN_NOWARN) set_name(0x8012D478, "VideoVol", SN_NOWARN) set_name(0x8012D47C, "SpeechVol", SN_NOWARN) set_name(0x8012E774, "Slider", SN_NOWARN) set_name(0x8012E778, "sw", SN_NOWARN) set_name(0x8012E77C, "sx", SN_NOWARN) set_name(0x8012E780, "sy", SN_NOWARN) set_name(0x8012E784, "Adjust", SN_NOWARN) set_name(0x8012E785, "qspin", SN_NOWARN) set_name(0x8012E786, "lqspin", SN_NOWARN) set_name(0x8012E788, "OrigLang", SN_NOWARN) set_name(0x8012E78C, "OldLang", SN_NOWARN) set_name(0x8012E790, "NewLang", SN_NOWARN) set_name(0x8012D480, "save_blocks", SN_NOWARN) set_name(0x8012D484, "Savefilename", SN_NOWARN) set_name(0x8012D488, "ReturnMenu", SN_NOWARN) set_name(0x8012E794, "ORect", SN_NOWARN) set_name(0x8012E79C, "McState", SN_NOWARN) set_name(0x8012D48C, "they_pressed", SN_NOWARN) set_name(0x8012E7A4, "Seed", SN_NOWARN) set_name(0x8012D440, "optionsflag", SN_NOWARN) set_name(0x8012D434, "cmenu", SN_NOWARN) set_name(0x8012D44C, "options_pad", SN_NOWARN) set_name(0x8012D43C, "allspellsflag", SN_NOWARN) set_name(0x800BF5F4, "Circle", SN_NOWARN) set_name(0x8012D420, "goldcheat", SN_NOWARN) set_name(0x8012D450, "OptionsSeed", SN_NOWARN) set_name(0x8012D454, "OptionsSetSeed", SN_NOWARN) set_name(0x8012D424, "Qfromoptions", SN_NOWARN) set_name(0x8012D428, "Spacing", SN_NOWARN) set_name(0x8012D42C, "cs", SN_NOWARN) set_name(0x8012D430, "lastcs", SN_NOWARN) set_name(0x8012D438, "MemcardOverlay", SN_NOWARN) set_name(0x8012D444, "saveflag", SN_NOWARN) set_name(0x8012D448, "loadflag", SN_NOWARN) set_name(0x8012D458, "PadFrig", SN_NOWARN) set_name(0x800BEB54, "MainMenu", SN_NOWARN) set_name(0x800BEC2C, "GameMenu", SN_NOWARN) set_name(0x800BED34, "SoundMenu", SN_NOWARN) set_name(0x800BEDC4, "CentreMenu", SN_NOWARN) set_name(0x800BEE6C, "LangMenu", SN_NOWARN) set_name(0x800BEF14, "QuitMenu", SN_NOWARN) set_name(0x800BEF74, "MemcardMenu", SN_NOWARN) set_name(0x800BF01C, "MemcardLoadGameMenu", SN_NOWARN) set_name(0x800BF07C, "MemcardSaveGameMenu", SN_NOWARN) set_name(0x800BF0DC, "MemcardSaveOptionsMenu", SN_NOWARN) set_name(0x800BF13C, "MemcardLoadOptionsMenu", SN_NOWARN) set_name(0x800BF19C, "MemcardCharacterMenu", SN_NOWARN) set_name(0x800BF1FC, "MemcardSelectCard1", SN_NOWARN) set_name(0x800BF2A4, "MemcardSelectCard2", SN_NOWARN) set_name(0x800BF34C, "MemcardFormatMenu", SN_NOWARN) set_name(0x800BF3AC, "CheatMenu", SN_NOWARN) set_name(0x800BF49C, "InfoMenu", SN_NOWARN) set_name(0x800BF4CC, "MonstViewMenu", SN_NOWARN) set_name(0x800BF514, "SeedMenu", SN_NOWARN) set_name(0x800BF55C, "MenuList", SN_NOWARN) set_name(0x8012D45C, "debounce", SN_NOWARN) set_name(0x8012D460, "KeyPos", SN_NOWARN) set_name(0x800BF674, "KeyTab", SN_NOWARN) set_name(0x8012D464, "SeedPos", SN_NOWARN) set_name(0x800BF688, "BirdList", SN_NOWARN) set_name(0x8012E7AC, "last_seenx", SN_NOWARN) set_name(0x8012E7B4, "last_seeny", SN_NOWARN) set_name(0x8012D499, "hop_height", SN_NOWARN) set_name(0x8012D49C, "perches", SN_NOWARN) set_name(0x800BF808, "FmvTab", SN_NOWARN) set_name(0x8012D4B0, "CurMons", SN_NOWARN) set_name(0x8012D4B4, "Frame", SN_NOWARN) set_name(0x8012D4B8, "Action", SN_NOWARN) set_name(0x8012D4BC, "Dir", SN_NOWARN) set_name(0x8012D520, "indsize", SN_NOWARN) set_name(0x8012D500, "kanjbuff", SN_NOWARN) set_name(0x8012D504, "kindex", SN_NOWARN) set_name(0x8012D508, "hndKanjBuff", SN_NOWARN) set_name(0x8012D50C, "hndKanjIndex", SN_NOWARN) set_name(0x8012E7BC, "HelpRect", SN_NOWARN) set_name(0x8012E7C4, "HelpTop", SN_NOWARN) set_name(0x8012F178, "HelpBack", SN_NOWARN) set_name(0x8012D530, "helpflag", SN_NOWARN) set_name(0x800BF848, "HelpList", SN_NOWARN) set_name(0x8012D580, "FeBackX", SN_NOWARN) set_name(0x8012D584, "FeBackY", SN_NOWARN) set_name(0x8012D588, "FeBackW", SN_NOWARN) set_name(0x8012D58C, "FeBackH", SN_NOWARN) set_name(0x8012D590, "FeFlag", SN_NOWARN) set_name(0x800BFE50, "FeBuffer", SN_NOWARN) set_name(0x8012D594, "FePlayerNo", SN_NOWARN) set_name(0x8012E7C8, "CStruct", SN_NOWARN) set_name(0x8012D598, "FeBufferCount", SN_NOWARN) set_name(0x8012D59C, "FeNoOfPlayers", SN_NOWARN) set_name(0x8012D5A0, "FeChrClass", SN_NOWARN) set_name(0x800C05D0, "FePlayerName", SN_NOWARN) set_name(0x8012D5A8, "FeCurMenu", SN_NOWARN) set_name(0x8012D5AC, "FePlayerNameFlag", SN_NOWARN) set_name(0x8012D5B0, "FeCount", SN_NOWARN) set_name(0x8012D5B4, "fileselect", SN_NOWARN) set_name(0x8012D5B8, "BookMenu", SN_NOWARN) set_name(0x8012D5BC, "FeAttractMode", SN_NOWARN) set_name(0x8012D5C0, "FMVPress", SN_NOWARN) set_name(0x8012D54C, "FeTData", SN_NOWARN) set_name(0x8012D554, "LoadedChar", SN_NOWARN) set_name(0x8012D550, "FlameTData", SN_NOWARN) set_name(0x8012D55C, "FeIsAVirgin", SN_NOWARN) set_name(0x8012D560, "FeMenuDelay", SN_NOWARN) set_name(0x800BF950, "DummyMenu", SN_NOWARN) set_name(0x800BF96C, "FeMainMenu", SN_NOWARN) set_name(0x800BF988, "FeNewGameMenu", SN_NOWARN) set_name(0x800BF9A4, "FeNewP1ClassMenu", SN_NOWARN) set_name(0x800BF9C0, "FeNewP1NameMenu", SN_NOWARN) set_name(0x800BF9DC, "FeNewP2ClassMenu", SN_NOWARN) set_name(0x800BF9F8, "FeNewP2NameMenu", SN_NOWARN) set_name(0x800BFA14, "FeDifficultyMenu", SN_NOWARN) set_name(0x800BFA30, "FeBackgroundMenu", SN_NOWARN) set_name(0x800BFA4C, "FeBook1Menu", SN_NOWARN) set_name(0x800BFA68, "FeBook2Menu", SN_NOWARN) set_name(0x800BFA84, "FeLoadCharMenu", SN_NOWARN) set_name(0x800BFAA0, "FeLoadChar1Menu", SN_NOWARN) set_name(0x800BFABC, "FeLoadChar2Menu", SN_NOWARN) set_name(0x8012D564, "fadeval", SN_NOWARN) set_name(0x800BFAD8, "FeMainMenuTable", SN_NOWARN) set_name(0x800BFB50, "FeNewGameMenuTable", SN_NOWARN) set_name(0x800BFB98, "FePlayerClassMenuTable", SN_NOWARN) set_name(0x800BFC10, "FeNameEngMenuTable", SN_NOWARN) set_name(0x800BFC58, "FeMemcardMenuTable", SN_NOWARN) set_name(0x800BFCA0, "FeDifficultyMenuTable", SN_NOWARN) set_name(0x800BFD00, "FeBackgroundMenuTable", SN_NOWARN) set_name(0x800BFD60, "FeBook1MenuTable", SN_NOWARN) set_name(0x800BFDD8, "FeBook2MenuTable", SN_NOWARN) set_name(0x8012D570, "DrawBackOn", SN_NOWARN) set_name(0x8012D574, "AttractTitleDelay", SN_NOWARN) set_name(0x8012D578, "AttractMainDelay", SN_NOWARN) set_name(0x8012D57C, "FMVEndPad", SN_NOWARN) set_name(0x8012D5F4, "InCredits", SN_NOWARN) set_name(0x8012D5F8, "CreditTitleNo", SN_NOWARN) set_name(0x8012D5FC, "CreditSubTitleNo", SN_NOWARN) set_name(0x8012D610, "card_status", SN_NOWARN) set_name(0x8012D618, "card_usable", SN_NOWARN) set_name(0x8012D620, "card_files", SN_NOWARN) set_name(0x8012D628, "card_changed", SN_NOWARN) set_name(0x8012D66C, "AlertTxt", SN_NOWARN) set_name(0x8012D670, "current_card", SN_NOWARN) set_name(0x8012D674, "LoadType", SN_NOWARN) set_name(0x8012D678, "McMenuPos", SN_NOWARN) set_name(0x8012D67C, "McCurMenu", SN_NOWARN) set_name(0x8012D668, "fileinfoflag", SN_NOWARN) set_name(0x8012D63C, "DiabloGameFile", SN_NOWARN) set_name(0x8012D640, "DiabloOptionFile", SN_NOWARN) set_name(0x8012D660, "McState_addr_8012D660", SN_NOWARN) set_name(0x8012D758, "mdec_audio_buffer", SN_NOWARN) set_name(0x8012D760, "mdec_audio_sec", SN_NOWARN) set_name(0x8012D764, "mdec_audio_offs", SN_NOWARN) set_name(0x8012D768, "mdec_audio_playing", SN_NOWARN) set_name(0x8012D76C, "mdec_audio_rate_shift", SN_NOWARN) set_name(0x8012D770, "vlcbuf", SN_NOWARN) set_name(0x8012D778, "slice_size", SN_NOWARN) set_name(0x8012D77C, "slice", SN_NOWARN) set_name(0x8012D784, "slice_inc", SN_NOWARN) set_name(0x8012D788, "area_pw", SN_NOWARN) set_name(0x8012D78C, "area_ph", SN_NOWARN) set_name(0x8012D790, "tmdc_pol_dirty", SN_NOWARN) set_name(0x8012D794, "num_pol", SN_NOWARN) set_name(0x8012D79C, "mdec_cx", SN_NOWARN) set_name(0x8012D7A0, "mdec_cy", SN_NOWARN) set_name(0x8012D7A4, "mdec_w", SN_NOWARN) set_name(0x8012D7A8, "mdec_h", SN_NOWARN) set_name(0x8012D7AC, "mdec_pw", SN_NOWARN) set_name(0x8012D7B4, "mdec_ph", SN_NOWARN) set_name(0x8012D7BC, "move_x", SN_NOWARN) set_name(0x8012D7C0, "move_y", SN_NOWARN) set_name(0x8012D7C4, "move_scale", SN_NOWARN) set_name(0x8012D7C8, "stream_frames", SN_NOWARN) set_name(0x8012D7CC, "last_stream_frame", SN_NOWARN) set_name(0x8012D7D0, "mdec_framecount", SN_NOWARN) set_name(0x8012D7D4, "mdec_speed", SN_NOWARN) set_name(0x8012D7D8, "mdec_stream_starting", SN_NOWARN) set_name(0x8012D7DC, "mdec_last_frame", SN_NOWARN) set_name(0x8012D7E0, "mdec_sectors_per_frame", SN_NOWARN) set_name(0x8012D7E4, "vlctab", SN_NOWARN) set_name(0x8012D7E8, "mdc_buftop", SN_NOWARN) set_name(0x8012D7EC, "mdc_bufstart", SN_NOWARN) set_name(0x8012D7F0, "mdc_bufleft", SN_NOWARN) set_name(0x8012D7F4, "mdc_buftotal", SN_NOWARN) set_name(0x8012D7F8, "ordertab_length", SN_NOWARN) set_name(0x8012D7FC, "time_in_frames", SN_NOWARN) set_name(0x8012D800, "stream_chunksize", SN_NOWARN) set_name(0x8012D804, "stream_bufsize", SN_NOWARN) set_name(0x8012D808, "stream_subsec", SN_NOWARN) set_name(0x8012D80C, "stream_secnum", SN_NOWARN) set_name(0x8012D810, "stream_last_sector", SN_NOWARN) set_name(0x8012D814, "stream_startsec", SN_NOWARN) set_name(0x8012D818, "stream_opened", SN_NOWARN) set_name(0x8012D81C, "stream_last_chunk", SN_NOWARN) set_name(0x8012D820, "stream_got_chunks", SN_NOWARN) set_name(0x8012D824, "last_sector", SN_NOWARN) set_name(0x8012D828, "cdstream_resetsec", SN_NOWARN) set_name(0x8012D82C, "last_handler_event", SN_NOWARN) set_name(0x8012D6F4, "user_start", SN_NOWARN) set_name(0x8012D68C, "vlc_tab", SN_NOWARN) set_name(0x8012D690, "vlc_buf", SN_NOWARN) set_name(0x8012D694, "img_buf", SN_NOWARN) set_name(0x8012D698, "vbuf", SN_NOWARN) set_name(0x8012D69C, "last_fn", SN_NOWARN) set_name(0x8012D6A0, "last_mdc", SN_NOWARN) set_name(0x8012D6A4, "slnum", SN_NOWARN) set_name(0x8012D6A8, "slices_to_do", SN_NOWARN) set_name(0x8012D6AC, "mbuf", SN_NOWARN) set_name(0x8012D6B0, "mfn", SN_NOWARN) set_name(0x8012D6B4, "last_move_mbuf", SN_NOWARN) set_name(0x8012D6B8, "move_request", SN_NOWARN) set_name(0x8012D6BC, "mdec_scale", SN_NOWARN) set_name(0x8012D6C0, "do_brightness", SN_NOWARN) set_name(0x8012D6C4, "frame_decoded", SN_NOWARN) set_name(0x8012D6C8, "mdec_streaming", SN_NOWARN) set_name(0x8012D6CC, "mdec_stream_size", SN_NOWARN) set_name(0x8012D6D0, "first_stream_frame", SN_NOWARN) set_name(0x8012D6D4, "stream_frames_played", SN_NOWARN) set_name(0x8012D6D8, "num_mdcs", SN_NOWARN) set_name(0x8012D6DC, "mdec_head", SN_NOWARN) set_name(0x8012D6E0, "mdec_tail", SN_NOWARN) set_name(0x8012D6E4, "mdec_waiting_tail", SN_NOWARN) set_name(0x8012D6E8, "mdecs_queued", SN_NOWARN) set_name(0x8012D6EC, "mdecs_waiting", SN_NOWARN) set_name(0x8012D6F0, "sfx_volume", SN_NOWARN) set_name(0x8012D6F8, "DiabEnd", SN_NOWARN) set_name(0x8012D6FC, "stream_chunks_in", SN_NOWARN) set_name(0x8012D700, "stream_chunks_total", SN_NOWARN) set_name(0x8012D704, "stream_in", SN_NOWARN) set_name(0x8012D708, "stream_out", SN_NOWARN) set_name(0x8012D70C, "stream_stalled", SN_NOWARN) set_name(0x8012D710, "stream_ending", SN_NOWARN) set_name(0x8012D714, "stream_open", SN_NOWARN) set_name(0x8012D718, "stream_handler_installed", SN_NOWARN) set_name(0x8012D71C, "stream_chunks_borrowed", SN_NOWARN) set_name(0x8012D720, "_get_count", SN_NOWARN) set_name(0x8012D724, "_discard_count", SN_NOWARN) set_name(0x8012D728, "CDTask", SN_NOWARN) set_name(0x8012D72C, "CDStream", SN_NOWARN) set_name(0x8012D730, "cdready_calls", SN_NOWARN) set_name(0x8012D734, "cdready_errors", SN_NOWARN) set_name(0x8012D738, "cdready_out_of_sync", SN_NOWARN) set_name(0x8012D73C, "cdstream_resetting", SN_NOWARN) set_name(0x8012D740, "sector_dma", SN_NOWARN) set_name(0x8012D744, "sector_dma_in", SN_NOWARN) set_name(0x8012D748, "chkaddr", SN_NOWARN) set_name(0x8012D74C, "chunk", SN_NOWARN) set_name(0x8012D750, "first_handler_event", SN_NOWARN) set_name(0x8012D754, "DOSLEEP", SN_NOWARN) set_name(0x8012D8AC, "pStatusPanel", SN_NOWARN) set_name(0x8012D8B0, "pGBoxBuff", SN_NOWARN) set_name(0x8012D8B4, "dropGoldFlag", SN_NOWARN) set_name(0x8012D8B8, "_pinfoflag", SN_NOWARN) set_name(0x800C0AE8, "_infostr", SN_NOWARN) set_name(0x8012D8BC, "_infoclr", SN_NOWARN) set_name(0x800C0CE8, "tempstr", SN_NOWARN) set_name(0x8012D8BE, "drawhpflag", SN_NOWARN) set_name(0x8012D8BF, "drawmanaflag", SN_NOWARN) set_name(0x8012D8C0, "chrflag", SN_NOWARN) set_name(0x8012D8C1, "drawbtnflag", SN_NOWARN) set_name(0x8012D8C2, "panbtndown", SN_NOWARN) set_name(0x8012D8C3, "panelflag", SN_NOWARN) set_name(0x8012D8C4, "chrbtndown", SN_NOWARN) set_name(0x8012D8C5, "lvlbtndown", SN_NOWARN) set_name(0x8012D8C6, "sbookflag", SN_NOWARN) set_name(0x8012D8C7, "talkflag", SN_NOWARN) set_name(0x8012D8C8, "dropGoldValue", SN_NOWARN) set_name(0x8012D8CC, "initialDropGoldValue", SN_NOWARN) set_name(0x8012D8D0, "initialDropGoldIndex", SN_NOWARN) set_name(0x8012D8D4, "pPanelButtons", SN_NOWARN) set_name(0x8012D8D8, "pPanelText", SN_NOWARN) set_name(0x8012D8DC, "pManaBuff", SN_NOWARN) set_name(0x8012D8E0, "pLifeBuff", SN_NOWARN) set_name(0x8012D8E4, "pChrPanel", SN_NOWARN) set_name(0x8012D8E8, "pChrButtons", SN_NOWARN) set_name(0x8012D8EC, "pSpellCels", SN_NOWARN) set_name(0x8012F1C8, "_panelstr", SN_NOWARN) set_name(0x8012F5C8, "_pstrjust", SN_NOWARN) set_name(0x8012E7D8, "_pnumlines", SN_NOWARN) set_name(0x8012D8F0, "InfoBoxRect", SN_NOWARN) set_name(0x8012D8F4, "CSRect", SN_NOWARN) set_name(0x8012E7E8, "_pSpell", SN_NOWARN) set_name(0x8012E7F0, "_pSplType", SN_NOWARN) set_name(0x8012D8FC, "numpanbtns", SN_NOWARN) set_name(0x8012D900, "pDurIcons", SN_NOWARN) set_name(0x8012D904, "drawdurflag", SN_NOWARN) set_name(0x8012E7F8, "chrbtn", SN_NOWARN) set_name(0x8012D905, "chrbtnactive", SN_NOWARN) set_name(0x8012D908, "pSpellBkCel", SN_NOWARN) set_name(0x8012D90C, "pSBkBtnCel", SN_NOWARN) set_name(0x8012D910, "pSBkIconCels", SN_NOWARN) set_name(0x8012D914, "sbooktab", SN_NOWARN) set_name(0x8012D918, "cur_spel", SN_NOWARN) set_name(0x8012E800, "talkofs", SN_NOWARN) set_name(0x8012F618, "sgszTalkMsg", SN_NOWARN) set_name(0x8012E804, "sgbTalkSavePos", SN_NOWARN) set_name(0x8012E805, "sgbNextTalkSave", SN_NOWARN) set_name(0x8012E806, "sgbPlrTalkTbl", SN_NOWARN) set_name(0x8012E808, "pTalkPanel", SN_NOWARN) set_name(0x8012E80C, "pMultiBtns", SN_NOWARN) set_name(0x8012E810, "pTalkBtns", SN_NOWARN) set_name(0x8012E814, "talkbtndown", SN_NOWARN) set_name(0x800C05FC, "SpellITbl", SN_NOWARN) set_name(0x8012D839, "DrawLevelUpFlag", SN_NOWARN) set_name(0x8012D860, "_spselflag", SN_NOWARN) set_name(0x8012D85C, "spspelstate", SN_NOWARN) set_name(0x8012D87C, "initchr", SN_NOWARN) set_name(0x8012D83C, "SPLICONNO", SN_NOWARN) set_name(0x8012D840, "SPLICONY", SN_NOWARN) set_name(0x8012E7E0, "SPLICONRIGHT", SN_NOWARN) set_name(0x8012D844, "scx", SN_NOWARN) set_name(0x8012D848, "scy", SN_NOWARN) set_name(0x8012D84C, "scx1", SN_NOWARN) set_name(0x8012D850, "scy1", SN_NOWARN) set_name(0x8012D854, "scx2", SN_NOWARN) set_name(0x8012D858, "scy2", SN_NOWARN) set_name(0x8012D868, "SpellCol", SN_NOWARN) set_name(0x800C05E8, "SpellColors", SN_NOWARN) set_name(0x800C0624, "SpellPages", SN_NOWARN) set_name(0x8012D86C, "lus", SN_NOWARN) set_name(0x8012D870, "CsNo", SN_NOWARN) set_name(0x8012D874, "plusanim", SN_NOWARN) set_name(0x8012F608, "CSBack", SN_NOWARN) set_name(0x8012D878, "CS_XOFF", SN_NOWARN) set_name(0x800C0688, "CS_Tab", SN_NOWARN) set_name(0x8012D880, "NoCSEntries", SN_NOWARN) set_name(0x8012D884, "SPALOFF", SN_NOWARN) set_name(0x8012D888, "paloffset1", SN_NOWARN) set_name(0x8012D88C, "paloffset2", SN_NOWARN) set_name(0x8012D890, "paloffset3", SN_NOWARN) set_name(0x8012D894, "paloffset4", SN_NOWARN) set_name(0x8012D898, "pinc1", SN_NOWARN) set_name(0x8012D89C, "pinc2", SN_NOWARN) set_name(0x8012D8A0, "pinc3", SN_NOWARN) set_name(0x8012D8A4, "pinc4", SN_NOWARN) set_name(0x8012D92C, "_pcurs", SN_NOWARN) set_name(0x8012D934, "cursW", SN_NOWARN) set_name(0x8012D938, "cursH", SN_NOWARN) set_name(0x8012D93C, "icursW", SN_NOWARN) set_name(0x8012D940, "icursH", SN_NOWARN) set_name(0x8012D944, "icursW28", SN_NOWARN) set_name(0x8012D948, "icursH28", SN_NOWARN) set_name(0x8012D94C, "cursmx", SN_NOWARN) set_name(0x8012D950, "cursmy", SN_NOWARN) set_name(0x8012D954, "_pcursmonst", SN_NOWARN) set_name(0x8012D95C, "_pcursobj", SN_NOWARN) set_name(0x8012D960, "_pcursitem", SN_NOWARN) set_name(0x8012D964, "_pcursinvitem", SN_NOWARN) set_name(0x8012D968, "_pcursplr", SN_NOWARN) set_name(0x8012D928, "sel_data", SN_NOWARN) set_name(0x800C0DE8, "dead", SN_NOWARN) set_name(0x8012D96C, "spurtndx", SN_NOWARN) set_name(0x8012D970, "stonendx", SN_NOWARN) set_name(0x8012D974, "pSquareCel", SN_NOWARN) set_name(0x8012D9B4, "ghInst", SN_NOWARN) set_name(0x8012D9B8, "svgamode", SN_NOWARN) set_name(0x8012D9BC, "MouseX", SN_NOWARN) set_name(0x8012D9C0, "MouseY", SN_NOWARN) set_name(0x8012D9C4, "gv1", SN_NOWARN) set_name(0x8012D9C8, "gv2", SN_NOWARN) set_name(0x8012D9CC, "gv3", SN_NOWARN) set_name(0x8012D9D0, "gv4", SN_NOWARN) set_name(0x8012D9D4, "gv5", SN_NOWARN) set_name(0x8012D9D8, "gbProcessPlayers", SN_NOWARN) set_name(0x800C0F5C, "DebugMonsters", SN_NOWARN) set_name(0x800C0F84, "glSeedTbl", SN_NOWARN) set_name(0x800C0FC8, "gnLevelTypeTbl", SN_NOWARN) set_name(0x8012D9D9, "gbDoEnding", SN_NOWARN) set_name(0x8012D9DA, "gbRunGame", SN_NOWARN) set_name(0x8012D9DB, "gbRunGameResult", SN_NOWARN) set_name(0x8012D9DC, "gbGameLoopStartup", SN_NOWARN) set_name(0x8012F668, "glEndSeed", SN_NOWARN) set_name(0x8012F6B8, "glMid1Seed", SN_NOWARN) set_name(0x8012F708, "glMid2Seed", SN_NOWARN) set_name(0x8012F758, "glMid3Seed", SN_NOWARN) set_name(0x8012E818, "sg_previousFilter", SN_NOWARN) set_name(0x800C100C, "CreateEnv", SN_NOWARN) set_name(0x8012D9E0, "Passedlvldir", SN_NOWARN) set_name(0x8012D9E4, "TempStack", SN_NOWARN) set_name(0x8012D984, "ghMainWnd", SN_NOWARN) set_name(0x8012D988, "fullscreen", SN_NOWARN) set_name(0x8012D98C, "force_redraw", SN_NOWARN) set_name(0x8012D9A0, "PauseMode", SN_NOWARN) set_name(0x8012D9A1, "FriendlyMode", SN_NOWARN) set_name(0x8012D991, "visiondebug", SN_NOWARN) set_name(0x8012D993, "light4flag", SN_NOWARN) set_name(0x8012D994, "leveldebug", SN_NOWARN) set_name(0x8012D995, "monstdebug", SN_NOWARN) set_name(0x8012D99C, "debugmonsttypes", SN_NOWARN) set_name(0x8012D990, "cineflag", SN_NOWARN) set_name(0x8012D992, "scrollflag", SN_NOWARN) set_name(0x8012D996, "trigdebug", SN_NOWARN) set_name(0x8012D998, "setseed", SN_NOWARN) set_name(0x8012D9A4, "sgnTimeoutCurs", SN_NOWARN) set_name(0x8012D9A8, "sgbMouseDown", SN_NOWARN) set_name(0x800C16D8, "towner", SN_NOWARN) set_name(0x8012D9FC, "numtowners", SN_NOWARN) set_name(0x8012DA00, "storeflag", SN_NOWARN) set_name(0x8012DA01, "boyloadflag", SN_NOWARN) set_name(0x8012DA02, "bannerflag", SN_NOWARN) set_name(0x8012DA04, "pCowCels", SN_NOWARN) set_name(0x8012E81C, "sgdwCowClicks", SN_NOWARN) set_name(0x8012E820, "sgnCowMsg", SN_NOWARN) set_name(0x800C1418, "Qtalklist", SN_NOWARN) set_name(0x8012D9F4, "CowPlaying", SN_NOWARN) set_name(0x800C103C, "AnimOrder", SN_NOWARN) set_name(0x800C13B4, "TownCowX", SN_NOWARN) set_name(0x800C13C0, "TownCowY", SN_NOWARN) set_name(0x800C13CC, "TownCowDir", SN_NOWARN) set_name(0x800C13D8, "cowoffx", SN_NOWARN) set_name(0x800C13F8, "cowoffy", SN_NOWARN) set_name(0x8012DA1C, "sfxdelay", SN_NOWARN) set_name(0x8012DA20, "sfxdnum", SN_NOWARN) set_name(0x8012DA14, "sghStream", SN_NOWARN) set_name(0x800C24D8, "sgSFX", SN_NOWARN) set_name(0x8012DA18, "sgpStreamSFX", SN_NOWARN) set_name(0x8012DA24, "orgseed", SN_NOWARN) set_name(0x8012E824, "sglGameSeed", SN_NOWARN) set_name(0x8012DA28, "SeedCount", SN_NOWARN) set_name(0x8012E828, "sgMemCrit", SN_NOWARN) set_name(0x8012E82C, "sgnWidth", SN_NOWARN) set_name(0x8012DA36, "msgflag", SN_NOWARN) set_name(0x8012DA37, "msgdelay", SN_NOWARN) set_name(0x800C3500, "msgtable", SN_NOWARN) set_name(0x800C3450, "MsgStrings", SN_NOWARN) set_name(0x8012DA35, "msgcnt", SN_NOWARN) set_name(0x8012E830, "sgdwProgress", SN_NOWARN) set_name(0x8012E834, "sgdwXY", SN_NOWARN) set_name(0x800C3550, "AllItemsUseable", SN_NOWARN) set_name(0x80123788, "AllItemsList", SN_NOWARN) set_name(0x80124B28, "PL_Prefix", SN_NOWARN) set_name(0x80125848, "PL_Suffix", SN_NOWARN) set_name(0x80126748, "UniqueItemList", SN_NOWARN) set_name(0x800C3764, "item", SN_NOWARN) set_name(0x800C8364, "itemactive", SN_NOWARN) set_name(0x800C83E4, "itemavail", SN_NOWARN) set_name(0x800C8464, "UniqueItemFlag", SN_NOWARN) set_name(0x8012DA70, "uitemflag", SN_NOWARN) set_name(0x8012E838, "tem", SN_NOWARN) set_name(0x8012F7A0, "curruitem", SN_NOWARN) set_name(0x8012F840, "itemhold", SN_NOWARN) set_name(0x8012DA74, "ScrollType", SN_NOWARN) set_name(0x800C84E4, "ItemStr", SN_NOWARN) set_name(0x800C8524, "SufStr", SN_NOWARN) set_name(0x8012DA50, "numitems", SN_NOWARN) set_name(0x8012DA54, "gnNumGetRecords", SN_NOWARN) set_name(0x800C36C0, "ItemInvSnds", SN_NOWARN) set_name(0x800C35F0, "ItemCAnimTbl", SN_NOWARN) set_name(0x80128570, "SinTab", SN_NOWARN) set_name(0x801285B0, "Item2Frm", SN_NOWARN) set_name(0x800C369C, "ItemAnimLs", SN_NOWARN) set_name(0x8012DA58, "ItemAnimSnds", SN_NOWARN) set_name(0x8012DA5C, "idoppely", SN_NOWARN) set_name(0x8012DA60, "ScrollFlag", SN_NOWARN) set_name(0x800C374C, "premiumlvladd", SN_NOWARN) set_name(0x800C9310, "LightList", SN_NOWARN) set_name(0x800C9450, "lightactive", SN_NOWARN) set_name(0x8012DA88, "numlights", SN_NOWARN) set_name(0x8012DA8C, "lightmax", SN_NOWARN) set_name(0x800C9478, "VisionList", SN_NOWARN) set_name(0x8012DA90, "numvision", SN_NOWARN) set_name(0x8012DA94, "dovision", SN_NOWARN) set_name(0x8012DA98, "visionid", SN_NOWARN) set_name(0x8012E83C, "disp_mask", SN_NOWARN) set_name(0x8012E840, "weird", SN_NOWARN) set_name(0x8012E844, "disp_tab_r", SN_NOWARN) set_name(0x8012E848, "dispy_r", SN_NOWARN) set_name(0x8012E84C, "disp_tab_g", SN_NOWARN) set_name(0x8012E850, "dispy_g", SN_NOWARN) set_name(0x8012E854, "disp_tab_b", SN_NOWARN) set_name(0x8012E858, "dispy_b", SN_NOWARN) set_name(0x8012E85C, "radius", SN_NOWARN) set_name(0x8012E860, "bright", SN_NOWARN) set_name(0x8012F850, "mult_tab", SN_NOWARN) set_name(0x8012DA78, "lightflag", SN_NOWARN) set_name(0x800C9024, "vCrawlTable", SN_NOWARN) set_name(0x800C92D8, "RadiusAdj", SN_NOWARN) set_name(0x800C8564, "CrawlTable", SN_NOWARN) set_name(0x8012DA7C, "restore_r", SN_NOWARN) set_name(0x8012DA80, "restore_g", SN_NOWARN) set_name(0x8012DA84, "restore_b", SN_NOWARN) set_name(0x800C92F0, "radius_tab", SN_NOWARN) set_name(0x800C9300, "bright_tab", SN_NOWARN) set_name(0x8012DAB9, "qtextflag", SN_NOWARN) set_name(0x8012DABC, "qtextSpd", SN_NOWARN) set_name(0x8012E864, "pMedTextCels", SN_NOWARN) set_name(0x8012E868, "pTextBoxCels", SN_NOWARN) set_name(0x8012E86C, "qtextptr", SN_NOWARN) set_name(0x8012E870, "qtexty", SN_NOWARN) set_name(0x8012E874, "qtextDelay", SN_NOWARN) set_name(0x8012E878, "sgLastScroll", SN_NOWARN) set_name(0x8012E87C, "scrolltexty", SN_NOWARN) set_name(0x8012E880, "sglMusicVolumeSave", SN_NOWARN) set_name(0x8012DAA8, "qtbodge", SN_NOWARN) set_name(0x800C9638, "QBack", SN_NOWARN) set_name(0x800C9648, "missiledata", SN_NOWARN) set_name(0x800C9DB8, "misfiledata", SN_NOWARN) set_name(0x800C9CA8, "MissPrintRoutines", SN_NOWARN) set_name(0x800C9EA4, "sgLevels", SN_NOWARN) set_name(0x800DDBF0, "sgLocals", SN_NOWARN) set_name(0x8012F8D0, "sgJunk", SN_NOWARN) set_name(0x8012E885, "sgbRecvCmd", SN_NOWARN) set_name(0x8012E888, "sgdwRecvOffset", SN_NOWARN) set_name(0x8012E88C, "sgbDeltaChunks", SN_NOWARN) set_name(0x8012E88D, "sgbDeltaChanged", SN_NOWARN) set_name(0x8012E890, "sgdwOwnerWait", SN_NOWARN) set_name(0x8012E894, "sgpMegaPkt", SN_NOWARN) set_name(0x8012E898, "sgpCurrPkt", SN_NOWARN) set_name(0x8012E89C, "sgnCurrMegaPlayer", SN_NOWARN) set_name(0x8012DAD5, "deltaload", SN_NOWARN) set_name(0x8012DAD6, "gbBufferMsgs", SN_NOWARN) set_name(0x8012DAD8, "dwRecCount", SN_NOWARN) set_name(0x8012DADC, "LevelOut", SN_NOWARN) set_name(0x8012DAF2, "gbMaxPlayers", SN_NOWARN) set_name(0x8012DAF3, "gbActivePlayers", SN_NOWARN) set_name(0x8012DAF4, "gbGameDestroyed", SN_NOWARN) set_name(0x8012DAF5, "gbDeltaSender", SN_NOWARN) set_name(0x8012DAF6, "gbSelectProvider", SN_NOWARN) set_name(0x8012DAF7, "gbSomebodyWonGameKludge", SN_NOWARN) set_name(0x8012E8A0, "sgbSentThisCycle", SN_NOWARN) set_name(0x8012E8A4, "sgdwGameLoops", SN_NOWARN) set_name(0x8012E8A8, "sgwPackPlrOffsetTbl", SN_NOWARN) set_name(0x8012E8AC, "sgbPlayerLeftGameTbl", SN_NOWARN) set_name(0x8012E8B0, "sgdwPlayerLeftReasonTbl", SN_NOWARN) set_name(0x8012E8B8, "sgbSendDeltaTbl", SN_NOWARN) set_name(0x8012E8C0, "sgGameInitInfo", SN_NOWARN) set_name(0x8012E8C8, "sgbTimeout", SN_NOWARN) set_name(0x8012E8CC, "sglTimeoutStart", SN_NOWARN) set_name(0x8012DAEC, "gszVersionNumber", SN_NOWARN) set_name(0x8012DAF1, "sgbNetInited", SN_NOWARN) set_name(0x800DEC58, "ObjTypeConv", SN_NOWARN) set_name(0x800DEE1C, "AllObjects", SN_NOWARN) set_name(0x80128CD8, "ObjMasterLoadList", SN_NOWARN) set_name(0x800DF5FC, "object", SN_NOWARN) set_name(0x8012DB18, "numobjects", SN_NOWARN) set_name(0x800E0BD0, "objectactive", SN_NOWARN) set_name(0x800E0C50, "objectavail", SN_NOWARN) set_name(0x8012DB1C, "InitObjFlag", SN_NOWARN) set_name(0x8012DB20, "trapid", SN_NOWARN) set_name(0x800E0CD0, "ObjFileList", SN_NOWARN) set_name(0x8012DB24, "trapdir", SN_NOWARN) set_name(0x8012DB28, "leverid", SN_NOWARN) set_name(0x8012DB10, "numobjfiles", SN_NOWARN) set_name(0x800DF514, "bxadd", SN_NOWARN) set_name(0x800DF534, "byadd", SN_NOWARN) set_name(0x800DF5BC, "shrineavail", SN_NOWARN) set_name(0x800DF554, "shrinestrs", SN_NOWARN) set_name(0x800DF5D8, "StoryBookName", SN_NOWARN) set_name(0x8012DB14, "myscale", SN_NOWARN) set_name(0x8012DB3C, "gbValidSaveFile", SN_NOWARN) set_name(0x8012DB38, "DoLoadedChar", SN_NOWARN) set_name(0x800E0EF0, "plr", SN_NOWARN) set_name(0x8012DB5C, "myplr", SN_NOWARN) set_name(0x8012DB60, "deathdelay", SN_NOWARN) set_name(0x8012DB64, "deathflag", SN_NOWARN) set_name(0x8012DB65, "light_rad", SN_NOWARN) set_name(0x8012DB54, "light_level", SN_NOWARN) set_name(0x800E0DE8, "MaxStats", SN_NOWARN) set_name(0x8012DB4C, "PlrStructSize", SN_NOWARN) set_name(0x8012DB50, "ItemStructSize", SN_NOWARN) set_name(0x800E0CF8, "plrxoff", SN_NOWARN) set_name(0x800E0D1C, "plryoff", SN_NOWARN) set_name(0x800E0D40, "plrxoff2", SN_NOWARN) set_name(0x800E0D64, "plryoff2", SN_NOWARN) set_name(0x800E0D88, "PlrGFXAnimLens", SN_NOWARN) set_name(0x800E0DAC, "StrengthTbl", SN_NOWARN) set_name(0x800E0DB8, "MagicTbl", SN_NOWARN) set_name(0x800E0DC4, "DexterityTbl", SN_NOWARN) set_name(0x800E0DD0, "VitalityTbl", SN_NOWARN) set_name(0x800E0DDC, "ToBlkTbl", SN_NOWARN) set_name(0x800E0E18, "ExpLvlsTbl", SN_NOWARN) set_name(0x800E5778, "quests", SN_NOWARN) set_name(0x8012DB94, "pQLogCel", SN_NOWARN) set_name(0x8012DB98, "ReturnLvlX", SN_NOWARN) set_name(0x8012DB9C, "ReturnLvlY", SN_NOWARN) set_name(0x8012DBA0, "ReturnLvl", SN_NOWARN) set_name(0x8012DBA4, "ReturnLvlT", SN_NOWARN) set_name(0x8012DBA8, "rporttest", SN_NOWARN) set_name(0x8012DBAC, "qline", SN_NOWARN) set_name(0x8012DBB0, "numqlines", SN_NOWARN) set_name(0x8012DBB4, "qtopline", SN_NOWARN) set_name(0x8012F8E8, "qlist", SN_NOWARN) set_name(0x8012E8D0, "QSRect", SN_NOWARN) set_name(0x8012DB71, "questlog", SN_NOWARN) set_name(0x800E5640, "questlist", SN_NOWARN) set_name(0x8012DB74, "ALLQUESTS", SN_NOWARN) set_name(0x800E5754, "QuestGroup1", SN_NOWARN) set_name(0x800E5760, "QuestGroup2", SN_NOWARN) set_name(0x800E576C, "QuestGroup3", SN_NOWARN) set_name(0x8012DB78, "QuestGroup4", SN_NOWARN) set_name(0x8012DB90, "WaterDone", SN_NOWARN) set_name(0x800E5740, "questtrigstr", SN_NOWARN) set_name(0x8012DB80, "QS_PX", SN_NOWARN) set_name(0x8012DB84, "QS_PY", SN_NOWARN) set_name(0x8012DB88, "QS_PW", SN_NOWARN) set_name(0x8012DB8C, "QS_PH", SN_NOWARN) set_name(0x8012F928, "QSBack", SN_NOWARN) set_name(0x800E58B8, "spelldata", SN_NOWARN) set_name(0x8012DBEF, "stextflag", SN_NOWARN) set_name(0x800E6160, "smithitem", SN_NOWARN) set_name(0x800E6D40, "premiumitem", SN_NOWARN) set_name(0x8012DBF0, "numpremium", SN_NOWARN) set_name(0x8012DBF4, "premiumlevel", SN_NOWARN) set_name(0x800E70D0, "witchitem", SN_NOWARN) set_name(0x800E7CB0, "boyitem", SN_NOWARN) set_name(0x8012DBF8, "boylevel", SN_NOWARN) set_name(0x800E7D48, "golditem", SN_NOWARN) set_name(0x800E7DE0, "healitem", SN_NOWARN) set_name(0x8012DBFC, "stextsize", SN_NOWARN) set_name(0x8012DBFD, "stextscrl", SN_NOWARN) set_name(0x8012E8D8, "stextsel", SN_NOWARN) set_name(0x8012E8DC, "stextlhold", SN_NOWARN) set_name(0x8012E8E0, "stextshold", SN_NOWARN) set_name(0x8012E8E4, "stextvhold", SN_NOWARN) set_name(0x8012E8E8, "stextsval", SN_NOWARN) set_name(0x8012E8EC, "stextsmax", SN_NOWARN) set_name(0x8012E8F0, "stextup", SN_NOWARN) set_name(0x8012E8F4, "stextdown", SN_NOWARN) set_name(0x8012E8F8, "stextscrlubtn", SN_NOWARN) set_name(0x8012E8F9, "stextscrldbtn", SN_NOWARN) set_name(0x8012E8FA, "SItemListFlag", SN_NOWARN) set_name(0x8012F938, "stext", SN_NOWARN) set_name(0x800E89C0, "storehold", SN_NOWARN) set_name(0x800EA640, "storehidx", SN_NOWARN) set_name(0x8012E8FC, "storenumh", SN_NOWARN) set_name(0x8012E900, "gossipstart", SN_NOWARN) set_name(0x8012E904, "gossipend", SN_NOWARN) set_name(0x8012E908, "StoreBackRect", SN_NOWARN) set_name(0x8012E910, "talker", SN_NOWARN) set_name(0x8012DBDC, "pSTextBoxCels", SN_NOWARN) set_name(0x8012DBE0, "pSTextSlidCels", SN_NOWARN) set_name(0x8012DBE4, "SStringY", SN_NOWARN) set_name(0x800E603C, "SBack", SN_NOWARN) set_name(0x800E604C, "SStringYNorm", SN_NOWARN) set_name(0x800E609C, "SStringYBuy0", SN_NOWARN) set_name(0x800E60EC, "SStringYBuy1", SN_NOWARN) set_name(0x800E613C, "talkname", SN_NOWARN) set_name(0x8012DBEE, "InStoreFlag", SN_NOWARN) set_name(0x8012A024, "alltext", SN_NOWARN) set_name(0x8012DC0C, "gdwAllTextEntries", SN_NOWARN) set_name(0x8012E914, "P3Tiles", SN_NOWARN) set_name(0x8012DC1C, "tile", SN_NOWARN) set_name(0x8012DC2C, "_trigflag", SN_NOWARN) set_name(0x800EA8A8, "trigs", SN_NOWARN) set_name(0x8012DC30, "numtrigs", SN_NOWARN) set_name(0x8012DC34, "townwarps", SN_NOWARN) set_name(0x8012DC38, "TWarpFrom", SN_NOWARN) set_name(0x800EA670, "TownDownList", SN_NOWARN) set_name(0x800EA69C, "TownWarp1List", SN_NOWARN) set_name(0x800EA6D0, "L1UpList", SN_NOWARN) set_name(0x800EA700, "L1DownList", SN_NOWARN) set_name(0x800EA728, "L2UpList", SN_NOWARN) set_name(0x800EA734, "L2DownList", SN_NOWARN) set_name(0x800EA748, "L2TWarpUpList", SN_NOWARN) set_name(0x800EA754, "L3UpList", SN_NOWARN) set_name(0x800EA790, "L3DownList", SN_NOWARN) set_name(0x800EA7B4, "L3TWarpUpList", SN_NOWARN) set_name(0x800EA7EC, "L4UpList", SN_NOWARN) set_name(0x800EA7FC, "L4DownList", SN_NOWARN) set_name(0x800EA814, "L4TWarpUpList", SN_NOWARN) set_name(0x800EA824, "L4PentaList", SN_NOWARN) set_name(0x8012DC51, "gbSndInited", SN_NOWARN) set_name(0x8012DC54, "sglMasterVolume", SN_NOWARN) set_name(0x8012DC58, "sglMusicVolume", SN_NOWARN) set_name(0x8012DC5C, "sglSoundVolume", SN_NOWARN) set_name(0x8012DC60, "sglSpeechVolume", SN_NOWARN) set_name(0x8012DC64, "sgnMusicTrack", SN_NOWARN) set_name(0x8012DC52, "gbDupSounds", SN_NOWARN) set_name(0x8012DC68, "sghMusic", SN_NOWARN) set_name(0x8012AE58, "sgszMusicTracks", SN_NOWARN) set_name(0x8012DC80, "_pcurr_inv", SN_NOWARN) set_name(0x800EA8F8, "_pfind_list", SN_NOWARN) set_name(0x8012DC88, "_pfind_index", SN_NOWARN) set_name(0x8012DC8C, "_pfindx", SN_NOWARN) set_name(0x8012DC90, "_pfindy", SN_NOWARN) set_name(0x8012DC92, "automapmoved", SN_NOWARN) set_name(0x8012DC75, "flyflag", SN_NOWARN) set_name(0x8012DC76, "seen_combo", SN_NOWARN) set_name(0x80130658, "GPad1", SN_NOWARN) set_name(0x801306F8, "GPad2", SN_NOWARN) set_name(0x8012E918, "CurrentProc", SN_NOWARN) set_name(0x8012AFEC, "AllMsgs", SN_NOWARN) set_name(0x8012DCCC, "NumOfStrings", SN_NOWARN) set_name(0x8012DCA0, "LanguageType", SN_NOWARN) set_name(0x8012DCA4, "hndText", SN_NOWARN) set_name(0x8012DCA8, "TextPtr", SN_NOWARN) set_name(0x8012DCAC, "LangDbNo", SN_NOWARN) set_name(0x8012DCDC, "MissDat", SN_NOWARN) set_name(0x8012DCE0, "CharFade", SN_NOWARN) set_name(0x8012DCE4, "rotateness", SN_NOWARN) set_name(0x8012DCE8, "spiralling_shape", SN_NOWARN) set_name(0x8012DCEC, "down", SN_NOWARN) set_name(0x800EA948, "MlTab", SN_NOWARN) set_name(0x800EA958, "QlTab", SN_NOWARN) set_name(0x800EA968, "ObjPrintFuncs", SN_NOWARN) set_name(0x8012DD08, "MyXoff1", SN_NOWARN) set_name(0x8012DD0C, "MyYoff1", SN_NOWARN) set_name(0x8012DD10, "MyXoff2", SN_NOWARN) set_name(0x8012DD14, "MyYoff2", SN_NOWARN) set_name(0x8012DD24, "iscflag", SN_NOWARN) set_name(0x8012DD31, "sgbFadedIn", SN_NOWARN) set_name(0x8012DD32, "screenbright", SN_NOWARN) set_name(0x8012DD34, "faderate", SN_NOWARN) set_name(0x8012DD38, "fading", SN_NOWARN) set_name(0x8012DD44, "FadeCoords", SN_NOWARN) set_name(0x8012DD3C, "st", SN_NOWARN) set_name(0x8012DD40, "mode", SN_NOWARN) set_name(0x800EAAF0, "portal", SN_NOWARN) set_name(0x8012DD76, "portalindex", SN_NOWARN) set_name(0x8012DD70, "WarpDropX", SN_NOWARN) set_name(0x8012DD74, "WarpDropY", SN_NOWARN) set_name(0x800EAB08, "MyVerString", SN_NOWARN) set_name(0x8012DED4, "Year", SN_NOWARN) set_name(0x8012DED8, "Day", SN_NOWARN) set_name(0x8012E91C, "tbuff", SN_NOWARN) set_name(0x800EAB80, "IconBuffer", SN_NOWARN) set_name(0x8012E920, "HR1", SN_NOWARN) set_name(0x8012E921, "HR2", SN_NOWARN) set_name(0x8012E922, "HR3", SN_NOWARN) set_name(0x8012E923, "VR1", SN_NOWARN) set_name(0x8012E924, "VR2", SN_NOWARN) set_name(0x8012E925, "VR3", SN_NOWARN) set_name(0x8012DF48, "pHallList", SN_NOWARN) set_name(0x8012DF4C, "nRoomCnt", SN_NOWARN) set_name(0x8012DF50, "nSx1", SN_NOWARN) set_name(0x8012DF54, "nSy1", SN_NOWARN) set_name(0x8012DF58, "nSx2", SN_NOWARN) set_name(0x8012DF5C, "nSy2", SN_NOWARN) set_name(0x8012DF00, "Area_Min", SN_NOWARN) set_name(0x8012DF04, "Room_Max", SN_NOWARN) set_name(0x8012DF08, "Room_Min", SN_NOWARN) set_name(0x8012DF0C, "BIG3", SN_NOWARN) set_name(0x8012DF14, "BIG4", SN_NOWARN) set_name(0x8012DF1C, "BIG6", SN_NOWARN) set_name(0x8012DF24, "BIG7", SN_NOWARN) set_name(0x8012DF2C, "RUINS1", SN_NOWARN) set_name(0x8012DF30, "RUINS2", SN_NOWARN) set_name(0x8012DF34, "RUINS3", SN_NOWARN) set_name(0x8012DF38, "RUINS4", SN_NOWARN) set_name(0x8012DF3C, "RUINS5", SN_NOWARN) set_name(0x8012DF40, "RUINS6", SN_NOWARN) set_name(0x8012DF44, "RUINS7", SN_NOWARN) set_name(0x8012E928, "abyssx", SN_NOWARN) set_name(0x8012E92C, "lavapool", SN_NOWARN) set_name(0x8012DFE8, "lockoutcnt", SN_NOWARN) set_name(0x8012DF6C, "L3TITE12", SN_NOWARN) set_name(0x8012DF74, "L3TITE13", SN_NOWARN) set_name(0x8012DF7C, "L3CREV1", SN_NOWARN) set_name(0x8012DF84, "L3CREV2", SN_NOWARN) set_name(0x8012DF8C, "L3CREV3", SN_NOWARN) set_name(0x8012DF94, "L3CREV4", SN_NOWARN) set_name(0x8012DF9C, "L3CREV5", SN_NOWARN) set_name(0x8012DFA4, "L3CREV6", SN_NOWARN) set_name(0x8012DFAC, "L3CREV7", SN_NOWARN) set_name(0x8012DFB4, "L3CREV8", SN_NOWARN) set_name(0x8012DFBC, "L3CREV9", SN_NOWARN) set_name(0x8012DFC4, "L3CREV10", SN_NOWARN) set_name(0x8012DFCC, "L3CREV11", SN_NOWARN) set_name(0x8012DFD4, "L3XTRA1", SN_NOWARN) set_name(0x8012DFD8, "L3XTRA2", SN_NOWARN) set_name(0x8012DFDC, "L3XTRA3", SN_NOWARN) set_name(0x8012DFE0, "L3XTRA4", SN_NOWARN) set_name(0x8012DFE4, "L3XTRA5", SN_NOWARN) set_name(0x8012DFEC, "diabquad1x", SN_NOWARN) set_name(0x8012DFF0, "diabquad2x", SN_NOWARN) set_name(0x8012DFF4, "diabquad3x", SN_NOWARN) set_name(0x8012DFF8, "diabquad4x", SN_NOWARN) set_name(0x8012DFFC, "diabquad1y", SN_NOWARN) set_name(0x8012E000, "diabquad2y", SN_NOWARN) set_name(0x8012E004, "diabquad3y", SN_NOWARN) set_name(0x8012E008, "diabquad4y", SN_NOWARN) set_name(0x8012E00C, "SP4x1", SN_NOWARN) set_name(0x8012E010, "SP4y1", SN_NOWARN) set_name(0x8012E014, "SP4x2", SN_NOWARN) set_name(0x8012E018, "SP4y2", SN_NOWARN) set_name(0x8012E01C, "l4holdx", SN_NOWARN) set_name(0x8012E020, "l4holdy", SN_NOWARN) set_name(0x8012E930, "lpSetPiece1", SN_NOWARN) set_name(0x8012E934, "lpSetPiece2", SN_NOWARN) set_name(0x8012E938, "lpSetPiece3", SN_NOWARN) set_name(0x8012E93C, "lpSetPiece4", SN_NOWARN) set_name(0x8012E940, "lppSetPiece2", SN_NOWARN) set_name(0x8012E944, "lppSetPiece3", SN_NOWARN) set_name(0x8012E948, "lppSetPiece4", SN_NOWARN) set_name(0x8012E030, "SkelKingTrans1", SN_NOWARN) set_name(0x8012E038, "SkelKingTrans2", SN_NOWARN) set_name(0x800EAE80, "SkelKingTrans3", SN_NOWARN) set_name(0x800EAE94, "SkelKingTrans4", SN_NOWARN) set_name(0x800EAEB0, "SkelChamTrans1", SN_NOWARN) set_name(0x8012E040, "SkelChamTrans2", SN_NOWARN) set_name(0x800EAEC4, "SkelChamTrans3", SN_NOWARN) set_name(0x8012E134, "DoUiForChooseMonster", SN_NOWARN) set_name(0x800EAEE8, "MgToText", SN_NOWARN) set_name(0x800EAF70, "StoryText", SN_NOWARN) set_name(0x800EAF94, "dungeon", SN_NOWARN) set_name(0x800EC194, "pdungeon", SN_NOWARN) set_name(0x800EC7D4, "dflags", SN_NOWARN) set_name(0x8012E158, "setpc_x", SN_NOWARN) set_name(0x8012E15C, "setpc_y", SN_NOWARN) set_name(0x8012E160, "setpc_w", SN_NOWARN) set_name(0x8012E164, "setpc_h", SN_NOWARN) set_name(0x8012E168, "setloadflag", SN_NOWARN) set_name(0x8012E16C, "pMegaTiles", SN_NOWARN) set_name(0x800ECE14, "nBlockTable", SN_NOWARN) set_name(0x800ED618, "nSolidTable", SN_NOWARN) set_name(0x800EDE1C, "nTransTable", SN_NOWARN) set_name(0x800EE620, "nMissileTable", SN_NOWARN) set_name(0x800EEE24, "nTrapTable", SN_NOWARN) set_name(0x8012E170, "dminx", SN_NOWARN) set_name(0x8012E174, "dminy", SN_NOWARN) set_name(0x8012E178, "dmaxx", SN_NOWARN) set_name(0x8012E17C, "dmaxy", SN_NOWARN) set_name(0x8012E180, "gnDifficulty", SN_NOWARN) set_name(0x8012E184, "currlevel", SN_NOWARN) set_name(0x8012E185, "leveltype", SN_NOWARN) set_name(0x8012E186, "setlevel", SN_NOWARN) set_name(0x8012E187, "setlvlnum", SN_NOWARN) set_name(0x8012E188, "setlvltype", SN_NOWARN) set_name(0x8012E18C, "ViewX", SN_NOWARN) set_name(0x8012E190, "ViewY", SN_NOWARN) set_name(0x8012E194, "ViewDX", SN_NOWARN) set_name(0x8012E198, "ViewDY", SN_NOWARN) set_name(0x8012E19C, "ViewBX", SN_NOWARN) set_name(0x8012E1A0, "ViewBY", SN_NOWARN) set_name(0x800EF628, "ScrollInfo", SN_NOWARN) set_name(0x8012E1A4, "LvlViewX", SN_NOWARN) set_name(0x8012E1A8, "LvlViewY", SN_NOWARN) set_name(0x8012E1AC, "btmbx", SN_NOWARN) set_name(0x8012E1B0, "btmby", SN_NOWARN) set_name(0x8012E1B4, "btmdx", SN_NOWARN) set_name(0x8012E1B8, "btmdy", SN_NOWARN) set_name(0x8012E1BC, "MicroTileLen", SN_NOWARN) set_name(0x8012E1C0, "TransVal", SN_NOWARN) set_name(0x800EF63C, "TransList", SN_NOWARN) set_name(0x8012E1C4, "themeCount", SN_NOWARN) set_name(0x800EF65C, "dung_map", SN_NOWARN) set_name(0x8011191C, "dung_map_r", SN_NOWARN) set_name(0x80112480, "dung_map_g", SN_NOWARN) set_name(0x80112FE4, "dung_map_b", SN_NOWARN) set_name(0x80113B48, "MinisetXY", SN_NOWARN) set_name(0x8012E150, "pSetPiece", SN_NOWARN) set_name(0x8012E154, "DungSize", SN_NOWARN) set_name(0x80113D14, "theme", SN_NOWARN) set_name(0x8012E204, "numthemes", SN_NOWARN) set_name(0x8012E208, "zharlib", SN_NOWARN) set_name(0x8012E20C, "armorFlag", SN_NOWARN) set_name(0x8012E20D, "bCrossFlag", SN_NOWARN) set_name(0x8012E20E, "weaponFlag", SN_NOWARN) set_name(0x8012E210, "themex", SN_NOWARN) set_name(0x8012E214, "themey", SN_NOWARN) set_name(0x8012E218, "themeVar1", SN_NOWARN) set_name(0x8012E21C, "bFountainFlag", SN_NOWARN) set_name(0x8012E21D, "cauldronFlag", SN_NOWARN) set_name(0x8012E21E, "mFountainFlag", SN_NOWARN) set_name(0x8012E21F, "pFountainFlag", SN_NOWARN) set_name(0x8012E220, "tFountainFlag", SN_NOWARN) set_name(0x8012E221, "treasureFlag", SN_NOWARN) set_name(0x8012E224, "ThemeGoodIn", SN_NOWARN) set_name(0x80113BF4, "ThemeGood", SN_NOWARN) set_name(0x80113C04, "trm5x", SN_NOWARN) set_name(0x80113C68, "trm5y", SN_NOWARN) set_name(0x80113CCC, "trm3x", SN_NOWARN) set_name(0x80113CF0, "trm3y", SN_NOWARN) set_name(0x8012E2FC, "nummissiles", SN_NOWARN) set_name(0x80113F2C, "missileactive", SN_NOWARN) set_name(0x80114120, "missileavail", SN_NOWARN) set_name(0x8012E300, "MissilePreFlag", SN_NOWARN) set_name(0x80114314, "missile", SN_NOWARN) set_name(0x8012E301, "ManashieldFlag", SN_NOWARN) set_name(0x8012E302, "ManashieldFlag2", SN_NOWARN) set_name(0x80113EA4, "XDirAdd", SN_NOWARN) set_name(0x80113EC4, "YDirAdd", SN_NOWARN) set_name(0x8012E2C9, "fadetor", SN_NOWARN) set_name(0x8012E2CA, "fadetog", SN_NOWARN) set_name(0x8012E2CB, "fadetob", SN_NOWARN) set_name(0x80113EE4, "ValueTable", SN_NOWARN) set_name(0x80113EF4, "StringTable", SN_NOWARN) set_name(0x80116BC4, "monster", SN_NOWARN) set_name(0x8012E364, "nummonsters", SN_NOWARN) set_name(0x8011C344, "monstactive", SN_NOWARN) set_name(0x8011C4D4, "monstkills", SN_NOWARN) set_name(0x8011C664, "Monsters", SN_NOWARN) set_name(0x8012E368, "monstimgtot", SN_NOWARN) set_name(0x8012E36C, "totalmonsters", SN_NOWARN) set_name(0x8012E370, "uniquetrans", SN_NOWARN) set_name(0x8012E94C, "sgbSaveSoundOn", SN_NOWARN) set_name(0x8012E334, "offset_x", SN_NOWARN) set_name(0x8012E33C, "offset_y", SN_NOWARN) set_name(0x8012E31C, "left", SN_NOWARN) set_name(0x8012E324, "right", SN_NOWARN) set_name(0x8012E32C, "opposite", SN_NOWARN) set_name(0x8012E310, "nummtypes", SN_NOWARN) set_name(0x8012E314, "animletter", SN_NOWARN) set_name(0x80116A24, "MWVel", SN_NOWARN) set_name(0x8012E344, "rnd5", SN_NOWARN) set_name(0x8012E348, "rnd10", SN_NOWARN) set_name(0x8012E34C, "rnd20", SN_NOWARN) set_name(0x8012E350, "rnd60", SN_NOWARN) set_name(0x80116B44, "AiProc", SN_NOWARN) set_name(0x8011CB3C, "monsterdata", SN_NOWARN) set_name(0x8011E57C, "MonstConvTbl", SN_NOWARN) set_name(0x8011E5FC, "MonstAvailTbl", SN_NOWARN) set_name(0x8011E66C, "UniqMonst", SN_NOWARN) set_name(0x8011C924, "TransPals", SN_NOWARN) set_name(0x8011C824, "StonePals", SN_NOWARN) set_name(0x8012E3A8, "invflag", SN_NOWARN) set_name(0x8012E3A9, "drawsbarflag", SN_NOWARN) set_name(0x8012E3AC, "InvBackY", SN_NOWARN) set_name(0x8012E3B0, "InvCursPos", SN_NOWARN) set_name(0x8011F614, "InvSlotTable", SN_NOWARN) set_name(0x8012E3B4, "InvBackAY", SN_NOWARN) set_name(0x8012E3B8, "InvSel", SN_NOWARN) set_name(0x8012E3BC, "ItemW", SN_NOWARN) set_name(0x8012E3C0, "ItemH", SN_NOWARN) set_name(0x8012E3C4, "ItemNo", SN_NOWARN) set_name(0x8012E3C8, "BRect", SN_NOWARN) set_name(0x8012E390, "InvPanelTData", SN_NOWARN) set_name(0x8012E394, "InvGfxTData", SN_NOWARN) set_name(0x8012E38C, "InvPageNo", SN_NOWARN) set_name(0x8011EF9C, "AP2x2Tbl", SN_NOWARN) set_name(0x8011EFC4, "InvRect", SN_NOWARN) set_name(0x8011F20C, "InvGfxTable", SN_NOWARN) set_name(0x8011F4AC, "InvItemWidth", SN_NOWARN) set_name(0x8011F560, "InvItemHeight", SN_NOWARN) set_name(0x8012E3A0, "InvOn", SN_NOWARN) set_name(0x8012E3A4, "sgdwLastTime", SN_NOWARN) set_name(0x8012E3FF, "automapflag", SN_NOWARN) set_name(0x8011F678, "automapview", SN_NOWARN) set_name(0x8011F740, "automaptype", SN_NOWARN) set_name(0x8012E400, "AMLWallFlag", SN_NOWARN) set_name(0x8012E401, "AMRWallFlag", SN_NOWARN) set_name(0x8012E402, "AMLLWallFlag", SN_NOWARN) set_name(0x8012E403, "AMLRWallFlag", SN_NOWARN) set_name(0x8012E404, "AMDirtFlag", SN_NOWARN) set_name(0x8012E405, "AMColumnFlag", SN_NOWARN) set_name(0x8012E406, "AMStairFlag", SN_NOWARN) set_name(0x8012E407, "AMLDoorFlag", SN_NOWARN) set_name(0x8012E408, "AMLGrateFlag", SN_NOWARN) set_name(0x8012E409, "AMLArchFlag", SN_NOWARN) set_name(0x8012E40A, "AMRDoorFlag", SN_NOWARN) set_name(0x8012E40B, "AMRGrateFlag", SN_NOWARN) set_name(0x8012E40C, "AMRArchFlag", SN_NOWARN) set_name(0x8012E410, "AutoMapX", SN_NOWARN) set_name(0x8012E414, "AutoMapY", SN_NOWARN) set_name(0x8012E418, "AutoMapXOfs", SN_NOWARN) set_name(0x8012E41C, "AutoMapYOfs", SN_NOWARN) set_name(0x8012E420, "AMPlayerX", SN_NOWARN) set_name(0x8012E424, "AMPlayerY", SN_NOWARN) set_name(0x8012E3DC, "AutoMapScale", SN_NOWARN) set_name(0x8012E3E0, "AutoMapPlayerR", SN_NOWARN) set_name(0x8012E3E1, "AutoMapPlayerG", SN_NOWARN) set_name(0x8012E3E2, "AutoMapPlayerB", SN_NOWARN) set_name(0x8012E3E3, "AutoMapWallR", SN_NOWARN) set_name(0x8012E3E4, "AutoMapWallG", SN_NOWARN) set_name(0x8012E3E5, "AutoMapWallB", SN_NOWARN) set_name(0x8012E3E6, "AutoMapDoorR", SN_NOWARN) set_name(0x8012E3E7, "AutoMapDoorG", SN_NOWARN) set_name(0x8012E3E8, "AutoMapDoorB", SN_NOWARN) set_name(0x8012E3E9, "AutoMapColumnR", SN_NOWARN) set_name(0x8012E3EA, "AutoMapColumnG", SN_NOWARN) set_name(0x8012E3EB, "AutoMapColumnB", SN_NOWARN) set_name(0x8012E3EC, "AutoMapArchR", SN_NOWARN) set_name(0x8012E3ED, "AutoMapArchG", SN_NOWARN) set_name(0x8012E3EE, "AutoMapArchB", SN_NOWARN) set_name(0x8012E3EF, "AutoMapStairR", SN_NOWARN) set_name(0x8012E3F0, "AutoMapStairG", SN_NOWARN) set_name(0x8012E3F1, "AutoMapStairB", SN_NOWARN) set_name(0x8011F660, "SetLevelName", SN_NOWARN) set_name(0x8012EAA8, "GazTick", SN_NOWARN) set_name(0x80135560, "RndTabs", SN_NOWARN) set_name(0x800A89D4, "DefaultRnd", SN_NOWARN) set_name(0x8012EAD0, "PollFunc", SN_NOWARN) set_name(0x8012EAB4, "MsgFunc", SN_NOWARN) set_name(0x8012EB00, "ErrorFunc", SN_NOWARN) set_name(0x8012E9D4, "ActiveTasks", SN_NOWARN) set_name(0x8012E9D8, "CurrentTask", SN_NOWARN) set_name(0x8012E9DC, "T", SN_NOWARN) set_name(0x8012E9E0, "MemTypeForTasker", SN_NOWARN) set_name(0x80132D90, "SchEnv", SN_NOWARN) set_name(0x8012E9E4, "ExecId", SN_NOWARN) set_name(0x8012E9E8, "ExecMask", SN_NOWARN) set_name(0x8012E9EC, "TasksActive", SN_NOWARN) set_name(0x8012E9F0, "EpiFunc", SN_NOWARN) set_name(0x8012E9F4, "ProFunc", SN_NOWARN) set_name(0x8012E9F8, "EpiProId", SN_NOWARN) set_name(0x8012E9FC, "EpiProMask", SN_NOWARN) set_name(0x8012EA00, "DoTasksPrologue", SN_NOWARN) set_name(0x8012EA04, "DoTasksEpilogue", SN_NOWARN) set_name(0x8012EA08, "StackFloodCallback", SN_NOWARN) set_name(0x8012EA0C, "ExtraStackProtection", SN_NOWARN) set_name(0x8012EA10, "ExtraStackSizeLongs", SN_NOWARN) set_name(0x8012EABC, "LastPtr", SN_NOWARN) set_name(0x800A8A0C, "WorkMemInfo", SN_NOWARN) set_name(0x8012EA14, "MemInitBlocks", SN_NOWARN) set_name(0x80132DC0, "MemHdrBlocks", SN_NOWARN) set_name(0x8012EA18, "FreeBlocks", SN_NOWARN) set_name(0x8012EA1C, "LastError", SN_NOWARN) set_name(0x8012EA20, "TimeStamp", SN_NOWARN) set_name(0x8012EA24, "FullErrorChecking", SN_NOWARN) set_name(0x8012EA28, "LastAttemptedAlloc", SN_NOWARN) set_name(0x8012EA2C, "LastDeallocedBlock", SN_NOWARN) set_name(0x8012EA30, "VerbLev", SN_NOWARN) set_name(0x8012EA34, "NumOfFreeHdrs", SN_NOWARN) set_name(0x8012EA38, "LastTypeAlloced", SN_NOWARN) set_name(0x8012EA3C, "AllocFilter", SN_NOWARN) set_name(0x800A8A14, "GalErrors", SN_NOWARN) set_name(0x800A8A3C, "PhantomMem", SN_NOWARN) set_name(0x80133F40, "buf", SN_NOWARN) set_name(0x800A8A64, "NULL_REP", SN_NOWARN)
psx/_dump_/35/_dump_ida_/make_psx.py
set_name(0x8007B9C0, "GetTpY__FUs", SN_NOWARN) set_name(0x8007B9DC, "GetTpX__FUs", SN_NOWARN) set_name(0x8007B9E8, "Remove96__Fv", SN_NOWARN) set_name(0x8007BA20, "AppMain", SN_NOWARN) set_name(0x8007BAC0, "MAIN_RestartGameTask__Fv", SN_NOWARN) set_name(0x8007BAEC, "GameTask__FP4TASK", SN_NOWARN) set_name(0x8007BBD4, "MAIN_MainLoop__Fv", SN_NOWARN) set_name(0x8007BC1C, "CheckMaxArgs__Fv", SN_NOWARN) set_name(0x8007BC50, "GPUQ_InitModule__Fv", SN_NOWARN) set_name(0x8007BC5C, "GPUQ_FlushQ__Fv", SN_NOWARN) set_name(0x8007BDD0, "GPUQ_LoadImage__FP4RECTli", SN_NOWARN) set_name(0x8007BE84, "GPUQ_DiscardHandle__Fl", SN_NOWARN) set_name(0x8007BF24, "GPUQ_LoadClutAddr__FiiiPv", SN_NOWARN) set_name(0x8007BFC0, "GPUQ_MoveImage__FP4RECTii", SN_NOWARN) set_name(0x8007C060, "PRIM_Open__FiiiP10SCREEN_ENVUl", SN_NOWARN) set_name(0x8007C17C, "InitPrimBuffer__FP11PRIM_BUFFERii", SN_NOWARN) set_name(0x8007C258, "PRIM_Clip__FP4RECTi", SN_NOWARN) set_name(0x8007C380, "PRIM_GetCurrentScreen__Fv", SN_NOWARN) set_name(0x8007C38C, "PRIM_FullScreen__Fi", SN_NOWARN) set_name(0x8007C3C8, "PRIM_Flush__Fv", SN_NOWARN) set_name(0x8007C5DC, "PRIM_GetCurrentOtList__Fv", SN_NOWARN) set_name(0x8007C5E8, "ClearPbOnDrawSync", SN_NOWARN) set_name(0x8007C624, "ClearedYet__Fv", SN_NOWARN) set_name(0x8007C630, "PrimDrawSycnCallBack", SN_NOWARN) set_name(0x8007C650, "SendDispEnv__Fv", SN_NOWARN) set_name(0x8007C674, "PRIM_GetNextPolyF4__Fv", SN_NOWARN) set_name(0x8007C68C, "PRIM_GetNextPolyFt4__Fv", SN_NOWARN) set_name(0x8007C6A4, "PRIM_GetNextPolyGt4__Fv", SN_NOWARN) set_name(0x8007C6BC, "PRIM_GetNextPolyG4__Fv", SN_NOWARN) set_name(0x8007C6D4, "PRIM_GetNextPolyF3__Fv", SN_NOWARN) set_name(0x8007C6EC, "PRIM_GetNextDrArea__Fv", SN_NOWARN) set_name(0x8007C704, "ClipRect__FRC4RECTR4RECT", SN_NOWARN) set_name(0x8007C818, "IsColiding__FRC4RECTT0", SN_NOWARN) set_name(0x8007C880, "VID_AfterDisplay__Fv", SN_NOWARN) set_name(0x8007C8A0, "VID_ScrOn__Fv", SN_NOWARN) set_name(0x8007C8C8, "VID_DoThisNextSync__FPFv_v", SN_NOWARN) set_name(0x8007C920, "VID_NextSyncRoutHasExecuted__Fv", SN_NOWARN) set_name(0x8007C92C, "VID_GetTick__Fv", SN_NOWARN) set_name(0x8007C938, "VID_DispEnvSend", SN_NOWARN) set_name(0x8007C974, "VID_SetXYOff__Fii", SN_NOWARN) set_name(0x8007C984, "VID_GetXOff__Fv", SN_NOWARN) set_name(0x8007C990, "VID_GetYOff__Fv", SN_NOWARN) set_name(0x8007C99C, "VID_SetDBuffer__Fb", SN_NOWARN) set_name(0x8007CB0C, "MyFilter__FUlUlPCc", SN_NOWARN) set_name(0x8007CB14, "SlowMemMove__FPvT0Ul", SN_NOWARN) set_name(0x8007CB34, "GetTpY__FUs_addr_8007CB34", SN_NOWARN) set_name(0x8007CB50, "GetTpX__FUs_addr_8007CB50", SN_NOWARN) set_name(0x8007CB5C, "SYSI_GetFs__Fv", SN_NOWARN) set_name(0x8007CB68, "SYSI_GetOverlayFs__Fv", SN_NOWARN) set_name(0x8007CB74, "SortOutFileSystem__Fv", SN_NOWARN) set_name(0x8007CCB0, "MemCb__FlPvUlPCcii", SN_NOWARN) set_name(0x8007CCD0, "Spanker__Fv", SN_NOWARN) set_name(0x8007CD10, "GaryLiddon__Fv", SN_NOWARN) set_name(0x8007CD18, "ReadPad__Fi", SN_NOWARN) set_name(0x8007CE74, "DummyPoll__Fv", SN_NOWARN) set_name(0x8007CE7C, "DaveOwens__Fv", SN_NOWARN) set_name(0x8007CEA4, "GetCur__C4CPad", SN_NOWARN) set_name(0x8007CECC, "CheckActive__4CPad", SN_NOWARN) set_name(0x8007CED8, "GetTpY__FUs_addr_8007CED8", SN_NOWARN) set_name(0x8007CEF4, "GetTpX__FUs_addr_8007CEF4", SN_NOWARN) set_name(0x8007CF00, "TimSwann__Fv", SN_NOWARN) set_name(0x8007CF08, "__6FileIOUl", SN_NOWARN) set_name(0x8007CF58, "___6FileIO", SN_NOWARN) set_name(0x8007CFAC, "Read__6FileIOPCcUl", SN_NOWARN) set_name(0x8007D114, "FileLen__6FileIOPCc", SN_NOWARN) set_name(0x8007D178, "FileNotFound__6FileIOPCc", SN_NOWARN) set_name(0x8007D198, "StreamFile__6FileIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007D278, "ReadAtAddr__6FileIOPCcPUci", SN_NOWARN) set_name(0x8007D33C, "DumpOldPath__6FileIO", SN_NOWARN) set_name(0x8007D3A0, "SetSearchPath__6FileIOPCc", SN_NOWARN) set_name(0x8007D47C, "FindFile__6FileIOPCcPc", SN_NOWARN) set_name(0x8007D590, "CopyPathItem__6FileIOPcPCc", SN_NOWARN) set_name(0x8007D638, "LockSearchPath__6FileIO", SN_NOWARN) set_name(0x8007D690, "UnlockSearchPath__6FileIO", SN_NOWARN) set_name(0x8007D6E8, "SearchPathExists__6FileIO", SN_NOWARN) set_name(0x8007D6FC, "Save__6FileIOPCcPUci", SN_NOWARN) set_name(0x8007D738, "__4PCIOUl", SN_NOWARN) set_name(0x8007D7A0, "___4PCIO", SN_NOWARN) set_name(0x8007D7F8, "FileExists__4PCIOPCc", SN_NOWARN) set_name(0x8007D83C, "LoReadFileAtAddr__4PCIOPCcPUci", SN_NOWARN) set_name(0x8007D900, "GetFileLength__4PCIOPCc", SN_NOWARN) set_name(0x8007D9B8, "LoSave__4PCIOPCcPUci", SN_NOWARN) set_name(0x8007DA8C, "LoStreamFile__4PCIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007DC9C, "__6SysObj", SN_NOWARN) set_name(0x8007DCB4, "__nw__6SysObji", SN_NOWARN) set_name(0x8007DCE0, "__nw__6SysObjiUl", SN_NOWARN) set_name(0x8007DD5C, "__dl__6SysObjPv", SN_NOWARN) set_name(0x8007DDC8, "__5DatIOUl", SN_NOWARN) set_name(0x8007DE04, "___5DatIO", SN_NOWARN) set_name(0x8007DE5C, "FileExists__5DatIOPCc", SN_NOWARN) set_name(0x8007DE9C, "LoReadFileAtAddr__5DatIOPCcPUci", SN_NOWARN) set_name(0x8007DF5C, "GetFileLength__5DatIOPCc", SN_NOWARN) set_name(0x8007E010, "LoSave__5DatIOPCcPUci", SN_NOWARN) set_name(0x8007E0B8, "LoStreamFile__5DatIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x8007E2C4, "__7TextDat", SN_NOWARN) set_name(0x8007E304, "___7TextDat", SN_NOWARN) set_name(0x8007E34C, "Use__7TextDat", SN_NOWARN) set_name(0x8007E540, "TpLoadCallBack__FPUciib", SN_NOWARN) set_name(0x8007E610, "StreamLoadTP__7TextDat", SN_NOWARN) set_name(0x8007E6C8, "FinishedUsing__7TextDat", SN_NOWARN) set_name(0x8007E724, "MakeBlockOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007E794, "MakeOffsetTab__C9CBlockHdr", SN_NOWARN) set_name(0x8007E8C0, "SetUVTp__7TextDatP9FRAME_HDRP8POLY_FT4ii", SN_NOWARN) set_name(0x8007E9C0, "PrintMonster__7TextDatiiibi", SN_NOWARN) set_name(0x8007EDCC, "PrepareFt4__7TextDatP8POLY_FT4iiiii", SN_NOWARN) set_name(0x8007F038, "GetDecompBufffer__7TextDati", SN_NOWARN) set_name(0x8007F198, "SetUVTpGT4__7TextDatP9FRAME_HDRP8POLY_GT4ii", SN_NOWARN) set_name(0x8007F298, "PrepareGt4__7TextDatP8POLY_GT4iiiii", SN_NOWARN) set_name(0x8007F4F0, "SetUVTpGT3__7TextDatP9FRAME_HDRP8POLY_GT3", SN_NOWARN) set_name(0x8007F574, "PrepareGt3__7TextDatP8POLY_GT3iii", SN_NOWARN) set_name(0x8007F73C, "PrintFt4__7TextDatiiiiii", SN_NOWARN) set_name(0x8007F890, "PrintGt4__7TextDatiiiiii", SN_NOWARN) set_name(0x8007F9E4, "PrintGt3__7TextDatiiii", SN_NOWARN) set_name(0x8007FAC8, "DecompFrame__7TextDatP9FRAME_HDR", SN_NOWARN) set_name(0x8007FC20, "MakeCreatureOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007FD60, "MakePalOffsetTab__7TextDat", SN_NOWARN) set_name(0x8007FE5C, "InitData__7TextDat", SN_NOWARN) set_name(0x8007FE88, "DumpData__7TextDat", SN_NOWARN) set_name(0x8007FFD0, "GM_UseTexData__Fi", SN_NOWARN) set_name(0x800800F0, "GM_FinishedUsing__FP7TextDat", SN_NOWARN) set_name(0x80080144, "SetPal__7TextDatP9FRAME_HDRP8POLY_FT4", SN_NOWARN) set_name(0x80080208, "GetFrNum__7TextDatiiii", SN_NOWARN) set_name(0x8008025C, "IsDirAliased__7TextDatiii", SN_NOWARN) set_name(0x800802B4, "DoDecompRequests__7TextDat", SN_NOWARN) set_name(0x800803D8, "FindDecompArea__7TextDatR4RECT", SN_NOWARN) set_name(0x800804B0, "GetFileInfo__7TextDati", SN_NOWARN) set_name(0x80080500, "GetSize__C15CCreatureAction", SN_NOWARN) set_name(0x80080528, "GetFrNum__C15CCreatureActionii", SN_NOWARN) set_name(0x800805D0, "InitDirRemap__15CCreatureAction", SN_NOWARN) set_name(0x80080690, "GetFrNum__C12CCreatureHdriii", SN_NOWARN) set_name(0x800806D4, "GetAction__C12CCreatureHdri", SN_NOWARN) set_name(0x80080764, "InitActionDirRemaps__12CCreatureHdr", SN_NOWARN) set_name(0x800807D4, "GetSize__C12CCreatureHdr", SN_NOWARN) set_name(0x80080840, "LoadDat__C13CTextFileInfo", SN_NOWARN) set_name(0x80080890, "LoadHdr__C13CTextFileInfo", SN_NOWARN) set_name(0x800808B8, "GetFile__C13CTextFileInfoPc", SN_NOWARN) set_name(0x80080954, "HasFile__C13CTextFileInfoPc", SN_NOWARN) set_name(0x800809BC, "Un64__FPUcT0l", SN_NOWARN) set_name(0x80080A90, "__7CScreen", SN_NOWARN) set_name(0x80080AC4, "Load__7CScreeniii", SN_NOWARN) set_name(0x80080D64, "Unload__7CScreen", SN_NOWARN) set_name(0x80080D88, "Display__7CScreeniiii", SN_NOWARN) set_name(0x80081068, "SetRect__5CPartR7TextDatR4RECT", SN_NOWARN) set_name(0x800810E4, "GetBoundingBox__6CBlockR7TextDatR4RECT", SN_NOWARN) set_name(0x80081240, "_GLOBAL__D_DatPool", SN_NOWARN) set_name(0x80081298, "_GLOBAL__I_DatPool", SN_NOWARN) set_name(0x800812EC, "PRIM_GetPrim__FPP8POLY_GT3", SN_NOWARN) set_name(0x80081368, "PRIM_GetPrim__FPP8POLY_GT4", SN_NOWARN) set_name(0x800813E4, "PRIM_GetPrim__FPP8POLY_FT4", SN_NOWARN) set_name(0x80081460, "CanXferFrame__C7TextDat", SN_NOWARN) set_name(0x80081488, "CanXferPal__C7TextDat", SN_NOWARN) set_name(0x800814B0, "IsLoaded__C7TextDat", SN_NOWARN) set_name(0x800814BC, "GetTexNum__C7TextDat", SN_NOWARN) set_name(0x800814C8, "GetCreature__7TextDati", SN_NOWARN) set_name(0x80081540, "GetNumOfCreatures__7TextDat", SN_NOWARN) set_name(0x80081554, "SetFileInfo__7TextDatPC13CTextFileInfoi", SN_NOWARN) set_name(0x80081560, "GetNumOfFrames__7TextDat", SN_NOWARN) set_name(0x80081574, "GetPal__7TextDati", SN_NOWARN) set_name(0x80081590, "GetFr__7TextDati", SN_NOWARN) set_name(0x800815AC, "GetName__C13CTextFileInfo", SN_NOWARN) set_name(0x800815B8, "HasDat__C13CTextFileInfo", SN_NOWARN) set_name(0x800815E0, "HasTp__C13CTextFileInfo", SN_NOWARN) set_name(0x80081608, "GetSize__C6CBlock", SN_NOWARN) set_name(0x8008161C, "__4CdIOUl", SN_NOWARN) set_name(0x80081660, "___4CdIO", SN_NOWARN) set_name(0x800816B8, "FileExists__4CdIOPCc", SN_NOWARN) set_name(0x800816DC, "LoReadFileAtAddr__4CdIOPCcPUci", SN_NOWARN) set_name(0x80081760, "GetFileLength__4CdIOPCc", SN_NOWARN) set_name(0x80081784, "LoSave__4CdIOPCcPUci", SN_NOWARN) set_name(0x80081864, "LoStreamCallBack__Fi", SN_NOWARN) set_name(0x80081874, "CD_GetCdlFILE__FPCcP7CdlFILE", SN_NOWARN) set_name(0x800819C0, "LoStreamFile__4CdIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x80081C9C, "LoAsyncStreamFile__4CdIOPCciPFPUciib_bii", SN_NOWARN) set_name(0x80081DFC, "BL_InitEAC__Fv", SN_NOWARN) set_name(0x80081EE8, "BL_ReadFile__FPcUl", SN_NOWARN) set_name(0x80082014, "BL_AsyncReadFile__FPcUl", SN_NOWARN) set_name(0x80082188, "BL_LoadDirectory__Fv", SN_NOWARN) set_name(0x800822B0, "BL_LoadStreamDir__Fv", SN_NOWARN) set_name(0x80082590, "BL_MakeFilePosTab__FPUcUl", SN_NOWARN) set_name(0x80082690, "BL_FindStreamFile__FPcc", SN_NOWARN) set_name(0x8008285C, "BL_FileExists__FPcc", SN_NOWARN) set_name(0x80082880, "BL_FileLength__FPcc", SN_NOWARN) set_name(0x800828B4, "BL_LoadFileAtAddr__FPcPUcc", SN_NOWARN) set_name(0x8008299C, "BL_AsyncLoadDone__Fv", SN_NOWARN) set_name(0x800829A8, "BL_WaitForAsyncFinish__Fv", SN_NOWARN) set_name(0x800829F4, "BL_AsyncLoadCallBack__Fi", SN_NOWARN) set_name(0x80082A24, "BL_LoadFileAsync__FPcc", SN_NOWARN) set_name(0x80082B9C, "BL_AsyncLoadFileAtAddr__FPcPUcc", SN_NOWARN) set_name(0x80082C64, "BL_OpenStreamFile__FPcc", SN_NOWARN) set_name(0x80082C90, "BL_CloseStreamFile__FP6STRHDR", SN_NOWARN) set_name(0x80082CC8, "LZNP_Decode__FPUcT0", SN_NOWARN) set_name(0x80082D9C, "Tmalloc__Fi", SN_NOWARN) set_name(0x80082EC0, "Tfree__FPv", SN_NOWARN) set_name(0x80082F70, "InitTmalloc__Fv", SN_NOWARN) set_name(0x80082F98, "strupr__FPc", SN_NOWARN) set_name(0x80082FEC, "PauseTask__FP4TASK", SN_NOWARN) set_name(0x80083038, "GetPausePad__Fv", SN_NOWARN) set_name(0x8008312C, "TryPadForPause__Fi", SN_NOWARN) set_name(0x80083158, "DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x800833D8, "DoPausedMessage__14CPauseMessages", SN_NOWARN) set_name(0x800836F0, "DoQuitMessage__14CPauseMessages", SN_NOWARN) set_name(0x80083810, "AreYouSureMessage__14CPauseMessages", SN_NOWARN) set_name(0x80083914, "PA_SetPauseOk__Fb", SN_NOWARN) set_name(0x80083924, "PA_GetPauseOk__Fv", SN_NOWARN) set_name(0x80083930, "MY_PausePrint__17CTempPauseMessageiPciP4RECT", SN_NOWARN) set_name(0x80083A7C, "InitPrintQuitMessage__17CTempPauseMessage", SN_NOWARN) set_name(0x80083A84, "PrintQuitMessage__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083BA0, "LeavePrintQuitMessage__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083BA8, "InitPrintAreYouSure__17CTempPauseMessage", SN_NOWARN) set_name(0x80083BB0, "PrintAreYouSure__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083CCC, "LeavePrintAreYouSure__17CTempPauseMessagei", SN_NOWARN) set_name(0x80083CD4, "InitPrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083CDC, "ShowInActive__17CTempPauseMessage", SN_NOWARN) set_name(0x80083DBC, "PrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083F0C, "LeavePrintPaused__17CTempPauseMessage", SN_NOWARN) set_name(0x80083F14, "___17CTempPauseMessage", SN_NOWARN) set_name(0x80083F3C, "_GLOBAL__D_DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x80083F64, "_GLOBAL__I_DoPause__14CPauseMessagesi", SN_NOWARN) set_name(0x80083F8C, "__17CTempPauseMessage", SN_NOWARN) set_name(0x80083FD0, "___14CPauseMessages", SN_NOWARN) set_name(0x80084004, "__14CPauseMessages", SN_NOWARN) set_name(0x80084018, "SetRGB__6DialogUcUcUc", SN_NOWARN) set_name(0x80084038, "SetBack__6Dialogi", SN_NOWARN) set_name(0x80084040, "SetBorder__6Dialogi", SN_NOWARN) set_name(0x80084048, "___6Dialog", SN_NOWARN) set_name(0x80084070, "__6Dialog", SN_NOWARN) set_name(0x800840CC, "GetDown__C4CPad", SN_NOWARN) set_name(0x800840F4, "GetUp__C4CPad", SN_NOWARN) set_name(0x8008411C, "CheckActive__4CPad_addr_8008411C", SN_NOWARN) set_name(0x80084128, "ReadPadStream__Fv", SN_NOWARN) set_name(0x80084240, "PAD_Handler__Fv", SN_NOWARN) set_name(0x80084408, "PAD_GetPad__FiUc", SN_NOWARN) set_name(0x800844A4, "NewVal__4CPadUs", SN_NOWARN) set_name(0x800845DC, "BothNewVal__4CPadUsUs", SN_NOWARN) set_name(0x80084738, "Trans__4CPadUs", SN_NOWARN) set_name(0x8008485C, "_GLOBAL__I_Pad0", SN_NOWARN) set_name(0x80084894, "SetPadType__4CPadUc", SN_NOWARN) set_name(0x8008489C, "CheckActive__4CPad_addr_8008489C", SN_NOWARN) set_name(0x800848A8, "SetActive__4CPadUc", SN_NOWARN) set_name(0x800848B0, "SetBothFlag__4CPadUc", SN_NOWARN) set_name(0x800848B8, "__4CPadi", SN_NOWARN) set_name(0x800848EC, "Flush__4CPad", SN_NOWARN) set_name(0x80084910, "Set__7FontTab", SN_NOWARN) set_name(0x800849AC, "InitPrinty__Fv", SN_NOWARN) set_name(0x80084A4C, "SetTextDat__5CFontP7TextDat", SN_NOWARN) set_name(0x80084A54, "PrintChar__5CFontUsUscUcUcUc", SN_NOWARN) set_name(0x80084BEC, "Print__5CFontiiPc8TXT_JUSTP4RECTUcUcUc", SN_NOWARN) set_name(0x80085218, "GetStrWidth__5CFontPc", SN_NOWARN) set_name(0x800852CC, "SetChar__5CFontiUs", SN_NOWARN) set_name(0x80085330, "SetOTpos__5CFonti", SN_NOWARN) set_name(0x8008533C, "ClearFont__5CFont", SN_NOWARN) set_name(0x80085360, "IsDefined__5CFontUc", SN_NOWARN) set_name(0x80085380, "GetCharFrameNum__5CFontc", SN_NOWARN) set_name(0x80085398, "GetCharWidth__5CFontc", SN_NOWARN) set_name(0x800853F0, "Init__5CFont", SN_NOWARN) set_name(0x80085424, "GetFr__7TextDati_addr_80085424", SN_NOWARN) set_name(0x80085440, "TrimCol__Fs", SN_NOWARN) set_name(0x80085478, "DialogPrint__Fiiiiiiiiii", SN_NOWARN) set_name(0x80085DF8, "GetDropShadowG4__FUcUcUcUcUcUcUcUcUcUcUcUc", SN_NOWARN) set_name(0x80085F30, "DropShadows__Fiiii", SN_NOWARN) set_name(0x800861D4, "InitDialog__Fv", SN_NOWARN) set_name(0x8008630C, "GetSizes__6Dialog", SN_NOWARN) set_name(0x80086590, "Back__6Dialogiiii", SN_NOWARN) set_name(0x80087750, "Line__6Dialogiii", SN_NOWARN) set_name(0x80087968, "GetPal__7TextDati_addr_80087968", SN_NOWARN) set_name(0x80087984, "GetFr__7TextDati_addr_80087984", SN_NOWARN) set_name(0x800879A0, "ATT_DoAttract__Fv", SN_NOWARN) set_name(0x80087AF0, "CreatePlayersFromFeData__FR9FE_CREATE", SN_NOWARN) set_name(0x80087BBC, "UpdateSel__FPUsUsPUc", SN_NOWARN) set_name(0x80087BFC, "CycleSelCols__Fv", SN_NOWARN) set_name(0x80087DB4, "FindTownCreature__7CBlocksi", SN_NOWARN) set_name(0x80087E28, "FindCreature__7CBlocksi", SN_NOWARN) set_name(0x80087E7C, "__7CBlocksiiiii", SN_NOWARN) set_name(0x80087FD0, "SetTownersGraphics__7CBlocks", SN_NOWARN) set_name(0x80088008, "SetMonsterGraphics__7CBlocksii", SN_NOWARN) set_name(0x800880D0, "___7CBlocks", SN_NOWARN) set_name(0x80088158, "DumpGt4s__7CBlocks", SN_NOWARN) set_name(0x800881C0, "DumpRects__7CBlocks", SN_NOWARN) set_name(0x80088228, "SetGraphics__7CBlocksPP7TextDatPii", SN_NOWARN) set_name(0x80088284, "DumpGraphics__7CBlocksPP7TextDatPi", SN_NOWARN) set_name(0x800882D4, "PrintBlockOutline__7CBlocksiiiii", SN_NOWARN) set_name(0x80088620, "Load__7CBlocksi", SN_NOWARN) set_name(0x800886CC, "MakeRectTable__7CBlocks", SN_NOWARN) set_name(0x800887A0, "MakeGt4Table__7CBlocks", SN_NOWARN) set_name(0x800888A8, "MakeGt4__7CBlocksP8POLY_GT4P9FRAME_HDR", SN_NOWARN) set_name(0x800889E8, "GetBlock__7CBlocksi", SN_NOWARN) set_name(0x80088A60, "Print__7CBlocks", SN_NOWARN) set_name(0x80088A88, "SetXY__7CBlocksii", SN_NOWARN) set_name(0x80088AB0, "GetXY__7CBlocksPiT1", SN_NOWARN) set_name(0x80088AC8, "PrintMap__7CBlocksii", SN_NOWARN) set_name(0x80089FB8, "PrintGameSprites__7CBlocksiiiii", SN_NOWARN) set_name(0x8008A128, "PrintGameSprites__7CBlocksP8map_infoiiiiiii", SN_NOWARN) set_name(0x8008AF2C, "PrintSprites__7CBlocksP8map_infoiiiiiii", SN_NOWARN) set_name(0x8008B680, "PrintSprites__7CBlocksiiiii", SN_NOWARN) set_name(0x8008B7F0, "ScrToWorldX__7CBlocksii", SN_NOWARN) set_name(0x8008B804, "ScrToWorldY__7CBlocksii", SN_NOWARN) set_name(0x8008B818, "SetScrollTarget__7CBlocksii", SN_NOWARN) set_name(0x8008B8DC, "DoScroll__7CBlocks", SN_NOWARN) set_name(0x8008B960, "SetPlayerPosBlocks__7CBlocksiii", SN_NOWARN) set_name(0x8008BA00, "GetScrXY__7CBlocksR4RECTiiii", SN_NOWARN) set_name(0x8008BAD4, "ShadScaleSkew__7CBlocksP8POLY_FT4", SN_NOWARN) set_name(0x8008BB54, "WorldToScrX__7CBlocksii", SN_NOWARN) set_name(0x8008BB5C, "WorldToScrY__7CBlocksii", SN_NOWARN) set_name(0x8008BB70, "BL_GetCurrentBlocks__Fv", SN_NOWARN) set_name(0x8008BB7C, "PRIM_GetPrim__FPP8POLY_FT4_addr_8008BB7C", SN_NOWARN) set_name(0x8008BBF8, "GetHighlightCol__FiPiUsUsUs", SN_NOWARN) set_name(0x8008BC40, "PRIM_GetCopy__FP8POLY_FT4", SN_NOWARN) set_name(0x8008BC7C, "GetHighlightCol__FiPcUsUsUs", SN_NOWARN) set_name(0x8008BCC4, "PRIM_GetPrim__FPP8POLY_GT4_addr_8008BCC4", SN_NOWARN) set_name(0x8008BD40, "PRIM_GetPrim__FPP7LINE_F2", SN_NOWARN) set_name(0x8008BDBC, "PRIM_CopyPrim__FP8POLY_FT4T0", SN_NOWARN) set_name(0x8008BDE4, "GetCreature__14TownToCreaturei", SN_NOWARN) set_name(0x8008BE00, "SetItemGraphics__7CBlocksi", SN_NOWARN) set_name(0x8008BE28, "SetObjGraphics__7CBlocksi", SN_NOWARN) set_name(0x8008BE50, "DumpItems__7CBlocks", SN_NOWARN) set_name(0x8008BE74, "DumpObjs__7CBlocks", SN_NOWARN) set_name(0x8008BE98, "DumpMonsters__7CBlocks", SN_NOWARN) set_name(0x8008BEC0, "GetNumOfBlocks__7CBlocks", SN_NOWARN) set_name(0x8008BECC, "CopyToGt4__9LittleGt4P8POLY_GT4", SN_NOWARN) set_name(0x8008BF64, "InitFromGt4__9LittleGt4P8POLY_GT4ii", SN_NOWARN) set_name(0x8008BFF4, "GetNumOfFrames__7TextDatii", SN_NOWARN) set_name(0x8008C02C, "GetCreature__7TextDati_addr_8008C02C", SN_NOWARN) set_name(0x8008C0A4, "GetNumOfCreatures__7TextDat_addr_8008C0A4", SN_NOWARN) set_name(0x8008C0B8, "SetFileInfo__7TextDatPC13CTextFileInfoi_addr_8008C0B8", SN_NOWARN) set_name(0x8008C0C4, "GetPal__7TextDati_addr_8008C0C4", SN_NOWARN) set_name(0x8008C0E0, "GetFr__7TextDati_addr_8008C0E0", SN_NOWARN) set_name(0x8008C0FC, "OVR_IsMemcardOverlayBlank__Fv", SN_NOWARN) set_name(0x8008C128, "OVR_LoadPregame__Fv", SN_NOWARN) set_name(0x8008C150, "OVR_LoadFrontend__Fv", SN_NOWARN) set_name(0x8008C178, "OVR_LoadGame__Fv", SN_NOWARN) set_name(0x8008C1A0, "OVR_LoadFmv__Fv", SN_NOWARN) set_name(0x8008C1C8, "OVR_LoadMemcard__Fv", SN_NOWARN) set_name(0x8008C1F4, "ClearOutOverlays__Fv", SN_NOWARN) set_name(0x8008C24C, "ClearOut__7Overlay", SN_NOWARN) set_name(0x8008C310, "Load__7Overlay", SN_NOWARN) set_name(0x8008C380, "OVR_GetCurrentOverlay__Fv", SN_NOWARN) set_name(0x8008C38C, "LoadOver__FR7Overlay", SN_NOWARN) set_name(0x8008C3E0, "_GLOBAL__I_OVR_Open__Fv", SN_NOWARN) set_name(0x8008C550, "GetOverType__7Overlay", SN_NOWARN) set_name(0x8008C55C, "StevesDummyPoll__Fv", SN_NOWARN) set_name(0x8008C564, "Lambo__Fv", SN_NOWARN) set_name(0x8008C56C, "__7CPlayerbi", SN_NOWARN) set_name(0x8008C650, "___7CPlayer", SN_NOWARN) set_name(0x8008C6A8, "Load__7CPlayeri", SN_NOWARN) set_name(0x8008C704, "SetBlockXY__7CPlayerR7CBlocksR12PlayerStruct", SN_NOWARN) set_name(0x8008C850, "SetScrollTarget__7CPlayerR12PlayerStructR7CBlocks", SN_NOWARN) set_name(0x8008CC7C, "GetNumOfSpellAnims__FR12PlayerStruct", SN_NOWARN) set_name(0x8008CCFC, "Print__7CPlayerR12PlayerStructR7CBlocks", SN_NOWARN) set_name(0x8008D1D4, "FindAction__7CPlayerR12PlayerStruct", SN_NOWARN) set_name(0x8008D250, "FindActionEnum__7CPlayerR12PlayerStruct", SN_NOWARN) set_name(0x8008D2CC, "Init__7CPlayer", SN_NOWARN) set_name(0x8008D2D4, "Dump__7CPlayer", SN_NOWARN) set_name(0x8008D2DC, "PRIM_GetPrim__FPP8POLY_FT4_addr_8008D2DC", SN_NOWARN) set_name(0x8008D358, "PRIM_GetCopy__FP8POLY_FT4_addr_8008D358", SN_NOWARN) set_name(0x8008D394, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_8008D394", SN_NOWARN) set_name(0x8008D3BC, "GetPlrOt__7CBlocksi", SN_NOWARN) set_name(0x8008D3D0, "SetDecompArea__7TextDatiiii", SN_NOWARN) set_name(0x8008D3E8, "GetNumOfFrames__7TextDatii_addr_8008D3E8", SN_NOWARN) set_name(0x8008D420, "GetNumOfActions__7TextDati", SN_NOWARN) set_name(0x8008D444, "GetCreature__7TextDati_addr_8008D444", SN_NOWARN) set_name(0x8008D4BC, "GetNumOfCreatures__7TextDat_addr_8008D4BC", SN_NOWARN) set_name(0x8008D4D0, "SetFileInfo__7TextDatPC13CTextFileInfoi_addr_8008D4D0", SN_NOWARN) set_name(0x8008D4DC, "PROF_Open__Fv", SN_NOWARN) set_name(0x8008D51C, "PROF_State__Fv", SN_NOWARN) set_name(0x8008D528, "PROF_On__Fv", SN_NOWARN) set_name(0x8008D538, "PROF_Off__Fv", SN_NOWARN) set_name(0x8008D544, "PROF_CpuEnd__Fv", SN_NOWARN) set_name(0x8008D574, "PROF_CpuStart__Fv", SN_NOWARN) set_name(0x8008D598, "PROF_DrawStart__Fv", SN_NOWARN) set_name(0x8008D5BC, "PROF_DrawEnd__Fv", SN_NOWARN) set_name(0x8008D5EC, "PROF_Draw__FPUl", SN_NOWARN) set_name(0x8008D7E0, "PROF_Restart__Fv", SN_NOWARN) set_name(0x8008D800, "PSX_WndProc__FUilUl", SN_NOWARN) set_name(0x8008D8C0, "PSX_PostWndProc__FUilUl", SN_NOWARN) set_name(0x8008D970, "GoBackLevel__Fv", SN_NOWARN) set_name(0x8008D9E8, "GoWarpLevel__Fv", SN_NOWARN) set_name(0x8008DA20, "PostLoadGame__Fv", SN_NOWARN) set_name(0x8008DABC, "GoLoadGame__Fv", SN_NOWARN) set_name(0x8008DB18, "PostNewLevel__Fv", SN_NOWARN) set_name(0x8008DBB4, "GoNewLevel__Fv", SN_NOWARN) set_name(0x8008DC08, "PostGoBackLevel__Fv", SN_NOWARN) set_name(0x8008DCA0, "GoForwardLevel__Fv", SN_NOWARN) set_name(0x8008DCF8, "PostGoForwardLevel__Fv", SN_NOWARN) set_name(0x8008DD90, "GoNewGame__Fv", SN_NOWARN) set_name(0x8008DDE0, "PostNewGame__Fv", SN_NOWARN) set_name(0x8008DE18, "LevelToLevelInit__Fv", SN_NOWARN) set_name(0x8008DE60, "GetPal__6GPaneli", SN_NOWARN) set_name(0x8008DEA4, "__6GPaneli", SN_NOWARN) set_name(0x8008DEFC, "DrawFlask__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E37C, "DrawSpeedBar__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E800, "DrawSpell__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E9A0, "DrawMsgWindow__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008E9EC, "DrawDurThingy__6GPaneliiP10ItemStructi", SN_NOWARN) set_name(0x8008EDA8, "DrawDurIcon__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008EE9C, "Print__6GPanelP7PanelXYP12PlayerStruct", SN_NOWARN) set_name(0x8008EFA0, "GetPal__7TextDati_addr_8008EFA0", SN_NOWARN) set_name(0x8008EFBC, "GetFr__7TextDati_addr_8008EFBC", SN_NOWARN) set_name(0x8008EFD8, "PrintCDWaitTask__FP4TASK", SN_NOWARN) set_name(0x8008F090, "InitCDWaitIcon__Fv", SN_NOWARN) set_name(0x8008F0C4, "STR_Debug__FP6SFXHDRPce", SN_NOWARN) set_name(0x8008F0D8, "STR_SystemTask__FP4TASK", SN_NOWARN) set_name(0x8008F120, "STR_AllocBuffer__Fv", SN_NOWARN) set_name(0x8008F174, "STR_Init__Fv", SN_NOWARN) set_name(0x8008F294, "STR_InitStream__Fv", SN_NOWARN) set_name(0x8008F3CC, "STR_PlaySound__FUscic", SN_NOWARN) set_name(0x8008F508, "STR_setvolume__FP6SFXHDR", SN_NOWARN) set_name(0x8008F560, "STR_PlaySFX__FP6SFXHDR", SN_NOWARN) set_name(0x8008F66C, "STR_pauseall__Fv", SN_NOWARN) set_name(0x8008F6BC, "STR_resumeall__Fv", SN_NOWARN) set_name(0x8008F70C, "STR_CloseStream__FP6SFXHDR", SN_NOWARN) set_name(0x8008F790, "STR_SoundCommand__FP6SFXHDRi", SN_NOWARN) set_name(0x8008F89C, "STR_Command__FP6SFXHDR", SN_NOWARN) set_name(0x8008FA48, "STR_DMAControl__FP6SFXHDR", SN_NOWARN) set_name(0x8008FB10, "STR_PlayStream__FP6SFXHDRPUci", SN_NOWARN) set_name(0x8008FCEC, "STR_AsyncWeeTASK__FP4TASK", SN_NOWARN) set_name(0x8008FFEC, "STR_AsyncTASK__FP4TASK", SN_NOWARN) set_name(0x80090420, "STR_StreamMainTask__FP6SFXHDRc", SN_NOWARN) set_name(0x80090528, "SND_Monitor__FP4TASK", SN_NOWARN) set_name(0x800905B4, "SPU_Init__Fv", SN_NOWARN) set_name(0x800906C0, "SND_FindChannel__Fv", SN_NOWARN) set_name(0x8009072C, "SND_ClearBank__Fv", SN_NOWARN) set_name(0x800907A4, "SndLoadCallBack__FPUciib", SN_NOWARN) set_name(0x8009081C, "SND_LoadBank__Fi", SN_NOWARN) set_name(0x80090950, "SND_FindSFX__FUs", SN_NOWARN) set_name(0x800909A4, "SND_StopSnd__Fi", SN_NOWARN) set_name(0x800909C8, "SND_IsSfxPlaying__Fi", SN_NOWARN) set_name(0x80090A04, "SND_RemapSnd__Fi", SN_NOWARN) set_name(0x80090A78, "SND_PlaySnd__FUsiii", SN_NOWARN) set_name(0x80090C34, "AS_CallBack0__Fi", SN_NOWARN) set_name(0x80090C48, "AS_CallBack1__Fi", SN_NOWARN) set_name(0x80090C5C, "AS_WasLastBlock__FiP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090D38, "AS_OpenStream__FP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090DD8, "AS_GetBlock__FP6SFXHDR", SN_NOWARN) set_name(0x80090DE4, "AS_CloseStream__FP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090E10, "AS_LoopStream__FiP6STRHDRP6SFXHDR", SN_NOWARN) set_name(0x80090F30, "SCR_NeedHighlightPal__FUsUsi", SN_NOWARN) set_name(0x80090F64, "Init__13PalCollectionPC7InitPos", SN_NOWARN) set_name(0x80090FF4, "FindPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x800910D0, "NewPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x80091150, "MakePal__8PalEntryUsUsi", SN_NOWARN) set_name(0x800911F0, "GetHighlightPal__13PalCollectionUsUsi", SN_NOWARN) set_name(0x80091284, "UpdatePals__13PalCollection", SN_NOWARN) set_name(0x800912F8, "SCR_Handler__Fv", SN_NOWARN) set_name(0x80091320, "GetNumOfObjs__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x80091328, "GetObj__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x80091364, "Init__t10Collection2Z8PalEntryi20", SN_NOWARN) set_name(0x800913C8, "MoveFromUsedToUnused__t10Collection2Z8PalEntryi20P8PalEntry", SN_NOWARN) set_name(0x80091420, "MoveFromUnusedToUsed__t10Collection2Z8PalEntryi20P8PalEntry", SN_NOWARN) set_name(0x80091478, "Set__8PalEntryUsUsi", SN_NOWARN) set_name(0x8009148C, "Set__8PalEntryRC7InitPos", SN_NOWARN) set_name(0x800914B8, "SetJustUsed__8PalEntryb", SN_NOWARN) set_name(0x800914C0, "Init__8PalEntry", SN_NOWARN) set_name(0x800914C8, "GetClut__C8PalEntry", SN_NOWARN) set_name(0x800914D4, "IsEqual__C8PalEntryUsUsi", SN_NOWARN) set_name(0x8009150C, "GetNext__Ct11TLinkedList1Z8PalEntry", SN_NOWARN) set_name(0x80091518, "AddToList__t11TLinkedList1Z8PalEntryPP8PalEntry", SN_NOWARN) set_name(0x80091538, "DetachFromList__t11TLinkedList1Z8PalEntryPP8PalEntry", SN_NOWARN) set_name(0x80091584, "stub__FPcPv", SN_NOWARN) set_name(0x8009158C, "new_eprint__FPcT0i", SN_NOWARN) set_name(0x800915C0, "TonysGameTask__FP4TASK", SN_NOWARN) set_name(0x80091648, "SetAmbientLight__Fv", SN_NOWARN) set_name(0x800916CC, "print_demo_task__FP4TASK", SN_NOWARN) set_name(0x800918D8, "TonysDummyPoll__Fv", SN_NOWARN) set_name(0x800918FC, "load_demo_pad_data__FUl", SN_NOWARN) set_name(0x8009195C, "save_demo_pad_data__FUl", SN_NOWARN) set_name(0x800919BC, "set_pad_record_play__Fi", SN_NOWARN) set_name(0x80091A30, "start_demo__Fv", SN_NOWARN) set_name(0x80091ACC, "SetQuest__Fv", SN_NOWARN) set_name(0x80091AF4, "CurrCheatStr__Fv", SN_NOWARN) set_name(0x80091B14, "tony__Fv", SN_NOWARN) set_name(0x80091B4C, "GLUE_SetMonsterList__Fi", SN_NOWARN) set_name(0x80091B58, "GLUE_GetMonsterList__Fv", SN_NOWARN) set_name(0x80091B64, "GLUE_SuspendGame__Fv", SN_NOWARN) set_name(0x80091BB8, "GLUE_ResumeGame__Fv", SN_NOWARN) set_name(0x80091C0C, "GLUE_PreTown__Fv", SN_NOWARN) set_name(0x80091C70, "GLUE_PreDun__Fv", SN_NOWARN) set_name(0x80091CBC, "GLUE_Finished__Fv", SN_NOWARN) set_name(0x80091CC8, "GLUE_SetFinished__Fb", SN_NOWARN) set_name(0x80091CD4, "GLUE_StartBg__Fibi", SN_NOWARN) set_name(0x80091D58, "GLUE_SetShowGameScreenFlag__Fb", SN_NOWARN) set_name(0x80091D68, "GLUE_SetHomingScrollFlag__Fb", SN_NOWARN) set_name(0x80091D78, "GLUE_SetShowPanelFlag__Fb", SN_NOWARN) set_name(0x80091D88, "DoShowPanelGFX__FP6GPanelT0", SN_NOWARN) set_name(0x80091E60, "BgTask__FP4TASK", SN_NOWARN) set_name(0x800923C0, "FindPlayerChar__FPc", SN_NOWARN) set_name(0x80092458, "FindPlayerChar__Fiii", SN_NOWARN) set_name(0x800924B4, "FindPlayerChar__FP12PlayerStruct", SN_NOWARN) set_name(0x800924E4, "FindPlayerChar__FP12PlayerStructb", SN_NOWARN) set_name(0x80092544, "MakeSurePlayerDressedProperly__FR7CPlayerR12PlayerStructb", SN_NOWARN) set_name(0x800925C4, "GLUE_GetCurrentList__Fi", SN_NOWARN) set_name(0x80092670, "GetTexId__7CPlayer", SN_NOWARN) set_name(0x8009267C, "SetTown__7CBlocksb", SN_NOWARN) set_name(0x80092684, "MoveToScrollTarget__7CBlocks", SN_NOWARN) set_name(0x80092698, "SetDemoKeys__FPi", SN_NOWARN) set_name(0x80092770, "RestoreDemoKeys__FPi", SN_NOWARN) set_name(0x80092800, "get_action_str__Fii", SN_NOWARN) set_name(0x80092878, "get_key_pad__Fi", SN_NOWARN) set_name(0x800928B0, "checkvalid__Fv", SN_NOWARN) set_name(0x80092914, "RemoveCtrlScreen__Fv", SN_NOWARN) set_name(0x8009297C, "Init_ctrl_pos__Fv", SN_NOWARN) set_name(0x80092A34, "remove_padval__Fi", SN_NOWARN) set_name(0x80092A74, "remove_comboval__Fi", SN_NOWARN) set_name(0x80092AB4, "set_buttons__Fii", SN_NOWARN) set_name(0x80092C08, "restore_controller_settings__Fv", SN_NOWARN) set_name(0x80092C50, "only_one_button__Fi", SN_NOWARN) set_name(0x80092C7C, "main_ctrl_setup__Fv", SN_NOWARN) set_name(0x8009312C, "PrintCtrlString__FiiUcic", SN_NOWARN) set_name(0x80093628, "DrawCtrlSetup__Fv", SN_NOWARN) set_name(0x80093AE4, "_GLOBAL__D_ctrlflag", SN_NOWARN) set_name(0x80093B0C, "_GLOBAL__I_ctrlflag", SN_NOWARN) set_name(0x80093B34, "GetTick__C4CPad", SN_NOWARN) set_name(0x80093B5C, "GetDown__C4CPad_addr_80093B5C", SN_NOWARN) set_name(0x80093B84, "GetUp__C4CPad_addr_80093B84", SN_NOWARN) set_name(0x80093BAC, "SetPadTickMask__4CPadUs", SN_NOWARN) set_name(0x80093BB4, "SetPadTick__4CPadUs", SN_NOWARN) set_name(0x80093BBC, "SetRGB__6DialogUcUcUc_addr_80093BBC", SN_NOWARN) set_name(0x80093BDC, "SetBorder__6Dialogi_addr_80093BDC", SN_NOWARN) set_name(0x80093BE4, "SetOTpos__6Dialogi", SN_NOWARN) set_name(0x80093BF0, "___6Dialog_addr_80093BF0", SN_NOWARN) set_name(0x80093C18, "__6Dialog_addr_80093C18", SN_NOWARN) set_name(0x80093C74, "switchnight__FP4TASK", SN_NOWARN) set_name(0x80093CC0, "city_lights__FP4TASK", SN_NOWARN) set_name(0x80093E14, "color_cycle__FP4TASK", SN_NOWARN) set_name(0x80093F58, "ReInitDFL__Fv", SN_NOWARN) set_name(0x80093F90, "DrawFlameLogo__Fv", SN_NOWARN) set_name(0x80094334, "TitleScreen__FP7CScreen", SN_NOWARN) set_name(0x80094388, "TryCreaturePrint__Fiiiiiii", SN_NOWARN) set_name(0x800945EC, "TryWater__FiiP8POLY_GT4i", SN_NOWARN) set_name(0x800947C4, "nightgfx__FibiP8POLY_GT4i", SN_NOWARN) set_name(0x80094850, "PRIM_GetCopy__FP8POLY_FT4_addr_80094850", SN_NOWARN) set_name(0x8009488C, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_8009488C", SN_NOWARN) set_name(0x800948B4, "PRIM_GetPrim__FPP8POLY_FT4_addr_800948B4", SN_NOWARN) set_name(0x80094930, "GetNumOfActions__7TextDati_addr_80094930", SN_NOWARN) set_name(0x80094954, "GetCreature__7TextDati_addr_80094954", SN_NOWARN) set_name(0x800949CC, "GetNumOfCreatures__7TextDat_addr_800949CC", SN_NOWARN) set_name(0x800949E0, "DaveLDummyPoll__Fv", SN_NOWARN) set_name(0x800949E8, "DaveL__Fv", SN_NOWARN) set_name(0x80094A10, "DoReflection__FP8POLY_FT4iii", SN_NOWARN) set_name(0x80094CFC, "mteleportfx__Fv", SN_NOWARN) set_name(0x80094FFC, "invistimer__Fv", SN_NOWARN) set_name(0x800950D4, "setUVparams__FP8POLY_FT4P9FRAME_HDR", SN_NOWARN) set_name(0x80095164, "drawparticle__Fiiiiii", SN_NOWARN) set_name(0x80095354, "drawpolyF4__Fiiiiii", SN_NOWARN) set_name(0x80095488, "drawpolyG4__Fiiiiiiii", SN_NOWARN) set_name(0x80095658, "particlejump__Fv", SN_NOWARN) set_name(0x80095808, "particleglow__Fv", SN_NOWARN) set_name(0x800958FC, "doparticlejump__Fv", SN_NOWARN) set_name(0x8009593C, "StartPartJump__Fiiiiii", SN_NOWARN) set_name(0x80095AA4, "doparticlechain__Fiiiiiiiiiiii", SN_NOWARN) set_name(0x80095EA0, "ParticleBlob__FP13MissileStructiiii", SN_NOWARN) set_name(0x80095F38, "ParticleMissile__FP13MissileStructiiii", SN_NOWARN) set_name(0x80095FF8, "Teleportfx__Fiiiiiiii", SN_NOWARN) set_name(0x800962EC, "ResurrectFX__Fiiii", SN_NOWARN) set_name(0x80096514, "ParticleExp__FP13MissileStructiiii", SN_NOWARN) set_name(0x800965B0, "GetPlrPos__11SPELLFX_DATP12PlayerStruct", SN_NOWARN) set_name(0x800966D4, "healFX__Fv", SN_NOWARN) set_name(0x80096810, "HealStart__Fi", SN_NOWARN) set_name(0x80096844, "HealotherStart__Fi", SN_NOWARN) set_name(0x8009687C, "TeleStart__Fi", SN_NOWARN) set_name(0x800968D8, "PhaseStart__Fi", SN_NOWARN) set_name(0x8009690C, "PhaseEnd__Fi", SN_NOWARN) set_name(0x80096938, "ApocInit__11SPELLFX_DATP12PlayerStruct", SN_NOWARN) set_name(0x80096B14, "ApocaStart__Fi", SN_NOWARN) set_name(0x80096B6C, "DaveLTask__FP4TASK", SN_NOWARN) set_name(0x80096C08, "PRIM_GetPrim__FPP7POLY_G4", SN_NOWARN) set_name(0x80096C84, "PRIM_GetPrim__FPP7POLY_F4", SN_NOWARN) set_name(0x80096D00, "PRIM_GetPrim__FPP8POLY_FT4_addr_80096D00", SN_NOWARN) set_name(0x80096D7C, "GetPlayer__7CPlayeri", SN_NOWARN) set_name(0x80096DCC, "GetLastOtPos__C7CPlayer", SN_NOWARN) set_name(0x80096DD8, "GetFr__7TextDati_addr_80096DD8", SN_NOWARN) set_name(0x80096DF4, "DrawArrow__Fii", SN_NOWARN) set_name(0x80096FF8, "show_spell_dir__Fi", SN_NOWARN) set_name(0x80097490, "release_spell__Fi", SN_NOWARN) set_name(0x80097504, "select_belt_item__Fi", SN_NOWARN) set_name(0x8009750C, "any_belt_items__Fv", SN_NOWARN) set_name(0x80097574, "get_last_inv__Fv", SN_NOWARN) set_name(0x800976A4, "get_next_inv__Fv", SN_NOWARN) set_name(0x800977DC, "pad_func_up__Fi", SN_NOWARN) set_name(0x80097808, "pad_func_down__Fi", SN_NOWARN) set_name(0x80097834, "pad_func_left__Fi", SN_NOWARN) set_name(0x8009783C, "pad_func_right__Fi", SN_NOWARN) set_name(0x80097844, "pad_func_select__Fi", SN_NOWARN) set_name(0x80097900, "pad_func_Attack__Fi", SN_NOWARN) set_name(0x80097D8C, "pad_func_Action__Fi", SN_NOWARN) set_name(0x800980D8, "InitTargetCursor__Fi", SN_NOWARN) set_name(0x800981E0, "RemoveTargetCursor__Fi", SN_NOWARN) set_name(0x80098270, "pad_func_Cast_Spell__Fi", SN_NOWARN) set_name(0x80098670, "pad_func_Use_Item__Fi", SN_NOWARN) set_name(0x80098730, "pad_func_Chr__Fi", SN_NOWARN) set_name(0x80098838, "pad_func_Inv__Fi", SN_NOWARN) set_name(0x80098930, "pad_func_SplBook__Fi", SN_NOWARN) set_name(0x80098A1C, "pad_func_QLog__Fi", SN_NOWARN) set_name(0x80098AA0, "pad_func_SpellBook__Fi", SN_NOWARN) set_name(0x80098B38, "pad_func_AutoMap__Fi", SN_NOWARN) set_name(0x80098BF4, "pad_func_Quick_Spell__Fi", SN_NOWARN) set_name(0x80098C70, "check_inv__FiPci", SN_NOWARN) set_name(0x80098E38, "pad_func_Quick_Use_Health__Fi", SN_NOWARN) set_name(0x80098E60, "pad_func_Quick_Use_Mana__Fi", SN_NOWARN) set_name(0x80098E88, "get_max_find_size__FPici", SN_NOWARN) set_name(0x80098FC8, "sort_gold__Fi", SN_NOWARN) set_name(0x800990D4, "DrawObjSelector__Fi", SN_NOWARN) set_name(0x80099954, "DrawObjTask__FP4TASK", SN_NOWARN) set_name(0x80099A30, "add_area_find_object__Fciii", SN_NOWARN) set_name(0x80099B3C, "CheckRangeObject__Fiici", SN_NOWARN) set_name(0x80099EFC, "CheckArea__FiiicUci", SN_NOWARN) set_name(0x8009A1D4, "PlacePlayer__FiiiUc", SN_NOWARN) set_name(0x8009A3F8, "_GLOBAL__D_gplayer", SN_NOWARN) set_name(0x8009A420, "_GLOBAL__I_gplayer", SN_NOWARN) set_name(0x8009A448, "SetRGB__6DialogUcUcUc_addr_8009A448", SN_NOWARN) set_name(0x8009A468, "SetBack__6Dialogi_addr_8009A468", SN_NOWARN) set_name(0x8009A470, "SetBorder__6Dialogi_addr_8009A470", SN_NOWARN) set_name(0x8009A478, "___6Dialog_addr_8009A478", SN_NOWARN) set_name(0x8009A4A0, "__6Dialog_addr_8009A4A0", SN_NOWARN) set_name(0x8009A4FC, "GetTick__C4CPad_addr_8009A4FC", SN_NOWARN) set_name(0x8009A524, "GetDown__C4CPad_addr_8009A524", SN_NOWARN) set_name(0x8009A54C, "GetCur__C4CPad_addr_8009A54C", SN_NOWARN) set_name(0x8009A574, "SetPadTickMask__4CPadUs_addr_8009A574", SN_NOWARN) set_name(0x8009A57C, "SetPadTick__4CPadUs_addr_8009A57C", SN_NOWARN) set_name(0x8009A584, "DEC_AddAsDecRequestor__FP7TextDat", SN_NOWARN) set_name(0x8009A600, "DEC_RemoveAsDecRequestor__FP7TextDat", SN_NOWARN) set_name(0x8009A658, "DEC_DoDecompRequests__Fv", SN_NOWARN) set_name(0x8009A6B4, "FindThisTd__FP7TextDat", SN_NOWARN) set_name(0x8009A6EC, "FindEmptyIndex__Fv", SN_NOWARN) set_name(0x8009A724, "UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009A784, "IsGameLoading__Fv", SN_NOWARN) set_name(0x8009A790, "PutUpCutScreenTSK__FP4TASK", SN_NOWARN) set_name(0x8009AC04, "PutUpCutScreen__Fi", SN_NOWARN) set_name(0x8009ACC4, "TakeDownCutScreen__Fv", SN_NOWARN) set_name(0x8009AD50, "FinishProgress__Fv", SN_NOWARN) set_name(0x8009ADB4, "PRIM_GetPrim__FPP7POLY_G4_addr_8009ADB4", SN_NOWARN) set_name(0x8009AE30, "_GLOBAL__D_UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009AE68, "_GLOBAL__I_UPDATEPROGRESS__Fi", SN_NOWARN) set_name(0x8009AEA0, "SetRGB__6DialogUcUcUc_addr_8009AEA0", SN_NOWARN) set_name(0x8009AEC0, "SetBack__6Dialogi_addr_8009AEC0", SN_NOWARN) set_name(0x8009AEC8, "SetBorder__6Dialogi_addr_8009AEC8", SN_NOWARN) set_name(0x8009AED0, "___6Dialog_addr_8009AED0", SN_NOWARN) set_name(0x8009AEF8, "__6Dialog_addr_8009AEF8", SN_NOWARN) set_name(0x8009AF54, "___7CScreen", SN_NOWARN) set_name(0x8009AF74, "init_mem_card__FPFii_vUc", SN_NOWARN) set_name(0x8009B1AC, "memcard_event__Fii", SN_NOWARN) set_name(0x8009B1B4, "init_card__Fib", SN_NOWARN) set_name(0x8009B274, "ping_card__Fi", SN_NOWARN) set_name(0x8009B308, "CardUpdateTask__FP4TASK", SN_NOWARN) set_name(0x8009B340, "MemcardON__Fv", SN_NOWARN) set_name(0x8009B3B0, "MemcardOFF__Fv", SN_NOWARN) set_name(0x8009B400, "CheckSavedOptions__Fv", SN_NOWARN) set_name(0x8009B488, "card_removed__Fi", SN_NOWARN) set_name(0x8009B4B0, "read_card_block__Fii", SN_NOWARN) set_name(0x8009B4F8, "test_hw_event__Fv", SN_NOWARN) set_name(0x8009B578, "PrintSelectBack__FbT0", SN_NOWARN) set_name(0x8009B6F8, "DrawDialogBox__FiiP4RECTiiii", SN_NOWARN) set_name(0x8009B7DC, "DrawSpinner__FiiUcUcUciiibiT8", SN_NOWARN) set_name(0x8009BCD0, "DrawMenu__Fi", SN_NOWARN) set_name(0x8009C960, "who_pressed__Fi", SN_NOWARN) set_name(0x8009C9E8, "ShowCharacterFiles__Fv", SN_NOWARN) set_name(0x8009CFEC, "MemcardPad__Fv", SN_NOWARN) set_name(0x8009D664, "SoundPad__Fv", SN_NOWARN) set_name(0x8009DE80, "CentrePad__Fv", SN_NOWARN) set_name(0x8009E2D8, "CalcVolumes__Fv", SN_NOWARN) set_name(0x8009E410, "SetLoadedVolumes__Fv", SN_NOWARN) set_name(0x8009E498, "GetVolumes__Fv", SN_NOWARN) set_name(0x8009E534, "PrintInfoMenu__Fv", SN_NOWARN) set_name(0x8009E6DC, "SeedPad__Fv", SN_NOWARN) set_name(0x8009E960, "DrawOptions__FP4TASK", SN_NOWARN) set_name(0x8009F234, "ToggleOptions__Fv", SN_NOWARN) set_name(0x8009F2EC, "FormatPad__Fv", SN_NOWARN) set_name(0x8009F61C, "ActivateMemcard__Fv", SN_NOWARN) set_name(0x8009F6A0, "PRIM_GetPrim__FPP7POLY_G4_addr_8009F6A0", SN_NOWARN) set_name(0x8009F71C, "GetTick__C4CPad_addr_8009F71C", SN_NOWARN) set_name(0x8009F744, "GetDown__C4CPad_addr_8009F744", SN_NOWARN) set_name(0x8009F76C, "GetUp__C4CPad_addr_8009F76C", SN_NOWARN) set_name(0x8009F794, "SetPadTickMask__4CPadUs_addr_8009F794", SN_NOWARN) set_name(0x8009F79C, "SetPadTick__4CPadUs_addr_8009F79C", SN_NOWARN) set_name(0x8009F7A4, "Flush__4CPad_addr_8009F7A4", SN_NOWARN) set_name(0x8009F7C8, "SetRGB__6DialogUcUcUc_addr_8009F7C8", SN_NOWARN) set_name(0x8009F7E8, "SetBack__6Dialogi_addr_8009F7E8", SN_NOWARN) set_name(0x8009F7F0, "SetBorder__6Dialogi_addr_8009F7F0", SN_NOWARN) set_name(0x8009F7F8, "___6Dialog_addr_8009F7F8", SN_NOWARN) set_name(0x8009F820, "__6Dialog_addr_8009F820", SN_NOWARN) set_name(0x8009F87C, "GetFr__7TextDati_addr_8009F87C", SN_NOWARN) set_name(0x8009F898, "BirdDistanceOK__Fiiii", SN_NOWARN) set_name(0x8009F8F0, "AlterBirdPos__FP10BIRDSTRUCTUc", SN_NOWARN) set_name(0x8009FA34, "BirdWorld__FP10BIRDSTRUCTii", SN_NOWARN) set_name(0x8009FAB0, "BirdScared__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FC3C, "GetPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FC90, "BIRD_StartHop__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FDF8, "BIRD_DoHop__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FEFC, "BIRD_StartPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FF68, "BIRD_DoPerch__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x8009FFEC, "BIRD_DoScatter__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0098, "CheckDirOk__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A01A8, "BIRD_StartScatter__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0254, "BIRD_StartFly__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A02F8, "BIRD_DoFly__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A05A4, "BIRD_StartLanding__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A05FC, "BIRD_DoLanding__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0668, "PlaceFlock__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0754, "ProcessFlock__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0884, "InitBird__Fv", SN_NOWARN) set_name(0x800A095C, "ProcessBird__Fv", SN_NOWARN) set_name(0x800A0AB4, "GetBirdFrame__FP10BIRDSTRUCT", SN_NOWARN) set_name(0x800A0B50, "bscale__FP8POLY_FT4i", SN_NOWARN) set_name(0x800A0C80, "doshadow__FP10BIRDSTRUCTii", SN_NOWARN) set_name(0x800A0D8C, "DrawLBird__Fv", SN_NOWARN) set_name(0x800A0F98, "PRIM_GetPrim__FPP8POLY_FT4_addr_800A0F98", SN_NOWARN) set_name(0x800A1014, "PlayFMV__FPcii", SN_NOWARN) set_name(0x800A10E8, "play_movie", SN_NOWARN) set_name(0x800A11A4, "DisplayMonsterTypes__Fv", SN_NOWARN) set_name(0x800A1640, "GetDown__C4CPad_addr_800A1640", SN_NOWARN) set_name(0x800A1668, "GetNumOfFrames__7TextDatii_addr_800A1668", SN_NOWARN) set_name(0x800A16A0, "GetCreature__7TextDati_addr_800A16A0", SN_NOWARN) set_name(0x800A1718, "GetNumOfCreatures__7TextDat_addr_800A1718", SN_NOWARN) set_name(0x800A172C, "GetFr__7TextDati_addr_800A172C", SN_NOWARN) set_name(0x800A1748, "LoadKanjiFont__FPc", SN_NOWARN) set_name(0x800A1838, "LoadKanjiIndex__FPc", SN_NOWARN) set_name(0x800A1948, "FreeKanji__Fv", SN_NOWARN) set_name(0x800A19D0, "LoadKanji__F10LANG_DB_NO", SN_NOWARN) set_name(0x800A1AA4, "getb__FUs", SN_NOWARN) set_name(0x800A1B14, "_get_font__FPUsUsUs", SN_NOWARN) set_name(0x800A1BE4, "KPrintChar__FUsUsUcUcUs", SN_NOWARN) set_name(0x800A1D50, "PRIM_GetPrim__FPP8POLY_FT4_addr_800A1D50", SN_NOWARN) set_name(0x800A1DCC, "writeblock__FP5block", SN_NOWARN) set_name(0x800A1EB4, "PAK_DoPak__FPUcT0i", SN_NOWARN) set_name(0x800A20F4, "PAK_DoUnpak__FPUcT0", SN_NOWARN) set_name(0x800A2194, "fputc__5blockUc", SN_NOWARN) set_name(0x800A21BC, "HelpPad__Fv", SN_NOWARN) set_name(0x800A22C4, "InitHelp__Fv", SN_NOWARN) set_name(0x800A2308, "GetControlKey__FiPb", SN_NOWARN) set_name(0x800A23B0, "CheckStr__FPcT0i", SN_NOWARN) set_name(0x800A2484, "DisplayHelp__Fv", SN_NOWARN) set_name(0x800A2848, "DrawHelp__Fv", SN_NOWARN) set_name(0x800A28E4, "_GLOBAL__D_DrawHelp__Fv", SN_NOWARN) set_name(0x800A290C, "_GLOBAL__I_DrawHelp__Fv", SN_NOWARN) set_name(0x800A2934, "SetRGB__6DialogUcUcUc_addr_800A2934", SN_NOWARN) set_name(0x800A2954, "SetBorder__6Dialogi_addr_800A2954", SN_NOWARN) set_name(0x800A295C, "___6Dialog_addr_800A295C", SN_NOWARN) set_name(0x800A2984, "__6Dialog_addr_800A2984", SN_NOWARN) set_name(0x800A29E0, "GetCharWidth__5CFontc_addr_800A29E0", SN_NOWARN) set_name(0x800A2A38, "GetFr__7TextDati_addr_800A2A38", SN_NOWARN) set_name(0x800A2A54, "GetTick__C4CPad_addr_800A2A54", SN_NOWARN) set_name(0x800A2A7C, "GetDown__C4CPad_addr_800A2A7C", SN_NOWARN) set_name(0x800A2AA4, "SetPadTickMask__4CPadUs_addr_800A2AA4", SN_NOWARN) set_name(0x800A2AAC, "SetPadTick__4CPadUs_addr_800A2AAC", SN_NOWARN) set_name(0x8002E8B0, "TrimCol__Fs_addr_8002E8B0", SN_NOWARN) set_name(0x8002E8E8, "DrawSpellCel__FllUclUc", SN_NOWARN) set_name(0x8002F408, "SetSpellTrans__Fc", SN_NOWARN) set_name(0x8002F414, "DrawSpellBookTSK__FP4TASK", SN_NOWARN) set_name(0x8002F4B0, "DrawSpeedSpellTSK__FP4TASK", SN_NOWARN) set_name(0x8002F554, "ToggleSpell__Fi", SN_NOWARN) set_name(0x8002F608, "DrawSpellList__Fv", SN_NOWARN) set_name(0x800301CC, "SetSpell__Fi", SN_NOWARN) set_name(0x800302A0, "AddPanelString__FPCci", SN_NOWARN) set_name(0x80030350, "ClearPanel__Fv", SN_NOWARN) set_name(0x80030380, "InitPanelStr__Fv", SN_NOWARN) set_name(0x800303A0, "InitControlPan__Fv", SN_NOWARN) set_name(0x800305C0, "DrawCtrlPan__Fv", SN_NOWARN) set_name(0x800305EC, "DoAutoMap__Fv", SN_NOWARN) set_name(0x80030660, "CheckPanelInfo__Fv", SN_NOWARN) set_name(0x80030D80, "FreeControlPan__Fv", SN_NOWARN) set_name(0x80030E90, "CPrintString__FiPci", SN_NOWARN) set_name(0x80030FAC, "PrintInfo__Fv", SN_NOWARN) set_name(0x80031268, "DrawInfoBox__FP4RECT", SN_NOWARN) set_name(0x8003191C, "MY_PlrStringXY__Fv", SN_NOWARN) set_name(0x80031E6C, "ADD_PlrStringXY__FPCcc", SN_NOWARN) set_name(0x80031F14, "DrawPlus__Fii", SN_NOWARN) set_name(0x8003207C, "ChrCheckValidButton__Fi", SN_NOWARN) set_name(0x80032158, "DrawArrows__Fv", SN_NOWARN) set_name(0x80032250, "BuildChr__Fv", SN_NOWARN) set_name(0x80033528, "DrawChr__Fv", SN_NOWARN) set_name(0x80033984, "DrawChrTSK__FP4TASK", SN_NOWARN) set_name(0x80033A68, "DrawLevelUpIcon__Fi", SN_NOWARN) set_name(0x80033AFC, "CheckChrBtns__Fv", SN_NOWARN) set_name(0x80033E68, "DrawDurIcon4Item__FPC10ItemStructii", SN_NOWARN) set_name(0x80033EEC, "RedBack__Fv", SN_NOWARN) set_name(0x80033FD4, "PrintSBookStr__FiiUcPCcUc", SN_NOWARN) set_name(0x8003406C, "GetSBookTrans__FiUc", SN_NOWARN) set_name(0x80034284, "DrawSpellBook__Fv", SN_NOWARN) set_name(0x80034C60, "CheckSBook__Fv", SN_NOWARN) set_name(0x80034E94, "get_pieces_str__Fi", SN_NOWARN) set_name(0x80034EC8, "_GLOBAL__D_DrawLevelUpFlag", SN_NOWARN) set_name(0x80034EF0, "_GLOBAL__I_DrawLevelUpFlag", SN_NOWARN) set_name(0x80034F2C, "GetTick__C4CPad_addr_80034F2C", SN_NOWARN) set_name(0x80034F54, "GetDown__C4CPad_addr_80034F54", SN_NOWARN) set_name(0x80034F7C, "SetPadTickMask__4CPadUs_addr_80034F7C", SN_NOWARN) set_name(0x80034F84, "SetPadTick__4CPadUs_addr_80034F84", SN_NOWARN) set_name(0x80034F8C, "SetRGB__6DialogUcUcUc_addr_80034F8C", SN_NOWARN) set_name(0x80034FAC, "SetBack__6Dialogi_addr_80034FAC", SN_NOWARN) set_name(0x80034FB4, "SetBorder__6Dialogi_addr_80034FB4", SN_NOWARN) set_name(0x80034FBC, "___6Dialog_addr_80034FBC", SN_NOWARN) set_name(0x80034FE4, "__6Dialog_addr_80034FE4", SN_NOWARN) set_name(0x80035040, "GetPal__7TextDati_addr_80035040", SN_NOWARN) set_name(0x8003505C, "GetFr__7TextDati_addr_8003505C", SN_NOWARN) set_name(0x80035078, "InitCursor__Fv", SN_NOWARN) set_name(0x80035080, "FreeCursor__Fv", SN_NOWARN) set_name(0x80035088, "SetICursor__Fi", SN_NOWARN) set_name(0x800350E4, "SetCursor__Fi", SN_NOWARN) set_name(0x80035148, "NewCursor__Fi", SN_NOWARN) set_name(0x80035168, "InitLevelCursor__Fv", SN_NOWARN) set_name(0x800351C8, "CheckTown__Fv", SN_NOWARN) set_name(0x80035454, "CheckRportal__Fv", SN_NOWARN) set_name(0x800356B4, "CheckCursMove__Fv", SN_NOWARN) set_name(0x800356BC, "InitDead__Fv", SN_NOWARN) set_name(0x800358B8, "AddDead__Fiici", SN_NOWARN) set_name(0x80035900, "FreeGameMem__Fv", SN_NOWARN) set_name(0x80035950, "start_game__FUi", SN_NOWARN) set_name(0x800359AC, "free_game__Fv", SN_NOWARN) set_name(0x80035A20, "LittleStart__FUcUc", SN_NOWARN) set_name(0x80035AE4, "StartGame__FUcUc", SN_NOWARN) set_name(0x80035CCC, "run_game_loop__FUi", SN_NOWARN) set_name(0x80035E3C, "TryIconCurs__Fv", SN_NOWARN) set_name(0x80036218, "DisableInputWndProc__FUlUilUl", SN_NOWARN) set_name(0x80036220, "GM_Game__FUlUilUl", SN_NOWARN) set_name(0x800362D0, "LoadLvlGFX__Fv", SN_NOWARN) set_name(0x8003636C, "LoadAllGFX__Fv", SN_NOWARN) set_name(0x8003638C, "CreateLevel__Fi", SN_NOWARN) set_name(0x80036484, "LoCreateLevel__FPv", SN_NOWARN) set_name(0x8003660C, "ClearOutDungeonMap__Fv", SN_NOWARN) set_name(0x800366E8, "LoadGameLevel__FUci", SN_NOWARN) set_name(0x80037044, "game_logic__Fv", SN_NOWARN) set_name(0x80037150, "timeout_cursor__FUc", SN_NOWARN) set_name(0x800371F8, "game_loop__FUc", SN_NOWARN) set_name(0x80037230, "alloc_plr__Fv", SN_NOWARN) set_name(0x80037238, "plr_encrypt__FUc", SN_NOWARN) set_name(0x80037240, "assert_fail__FiPCcT1", SN_NOWARN) set_name(0x80037260, "assert_fail__FiPCc", SN_NOWARN) set_name(0x80037280, "app_fatal", SN_NOWARN) set_name(0x800372B0, "DoMemCardFromFrontEnd__Fv", SN_NOWARN) set_name(0x800372D8, "DoMemCardFromInGame__Fv", SN_NOWARN) set_name(0x80037300, "GetActiveTowner__Fi", SN_NOWARN) set_name(0x80037354, "SetTownerGPtrs__FPUcPPUc", SN_NOWARN) set_name(0x80037374, "NewTownerAnim__FiPUcii", SN_NOWARN) set_name(0x800373BC, "InitTownerInfo__FilUciiici", SN_NOWARN) set_name(0x8003751C, "InitQstSnds__Fi", SN_NOWARN) set_name(0x800375D4, "InitSmith__Fv", SN_NOWARN) set_name(0x80037700, "InitBarOwner__Fv", SN_NOWARN) set_name(0x80037834, "InitTownDead__Fv", SN_NOWARN) set_name(0x80037964, "InitWitch__Fv", SN_NOWARN) set_name(0x80037A94, "InitBarmaid__Fv", SN_NOWARN) set_name(0x80037BC4, "InitBoy__Fv", SN_NOWARN) set_name(0x80037CFC, "InitHealer__Fv", SN_NOWARN) set_name(0x80037E2C, "InitTeller__Fv", SN_NOWARN) set_name(0x80037F5C, "InitDrunk__Fv", SN_NOWARN) set_name(0x8003808C, "InitCows__Fv", SN_NOWARN) set_name(0x80038350, "InitTowners__Fv", SN_NOWARN) set_name(0x800383DC, "FreeTownerGFX__Fv", SN_NOWARN) set_name(0x80038480, "TownCtrlMsg__Fi", SN_NOWARN) set_name(0x800385B0, "TownBlackSmith__Fv", SN_NOWARN) set_name(0x800385E4, "TownBarOwner__Fv", SN_NOWARN) set_name(0x80038618, "TownDead__Fv", SN_NOWARN) set_name(0x80038700, "TownHealer__Fv", SN_NOWARN) set_name(0x80038728, "TownStory__Fv", SN_NOWARN) set_name(0x80038750, "TownDrunk__Fv", SN_NOWARN) set_name(0x80038778, "TownBoy__Fv", SN_NOWARN) set_name(0x800387A0, "TownWitch__Fv", SN_NOWARN) set_name(0x800387C8, "TownBarMaid__Fv", SN_NOWARN) set_name(0x800387F0, "TownCow__Fv", SN_NOWARN) set_name(0x80038818, "ProcessTowners__Fv", SN_NOWARN) set_name(0x80038A68, "PlrHasItem__FiiRi", SN_NOWARN) set_name(0x80038B3C, "CowSFX__Fi", SN_NOWARN) set_name(0x80038C58, "TownerTalk__Fii", SN_NOWARN) set_name(0x80038C98, "TalkToTowner__Fii", SN_NOWARN) set_name(0x8003A16C, "effect_is_playing__Fi", SN_NOWARN) set_name(0x8003A174, "stream_stop__Fv", SN_NOWARN) set_name(0x8003A1C8, "stream_play__FP4TSFXll", SN_NOWARN) set_name(0x8003A2B8, "stream_update__Fv", SN_NOWARN) set_name(0x8003A2C0, "sfx_stop__Fv", SN_NOWARN) set_name(0x8003A2DC, "InitMonsterSND__Fi", SN_NOWARN) set_name(0x8003A334, "FreeMonsterSnd__Fv", SN_NOWARN) set_name(0x8003A33C, "calc_snd_position__FiiPlT2", SN_NOWARN) set_name(0x8003A440, "PlaySFX_priv__FP4TSFXUcii", SN_NOWARN) set_name(0x8003A53C, "PlayEffect__Fii", SN_NOWARN) set_name(0x8003A680, "RndSFX__Fi", SN_NOWARN) set_name(0x8003A718, "PlaySFX__Fi", SN_NOWARN) set_name(0x8003A758, "PlaySfxLoc__Fiii", SN_NOWARN) set_name(0x8003A7AC, "sound_stop__Fv", SN_NOWARN) set_name(0x8003A844, "sound_update__Fv", SN_NOWARN) set_name(0x8003A878, "priv_sound_init__FUc", SN_NOWARN) set_name(0x8003A8BC, "sound_init__Fv", SN_NOWARN) set_name(0x8003A964, "GetDirection__Fiiii", SN_NOWARN) set_name(0x8003AA08, "SetRndSeed__Fl", SN_NOWARN) set_name(0x8003AA18, "GetRndSeed__Fv", SN_NOWARN) set_name(0x8003AA60, "random__Fil", SN_NOWARN) set_name(0x8003AACC, "DiabloAllocPtr__FUl", SN_NOWARN) set_name(0x8003AB18, "mem_free_dbg__FPv", SN_NOWARN) set_name(0x8003AB68, "LoadFileInMem__FPCcPUl", SN_NOWARN) set_name(0x8003AB70, "PlayInGameMovie__FPCc", SN_NOWARN) set_name(0x8003AB78, "Enter__9CCritSect", SN_NOWARN) set_name(0x8003AB80, "InitDiabloMsg__Fc", SN_NOWARN) set_name(0x8003AC14, "ClrDiabloMsg__Fv", SN_NOWARN) set_name(0x8003AC40, "DrawDiabloMsg__Fv", SN_NOWARN) set_name(0x8003AD4C, "interface_msg_pump__Fv", SN_NOWARN) set_name(0x8003AD54, "ShowProgress__FUi", SN_NOWARN) set_name(0x8003B28C, "InitAllItemsUseable__Fv", SN_NOWARN) set_name(0x8003B2C4, "InitItemGFX__Fv", SN_NOWARN) set_name(0x8003B2F0, "ItemPlace__Fii", SN_NOWARN) set_name(0x8003B3B8, "AddInitItems__Fv", SN_NOWARN) set_name(0x8003B5D0, "InitItems__Fv", SN_NOWARN) set_name(0x8003B7A8, "CalcPlrItemVals__FiUc", SN_NOWARN) set_name(0x8003C258, "CalcPlrScrolls__Fi", SN_NOWARN) set_name(0x8003C5D8, "CalcPlrStaff__FP12PlayerStruct", SN_NOWARN) set_name(0x8003C674, "CalcSelfItems__Fi", SN_NOWARN) set_name(0x8003C7D4, "ItemMinStats__FPC12PlayerStructPC10ItemStruct", SN_NOWARN) set_name(0x8003C820, "CalcPlrItemMin__Fi", SN_NOWARN) set_name(0x8003C900, "CalcPlrBookVals__Fi", SN_NOWARN) set_name(0x8003CB94, "CalcPlrInv__FiUc", SN_NOWARN) set_name(0x8003CC58, "SetPlrHandItem__FP10ItemStructi", SN_NOWARN) set_name(0x8003CD70, "GetPlrHandSeed__FP10ItemStruct", SN_NOWARN) set_name(0x8003CD9C, "GetGoldSeed__FiP10ItemStruct", SN_NOWARN) set_name(0x8003CF18, "SetPlrHandSeed__FP10ItemStructi", SN_NOWARN) set_name(0x8003CF20, "SetPlrHandGoldCurs__FP10ItemStruct", SN_NOWARN) set_name(0x8003CF50, "CreatePlrItems__Fi", SN_NOWARN) set_name(0x8003D38C, "ItemSpaceOk__Fii", SN_NOWARN) set_name(0x8003D664, "GetItemSpace__Fiic", SN_NOWARN) set_name(0x8003D890, "GetSuperItemSpace__Fiic", SN_NOWARN) set_name(0x8003D9F8, "GetSuperItemLoc__FiiRiT2", SN_NOWARN) set_name(0x8003DAC0, "CalcItemValue__Fi", SN_NOWARN) set_name(0x8003DB78, "GetBookSpell__Fii", SN_NOWARN) set_name(0x8003DDE0, "GetStaffPower__FiiiUc", SN_NOWARN) set_name(0x8003DFD0, "GetStaffSpell__FiiUc", SN_NOWARN) set_name(0x8003E284, "GetItemAttrs__Fiii", SN_NOWARN) set_name(0x8003E7D0, "RndPL__Fii", SN_NOWARN) set_name(0x8003E808, "PLVal__Fiiiii", SN_NOWARN) set_name(0x8003E87C, "SaveItemPower__Fiiiiiii", SN_NOWARN) set_name(0x8003FFA8, "GetItemPower__FiiilUc", SN_NOWARN) set_name(0x80040410, "GetItemBonus__FiiiiUc", SN_NOWARN) set_name(0x8004050C, "SetupItem__Fi", SN_NOWARN) set_name(0x80040614, "RndItem__Fi", SN_NOWARN) set_name(0x80040858, "RndUItem__Fi", SN_NOWARN) set_name(0x80040A98, "RndAllItems__Fv", SN_NOWARN) set_name(0x80040C0C, "RndTypeItems__Fii", SN_NOWARN) set_name(0x80040D0C, "CheckUnique__FiiiUc", SN_NOWARN) set_name(0x80040EBC, "GetUniqueItem__Fii", SN_NOWARN) set_name(0x80041164, "SpawnUnique__Fiii", SN_NOWARN) set_name(0x8004129C, "ItemRndDur__Fi", SN_NOWARN) set_name(0x8004132C, "SetupAllItems__FiiiiiUcUcUc", SN_NOWARN) set_name(0x80041638, "SpawnItem__FiiiUc", SN_NOWARN) set_name(0x80041880, "CreateItem__Fiii", SN_NOWARN) set_name(0x800419B0, "CreateRndItem__FiiUcUcUc", SN_NOWARN) set_name(0x80041AF8, "SetupAllUseful__Fiii", SN_NOWARN) set_name(0x80041BD0, "CreateRndUseful__FiiiUc", SN_NOWARN) set_name(0x80041C90, "CreateTypeItem__FiiUciiUcUc", SN_NOWARN) set_name(0x80041DD4, "RecreateEar__FiUsiUciiiiii", SN_NOWARN) set_name(0x80041FC0, "SpawnQuestItem__Fiiiii", SN_NOWARN) set_name(0x80042234, "SpawnRock__Fv", SN_NOWARN) set_name(0x800423F4, "RespawnItem__FiUc", SN_NOWARN) set_name(0x800425AC, "DeleteItem__Fii", SN_NOWARN) set_name(0x80042600, "ItemDoppel__Fv", SN_NOWARN) set_name(0x800426C8, "ProcessItems__Fv", SN_NOWARN) set_name(0x800428D0, "FreeItemGFX__Fv", SN_NOWARN) set_name(0x800428D8, "GetItemStr__Fi", SN_NOWARN) set_name(0x80042A80, "CheckIdentify__Fii", SN_NOWARN) set_name(0x80042B70, "RepairItem__FP10ItemStructi", SN_NOWARN) set_name(0x80042C40, "DoRepair__Fii", SN_NOWARN) set_name(0x80042D04, "RechargeItem__FP10ItemStructi", SN_NOWARN) set_name(0x80042D74, "DoRecharge__Fii", SN_NOWARN) set_name(0x80042E74, "PrintItemOil__Fc", SN_NOWARN) set_name(0x80042F68, "PrintItemPower__FcPC10ItemStruct", SN_NOWARN) set_name(0x80043624, "PrintUString__FiiUcPcc", SN_NOWARN) set_name(0x8004362C, "PrintItemMisc__FPC10ItemStruct", SN_NOWARN) set_name(0x800437B8, "PrintItemDetails__FPC10ItemStruct", SN_NOWARN) set_name(0x80043B28, "PrintItemDur__FPC10ItemStruct", SN_NOWARN) set_name(0x80043E38, "CastScroll__Fii", SN_NOWARN) set_name(0x80043E50, "UseItem__Fiii", SN_NOWARN) set_name(0x80044468, "StoreStatOk__FP10ItemStruct", SN_NOWARN) set_name(0x800444FC, "PremiumItemOk__Fi", SN_NOWARN) set_name(0x80044578, "RndPremiumItem__Fii", SN_NOWARN) set_name(0x80044680, "SpawnOnePremium__Fii", SN_NOWARN) set_name(0x800448A0, "SpawnPremium__Fi", SN_NOWARN) set_name(0x80044AE4, "WitchBookLevel__Fi", SN_NOWARN) set_name(0x80044C34, "SpawnStoreGold__Fv", SN_NOWARN) set_name(0x80044CB8, "RecalcStoreStats__Fv", SN_NOWARN) set_name(0x80044E58, "ItemNoFlippy__Fv", SN_NOWARN) set_name(0x80044EBC, "CreateSpellBook__FiiiUcUc", SN_NOWARN) set_name(0x8004504C, "CreateMagicArmor__FiiiiUcUc", SN_NOWARN) set_name(0x800451C8, "CreateMagicWeapon__FiiiiUcUc", SN_NOWARN) set_name(0x80045344, "DrawUniqueInfo__Fv", SN_NOWARN) set_name(0x800454B8, "MakeItemStr__FP10ItemStructUsUs", SN_NOWARN) set_name(0x800456B8, "veclen2__Fii", SN_NOWARN) set_name(0x80045720, "set_light_bands__Fv", SN_NOWARN) set_name(0x8004579C, "SetLightFX__FiisssUcUcUc", SN_NOWARN) set_name(0x80045808, "DoLighting__Fiiii", SN_NOWARN) set_name(0x800464B8, "DoUnLight__Fv", SN_NOWARN) set_name(0x80046700, "DoUnVision__Fiii", SN_NOWARN) set_name(0x800467C4, "DoVision__FiiiUcUc", SN_NOWARN) set_name(0x80046CD4, "FreeLightTable__Fv", SN_NOWARN) set_name(0x80046CDC, "InitLightTable__Fv", SN_NOWARN) set_name(0x80046CE4, "MakeLightTable__Fv", SN_NOWARN) set_name(0x80046CEC, "InitLightMax__Fv", SN_NOWARN) set_name(0x80046D10, "InitLighting__Fv", SN_NOWARN) set_name(0x80046D54, "AddLight__Fiii", SN_NOWARN) set_name(0x80046DC0, "AddUnLight__Fi", SN_NOWARN) set_name(0x80046DF0, "ChangeLightRadius__Fii", SN_NOWARN) set_name(0x80046E1C, "ChangeLightXY__Fiii", SN_NOWARN) set_name(0x80046E58, "light_fix__Fi", SN_NOWARN) set_name(0x80046E60, "ChangeLightOff__Fiii", SN_NOWARN) set_name(0x80046E94, "ChangeLight__Fiiii", SN_NOWARN) set_name(0x80046ECC, "ChangeLightColour__Fii", SN_NOWARN) set_name(0x80046EF4, "ProcessLightList__Fv", SN_NOWARN) set_name(0x80047018, "SavePreLighting__Fv", SN_NOWARN) set_name(0x80047020, "InitVision__Fv", SN_NOWARN) set_name(0x80047070, "AddVision__FiiiUc", SN_NOWARN) set_name(0x800470EC, "ChangeVisionRadius__Fii", SN_NOWARN) set_name(0x800471A0, "ChangeVisionXY__Fiii", SN_NOWARN) set_name(0x80047220, "ProcessVisionList__Fv", SN_NOWARN) set_name(0x80047420, "FreeQuestText__Fv", SN_NOWARN) set_name(0x80047428, "InitQuestText__Fv", SN_NOWARN) set_name(0x80047434, "CalcTextSpeed__FPCc", SN_NOWARN) set_name(0x80047588, "InitQTextMsg__Fi", SN_NOWARN) set_name(0x80047730, "DrawQTextBack__Fv", SN_NOWARN) set_name(0x800477A0, "DrawQTextTSK__FP4TASK", SN_NOWARN) set_name(0x800478E0, "DrawQText__Fv", SN_NOWARN) set_name(0x80047C4C, "_GLOBAL__D_QBack", SN_NOWARN) set_name(0x80047C74, "_GLOBAL__I_QBack", SN_NOWARN) set_name(0x80047C9C, "SetRGB__6DialogUcUcUc_addr_80047C9C", SN_NOWARN) set_name(0x80047CBC, "SetBorder__6Dialogi_addr_80047CBC", SN_NOWARN) set_name(0x80047CC4, "___6Dialog_addr_80047CC4", SN_NOWARN) set_name(0x80047CEC, "__6Dialog_addr_80047CEC", SN_NOWARN) set_name(0x80047D48, "GetCharWidth__5CFontc_addr_80047D48", SN_NOWARN) set_name(0x80047DA0, "GetDown__C4CPad_addr_80047DA0", SN_NOWARN) set_name(0x80047DC8, "GetFr__7TextDati_addr_80047DC8", SN_NOWARN) set_name(0x80047DE4, "nullmissile__Fiiiiiicii", SN_NOWARN) set_name(0x80047DEC, "FuncNULL__FP13MissileStructiii", SN_NOWARN) set_name(0x80047DF4, "delta_init__Fv", SN_NOWARN) set_name(0x80047E54, "delta_kill_monster__FiUcUcUc", SN_NOWARN) set_name(0x80047EF0, "delta_monster_hp__FilUc", SN_NOWARN) set_name(0x80047F74, "delta_sync_golem__FPC9TCmdGolemiUc", SN_NOWARN) set_name(0x80048004, "delta_leave_sync__FUc", SN_NOWARN) set_name(0x80048330, "delta_sync_object__FiUcUc", SN_NOWARN) set_name(0x80048390, "delta_get_item__FPC9TCmdGItemUc", SN_NOWARN) set_name(0x80048554, "delta_put_item__FPC9TCmdPItemiiUc", SN_NOWARN) set_name(0x800486DC, "delta_portal_inited__Fi", SN_NOWARN) set_name(0x80048700, "delta_quest_inited__Fi", SN_NOWARN) set_name(0x80048724, "DeltaAddItem__Fi", SN_NOWARN) set_name(0x80048938, "DeltaExportData__FPc", SN_NOWARN) set_name(0x800489E0, "DeltaImportData__FPc", SN_NOWARN) set_name(0x80048A8C, "DeltaSaveLevel__Fv", SN_NOWARN) set_name(0x80048B88, "NetSendCmd__FUcUc", SN_NOWARN) set_name(0x80048BB0, "NetSendCmdGolem__FUcUcUcUclUc", SN_NOWARN) set_name(0x80048BFC, "NetSendCmdLoc__FUcUcUcUc", SN_NOWARN) set_name(0x80048C2C, "NetSendCmdLocParam1__FUcUcUcUcUs", SN_NOWARN) set_name(0x80048C64, "NetSendCmdLocParam2__FUcUcUcUcUsUs", SN_NOWARN) set_name(0x80048CA4, "NetSendCmdLocParam3__FUcUcUcUcUsUsUs", SN_NOWARN) set_name(0x80048CEC, "NetSendCmdParam1__FUcUcUs", SN_NOWARN) set_name(0x80048D18, "NetSendCmdParam2__FUcUcUsUs", SN_NOWARN) set_name(0x80048D48, "NetSendCmdParam3__FUcUcUsUsUs", SN_NOWARN) set_name(0x80048D80, "NetSendCmdQuest__FUcUc", SN_NOWARN) set_name(0x80048DF4, "NetSendCmdGItem__FUcUcUcUcUc", SN_NOWARN) set_name(0x80048F28, "NetSendCmdGItem2__FUcUcUcUcPC9TCmdGItem", SN_NOWARN) set_name(0x80048FA4, "NetSendCmdReq2__FUcUcUcPC9TCmdGItem", SN_NOWARN) set_name(0x80048FFC, "NetSendCmdExtra__FPC9TCmdGItem", SN_NOWARN) set_name(0x80049064, "NetSendCmdPItem__FUcUcUcUc", SN_NOWARN) set_name(0x8004916C, "NetSendCmdChItem__FUcUc", SN_NOWARN) set_name(0x80049210, "NetSendCmdDelItem__FUcUc", SN_NOWARN) set_name(0x80049240, "NetSendCmdDItem__FUci", SN_NOWARN) set_name(0x80049354, "i_own_level__Fi", SN_NOWARN) set_name(0x8004935C, "NetSendCmdDamage__FUcUcUl", SN_NOWARN) set_name(0x80049390, "delta_open_portal__FiUcUcUcUcUc", SN_NOWARN) set_name(0x800493EC, "delta_close_portal__Fi", SN_NOWARN) set_name(0x8004942C, "check_update_plr__Fi", SN_NOWARN) set_name(0x80049434, "On_WALKXY__FPC4TCmdi", SN_NOWARN) set_name(0x800494B4, "On_ADDSTR__FPC4TCmdi", SN_NOWARN) set_name(0x800494E4, "On_ADDMAG__FPC4TCmdi", SN_NOWARN) set_name(0x80049514, "On_ADDDEX__FPC4TCmdi", SN_NOWARN) set_name(0x80049544, "On_ADDVIT__FPC4TCmdi", SN_NOWARN) set_name(0x80049574, "On_SBSPELL__FPC4TCmdi", SN_NOWARN) set_name(0x800495E8, "On_GOTOGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049670, "On_REQUESTGITEM__FPC4TCmdi", SN_NOWARN) set_name(0x800497B0, "On_GETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049980, "On_GOTOAGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049A08, "On_REQUESTAGITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049B3C, "On_AGETITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049D04, "On_ITEMEXTRA__FPC4TCmdi", SN_NOWARN) set_name(0x80049D50, "On_PUTITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049E68, "On_SYNCPUTITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049F68, "On_RESPAWNITEM__FPC4TCmdi", SN_NOWARN) set_name(0x80049FC0, "On_SATTACKXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A04C, "On_SPELLXYD__FPC4TCmdi", SN_NOWARN) set_name(0x8004A134, "On_SPELLXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A20C, "On_TSPELLXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A2E8, "On_OPOBJXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A3C8, "On_DISARMXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004A4A8, "On_OPOBJT__FPC4TCmdi", SN_NOWARN) set_name(0x8004A4F4, "On_ATTACKID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A628, "On_SPELLID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A6F0, "On_SPELLPID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A7B0, "On_TSPELLID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A874, "On_TSPELLPID__FPC4TCmdi", SN_NOWARN) set_name(0x8004A938, "On_KNOCKBACK__FPC4TCmdi", SN_NOWARN) set_name(0x8004A980, "On_RESURRECT__FPC4TCmdi", SN_NOWARN) set_name(0x8004A9B8, "On_HEALOTHER__FPC4TCmdi", SN_NOWARN) set_name(0x8004A9E0, "On_TALKXY__FPC4TCmdi", SN_NOWARN) set_name(0x8004AA68, "On_NEWLVL__FPC4TCmdi", SN_NOWARN) set_name(0x8004AA98, "On_WARP__FPC4TCmdi", SN_NOWARN) set_name(0x8004AB8C, "On_MONSTDEATH__FPC4TCmdi", SN_NOWARN) set_name(0x8004ABF8, "On_KILLGOLEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004AC64, "On_AWAKEGOLEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004AD7C, "On_MONSTDAMAGE__FPC4TCmdi", SN_NOWARN) set_name(0x8004AE68, "On_PLRDEAD__FPC4TCmdi", SN_NOWARN) set_name(0x8004AEB0, "On_PLRDAMAGE__FPC4TCmdi", SN_NOWARN) set_name(0x8004B06C, "On_OPENDOOR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B0E8, "On_CLOSEDOOR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B164, "On_OPERATEOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B1E0, "On_PLROPOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B25C, "On_BREAKOBJ__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2D4, "On_CHANGEPLRITEMS__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2DC, "On_DELPLRITEMS__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2E4, "On_PLRLEVEL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B2EC, "On_DROPITEM__FPC4TCmdi", SN_NOWARN) set_name(0x8004B344, "On_PLAYER_JOINLEVEL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B5BC, "On_ACTIVATEPORTAL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B74C, "On_DEACTIVATEPORTAL__FPC4TCmdi", SN_NOWARN) set_name(0x8004B79C, "On_RETOWN__FPC4TCmdi", SN_NOWARN) set_name(0x8004B7E4, "On_SETSTR__FPC4TCmdi", SN_NOWARN) set_name(0x8004B824, "On_SETDEX__FPC4TCmdi", SN_NOWARN) set_name(0x8004B864, "On_SETMAG__FPC4TCmdi", SN_NOWARN) set_name(0x8004B8A4, "On_SETVIT__FPC4TCmdi", SN_NOWARN) set_name(0x8004B8E4, "On_SYNCQUEST__FPC4TCmdi", SN_NOWARN) set_name(0x8004B92C, "On_ENDSHIELD__FPC4TCmdi", SN_NOWARN) set_name(0x8004BA08, "ParseCmd__FiPC4TCmd", SN_NOWARN) set_name(0x8004BE28, "GetDLevel__Fib", SN_NOWARN) set_name(0x8004BEB8, "ReleaseDLevel__FP6DLevel", SN_NOWARN) set_name(0x8004BEF0, "NetSendLoPri__FPCUcUc", SN_NOWARN) set_name(0x8004BF1C, "InitLevelType__Fi", SN_NOWARN) set_name(0x8004BF68, "SetupLocalCoords__Fv", SN_NOWARN) set_name(0x8004C0F8, "InitNewSeed__Fl", SN_NOWARN) set_name(0x8004C16C, "NetInit__FUcPUc", SN_NOWARN) set_name(0x8004C3C0, "PostAddL1Door__Fiiii", SN_NOWARN) set_name(0x8004C4F8, "PostAddL2Door__Fiiii", SN_NOWARN) set_name(0x8004C644, "PostAddArmorStand__Fi", SN_NOWARN) set_name(0x8004C6CC, "PostTorchLocOK__Fii", SN_NOWARN) set_name(0x8004C70C, "PostAddObjLight__Fii", SN_NOWARN) set_name(0x8004C7B0, "PostObjObjAddSwitch__Fiiii", SN_NOWARN) set_name(0x8004C840, "InitObjectGFX__Fv", SN_NOWARN) set_name(0x8004CA5C, "FreeObjectGFX__Fv", SN_NOWARN) set_name(0x8004CA68, "DeleteObject__Fii", SN_NOWARN) set_name(0x8004CB20, "SetupObject__Fiiii", SN_NOWARN) set_name(0x8004CDA4, "SetObjMapRange__Fiiiiii", SN_NOWARN) set_name(0x8004CE04, "SetBookMsg__Fii", SN_NOWARN) set_name(0x8004CE2C, "AddObject__Fiii", SN_NOWARN) set_name(0x8004CF38, "PostAddObject__Fiii", SN_NOWARN) set_name(0x8004D044, "Obj_Light__Fii", SN_NOWARN) set_name(0x8004D254, "Obj_Circle__Fi", SN_NOWARN) set_name(0x8004D590, "Obj_StopAnim__Fi", SN_NOWARN) set_name(0x8004D5F4, "DrawExpl__Fiiiiiccc", SN_NOWARN) set_name(0x8004D8D0, "DrawObjExpl__FP12ObjectStructiii", SN_NOWARN) set_name(0x8004D940, "Obj_Door__Fi", SN_NOWARN) set_name(0x8004DAD4, "Obj_Sarc__Fi", SN_NOWARN) set_name(0x8004DB20, "ActivateTrapLine__Fii", SN_NOWARN) set_name(0x8004DC44, "Obj_FlameTrap__Fi", SN_NOWARN) set_name(0x8004DF14, "Obj_Trap__Fi", SN_NOWARN) set_name(0x8004E264, "Obj_BCrossDamage__Fi", SN_NOWARN) set_name(0x8004E4F4, "ProcessObjects__Fv", SN_NOWARN) set_name(0x8004E7D0, "ObjSetMicro__Fiii", SN_NOWARN) set_name(0x8004E808, "ObjSetMini__Fiii", SN_NOWARN) set_name(0x8004E8DC, "ObjL1Special__Fiiii", SN_NOWARN) set_name(0x8004E8E4, "ObjL2Special__Fiiii", SN_NOWARN) set_name(0x8004E8EC, "DoorSet__Fiii", SN_NOWARN) set_name(0x8004EB6C, "RedoPlayerVision__Fv", SN_NOWARN) set_name(0x8004EC10, "OperateL1RDoor__FiiUc", SN_NOWARN) set_name(0x8004EFB4, "OperateL1LDoor__FiiUc", SN_NOWARN) set_name(0x8004F38C, "OperateL2RDoor__FiiUc", SN_NOWARN) set_name(0x8004F724, "OperateL2LDoor__FiiUc", SN_NOWARN) set_name(0x8004FABC, "OperateL3RDoor__FiiUc", SN_NOWARN) set_name(0x8004FDC4, "OperateL3LDoor__FiiUc", SN_NOWARN) set_name(0x800500CC, "MonstCheckDoors__Fi", SN_NOWARN) set_name(0x800505C8, "PostAddL1Objs__Fiiii", SN_NOWARN) set_name(0x80050700, "PostAddL2Objs__Fiiii", SN_NOWARN) set_name(0x80050814, "ObjChangeMap__Fiiii", SN_NOWARN) set_name(0x800509CC, "DRLG_MRectTrans__Fiiii", SN_NOWARN) set_name(0x80050A78, "ObjChangeMapResync__Fiiii", SN_NOWARN) set_name(0x80050BFC, "OperateL1Door__FiiUc", SN_NOWARN) set_name(0x80050D58, "OperateLever__Fii", SN_NOWARN) set_name(0x80050F44, "OperateBook__Fii", SN_NOWARN) set_name(0x8005146C, "OperateBookLever__Fii", SN_NOWARN) set_name(0x800519FC, "OperateSChambBk__Fii", SN_NOWARN) set_name(0x80051C3C, "OperateChest__FiiUc", SN_NOWARN) set_name(0x8005200C, "OperateMushPatch__Fii", SN_NOWARN) set_name(0x800521D8, "OperateInnSignChest__Fii", SN_NOWARN) set_name(0x8005238C, "OperateSlainHero__FiiUc", SN_NOWARN) set_name(0x800525E0, "OperateTrapLvr__Fi", SN_NOWARN) set_name(0x800527B0, "OperateSarc__FiiUc", SN_NOWARN) set_name(0x80052968, "OperateL2Door__FiiUc", SN_NOWARN) set_name(0x80052AC4, "OperateL3Door__FiiUc", SN_NOWARN) set_name(0x80052C20, "LoadMapObjs__FPUcii", SN_NOWARN) set_name(0x80052D28, "OperatePedistal__Fii", SN_NOWARN) set_name(0x80053240, "TryDisarm__Fii", SN_NOWARN) set_name(0x80053404, "ItemMiscIdIdx__Fi", SN_NOWARN) set_name(0x80053474, "OperateShrine__Fiii", SN_NOWARN) set_name(0x80055A44, "OperateSkelBook__FiiUc", SN_NOWARN) set_name(0x80055BC0, "OperateBookCase__FiiUc", SN_NOWARN) set_name(0x80055DC4, "OperateDecap__FiiUc", SN_NOWARN) set_name(0x80055EAC, "OperateArmorStand__FiiUc", SN_NOWARN) set_name(0x8005601C, "FindValidShrine__Fi", SN_NOWARN) set_name(0x8005610C, "OperateGoatShrine__Fiii", SN_NOWARN) set_name(0x800561B4, "OperateCauldron__Fiii", SN_NOWARN) set_name(0x80056258, "OperateFountains__Fii", SN_NOWARN) set_name(0x80056804, "OperateWeaponRack__FiiUc", SN_NOWARN) set_name(0x800569B0, "OperateStoryBook__Fii", SN_NOWARN) set_name(0x80056AA0, "OperateLazStand__Fii", SN_NOWARN) set_name(0x80056C04, "OperateObject__FiiUc", SN_NOWARN) set_name(0x8005703C, "SyncOpL1Door__Fiii", SN_NOWARN) set_name(0x80057150, "SyncOpL2Door__Fiii", SN_NOWARN) set_name(0x80057264, "SyncOpL3Door__Fiii", SN_NOWARN) set_name(0x80057378, "SyncOpObject__Fiii", SN_NOWARN) set_name(0x80057578, "BreakCrux__Fi", SN_NOWARN) set_name(0x80057768, "BreakBarrel__FiiiUcUc", SN_NOWARN) set_name(0x80057CBC, "BreakObject__Fii", SN_NOWARN) set_name(0x80057E1C, "SyncBreakObj__Fii", SN_NOWARN) set_name(0x80057E78, "SyncL1Doors__Fi", SN_NOWARN) set_name(0x80057F90, "SyncCrux__Fi", SN_NOWARN) set_name(0x800580C8, "SyncLever__Fi", SN_NOWARN) set_name(0x80058144, "SyncQSTLever__Fi", SN_NOWARN) set_name(0x80058250, "SyncPedistal__Fi", SN_NOWARN) set_name(0x800583AC, "SyncL2Doors__Fi", SN_NOWARN) set_name(0x80058514, "SyncL3Doors__Fi", SN_NOWARN) set_name(0x80058640, "SyncObjectAnim__Fi", SN_NOWARN) set_name(0x80058780, "GetObjectStr__Fi", SN_NOWARN) set_name(0x80058B9C, "RestoreObjectLight__Fv", SN_NOWARN) set_name(0x80058DB8, "GetNumOfFrames__7TextDatii_addr_80058DB8", SN_NOWARN) set_name(0x80058DF0, "GetCreature__7TextDati_addr_80058DF0", SN_NOWARN) set_name(0x80058E68, "GetNumOfCreatures__7TextDat_addr_80058E68", SN_NOWARN) set_name(0x80058E7C, "FindPath__FPFiii_UciiiiiPc", SN_NOWARN) set_name(0x80058E84, "game_2_ui_class__FPC12PlayerStruct", SN_NOWARN) set_name(0x80058EB0, "game_2_ui_player__FPC12PlayerStructP11_uiheroinfoUc", SN_NOWARN) set_name(0x80058F64, "SetupLocalPlayer__Fv", SN_NOWARN) set_name(0x80058F84, "ismyplr__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FC8, "plrind__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FDC, "InitPlayerGFX__FP12PlayerStruct", SN_NOWARN) set_name(0x80058FFC, "FreePlayerGFX__FP12PlayerStruct", SN_NOWARN) set_name(0x80059004, "NewPlrAnim__FP12PlayerStructiii", SN_NOWARN) set_name(0x80059020, "ClearPlrPVars__FP12PlayerStruct", SN_NOWARN) set_name(0x80059044, "SetPlrAnims__FP12PlayerStruct", SN_NOWARN) set_name(0x80059280, "CreatePlayer__FP12PlayerStructc", SN_NOWARN) set_name(0x8005969C, "CalcStatDiff__FP12PlayerStruct", SN_NOWARN) set_name(0x80059704, "NextPlrLevel__FP12PlayerStruct", SN_NOWARN) set_name(0x80059874, "AddPlrExperience__FP12PlayerStructil", SN_NOWARN) set_name(0x80059A80, "AddPlrMonstExper__Filc", SN_NOWARN) set_name(0x80059B04, "InitPlayer__FP12PlayerStructUc", SN_NOWARN) set_name(0x80059EA4, "InitMultiView__Fv", SN_NOWARN) set_name(0x80059EAC, "CheckLeighSolid__Fii", SN_NOWARN) set_name(0x80059F44, "SolidLoc__Fii", SN_NOWARN) set_name(0x80059FCC, "PlrClrTrans__Fii", SN_NOWARN) set_name(0x8005A060, "PlrDoTrans__Fii", SN_NOWARN) set_name(0x8005A154, "SetPlayerOld__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A168, "StartStand__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A1F4, "StartWalkStand__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A258, "PM_ChangeLightOff__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A294, "PM_ChangeOffset__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A2C0, "StartAttack__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A3F8, "StartPlrBlock__FP12PlayerStructi", SN_NOWARN) set_name(0x8005A490, "StartSpell__FP12PlayerStructiii", SN_NOWARN) set_name(0x8005A62C, "RemovePlrFromMap__FP12PlayerStruct", SN_NOWARN) set_name(0x8005A74C, "StartPlrHit__FP12PlayerStructiUc", SN_NOWARN) set_name(0x8005A86C, "RespawnDeadItem__FP10ItemStructii", SN_NOWARN) set_name(0x8005AA08, "PlrDeadItem__FP12PlayerStructP10ItemStructii", SN_NOWARN) set_name(0x8005ABD0, "StartPlayerKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005AED8, "DropHalfPlayersGold__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B320, "StartPlrKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005B478, "SyncPlrKill__FP12PlayerStructi", SN_NOWARN) set_name(0x8005B498, "RemovePlrMissiles__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B780, "InitLevelChange__FP12PlayerStruct", SN_NOWARN) set_name(0x8005B844, "StartNewLvl__FP12PlayerStructii", SN_NOWARN) set_name(0x8005B988, "RestartTownLvl__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BA18, "StartWarpLvl__FP12PlayerStructi", SN_NOWARN) set_name(0x8005BAD4, "PM_DoStand__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BADC, "ChkPlrOffsets__Fiiii", SN_NOWARN) set_name(0x8005BB64, "PM_DoWalk__FP12PlayerStruct", SN_NOWARN) set_name(0x8005BED0, "WeaponDur__FP12PlayerStructi", SN_NOWARN) set_name(0x8005C070, "PlrHitMonst__FP12PlayerStructi", SN_NOWARN) set_name(0x8005C6A0, "PlrHitPlr__FP12PlayerStructc", SN_NOWARN) set_name(0x8005CA50, "PlrHitObj__FP12PlayerStructii", SN_NOWARN) set_name(0x8005CAE0, "PM_DoAttack__FP12PlayerStruct", SN_NOWARN) set_name(0x8005CE6C, "PM_DoRangeAttack__FP12PlayerStruct", SN_NOWARN) set_name(0x8005CF6C, "ShieldDur__FP12PlayerStruct", SN_NOWARN) set_name(0x8005D030, "PM_DoBlock__FP12PlayerStruct", SN_NOWARN) set_name(0x8005D0D0, "do_spell_anim__FiiiP12PlayerStruct", SN_NOWARN) set_name(0x8005E094, "PM_DoSpell__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E3D4, "ArmorDur__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E4D4, "PM_DoGotHit__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E550, "PM_DoDeath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E690, "PM_DoNewLvl__FP12PlayerStruct", SN_NOWARN) set_name(0x8005E698, "CheckNewPath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005EAD8, "PlrDeathModeOK__Fi", SN_NOWARN) set_name(0x8005EB40, "ValidatePlayer__Fv", SN_NOWARN) set_name(0x8005F028, "CheckCheatStats__FP12PlayerStruct", SN_NOWARN) set_name(0x8005F0C4, "ProcessPlayers__Fv", SN_NOWARN) set_name(0x8005F3F8, "ClrPlrPath__FP12PlayerStruct", SN_NOWARN) set_name(0x8005F420, "PosOkPlayer__FP12PlayerStructii", SN_NOWARN) set_name(0x8005F5C8, "MakePlrPath__FP12PlayerStructiiUc", SN_NOWARN) set_name(0x8005F5D0, "CheckPlrSpell__Fv", SN_NOWARN) set_name(0x8005F9E0, "SyncInitPlrPos__FP12PlayerStruct", SN_NOWARN) set_name(0x8005FB08, "SyncInitPlr__FP12PlayerStruct", SN_NOWARN) set_name(0x8005FB38, "CheckStats__Fi", SN_NOWARN) set_name(0x8005FCD4, "ModifyPlrStr__Fii", SN_NOWARN) set_name(0x8005FDF0, "ModifyPlrMag__Fii", SN_NOWARN) set_name(0x8005FEDC, "ModifyPlrDex__Fii", SN_NOWARN) set_name(0x8005FFC0, "ModifyPlrVit__Fii", SN_NOWARN) set_name(0x8006009C, "SetPlayerHitPoints__FP12PlayerStructi", SN_NOWARN) set_name(0x800600E0, "SetPlrStr__Fii", SN_NOWARN) set_name(0x800601BC, "SetPlrMag__Fii", SN_NOWARN) set_name(0x8006022C, "SetPlrDex__Fii", SN_NOWARN) set_name(0x80060308, "SetPlrVit__Fii", SN_NOWARN) set_name(0x80060374, "InitDungMsgs__FP12PlayerStruct", SN_NOWARN) set_name(0x8006037C, "PlayDungMsgs__Fv", SN_NOWARN) set_name(0x800606AC, "CreatePlrItems__FP12PlayerStruct", SN_NOWARN) set_name(0x800606D4, "WorldToOffset__FP12PlayerStructii", SN_NOWARN) set_name(0x80060718, "SetSpdbarGoldCurs__FP12PlayerStructi", SN_NOWARN) set_name(0x8006074C, "GetSpellLevel__FP12PlayerStructi", SN_NOWARN) set_name(0x80060780, "BreakObject__FP12PlayerStructi", SN_NOWARN) set_name(0x800607B4, "CalcPlrInv__FP12PlayerStructUc", SN_NOWARN) set_name(0x800607E8, "RemoveSpdBarItem__FP12PlayerStructi", SN_NOWARN) set_name(0x8006081C, "M_StartKill__FiP12PlayerStruct", SN_NOWARN) set_name(0x80060854, "SetGoldCurs__FP12PlayerStructi", SN_NOWARN) set_name(0x80060888, "HealStart__FP12PlayerStruct", SN_NOWARN) set_name(0x800608B0, "HealotherStart__FP12PlayerStruct", SN_NOWARN) set_name(0x800608D8, "CalculateGold__FP12PlayerStruct", SN_NOWARN) set_name(0x80060900, "M_StartHit__FiP12PlayerStructi", SN_NOWARN) set_name(0x80060948, "TeleStart__FP12PlayerStruct", SN_NOWARN) set_name(0x80060970, "PhaseStart__FP12PlayerStruct", SN_NOWARN) set_name(0x80060998, "RemoveInvItem__FP12PlayerStructi", SN_NOWARN) set_name(0x800609CC, "PhaseEnd__FP12PlayerStruct", SN_NOWARN) set_name(0x800609F4, "OperateObject__FP12PlayerStructiUc", SN_NOWARN) set_name(0x80060A38, "TryDisarm__FP12PlayerStructi", SN_NOWARN) set_name(0x80060A6C, "TalkToTowner__FP12PlayerStructi", SN_NOWARN) set_name(0x80060AA0, "PosOkPlayer__Fiii", SN_NOWARN) set_name(0x80060AEC, "CalcStatDiff__Fi", SN_NOWARN) set_name(0x80060B38, "StartNewLvl__Fiii", SN_NOWARN) set_name(0x80060B84, "CreatePlayer__Fic", SN_NOWARN) set_name(0x80060BD8, "StartStand__Fii", SN_NOWARN) set_name(0x80060C24, "SetPlayerHitPoints__Fii", SN_NOWARN) set_name(0x80060C70, "MakePlrPath__FiiiUc", SN_NOWARN) set_name(0x80060CC0, "StartWarpLvl__Fii", SN_NOWARN) set_name(0x80060D0C, "SyncPlrKill__Fii", SN_NOWARN) set_name(0x80060D58, "StartPlrKill__Fii", SN_NOWARN) set_name(0x80060DA4, "NewPlrAnim__Fiiii", SN_NOWARN) set_name(0x80060DF0, "AddPlrExperience__Fiil", SN_NOWARN) set_name(0x80060E3C, "StartPlrBlock__Fii", SN_NOWARN) set_name(0x80060E88, "StartPlrHit__FiiUc", SN_NOWARN) set_name(0x80060ED8, "StartSpell__Fiiii", SN_NOWARN) set_name(0x80060F24, "InitPlayer__FiUc", SN_NOWARN) set_name(0x80060F74, "PM_ChangeLightOff__Fi", SN_NOWARN) set_name(0x80060FC0, "CheckNewPath__Fi", SN_NOWARN) set_name(0x8006100C, "FreePlayerGFX__Fi", SN_NOWARN) set_name(0x80061058, "InitDungMsgs__Fi", SN_NOWARN) set_name(0x800610A4, "InitPlayerGFX__Fi", SN_NOWARN) set_name(0x800610F0, "SyncInitPlrPos__Fi", SN_NOWARN) set_name(0x8006113C, "SetPlrAnims__Fi", SN_NOWARN) set_name(0x80061188, "ClrPlrPath__Fi", SN_NOWARN) set_name(0x800611D4, "SyncInitPlr__Fi", SN_NOWARN) set_name(0x80061220, "RestartTownLvl__Fi", SN_NOWARN) set_name(0x8006126C, "SetPlayerOld__Fi", SN_NOWARN) set_name(0x800612B8, "GetGoldSeed__FP12PlayerStructP10ItemStruct", SN_NOWARN) set_name(0x800612EC, "PRIM_GetPrim__FPP8POLY_FT4_addr_800612EC", SN_NOWARN) set_name(0x80061368, "GetPlayer__7CPlayeri_addr_80061368", SN_NOWARN) set_name(0x800613B8, "GetLastOtPos__C7CPlayer_addr_800613B8", SN_NOWARN) set_name(0x800613C4, "GetLastScrY__C7CPlayer", SN_NOWARN) set_name(0x800613D0, "GetLastScrX__C7CPlayer", SN_NOWARN) set_name(0x800613DC, "TSK_Lava2Water__FP4TASK", SN_NOWARN) set_name(0x80061628, "CheckQuests__Fv", SN_NOWARN) set_name(0x80061ADC, "ForceQuests__Fv", SN_NOWARN) set_name(0x80061C80, "QuestStatus__Fi", SN_NOWARN) set_name(0x80061D14, "CheckQuestKill__FiUc", SN_NOWARN) set_name(0x800622F4, "SetReturnLvlPos__Fv", SN_NOWARN) set_name(0x80062404, "GetReturnLvlPos__Fv", SN_NOWARN) set_name(0x80062458, "ResyncMPQuests__Fv", SN_NOWARN) set_name(0x80062594, "ResyncQuests__Fv", SN_NOWARN) set_name(0x80062AF4, "PrintQLString__FiiUcPcc", SN_NOWARN) set_name(0x80062D20, "DrawQuestLog__Fv", SN_NOWARN) set_name(0x80062EE8, "DrawQuestLogTSK__FP4TASK", SN_NOWARN) set_name(0x80062F80, "StartQuestlog__Fv", SN_NOWARN) set_name(0x80063098, "QuestlogUp__Fv", SN_NOWARN) set_name(0x800630EC, "QuestlogDown__Fv", SN_NOWARN) set_name(0x80063158, "RemoveQLog__Fv", SN_NOWARN) set_name(0x800631D0, "QuestlogEnter__Fv", SN_NOWARN) set_name(0x80063294, "QuestlogESC__Fv", SN_NOWARN) set_name(0x800632BC, "SetMultiQuest__FiiUci", SN_NOWARN) set_name(0x8006333C, "_GLOBAL__D_questlog", SN_NOWARN) set_name(0x80063364, "_GLOBAL__I_questlog", SN_NOWARN) set_name(0x8006338C, "GetBlockTexDat__7CBlocks", SN_NOWARN) set_name(0x80063398, "SetRGB__6DialogUcUcUc_addr_80063398", SN_NOWARN) set_name(0x800633B8, "SetBack__6Dialogi_addr_800633B8", SN_NOWARN) set_name(0x800633C0, "SetBorder__6Dialogi_addr_800633C0", SN_NOWARN) set_name(0x800633C8, "___6Dialog_addr_800633C8", SN_NOWARN) set_name(0x800633F0, "__6Dialog_addr_800633F0", SN_NOWARN) set_name(0x8006344C, "GetPal__7TextDati_addr_8006344C", SN_NOWARN) set_name(0x80063468, "GetFr__7TextDati_addr_80063468", SN_NOWARN) set_name(0x80063484, "DrawView__Fii", SN_NOWARN) set_name(0x8006364C, "DrawAndBlit__Fv", SN_NOWARN) set_name(0x80063778, "FreeStoreMem__Fv", SN_NOWARN) set_name(0x80063780, "DrawSTextBack__Fv", SN_NOWARN) set_name(0x800637F0, "PrintSString__FiiUcPcci", SN_NOWARN) set_name(0x80063BE4, "DrawSLine__Fi", SN_NOWARN) set_name(0x80063C78, "ClearSText__Fii", SN_NOWARN) set_name(0x80063D10, "AddSLine__Fi", SN_NOWARN) set_name(0x80063D60, "AddSTextVal__Fii", SN_NOWARN) set_name(0x80063D88, "AddSText__FiiUcPccUc", SN_NOWARN) set_name(0x80063E3C, "PrintStoreItem__FPC10ItemStructic", SN_NOWARN) set_name(0x800642C4, "StoreAutoPlace__Fv", SN_NOWARN) set_name(0x800648E4, "S_StartSmith__Fv", SN_NOWARN) set_name(0x80064A6C, "S_ScrollSBuy__Fi", SN_NOWARN) set_name(0x80064C24, "S_StartSBuy__Fv", SN_NOWARN) set_name(0x80064D54, "S_ScrollSPBuy__Fi", SN_NOWARN) set_name(0x80064F74, "S_StartSPBuy__Fv", SN_NOWARN) set_name(0x800650C4, "SmithSellOk__Fi", SN_NOWARN) set_name(0x800651A8, "S_ScrollSSell__Fi", SN_NOWARN) set_name(0x800653D0, "S_StartSSell__Fv", SN_NOWARN) set_name(0x80065800, "SmithRepairOk__Fi", SN_NOWARN) set_name(0x800658A4, "AddStoreHoldRepair__FP10ItemStructi", SN_NOWARN) set_name(0x80065A84, "S_StartSRepair__Fv", SN_NOWARN) set_name(0x80065F54, "S_StartWitch__Fv", SN_NOWARN) set_name(0x80066094, "S_ScrollWBuy__Fi", SN_NOWARN) set_name(0x8006626C, "S_StartWBuy__Fv", SN_NOWARN) set_name(0x80066398, "WitchSellOk__Fi", SN_NOWARN) set_name(0x800664BC, "S_StartWSell__Fv", SN_NOWARN) set_name(0x80066B14, "WitchRechargeOk__Fi", SN_NOWARN) set_name(0x80066B9C, "AddStoreHoldRecharge__FG10ItemStructi", SN_NOWARN) set_name(0x80066D1C, "S_StartWRecharge__Fv", SN_NOWARN) set_name(0x8006713C, "S_StartNoMoney__Fv", SN_NOWARN) set_name(0x800671A4, "S_StartNoRoom__Fv", SN_NOWARN) set_name(0x80067204, "S_StartConfirm__Fv", SN_NOWARN) set_name(0x8006757C, "S_StartBoy__Fv", SN_NOWARN) set_name(0x8006770C, "S_StartBBoy__Fv", SN_NOWARN) set_name(0x80067894, "S_StartHealer__Fv", SN_NOWARN) set_name(0x80067A68, "S_ScrollHBuy__Fi", SN_NOWARN) set_name(0x80067BD4, "S_StartHBuy__Fv", SN_NOWARN) set_name(0x80067CF4, "S_StartStory__Fv", SN_NOWARN) set_name(0x80067DE4, "IdItemOk__FP10ItemStruct", SN_NOWARN) set_name(0x80067E18, "AddStoreHoldId__FG10ItemStructi", SN_NOWARN) set_name(0x80067EEC, "S_StartSIdentify__Fv", SN_NOWARN) set_name(0x8006894C, "S_StartIdShow__Fv", SN_NOWARN) set_name(0x80068B20, "S_StartTalk__Fv", SN_NOWARN) set_name(0x80068D50, "S_StartTavern__Fv", SN_NOWARN) set_name(0x80068E48, "S_StartBarMaid__Fv", SN_NOWARN) set_name(0x80068F1C, "S_StartDrunk__Fv", SN_NOWARN) set_name(0x80068FF0, "StartStore__Fc", SN_NOWARN) set_name(0x800692D8, "DrawSText__Fv", SN_NOWARN) set_name(0x80069318, "DrawSTextTSK__FP4TASK", SN_NOWARN) set_name(0x800693E0, "DoThatDrawSText__Fv", SN_NOWARN) set_name(0x8006958C, "STextESC__Fv", SN_NOWARN) set_name(0x80069700, "STextUp__Fv", SN_NOWARN) set_name(0x80069898, "STextDown__Fv", SN_NOWARN) set_name(0x80069A48, "S_SmithEnter__Fv", SN_NOWARN) set_name(0x80069B1C, "SetGoldCurs__Fii", SN_NOWARN) set_name(0x80069B98, "SetSpdbarGoldCurs__Fii", SN_NOWARN) set_name(0x80069C14, "TakePlrsMoney__Fl", SN_NOWARN) set_name(0x8006A060, "SmithBuyItem__Fv", SN_NOWARN) set_name(0x8006A254, "S_SBuyEnter__Fv", SN_NOWARN) set_name(0x8006A478, "SmithBuyPItem__Fv", SN_NOWARN) set_name(0x8006A600, "S_SPBuyEnter__Fv", SN_NOWARN) set_name(0x8006A830, "StoreGoldFit__Fi", SN_NOWARN) set_name(0x8006AAE8, "PlaceStoreGold__Fl", SN_NOWARN) set_name(0x8006AD4C, "StoreSellItem__Fv", SN_NOWARN) set_name(0x8006B040, "S_SSellEnter__Fv", SN_NOWARN) set_name(0x8006B144, "SmithRepairItem__Fv", SN_NOWARN) set_name(0x8006B3B4, "S_SRepairEnter__Fv", SN_NOWARN) set_name(0x8006B510, "S_WitchEnter__Fv", SN_NOWARN) set_name(0x8006B5C0, "WitchBuyItem__Fv", SN_NOWARN) set_name(0x8006B7C0, "S_WBuyEnter__Fv", SN_NOWARN) set_name(0x8006B9AC, "S_WSellEnter__Fv", SN_NOWARN) set_name(0x8006BAB0, "WitchRechargeItem__Fv", SN_NOWARN) set_name(0x8006BC28, "S_WRechargeEnter__Fv", SN_NOWARN) set_name(0x8006BD84, "S_BoyEnter__Fv", SN_NOWARN) set_name(0x8006BEBC, "BoyBuyItem__Fv", SN_NOWARN) set_name(0x8006BF40, "HealerBuyItem__Fv", SN_NOWARN) set_name(0x8006C1E4, "S_BBuyEnter__Fv", SN_NOWARN) set_name(0x8006C3CC, "StoryIdItem__Fv", SN_NOWARN) set_name(0x8006C718, "S_ConfirmEnter__Fv", SN_NOWARN) set_name(0x8006C834, "S_HealerEnter__Fv", SN_NOWARN) set_name(0x8006C8CC, "S_HBuyEnter__Fv", SN_NOWARN) set_name(0x8006CAD8, "S_StoryEnter__Fv", SN_NOWARN) set_name(0x8006CB70, "S_SIDEnter__Fv", SN_NOWARN) set_name(0x8006CCEC, "S_TalkEnter__Fv", SN_NOWARN) set_name(0x8006CEE4, "S_TavernEnter__Fv", SN_NOWARN) set_name(0x8006CF54, "S_BarmaidEnter__Fv", SN_NOWARN) set_name(0x8006CFC4, "S_DrunkEnter__Fv", SN_NOWARN) set_name(0x8006D034, "STextEnter__Fv", SN_NOWARN) set_name(0x8006D1F8, "CheckStoreBtn__Fv", SN_NOWARN) set_name(0x8006D2D0, "ReleaseStoreBtn__Fv", SN_NOWARN) set_name(0x8006D2E4, "_GLOBAL__D_pSTextBoxCels", SN_NOWARN) set_name(0x8006D30C, "_GLOBAL__I_pSTextBoxCels", SN_NOWARN) set_name(0x8006D334, "GetDown__C4CPad_addr_8006D334", SN_NOWARN) set_name(0x8006D35C, "SetRGB__6DialogUcUcUc_addr_8006D35C", SN_NOWARN) set_name(0x8006D37C, "SetBorder__6Dialogi_addr_8006D37C", SN_NOWARN) set_name(0x8006D384, "___6Dialog_addr_8006D384", SN_NOWARN) set_name(0x8006D3AC, "__6Dialog_addr_8006D3AC", SN_NOWARN) set_name(0x8006D408, "T_DrawView__Fii", SN_NOWARN) set_name(0x8006D5B8, "T_FillSector__FPUcT0iiiib", SN_NOWARN) set_name(0x8006D7B0, "T_FillTile__FPUciii", SN_NOWARN) set_name(0x8006D8A0, "T_Pass3__Fv", SN_NOWARN) set_name(0x8006DC60, "CreateTown__Fi", SN_NOWARN) set_name(0x8006DDC8, "GRL_LoadFileInMemSig__FPCcPUl", SN_NOWARN) set_name(0x8006DEAC, "GRL_StripDir__FPcPCc", SN_NOWARN) set_name(0x8006DF44, "InitVPTriggers__Fv", SN_NOWARN) set_name(0x8006DF8C, "ForceTownTrig__Fv", SN_NOWARN) set_name(0x8006E2A4, "ForceL1Trig__Fv", SN_NOWARN) set_name(0x8006E554, "ForceL2Trig__Fv", SN_NOWARN) set_name(0x8006E9B4, "ForceL3Trig__Fv", SN_NOWARN) set_name(0x8006EE30, "ForceL4Trig__Fv", SN_NOWARN) set_name(0x8006F33C, "Freeupstairs__Fv", SN_NOWARN) set_name(0x8006F3FC, "ForceSKingTrig__Fv", SN_NOWARN) set_name(0x8006F4F0, "ForceSChambTrig__Fv", SN_NOWARN) set_name(0x8006F5E4, "ForcePWaterTrig__Fv", SN_NOWARN) set_name(0x8006F6D8, "CheckTrigForce__Fv", SN_NOWARN) set_name(0x8006F9E0, "FadeGameOut__Fv", SN_NOWARN) set_name(0x8006FA7C, "IsTrigger__Fii", SN_NOWARN) set_name(0x8006FAE0, "CheckTriggers__Fi", SN_NOWARN) set_name(0x8006FFFC, "GetManaAmount__Fii", SN_NOWARN) set_name(0x800702C4, "UseMana__Fii", SN_NOWARN) set_name(0x80070408, "CheckSpell__FiicUc", SN_NOWARN) set_name(0x800704A8, "CastSpell__Fiiiiiiii", SN_NOWARN) set_name(0x80070754, "DoResurrect__Fii", SN_NOWARN) set_name(0x80070A08, "DoHealOther__Fii", SN_NOWARN) set_name(0x80070C6C, "snd_update__FUc", SN_NOWARN) set_name(0x80070C74, "snd_get_volume__FPCcPl", SN_NOWARN) set_name(0x80070CDC, "snd_stop_snd__FP4TSnd", SN_NOWARN) set_name(0x80070CFC, "snd_play_snd__FP4TSFXll", SN_NOWARN) set_name(0x80070D5C, "snd_play_msnd__FUsll", SN_NOWARN) set_name(0x80070DEC, "snd_init__FUl", SN_NOWARN) set_name(0x80070E3C, "music_stop__Fv", SN_NOWARN) set_name(0x80070E80, "music_fade__Fv", SN_NOWARN) set_name(0x80070EC0, "music_start__Fi", SN_NOWARN) set_name(0x80070F44, "music_hold__Fv", SN_NOWARN) set_name(0x80070FA4, "music_release__Fv", SN_NOWARN) set_name(0x80070FF4, "snd_playing__Fi", SN_NOWARN) set_name(0x80071014, "ClrCursor__Fi", SN_NOWARN) set_name(0x80071064, "flyabout__7GamePad", SN_NOWARN) set_name(0x80071520, "CloseInvChr__Fv", SN_NOWARN) set_name(0x80071570, "LeftOf__Fi", SN_NOWARN) set_name(0x80071588, "RightOf__Fi", SN_NOWARN) set_name(0x800715A4, "WorldToOffset__Fiii", SN_NOWARN) set_name(0x80071650, "pad_UpIsUpRight__Fic", SN_NOWARN) set_name(0x80071714, "__7GamePadi", SN_NOWARN) set_name(0x80071808, "SetMoveStyle__7GamePadc", SN_NOWARN) set_name(0x80071810, "SetDownButton__7GamePadiPFi_v", SN_NOWARN) set_name(0x80071854, "SetComboDownButton__7GamePadiPFi_v", SN_NOWARN) set_name(0x80071898, "SetAllButtons__7GamePadP11KEY_ASSIGNS", SN_NOWARN) set_name(0x80071AF8, "GetAllButtons__7GamePadP11KEY_ASSIGNS", SN_NOWARN) set_name(0x80071CA8, "GetActionButton__7GamePadPFi_v", SN_NOWARN) set_name(0x80071D04, "SetUpAction__7GamePadPFi_vT1", SN_NOWARN) set_name(0x80071D40, "RunFunc__7GamePadi", SN_NOWARN) set_name(0x80071E04, "ButtonDown__7GamePadi", SN_NOWARN) set_name(0x80072210, "TestButtons__7GamePad", SN_NOWARN) set_name(0x80072354, "CheckCentre__FP12PlayerStructi", SN_NOWARN) set_name(0x80072448, "CheckDirs__7GamePadi", SN_NOWARN) set_name(0x80072560, "CheckSide__7GamePadi", SN_NOWARN) set_name(0x800725B4, "CheckBodge__7GamePadi", SN_NOWARN) set_name(0x800729C0, "walk__7GamePadc", SN_NOWARN) set_name(0x80072CD8, "check_around_player__7GamePad", SN_NOWARN) set_name(0x800730B8, "show_combos__7GamePad", SN_NOWARN) set_name(0x80073258, "Handle__7GamePad", SN_NOWARN) set_name(0x80073930, "GamePadTask__FP4TASK", SN_NOWARN) set_name(0x800739FC, "PostGamePad__Fiiii", SN_NOWARN) set_name(0x80073B0C, "Init_GamePad__Fv", SN_NOWARN) set_name(0x80073B3C, "InitGamePadVars__Fv", SN_NOWARN) set_name(0x80073BCC, "SetWalkStyle__Fii", SN_NOWARN) set_name(0x80073C3C, "GetPadStyle__Fi", SN_NOWARN) set_name(0x80073C60, "_GLOBAL__I_flyflag", SN_NOWARN) set_name(0x80073C98, "MoveToScrollTarget__7CBlocks_addr_80073C98", SN_NOWARN) set_name(0x80073CAC, "GetDown__C4CPad_addr_80073CAC", SN_NOWARN) set_name(0x80073CD4, "GetUp__C4CPad_addr_80073CD4", SN_NOWARN) set_name(0x80073CFC, "GetCur__C4CPad_addr_80073CFC", SN_NOWARN) set_name(0x80073D24, "DoGameTestStuff__Fv", SN_NOWARN) set_name(0x80073D50, "DoInitGameStuff__Fv", SN_NOWARN) set_name(0x80073D84, "SMemAlloc", SN_NOWARN) set_name(0x80073DA4, "SMemFree", SN_NOWARN) set_name(0x80073DC4, "GRL_InitGwin__Fv", SN_NOWARN) set_name(0x80073DD0, "GRL_SetWindowProc__FPFUlUilUl_Ul", SN_NOWARN) set_name(0x80073DE0, "GRL_CallWindowProc__FUlUilUl", SN_NOWARN) set_name(0x80073E08, "GRL_PostMessage__FUlUilUl", SN_NOWARN) set_name(0x80073EB4, "Msg2Txt__Fi", SN_NOWARN) set_name(0x80073EFC, "LANG_GetLang__Fv", SN_NOWARN) set_name(0x80073F08, "LANG_SetDb__F10LANG_DB_NO", SN_NOWARN) set_name(0x80074074, "GetStr__Fi", SN_NOWARN) set_name(0x800740DC, "LANG_ReloadMainTXT__Fv", SN_NOWARN) set_name(0x80074110, "LANG_SetLang__F9LANG_TYPE", SN_NOWARN) set_name(0x80074274, "DumpCurrentText__Fv", SN_NOWARN) set_name(0x800742CC, "CalcNumOfStrings__FPPc", SN_NOWARN) set_name(0x800742D8, "GetLangFileName__F9LANG_TYPEPc", SN_NOWARN) set_name(0x800743A0, "GetLangFileNameExt__F9LANG_TYPE", SN_NOWARN) set_name(0x80074420, "TempPrintMissile__FiiiiiiiiccUcUcUcc", SN_NOWARN) set_name(0x80074858, "FuncTOWN__FP13MissileStructiii", SN_NOWARN) set_name(0x800749D8, "FuncRPORTAL__FP13MissileStructiii", SN_NOWARN) set_name(0x80074B38, "FuncFIREBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80074BD0, "FuncHBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80074C80, "FuncLIGHTNING__FP13MissileStructiii", SN_NOWARN) set_name(0x80074CE4, "FuncGUARDIAN__FP13MissileStructiii", SN_NOWARN) set_name(0x80074DFC, "FuncFIREWALL__FP13MissileStructiii", SN_NOWARN) set_name(0x80074E94, "FuncFIREMOVE__FP13MissileStructiii", SN_NOWARN) set_name(0x80074F2C, "FuncFLAME__FP13MissileStructiii", SN_NOWARN) set_name(0x80074F94, "FuncARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x80075034, "FuncFARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x80075114, "FuncLARROW__FP13MissileStructiii", SN_NOWARN) set_name(0x800751EC, "FuncMAGMABALL__FP13MissileStructiii", SN_NOWARN) set_name(0x8007527C, "FuncBONESPIRIT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075398, "FuncACID__FP13MissileStructiii", SN_NOWARN) set_name(0x80075434, "FuncACIDSPLAT__FP13MissileStructiii", SN_NOWARN) set_name(0x8007549C, "FuncACIDPUD__FP13MissileStructiii", SN_NOWARN) set_name(0x80075504, "FuncFLARE__FP13MissileStructiii", SN_NOWARN) set_name(0x80075668, "FuncFLAREXP__FP13MissileStructiii", SN_NOWARN) set_name(0x800757AC, "FuncCBOLT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075814, "FuncBOOM__FP13MissileStructiii", SN_NOWARN) set_name(0x8007586C, "FuncELEMENT__FP13MissileStructiii", SN_NOWARN) set_name(0x80075938, "FuncMISEXP__FP13MissileStructiii", SN_NOWARN) set_name(0x8007599C, "FuncRHINO__FP13MissileStructiii", SN_NOWARN) set_name(0x800759A4, "FuncFLASH__FP13MissileStructiii", SN_NOWARN) set_name(0x80075ECC, "FuncMANASHIELD__FP13MissileStructiii", SN_NOWARN) set_name(0x80075F74, "FuncFLASH2__FP13MissileStructiii", SN_NOWARN) set_name(0x80075F7C, "FuncRESURRECTBEAM__FP13MissileStructiii", SN_NOWARN) set_name(0x80075FB0, "FuncWEAPEXP__FP13MissileStructiii", SN_NOWARN) set_name(0x80075FD4, "PRIM_GetPrim__FPP8POLY_FT4_addr_80075FD4", SN_NOWARN) set_name(0x80076050, "GetPlayer__7CPlayeri_addr_80076050", SN_NOWARN) set_name(0x800760A0, "GetLastOtPos__C7CPlayer_addr_800760A0", SN_NOWARN) set_name(0x800760AC, "GetLastScrY__C7CPlayer_addr_800760AC", SN_NOWARN) set_name(0x800760B8, "GetLastScrX__C7CPlayer_addr_800760B8", SN_NOWARN) set_name(0x800760C4, "GetNumOfFrames__7TextDat_addr_800760C4", SN_NOWARN) set_name(0x800760D8, "GetFr__7TextDati_addr_800760D8", SN_NOWARN) set_name(0x800760F4, "ML_Init__Fv", SN_NOWARN) set_name(0x8007612C, "ML_GetList__Fi", SN_NOWARN) set_name(0x800761AC, "ML_SetRandomList__Fi", SN_NOWARN) set_name(0x80076244, "ML_SetList__Fii", SN_NOWARN) set_name(0x800762F4, "ML_GetPresetMonsters__FiPiUl", SN_NOWARN) set_name(0x800764B0, "DefaultObjPrint__FP12ObjectStructiiP7TextDatiii", SN_NOWARN) set_name(0x80076644, "LightObjPrint__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800766FC, "DoorObjPrint__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076990, "DrawLightSpark__Fiii", SN_NOWARN) set_name(0x80076A68, "PrintOBJ_L1LIGHT__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076AF0, "PrintOBJ_SKFIRE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B1C, "PrintOBJ_LEVER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B48, "PrintOBJ_CHEST1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076B74, "PrintOBJ_CHEST2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BA0, "PrintOBJ_CHEST3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BCC, "PrintOBJ_CANDLE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076BF0, "PrintOBJ_CANDLE2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C14, "PrintOBJ_CANDLEO__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C40, "PrintOBJ_BANNERL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C6C, "PrintOBJ_BANNERM__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076C98, "PrintOBJ_BANNERR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076CC4, "PrintOBJ_SKPILE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076CF0, "PrintOBJ_SKSTICK1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D1C, "PrintOBJ_SKSTICK2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D48, "PrintOBJ_SKSTICK3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076D74, "PrintOBJ_SKSTICK4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DA0, "PrintOBJ_SKSTICK5__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DCC, "PrintOBJ_CRUX1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076DF8, "PrintOBJ_CRUX2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E24, "PrintOBJ_CRUX3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E50, "PrintOBJ_STAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076E7C, "PrintOBJ_ANGEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076EA8, "PrintOBJ_BOOK2L__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076ED4, "PrintOBJ_BCROSS__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F00, "PrintOBJ_NUDEW2R__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F2C, "PrintOBJ_SWITCHSKL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F58, "PrintOBJ_TNUDEM1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076F84, "PrintOBJ_TNUDEM2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076FB0, "PrintOBJ_TNUDEM3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80076FDC, "PrintOBJ_TNUDEM4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077008, "PrintOBJ_TNUDEW1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077034, "PrintOBJ_TNUDEW2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077060, "PrintOBJ_TNUDEW3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007708C, "PrintOBJ_TORTURE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800770B8, "PrintOBJ_TORTURE2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800770E4, "PrintOBJ_TORTURE3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077110, "PrintOBJ_TORTURE4__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007713C, "PrintOBJ_TORTURE5__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077168, "PrintOBJ_BOOK2R__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077194, "PrintTorchStick__Fiiii", SN_NOWARN) set_name(0x80077228, "PrintOBJ_TORCHL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800772B8, "PrintOBJ_TORCHR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077348, "PrintOBJ_TORCHL2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800773D8, "PrintOBJ_TORCHR2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077468, "PrintOBJ_SARC__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077494, "PrintOBJ_FLAMEHOLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800774C0, "PrintOBJ_FLAMELVR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800774EC, "PrintOBJ_WATER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077518, "PrintOBJ_BOOKLVR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077544, "PrintOBJ_TRAPL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077570, "PrintOBJ_TRAPR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007759C, "PrintOBJ_BOOKSHELF__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800775C8, "PrintOBJ_WEAPRACK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800775F4, "PrintOBJ_BARREL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077620, "PrintOBJ_BARRELEX__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077778, "PrintOBJ_SHRINEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077844, "PrintOBJ_SHRINER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077910, "PrintOBJ_SKELBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007793C, "PrintOBJ_BOOKCASEL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077968, "PrintOBJ_BOOKCASER__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077994, "PrintOBJ_BOOKSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800779C0, "PrintOBJ_BOOKCANDLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800779E4, "PrintOBJ_BLOODFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A10, "PrintOBJ_DECAP__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A3C, "PrintOBJ_TCHEST1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A68, "PrintOBJ_TCHEST2__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077A94, "PrintOBJ_TCHEST3__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077AC0, "PrintOBJ_BLINDBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077AEC, "PrintOBJ_BLOODBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B18, "PrintOBJ_PEDISTAL__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B44, "PrintOBJ_PURIFYINGFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B70, "PrintOBJ_ARMORSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077B9C, "PrintOBJ_ARMORSTANDN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077BC8, "PrintOBJ_GOATSHRINE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077BF4, "PrintOBJ_CAULDRON__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C20, "PrintOBJ_MURKYFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C4C, "PrintOBJ_TEARFTN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077C78, "PrintOBJ_ALTBOY__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077CA4, "PrintOBJ_MCIRCLE1__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077E38, "PrintOBJ_STORYBOOK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077FC0, "PrintOBJ_STORYCANDLE__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80077FE4, "PrintOBJ_STEELTOME__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078010, "PrintOBJ_WARARMOR__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007803C, "PrintOBJ_WARWEAP__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078068, "PrintOBJ_TBCROSS__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078094, "PrintOBJ_WEAPONRACK__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800780C0, "PrintOBJ_WEAPONRACKN__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x800780EC, "PrintOBJ_MUSHPATCH__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078118, "PrintOBJ_LAZSTAND__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078144, "PrintOBJ_SLAINHERO__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x80078170, "PrintOBJ_SIGNCHEST__FP12ObjectStructiiP7TextDati", SN_NOWARN) set_name(0x8007819C, "PRIM_GetCopy__FP8POLY_FT4_addr_8007819C", SN_NOWARN) set_name(0x800781D8, "PRIM_CopyPrim__FP8POLY_FT4T0_addr_800781D8", SN_NOWARN) set_name(0x80078200, "PRIM_GetPrim__FPP8POLY_FT4_addr_80078200", SN_NOWARN) set_name(0x8007827C, "GetBlockTexDat__7CBlocks_addr_8007827C", SN_NOWARN) set_name(0x80078288, "GetNumOfFrames__7TextDatii_addr_80078288", SN_NOWARN) set_name(0x800782C0, "GetCreature__7TextDati_addr_800782C0", SN_NOWARN) set_name(0x80078338, "GetNumOfCreatures__7TextDat_addr_80078338", SN_NOWARN) set_name(0x8007834C, "GetFr__7TextDati_addr_8007834C", SN_NOWARN) set_name(0x80078368, "gamemenu_on__Fv", SN_NOWARN) set_name(0x80078370, "gamemenu_off__Fv", SN_NOWARN) set_name(0x80078378, "LoadPalette__FPCc", SN_NOWARN) set_name(0x80078380, "LoadRndLvlPal__Fi", SN_NOWARN) set_name(0x80078388, "ResetPal__Fv", SN_NOWARN) set_name(0x80078390, "SetFadeLevel__Fi", SN_NOWARN) set_name(0x800783C0, "GetFadeState__Fv", SN_NOWARN) set_name(0x800783CC, "SetPolyXY__FP8POLY_GT4PUc", SN_NOWARN) set_name(0x800784E8, "SmearScreen__Fv", SN_NOWARN) set_name(0x800784F0, "DrawFadedScreen__Fv", SN_NOWARN) set_name(0x80078544, "BlackPalette__Fv", SN_NOWARN) set_name(0x80078600, "PaletteFadeInTask__FP4TASK", SN_NOWARN) set_name(0x80078690, "PaletteFadeIn__Fi", SN_NOWARN) set_name(0x800786E8, "PaletteFadeOutTask__FP4TASK", SN_NOWARN) set_name(0x80078798, "PaletteFadeOut__Fi", SN_NOWARN) set_name(0x800787EC, "M_CheckEFlag__Fi", SN_NOWARN) set_name(0x8007880C, "M_ClearSquares__Fi", SN_NOWARN) set_name(0x80078978, "IsSkel__Fi", SN_NOWARN) set_name(0x800789B4, "NewMonsterAnim__FiR10AnimStructii", SN_NOWARN) set_name(0x80078A00, "M_Ranged__Fi", SN_NOWARN) set_name(0x80078A48, "M_Talker__Fi", SN_NOWARN) set_name(0x80078AA8, "M_Enemy__Fi", SN_NOWARN) set_name(0x8007901C, "ClearMVars__Fi", SN_NOWARN) set_name(0x80079090, "InitMonster__Fiiiii", SN_NOWARN) set_name(0x800794DC, "AddMonster__FiiiiUc", SN_NOWARN) set_name(0x8007958C, "M_StartStand__Fii", SN_NOWARN) set_name(0x800796D0, "M_UpdateLeader__Fi", SN_NOWARN) set_name(0x800797C8, "ActivateSpawn__Fiiii", SN_NOWARN) set_name(0x80079870, "SpawnSkeleton__Fiii", SN_NOWARN) set_name(0x80079A60, "M_StartSpStand__Fii", SN_NOWARN) set_name(0x80079B40, "PosOkMonst__Fiii", SN_NOWARN) set_name(0x80079DBC, "CanPut__Fii", SN_NOWARN) set_name(0x8007A0C4, "GetAutomapType__FiiUc", SN_NOWARN) set_name(0x8007A3C0, "SetAutomapView__Fii", SN_NOWARN) set_name(0x8007A810, "lAddMissile__Fiiici", SN_NOWARN) set_name(0x8007A9E4, "AddWarpMissile__Fiii", SN_NOWARN) set_name(0x8007AB2C, "SyncPortals__Fv", SN_NOWARN) set_name(0x8007AC34, "AddInTownPortal__Fi", SN_NOWARN) set_name(0x8007AC6C, "ActivatePortal__FiiiiiUc", SN_NOWARN) set_name(0x8007ACDC, "DeactivatePortal__Fi", SN_NOWARN) set_name(0x8007ACFC, "PortalOnLevel__Fi", SN_NOWARN) set_name(0x8007AD34, "DelMis__Fii", SN_NOWARN) set_name(0x8007AD94, "RemovePortalMissile__Fi", SN_NOWARN) set_name(0x8007AF10, "SetCurrentPortal__Fi", SN_NOWARN) set_name(0x8007AF1C, "GetPortalLevel__Fv", SN_NOWARN) set_name(0x8007B0C0, "GetPortalLvlPos__Fv", SN_NOWARN) set_name(0x8007B170, "__13CompLevelMaps", SN_NOWARN) set_name(0x8007B1D8, "___13CompLevelMaps", SN_NOWARN) set_name(0x8007B258, "Init__13CompLevelMaps", SN_NOWARN) set_name(0x8007B288, "InitAllMaps__13CompLevelMaps", SN_NOWARN) set_name(0x8007B2D0, "GetMap__13CompLevelMapsi", SN_NOWARN) set_name(0x8007B344, "ReleaseMap__13CompLevelMapsP6DLevel", SN_NOWARN) set_name(0x8007B3E8, "Init__4AMap", SN_NOWARN) set_name(0x8007B450, "GetMap__4AMap", SN_NOWARN) set_name(0x8007B570, "ReleaseMap__4AMapP6DLevel", SN_NOWARN) set_name(0x8007B600, "CheckMapNum__13CompLevelMapsi", SN_NOWARN) set_name(0x8007B634, "___4AMap", SN_NOWARN) set_name(0x8007B67C, "__4AMap", SN_NOWARN) set_name(0x8007B6B0, "GO_DoGameOver__Fv", SN_NOWARN) set_name(0x8007B6F4, "GameOverTask__FP4TASK", SN_NOWARN) set_name(0x8007B7B0, "PrintGameOver__Fv", SN_NOWARN) set_name(0x8007B890, "SetRGB__6DialogUcUcUc_addr_8007B890", SN_NOWARN) set_name(0x8007B8B0, "SetBack__6Dialogi_addr_8007B8B0", SN_NOWARN) set_name(0x8007B8B8, "SetBorder__6Dialogi_addr_8007B8B8", SN_NOWARN) set_name(0x8007B8C0, "___6Dialog_addr_8007B8C0", SN_NOWARN) set_name(0x8007B8E8, "__6Dialog_addr_8007B8E8", SN_NOWARN) set_name(0x8007B944, "VER_InitVersion__Fv", SN_NOWARN) set_name(0x8007B988, "VER_GetVerString__Fv", SN_NOWARN) set_name(0x8007B998, "CharPair2Num__FPc", SN_NOWARN) set_name(0x8001E6A8, "TICK_InitModule", SN_NOWARN) set_name(0x8001E6C8, "TICK_Set", SN_NOWARN) set_name(0x8001E6D8, "TICK_Get", SN_NOWARN) set_name(0x8001E6E8, "TICK_Update", SN_NOWARN) set_name(0x8001E708, "TICK_GetAge", SN_NOWARN) set_name(0x8001E734, "TICK_GetDateString", SN_NOWARN) set_name(0x8001E744, "TICK_GetTimeString", SN_NOWARN) set_name(0x8001E754, "GU_InitModule", SN_NOWARN) set_name(0x8001E780, "GU_SetRndSeed", SN_NOWARN) set_name(0x8001E7B0, "GU_GetRnd", SN_NOWARN) set_name(0x8001E840, "GU_GetSRnd", SN_NOWARN) set_name(0x8001E860, "GU_GetRndRange", SN_NOWARN) set_name(0x8001E89C, "GU_AlignVal", SN_NOWARN) set_name(0x8001E8C0, "main", SN_NOWARN) set_name(0x8001E910, "DBG_OpenModule", SN_NOWARN) set_name(0x8001E918, "DBG_PollHost", SN_NOWARN) set_name(0x8001E920, "DBG_Halt", SN_NOWARN) set_name(0x8001E928, "DBG_SendMessage", SN_NOWARN) set_name(0x8001E940, "DBG_SetMessageHandler", SN_NOWARN) set_name(0x8001E950, "DBG_Error", SN_NOWARN) set_name(0x8001E97C, "DBG_SetErrorFunc", SN_NOWARN) set_name(0x8001E98C, "SendPsyqString", SN_NOWARN) set_name(0x8001E994, "DBG_SetPollRoutine", SN_NOWARN) set_name(0x8001E9A4, "GTIMSYS_GetTimer", SN_NOWARN) set_name(0x8001E9C8, "GTIMSYS_ResetTimer", SN_NOWARN) set_name(0x8001E9EC, "GTIMSYS_InitTimer", SN_NOWARN) set_name(0x8001EC20, "DoEpi", SN_NOWARN) set_name(0x8001EC70, "DoPro", SN_NOWARN) set_name(0x8001ECC0, "TSK_OpenModule", SN_NOWARN) set_name(0x8001ED34, "TSK_AddTask", SN_NOWARN) set_name(0x8001EF1C, "TSK_DoTasks", SN_NOWARN) set_name(0x8001F0DC, "TSK_Sleep", SN_NOWARN) set_name(0x8001F1B8, "ReturnToSchedulerIfCurrentTask", SN_NOWARN) set_name(0x8001F240, "TSK_Die", SN_NOWARN) set_name(0x8001F26C, "TSK_Kill", SN_NOWARN) set_name(0x8001F2BC, "TSK_GetFirstActive", SN_NOWARN) set_name(0x8001F2CC, "TSK_IsStackCorrupted", SN_NOWARN) set_name(0x8001F348, "TSK_JumpAndResetStack", SN_NOWARN) set_name(0x8001F390, "TSK_RepointProc", SN_NOWARN) set_name(0x8001F3D4, "TSK_GetCurrentTask", SN_NOWARN) set_name(0x8001F3E4, "TSK_IsCurrentTask", SN_NOWARN) set_name(0x8001F3FC, "TSK_Exist", SN_NOWARN) set_name(0x8001F454, "TSK_SetExecFilter", SN_NOWARN) set_name(0x8001F46C, "TSK_ClearExecFilter", SN_NOWARN) set_name(0x8001F490, "TSK_KillTasks", SN_NOWARN) set_name(0x8001F590, "TSK_IterateTasks", SN_NOWARN) set_name(0x8001F608, "TSK_MakeTaskInactive", SN_NOWARN) set_name(0x8001F61C, "TSK_MakeTaskActive", SN_NOWARN) set_name(0x8001F630, "TSK_MakeTaskImmortal", SN_NOWARN) set_name(0x8001F644, "TSK_MakeTaskMortal", SN_NOWARN) set_name(0x8001F658, "TSK_IsTaskActive", SN_NOWARN) set_name(0x8001F66C, "TSK_IsTaskMortal", SN_NOWARN) set_name(0x8001F680, "DetachFromList", SN_NOWARN) set_name(0x8001F6CC, "AddToList", SN_NOWARN) set_name(0x8001F6EC, "LoTskKill", SN_NOWARN) set_name(0x8001F75C, "ExecuteTask", SN_NOWARN) set_name(0x8001F7AC, "TSK_SetDoTasksPrologue", SN_NOWARN) set_name(0x8001F7C4, "TSK_SetDoTasksEpilogue", SN_NOWARN) set_name(0x8001F7DC, "TSK_SetTaskPrologue", SN_NOWARN) set_name(0x8001F7F4, "TSK_SetTaskEpilogue", SN_NOWARN) set_name(0x8001F80C, "TSK_SetEpiProFilter", SN_NOWARN) set_name(0x8001F824, "TSK_ClearEpiProFilter", SN_NOWARN) set_name(0x8001F858, "TSK_SetExtraStackProtection", SN_NOWARN) set_name(0x8001F868, "TSK_SetStackFloodCallback", SN_NOWARN) set_name(0x8001F880, "TSK_SetExtraStackSize", SN_NOWARN) set_name(0x8001F8A8, "ExtraMarkStack", SN_NOWARN) set_name(0x8001F8D4, "CheckExtraStack", SN_NOWARN) set_name(0x8001F910, "GSYS_GetWorkMemInfo", SN_NOWARN) set_name(0x8001F920, "GSYS_SetStackAndJump", SN_NOWARN) set_name(0x8001F95C, "GSYS_MarkStack", SN_NOWARN) set_name(0x8001F96C, "GSYS_IsStackCorrupted", SN_NOWARN) set_name(0x8001F984, "GSYS_InitMachine", SN_NOWARN) set_name(0x8001F9D8, "GSYS_CheckPtr", SN_NOWARN) set_name(0x8001FA0C, "GSYS_IsStackOutOfBounds", SN_NOWARN) set_name(0x8001FA88, "GAL_SetErrorChecking", SN_NOWARN) set_name(0x8001FA98, "GAL_SplitBlock", SN_NOWARN) set_name(0x8001FBCC, "GAL_InitModule", SN_NOWARN) set_name(0x8001FC84, "GAL_AddMemType", SN_NOWARN) set_name(0x8001FDA4, "GAL_Alloc", SN_NOWARN) set_name(0x8001FF3C, "GAL_Lock", SN_NOWARN) set_name(0x8001FF9C, "GAL_Unlock", SN_NOWARN) set_name(0x80020018, "GAL_Free", SN_NOWARN) set_name(0x800200B8, "GAL_GetFreeMem", SN_NOWARN) set_name(0x8002012C, "GAL_GetUsedMem", SN_NOWARN) set_name(0x800201A0, "GAL_LargestFreeBlock", SN_NOWARN) set_name(0x8002021C, "AttachHdrToList", SN_NOWARN) set_name(0x8002023C, "DetachHdrFromList", SN_NOWARN) set_name(0x80020288, "IsActiveValidHandle", SN_NOWARN) set_name(0x800202B8, "AlignPtr", SN_NOWARN) set_name(0x800202E8, "AlignSize", SN_NOWARN) set_name(0x80020318, "FindClosestSizedBlock", SN_NOWARN) set_name(0x80020370, "FindHighestMemBlock", SN_NOWARN) set_name(0x800203D8, "FindLowestMemBlock", SN_NOWARN) set_name(0x80020440, "GetMemInitInfoBlockFromType", SN_NOWARN) set_name(0x8002047C, "MergeToEmptyList", SN_NOWARN) set_name(0x80020550, "GAL_AllocAt", SN_NOWARN) set_name(0x8002062C, "LoAlloc", SN_NOWARN) set_name(0x800207C4, "FindBlockInTheseBounds", SN_NOWARN) set_name(0x80020830, "GetFreeMemHdrBlock", SN_NOWARN) set_name(0x800208B8, "ReleaseMemHdrBlock", SN_NOWARN) set_name(0x800208F8, "GAL_IterateEmptyMem", SN_NOWARN) set_name(0x8002097C, "GAL_IterateUsedMem", SN_NOWARN) set_name(0x80020A18, "GAL_SetMemName", SN_NOWARN) set_name(0x80020A80, "GAL_TotalMem", SN_NOWARN) set_name(0x80020AD4, "GAL_MemBase", SN_NOWARN) set_name(0x80020B28, "GAL_DefragMem", SN_NOWARN) set_name(0x80020BAC, "GSetError", SN_NOWARN) set_name(0x80020C08, "GAL_CheckMem", SN_NOWARN) set_name(0x80020D04, "CheckCollisions", SN_NOWARN) set_name(0x80020DB0, "AreBlocksColliding", SN_NOWARN) set_name(0x80020E08, "GAL_GetErrorText", SN_NOWARN) set_name(0x80020E38, "GAL_GetLastErrorCode", SN_NOWARN) set_name(0x80020E48, "GAL_GetLastErrorText", SN_NOWARN) set_name(0x80020E70, "GAL_HowManyEmptyRegions", SN_NOWARN) set_name(0x80020ED8, "GAL_HowManyUsedRegions", SN_NOWARN) set_name(0x80020F40, "GAL_SetTimeStamp", SN_NOWARN) set_name(0x80020F50, "GAL_IncTimeStamp", SN_NOWARN) set_name(0x80020F70, "GAL_GetTimeStamp", SN_NOWARN) set_name(0x80020F80, "GAL_AlignSizeToType", SN_NOWARN) set_name(0x80020FD0, "GAL_AllocMultiStruct", SN_NOWARN) set_name(0x80021020, "GAL_ProcessMultiStruct", SN_NOWARN) set_name(0x800210CC, "GAL_GetSize", SN_NOWARN) set_name(0x80021120, "GazDefragMem", SN_NOWARN) set_name(0x80021288, "PutBlocksInRegionIntoList", SN_NOWARN) set_name(0x8002132C, "CollideRegions", SN_NOWARN) set_name(0x80021360, "DeleteEmptyBlocks", SN_NOWARN) set_name(0x800213CC, "GetRegion", SN_NOWARN) set_name(0x800214C4, "FindNextBlock", SN_NOWARN) set_name(0x80021500, "ShuffleBlocks", SN_NOWARN) set_name(0x80021590, "PutAllLockedBlocksOntoList", SN_NOWARN) set_name(0x8002160C, "SortMemHdrListByAddr", SN_NOWARN) set_name(0x800216C0, "GraftMemHdrList", SN_NOWARN) set_name(0x8002171C, "GAL_MemDump", SN_NOWARN) set_name(0x80021790, "GAL_SetVerbosity", SN_NOWARN) set_name(0x800217A0, "CountFreeBlocks", SN_NOWARN) set_name(0x800217CC, "SetBlockName", SN_NOWARN) set_name(0x80021814, "GAL_GetNumFreeHeaders", SN_NOWARN) set_name(0x80021824, "GAL_GetLastTypeAlloced", SN_NOWARN) set_name(0x80021834, "GAL_SetAllocFilter", SN_NOWARN) set_name(0x8002184C, "GAL_SortUsedRegionsBySize", SN_NOWARN) set_name(0x800218A0, "SortSize", SN_NOWARN) set_name(0x800218B0, "SortMemHdrList", SN_NOWARN) set_name(0x80023C6C, "vsprintf", SN_NOWARN) set_name(0x80023CB8, "_doprnt", SN_NOWARN) set_name(0x8012CDC8, "NumOfMonsterListLevels", SN_NOWARN) set_name(0x800A9BE0, "AllLevels", SN_NOWARN) set_name(0x8012CAAC, "NumsLEV1M1A", SN_NOWARN) set_name(0x8012CAB0, "NumsLEV1M1B", SN_NOWARN) set_name(0x8012CAB4, "NumsLEV1M1C", SN_NOWARN) set_name(0x8012CABC, "NumsLEV2M2A", SN_NOWARN) set_name(0x8012CAC0, "NumsLEV2M2B", SN_NOWARN) set_name(0x8012CAC4, "NumsLEV2M2C", SN_NOWARN) set_name(0x8012CAC8, "NumsLEV2M2D", SN_NOWARN) set_name(0x8012CACC, "NumsLEV2M2QA", SN_NOWARN) set_name(0x8012CAD0, "NumsLEV2M2QB", SN_NOWARN) set_name(0x8012CAD4, "NumsLEV3M3A", SN_NOWARN) set_name(0x8012CAD8, "NumsLEV3M3QA", SN_NOWARN) set_name(0x8012CADC, "NumsLEV3M3B", SN_NOWARN) set_name(0x8012CAE0, "NumsLEV3M3C", SN_NOWARN) set_name(0x8012CAE4, "NumsLEV4M4A", SN_NOWARN) set_name(0x8012CAE8, "NumsLEV4M4QA", SN_NOWARN) set_name(0x8012CAEC, "NumsLEV4M4B", SN_NOWARN) set_name(0x8012CAF0, "NumsLEV4M4QB", SN_NOWARN) set_name(0x8012CAF8, "NumsLEV4M4C", SN_NOWARN) set_name(0x8012CAFC, "NumsLEV4M4QC", SN_NOWARN) set_name(0x8012CB04, "NumsLEV4M4D", SN_NOWARN) set_name(0x8012CB08, "NumsLEV5M5A", SN_NOWARN) set_name(0x8012CB0C, "NumsLEV5M5B", SN_NOWARN) set_name(0x8012CB10, "NumsLEV5M5C", SN_NOWARN) set_name(0x8012CB14, "NumsLEV5M5D", SN_NOWARN) set_name(0x8012CB18, "NumsLEV5M5E", SN_NOWARN) set_name(0x8012CB1C, "NumsLEV5M5F", SN_NOWARN) set_name(0x8012CB20, "NumsLEV5M5QA", SN_NOWARN) set_name(0x8012CB24, "NumsLEV6M6A", SN_NOWARN) set_name(0x8012CB2C, "NumsLEV6M6B", SN_NOWARN) set_name(0x8012CB30, "NumsLEV6M6C", SN_NOWARN) set_name(0x8012CB34, "NumsLEV6M6D", SN_NOWARN) set_name(0x8012CB38, "NumsLEV6M6E", SN_NOWARN) set_name(0x8012CB3C, "NumsLEV6M6QA", SN_NOWARN) set_name(0x8012CB40, "NumsLEV7M7A", SN_NOWARN) set_name(0x8012CB44, "NumsLEV7M7B", SN_NOWARN) set_name(0x8012CB48, "NumsLEV7M7C", SN_NOWARN) set_name(0x8012CB4C, "NumsLEV7M7D", SN_NOWARN) set_name(0x8012CB50, "NumsLEV7M7E", SN_NOWARN) set_name(0x8012CB54, "NumsLEV8M8QA", SN_NOWARN) set_name(0x8012CB58, "NumsLEV8M8A", SN_NOWARN) set_name(0x8012CB5C, "NumsLEV8M8B", SN_NOWARN) set_name(0x8012CB60, "NumsLEV8M8C", SN_NOWARN) set_name(0x8012CB64, "NumsLEV8M8D", SN_NOWARN) set_name(0x8012CB68, "NumsLEV8M8E", SN_NOWARN) set_name(0x8012CB6C, "NumsLEV9M9A", SN_NOWARN) set_name(0x8012CB70, "NumsLEV9M9B", SN_NOWARN) set_name(0x8012CB74, "NumsLEV9M9C", SN_NOWARN) set_name(0x8012CB78, "NumsLEV9M9D", SN_NOWARN) set_name(0x8012CB7C, "NumsLEV10M10A", SN_NOWARN) set_name(0x8012CB80, "NumsLEV10M10B", SN_NOWARN) set_name(0x8012CB84, "NumsLEV10M10C", SN_NOWARN) set_name(0x8012CB88, "NumsLEV10M10D", SN_NOWARN) set_name(0x8012CB8C, "NumsLEV10M10QA", SN_NOWARN) set_name(0x8012CB90, "NumsLEV11M11A", SN_NOWARN) set_name(0x8012CB94, "NumsLEV11M11B", SN_NOWARN) set_name(0x8012CB98, "NumsLEV11M11C", SN_NOWARN) set_name(0x8012CB9C, "NumsLEV11M11D", SN_NOWARN) set_name(0x8012CBA0, "NumsLEV11M11E", SN_NOWARN) set_name(0x8012CBA4, "NumsLEV12M12A", SN_NOWARN) set_name(0x8012CBA8, "NumsLEV12M12B", SN_NOWARN) set_name(0x8012CBAC, "NumsLEV12M12C", SN_NOWARN) set_name(0x8012CBB0, "NumsLEV12M12D", SN_NOWARN) set_name(0x8012CBB4, "NumsLEV13M13A", SN_NOWARN) set_name(0x8012CBB8, "NumsLEV13M13B", SN_NOWARN) set_name(0x8012CBBC, "NumsLEV13M13QB", SN_NOWARN) set_name(0x8012CBC0, "NumsLEV13M13C", SN_NOWARN) set_name(0x8012CBC4, "NumsLEV13M13D", SN_NOWARN) set_name(0x8012CBC8, "NumsLEV14M14A", SN_NOWARN) set_name(0x8012CBCC, "NumsLEV14M14B", SN_NOWARN) set_name(0x8012CBD0, "NumsLEV14M14QB", SN_NOWARN) set_name(0x8012CBD4, "NumsLEV14M14C", SN_NOWARN) set_name(0x8012CBD8, "NumsLEV14M14D", SN_NOWARN) set_name(0x8012CBDC, "NumsLEV14M14E", SN_NOWARN) set_name(0x8012CBE0, "NumsLEV15M15A", SN_NOWARN) set_name(0x8012CBE4, "NumsLEV15M15B", SN_NOWARN) set_name(0x8012CBE8, "NumsLEV15M15C", SN_NOWARN) set_name(0x8012CBEC, "NumsLEV15M15QA", SN_NOWARN) set_name(0x8012CBF0, "NumsLEV16M16D", SN_NOWARN) set_name(0x800A9700, "ChoiceListLEV1", SN_NOWARN) set_name(0x800A9730, "ChoiceListLEV2", SN_NOWARN) set_name(0x800A9790, "ChoiceListLEV3", SN_NOWARN) set_name(0x800A97D0, "ChoiceListLEV4", SN_NOWARN) set_name(0x800A9840, "ChoiceListLEV5", SN_NOWARN) set_name(0x800A98B0, "ChoiceListLEV6", SN_NOWARN) set_name(0x800A9910, "ChoiceListLEV7", SN_NOWARN) set_name(0x800A9960, "ChoiceListLEV8", SN_NOWARN) set_name(0x800A99C0, "ChoiceListLEV9", SN_NOWARN) set_name(0x800A9A00, "ChoiceListLEV10", SN_NOWARN) set_name(0x800A9A50, "ChoiceListLEV11", SN_NOWARN) set_name(0x800A9AA0, "ChoiceListLEV12", SN_NOWARN) set_name(0x800A9AE0, "ChoiceListLEV13", SN_NOWARN) set_name(0x800A9B30, "ChoiceListLEV14", SN_NOWARN) set_name(0x800A9B90, "ChoiceListLEV15", SN_NOWARN) set_name(0x800A9BD0, "ChoiceListLEV16", SN_NOWARN) set_name(0x8012E688, "GameTaskPtr", SN_NOWARN) set_name(0x800A9C60, "AllArgs", SN_NOWARN) set_name(0x8012CDD8, "ArgsSoFar", SN_NOWARN) set_name(0x8012CDE8, "ThisOt", SN_NOWARN) set_name(0x8012CDEC, "ThisPrimAddr", SN_NOWARN) set_name(0x8012E68C, "hndPrimBuffers", SN_NOWARN) set_name(0x8012E690, "PrimBuffers", SN_NOWARN) set_name(0x8012E694, "BufferDepth", SN_NOWARN) set_name(0x8012E695, "WorkRamId", SN_NOWARN) set_name(0x8012E696, "ScrNum", SN_NOWARN) set_name(0x8012E698, "Screens", SN_NOWARN) set_name(0x8012E69C, "PbToClear", SN_NOWARN) set_name(0x8012E6A0, "BufferNum", SN_NOWARN) set_name(0x8012CDF0, "AddrToAvoid", SN_NOWARN) set_name(0x8012E6A1, "LastBuffer", SN_NOWARN) set_name(0x8012E6A4, "DispEnvToPut", SN_NOWARN) set_name(0x8012E6A8, "ThisOtSize", SN_NOWARN) set_name(0x8012CDF4, "ScrRect", SN_NOWARN) set_name(0x8012E6AC, "VidWait", SN_NOWARN) set_name(0x8012EB28, "screen", SN_NOWARN) set_name(0x8012E6B0, "VbFunc", SN_NOWARN) set_name(0x8012E6B4, "VidTick", SN_NOWARN) set_name(0x8012E6B8, "VXOff", SN_NOWARN) set_name(0x8012E6BC, "VYOff", SN_NOWARN) set_name(0x8012CE08, "Gaz", SN_NOWARN) set_name(0x8012CE0C, "LastFmem", SN_NOWARN) set_name(0x8012CDFC, "GSYS_MemStart", SN_NOWARN) set_name(0x8012CE00, "GSYS_MemEnd", SN_NOWARN) set_name(0x800A9FA8, "PsxMem", SN_NOWARN) set_name(0x800A9FD0, "PsxFastMem", SN_NOWARN) set_name(0x8012CE04, "LowestFmem", SN_NOWARN) set_name(0x8012CE1C, "FileSYS", SN_NOWARN) set_name(0x8012E6C0, "FileSystem", SN_NOWARN) set_name(0x8012E6C4, "OverlayFileSystem", SN_NOWARN) set_name(0x8012CE36, "DavesPad", SN_NOWARN) set_name(0x8012CE38, "DavesPadDeb", SN_NOWARN) set_name(0x800A9FF8, "_6FileIO_FileToLoad", SN_NOWARN) set_name(0x8012EC08, "MyFT4", SN_NOWARN) set_name(0x800AA89C, "AllDats", SN_NOWARN) set_name(0x8012CE88, "TpW", SN_NOWARN) set_name(0x8012CE8C, "TpH", SN_NOWARN) set_name(0x8012CE90, "TpXDest", SN_NOWARN) set_name(0x8012CE94, "TpYDest", SN_NOWARN) set_name(0x8012CE98, "R", SN_NOWARN) set_name(0x800AAE5C, "MyGT4", SN_NOWARN) set_name(0x800AAE90, "MyGT3", SN_NOWARN) set_name(0x800AA02C, "DatPool", SN_NOWARN) set_name(0x8012CEAC, "ChunkGot", SN_NOWARN) set_name(0x800AAEB8, "STREAM_DIR", SN_NOWARN) set_name(0x800AAEC8, "STREAM_BIN", SN_NOWARN) set_name(0x800AAED8, "EAC_DirectoryCache", SN_NOWARN) set_name(0x8012CEC0, "BL_NoLumpFiles", SN_NOWARN) set_name(0x8012CEC4, "BL_NoStreamFiles", SN_NOWARN) set_name(0x8012CEC8, "LFileTab", SN_NOWARN) set_name(0x8012CECC, "SFileTab", SN_NOWARN) set_name(0x8012CED0, "FileLoaded", SN_NOWARN) set_name(0x8012CEF4, "NoTAllocs", SN_NOWARN) set_name(0x800AB004, "MemBlock", SN_NOWARN) set_name(0x8012E6D0, "CanPause", SN_NOWARN) set_name(0x8012E6D4, "Paused", SN_NOWARN) set_name(0x8012E6D8, "InActivePad", SN_NOWARN) set_name(0x8012EC30, "PBack", SN_NOWARN) set_name(0x800AB26C, "RawPadData0", SN_NOWARN) set_name(0x800AB290, "RawPadData1", SN_NOWARN) set_name(0x800AB2B4, "demo_buffer", SN_NOWARN) set_name(0x8012CF10, "demo_pad_time", SN_NOWARN) set_name(0x8012CF14, "demo_pad_count", SN_NOWARN) set_name(0x800AB194, "Pad0", SN_NOWARN) set_name(0x800AB200, "Pad1", SN_NOWARN) set_name(0x8012CF18, "demo_finish", SN_NOWARN) set_name(0x8012CF1C, "cac_pad", SN_NOWARN) set_name(0x8012CF3C, "CharFt4", SN_NOWARN) set_name(0x8012CF40, "CharFrm", SN_NOWARN) set_name(0x8012CF29, "WHITER", SN_NOWARN) set_name(0x8012CF2A, "WHITEG", SN_NOWARN) set_name(0x8012CF2B, "WHITEB", SN_NOWARN) set_name(0x8012CF2C, "BLUER", SN_NOWARN) set_name(0x8012CF2D, "BLUEG", SN_NOWARN) set_name(0x8012CF2E, "BLUEB", SN_NOWARN) set_name(0x8012CF2F, "REDR", SN_NOWARN) set_name(0x8012CF30, "REDG", SN_NOWARN) set_name(0x8012CF31, "REDB", SN_NOWARN) set_name(0x8012CF32, "GOLDR", SN_NOWARN) set_name(0x8012CF33, "GOLDG", SN_NOWARN) set_name(0x8012CF34, "GOLDB", SN_NOWARN) set_name(0x800AB638, "MediumFont", SN_NOWARN) set_name(0x800AB854, "LargeFont", SN_NOWARN) set_name(0x8012CF38, "buttoncol", SN_NOWARN) set_name(0x800ABA70, "LFontTab", SN_NOWARN) set_name(0x800ABB24, "LFont", SN_NOWARN) set_name(0x800ABB34, "MFontTab", SN_NOWARN) set_name(0x800ABC6C, "MFont", SN_NOWARN) set_name(0x8012CF55, "DialogRed", SN_NOWARN) set_name(0x8012CF56, "DialogGreen", SN_NOWARN) set_name(0x8012CF57, "DialogBlue", SN_NOWARN) set_name(0x8012CF58, "DialogTRed", SN_NOWARN) set_name(0x8012CF59, "DialogTGreen", SN_NOWARN) set_name(0x8012CF5A, "DialogTBlue", SN_NOWARN) set_name(0x8012CF5C, "DialogTData", SN_NOWARN) set_name(0x8012CF60, "DialogBackGfx", SN_NOWARN) set_name(0x8012CF64, "DialogBackW", SN_NOWARN) set_name(0x8012CF68, "DialogBackH", SN_NOWARN) set_name(0x8012CF6C, "DialogBorderGfx", SN_NOWARN) set_name(0x8012CF70, "DialogBorderTLW", SN_NOWARN) set_name(0x8012CF74, "DialogBorderTLH", SN_NOWARN) set_name(0x8012CF78, "DialogBorderTRW", SN_NOWARN) set_name(0x8012CF7C, "DialogBorderTRH", SN_NOWARN) set_name(0x8012CF80, "DialogBorderBLW", SN_NOWARN) set_name(0x8012CF84, "DialogBorderBLH", SN_NOWARN) set_name(0x8012CF88, "DialogBorderBRW", SN_NOWARN) set_name(0x8012CF8C, "DialogBorderBRH", SN_NOWARN) set_name(0x8012CF90, "DialogBorderTW", SN_NOWARN) set_name(0x8012CF94, "DialogBorderTH", SN_NOWARN) set_name(0x8012CF98, "DialogBorderBW", SN_NOWARN) set_name(0x8012CF9C, "DialogBorderBH", SN_NOWARN) set_name(0x8012CFA0, "DialogBorderLW", SN_NOWARN) set_name(0x8012CFA4, "DialogBorderLH", SN_NOWARN) set_name(0x8012CFA8, "DialogBorderRW", SN_NOWARN) set_name(0x8012CFAC, "DialogBorderRH", SN_NOWARN) set_name(0x8012CFB0, "DialogBevelGfx", SN_NOWARN) set_name(0x8012CFB4, "DialogBevelCW", SN_NOWARN) set_name(0x8012CFB8, "DialogBevelCH", SN_NOWARN) set_name(0x8012CFBC, "DialogBevelLRW", SN_NOWARN) set_name(0x8012CFC0, "DialogBevelLRH", SN_NOWARN) set_name(0x8012CFC4, "DialogBevelUDW", SN_NOWARN) set_name(0x8012CFC8, "DialogBevelUDH", SN_NOWARN) set_name(0x8012CFCC, "MY_DialogOTpos", SN_NOWARN) set_name(0x8012E6DC, "DialogGBack", SN_NOWARN) set_name(0x8012E6DD, "GShadeX", SN_NOWARN) set_name(0x8012E6DE, "GShadeY", SN_NOWARN) set_name(0x8012E6E4, "RandBTab", SN_NOWARN) set_name(0x800ABCBC, "Cxy", SN_NOWARN) set_name(0x8012CF4F, "BORDERR", SN_NOWARN) set_name(0x8012CF50, "BORDERG", SN_NOWARN) set_name(0x8012CF51, "BORDERB", SN_NOWARN) set_name(0x8012CF52, "BACKR", SN_NOWARN) set_name(0x8012CF53, "BACKG", SN_NOWARN) set_name(0x8012CF54, "BACKB", SN_NOWARN) set_name(0x800ABC7C, "GShadeTab", SN_NOWARN) set_name(0x8012CF4D, "GShadePX", SN_NOWARN) set_name(0x8012CF4E, "GShadePY", SN_NOWARN) set_name(0x8012CFD9, "PlayDemoFlag", SN_NOWARN) set_name(0x8012EC40, "rgbb", SN_NOWARN) set_name(0x8012EC70, "rgbt", SN_NOWARN) set_name(0x8012E6EC, "blockr", SN_NOWARN) set_name(0x8012E6F0, "blockg", SN_NOWARN) set_name(0x8012E6F4, "blockb", SN_NOWARN) set_name(0x8012E6F8, "InfraFlag", SN_NOWARN) set_name(0x8012E6FC, "blank_bit", SN_NOWARN) set_name(0x8012CFED, "P1ObjSelCount", SN_NOWARN) set_name(0x8012CFEE, "P2ObjSelCount", SN_NOWARN) set_name(0x8012CFEF, "P12ObjSelCount", SN_NOWARN) set_name(0x8012CFF0, "P1ItemSelCount", SN_NOWARN) set_name(0x8012CFF1, "P2ItemSelCount", SN_NOWARN) set_name(0x8012CFF2, "P12ItemSelCount", SN_NOWARN) set_name(0x8012CFF3, "P1MonstSelCount", SN_NOWARN) set_name(0x8012CFF4, "P2MonstSelCount", SN_NOWARN) set_name(0x8012CFF5, "P12MonstSelCount", SN_NOWARN) set_name(0x8012CFF6, "P1ObjSelCol", SN_NOWARN) set_name(0x8012CFF8, "P2ObjSelCol", SN_NOWARN) set_name(0x8012CFFA, "P12ObjSelCol", SN_NOWARN) set_name(0x8012CFFC, "P1ItemSelCol", SN_NOWARN) set_name(0x8012CFFE, "P2ItemSelCol", SN_NOWARN) set_name(0x8012D000, "P12ItemSelCol", SN_NOWARN) set_name(0x8012D002, "P1MonstSelCol", SN_NOWARN) set_name(0x8012D004, "P2MonstSelCol", SN_NOWARN) set_name(0x8012D006, "P12MonstSelCol", SN_NOWARN) set_name(0x8012D008, "CurrentBlocks", SN_NOWARN) set_name(0x800ABD2C, "TownConv", SN_NOWARN) set_name(0x8012D024, "CurrentOverlay", SN_NOWARN) set_name(0x80122750, "HaltTab", SN_NOWARN) set_name(0x8012ECA0, "FrontEndOver", SN_NOWARN) set_name(0x8012ECB0, "PregameOver", SN_NOWARN) set_name(0x8012ECC0, "GameOver", SN_NOWARN) set_name(0x8012ECD0, "FmvOver", SN_NOWARN) set_name(0x8012E700, "OWorldX", SN_NOWARN) set_name(0x8012E704, "OWorldY", SN_NOWARN) set_name(0x8012E708, "WWorldX", SN_NOWARN) set_name(0x8012E70C, "WWorldY", SN_NOWARN) set_name(0x801227CC, "TxyAdd", SN_NOWARN) set_name(0x8012D048, "GXAdj2", SN_NOWARN) set_name(0x8012E710, "TimePerFrame", SN_NOWARN) set_name(0x8012E714, "CpuStart", SN_NOWARN) set_name(0x8012E718, "CpuTime", SN_NOWARN) set_name(0x8012E71C, "DrawTime", SN_NOWARN) set_name(0x8012E720, "DrawStart", SN_NOWARN) set_name(0x8012E724, "LastCpuTime", SN_NOWARN) set_name(0x8012E728, "LastDrawTime", SN_NOWARN) set_name(0x8012E72C, "DrawArea", SN_NOWARN) set_name(0x8012D050, "ProfOn", SN_NOWARN) set_name(0x800ABD44, "LevPals", SN_NOWARN) set_name(0x80122928, "Level2Bgdata", SN_NOWARN) set_name(0x800ABD58, "DefP1PanelXY", SN_NOWARN) set_name(0x800ABDAC, "DefP1PanelXY2", SN_NOWARN) set_name(0x800ABE00, "DefP2PanelXY", SN_NOWARN) set_name(0x800ABE54, "DefP2PanelXY2", SN_NOWARN) set_name(0x800ABEA8, "SpeedBarGfxTable", SN_NOWARN) set_name(0x8012D078, "hof", SN_NOWARN) set_name(0x8012D07C, "mof", SN_NOWARN) set_name(0x800ABF70, "SFXTab", SN_NOWARN) set_name(0x800AC070, "STR_Buffer", SN_NOWARN) set_name(0x8012D0B0, "Time", SN_NOWARN) set_name(0x8012D0B4, "CDWAIT", SN_NOWARN) set_name(0x800BE070, "voice_attr", SN_NOWARN) set_name(0x800BE0B0, "STRSave", SN_NOWARN) set_name(0x8012E730, "SavePause", SN_NOWARN) set_name(0x8012D089, "NoActiveStreams", SN_NOWARN) set_name(0x8012D08C, "STRInit", SN_NOWARN) set_name(0x8012D090, "frame_rate", SN_NOWARN) set_name(0x8012D094, "CDAngle", SN_NOWARN) set_name(0x8012D0D8, "SFXNotPlayed", SN_NOWARN) set_name(0x8012D0D9, "SFXNotInBank", SN_NOWARN) set_name(0x8012ECE0, "spu_management", SN_NOWARN) set_name(0x8012EDF0, "rev_attr", SN_NOWARN) set_name(0x8012E738, "NoSfx", SN_NOWARN) set_name(0x8012EE10, "CHStatus", SN_NOWARN) set_name(0x8012D0C4, "BankOffsets", SN_NOWARN) set_name(0x8012D0C8, "OffsetHandle", SN_NOWARN) set_name(0x8012D0CC, "BankBase", SN_NOWARN) set_name(0x8012D0D0, "SPU_Done", SN_NOWARN) set_name(0x80122CD0, "SFXRemapTab", SN_NOWARN) set_name(0x8012D0D4, "NoSNDRemaps", SN_NOWARN) set_name(0x800BE130, "ThePals", SN_NOWARN) set_name(0x80122D7C, "InitialPositions", SN_NOWARN) set_name(0x8012D11C, "demo_level", SN_NOWARN) set_name(0x8012EE40, "buff", SN_NOWARN) set_name(0x8012D120, "old_val", SN_NOWARN) set_name(0x8012D124, "DemoTask", SN_NOWARN) set_name(0x8012D128, "DemoGameTask", SN_NOWARN) set_name(0x8012D12C, "tonys", SN_NOWARN) set_name(0x8012D104, "demo_load", SN_NOWARN) set_name(0x8012D108, "demo_record_load", SN_NOWARN) set_name(0x8012D10C, "level_record", SN_NOWARN) set_name(0x8012D110, "demo_fade_finished", SN_NOWARN) set_name(0x8012D113, "demo_which", SN_NOWARN) set_name(0x800BE35C, "demolevel", SN_NOWARN) set_name(0x8012D111, "quest_cheat_num", SN_NOWARN) set_name(0x8012D112, "cheat_quest_flag", SN_NOWARN) set_name(0x8012D100, "moo_moo", SN_NOWARN) set_name(0x800BE31C, "quest_seed", SN_NOWARN) set_name(0x8012D114, "demo_flash", SN_NOWARN) set_name(0x8012D118, "tonys_Task", SN_NOWARN) set_name(0x8012D288, "DoShowPanel", SN_NOWARN) set_name(0x8012D28C, "DoDrawBg", SN_NOWARN) set_name(0x8012E73C, "GlueFinished", SN_NOWARN) set_name(0x8012E740, "DoHomingScroll", SN_NOWARN) set_name(0x8012E744, "TownerGfx", SN_NOWARN) set_name(0x8012E748, "CurrentMonsterList", SN_NOWARN) set_name(0x8012D139, "started_grtask", SN_NOWARN) set_name(0x800BE370, "PlayerInfo", SN_NOWARN) set_name(0x8012D290, "ArmourChar", SN_NOWARN) set_name(0x80122E70, "WepChar", SN_NOWARN) set_name(0x8012D294, "CharChar", SN_NOWARN) set_name(0x8012E74C, "ctrl_select_line", SN_NOWARN) set_name(0x8012E74D, "ctrl_select_side", SN_NOWARN) set_name(0x8012E74E, "ckeyheld", SN_NOWARN) set_name(0x8012E754, "CtrlRect", SN_NOWARN) set_name(0x8012D2A8, "ctrlflag", SN_NOWARN) set_name(0x800BE7E4, "txt_actions", SN_NOWARN) set_name(0x800BE73C, "pad_txt", SN_NOWARN) set_name(0x8012D2A4, "toppos", SN_NOWARN) set_name(0x8012EE60, "CtrlBack", SN_NOWARN) set_name(0x800BE914, "controller_defaults", SN_NOWARN) set_name(0x8012D314, "gr_scrxoff", SN_NOWARN) set_name(0x8012D318, "gr_scryoff", SN_NOWARN) set_name(0x8012D320, "water_clut", SN_NOWARN) set_name(0x8012D323, "visible_level", SN_NOWARN) set_name(0x8012D311, "last_type", SN_NOWARN) set_name(0x8012D325, "daylight", SN_NOWARN) set_name(0x8012D322, "cow_in_sight", SN_NOWARN) set_name(0x8012D31C, "water_count", SN_NOWARN) set_name(0x8012D324, "lastrnd", SN_NOWARN) set_name(0x8012D328, "call_clock", SN_NOWARN) set_name(0x8012D338, "TitleAnimCount", SN_NOWARN) set_name(0x8012D33C, "flametick", SN_NOWARN) set_name(0x800BE9AC, "ypos", SN_NOWARN) set_name(0x800BE9C4, "frmlist", SN_NOWARN) set_name(0x800BE9DC, "xoff", SN_NOWARN) set_name(0x8012D340, "startx", SN_NOWARN) set_name(0x8012D344, "hellomumflag", SN_NOWARN) set_name(0x800BEA14, "SpellFXDat", SN_NOWARN) set_name(0x8012EE70, "PartArray", SN_NOWARN) set_name(0x8012E75C, "partOtPos", SN_NOWARN) set_name(0x8012D364, "SetParticle", SN_NOWARN) set_name(0x8012D368, "p1partexecnum", SN_NOWARN) set_name(0x8012D36C, "p2partexecnum", SN_NOWARN) set_name(0x800BE9F4, "JumpArray", SN_NOWARN) set_name(0x8012D370, "partjumpflag", SN_NOWARN) set_name(0x8012D374, "partglowflag", SN_NOWARN) set_name(0x8012D378, "partcolour", SN_NOWARN) set_name(0x8012D37C, "anyfuckingmenus", SN_NOWARN) set_name(0x800BEAA4, "SplTarget", SN_NOWARN) set_name(0x8012D39D, "select_flag", SN_NOWARN) set_name(0x8012E760, "SelectRect", SN_NOWARN) set_name(0x8012E768, "item_select", SN_NOWARN) set_name(0x8012D3A0, "QSpell", SN_NOWARN) set_name(0x8012D3A4, "_spltotype", SN_NOWARN) set_name(0x8012D3A8, "force_attack", SN_NOWARN) set_name(0x8012D390, "gplayer", SN_NOWARN) set_name(0x8012F0B0, "SelectBack", SN_NOWARN) set_name(0x8012D394, "mana_order", SN_NOWARN) set_name(0x8012D398, "health_order", SN_NOWARN) set_name(0x8012D39C, "birdcheck", SN_NOWARN) set_name(0x8012F0C0, "DecRequestors", SN_NOWARN) set_name(0x8012E76C, "progress", SN_NOWARN) set_name(0x80122FFC, "Level2CutScreen", SN_NOWARN) set_name(0x8012F0E8, "Scr", SN_NOWARN) set_name(0x8012D3C8, "CutScreenTSK", SN_NOWARN) set_name(0x8012D3CC, "GameLoading", SN_NOWARN) set_name(0x8012F168, "LBack", SN_NOWARN) set_name(0x800BEAD4, "block_buf", SN_NOWARN) set_name(0x8012D3E8, "card_ev0", SN_NOWARN) set_name(0x8012D3EC, "card_ev1", SN_NOWARN) set_name(0x8012D3F0, "card_ev2", SN_NOWARN) set_name(0x8012D3F4, "card_ev3", SN_NOWARN) set_name(0x8012D3F8, "card_ev10", SN_NOWARN) set_name(0x8012D3FC, "card_ev11", SN_NOWARN) set_name(0x8012D400, "card_ev12", SN_NOWARN) set_name(0x8012D404, "card_ev13", SN_NOWARN) set_name(0x8012D408, "card_dirty", SN_NOWARN) set_name(0x8012D410, "MemcardTask", SN_NOWARN) set_name(0x8012E770, "card_event", SN_NOWARN) set_name(0x8012D3E4, "mem_card_event_handler", SN_NOWARN) set_name(0x8012D3DC, "MemCardActive", SN_NOWARN) set_name(0x8012D3E0, "never_hooked_events", SN_NOWARN) set_name(0x8012D46C, "MasterVol", SN_NOWARN) set_name(0x8012D470, "MusicVol", SN_NOWARN) set_name(0x8012D474, "SoundVol", SN_NOWARN) set_name(0x8012D478, "VideoVol", SN_NOWARN) set_name(0x8012D47C, "SpeechVol", SN_NOWARN) set_name(0x8012E774, "Slider", SN_NOWARN) set_name(0x8012E778, "sw", SN_NOWARN) set_name(0x8012E77C, "sx", SN_NOWARN) set_name(0x8012E780, "sy", SN_NOWARN) set_name(0x8012E784, "Adjust", SN_NOWARN) set_name(0x8012E785, "qspin", SN_NOWARN) set_name(0x8012E786, "lqspin", SN_NOWARN) set_name(0x8012E788, "OrigLang", SN_NOWARN) set_name(0x8012E78C, "OldLang", SN_NOWARN) set_name(0x8012E790, "NewLang", SN_NOWARN) set_name(0x8012D480, "save_blocks", SN_NOWARN) set_name(0x8012D484, "Savefilename", SN_NOWARN) set_name(0x8012D488, "ReturnMenu", SN_NOWARN) set_name(0x8012E794, "ORect", SN_NOWARN) set_name(0x8012E79C, "McState", SN_NOWARN) set_name(0x8012D48C, "they_pressed", SN_NOWARN) set_name(0x8012E7A4, "Seed", SN_NOWARN) set_name(0x8012D440, "optionsflag", SN_NOWARN) set_name(0x8012D434, "cmenu", SN_NOWARN) set_name(0x8012D44C, "options_pad", SN_NOWARN) set_name(0x8012D43C, "allspellsflag", SN_NOWARN) set_name(0x800BF5F4, "Circle", SN_NOWARN) set_name(0x8012D420, "goldcheat", SN_NOWARN) set_name(0x8012D450, "OptionsSeed", SN_NOWARN) set_name(0x8012D454, "OptionsSetSeed", SN_NOWARN) set_name(0x8012D424, "Qfromoptions", SN_NOWARN) set_name(0x8012D428, "Spacing", SN_NOWARN) set_name(0x8012D42C, "cs", SN_NOWARN) set_name(0x8012D430, "lastcs", SN_NOWARN) set_name(0x8012D438, "MemcardOverlay", SN_NOWARN) set_name(0x8012D444, "saveflag", SN_NOWARN) set_name(0x8012D448, "loadflag", SN_NOWARN) set_name(0x8012D458, "PadFrig", SN_NOWARN) set_name(0x800BEB54, "MainMenu", SN_NOWARN) set_name(0x800BEC2C, "GameMenu", SN_NOWARN) set_name(0x800BED34, "SoundMenu", SN_NOWARN) set_name(0x800BEDC4, "CentreMenu", SN_NOWARN) set_name(0x800BEE6C, "LangMenu", SN_NOWARN) set_name(0x800BEF14, "QuitMenu", SN_NOWARN) set_name(0x800BEF74, "MemcardMenu", SN_NOWARN) set_name(0x800BF01C, "MemcardLoadGameMenu", SN_NOWARN) set_name(0x800BF07C, "MemcardSaveGameMenu", SN_NOWARN) set_name(0x800BF0DC, "MemcardSaveOptionsMenu", SN_NOWARN) set_name(0x800BF13C, "MemcardLoadOptionsMenu", SN_NOWARN) set_name(0x800BF19C, "MemcardCharacterMenu", SN_NOWARN) set_name(0x800BF1FC, "MemcardSelectCard1", SN_NOWARN) set_name(0x800BF2A4, "MemcardSelectCard2", SN_NOWARN) set_name(0x800BF34C, "MemcardFormatMenu", SN_NOWARN) set_name(0x800BF3AC, "CheatMenu", SN_NOWARN) set_name(0x800BF49C, "InfoMenu", SN_NOWARN) set_name(0x800BF4CC, "MonstViewMenu", SN_NOWARN) set_name(0x800BF514, "SeedMenu", SN_NOWARN) set_name(0x800BF55C, "MenuList", SN_NOWARN) set_name(0x8012D45C, "debounce", SN_NOWARN) set_name(0x8012D460, "KeyPos", SN_NOWARN) set_name(0x800BF674, "KeyTab", SN_NOWARN) set_name(0x8012D464, "SeedPos", SN_NOWARN) set_name(0x800BF688, "BirdList", SN_NOWARN) set_name(0x8012E7AC, "last_seenx", SN_NOWARN) set_name(0x8012E7B4, "last_seeny", SN_NOWARN) set_name(0x8012D499, "hop_height", SN_NOWARN) set_name(0x8012D49C, "perches", SN_NOWARN) set_name(0x800BF808, "FmvTab", SN_NOWARN) set_name(0x8012D4B0, "CurMons", SN_NOWARN) set_name(0x8012D4B4, "Frame", SN_NOWARN) set_name(0x8012D4B8, "Action", SN_NOWARN) set_name(0x8012D4BC, "Dir", SN_NOWARN) set_name(0x8012D520, "indsize", SN_NOWARN) set_name(0x8012D500, "kanjbuff", SN_NOWARN) set_name(0x8012D504, "kindex", SN_NOWARN) set_name(0x8012D508, "hndKanjBuff", SN_NOWARN) set_name(0x8012D50C, "hndKanjIndex", SN_NOWARN) set_name(0x8012E7BC, "HelpRect", SN_NOWARN) set_name(0x8012E7C4, "HelpTop", SN_NOWARN) set_name(0x8012F178, "HelpBack", SN_NOWARN) set_name(0x8012D530, "helpflag", SN_NOWARN) set_name(0x800BF848, "HelpList", SN_NOWARN) set_name(0x8012D580, "FeBackX", SN_NOWARN) set_name(0x8012D584, "FeBackY", SN_NOWARN) set_name(0x8012D588, "FeBackW", SN_NOWARN) set_name(0x8012D58C, "FeBackH", SN_NOWARN) set_name(0x8012D590, "FeFlag", SN_NOWARN) set_name(0x800BFE50, "FeBuffer", SN_NOWARN) set_name(0x8012D594, "FePlayerNo", SN_NOWARN) set_name(0x8012E7C8, "CStruct", SN_NOWARN) set_name(0x8012D598, "FeBufferCount", SN_NOWARN) set_name(0x8012D59C, "FeNoOfPlayers", SN_NOWARN) set_name(0x8012D5A0, "FeChrClass", SN_NOWARN) set_name(0x800C05D0, "FePlayerName", SN_NOWARN) set_name(0x8012D5A8, "FeCurMenu", SN_NOWARN) set_name(0x8012D5AC, "FePlayerNameFlag", SN_NOWARN) set_name(0x8012D5B0, "FeCount", SN_NOWARN) set_name(0x8012D5B4, "fileselect", SN_NOWARN) set_name(0x8012D5B8, "BookMenu", SN_NOWARN) set_name(0x8012D5BC, "FeAttractMode", SN_NOWARN) set_name(0x8012D5C0, "FMVPress", SN_NOWARN) set_name(0x8012D54C, "FeTData", SN_NOWARN) set_name(0x8012D554, "LoadedChar", SN_NOWARN) set_name(0x8012D550, "FlameTData", SN_NOWARN) set_name(0x8012D55C, "FeIsAVirgin", SN_NOWARN) set_name(0x8012D560, "FeMenuDelay", SN_NOWARN) set_name(0x800BF950, "DummyMenu", SN_NOWARN) set_name(0x800BF96C, "FeMainMenu", SN_NOWARN) set_name(0x800BF988, "FeNewGameMenu", SN_NOWARN) set_name(0x800BF9A4, "FeNewP1ClassMenu", SN_NOWARN) set_name(0x800BF9C0, "FeNewP1NameMenu", SN_NOWARN) set_name(0x800BF9DC, "FeNewP2ClassMenu", SN_NOWARN) set_name(0x800BF9F8, "FeNewP2NameMenu", SN_NOWARN) set_name(0x800BFA14, "FeDifficultyMenu", SN_NOWARN) set_name(0x800BFA30, "FeBackgroundMenu", SN_NOWARN) set_name(0x800BFA4C, "FeBook1Menu", SN_NOWARN) set_name(0x800BFA68, "FeBook2Menu", SN_NOWARN) set_name(0x800BFA84, "FeLoadCharMenu", SN_NOWARN) set_name(0x800BFAA0, "FeLoadChar1Menu", SN_NOWARN) set_name(0x800BFABC, "FeLoadChar2Menu", SN_NOWARN) set_name(0x8012D564, "fadeval", SN_NOWARN) set_name(0x800BFAD8, "FeMainMenuTable", SN_NOWARN) set_name(0x800BFB50, "FeNewGameMenuTable", SN_NOWARN) set_name(0x800BFB98, "FePlayerClassMenuTable", SN_NOWARN) set_name(0x800BFC10, "FeNameEngMenuTable", SN_NOWARN) set_name(0x800BFC58, "FeMemcardMenuTable", SN_NOWARN) set_name(0x800BFCA0, "FeDifficultyMenuTable", SN_NOWARN) set_name(0x800BFD00, "FeBackgroundMenuTable", SN_NOWARN) set_name(0x800BFD60, "FeBook1MenuTable", SN_NOWARN) set_name(0x800BFDD8, "FeBook2MenuTable", SN_NOWARN) set_name(0x8012D570, "DrawBackOn", SN_NOWARN) set_name(0x8012D574, "AttractTitleDelay", SN_NOWARN) set_name(0x8012D578, "AttractMainDelay", SN_NOWARN) set_name(0x8012D57C, "FMVEndPad", SN_NOWARN) set_name(0x8012D5F4, "InCredits", SN_NOWARN) set_name(0x8012D5F8, "CreditTitleNo", SN_NOWARN) set_name(0x8012D5FC, "CreditSubTitleNo", SN_NOWARN) set_name(0x8012D610, "card_status", SN_NOWARN) set_name(0x8012D618, "card_usable", SN_NOWARN) set_name(0x8012D620, "card_files", SN_NOWARN) set_name(0x8012D628, "card_changed", SN_NOWARN) set_name(0x8012D66C, "AlertTxt", SN_NOWARN) set_name(0x8012D670, "current_card", SN_NOWARN) set_name(0x8012D674, "LoadType", SN_NOWARN) set_name(0x8012D678, "McMenuPos", SN_NOWARN) set_name(0x8012D67C, "McCurMenu", SN_NOWARN) set_name(0x8012D668, "fileinfoflag", SN_NOWARN) set_name(0x8012D63C, "DiabloGameFile", SN_NOWARN) set_name(0x8012D640, "DiabloOptionFile", SN_NOWARN) set_name(0x8012D660, "McState_addr_8012D660", SN_NOWARN) set_name(0x8012D758, "mdec_audio_buffer", SN_NOWARN) set_name(0x8012D760, "mdec_audio_sec", SN_NOWARN) set_name(0x8012D764, "mdec_audio_offs", SN_NOWARN) set_name(0x8012D768, "mdec_audio_playing", SN_NOWARN) set_name(0x8012D76C, "mdec_audio_rate_shift", SN_NOWARN) set_name(0x8012D770, "vlcbuf", SN_NOWARN) set_name(0x8012D778, "slice_size", SN_NOWARN) set_name(0x8012D77C, "slice", SN_NOWARN) set_name(0x8012D784, "slice_inc", SN_NOWARN) set_name(0x8012D788, "area_pw", SN_NOWARN) set_name(0x8012D78C, "area_ph", SN_NOWARN) set_name(0x8012D790, "tmdc_pol_dirty", SN_NOWARN) set_name(0x8012D794, "num_pol", SN_NOWARN) set_name(0x8012D79C, "mdec_cx", SN_NOWARN) set_name(0x8012D7A0, "mdec_cy", SN_NOWARN) set_name(0x8012D7A4, "mdec_w", SN_NOWARN) set_name(0x8012D7A8, "mdec_h", SN_NOWARN) set_name(0x8012D7AC, "mdec_pw", SN_NOWARN) set_name(0x8012D7B4, "mdec_ph", SN_NOWARN) set_name(0x8012D7BC, "move_x", SN_NOWARN) set_name(0x8012D7C0, "move_y", SN_NOWARN) set_name(0x8012D7C4, "move_scale", SN_NOWARN) set_name(0x8012D7C8, "stream_frames", SN_NOWARN) set_name(0x8012D7CC, "last_stream_frame", SN_NOWARN) set_name(0x8012D7D0, "mdec_framecount", SN_NOWARN) set_name(0x8012D7D4, "mdec_speed", SN_NOWARN) set_name(0x8012D7D8, "mdec_stream_starting", SN_NOWARN) set_name(0x8012D7DC, "mdec_last_frame", SN_NOWARN) set_name(0x8012D7E0, "mdec_sectors_per_frame", SN_NOWARN) set_name(0x8012D7E4, "vlctab", SN_NOWARN) set_name(0x8012D7E8, "mdc_buftop", SN_NOWARN) set_name(0x8012D7EC, "mdc_bufstart", SN_NOWARN) set_name(0x8012D7F0, "mdc_bufleft", SN_NOWARN) set_name(0x8012D7F4, "mdc_buftotal", SN_NOWARN) set_name(0x8012D7F8, "ordertab_length", SN_NOWARN) set_name(0x8012D7FC, "time_in_frames", SN_NOWARN) set_name(0x8012D800, "stream_chunksize", SN_NOWARN) set_name(0x8012D804, "stream_bufsize", SN_NOWARN) set_name(0x8012D808, "stream_subsec", SN_NOWARN) set_name(0x8012D80C, "stream_secnum", SN_NOWARN) set_name(0x8012D810, "stream_last_sector", SN_NOWARN) set_name(0x8012D814, "stream_startsec", SN_NOWARN) set_name(0x8012D818, "stream_opened", SN_NOWARN) set_name(0x8012D81C, "stream_last_chunk", SN_NOWARN) set_name(0x8012D820, "stream_got_chunks", SN_NOWARN) set_name(0x8012D824, "last_sector", SN_NOWARN) set_name(0x8012D828, "cdstream_resetsec", SN_NOWARN) set_name(0x8012D82C, "last_handler_event", SN_NOWARN) set_name(0x8012D6F4, "user_start", SN_NOWARN) set_name(0x8012D68C, "vlc_tab", SN_NOWARN) set_name(0x8012D690, "vlc_buf", SN_NOWARN) set_name(0x8012D694, "img_buf", SN_NOWARN) set_name(0x8012D698, "vbuf", SN_NOWARN) set_name(0x8012D69C, "last_fn", SN_NOWARN) set_name(0x8012D6A0, "last_mdc", SN_NOWARN) set_name(0x8012D6A4, "slnum", SN_NOWARN) set_name(0x8012D6A8, "slices_to_do", SN_NOWARN) set_name(0x8012D6AC, "mbuf", SN_NOWARN) set_name(0x8012D6B0, "mfn", SN_NOWARN) set_name(0x8012D6B4, "last_move_mbuf", SN_NOWARN) set_name(0x8012D6B8, "move_request", SN_NOWARN) set_name(0x8012D6BC, "mdec_scale", SN_NOWARN) set_name(0x8012D6C0, "do_brightness", SN_NOWARN) set_name(0x8012D6C4, "frame_decoded", SN_NOWARN) set_name(0x8012D6C8, "mdec_streaming", SN_NOWARN) set_name(0x8012D6CC, "mdec_stream_size", SN_NOWARN) set_name(0x8012D6D0, "first_stream_frame", SN_NOWARN) set_name(0x8012D6D4, "stream_frames_played", SN_NOWARN) set_name(0x8012D6D8, "num_mdcs", SN_NOWARN) set_name(0x8012D6DC, "mdec_head", SN_NOWARN) set_name(0x8012D6E0, "mdec_tail", SN_NOWARN) set_name(0x8012D6E4, "mdec_waiting_tail", SN_NOWARN) set_name(0x8012D6E8, "mdecs_queued", SN_NOWARN) set_name(0x8012D6EC, "mdecs_waiting", SN_NOWARN) set_name(0x8012D6F0, "sfx_volume", SN_NOWARN) set_name(0x8012D6F8, "DiabEnd", SN_NOWARN) set_name(0x8012D6FC, "stream_chunks_in", SN_NOWARN) set_name(0x8012D700, "stream_chunks_total", SN_NOWARN) set_name(0x8012D704, "stream_in", SN_NOWARN) set_name(0x8012D708, "stream_out", SN_NOWARN) set_name(0x8012D70C, "stream_stalled", SN_NOWARN) set_name(0x8012D710, "stream_ending", SN_NOWARN) set_name(0x8012D714, "stream_open", SN_NOWARN) set_name(0x8012D718, "stream_handler_installed", SN_NOWARN) set_name(0x8012D71C, "stream_chunks_borrowed", SN_NOWARN) set_name(0x8012D720, "_get_count", SN_NOWARN) set_name(0x8012D724, "_discard_count", SN_NOWARN) set_name(0x8012D728, "CDTask", SN_NOWARN) set_name(0x8012D72C, "CDStream", SN_NOWARN) set_name(0x8012D730, "cdready_calls", SN_NOWARN) set_name(0x8012D734, "cdready_errors", SN_NOWARN) set_name(0x8012D738, "cdready_out_of_sync", SN_NOWARN) set_name(0x8012D73C, "cdstream_resetting", SN_NOWARN) set_name(0x8012D740, "sector_dma", SN_NOWARN) set_name(0x8012D744, "sector_dma_in", SN_NOWARN) set_name(0x8012D748, "chkaddr", SN_NOWARN) set_name(0x8012D74C, "chunk", SN_NOWARN) set_name(0x8012D750, "first_handler_event", SN_NOWARN) set_name(0x8012D754, "DOSLEEP", SN_NOWARN) set_name(0x8012D8AC, "pStatusPanel", SN_NOWARN) set_name(0x8012D8B0, "pGBoxBuff", SN_NOWARN) set_name(0x8012D8B4, "dropGoldFlag", SN_NOWARN) set_name(0x8012D8B8, "_pinfoflag", SN_NOWARN) set_name(0x800C0AE8, "_infostr", SN_NOWARN) set_name(0x8012D8BC, "_infoclr", SN_NOWARN) set_name(0x800C0CE8, "tempstr", SN_NOWARN) set_name(0x8012D8BE, "drawhpflag", SN_NOWARN) set_name(0x8012D8BF, "drawmanaflag", SN_NOWARN) set_name(0x8012D8C0, "chrflag", SN_NOWARN) set_name(0x8012D8C1, "drawbtnflag", SN_NOWARN) set_name(0x8012D8C2, "panbtndown", SN_NOWARN) set_name(0x8012D8C3, "panelflag", SN_NOWARN) set_name(0x8012D8C4, "chrbtndown", SN_NOWARN) set_name(0x8012D8C5, "lvlbtndown", SN_NOWARN) set_name(0x8012D8C6, "sbookflag", SN_NOWARN) set_name(0x8012D8C7, "talkflag", SN_NOWARN) set_name(0x8012D8C8, "dropGoldValue", SN_NOWARN) set_name(0x8012D8CC, "initialDropGoldValue", SN_NOWARN) set_name(0x8012D8D0, "initialDropGoldIndex", SN_NOWARN) set_name(0x8012D8D4, "pPanelButtons", SN_NOWARN) set_name(0x8012D8D8, "pPanelText", SN_NOWARN) set_name(0x8012D8DC, "pManaBuff", SN_NOWARN) set_name(0x8012D8E0, "pLifeBuff", SN_NOWARN) set_name(0x8012D8E4, "pChrPanel", SN_NOWARN) set_name(0x8012D8E8, "pChrButtons", SN_NOWARN) set_name(0x8012D8EC, "pSpellCels", SN_NOWARN) set_name(0x8012F1C8, "_panelstr", SN_NOWARN) set_name(0x8012F5C8, "_pstrjust", SN_NOWARN) set_name(0x8012E7D8, "_pnumlines", SN_NOWARN) set_name(0x8012D8F0, "InfoBoxRect", SN_NOWARN) set_name(0x8012D8F4, "CSRect", SN_NOWARN) set_name(0x8012E7E8, "_pSpell", SN_NOWARN) set_name(0x8012E7F0, "_pSplType", SN_NOWARN) set_name(0x8012D8FC, "numpanbtns", SN_NOWARN) set_name(0x8012D900, "pDurIcons", SN_NOWARN) set_name(0x8012D904, "drawdurflag", SN_NOWARN) set_name(0x8012E7F8, "chrbtn", SN_NOWARN) set_name(0x8012D905, "chrbtnactive", SN_NOWARN) set_name(0x8012D908, "pSpellBkCel", SN_NOWARN) set_name(0x8012D90C, "pSBkBtnCel", SN_NOWARN) set_name(0x8012D910, "pSBkIconCels", SN_NOWARN) set_name(0x8012D914, "sbooktab", SN_NOWARN) set_name(0x8012D918, "cur_spel", SN_NOWARN) set_name(0x8012E800, "talkofs", SN_NOWARN) set_name(0x8012F618, "sgszTalkMsg", SN_NOWARN) set_name(0x8012E804, "sgbTalkSavePos", SN_NOWARN) set_name(0x8012E805, "sgbNextTalkSave", SN_NOWARN) set_name(0x8012E806, "sgbPlrTalkTbl", SN_NOWARN) set_name(0x8012E808, "pTalkPanel", SN_NOWARN) set_name(0x8012E80C, "pMultiBtns", SN_NOWARN) set_name(0x8012E810, "pTalkBtns", SN_NOWARN) set_name(0x8012E814, "talkbtndown", SN_NOWARN) set_name(0x800C05FC, "SpellITbl", SN_NOWARN) set_name(0x8012D839, "DrawLevelUpFlag", SN_NOWARN) set_name(0x8012D860, "_spselflag", SN_NOWARN) set_name(0x8012D85C, "spspelstate", SN_NOWARN) set_name(0x8012D87C, "initchr", SN_NOWARN) set_name(0x8012D83C, "SPLICONNO", SN_NOWARN) set_name(0x8012D840, "SPLICONY", SN_NOWARN) set_name(0x8012E7E0, "SPLICONRIGHT", SN_NOWARN) set_name(0x8012D844, "scx", SN_NOWARN) set_name(0x8012D848, "scy", SN_NOWARN) set_name(0x8012D84C, "scx1", SN_NOWARN) set_name(0x8012D850, "scy1", SN_NOWARN) set_name(0x8012D854, "scx2", SN_NOWARN) set_name(0x8012D858, "scy2", SN_NOWARN) set_name(0x8012D868, "SpellCol", SN_NOWARN) set_name(0x800C05E8, "SpellColors", SN_NOWARN) set_name(0x800C0624, "SpellPages", SN_NOWARN) set_name(0x8012D86C, "lus", SN_NOWARN) set_name(0x8012D870, "CsNo", SN_NOWARN) set_name(0x8012D874, "plusanim", SN_NOWARN) set_name(0x8012F608, "CSBack", SN_NOWARN) set_name(0x8012D878, "CS_XOFF", SN_NOWARN) set_name(0x800C0688, "CS_Tab", SN_NOWARN) set_name(0x8012D880, "NoCSEntries", SN_NOWARN) set_name(0x8012D884, "SPALOFF", SN_NOWARN) set_name(0x8012D888, "paloffset1", SN_NOWARN) set_name(0x8012D88C, "paloffset2", SN_NOWARN) set_name(0x8012D890, "paloffset3", SN_NOWARN) set_name(0x8012D894, "paloffset4", SN_NOWARN) set_name(0x8012D898, "pinc1", SN_NOWARN) set_name(0x8012D89C, "pinc2", SN_NOWARN) set_name(0x8012D8A0, "pinc3", SN_NOWARN) set_name(0x8012D8A4, "pinc4", SN_NOWARN) set_name(0x8012D92C, "_pcurs", SN_NOWARN) set_name(0x8012D934, "cursW", SN_NOWARN) set_name(0x8012D938, "cursH", SN_NOWARN) set_name(0x8012D93C, "icursW", SN_NOWARN) set_name(0x8012D940, "icursH", SN_NOWARN) set_name(0x8012D944, "icursW28", SN_NOWARN) set_name(0x8012D948, "icursH28", SN_NOWARN) set_name(0x8012D94C, "cursmx", SN_NOWARN) set_name(0x8012D950, "cursmy", SN_NOWARN) set_name(0x8012D954, "_pcursmonst", SN_NOWARN) set_name(0x8012D95C, "_pcursobj", SN_NOWARN) set_name(0x8012D960, "_pcursitem", SN_NOWARN) set_name(0x8012D964, "_pcursinvitem", SN_NOWARN) set_name(0x8012D968, "_pcursplr", SN_NOWARN) set_name(0x8012D928, "sel_data", SN_NOWARN) set_name(0x800C0DE8, "dead", SN_NOWARN) set_name(0x8012D96C, "spurtndx", SN_NOWARN) set_name(0x8012D970, "stonendx", SN_NOWARN) set_name(0x8012D974, "pSquareCel", SN_NOWARN) set_name(0x8012D9B4, "ghInst", SN_NOWARN) set_name(0x8012D9B8, "svgamode", SN_NOWARN) set_name(0x8012D9BC, "MouseX", SN_NOWARN) set_name(0x8012D9C0, "MouseY", SN_NOWARN) set_name(0x8012D9C4, "gv1", SN_NOWARN) set_name(0x8012D9C8, "gv2", SN_NOWARN) set_name(0x8012D9CC, "gv3", SN_NOWARN) set_name(0x8012D9D0, "gv4", SN_NOWARN) set_name(0x8012D9D4, "gv5", SN_NOWARN) set_name(0x8012D9D8, "gbProcessPlayers", SN_NOWARN) set_name(0x800C0F5C, "DebugMonsters", SN_NOWARN) set_name(0x800C0F84, "glSeedTbl", SN_NOWARN) set_name(0x800C0FC8, "gnLevelTypeTbl", SN_NOWARN) set_name(0x8012D9D9, "gbDoEnding", SN_NOWARN) set_name(0x8012D9DA, "gbRunGame", SN_NOWARN) set_name(0x8012D9DB, "gbRunGameResult", SN_NOWARN) set_name(0x8012D9DC, "gbGameLoopStartup", SN_NOWARN) set_name(0x8012F668, "glEndSeed", SN_NOWARN) set_name(0x8012F6B8, "glMid1Seed", SN_NOWARN) set_name(0x8012F708, "glMid2Seed", SN_NOWARN) set_name(0x8012F758, "glMid3Seed", SN_NOWARN) set_name(0x8012E818, "sg_previousFilter", SN_NOWARN) set_name(0x800C100C, "CreateEnv", SN_NOWARN) set_name(0x8012D9E0, "Passedlvldir", SN_NOWARN) set_name(0x8012D9E4, "TempStack", SN_NOWARN) set_name(0x8012D984, "ghMainWnd", SN_NOWARN) set_name(0x8012D988, "fullscreen", SN_NOWARN) set_name(0x8012D98C, "force_redraw", SN_NOWARN) set_name(0x8012D9A0, "PauseMode", SN_NOWARN) set_name(0x8012D9A1, "FriendlyMode", SN_NOWARN) set_name(0x8012D991, "visiondebug", SN_NOWARN) set_name(0x8012D993, "light4flag", SN_NOWARN) set_name(0x8012D994, "leveldebug", SN_NOWARN) set_name(0x8012D995, "monstdebug", SN_NOWARN) set_name(0x8012D99C, "debugmonsttypes", SN_NOWARN) set_name(0x8012D990, "cineflag", SN_NOWARN) set_name(0x8012D992, "scrollflag", SN_NOWARN) set_name(0x8012D996, "trigdebug", SN_NOWARN) set_name(0x8012D998, "setseed", SN_NOWARN) set_name(0x8012D9A4, "sgnTimeoutCurs", SN_NOWARN) set_name(0x8012D9A8, "sgbMouseDown", SN_NOWARN) set_name(0x800C16D8, "towner", SN_NOWARN) set_name(0x8012D9FC, "numtowners", SN_NOWARN) set_name(0x8012DA00, "storeflag", SN_NOWARN) set_name(0x8012DA01, "boyloadflag", SN_NOWARN) set_name(0x8012DA02, "bannerflag", SN_NOWARN) set_name(0x8012DA04, "pCowCels", SN_NOWARN) set_name(0x8012E81C, "sgdwCowClicks", SN_NOWARN) set_name(0x8012E820, "sgnCowMsg", SN_NOWARN) set_name(0x800C1418, "Qtalklist", SN_NOWARN) set_name(0x8012D9F4, "CowPlaying", SN_NOWARN) set_name(0x800C103C, "AnimOrder", SN_NOWARN) set_name(0x800C13B4, "TownCowX", SN_NOWARN) set_name(0x800C13C0, "TownCowY", SN_NOWARN) set_name(0x800C13CC, "TownCowDir", SN_NOWARN) set_name(0x800C13D8, "cowoffx", SN_NOWARN) set_name(0x800C13F8, "cowoffy", SN_NOWARN) set_name(0x8012DA1C, "sfxdelay", SN_NOWARN) set_name(0x8012DA20, "sfxdnum", SN_NOWARN) set_name(0x8012DA14, "sghStream", SN_NOWARN) set_name(0x800C24D8, "sgSFX", SN_NOWARN) set_name(0x8012DA18, "sgpStreamSFX", SN_NOWARN) set_name(0x8012DA24, "orgseed", SN_NOWARN) set_name(0x8012E824, "sglGameSeed", SN_NOWARN) set_name(0x8012DA28, "SeedCount", SN_NOWARN) set_name(0x8012E828, "sgMemCrit", SN_NOWARN) set_name(0x8012E82C, "sgnWidth", SN_NOWARN) set_name(0x8012DA36, "msgflag", SN_NOWARN) set_name(0x8012DA37, "msgdelay", SN_NOWARN) set_name(0x800C3500, "msgtable", SN_NOWARN) set_name(0x800C3450, "MsgStrings", SN_NOWARN) set_name(0x8012DA35, "msgcnt", SN_NOWARN) set_name(0x8012E830, "sgdwProgress", SN_NOWARN) set_name(0x8012E834, "sgdwXY", SN_NOWARN) set_name(0x800C3550, "AllItemsUseable", SN_NOWARN) set_name(0x80123788, "AllItemsList", SN_NOWARN) set_name(0x80124B28, "PL_Prefix", SN_NOWARN) set_name(0x80125848, "PL_Suffix", SN_NOWARN) set_name(0x80126748, "UniqueItemList", SN_NOWARN) set_name(0x800C3764, "item", SN_NOWARN) set_name(0x800C8364, "itemactive", SN_NOWARN) set_name(0x800C83E4, "itemavail", SN_NOWARN) set_name(0x800C8464, "UniqueItemFlag", SN_NOWARN) set_name(0x8012DA70, "uitemflag", SN_NOWARN) set_name(0x8012E838, "tem", SN_NOWARN) set_name(0x8012F7A0, "curruitem", SN_NOWARN) set_name(0x8012F840, "itemhold", SN_NOWARN) set_name(0x8012DA74, "ScrollType", SN_NOWARN) set_name(0x800C84E4, "ItemStr", SN_NOWARN) set_name(0x800C8524, "SufStr", SN_NOWARN) set_name(0x8012DA50, "numitems", SN_NOWARN) set_name(0x8012DA54, "gnNumGetRecords", SN_NOWARN) set_name(0x800C36C0, "ItemInvSnds", SN_NOWARN) set_name(0x800C35F0, "ItemCAnimTbl", SN_NOWARN) set_name(0x80128570, "SinTab", SN_NOWARN) set_name(0x801285B0, "Item2Frm", SN_NOWARN) set_name(0x800C369C, "ItemAnimLs", SN_NOWARN) set_name(0x8012DA58, "ItemAnimSnds", SN_NOWARN) set_name(0x8012DA5C, "idoppely", SN_NOWARN) set_name(0x8012DA60, "ScrollFlag", SN_NOWARN) set_name(0x800C374C, "premiumlvladd", SN_NOWARN) set_name(0x800C9310, "LightList", SN_NOWARN) set_name(0x800C9450, "lightactive", SN_NOWARN) set_name(0x8012DA88, "numlights", SN_NOWARN) set_name(0x8012DA8C, "lightmax", SN_NOWARN) set_name(0x800C9478, "VisionList", SN_NOWARN) set_name(0x8012DA90, "numvision", SN_NOWARN) set_name(0x8012DA94, "dovision", SN_NOWARN) set_name(0x8012DA98, "visionid", SN_NOWARN) set_name(0x8012E83C, "disp_mask", SN_NOWARN) set_name(0x8012E840, "weird", SN_NOWARN) set_name(0x8012E844, "disp_tab_r", SN_NOWARN) set_name(0x8012E848, "dispy_r", SN_NOWARN) set_name(0x8012E84C, "disp_tab_g", SN_NOWARN) set_name(0x8012E850, "dispy_g", SN_NOWARN) set_name(0x8012E854, "disp_tab_b", SN_NOWARN) set_name(0x8012E858, "dispy_b", SN_NOWARN) set_name(0x8012E85C, "radius", SN_NOWARN) set_name(0x8012E860, "bright", SN_NOWARN) set_name(0x8012F850, "mult_tab", SN_NOWARN) set_name(0x8012DA78, "lightflag", SN_NOWARN) set_name(0x800C9024, "vCrawlTable", SN_NOWARN) set_name(0x800C92D8, "RadiusAdj", SN_NOWARN) set_name(0x800C8564, "CrawlTable", SN_NOWARN) set_name(0x8012DA7C, "restore_r", SN_NOWARN) set_name(0x8012DA80, "restore_g", SN_NOWARN) set_name(0x8012DA84, "restore_b", SN_NOWARN) set_name(0x800C92F0, "radius_tab", SN_NOWARN) set_name(0x800C9300, "bright_tab", SN_NOWARN) set_name(0x8012DAB9, "qtextflag", SN_NOWARN) set_name(0x8012DABC, "qtextSpd", SN_NOWARN) set_name(0x8012E864, "pMedTextCels", SN_NOWARN) set_name(0x8012E868, "pTextBoxCels", SN_NOWARN) set_name(0x8012E86C, "qtextptr", SN_NOWARN) set_name(0x8012E870, "qtexty", SN_NOWARN) set_name(0x8012E874, "qtextDelay", SN_NOWARN) set_name(0x8012E878, "sgLastScroll", SN_NOWARN) set_name(0x8012E87C, "scrolltexty", SN_NOWARN) set_name(0x8012E880, "sglMusicVolumeSave", SN_NOWARN) set_name(0x8012DAA8, "qtbodge", SN_NOWARN) set_name(0x800C9638, "QBack", SN_NOWARN) set_name(0x800C9648, "missiledata", SN_NOWARN) set_name(0x800C9DB8, "misfiledata", SN_NOWARN) set_name(0x800C9CA8, "MissPrintRoutines", SN_NOWARN) set_name(0x800C9EA4, "sgLevels", SN_NOWARN) set_name(0x800DDBF0, "sgLocals", SN_NOWARN) set_name(0x8012F8D0, "sgJunk", SN_NOWARN) set_name(0x8012E885, "sgbRecvCmd", SN_NOWARN) set_name(0x8012E888, "sgdwRecvOffset", SN_NOWARN) set_name(0x8012E88C, "sgbDeltaChunks", SN_NOWARN) set_name(0x8012E88D, "sgbDeltaChanged", SN_NOWARN) set_name(0x8012E890, "sgdwOwnerWait", SN_NOWARN) set_name(0x8012E894, "sgpMegaPkt", SN_NOWARN) set_name(0x8012E898, "sgpCurrPkt", SN_NOWARN) set_name(0x8012E89C, "sgnCurrMegaPlayer", SN_NOWARN) set_name(0x8012DAD5, "deltaload", SN_NOWARN) set_name(0x8012DAD6, "gbBufferMsgs", SN_NOWARN) set_name(0x8012DAD8, "dwRecCount", SN_NOWARN) set_name(0x8012DADC, "LevelOut", SN_NOWARN) set_name(0x8012DAF2, "gbMaxPlayers", SN_NOWARN) set_name(0x8012DAF3, "gbActivePlayers", SN_NOWARN) set_name(0x8012DAF4, "gbGameDestroyed", SN_NOWARN) set_name(0x8012DAF5, "gbDeltaSender", SN_NOWARN) set_name(0x8012DAF6, "gbSelectProvider", SN_NOWARN) set_name(0x8012DAF7, "gbSomebodyWonGameKludge", SN_NOWARN) set_name(0x8012E8A0, "sgbSentThisCycle", SN_NOWARN) set_name(0x8012E8A4, "sgdwGameLoops", SN_NOWARN) set_name(0x8012E8A8, "sgwPackPlrOffsetTbl", SN_NOWARN) set_name(0x8012E8AC, "sgbPlayerLeftGameTbl", SN_NOWARN) set_name(0x8012E8B0, "sgdwPlayerLeftReasonTbl", SN_NOWARN) set_name(0x8012E8B8, "sgbSendDeltaTbl", SN_NOWARN) set_name(0x8012E8C0, "sgGameInitInfo", SN_NOWARN) set_name(0x8012E8C8, "sgbTimeout", SN_NOWARN) set_name(0x8012E8CC, "sglTimeoutStart", SN_NOWARN) set_name(0x8012DAEC, "gszVersionNumber", SN_NOWARN) set_name(0x8012DAF1, "sgbNetInited", SN_NOWARN) set_name(0x800DEC58, "ObjTypeConv", SN_NOWARN) set_name(0x800DEE1C, "AllObjects", SN_NOWARN) set_name(0x80128CD8, "ObjMasterLoadList", SN_NOWARN) set_name(0x800DF5FC, "object", SN_NOWARN) set_name(0x8012DB18, "numobjects", SN_NOWARN) set_name(0x800E0BD0, "objectactive", SN_NOWARN) set_name(0x800E0C50, "objectavail", SN_NOWARN) set_name(0x8012DB1C, "InitObjFlag", SN_NOWARN) set_name(0x8012DB20, "trapid", SN_NOWARN) set_name(0x800E0CD0, "ObjFileList", SN_NOWARN) set_name(0x8012DB24, "trapdir", SN_NOWARN) set_name(0x8012DB28, "leverid", SN_NOWARN) set_name(0x8012DB10, "numobjfiles", SN_NOWARN) set_name(0x800DF514, "bxadd", SN_NOWARN) set_name(0x800DF534, "byadd", SN_NOWARN) set_name(0x800DF5BC, "shrineavail", SN_NOWARN) set_name(0x800DF554, "shrinestrs", SN_NOWARN) set_name(0x800DF5D8, "StoryBookName", SN_NOWARN) set_name(0x8012DB14, "myscale", SN_NOWARN) set_name(0x8012DB3C, "gbValidSaveFile", SN_NOWARN) set_name(0x8012DB38, "DoLoadedChar", SN_NOWARN) set_name(0x800E0EF0, "plr", SN_NOWARN) set_name(0x8012DB5C, "myplr", SN_NOWARN) set_name(0x8012DB60, "deathdelay", SN_NOWARN) set_name(0x8012DB64, "deathflag", SN_NOWARN) set_name(0x8012DB65, "light_rad", SN_NOWARN) set_name(0x8012DB54, "light_level", SN_NOWARN) set_name(0x800E0DE8, "MaxStats", SN_NOWARN) set_name(0x8012DB4C, "PlrStructSize", SN_NOWARN) set_name(0x8012DB50, "ItemStructSize", SN_NOWARN) set_name(0x800E0CF8, "plrxoff", SN_NOWARN) set_name(0x800E0D1C, "plryoff", SN_NOWARN) set_name(0x800E0D40, "plrxoff2", SN_NOWARN) set_name(0x800E0D64, "plryoff2", SN_NOWARN) set_name(0x800E0D88, "PlrGFXAnimLens", SN_NOWARN) set_name(0x800E0DAC, "StrengthTbl", SN_NOWARN) set_name(0x800E0DB8, "MagicTbl", SN_NOWARN) set_name(0x800E0DC4, "DexterityTbl", SN_NOWARN) set_name(0x800E0DD0, "VitalityTbl", SN_NOWARN) set_name(0x800E0DDC, "ToBlkTbl", SN_NOWARN) set_name(0x800E0E18, "ExpLvlsTbl", SN_NOWARN) set_name(0x800E5778, "quests", SN_NOWARN) set_name(0x8012DB94, "pQLogCel", SN_NOWARN) set_name(0x8012DB98, "ReturnLvlX", SN_NOWARN) set_name(0x8012DB9C, "ReturnLvlY", SN_NOWARN) set_name(0x8012DBA0, "ReturnLvl", SN_NOWARN) set_name(0x8012DBA4, "ReturnLvlT", SN_NOWARN) set_name(0x8012DBA8, "rporttest", SN_NOWARN) set_name(0x8012DBAC, "qline", SN_NOWARN) set_name(0x8012DBB0, "numqlines", SN_NOWARN) set_name(0x8012DBB4, "qtopline", SN_NOWARN) set_name(0x8012F8E8, "qlist", SN_NOWARN) set_name(0x8012E8D0, "QSRect", SN_NOWARN) set_name(0x8012DB71, "questlog", SN_NOWARN) set_name(0x800E5640, "questlist", SN_NOWARN) set_name(0x8012DB74, "ALLQUESTS", SN_NOWARN) set_name(0x800E5754, "QuestGroup1", SN_NOWARN) set_name(0x800E5760, "QuestGroup2", SN_NOWARN) set_name(0x800E576C, "QuestGroup3", SN_NOWARN) set_name(0x8012DB78, "QuestGroup4", SN_NOWARN) set_name(0x8012DB90, "WaterDone", SN_NOWARN) set_name(0x800E5740, "questtrigstr", SN_NOWARN) set_name(0x8012DB80, "QS_PX", SN_NOWARN) set_name(0x8012DB84, "QS_PY", SN_NOWARN) set_name(0x8012DB88, "QS_PW", SN_NOWARN) set_name(0x8012DB8C, "QS_PH", SN_NOWARN) set_name(0x8012F928, "QSBack", SN_NOWARN) set_name(0x800E58B8, "spelldata", SN_NOWARN) set_name(0x8012DBEF, "stextflag", SN_NOWARN) set_name(0x800E6160, "smithitem", SN_NOWARN) set_name(0x800E6D40, "premiumitem", SN_NOWARN) set_name(0x8012DBF0, "numpremium", SN_NOWARN) set_name(0x8012DBF4, "premiumlevel", SN_NOWARN) set_name(0x800E70D0, "witchitem", SN_NOWARN) set_name(0x800E7CB0, "boyitem", SN_NOWARN) set_name(0x8012DBF8, "boylevel", SN_NOWARN) set_name(0x800E7D48, "golditem", SN_NOWARN) set_name(0x800E7DE0, "healitem", SN_NOWARN) set_name(0x8012DBFC, "stextsize", SN_NOWARN) set_name(0x8012DBFD, "stextscrl", SN_NOWARN) set_name(0x8012E8D8, "stextsel", SN_NOWARN) set_name(0x8012E8DC, "stextlhold", SN_NOWARN) set_name(0x8012E8E0, "stextshold", SN_NOWARN) set_name(0x8012E8E4, "stextvhold", SN_NOWARN) set_name(0x8012E8E8, "stextsval", SN_NOWARN) set_name(0x8012E8EC, "stextsmax", SN_NOWARN) set_name(0x8012E8F0, "stextup", SN_NOWARN) set_name(0x8012E8F4, "stextdown", SN_NOWARN) set_name(0x8012E8F8, "stextscrlubtn", SN_NOWARN) set_name(0x8012E8F9, "stextscrldbtn", SN_NOWARN) set_name(0x8012E8FA, "SItemListFlag", SN_NOWARN) set_name(0x8012F938, "stext", SN_NOWARN) set_name(0x800E89C0, "storehold", SN_NOWARN) set_name(0x800EA640, "storehidx", SN_NOWARN) set_name(0x8012E8FC, "storenumh", SN_NOWARN) set_name(0x8012E900, "gossipstart", SN_NOWARN) set_name(0x8012E904, "gossipend", SN_NOWARN) set_name(0x8012E908, "StoreBackRect", SN_NOWARN) set_name(0x8012E910, "talker", SN_NOWARN) set_name(0x8012DBDC, "pSTextBoxCels", SN_NOWARN) set_name(0x8012DBE0, "pSTextSlidCels", SN_NOWARN) set_name(0x8012DBE4, "SStringY", SN_NOWARN) set_name(0x800E603C, "SBack", SN_NOWARN) set_name(0x800E604C, "SStringYNorm", SN_NOWARN) set_name(0x800E609C, "SStringYBuy0", SN_NOWARN) set_name(0x800E60EC, "SStringYBuy1", SN_NOWARN) set_name(0x800E613C, "talkname", SN_NOWARN) set_name(0x8012DBEE, "InStoreFlag", SN_NOWARN) set_name(0x8012A024, "alltext", SN_NOWARN) set_name(0x8012DC0C, "gdwAllTextEntries", SN_NOWARN) set_name(0x8012E914, "P3Tiles", SN_NOWARN) set_name(0x8012DC1C, "tile", SN_NOWARN) set_name(0x8012DC2C, "_trigflag", SN_NOWARN) set_name(0x800EA8A8, "trigs", SN_NOWARN) set_name(0x8012DC30, "numtrigs", SN_NOWARN) set_name(0x8012DC34, "townwarps", SN_NOWARN) set_name(0x8012DC38, "TWarpFrom", SN_NOWARN) set_name(0x800EA670, "TownDownList", SN_NOWARN) set_name(0x800EA69C, "TownWarp1List", SN_NOWARN) set_name(0x800EA6D0, "L1UpList", SN_NOWARN) set_name(0x800EA700, "L1DownList", SN_NOWARN) set_name(0x800EA728, "L2UpList", SN_NOWARN) set_name(0x800EA734, "L2DownList", SN_NOWARN) set_name(0x800EA748, "L2TWarpUpList", SN_NOWARN) set_name(0x800EA754, "L3UpList", SN_NOWARN) set_name(0x800EA790, "L3DownList", SN_NOWARN) set_name(0x800EA7B4, "L3TWarpUpList", SN_NOWARN) set_name(0x800EA7EC, "L4UpList", SN_NOWARN) set_name(0x800EA7FC, "L4DownList", SN_NOWARN) set_name(0x800EA814, "L4TWarpUpList", SN_NOWARN) set_name(0x800EA824, "L4PentaList", SN_NOWARN) set_name(0x8012DC51, "gbSndInited", SN_NOWARN) set_name(0x8012DC54, "sglMasterVolume", SN_NOWARN) set_name(0x8012DC58, "sglMusicVolume", SN_NOWARN) set_name(0x8012DC5C, "sglSoundVolume", SN_NOWARN) set_name(0x8012DC60, "sglSpeechVolume", SN_NOWARN) set_name(0x8012DC64, "sgnMusicTrack", SN_NOWARN) set_name(0x8012DC52, "gbDupSounds", SN_NOWARN) set_name(0x8012DC68, "sghMusic", SN_NOWARN) set_name(0x8012AE58, "sgszMusicTracks", SN_NOWARN) set_name(0x8012DC80, "_pcurr_inv", SN_NOWARN) set_name(0x800EA8F8, "_pfind_list", SN_NOWARN) set_name(0x8012DC88, "_pfind_index", SN_NOWARN) set_name(0x8012DC8C, "_pfindx", SN_NOWARN) set_name(0x8012DC90, "_pfindy", SN_NOWARN) set_name(0x8012DC92, "automapmoved", SN_NOWARN) set_name(0x8012DC75, "flyflag", SN_NOWARN) set_name(0x8012DC76, "seen_combo", SN_NOWARN) set_name(0x80130658, "GPad1", SN_NOWARN) set_name(0x801306F8, "GPad2", SN_NOWARN) set_name(0x8012E918, "CurrentProc", SN_NOWARN) set_name(0x8012AFEC, "AllMsgs", SN_NOWARN) set_name(0x8012DCCC, "NumOfStrings", SN_NOWARN) set_name(0x8012DCA0, "LanguageType", SN_NOWARN) set_name(0x8012DCA4, "hndText", SN_NOWARN) set_name(0x8012DCA8, "TextPtr", SN_NOWARN) set_name(0x8012DCAC, "LangDbNo", SN_NOWARN) set_name(0x8012DCDC, "MissDat", SN_NOWARN) set_name(0x8012DCE0, "CharFade", SN_NOWARN) set_name(0x8012DCE4, "rotateness", SN_NOWARN) set_name(0x8012DCE8, "spiralling_shape", SN_NOWARN) set_name(0x8012DCEC, "down", SN_NOWARN) set_name(0x800EA948, "MlTab", SN_NOWARN) set_name(0x800EA958, "QlTab", SN_NOWARN) set_name(0x800EA968, "ObjPrintFuncs", SN_NOWARN) set_name(0x8012DD08, "MyXoff1", SN_NOWARN) set_name(0x8012DD0C, "MyYoff1", SN_NOWARN) set_name(0x8012DD10, "MyXoff2", SN_NOWARN) set_name(0x8012DD14, "MyYoff2", SN_NOWARN) set_name(0x8012DD24, "iscflag", SN_NOWARN) set_name(0x8012DD31, "sgbFadedIn", SN_NOWARN) set_name(0x8012DD32, "screenbright", SN_NOWARN) set_name(0x8012DD34, "faderate", SN_NOWARN) set_name(0x8012DD38, "fading", SN_NOWARN) set_name(0x8012DD44, "FadeCoords", SN_NOWARN) set_name(0x8012DD3C, "st", SN_NOWARN) set_name(0x8012DD40, "mode", SN_NOWARN) set_name(0x800EAAF0, "portal", SN_NOWARN) set_name(0x8012DD76, "portalindex", SN_NOWARN) set_name(0x8012DD70, "WarpDropX", SN_NOWARN) set_name(0x8012DD74, "WarpDropY", SN_NOWARN) set_name(0x800EAB08, "MyVerString", SN_NOWARN) set_name(0x8012DED4, "Year", SN_NOWARN) set_name(0x8012DED8, "Day", SN_NOWARN) set_name(0x8012E91C, "tbuff", SN_NOWARN) set_name(0x800EAB80, "IconBuffer", SN_NOWARN) set_name(0x8012E920, "HR1", SN_NOWARN) set_name(0x8012E921, "HR2", SN_NOWARN) set_name(0x8012E922, "HR3", SN_NOWARN) set_name(0x8012E923, "VR1", SN_NOWARN) set_name(0x8012E924, "VR2", SN_NOWARN) set_name(0x8012E925, "VR3", SN_NOWARN) set_name(0x8012DF48, "pHallList", SN_NOWARN) set_name(0x8012DF4C, "nRoomCnt", SN_NOWARN) set_name(0x8012DF50, "nSx1", SN_NOWARN) set_name(0x8012DF54, "nSy1", SN_NOWARN) set_name(0x8012DF58, "nSx2", SN_NOWARN) set_name(0x8012DF5C, "nSy2", SN_NOWARN) set_name(0x8012DF00, "Area_Min", SN_NOWARN) set_name(0x8012DF04, "Room_Max", SN_NOWARN) set_name(0x8012DF08, "Room_Min", SN_NOWARN) set_name(0x8012DF0C, "BIG3", SN_NOWARN) set_name(0x8012DF14, "BIG4", SN_NOWARN) set_name(0x8012DF1C, "BIG6", SN_NOWARN) set_name(0x8012DF24, "BIG7", SN_NOWARN) set_name(0x8012DF2C, "RUINS1", SN_NOWARN) set_name(0x8012DF30, "RUINS2", SN_NOWARN) set_name(0x8012DF34, "RUINS3", SN_NOWARN) set_name(0x8012DF38, "RUINS4", SN_NOWARN) set_name(0x8012DF3C, "RUINS5", SN_NOWARN) set_name(0x8012DF40, "RUINS6", SN_NOWARN) set_name(0x8012DF44, "RUINS7", SN_NOWARN) set_name(0x8012E928, "abyssx", SN_NOWARN) set_name(0x8012E92C, "lavapool", SN_NOWARN) set_name(0x8012DFE8, "lockoutcnt", SN_NOWARN) set_name(0x8012DF6C, "L3TITE12", SN_NOWARN) set_name(0x8012DF74, "L3TITE13", SN_NOWARN) set_name(0x8012DF7C, "L3CREV1", SN_NOWARN) set_name(0x8012DF84, "L3CREV2", SN_NOWARN) set_name(0x8012DF8C, "L3CREV3", SN_NOWARN) set_name(0x8012DF94, "L3CREV4", SN_NOWARN) set_name(0x8012DF9C, "L3CREV5", SN_NOWARN) set_name(0x8012DFA4, "L3CREV6", SN_NOWARN) set_name(0x8012DFAC, "L3CREV7", SN_NOWARN) set_name(0x8012DFB4, "L3CREV8", SN_NOWARN) set_name(0x8012DFBC, "L3CREV9", SN_NOWARN) set_name(0x8012DFC4, "L3CREV10", SN_NOWARN) set_name(0x8012DFCC, "L3CREV11", SN_NOWARN) set_name(0x8012DFD4, "L3XTRA1", SN_NOWARN) set_name(0x8012DFD8, "L3XTRA2", SN_NOWARN) set_name(0x8012DFDC, "L3XTRA3", SN_NOWARN) set_name(0x8012DFE0, "L3XTRA4", SN_NOWARN) set_name(0x8012DFE4, "L3XTRA5", SN_NOWARN) set_name(0x8012DFEC, "diabquad1x", SN_NOWARN) set_name(0x8012DFF0, "diabquad2x", SN_NOWARN) set_name(0x8012DFF4, "diabquad3x", SN_NOWARN) set_name(0x8012DFF8, "diabquad4x", SN_NOWARN) set_name(0x8012DFFC, "diabquad1y", SN_NOWARN) set_name(0x8012E000, "diabquad2y", SN_NOWARN) set_name(0x8012E004, "diabquad3y", SN_NOWARN) set_name(0x8012E008, "diabquad4y", SN_NOWARN) set_name(0x8012E00C, "SP4x1", SN_NOWARN) set_name(0x8012E010, "SP4y1", SN_NOWARN) set_name(0x8012E014, "SP4x2", SN_NOWARN) set_name(0x8012E018, "SP4y2", SN_NOWARN) set_name(0x8012E01C, "l4holdx", SN_NOWARN) set_name(0x8012E020, "l4holdy", SN_NOWARN) set_name(0x8012E930, "lpSetPiece1", SN_NOWARN) set_name(0x8012E934, "lpSetPiece2", SN_NOWARN) set_name(0x8012E938, "lpSetPiece3", SN_NOWARN) set_name(0x8012E93C, "lpSetPiece4", SN_NOWARN) set_name(0x8012E940, "lppSetPiece2", SN_NOWARN) set_name(0x8012E944, "lppSetPiece3", SN_NOWARN) set_name(0x8012E948, "lppSetPiece4", SN_NOWARN) set_name(0x8012E030, "SkelKingTrans1", SN_NOWARN) set_name(0x8012E038, "SkelKingTrans2", SN_NOWARN) set_name(0x800EAE80, "SkelKingTrans3", SN_NOWARN) set_name(0x800EAE94, "SkelKingTrans4", SN_NOWARN) set_name(0x800EAEB0, "SkelChamTrans1", SN_NOWARN) set_name(0x8012E040, "SkelChamTrans2", SN_NOWARN) set_name(0x800EAEC4, "SkelChamTrans3", SN_NOWARN) set_name(0x8012E134, "DoUiForChooseMonster", SN_NOWARN) set_name(0x800EAEE8, "MgToText", SN_NOWARN) set_name(0x800EAF70, "StoryText", SN_NOWARN) set_name(0x800EAF94, "dungeon", SN_NOWARN) set_name(0x800EC194, "pdungeon", SN_NOWARN) set_name(0x800EC7D4, "dflags", SN_NOWARN) set_name(0x8012E158, "setpc_x", SN_NOWARN) set_name(0x8012E15C, "setpc_y", SN_NOWARN) set_name(0x8012E160, "setpc_w", SN_NOWARN) set_name(0x8012E164, "setpc_h", SN_NOWARN) set_name(0x8012E168, "setloadflag", SN_NOWARN) set_name(0x8012E16C, "pMegaTiles", SN_NOWARN) set_name(0x800ECE14, "nBlockTable", SN_NOWARN) set_name(0x800ED618, "nSolidTable", SN_NOWARN) set_name(0x800EDE1C, "nTransTable", SN_NOWARN) set_name(0x800EE620, "nMissileTable", SN_NOWARN) set_name(0x800EEE24, "nTrapTable", SN_NOWARN) set_name(0x8012E170, "dminx", SN_NOWARN) set_name(0x8012E174, "dminy", SN_NOWARN) set_name(0x8012E178, "dmaxx", SN_NOWARN) set_name(0x8012E17C, "dmaxy", SN_NOWARN) set_name(0x8012E180, "gnDifficulty", SN_NOWARN) set_name(0x8012E184, "currlevel", SN_NOWARN) set_name(0x8012E185, "leveltype", SN_NOWARN) set_name(0x8012E186, "setlevel", SN_NOWARN) set_name(0x8012E187, "setlvlnum", SN_NOWARN) set_name(0x8012E188, "setlvltype", SN_NOWARN) set_name(0x8012E18C, "ViewX", SN_NOWARN) set_name(0x8012E190, "ViewY", SN_NOWARN) set_name(0x8012E194, "ViewDX", SN_NOWARN) set_name(0x8012E198, "ViewDY", SN_NOWARN) set_name(0x8012E19C, "ViewBX", SN_NOWARN) set_name(0x8012E1A0, "ViewBY", SN_NOWARN) set_name(0x800EF628, "ScrollInfo", SN_NOWARN) set_name(0x8012E1A4, "LvlViewX", SN_NOWARN) set_name(0x8012E1A8, "LvlViewY", SN_NOWARN) set_name(0x8012E1AC, "btmbx", SN_NOWARN) set_name(0x8012E1B0, "btmby", SN_NOWARN) set_name(0x8012E1B4, "btmdx", SN_NOWARN) set_name(0x8012E1B8, "btmdy", SN_NOWARN) set_name(0x8012E1BC, "MicroTileLen", SN_NOWARN) set_name(0x8012E1C0, "TransVal", SN_NOWARN) set_name(0x800EF63C, "TransList", SN_NOWARN) set_name(0x8012E1C4, "themeCount", SN_NOWARN) set_name(0x800EF65C, "dung_map", SN_NOWARN) set_name(0x8011191C, "dung_map_r", SN_NOWARN) set_name(0x80112480, "dung_map_g", SN_NOWARN) set_name(0x80112FE4, "dung_map_b", SN_NOWARN) set_name(0x80113B48, "MinisetXY", SN_NOWARN) set_name(0x8012E150, "pSetPiece", SN_NOWARN) set_name(0x8012E154, "DungSize", SN_NOWARN) set_name(0x80113D14, "theme", SN_NOWARN) set_name(0x8012E204, "numthemes", SN_NOWARN) set_name(0x8012E208, "zharlib", SN_NOWARN) set_name(0x8012E20C, "armorFlag", SN_NOWARN) set_name(0x8012E20D, "bCrossFlag", SN_NOWARN) set_name(0x8012E20E, "weaponFlag", SN_NOWARN) set_name(0x8012E210, "themex", SN_NOWARN) set_name(0x8012E214, "themey", SN_NOWARN) set_name(0x8012E218, "themeVar1", SN_NOWARN) set_name(0x8012E21C, "bFountainFlag", SN_NOWARN) set_name(0x8012E21D, "cauldronFlag", SN_NOWARN) set_name(0x8012E21E, "mFountainFlag", SN_NOWARN) set_name(0x8012E21F, "pFountainFlag", SN_NOWARN) set_name(0x8012E220, "tFountainFlag", SN_NOWARN) set_name(0x8012E221, "treasureFlag", SN_NOWARN) set_name(0x8012E224, "ThemeGoodIn", SN_NOWARN) set_name(0x80113BF4, "ThemeGood", SN_NOWARN) set_name(0x80113C04, "trm5x", SN_NOWARN) set_name(0x80113C68, "trm5y", SN_NOWARN) set_name(0x80113CCC, "trm3x", SN_NOWARN) set_name(0x80113CF0, "trm3y", SN_NOWARN) set_name(0x8012E2FC, "nummissiles", SN_NOWARN) set_name(0x80113F2C, "missileactive", SN_NOWARN) set_name(0x80114120, "missileavail", SN_NOWARN) set_name(0x8012E300, "MissilePreFlag", SN_NOWARN) set_name(0x80114314, "missile", SN_NOWARN) set_name(0x8012E301, "ManashieldFlag", SN_NOWARN) set_name(0x8012E302, "ManashieldFlag2", SN_NOWARN) set_name(0x80113EA4, "XDirAdd", SN_NOWARN) set_name(0x80113EC4, "YDirAdd", SN_NOWARN) set_name(0x8012E2C9, "fadetor", SN_NOWARN) set_name(0x8012E2CA, "fadetog", SN_NOWARN) set_name(0x8012E2CB, "fadetob", SN_NOWARN) set_name(0x80113EE4, "ValueTable", SN_NOWARN) set_name(0x80113EF4, "StringTable", SN_NOWARN) set_name(0x80116BC4, "monster", SN_NOWARN) set_name(0x8012E364, "nummonsters", SN_NOWARN) set_name(0x8011C344, "monstactive", SN_NOWARN) set_name(0x8011C4D4, "monstkills", SN_NOWARN) set_name(0x8011C664, "Monsters", SN_NOWARN) set_name(0x8012E368, "monstimgtot", SN_NOWARN) set_name(0x8012E36C, "totalmonsters", SN_NOWARN) set_name(0x8012E370, "uniquetrans", SN_NOWARN) set_name(0x8012E94C, "sgbSaveSoundOn", SN_NOWARN) set_name(0x8012E334, "offset_x", SN_NOWARN) set_name(0x8012E33C, "offset_y", SN_NOWARN) set_name(0x8012E31C, "left", SN_NOWARN) set_name(0x8012E324, "right", SN_NOWARN) set_name(0x8012E32C, "opposite", SN_NOWARN) set_name(0x8012E310, "nummtypes", SN_NOWARN) set_name(0x8012E314, "animletter", SN_NOWARN) set_name(0x80116A24, "MWVel", SN_NOWARN) set_name(0x8012E344, "rnd5", SN_NOWARN) set_name(0x8012E348, "rnd10", SN_NOWARN) set_name(0x8012E34C, "rnd20", SN_NOWARN) set_name(0x8012E350, "rnd60", SN_NOWARN) set_name(0x80116B44, "AiProc", SN_NOWARN) set_name(0x8011CB3C, "monsterdata", SN_NOWARN) set_name(0x8011E57C, "MonstConvTbl", SN_NOWARN) set_name(0x8011E5FC, "MonstAvailTbl", SN_NOWARN) set_name(0x8011E66C, "UniqMonst", SN_NOWARN) set_name(0x8011C924, "TransPals", SN_NOWARN) set_name(0x8011C824, "StonePals", SN_NOWARN) set_name(0x8012E3A8, "invflag", SN_NOWARN) set_name(0x8012E3A9, "drawsbarflag", SN_NOWARN) set_name(0x8012E3AC, "InvBackY", SN_NOWARN) set_name(0x8012E3B0, "InvCursPos", SN_NOWARN) set_name(0x8011F614, "InvSlotTable", SN_NOWARN) set_name(0x8012E3B4, "InvBackAY", SN_NOWARN) set_name(0x8012E3B8, "InvSel", SN_NOWARN) set_name(0x8012E3BC, "ItemW", SN_NOWARN) set_name(0x8012E3C0, "ItemH", SN_NOWARN) set_name(0x8012E3C4, "ItemNo", SN_NOWARN) set_name(0x8012E3C8, "BRect", SN_NOWARN) set_name(0x8012E390, "InvPanelTData", SN_NOWARN) set_name(0x8012E394, "InvGfxTData", SN_NOWARN) set_name(0x8012E38C, "InvPageNo", SN_NOWARN) set_name(0x8011EF9C, "AP2x2Tbl", SN_NOWARN) set_name(0x8011EFC4, "InvRect", SN_NOWARN) set_name(0x8011F20C, "InvGfxTable", SN_NOWARN) set_name(0x8011F4AC, "InvItemWidth", SN_NOWARN) set_name(0x8011F560, "InvItemHeight", SN_NOWARN) set_name(0x8012E3A0, "InvOn", SN_NOWARN) set_name(0x8012E3A4, "sgdwLastTime", SN_NOWARN) set_name(0x8012E3FF, "automapflag", SN_NOWARN) set_name(0x8011F678, "automapview", SN_NOWARN) set_name(0x8011F740, "automaptype", SN_NOWARN) set_name(0x8012E400, "AMLWallFlag", SN_NOWARN) set_name(0x8012E401, "AMRWallFlag", SN_NOWARN) set_name(0x8012E402, "AMLLWallFlag", SN_NOWARN) set_name(0x8012E403, "AMLRWallFlag", SN_NOWARN) set_name(0x8012E404, "AMDirtFlag", SN_NOWARN) set_name(0x8012E405, "AMColumnFlag", SN_NOWARN) set_name(0x8012E406, "AMStairFlag", SN_NOWARN) set_name(0x8012E407, "AMLDoorFlag", SN_NOWARN) set_name(0x8012E408, "AMLGrateFlag", SN_NOWARN) set_name(0x8012E409, "AMLArchFlag", SN_NOWARN) set_name(0x8012E40A, "AMRDoorFlag", SN_NOWARN) set_name(0x8012E40B, "AMRGrateFlag", SN_NOWARN) set_name(0x8012E40C, "AMRArchFlag", SN_NOWARN) set_name(0x8012E410, "AutoMapX", SN_NOWARN) set_name(0x8012E414, "AutoMapY", SN_NOWARN) set_name(0x8012E418, "AutoMapXOfs", SN_NOWARN) set_name(0x8012E41C, "AutoMapYOfs", SN_NOWARN) set_name(0x8012E420, "AMPlayerX", SN_NOWARN) set_name(0x8012E424, "AMPlayerY", SN_NOWARN) set_name(0x8012E3DC, "AutoMapScale", SN_NOWARN) set_name(0x8012E3E0, "AutoMapPlayerR", SN_NOWARN) set_name(0x8012E3E1, "AutoMapPlayerG", SN_NOWARN) set_name(0x8012E3E2, "AutoMapPlayerB", SN_NOWARN) set_name(0x8012E3E3, "AutoMapWallR", SN_NOWARN) set_name(0x8012E3E4, "AutoMapWallG", SN_NOWARN) set_name(0x8012E3E5, "AutoMapWallB", SN_NOWARN) set_name(0x8012E3E6, "AutoMapDoorR", SN_NOWARN) set_name(0x8012E3E7, "AutoMapDoorG", SN_NOWARN) set_name(0x8012E3E8, "AutoMapDoorB", SN_NOWARN) set_name(0x8012E3E9, "AutoMapColumnR", SN_NOWARN) set_name(0x8012E3EA, "AutoMapColumnG", SN_NOWARN) set_name(0x8012E3EB, "AutoMapColumnB", SN_NOWARN) set_name(0x8012E3EC, "AutoMapArchR", SN_NOWARN) set_name(0x8012E3ED, "AutoMapArchG", SN_NOWARN) set_name(0x8012E3EE, "AutoMapArchB", SN_NOWARN) set_name(0x8012E3EF, "AutoMapStairR", SN_NOWARN) set_name(0x8012E3F0, "AutoMapStairG", SN_NOWARN) set_name(0x8012E3F1, "AutoMapStairB", SN_NOWARN) set_name(0x8011F660, "SetLevelName", SN_NOWARN) set_name(0x8012EAA8, "GazTick", SN_NOWARN) set_name(0x80135560, "RndTabs", SN_NOWARN) set_name(0x800A89D4, "DefaultRnd", SN_NOWARN) set_name(0x8012EAD0, "PollFunc", SN_NOWARN) set_name(0x8012EAB4, "MsgFunc", SN_NOWARN) set_name(0x8012EB00, "ErrorFunc", SN_NOWARN) set_name(0x8012E9D4, "ActiveTasks", SN_NOWARN) set_name(0x8012E9D8, "CurrentTask", SN_NOWARN) set_name(0x8012E9DC, "T", SN_NOWARN) set_name(0x8012E9E0, "MemTypeForTasker", SN_NOWARN) set_name(0x80132D90, "SchEnv", SN_NOWARN) set_name(0x8012E9E4, "ExecId", SN_NOWARN) set_name(0x8012E9E8, "ExecMask", SN_NOWARN) set_name(0x8012E9EC, "TasksActive", SN_NOWARN) set_name(0x8012E9F0, "EpiFunc", SN_NOWARN) set_name(0x8012E9F4, "ProFunc", SN_NOWARN) set_name(0x8012E9F8, "EpiProId", SN_NOWARN) set_name(0x8012E9FC, "EpiProMask", SN_NOWARN) set_name(0x8012EA00, "DoTasksPrologue", SN_NOWARN) set_name(0x8012EA04, "DoTasksEpilogue", SN_NOWARN) set_name(0x8012EA08, "StackFloodCallback", SN_NOWARN) set_name(0x8012EA0C, "ExtraStackProtection", SN_NOWARN) set_name(0x8012EA10, "ExtraStackSizeLongs", SN_NOWARN) set_name(0x8012EABC, "LastPtr", SN_NOWARN) set_name(0x800A8A0C, "WorkMemInfo", SN_NOWARN) set_name(0x8012EA14, "MemInitBlocks", SN_NOWARN) set_name(0x80132DC0, "MemHdrBlocks", SN_NOWARN) set_name(0x8012EA18, "FreeBlocks", SN_NOWARN) set_name(0x8012EA1C, "LastError", SN_NOWARN) set_name(0x8012EA20, "TimeStamp", SN_NOWARN) set_name(0x8012EA24, "FullErrorChecking", SN_NOWARN) set_name(0x8012EA28, "LastAttemptedAlloc", SN_NOWARN) set_name(0x8012EA2C, "LastDeallocedBlock", SN_NOWARN) set_name(0x8012EA30, "VerbLev", SN_NOWARN) set_name(0x8012EA34, "NumOfFreeHdrs", SN_NOWARN) set_name(0x8012EA38, "LastTypeAlloced", SN_NOWARN) set_name(0x8012EA3C, "AllocFilter", SN_NOWARN) set_name(0x800A8A14, "GalErrors", SN_NOWARN) set_name(0x800A8A3C, "PhantomMem", SN_NOWARN) set_name(0x80133F40, "buf", SN_NOWARN) set_name(0x800A8A64, "NULL_REP", SN_NOWARN)
0.16175
0.060891
import sys import dlib import cv2 import os import argparse import largest_face_detector import copy Images_Folder = 'train/personB' OutFace_Folder = 'train/personB_face/' Images_Path = os.path.join(os.path.realpath('.'), Images_Folder) Out_Path = os.path.join(os.path.realpath('.'), OutFace_Folder) pictures = os.listdir(Images_Path) # initialize hog + svm based face detector detector = dlib.get_frontal_face_detector() # # handle command line arguments # ap = argparse.ArgumentParser() # ap.add_argument('-w', '--weights', default='./mmod_human_face_detector.dat', # help='path to weights file') # args = ap.parse_args() # # initialize CNN based face detector # detector = dlib.cnn_face_detection_model_v1(args.weights) print(pictures) def rotate(img): rows,cols,_ = img.shape M = cv2.getRotationMatrix2D((cols, rows ), 0, 1) dst = cv2.warpAffine(img, M, (cols, rows)) return dst for f in pictures: print('processing image') img = cv2.imread(os.path.join(Images_Path,f), cv2.IMREAD_COLOR) b, g, r = cv2.split(img) img2 = cv2.merge([r, g, b]) img = rotate(img) # f_copy = copy.deepcopy(f) # image = largest_face_detector.detect_largest_face(str(Images_Path)+'/'+str(f_copy)) # cv2.imwrite(OutFace_Folder+f_copy[:-4]+"_large_face.jpg", image) print(' processing image 2') dets = detector(img, 1) print("Number of faces detected: {}".format(len(dets))) for idx, face in enumerate(dets): # print('face{}; left{}; top {}; right {}; bot {}'.format(idx, face.left(). face.top(), face.right(), face.bottom())) left = face.left() top = face.top() right = face.right() bot = face.bottom() #print(left, top, right, bot) #cv2.rectangle(img, (left, top), (right, bot), (0, 255, 0), 3) #print(img.shape) crop_img = img[top:bot, left:right] #cv2.imshow(f, img) #cv2.imshow(f, crop_img) print(OutFace_Folder,f[:-4],"_face.jpg") cv2.imwrite(OutFace_Folder+f[:-4]+"_face.jpg", crop_img) #k = cv2.waitKey(1000) #cv2.destroyAllWindows()
Ref/deepfake-pytorch/crop_face.py
import sys import dlib import cv2 import os import argparse import largest_face_detector import copy Images_Folder = 'train/personB' OutFace_Folder = 'train/personB_face/' Images_Path = os.path.join(os.path.realpath('.'), Images_Folder) Out_Path = os.path.join(os.path.realpath('.'), OutFace_Folder) pictures = os.listdir(Images_Path) # initialize hog + svm based face detector detector = dlib.get_frontal_face_detector() # # handle command line arguments # ap = argparse.ArgumentParser() # ap.add_argument('-w', '--weights', default='./mmod_human_face_detector.dat', # help='path to weights file') # args = ap.parse_args() # # initialize CNN based face detector # detector = dlib.cnn_face_detection_model_v1(args.weights) print(pictures) def rotate(img): rows,cols,_ = img.shape M = cv2.getRotationMatrix2D((cols, rows ), 0, 1) dst = cv2.warpAffine(img, M, (cols, rows)) return dst for f in pictures: print('processing image') img = cv2.imread(os.path.join(Images_Path,f), cv2.IMREAD_COLOR) b, g, r = cv2.split(img) img2 = cv2.merge([r, g, b]) img = rotate(img) # f_copy = copy.deepcopy(f) # image = largest_face_detector.detect_largest_face(str(Images_Path)+'/'+str(f_copy)) # cv2.imwrite(OutFace_Folder+f_copy[:-4]+"_large_face.jpg", image) print(' processing image 2') dets = detector(img, 1) print("Number of faces detected: {}".format(len(dets))) for idx, face in enumerate(dets): # print('face{}; left{}; top {}; right {}; bot {}'.format(idx, face.left(). face.top(), face.right(), face.bottom())) left = face.left() top = face.top() right = face.right() bot = face.bottom() #print(left, top, right, bot) #cv2.rectangle(img, (left, top), (right, bot), (0, 255, 0), 3) #print(img.shape) crop_img = img[top:bot, left:right] #cv2.imshow(f, img) #cv2.imshow(f, crop_img) print(OutFace_Folder,f[:-4],"_face.jpg") cv2.imwrite(OutFace_Folder+f[:-4]+"_face.jpg", crop_img) #k = cv2.waitKey(1000) #cv2.destroyAllWindows()
0.188026
0.136464
import unittest from kubedriver.kubeobjects.names import NameHelper class TestNameHelper(unittest.TestCase): def setUp(self): self.helper = NameHelper() def test_is_valid_subdomain_name_allows_lowercase(self): valid, reason = self.helper.is_valid_subdomain_name('testing') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_uppercase(self): valid, reason = self.helper.is_valid_subdomain_name('tESting') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 1\']') self.assertFalse(valid) def test_is_valid_subdomain_name_allows_dots(self): valid, reason = self.helper.is_valid_subdomain_name('testing.dots') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_allows_dash(self): valid, reason = self.helper.is_valid_subdomain_name('testing-dashes') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_non_alphanumeric_start(self): valid, reason = self.helper.is_valid_subdomain_name('-non-alphanum-start') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid start\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_non_alphanumeric_end(self): valid, reason = self.helper.is_valid_subdomain_name('non-alphanum-end-') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 16\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_special_character(self): valid, reason = self.helper.is_valid_subdomain_name('testing@specialchars') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_exceed_max_length(self): test_str = 'a' * 254 valid, reason = self.helper.is_valid_subdomain_name(test_str) self.assertEqual(reason, 'Subdomain names must contain no more than 253 characters -> Contained 254') self.assertFalse(valid) def test_is_valid_subdomain_name_allows_string_at_max_length(self): test_str = 'a' * 253 valid, reason = self.helper.is_valid_subdomain_name(test_str) self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_none(self): valid, reason = self.helper.is_valid_subdomain_name(None) self.assertEqual(reason, 'Subdomains cannot be empty') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_empty_string(self): valid, reason = self.helper.is_valid_subdomain_name('') self.assertEqual(reason, 'Subdomains cannot be empty') self.assertFalse(valid) def test_is_valid_label_name_allows_lowercase(self): valid, reason = self.helper.is_valid_label_name('testing') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_uppercase(self): valid, reason = self.helper.is_valid_label_name('tESting') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 1\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_dots(self): valid, reason = self.helper.is_valid_label_name('testing.dots') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_label_name_allows_dash(self): valid, reason = self.helper.is_valid_label_name('testing-dashes') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_non_alphanumeric_start(self): valid, reason = self.helper.is_valid_label_name('-non-alphanum-start') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid start\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_non_alphanumeric_end(self): valid, reason = self.helper.is_valid_label_name('non-alphanum-end-') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 16\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_special_character(self): valid, reason = self.helper.is_valid_label_name('testing@specialchars') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_exceed_max_length(self): test_str = 'a' * 64 valid, reason = self.helper.is_valid_label_name(test_str) self.assertEqual(reason, 'Label names must contain no more than 63 characters -> Contained 64') self.assertFalse(valid) def test_is_valid_label_name_allows_string_at_max_length(self): test_str = 'a' * 63 valid, reason = self.helper.is_valid_label_name(test_str) self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_none(self): valid, reason = self.helper.is_valid_label_name(None) self.assertEqual(reason, 'Label names cannot be empty') self.assertFalse(valid) def test_is_valid_label_name_false_on_empty_string(self): valid, reason = self.helper.is_valid_label_name('') self.assertEqual(reason, 'Label names cannot be empty') self.assertFalse(valid)
tests/unit/kubeobjects/test_names.py
import unittest from kubedriver.kubeobjects.names import NameHelper class TestNameHelper(unittest.TestCase): def setUp(self): self.helper = NameHelper() def test_is_valid_subdomain_name_allows_lowercase(self): valid, reason = self.helper.is_valid_subdomain_name('testing') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_uppercase(self): valid, reason = self.helper.is_valid_subdomain_name('tESting') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 1\']') self.assertFalse(valid) def test_is_valid_subdomain_name_allows_dots(self): valid, reason = self.helper.is_valid_subdomain_name('testing.dots') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_allows_dash(self): valid, reason = self.helper.is_valid_subdomain_name('testing-dashes') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_non_alphanumeric_start(self): valid, reason = self.helper.is_valid_subdomain_name('-non-alphanum-start') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid start\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_non_alphanumeric_end(self): valid, reason = self.helper.is_valid_subdomain_name('non-alphanum-end-') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 16\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_special_character(self): valid, reason = self.helper.is_valid_subdomain_name('testing@specialchars') self.assertEqual(reason, 'Subdomain names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters, \'-\' or \'.\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_exceed_max_length(self): test_str = 'a' * 254 valid, reason = self.helper.is_valid_subdomain_name(test_str) self.assertEqual(reason, 'Subdomain names must contain no more than 253 characters -> Contained 254') self.assertFalse(valid) def test_is_valid_subdomain_name_allows_string_at_max_length(self): test_str = 'a' * 253 valid, reason = self.helper.is_valid_subdomain_name(test_str) self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_subdomain_name_false_on_none(self): valid, reason = self.helper.is_valid_subdomain_name(None) self.assertEqual(reason, 'Subdomains cannot be empty') self.assertFalse(valid) def test_is_valid_subdomain_name_false_on_empty_string(self): valid, reason = self.helper.is_valid_subdomain_name('') self.assertEqual(reason, 'Subdomains cannot be empty') self.assertFalse(valid) def test_is_valid_label_name_allows_lowercase(self): valid, reason = self.helper.is_valid_label_name('testing') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_uppercase(self): valid, reason = self.helper.is_valid_label_name('tESting') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 1\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_dots(self): valid, reason = self.helper.is_valid_label_name('testing.dots') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_label_name_allows_dash(self): valid, reason = self.helper.is_valid_label_name('testing-dashes') self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_non_alphanumeric_start(self): valid, reason = self.helper.is_valid_label_name('-non-alphanum-start') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid start\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_non_alphanumeric_end(self): valid, reason = self.helper.is_valid_label_name('non-alphanum-end-') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 16\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_special_character(self): valid, reason = self.helper.is_valid_label_name('testing@specialchars') self.assertEqual(reason, 'Label names must start and end with an alphanumeric character and consist of only lower case alphanumeric characters or \'-\' -> [\'Invalid at index 7\']') self.assertFalse(valid) def test_is_valid_label_name_false_on_exceed_max_length(self): test_str = 'a' * 64 valid, reason = self.helper.is_valid_label_name(test_str) self.assertEqual(reason, 'Label names must contain no more than 63 characters -> Contained 64') self.assertFalse(valid) def test_is_valid_label_name_allows_string_at_max_length(self): test_str = 'a' * 63 valid, reason = self.helper.is_valid_label_name(test_str) self.assertIsNone(reason) self.assertTrue(valid) def test_is_valid_label_name_false_on_none(self): valid, reason = self.helper.is_valid_label_name(None) self.assertEqual(reason, 'Label names cannot be empty') self.assertFalse(valid) def test_is_valid_label_name_false_on_empty_string(self): valid, reason = self.helper.is_valid_label_name('') self.assertEqual(reason, 'Label names cannot be empty') self.assertFalse(valid)
0.683525
0.501526
# Description: # This tool helps you to find hack attempts # within webserver log files (e.g. Apache2 access logs). # Features: # - Error handling # - Scan a log file for four different attack types # - Display a short scan report # - Write scan results to a new log file # - Easy to use (everything is simple and automated # Usage example: # scan_log.py -file vhost_access.log # Known issue: # XSS attempt discovery feature can be a little bit buggy. # Disclaimer: # I am not responsible if this script or you cause any damage # to your system. The memory consumption can become # quite large and the generated reports very huge. So be sure # you know what you are doing. I highly recommend you # download your log files on a separate machine and # analyze these files there. # I know that there are much better tools, but well, I do # this for learning and fun =) # Attention: Tool is far away from being perfect, so don't rely a 100 percent on it. # A BIG "Thank you!" to all who publish their awesome Python # scripts online and help other ppl learning this language. # Modify, distribute, share and copy this code in any way you like! # Power to the cows! import sys, string, re, time from time import strftime, localtime def print_usage(): print "" print "" print "[!] Use parameter --help for help!" print "" print "" return def print_help(): print "" print "The Simple Log File Analyzer helps you to find" print "common hack attempts within your webserver log." print "" print "Supported attacks:" print " - SQL Injection" print " - Local File Inclusion" print " - Remote File Inclusion" print " - Cross-Site Scripting" print "" print "This scanner doesn't find everything so don't" print "rely on it!" print "" print "Usage example:" print "scan_log.py -file vhost_access.log" print "" print "Options:" print " -file <file> (starts the main analyzing function" print " --help (displays this text)" print "" print "Features:" print " - Error handling" print " - Scan a log file for four different attack types" print " - Display a short scan report" print " - Write scan results to a new log file" print " - Easy to use (everything is simple and automated)" print "" print "Additional information:" print "I only tested this tool with Apache2 log files (up to 2000 lines)." print "It may happen that the tool crashes when the provided log" print "file is too big or contains too many lines/characters." print "Scanning a 4000 lines log file only takes one second." print "" print "Hint: The XSS discovery feature is a little bit buggy." print "" print "" return def print_banner(): print "" return # Define the function for analyzing log files def analyze_log_file(provided_file): # Defining some important vars sqli_found_list = {} lfi_found_list = {} rfi_found_list = {} xss_found_list = {} # I know, there are better methods for doing/defining this... sql_injection_1 = "UNION" sql_injection_2 = "ORDER" sql_injection_3 = "GROUP" local_file_inclusion_1 = "/etc/passwd" local_file_inclusion_2 = "/etc/passwd%20" local_file_inclusion_3 = "=../" remote_file_inclusion_1 = "c99" remote_file_inclusion_2 = "=http://" cross_site_scripting_1 = "XSS" cross_site_scripting_2 = "alert" cross_site_scripting_3 = "String.fromCharCode" cross_site_scripting_4 = "iframe" cross_site_scripting_5 = "javascript" print "[i] >>", provided_file print "[i] Assuming you provided a readable log file." print "[i] Trying to open the log file now." print "" # Opening the log file try: f = open(provided_file, "r") except IOError: print "[!] The file doesn't exist." print "[!] Exiting now!" print "" sys.exit(1) print "[i] Opening the log file was successfull." print "[i] Moving on now..." print "" # Storing every single line in a list line_list = [line for line in f] max_lines = len(line_list) print "[i] The file contains", max_lines, "lines." print "[i] Now looking for possible hack attempts..." # Viewing every single line for x in xrange(1, max_lines): current_line = line_list[x:x+1] # For some strange list behaviour we convert the list into a string current_line_string = "".join(current_line) # Search for SQL injections find_sql_injection_1 = re.findall(sql_injection_1, current_line_string) if len(find_sql_injection_1) != 0: sqli_found_list[x+1] = current_line_string else: find_sql_injection_2 = re.findall(sql_injection_2, current_line_string) if len(find_sql_injection_2) != 0: sqli_found_list[x+1] = current_line_string else: find_sql_injection_3 = re.findall(sql_injection_3, current_line_string) if len(find_sql_injection_3) != 0: sqli_found_list[x+1] = current_line_string # Search for local file inclusions find_local_file_inclusion_1 = re.findall(local_file_inclusion_1, current_line_string) if len(find_local_file_inclusion_1) != 0: lfi_found_list[x+1] = current_line_string else: find_local_file_inclusion_2 = re.findall(local_file_inclusion_2, current_line_string) if len(find_local_file_inclusion_2) != 0: lfi_found_list[x+1] = current_line_string else: find_local_file_inclusion_3 = re.findall(local_file_inclusion_3, current_line_string) if len(find_local_file_inclusion_3) != 0: lfi_found_list[x+1] = current_line_string # Search for remote file inclusions find_remote_file_inclusion_1 = re.findall(remote_file_inclusion_1, current_line_string) if len(find_remote_file_inclusion_1) != 0: rfi_found_list[x+1] = current_line_string else: find_remote_file_inclusion_2 = re.findall(remote_file_inclusion_2, current_line_string) if len(find_remote_file_inclusion_2) != 0: rfi_found_list[x+1] = current_line_string # Search for cross-site scripting attempts find_cross_site_scripting_1 = re.findall(cross_site_scripting_1, current_line_string) if len(find_cross_site_scripting_1) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_2 = re.findall(cross_site_scripting_2, current_line_string) if len(find_cross_site_scripting_2) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_3 = re.findall(cross_site_scripting_3, current_line_string) if len(find_cross_site_scripting_3) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_4= re.findall(cross_site_scripting_4, current_line_string) if len(find_cross_site_scripting_4) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_5 = re.findall(cross_site_scripting_5, current_line_string) if len(find_cross_site_scripting_5) != 0: xss_found_list[x+1] = current_line_string # Close the file we opened recently f.close() # Generating a short report print "[i] Done." print "" print "[#] Simple report for analyzed log file" check_for_sqli_attempts = len(sqli_found_list) if check_for_sqli_attempts > 0: print "[!]", check_for_sqli_attempts, "SQL injection attempt(s) was/were found." else: print "[+] No SQL injection attempt was found." check_for_lfi_attempts = len(lfi_found_list) if check_for_lfi_attempts > 0: print "[!]", check_for_lfi_attempts, "local file inclusion attempt(s) was/were found." else: print "[+] No local file inclusion attempt was found." check_for_rfi_attempts = len(rfi_found_list) if check_for_rfi_attempts > 0: print "[!]", check_for_rfi_attempts, "remote file inclusion attempt(s) was/were found." else: print "[+] No remote file inclusion attempt was found." check_for_xss_attempts = len(xss_found_list) if check_for_xss_attempts > 0: print "[!]", check_for_xss_attempts, "cross-site scripting attempt(s) was/were found." else: print "[+] No crosse-site scripting attempt was found." # Now generate the report print "" print "[i] Generating report..." # Define variables for the report name time_string = strftime("%a_%d_%b_%Y_%H_%M_%S", localtime()) time_string_for_report = strftime("%a the %d %b %Y, %H:%M:%S", localtime()) name_of_report_file = provided_file + "_scan_report_from_" + time_string # Convert the ints to strings sqli_numbers = str(check_for_sqli_attempts) lfi_numbers = str(check_for_lfi_attempts) rfi_numbers = str(check_for_rfi_attempts) xss_numbers = str(check_for_xss_attempts) # Create the file generated_report = open(name_of_report_file, "w") # Write the content generated_report.write("\n") generated_report.write("Simple Log File Analyzer\n") generated_report.write("\n") generated_report.write("Scan report for " +provided_file + " on " + time_string_for_report + "\n") generated_report.write("Hint: XSS attempt discovery feature might be a little bit buggy.\n") generated_report.write("\n") generated_report.write("\n") generated_report.write("Number of possible SQL injection attempts found: " + sqli_numbers + "\n") generated_report.write("Number of possible local file inclusion attempts found: " + lfi_numbers + "\n") generated_report.write("Number of possible remote file inclusion attempts found: " + rfi_numbers + "\n") generated_report.write("Number of possible cross-site scripting attempts found: " + xss_numbers + "\n") generated_report.write("\n") generated_report.write("\n") if len(sqli_found_list) != 0: sqli_found_list_string = "" sqli_found_list_string = "".join(str(sqli_found_list)) generated_report.write("Details for the SQL injection attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(sqli_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(lfi_found_list) != 0: lfi_found_list_string = "" lfi_found_list_string = "".join(str(lfi_found_list)) generated_report.write("Details for the local file inclusion attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(lfi_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(rfi_found_list) != 0: rfi_found_list_string = "" rfi_found_list_string = "".join(str(rfi_found_list)) generated_report.write("Details for the remote file inclusion attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(rfi_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(xss_found_list) != 0: xss_found_list_string = "" xss_found_list_string = "".join(str(xss_found_list)) generated_report.write("Details for the cross-site scripting attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(xss_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") # Close the file generated_report.close() print "[i] Finished writing the report." print "[i] Hint: The report file can become quite large." print "[i] Hint: The XSS attempt discovery feature might be a little bit buggy." print "" print "[i] That's it, bye!" print "" print "" return # End of the log file function # Checking if argument was provided if len(sys.argv) <=1: print_usage() sys.exit(1) for arg in sys.argv: # Checking if help was called if arg == "--help": print_help() sys.exit(1) # Checking if a log file was provided, if yes -> go! if arg == "-file": provided_file = sys.argv[2] print_banner() # Start the main analyze function analyze_log_file(provided_file) sys.exit(1) ### EOF ###
machine-learning-gists/a25a81cdaf63c90d0c08cb466a0371b8f9273d00/snippet.py
# Description: # This tool helps you to find hack attempts # within webserver log files (e.g. Apache2 access logs). # Features: # - Error handling # - Scan a log file for four different attack types # - Display a short scan report # - Write scan results to a new log file # - Easy to use (everything is simple and automated # Usage example: # scan_log.py -file vhost_access.log # Known issue: # XSS attempt discovery feature can be a little bit buggy. # Disclaimer: # I am not responsible if this script or you cause any damage # to your system. The memory consumption can become # quite large and the generated reports very huge. So be sure # you know what you are doing. I highly recommend you # download your log files on a separate machine and # analyze these files there. # I know that there are much better tools, but well, I do # this for learning and fun =) # Attention: Tool is far away from being perfect, so don't rely a 100 percent on it. # A BIG "Thank you!" to all who publish their awesome Python # scripts online and help other ppl learning this language. # Modify, distribute, share and copy this code in any way you like! # Power to the cows! import sys, string, re, time from time import strftime, localtime def print_usage(): print "" print "" print "[!] Use parameter --help for help!" print "" print "" return def print_help(): print "" print "The Simple Log File Analyzer helps you to find" print "common hack attempts within your webserver log." print "" print "Supported attacks:" print " - SQL Injection" print " - Local File Inclusion" print " - Remote File Inclusion" print " - Cross-Site Scripting" print "" print "This scanner doesn't find everything so don't" print "rely on it!" print "" print "Usage example:" print "scan_log.py -file vhost_access.log" print "" print "Options:" print " -file <file> (starts the main analyzing function" print " --help (displays this text)" print "" print "Features:" print " - Error handling" print " - Scan a log file for four different attack types" print " - Display a short scan report" print " - Write scan results to a new log file" print " - Easy to use (everything is simple and automated)" print "" print "Additional information:" print "I only tested this tool with Apache2 log files (up to 2000 lines)." print "It may happen that the tool crashes when the provided log" print "file is too big or contains too many lines/characters." print "Scanning a 4000 lines log file only takes one second." print "" print "Hint: The XSS discovery feature is a little bit buggy." print "" print "" return def print_banner(): print "" return # Define the function for analyzing log files def analyze_log_file(provided_file): # Defining some important vars sqli_found_list = {} lfi_found_list = {} rfi_found_list = {} xss_found_list = {} # I know, there are better methods for doing/defining this... sql_injection_1 = "UNION" sql_injection_2 = "ORDER" sql_injection_3 = "GROUP" local_file_inclusion_1 = "/etc/passwd" local_file_inclusion_2 = "/etc/passwd%20" local_file_inclusion_3 = "=../" remote_file_inclusion_1 = "c99" remote_file_inclusion_2 = "=http://" cross_site_scripting_1 = "XSS" cross_site_scripting_2 = "alert" cross_site_scripting_3 = "String.fromCharCode" cross_site_scripting_4 = "iframe" cross_site_scripting_5 = "javascript" print "[i] >>", provided_file print "[i] Assuming you provided a readable log file." print "[i] Trying to open the log file now." print "" # Opening the log file try: f = open(provided_file, "r") except IOError: print "[!] The file doesn't exist." print "[!] Exiting now!" print "" sys.exit(1) print "[i] Opening the log file was successfull." print "[i] Moving on now..." print "" # Storing every single line in a list line_list = [line for line in f] max_lines = len(line_list) print "[i] The file contains", max_lines, "lines." print "[i] Now looking for possible hack attempts..." # Viewing every single line for x in xrange(1, max_lines): current_line = line_list[x:x+1] # For some strange list behaviour we convert the list into a string current_line_string = "".join(current_line) # Search for SQL injections find_sql_injection_1 = re.findall(sql_injection_1, current_line_string) if len(find_sql_injection_1) != 0: sqli_found_list[x+1] = current_line_string else: find_sql_injection_2 = re.findall(sql_injection_2, current_line_string) if len(find_sql_injection_2) != 0: sqli_found_list[x+1] = current_line_string else: find_sql_injection_3 = re.findall(sql_injection_3, current_line_string) if len(find_sql_injection_3) != 0: sqli_found_list[x+1] = current_line_string # Search for local file inclusions find_local_file_inclusion_1 = re.findall(local_file_inclusion_1, current_line_string) if len(find_local_file_inclusion_1) != 0: lfi_found_list[x+1] = current_line_string else: find_local_file_inclusion_2 = re.findall(local_file_inclusion_2, current_line_string) if len(find_local_file_inclusion_2) != 0: lfi_found_list[x+1] = current_line_string else: find_local_file_inclusion_3 = re.findall(local_file_inclusion_3, current_line_string) if len(find_local_file_inclusion_3) != 0: lfi_found_list[x+1] = current_line_string # Search for remote file inclusions find_remote_file_inclusion_1 = re.findall(remote_file_inclusion_1, current_line_string) if len(find_remote_file_inclusion_1) != 0: rfi_found_list[x+1] = current_line_string else: find_remote_file_inclusion_2 = re.findall(remote_file_inclusion_2, current_line_string) if len(find_remote_file_inclusion_2) != 0: rfi_found_list[x+1] = current_line_string # Search for cross-site scripting attempts find_cross_site_scripting_1 = re.findall(cross_site_scripting_1, current_line_string) if len(find_cross_site_scripting_1) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_2 = re.findall(cross_site_scripting_2, current_line_string) if len(find_cross_site_scripting_2) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_3 = re.findall(cross_site_scripting_3, current_line_string) if len(find_cross_site_scripting_3) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_4= re.findall(cross_site_scripting_4, current_line_string) if len(find_cross_site_scripting_4) != 0: xss_found_list[x+1] = current_line_string else: find_cross_site_scripting_5 = re.findall(cross_site_scripting_5, current_line_string) if len(find_cross_site_scripting_5) != 0: xss_found_list[x+1] = current_line_string # Close the file we opened recently f.close() # Generating a short report print "[i] Done." print "" print "[#] Simple report for analyzed log file" check_for_sqli_attempts = len(sqli_found_list) if check_for_sqli_attempts > 0: print "[!]", check_for_sqli_attempts, "SQL injection attempt(s) was/were found." else: print "[+] No SQL injection attempt was found." check_for_lfi_attempts = len(lfi_found_list) if check_for_lfi_attempts > 0: print "[!]", check_for_lfi_attempts, "local file inclusion attempt(s) was/were found." else: print "[+] No local file inclusion attempt was found." check_for_rfi_attempts = len(rfi_found_list) if check_for_rfi_attempts > 0: print "[!]", check_for_rfi_attempts, "remote file inclusion attempt(s) was/were found." else: print "[+] No remote file inclusion attempt was found." check_for_xss_attempts = len(xss_found_list) if check_for_xss_attempts > 0: print "[!]", check_for_xss_attempts, "cross-site scripting attempt(s) was/were found." else: print "[+] No crosse-site scripting attempt was found." # Now generate the report print "" print "[i] Generating report..." # Define variables for the report name time_string = strftime("%a_%d_%b_%Y_%H_%M_%S", localtime()) time_string_for_report = strftime("%a the %d %b %Y, %H:%M:%S", localtime()) name_of_report_file = provided_file + "_scan_report_from_" + time_string # Convert the ints to strings sqli_numbers = str(check_for_sqli_attempts) lfi_numbers = str(check_for_lfi_attempts) rfi_numbers = str(check_for_rfi_attempts) xss_numbers = str(check_for_xss_attempts) # Create the file generated_report = open(name_of_report_file, "w") # Write the content generated_report.write("\n") generated_report.write("Simple Log File Analyzer\n") generated_report.write("\n") generated_report.write("Scan report for " +provided_file + " on " + time_string_for_report + "\n") generated_report.write("Hint: XSS attempt discovery feature might be a little bit buggy.\n") generated_report.write("\n") generated_report.write("\n") generated_report.write("Number of possible SQL injection attempts found: " + sqli_numbers + "\n") generated_report.write("Number of possible local file inclusion attempts found: " + lfi_numbers + "\n") generated_report.write("Number of possible remote file inclusion attempts found: " + rfi_numbers + "\n") generated_report.write("Number of possible cross-site scripting attempts found: " + xss_numbers + "\n") generated_report.write("\n") generated_report.write("\n") if len(sqli_found_list) != 0: sqli_found_list_string = "" sqli_found_list_string = "".join(str(sqli_found_list)) generated_report.write("Details for the SQL injection attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(sqli_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(lfi_found_list) != 0: lfi_found_list_string = "" lfi_found_list_string = "".join(str(lfi_found_list)) generated_report.write("Details for the local file inclusion attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(lfi_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(rfi_found_list) != 0: rfi_found_list_string = "" rfi_found_list_string = "".join(str(rfi_found_list)) generated_report.write("Details for the remote file inclusion attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(rfi_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") if len(xss_found_list) != 0: xss_found_list_string = "" xss_found_list_string = "".join(str(xss_found_list)) generated_report.write("Details for the cross-site scripting attempts (line, log entry)\n") generated_report.write("------------------------------------------------\n") generated_report.write(xss_found_list_string) generated_report.write("\n") generated_report.write("\n") generated_report.write("\n") # Close the file generated_report.close() print "[i] Finished writing the report." print "[i] Hint: The report file can become quite large." print "[i] Hint: The XSS attempt discovery feature might be a little bit buggy." print "" print "[i] That's it, bye!" print "" print "" return # End of the log file function # Checking if argument was provided if len(sys.argv) <=1: print_usage() sys.exit(1) for arg in sys.argv: # Checking if help was called if arg == "--help": print_help() sys.exit(1) # Checking if a log file was provided, if yes -> go! if arg == "-file": provided_file = sys.argv[2] print_banner() # Start the main analyze function analyze_log_file(provided_file) sys.exit(1) ### EOF ###
0.46223
0.197541
import pytest import pyeventdispatcher from pyeventdispatcher import ( EventDispatcher, Event, EventDispatcherException, EventSubscriber, listen, ) from pyeventdispatcher.event_dispatcher import ( MemoryRegistry, register_global_listener, register_event_subscribers, ) class TestRegister: class MyListener: def call_on_event(self, event): print(event.data) @pytest.mark.parametrize( "registered", [MyListener().call_on_event, lambda event: print(event.data)] ) def test_it_allows_to_register(self, registered, capsys): py_event_dispatcher = EventDispatcher() py_event_dispatcher.register("foo.bar", registered) py_event_dispatcher.dispatch(Event("foo.bar", {"a": "b"})) captured = capsys.readouterr() assert captured.out == "{'a': 'b'}\n" @pytest.mark.parametrize( "to_register, output", [ # With default "priority" - in order they were added ( ( {"lambda": lambda event: print("First"), "priority": 0}, {"lambda": lambda event: print("Second"), "priority": 0}, ), "First\nSecond\n", ), # Based on priority ( ( {"lambda": lambda event: print("First"), "priority": 0}, {"lambda": lambda event: print("Second"), "priority": -100}, ), "Second\nFirst\n", ), ], ) def test_listeners_executed_in_order(self, to_register, output, capsys): py_event_dispatcher = EventDispatcher() for register in to_register: py_event_dispatcher.register( "foo.bar", register["lambda"], register["priority"] ) py_event_dispatcher.dispatch(Event("foo.bar", {"a": "b"})) captured = capsys.readouterr() assert captured.out == output def test_it_raises_an_exception_when_non_callable_is_trying_to_be_registered(self): py_event_dispatcher = EventDispatcher() with pytest.raises(EventDispatcherException): py_event_dispatcher.register("foo.bar", "") @pytest.mark.parametrize("priority", [None, ""]) def test_it_raises_an_exception_when_priority_is_not_integer(self, priority): py_event_dispatcher = EventDispatcher() with pytest.raises(EventDispatcherException): py_event_dispatcher.register( "foo.bar", lambda event: print(event), priority ) class TestRegisterGlobal: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_it_allows_to_register_listener_globally(self, capsys): def my_listener(event): print("my_listener") def global_listener(event): print("global") register_global_listener("foo.bar", global_listener) py_event_dispatcher_1 = EventDispatcher() py_event_dispatcher_1.register("foo.bar", my_listener) py_event_dispatcher_2 = EventDispatcher() py_event_dispatcher_2.register("foo.bar", my_listener) py_event_dispatcher_1.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "my_listener\nglobal\n" class TestRegisterSubscribers: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() class MySubscriber1(EventSubscriber): EVENTS = {"foo.bar": "execute_one", "bar.foo": ("execute_two", -10)} @staticmethod def execute_one(event): print("MySubscriber1::execute_one") @staticmethod def execute_two(event): print("MySubscriber1::execute_two") def test_register_global_listeners_by_subscriber(self, capsys): register_event_subscribers() py_event_dispatcher = EventDispatcher() py_event_dispatcher.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "MySubscriber1::execute_one\n" class TestRegisterThroughDecorator: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_register_global_listener_by_decorator(self, capsys): @listen("foo.bar") def my_test_function(event): print(event.name) py_event_dispatcher = EventDispatcher() py_event_dispatcher.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "foo.bar\n" class TestStopPropagation: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_it_stops_propagation(self, capsys): def first_listener(event): event.stop = True print("first_listener") def second_listener(event): print("first_listener") py_event_dispatcher = EventDispatcher() py_event_dispatcher.register("foo.bar", first_listener) py_event_dispatcher.register("foo.bar", second_listener) py_event_dispatcher.dispatch(Event("foo.bar", {})) captured = capsys.readouterr() assert captured.out == "first_listener\n"
test/test_pyeventdispatcher.py
import pytest import pyeventdispatcher from pyeventdispatcher import ( EventDispatcher, Event, EventDispatcherException, EventSubscriber, listen, ) from pyeventdispatcher.event_dispatcher import ( MemoryRegistry, register_global_listener, register_event_subscribers, ) class TestRegister: class MyListener: def call_on_event(self, event): print(event.data) @pytest.mark.parametrize( "registered", [MyListener().call_on_event, lambda event: print(event.data)] ) def test_it_allows_to_register(self, registered, capsys): py_event_dispatcher = EventDispatcher() py_event_dispatcher.register("foo.bar", registered) py_event_dispatcher.dispatch(Event("foo.bar", {"a": "b"})) captured = capsys.readouterr() assert captured.out == "{'a': 'b'}\n" @pytest.mark.parametrize( "to_register, output", [ # With default "priority" - in order they were added ( ( {"lambda": lambda event: print("First"), "priority": 0}, {"lambda": lambda event: print("Second"), "priority": 0}, ), "First\nSecond\n", ), # Based on priority ( ( {"lambda": lambda event: print("First"), "priority": 0}, {"lambda": lambda event: print("Second"), "priority": -100}, ), "Second\nFirst\n", ), ], ) def test_listeners_executed_in_order(self, to_register, output, capsys): py_event_dispatcher = EventDispatcher() for register in to_register: py_event_dispatcher.register( "foo.bar", register["lambda"], register["priority"] ) py_event_dispatcher.dispatch(Event("foo.bar", {"a": "b"})) captured = capsys.readouterr() assert captured.out == output def test_it_raises_an_exception_when_non_callable_is_trying_to_be_registered(self): py_event_dispatcher = EventDispatcher() with pytest.raises(EventDispatcherException): py_event_dispatcher.register("foo.bar", "") @pytest.mark.parametrize("priority", [None, ""]) def test_it_raises_an_exception_when_priority_is_not_integer(self, priority): py_event_dispatcher = EventDispatcher() with pytest.raises(EventDispatcherException): py_event_dispatcher.register( "foo.bar", lambda event: print(event), priority ) class TestRegisterGlobal: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_it_allows_to_register_listener_globally(self, capsys): def my_listener(event): print("my_listener") def global_listener(event): print("global") register_global_listener("foo.bar", global_listener) py_event_dispatcher_1 = EventDispatcher() py_event_dispatcher_1.register("foo.bar", my_listener) py_event_dispatcher_2 = EventDispatcher() py_event_dispatcher_2.register("foo.bar", my_listener) py_event_dispatcher_1.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "my_listener\nglobal\n" class TestRegisterSubscribers: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() class MySubscriber1(EventSubscriber): EVENTS = {"foo.bar": "execute_one", "bar.foo": ("execute_two", -10)} @staticmethod def execute_one(event): print("MySubscriber1::execute_one") @staticmethod def execute_two(event): print("MySubscriber1::execute_two") def test_register_global_listeners_by_subscriber(self, capsys): register_event_subscribers() py_event_dispatcher = EventDispatcher() py_event_dispatcher.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "MySubscriber1::execute_one\n" class TestRegisterThroughDecorator: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_register_global_listener_by_decorator(self, capsys): @listen("foo.bar") def my_test_function(event): print(event.name) py_event_dispatcher = EventDispatcher() py_event_dispatcher.dispatch(Event("foo.bar", None)) captured = capsys.readouterr() assert captured.out == "foo.bar\n" class TestStopPropagation: def setup_method(self): pyeventdispatcher.event_dispatcher.global_registry = MemoryRegistry() def test_it_stops_propagation(self, capsys): def first_listener(event): event.stop = True print("first_listener") def second_listener(event): print("first_listener") py_event_dispatcher = EventDispatcher() py_event_dispatcher.register("foo.bar", first_listener) py_event_dispatcher.register("foo.bar", second_listener) py_event_dispatcher.dispatch(Event("foo.bar", {})) captured = capsys.readouterr() assert captured.out == "first_listener\n"
0.530723
0.413536
import base64 import subprocess import json import sys import logging import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from urllib.parse import urljoin from kubernetes import client, config class APIRequest(object): """ Example use: api_request = APIRequest('http://api.com') response = api_request('GET', '/get/stuff') print (f"response.status_code") print (f"{response.status_code}") print() print (f"response.reason") print (f"{response.reason}") print() print (f"response.text") print (f"{response.text}") print() print (f"response.json") print (f"{response.json()}") """ def __init__(self, base_url, headers=None): if not base_url.endswith('/'): base_url += '/' self._base_url = base_url if headers is not None: self._headers = headers else: self._headers = {} def __call__(self, method, route, **kwargs): if route.startswith('/'): route = route[1:] url = urljoin(self._base_url, route, allow_fragments=False) headers = kwargs.pop('headers', {}) headers.update(self._headers) retry_strategy = Retry( total=10, backoff_factor=0.1, status_forcelist=[429, 500, 502, 503, 504], method_whitelist=["PATCH", "DELETE", "POST", "HEAD", "GET", "OPTIONS"] ) adapter = HTTPAdapter(max_retries=retry_strategy) http = requests.Session() http.mount("https://", adapter) http.mount("http://", adapter) response = http.request(method=method, url=url, headers=headers, **kwargs) if 'data' in kwargs: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}" f"and data:" f"{json.dumps(kwargs['data'], indent=4)}") elif 'json' in kwargs: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}" f"and JSON:" f"{json.dumps(kwargs['json'], indent=4)}") else: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}") log.debug(f"Response to {method} {url} => {response.status_code} {response.reason}" f"{response.text}") return response # globals gw_api = APIRequest('https://api-gw-service-nmn.local') log = logging.getLogger(__name__) log.setLevel(logging.WARN) handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) log.addHandler(handler) def token(): # setup kubernetes client config.load_kube_config() v1 = client.CoreV1Api() # get kubernetes admin secret secret = v1.read_namespaced_secret("admin-client-auth", "default").data # decode the base64 secret token = base64.b64decode(secret['client-secret']).decode('utf-8') # create post data to keycloak istio ingress token_data = {'grant_type': 'client_credentials', 'client_id': 'admin-client', 'client_secret': token} # query keycloack token_url = '/keycloak/realms/shasta/protocol/openid-connect/token' token_resp = gw_api('POST', token_url, data=token_data) access_token = token_resp.json()['access_token'] # print (f'access_token') return access_token def main(): error_found = False bearer_token = token() # request header passing token headers = {'Authorization': 'Bearer ' + bearer_token} # query SMD EthernetInterfaces smd_url = '/apis/smd/hsm/v2/Inventory/EthernetInterfaces' smd_resp = gw_api('GET', smd_url, headers=headers) smd_ethernet_interfaces = smd_resp.json() # query SLS hardware sls_url = '/apis/sls/v1/hardware' sls_resp = gw_api('GET', sls_url, headers=headers) sls_hardware = sls_resp.json() ip_set = set() for smd_entry in smd_ethernet_interfaces: # print (smd_entry) if smd_entry['IPAddresses'] != '[]': ip_addresses = smd_entry['IPAddresses'] for ips in ip_addresses: ip = ips['IPAddress'] # print (ip) if ip != '': if ip in ip_set: log.error(f'Error: found duplicate IP: {ip}') error_found = True nslookup_cmd = subprocess.Popen(('nslookup', ip), stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, errors = nslookup_cmd.communicate() print("output.decode('ascii')") else: ip_set.add(ip) hostname_list = [] for i in range(len(sls_hardware)): if 'ExtraProperties' in sls_hardware[i]: if 'Role' in sls_hardware[i]['ExtraProperties'] and ( sls_hardware[i]['ExtraProperties']['Role'] == 'Application' or sls_hardware[i]['ExtraProperties'][ 'Role'] == 'Management'): hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.nmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.can') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.hmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '-mgmt') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.cmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.chn') for hostname in hostname_list: dig_cmd = subprocess.Popen(('dig', hostname, '+short'), stdout=subprocess.PIPE) wc_cmd = subprocess.check_output(('wc', '-l'), stdin=dig_cmd.stdout) result = int(wc_cmd.decode('ascii').strip()) if result > 1: error_found = True log.error(f'ERROR: {hostname} has more than 1 DNS entry') nslookup_cmd = subprocess.Popen(('nslookup', hostname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, errors = nslookup_cmd.communicate() print(f"{output.decode('ascii')}") if error_found: log.error('ERRORS: see above output.') sys.exit(1) else: log.debug('No errors found.') sys.exit(0) if __name__ == "__main__": main()
goss-testing/scripts/python/check_ncn_uan_ip_dns.py
import base64 import subprocess import json import sys import logging import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from urllib.parse import urljoin from kubernetes import client, config class APIRequest(object): """ Example use: api_request = APIRequest('http://api.com') response = api_request('GET', '/get/stuff') print (f"response.status_code") print (f"{response.status_code}") print() print (f"response.reason") print (f"{response.reason}") print() print (f"response.text") print (f"{response.text}") print() print (f"response.json") print (f"{response.json()}") """ def __init__(self, base_url, headers=None): if not base_url.endswith('/'): base_url += '/' self._base_url = base_url if headers is not None: self._headers = headers else: self._headers = {} def __call__(self, method, route, **kwargs): if route.startswith('/'): route = route[1:] url = urljoin(self._base_url, route, allow_fragments=False) headers = kwargs.pop('headers', {}) headers.update(self._headers) retry_strategy = Retry( total=10, backoff_factor=0.1, status_forcelist=[429, 500, 502, 503, 504], method_whitelist=["PATCH", "DELETE", "POST", "HEAD", "GET", "OPTIONS"] ) adapter = HTTPAdapter(max_retries=retry_strategy) http = requests.Session() http.mount("https://", adapter) http.mount("http://", adapter) response = http.request(method=method, url=url, headers=headers, **kwargs) if 'data' in kwargs: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}" f"and data:" f"{json.dumps(kwargs['data'], indent=4)}") elif 'json' in kwargs: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}" f"and JSON:" f"{json.dumps(kwargs['json'], indent=4)}") else: log.debug(f"{method} {url} with headers:" f"{json.dumps(headers, indent=4)}") log.debug(f"Response to {method} {url} => {response.status_code} {response.reason}" f"{response.text}") return response # globals gw_api = APIRequest('https://api-gw-service-nmn.local') log = logging.getLogger(__name__) log.setLevel(logging.WARN) handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) log.addHandler(handler) def token(): # setup kubernetes client config.load_kube_config() v1 = client.CoreV1Api() # get kubernetes admin secret secret = v1.read_namespaced_secret("admin-client-auth", "default").data # decode the base64 secret token = base64.b64decode(secret['client-secret']).decode('utf-8') # create post data to keycloak istio ingress token_data = {'grant_type': 'client_credentials', 'client_id': 'admin-client', 'client_secret': token} # query keycloack token_url = '/keycloak/realms/shasta/protocol/openid-connect/token' token_resp = gw_api('POST', token_url, data=token_data) access_token = token_resp.json()['access_token'] # print (f'access_token') return access_token def main(): error_found = False bearer_token = token() # request header passing token headers = {'Authorization': 'Bearer ' + bearer_token} # query SMD EthernetInterfaces smd_url = '/apis/smd/hsm/v2/Inventory/EthernetInterfaces' smd_resp = gw_api('GET', smd_url, headers=headers) smd_ethernet_interfaces = smd_resp.json() # query SLS hardware sls_url = '/apis/sls/v1/hardware' sls_resp = gw_api('GET', sls_url, headers=headers) sls_hardware = sls_resp.json() ip_set = set() for smd_entry in smd_ethernet_interfaces: # print (smd_entry) if smd_entry['IPAddresses'] != '[]': ip_addresses = smd_entry['IPAddresses'] for ips in ip_addresses: ip = ips['IPAddress'] # print (ip) if ip != '': if ip in ip_set: log.error(f'Error: found duplicate IP: {ip}') error_found = True nslookup_cmd = subprocess.Popen(('nslookup', ip), stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, errors = nslookup_cmd.communicate() print("output.decode('ascii')") else: ip_set.add(ip) hostname_list = [] for i in range(len(sls_hardware)): if 'ExtraProperties' in sls_hardware[i]: if 'Role' in sls_hardware[i]['ExtraProperties'] and ( sls_hardware[i]['ExtraProperties']['Role'] == 'Application' or sls_hardware[i]['ExtraProperties'][ 'Role'] == 'Management'): hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.nmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.can') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.hmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '-mgmt') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.cmn') hostname_list.append(sls_hardware[i]['ExtraProperties']['Aliases'][0] + '.chn') for hostname in hostname_list: dig_cmd = subprocess.Popen(('dig', hostname, '+short'), stdout=subprocess.PIPE) wc_cmd = subprocess.check_output(('wc', '-l'), stdin=dig_cmd.stdout) result = int(wc_cmd.decode('ascii').strip()) if result > 1: error_found = True log.error(f'ERROR: {hostname} has more than 1 DNS entry') nslookup_cmd = subprocess.Popen(('nslookup', hostname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, errors = nslookup_cmd.communicate() print(f"{output.decode('ascii')}") if error_found: log.error('ERRORS: see above output.') sys.exit(1) else: log.debug('No errors found.') sys.exit(0) if __name__ == "__main__": main()
0.126961
0.048858
import smbus import time HTS221_ADDR = 0x5F HTS221_WHO_AM_I = 0x0F HTS221_ID = 0xBC HTS221_AV_CONF = 0x10 HTS221_CTRL_REG1 = 0x20 # Humidity HTS221_H0_rH_x2 = 0x30 HTS221_H1_rH_x2 = 0x31 HTS221_H0_T0_OUT_L = 0x36 HTS221_H0_T0_OUT_H = 0x37 HTS221_H1_T0_OUT_L = 0x3A HTS221_H1_T0_OUT_H = 0x3B HTS221_H_OUT_L = 0x28 HTS221_H_OUT_H = 0x29 # Temperature HTS221_T0_DEGC_X8 = 0x32 HTS221_T1_DEGC_X8 = 0x33 HTS221_T0_T1_MSB = 0x35 HTS221_T0_OUT_L = 0x3C HTS221_T0_OUT_H = 0x3D HTS221_T1_OUT_L = 0x3E HTS221_T1_OUT_H = 0x3F HTS221_T_OUT_L = 0x2A HTS221_T_OUT_H = 0x2B class HTS221: def __init__(self): self.bus = smbus.SMBus(1) # Temperature average samples = 16(MAX 256), Humidity average samples = 32(MAX 512) self.bus.write_byte_data(HTS221_ADDR, HTS221_AV_CONF, 0x1B) # Power ON, Continuous update, Data ouput rate = 1Hz self.bus.write_byte_data(HTS221_ADDR, HTS221_CTRL_REG1, 0x81) time.sleep(0.5) def getDeviceID(self): return self.bus.read_byte_data(HTS221_ADDR, HTS221_WHO_AM_I) def getHumidity(self): val = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_rH_x2) H0 = val / 2 val = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_rH_x2) H1 = val /2 val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_T0_OUT_H) H2 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_T0_OUT_H) H3 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) Hl = self.bus.read_byte_data(HTS221_ADDR, HTS221_H_OUT_L) Hh = self.bus.read_byte_data(HTS221_ADDR, HTS221_H_OUT_H) humidity = (Hh * 256) + Hl humidity = ((1.0 * H1) - (1.0 * H0)) * (1.0 * humidity - 1.0 * H2) / (1.0 * H3 - 1.0 * H2) + (1.0 * H0) return humidity def getCTemperature(self): T0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_DEGC_X8) T0 = (T0 & 0xFF) T1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_DEGC_X8) T1 = (T1 & 0xFF) raw = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_T1_MSB) raw = (T1 & 0xFF) T0 = ((raw & 0x03) * 256) + T0 T1 = ((raw & 0x0C) * 64) + T1 val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_OUT_H) T2 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_OUT_H) T3 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) Tl = self.bus.read_byte_data(HTS221_ADDR, HTS221_T_OUT_L) Th = self.bus.read_byte_data(HTS221_ADDR, HTS221_T_OUT_H) temperature = (Th * 256) + Tl if temperature > 32767: temperature -= 65536 cTemp = ((T1 - T0) / 8.0) * (temperature - T2) / (T3 - T2) + (T0 / 8.0) return cTemp def getFTemperature(self): return (self.getCTemperature() * 1.8) + 32
CZNBIoT/HTS221.py
import smbus import time HTS221_ADDR = 0x5F HTS221_WHO_AM_I = 0x0F HTS221_ID = 0xBC HTS221_AV_CONF = 0x10 HTS221_CTRL_REG1 = 0x20 # Humidity HTS221_H0_rH_x2 = 0x30 HTS221_H1_rH_x2 = 0x31 HTS221_H0_T0_OUT_L = 0x36 HTS221_H0_T0_OUT_H = 0x37 HTS221_H1_T0_OUT_L = 0x3A HTS221_H1_T0_OUT_H = 0x3B HTS221_H_OUT_L = 0x28 HTS221_H_OUT_H = 0x29 # Temperature HTS221_T0_DEGC_X8 = 0x32 HTS221_T1_DEGC_X8 = 0x33 HTS221_T0_T1_MSB = 0x35 HTS221_T0_OUT_L = 0x3C HTS221_T0_OUT_H = 0x3D HTS221_T1_OUT_L = 0x3E HTS221_T1_OUT_H = 0x3F HTS221_T_OUT_L = 0x2A HTS221_T_OUT_H = 0x2B class HTS221: def __init__(self): self.bus = smbus.SMBus(1) # Temperature average samples = 16(MAX 256), Humidity average samples = 32(MAX 512) self.bus.write_byte_data(HTS221_ADDR, HTS221_AV_CONF, 0x1B) # Power ON, Continuous update, Data ouput rate = 1Hz self.bus.write_byte_data(HTS221_ADDR, HTS221_CTRL_REG1, 0x81) time.sleep(0.5) def getDeviceID(self): return self.bus.read_byte_data(HTS221_ADDR, HTS221_WHO_AM_I) def getHumidity(self): val = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_rH_x2) H0 = val / 2 val = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_rH_x2) H1 = val /2 val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H0_T0_OUT_H) H2 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_H1_T0_OUT_H) H3 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) Hl = self.bus.read_byte_data(HTS221_ADDR, HTS221_H_OUT_L) Hh = self.bus.read_byte_data(HTS221_ADDR, HTS221_H_OUT_H) humidity = (Hh * 256) + Hl humidity = ((1.0 * H1) - (1.0 * H0)) * (1.0 * humidity - 1.0 * H2) / (1.0 * H3 - 1.0 * H2) + (1.0 * H0) return humidity def getCTemperature(self): T0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_DEGC_X8) T0 = (T0 & 0xFF) T1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_DEGC_X8) T1 = (T1 & 0xFF) raw = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_T1_MSB) raw = (T1 & 0xFF) T0 = ((raw & 0x03) * 256) + T0 T1 = ((raw & 0x0C) * 64) + T1 val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T0_OUT_H) T2 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) val0 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_OUT_L) val1 = self.bus.read_byte_data(HTS221_ADDR, HTS221_T1_OUT_H) T3 = ((val1 & 0xFF) * 256) + (val0 & 0xFF) Tl = self.bus.read_byte_data(HTS221_ADDR, HTS221_T_OUT_L) Th = self.bus.read_byte_data(HTS221_ADDR, HTS221_T_OUT_H) temperature = (Th * 256) + Tl if temperature > 32767: temperature -= 65536 cTemp = ((T1 - T0) / 8.0) * (temperature - T2) / (T3 - T2) + (T0 / 8.0) return cTemp def getFTemperature(self): return (self.getCTemperature() * 1.8) + 32
0.379608
0.240017
import copy class System: pass class LinearSystem(System): def __init__(self, equations): self.equations = equations def __str__(self): eqsStr = [] greaterEqualSignPos = 0 for eq in self.equations: eqStr = str(eq) equalSignPos = eqStr.find('=') if equalSignPos > greaterEqualSignPos: greaterEqualSignPos = equalSignPos eqsStr.append(eqStr) # Sexy printing i = 0 for eqStr in eqsStr: equalSignPos = eqStr.find('=') eqStr = ' '*(greaterEqualSignPos - equalSignPos) + eqStr eqsStr[i] = eqStr i += 1 return '\n'.join(eqsStr) def __len__(self): return len(self.equations) def __iter__(self): return iter(self.equations) def __getitem__(self, key): return self.equations[key] def __reversed__(self): return LinearSystem(reversed(self.equations)) def pivot(self): allNull = True for eq in self.equations: if len(eq): allNull = False break if allNull: return self pivot = None pivotCoeff = None pivotEq = None for eq in self.equations: for letter in eq: if not letter: continue coeff = eq[letter] if pivotCoeff is None or abs(coeff) < abs(pivotCoeff): pivotCoeff = coeff pivot = letter pivotEq = eq eqs = [] for eq in self.equations: if eq is pivotEq: continue if pivot in eq: eqPivotCoeff = eq[pivot] else: eqPivotCoeff = 0 eq *= pivotCoeff eqPivotEq = pivotEq * eqPivotCoeff eqs.append(eqPivotEq - eq) if len(eqs) > 1: subsys = LinearSystem(eqs) eqs = subsys.pivot().equations eqs.insert(0, pivotEq) return LinearSystem(eqs) def solve(self): reducedSys = reversed(self.pivot()) found = {} for eq in reducedSys: result = eq.solve(found) if result == False: return False elif isinstance(result, dict): for letter in result: if letter in found: if found[letter] != result[letter]: return False else: found[letter] = result[letter] return found class Equation: pass class LinearEquation(Equation): def __init__(self, data = None): if isinstance(data, str): members = data.split('=') firstMember = LinearExpression(members[0]) if len(members) > 1: secondMember = LinearExpression(members[1]) self.expression = firstMember - secondMember else: self.expression = firstMember else: self.expression = LinearExpression(data) def __str__(self): return str(self.expression) + '= 0' def __iter__(self): return iter(self.expression) def __getitem__(self, key): return self.expression[key] def __len__(self): return len(self.expression) def __mul__(self, factor): return LinearEquation(self.expression * factor) def __add__(self, other): if isinstance(other, LinearEquation): other = other.expression return LinearEquation(self.expression + other) def __neg__(self): return self * (-1) def __sub__(self, other): return self + (-other) def solve(self, found = {}): primaryUnknown = None secondaryUnknowns = {} value = 0 for letter in self: if letter == '': value = - self[letter] elif letter in found: value = value - found[letter] * self[letter] else: if primaryUnknown is None: primaryUnknown = letter else: secondaryUnknowns[letter] = - self[letter] / self[primaryUnknown] if primaryUnknown is None: return (value == 0) elif len(secondaryUnknowns) == 0: return { primaryUnknown: value / self[primaryUnknown] } else: # TODO: didnt managed to find a clean way to do this # Even with the __div__ magic method secondaryUnknowns[''] = value * (1 / self[primaryUnknown]) return { primaryUnknown: LinearExpression(secondaryUnknowns) } class Expression: pass class LinearExpression(Expression): def __init__(self, data = None): self.data = {} if isinstance(data, LinearExpression): self.fromCoeff(data.data) elif isinstance(data, int): self.fromCoeff({ '': data }) elif isinstance(data, dict): self.fromCoeff(data) elif isinstance(data, str): self.fromStr(data) def fromCoeff(self, data): self.data = {} addAfter = None if '' in data and isinstance(data[''], LinearExpression): addAfter = data[''] data[''] = 0 for letter in data: coeff = data[letter] if coeff == 0: continue else: self.data[letter] = coeff if addAfter: self.data = (self + addAfter).data def fromStr(self, string): expData = { '': 0 } coeff = '' def coeffToInt(coeff): if coeff in ['+', '-']: coeff += '1' if coeff == '': coeff = 1 else: coeff = int(coeff) return coeff for char in string: if char.isdigit(): coeff += char elif char in ['+', '-']: coeff = char elif char.isalpha() or char == '': expData[char] = coeffToInt(coeff) coeff = '' if coeff: coeff = coeffToInt(coeff) expData[''] += coeff return self.fromCoeff(expData) def __str__(self): string = '' for letter in self: coeff = self[letter] if coeff < 0: string += '- ' elif string: string += '+ ' string += str(abs(coeff))+letter+' ' if not string: string = '0 ' return string def __repr__(self): # TODO: find a way to print solutions of a system without this return str(self) def __iter__(self): return iter(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, value): self.data[key] = value def __len__(self): return len(self.data.keys()) def __add__(self, other): if not isinstance(other, Expression): other = LinearExpression(other) expData = copy.copy(self.data) for letter in other: if not letter in expData: expData[letter] = 0 expData[letter] += other[letter] return LinearExpression(expData) def __radd__(self, other): return self + other def __iadd__(self, other): return self + other def __sub__(self, other): return self + (-other) def __rsub__(self, other): return self - other def __isub__(self, other): return self - other def __mul__(self, other): expData = {} for letter in self: expData[letter] = self[letter] * other return LinearExpression(expData) def __rmul__(self, other): return self * other def __neg__(self): return self * (-1) def __div__(self, other): return self * (1 / other) def __rdiv__(self, other): return (1 / self) * other if __name__ == '__main__': print('Entrez le système :') eqs = [] while True: eqStr = input() if not eqStr: break else: eqs.append(LinearEquation(eqStr)) sys = LinearSystem(eqs) print(sys.solve())
main.py
import copy class System: pass class LinearSystem(System): def __init__(self, equations): self.equations = equations def __str__(self): eqsStr = [] greaterEqualSignPos = 0 for eq in self.equations: eqStr = str(eq) equalSignPos = eqStr.find('=') if equalSignPos > greaterEqualSignPos: greaterEqualSignPos = equalSignPos eqsStr.append(eqStr) # Sexy printing i = 0 for eqStr in eqsStr: equalSignPos = eqStr.find('=') eqStr = ' '*(greaterEqualSignPos - equalSignPos) + eqStr eqsStr[i] = eqStr i += 1 return '\n'.join(eqsStr) def __len__(self): return len(self.equations) def __iter__(self): return iter(self.equations) def __getitem__(self, key): return self.equations[key] def __reversed__(self): return LinearSystem(reversed(self.equations)) def pivot(self): allNull = True for eq in self.equations: if len(eq): allNull = False break if allNull: return self pivot = None pivotCoeff = None pivotEq = None for eq in self.equations: for letter in eq: if not letter: continue coeff = eq[letter] if pivotCoeff is None or abs(coeff) < abs(pivotCoeff): pivotCoeff = coeff pivot = letter pivotEq = eq eqs = [] for eq in self.equations: if eq is pivotEq: continue if pivot in eq: eqPivotCoeff = eq[pivot] else: eqPivotCoeff = 0 eq *= pivotCoeff eqPivotEq = pivotEq * eqPivotCoeff eqs.append(eqPivotEq - eq) if len(eqs) > 1: subsys = LinearSystem(eqs) eqs = subsys.pivot().equations eqs.insert(0, pivotEq) return LinearSystem(eqs) def solve(self): reducedSys = reversed(self.pivot()) found = {} for eq in reducedSys: result = eq.solve(found) if result == False: return False elif isinstance(result, dict): for letter in result: if letter in found: if found[letter] != result[letter]: return False else: found[letter] = result[letter] return found class Equation: pass class LinearEquation(Equation): def __init__(self, data = None): if isinstance(data, str): members = data.split('=') firstMember = LinearExpression(members[0]) if len(members) > 1: secondMember = LinearExpression(members[1]) self.expression = firstMember - secondMember else: self.expression = firstMember else: self.expression = LinearExpression(data) def __str__(self): return str(self.expression) + '= 0' def __iter__(self): return iter(self.expression) def __getitem__(self, key): return self.expression[key] def __len__(self): return len(self.expression) def __mul__(self, factor): return LinearEquation(self.expression * factor) def __add__(self, other): if isinstance(other, LinearEquation): other = other.expression return LinearEquation(self.expression + other) def __neg__(self): return self * (-1) def __sub__(self, other): return self + (-other) def solve(self, found = {}): primaryUnknown = None secondaryUnknowns = {} value = 0 for letter in self: if letter == '': value = - self[letter] elif letter in found: value = value - found[letter] * self[letter] else: if primaryUnknown is None: primaryUnknown = letter else: secondaryUnknowns[letter] = - self[letter] / self[primaryUnknown] if primaryUnknown is None: return (value == 0) elif len(secondaryUnknowns) == 0: return { primaryUnknown: value / self[primaryUnknown] } else: # TODO: didnt managed to find a clean way to do this # Even with the __div__ magic method secondaryUnknowns[''] = value * (1 / self[primaryUnknown]) return { primaryUnknown: LinearExpression(secondaryUnknowns) } class Expression: pass class LinearExpression(Expression): def __init__(self, data = None): self.data = {} if isinstance(data, LinearExpression): self.fromCoeff(data.data) elif isinstance(data, int): self.fromCoeff({ '': data }) elif isinstance(data, dict): self.fromCoeff(data) elif isinstance(data, str): self.fromStr(data) def fromCoeff(self, data): self.data = {} addAfter = None if '' in data and isinstance(data[''], LinearExpression): addAfter = data[''] data[''] = 0 for letter in data: coeff = data[letter] if coeff == 0: continue else: self.data[letter] = coeff if addAfter: self.data = (self + addAfter).data def fromStr(self, string): expData = { '': 0 } coeff = '' def coeffToInt(coeff): if coeff in ['+', '-']: coeff += '1' if coeff == '': coeff = 1 else: coeff = int(coeff) return coeff for char in string: if char.isdigit(): coeff += char elif char in ['+', '-']: coeff = char elif char.isalpha() or char == '': expData[char] = coeffToInt(coeff) coeff = '' if coeff: coeff = coeffToInt(coeff) expData[''] += coeff return self.fromCoeff(expData) def __str__(self): string = '' for letter in self: coeff = self[letter] if coeff < 0: string += '- ' elif string: string += '+ ' string += str(abs(coeff))+letter+' ' if not string: string = '0 ' return string def __repr__(self): # TODO: find a way to print solutions of a system without this return str(self) def __iter__(self): return iter(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, value): self.data[key] = value def __len__(self): return len(self.data.keys()) def __add__(self, other): if not isinstance(other, Expression): other = LinearExpression(other) expData = copy.copy(self.data) for letter in other: if not letter in expData: expData[letter] = 0 expData[letter] += other[letter] return LinearExpression(expData) def __radd__(self, other): return self + other def __iadd__(self, other): return self + other def __sub__(self, other): return self + (-other) def __rsub__(self, other): return self - other def __isub__(self, other): return self - other def __mul__(self, other): expData = {} for letter in self: expData[letter] = self[letter] * other return LinearExpression(expData) def __rmul__(self, other): return self * other def __neg__(self): return self * (-1) def __div__(self, other): return self * (1 / other) def __rdiv__(self, other): return (1 / self) * other if __name__ == '__main__': print('Entrez le système :') eqs = [] while True: eqStr = input() if not eqStr: break else: eqs.append(LinearEquation(eqStr)) sys = LinearSystem(eqs) print(sys.solve())
0.425605
0.305089
import sys sys.path.append('/home/george2/Raise/ProgramRepair/CodeSeer/projects/src/main/python') from CodeJam.Y14R5P1.Grzesiu.A import * def func_0c1046dd31d944ea823eab991f0e63dc(totalsum, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA return kA def func_422fc4f073a5491ca907af456989307d(totalsum, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA return kB def func_cb25b39d091a4ed0be971403e40545e8(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return kC def func_48ddb4d7198042df9124af4330d4a9de(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return kB def func_bba41d648d0441dca54c56d48145d9af(kB, kA, totalsum, total, b): kC = total - totalsum[b] return max(kA, kB, kC) def func_130b9eec4f0f4f0491610e9a630f05df(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kB def func_c418382fb0eb4534952deae538bb9d95(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kA def func_dfb1511a80fe42d0920b4b71b233a7ac(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kC def func_b007cdf7074f4d2382215cd9b63f23b6(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return max(kA, kB, kC) def func_e65f348d9f5c470e812bbdfd0bb9769b(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return max(kA, kB, kC) def func_8e4850ce4f84418ebfc04ad182d62d33(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return p def func_7116f7f249d84c3e8c2e9376e5e146f0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return s def func_416f54a060fd409d8a38cf6f7339f537(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return A def func_da0f02fa2fab4bfd90e55bb5c1f3897a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return q def func_f1cafdeac7924855905a43e0e50f8c85(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return i def func_af94cd7291db4d8392637e0964190c75(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return r def func_dd4ee7dff058465e8f9093c72bf44be5(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return N def func_6dd4a037ee1c41ed8bdf11451d7e1266(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return total def func_954d03bde7054130aab706fa6da97018(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return A def func_82ac2147bb5d453ca2588da6a7904c95(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return i def func_9391841ca22f4e45864b78ca7501bd3b(A): total = sum(A) totalsum = [a for a in A] return total def func_5fa8c3c70c6b4c4d824ad7d14417620a(A): total = sum(A) totalsum = [a for a in A] return totalsum def func_94aff88d4b4848d3bd7c9da2849f2741(A): total = sum(A) totalsum = [a for a in A] return a def func_deacbfabc9ed40e0a33ec1637bf3430d(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_9d5cfc4a34764e4f867da51ac2811b37(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_03d2f890a2c949a89793ecdc37f01f8f(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_bc6e0ffb677a4a67b1ba826848706e9a(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_6193114b510e409fbb3ed2fb52bd8b7d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_78f971ff88584c14ad46ac76e6fc8032(total): best = total b = 0 return b def func_f3a042db45ca47a0880954620f7b5783(total): best = total b = 0 return best def func_d26fbe01c90148db82aaa7350d85683b(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_b2b1a0159b424f4a8e5e2b5bac201d3d(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_00ae7a5021ec492d8850a5f8530f152f(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_eba418b4202c415fb7e3f41e9688876c(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_a55d54ba506b4cd2ad93472f66412496(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_5c90fc2fd4474d2f8fe63538661a736b(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_cb9fa78f3b444f86ad7698e0c085d7c8(T, total): best = total - best('Case #%d' % T) return best def func_93deb75380134701984007a407855566(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return q def func_d92a13d828a942c28298b66ca886930d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return p def func_5a6d25f1446a46529d652fb6c2ae134f(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return r def func_150486a3999145ec89520933b8f88e70(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return i def func_0d712110dc7c47779dd70c540d1aa50d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return A def func_7937b50a609540bdb874c3ad9fcda873(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return s def func_3073a97d9ecd4a1c92b7db471d088adb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return total def func_b43a45da96df4bc199eada33015296a5(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return N def func_6a89344f1c3c4b8da1b282d31691fa98(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return totalsum def func_8fb52450fc054702b35b62053f47b93d(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return A def func_a5faeb40726d4e7287b8837bc707874f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return i def func_bb60e94bb9a14c1bae93b1a33d441eef(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return a def func_b47f7a892dd2437bbb253b9fb787f688(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return total def func_0287b13dbc004259bde8be86e46d338a(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_721f8e105ea84f1eac5263bbeb281074(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_8007080568044eaaa1129ad105693aaf(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_8c742d967969486fb7cf47965a68ccad(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_cba549662da849b58feff5076242d903(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_5427bae4642e4fdeb8cc62f7b3113952(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_099d62d420a14be2af61d0eef35882cc(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_412aa6909aca4e2f958cf37202da9dd7(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_e35f043e8aa84ecc8b3e0393dfd707bc(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_8beeb2ec54f54b3391cac4ec0668b67d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_652d5bbc2211491288de6c3066a45dce(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_d184302c4fe64cde800c5118ad0b7f31(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_d016d8debeab484193fc6070b396464f(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_c668763de076457cafe3d525f03b9aed(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_ce9c680390fa4a739bcb2f216f41cc08(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_8cefb7563b65491f840bd963a4e06e28(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_9205e1b6d15c47ae95da73e32aa7d2c2(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_7d3bdd4aaa334ab79331397a4270a372(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_8819fef0fc5148e4a0470dcfa8346b13(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_83b5413719db4c81ba4a54550c7a474e(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_4628dff9ecb34bc9b8665814ed14c2d3(T, total): best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_f6c3835ea4824cbf80d96583a94cb3d0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return A def func_a2a7841663d749e0b6a1538c684e1b57(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return N def func_a433cc19c124454a97c8a4cf27bcd898(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return total def func_f24006dc23f846e185568867764af2ee(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return totalsum def func_c3c09e290323417ba11580f0e7713ce4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return s def func_0945d65e8a434ee9a719cfdfaf94fcd4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return r def func_f149df5fefb448f49ed7ffaf58d287e6(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return p def func_d7b19a4983f64e608c3a2995ec0ffc2d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return a def func_5aaf89c6004f40429b036ef3d20be59f(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return i def func_b33308ebf4ba4c2f86b38d6d146ad9cc(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return q def func_ed829d76cfdd4b59a9adc102aa0fbaa5(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_95540fe1d5db495a96297feb9ab821b2(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return A def func_8ab2527b70af452baf1cf9779d1cbcaf(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_a8cd2d6b156e44b2ad0e6504ac6bbed1(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_d06f6698c2a846998ba7071fd9458b55(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_3644d4881d65454a8b0e9d0510e38422(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_b3feac9ec0694c90b19b8e431568b51d(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_f9479ff289a948be8c2d7a7b0f2dfa83(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_ac8b92c83ce248479046b3d1191f9935(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_4875af921b0c4977ba51da4e664ab59b(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_31a999361e184b9b8d1f149a051ddcc1(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_df07ccb748a54e528df29cc926af1ee4(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_d398a0b3c1c94fae9678823ece240fea(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_faff262f409e4f248fa54d003c00fefb(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_114e4fe8358a4f32a697fd438e39773e(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_668cfa2fae264d36867d27ffd2ae1e2b(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_cdd19a5dbfc643abaeaec08464a05c9d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_2174296acb144810a55351d88c5dcce7(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1f03d84bfae0482f9aa5f9d61a1da0c7(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_5833337ca69a40a181bf8c1cc7d68ff7(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_fe7110a853a64080b6fbd23084718eaa(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_b1f3ff45a4c94846843ba29db93fe331(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_81ea9263f3e842a9ae01a7433382d4c8(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_bf9d5058feb84aee80c5ca00a2cb54b2(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_030442168f234726b610e6a0c02e47a9(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_ec1d02104ff94365a146555cb0225777(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_68b2410982af4f4a96700459610ac3f8(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_ea040bbde3f44a7cb65e7b1f853f83e2(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_0e8c513fb442411f97db0855e99c9cfc(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return N def func_c7aac4232ceb4332bb6765fe230eb8cb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return r def func_c64ef9dd33e540a1933b88193be1c149(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return s def func_b70140caa4824149831541bdc759ac7b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_d8e62241fbe24924a08ed3df065f67da(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_3c475224df74450ebbbebd68db957a8b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return q def func_43f87e93b79b46e9b36f5ec1ac85c946(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_241fa146277d48f2b99447ee62343980(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_190c482f8d024b3599d388e753beb073(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return A def func_8c8a3306df2b4e8c8535f5c1df820f9e(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return p def func_cd51604d70bb4ef5933fa927221116fa(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_bb3e4b971f22470da676c5b725207f07(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_a019d6d9f147401e9081f89d7dbe4bba(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_e05db95d4c7a47b89133877c29283d4e(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return A def func_771e4fdad22c419e80e2672653ef8ad7(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_6e414cd37558425f9ae245e0f4b7c937(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_785e8ebf3c9146ce952803401103dabe(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_9d95579b9fda4f26b88e39b79c5059d5(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_1b7921098626402992761f63a58479ce(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_68e5b2a66f5a4bddae385b8336308872(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_9dc316eb090e414098169c7abcf13cb7(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_80d4864700ce4dd0ad11216a8af20a43(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_b64703189512463e9ee70d7dc83fc375(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_bd4c2269f3a444c580534180fd56666c(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_0eb21573e19d44e0904f29a1a176a7b4(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_6e165c549d7349069dcad42585d4381a(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_f5e3925197d94712bb243ebda63886d0(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_0932f865260643f1a109fb1ae90c5edf(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_1390dd1047e146e1b1a6cf7838cfb5c2(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_75b310ced29e4f85b6ffa5be84905f4e(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_e19d5aceda4d42708e3d55d1748c2237(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_a4c25e095ba743018293dafb1fadc8fb(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_fc482b6c95e542c4b070b3f2c6e75c4c(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_68482c37c95e43219306daddda33308c(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_689e87938d01400d89fcdbd0a1657e42(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_a33e235cc6ce497db3a71f850c881560(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_73eacd2b66e2428facf6fe9dcd7caa33(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_fcb42c7f0c6141958b4c4eb757cf8ced(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_1b522bba99d244768f92ca0d66907596(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return r def func_f7b9697a0bbe437eaca9e33bb5952488(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_fe527a3ce0b3419aae5f158d3651b562(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_63de86573b224aae9f1f9e8474443dcb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return s def func_6462f1db1fbf46449e1f9f9c17b4ca86(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return A def func_15a8181c64ab4692a82de8ea05f134df(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_8b434e63e32147d2bc32c6d882bf50f6(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return q def func_06849a63535c47c5a28626d1066aa50c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return p def func_993fcca1c0e649cc8d64de87bd4242ee(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_e2f8594e9ca64dcd8654f23efbcc83ad(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return N def func_a8bb40fc65134737ba360f8f3cd4b5ba(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_5c936034506c47c5bd14033a6b953f6a(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_ed345658196c43768f6c38d1cd4015d4(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_3e88384849a9496ba926be882060713b(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_6d4fff6f763647ea8f0e9dd103679f30(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_a5c7bc28811e4fd1ac02c08c235801d5(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return A def func_7248f802060a4e7794c8959d6107aced(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_bed0aeae57e14a26a98754c47d037921(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1031ea5561494143b4f27b3c582366d1(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_53561c5d176f45759894a733267b6035(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_88aabe94e6764b318ca15090dd04797b(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_aeff768c0ff849b28f22b3666805f417(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_7f27c39d96914c7ca3021ab236623286(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_9bd6ec8d36d940eeb9c65f5f0fee09bd(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_fff41eaa356b426abbec77e0ae7cc499(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_76d4ce7de8cd4ebdaea20dfb1d396722(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_533c9fcc8ae8408a928cf5db36ca6bab(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_c6ebc6f32ada46b89d186717cd7f078e(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_f781a8c9fa3547e0bbec9cee8cd9dc58(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_71f4942496a64bf18d521cf89329fc4c(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_c3f89268148b4e67be97d9e5a2e5914e(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_1e34644ed714453fa16f2cadc0130a53(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_01e307c903734bd9aefbc95a706f28b8(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_61e5332a00f8429382f5e19b86b0d934(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_5eb9c9bbd97d4c67928fcd40c9ac09e6(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_3eca48fdc68a451eb952d89dadf9c55d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return p def func_7d3910e9f0b74b938c3dd982d0e5d964(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return q def func_d917dff6872b4f9088039baa3af2221d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return N def func_01a1ccf646a24ddb8981de1e709514b2(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return r def func_6cc54bb0375142feb13cf04e82a65936(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return A def func_0be6caff8ed74f02b53e6aa04d43bf93(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_3d82270a03184d0e85302a0befa29e7d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_2199d683b992451d9c735d69c8380c8c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_13c29f009dca43cea9c187660f33a6db(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_49b4495284ab46febcbc82c7168483c0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_7a087966ced24570a7629b2dc30f9a29(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return s def func_479c4c122a8b4679b2faaa9b5d48f378(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_f4ad26e4e8b4430daaf801ac9274191c(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_d9e3392f603c479ca85259bc0c7b34b2(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1d7d2382410e4afbad6e132229e3df25(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return A def func_893929db04274d1f82a7d73563096ef6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_50795ee331ee43258656611679f9b6d6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_818782be43824fbabb7740c3f72462ce(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_1b4eba326d7447e585ef56ee6461ac8f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_d28aa504c42b4e95a31d5ecc209cc372(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_a0601ae8aa534f048cb6098f9f85db51(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_c952a48a25e247f8be18eabaf023cdfd(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_835332840fcf4d8e917feeca658aec77(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_1a6aa03d8fed4735b6c35cda31b064e8(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_41a16dbe9ef949c3a0325a4933038f16(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_297acb7c309b46209e1a96b19a82e91a(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_8c735db321ef4188a222ecdcd7b2efe8(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_dd31827642ae4575831fe6cda5a39b91(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_1d7e4a5716a44b22a2305573c28676a1(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_c4ac65d1931343bb9b6e996ad4152ef3(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_f27c58c7cc4d4147a89c1096958515f5(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_e62fe36dc80e44a0a41bea416e4f92f1(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_e11294462e2445489b52e6b0eed435ee(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_49924ab686004a759bf4948f2bb194d6(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_75b0e58d5c2046e0bb5b1406882523c4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return r def func_4e2e5c8fcc194f20993cddfdc052c55a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_7403b011372b40a3a65d9ad4ebe400ba(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return N def func_27cd90810fbf4495ae543bd7962d072b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return A def func_00ffe956dfba46ddbc805bd41de24ddf(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return p def func_9bbacec9b3af419cb486abe3fb656408(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_93308f57be724854adc102abcc118d34(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_b0aa3e8451194389961221e9c416616a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_f56482a2429e4e148f120717c06e84b8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return q def func_8055994d0065464d93ef85cd8c21131e(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return s def func_3bcd690eec1940128543fccbf5c22bfb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_0221858737204fa389e982dac0799bbd(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_5139fada504242c281e3dfaf4c5444b6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_4df52d7b70ad4a37810abf46330a3aa3(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_c5d31a6eb622455b9f7c863026b5eada(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_6d0a581ab9084400bc2ad4509dd962e0(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_47d3b72343c94709985a4ec5a9754219(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_10c189a3fd28494689725a3fdc8f9891(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return A def func_d43643d34ebd49c591a6a144a9caf44f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_c6d2018833c143c2bd608c67feb3227d(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_526fa2fc984f4447b08763398b048a81(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_3366a28a998f41dc933c3362dceb1430(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_e61ed751ed6c464ea3c72675a48a505b(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_698f2fced81d49a7b92b09b9cc787229(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_2e985ed82f844b43a73426f35f0d4513(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_326a084b251c474aba3bf5157e019e23(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_83f866438efe4c8f894f8b44ba707abe(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_192877dd3f8542e0a895f6b9f318d9a9(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_6be1570d9df14bdeabe0c780d71063f1(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_ea53fec8af8b41f69313c3e927e451d9(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_172a73f5168749b1ac20de58ee22ef30(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return N def func_76570db24c144caa91967ac9ac1e9e4c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return r def func_adbf640f1e9e4cc0a7fd3eaee07b38a9(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_2aaa3e8ae0c640c793a528fc63a5e41c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_957089c5fc5545cb9ce942b5d4ef80e8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return q def func_366f89dec9974b10990f0331536c05c8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return p def func_7d49a5cd82954d9bb8f4557a9e1764de(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return s def func_59a339997e42418688238fc08183ea56(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_9411e23d1c104f8b81d7ae15d9cd790d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_38ef4e85f58242eb890ce11e30ee544b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return A def func_0a3d9c5358794d96a07a86e88bd11f43(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_a89677cd5d8b407aaf99ada694aa9eac(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_7fbab4a6a241418781b5a2d12d1a7f03(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_9aa3be1304334d078816c173dc2f37d7(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_6187c62abd5d4f4ea088f53fc2d4a8cf(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_ff3b2d5022b841e495bea0c9eb53a45a(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_1f93aa92e947411b91e6f2783d55222a(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return A def func_597204c0cb404c9983974cf8f235e6ca(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_8605c097769648f3819629d43916b606(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_ef7dba35d5834656a73cd78555f023b1(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_45b5aec34b7548d7b1f5f9d42de99bd8(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_d6b516d8e9234a5dad5dc8802b0504ab(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_611534ecf9b2487c9cdcd23bf333395c(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_7934f1a86e094e1d864da8df5603aa7c(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_e5b4633dc62346eba6d8ace8f7f5b9e6(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_c8ac40984b3c4144871b8690b2828687(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return N def func_809b9e1e6c3a496f9caa599728bbb901(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_1ceb53a530e1435bb681a95a0d241be1(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return s def func_97d13fa555774b9e84f227df329b52f2(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_bb6de3759b69441ea78b54431633b006(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return A def func_05499c2e780348f98504bf8f7b9c7d9d(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return p def func_00d72e88b8404654b956708f231daadc(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return q def func_af9e65eec45c451b8eb830b4b95345aa(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_b0ff1c498786447195d14db4860ca57f(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return r def func_411779ddb1ec4ade957f1d8871308397(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_81c3b38dac0c48fca84e80de2cad5358(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_72dc98d4f7504e5387cd75838acb038e(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_8ce62155b9734233b417516d60100590(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_70be2c23b409422c9fdf414d68939ccb(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_e3a7d5c635e54faa89dea71f048d02ab(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_0f4fb040495b4139925341acd807c78c(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_f539a9e24bac4f8796e02e51c3d12476(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_ec4ef50f73ed4cae94034202d150039b(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_5288b32e62e7470fab938555be76d716(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return A def func_efaa44fe3f2b4b2c9855bfd133bd99b0(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_56c37c59c8934f7aa515817dbe7140a2(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_7495008816464a76bb91d2ffc4988345(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_beef533c5bd543f695c4e264d1cd8fe0(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return A def func_e3493e1ae4b94c3b88b0cacdc6ceb441(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_48e70dfd9719447583b13b505e41e402(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_002b1a05bdcd4e15a8af5576d9b91ca5(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return p def func_1e9868541192432497f7afddf6598f40(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return r def func_15358d1d753f4af0b5abf587f122981a(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return s def func_525021bbfb694e2d81ea77e6dfdfb893(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return q def func_3085b093b0094ae3babe3700b49f3241(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return N def func_529d5d0ce6d24c7b89be80d23f00dc9d(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_d3f7b486a618491a9a2c5ce79bc867c9(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) return T def func_0784b0652171461a8249f952f2b48000(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) return infile def func_379b3ac414f3412d82a2a3d21559845e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return i def func_a15be2b4249741d2a57c8a1a96e038dd(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return p def func_ddaa4aa4e21a46f1a02effc47cf59045(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return r def func_f2ee59dcc42c4d53b8a37093f7e40f19(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return A def func_4e6cc241c7314974b4d28fd300c27ef7(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return totalsum def func_dc36827cd4164af3965269e69805f105(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return N def func_311acdaf55a14825b30544b6f62de751(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return best def func_2b849feb727142e989b398248e69c4b0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return total def func_84004c157eb24824a7dd45092acff705(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return a def func_ed9f2e9046bd48a6bc7b1f2cbd4b3307(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return s def func_06ac1429d0dd4b6786a480a62be93d63(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return q def func_358f85f329ad449f915a3878e2b03ee6(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return b def func_d96a764c862148198fc928d5c4aea2ef(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return T def func_392b3c81c3aa40eda55980e1c2344b73(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_d17b7e8cddaf4ab9b9cec7ed00676ccb(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_160b060d21ff4a44a65dff46a628505c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_d52463c4007c4b1298b2c5b933e78cab(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_03d836aa566443159aaee96fbb4e9967(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_7e38d9e98b1049158c869d531753c12f(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_10894e4371e1435d9b05f716a68add7b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_0a11821b1137476e88c18298384deb8b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_15bad475ff63420baa3ece9f13f35a04(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_caf0cedfefe54103993a5aaffc3a5f5b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_73f6530a43ca4df1af33294cc65337cc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_5ad67b425b01433da824f5b458409971(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_2a6eb9490f3b4fa89c4c00fe246f8bcf(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_39b5ff4411a3446aa7aa21c266357ed7(N, a, total, totalsum): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_8abb784db8474fe48574d1cf6e65cedc(N, a, total, totalsum, infile): while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_c10f7260f9ae4d4db9084aa2e4364cda(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return A def func_1e62ef3080d34852a8994b744dd7cf8b(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return totalsum def func_2fe7817bb9454ac4a7f42c36b06e5656(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return N def func_41b7bcd3d9054f88afd5d7481ab082db(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return s def func_2c40fb27367d4bb09fd59d10002217fe(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return best def func_879c0a5a046d402197301a1dd262a502(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return T def func_5700b7f5ad5445a2ae57b59931d8218f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return q def func_3fb83ef4cbac4845919264234344ea5b(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return total def func_ed1ca0fdfe934213a9689a109a05a323(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return a def func_14b182e6c4d442a2a6333c20f33098af(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return b def func_74cdc7c4ea58410b9e9e3d4153b8528f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return infile def func_52fd8244225c47539b667eff5ac1c506(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return r def func_1e280bac5e4f4881b06a6ffb6c3bcd27(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return p def func_97bfc163c6f94530a61ae008f98138c5(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return i def func_7f420ba7f38040f9bdf680eed5f6ca30(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_f1905696e0384d21b40588505d7d96a4(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_10ccb346b51f4c6bbbd2924a66031d26(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_dd77ecfb51634b54906d9828787b665a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_2df92723130a4dbb9e3bd917045f1364(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_a4f0e5f3379042e6868bfda705691e5a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_eeffb7d067d94cf895a14810273b3adb(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_5b593d280d894227886d9820e2620ed7(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_8fc587178b0f425893cfb8b8d0bf3ab0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_eb5f88e2fd7749f08864f8f47842b573(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_1ca496655a6749638375900047039b79(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_d398731c95e149a2a588991bfb6cc19c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_10873cb0fc834b2e8aae8c536c30e9ff(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_b564fdc0138845c596ef79cd1a15d0bc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_b42646bf57b04e1ba5eb398e69ab566a(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_f13a21b1f8294c6ea4692285e7257508(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_e6c89cbce82b4fe59072ac31bd8cccfc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_7b973b66bfe248a1b083a7b65d8747cb(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_06a170a9d28944df9bd77ac6dbfc9bb9(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_e56980d85c51442fa98eaac3e42761f6(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_ff24164b9e5c498eb583322af419353c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_d22a16a174d74323bcdfc0748c900fb7(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_3198becba046425b9f7701a079086953(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_42bb0ea960504637ac6203bee7e46b30(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_510efd6a1bef4ea4915b38410ec44f95(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_d4db808b5c5f4ad19f746d92b5eceea1(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_0fe0cb5387d84c33a820ce7538128287(N, a, total, totalsum, infile): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_a4c9e7f7ac2d41169d555389b022f1b2(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_df00b7d4111b4b17ae5338bc5d859307(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_e3759d7baf854516acd05dd65f58e267(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_001061ffe51349cbb94a04ecda918986(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_b5cf5d42ed4d46ce9647adf74afadbdf(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_c8c31fa793ec4baf9ebe919e60d10e63(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_81d7ec305fd14deea9aae3abfb35ea46(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_b78708fc55d5493dbd5bf9e59d12fffc(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_dc22601ca4164c319547ec8092cd1ca0(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_c41e70b8b5b145f3b436438803d19f3e(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_7649988e353d42b4b610723f812d4f3e(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_60b98beb7ef74a05829454996e6baf05(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return infile def func_3fd2df326bee456eba012bbca72a6827(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_8b92c7641e484c3185ac21b876e1c6a3(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_a058fb23c70c4f83b621ff8b996ca757(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_79cd49364c704b2481ae80b0d388570e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_6beb80e3001a481a84058c4d33a9c8ce(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_1691ea258a804e008ed80b0b27bfe0b0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_684fcc825d8c47bcad7082f202f2183f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_c1bd00b0cf194523b77e76a0ff6c7b63(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_cedb8992c5f34bb4a21e2acfb535ab9a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_f25afc94d1bf4c3cb31d44c394340e06(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_754e6e270ffc43aea9841c9db716860a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_ad489c77b0394a6d991496c4c1d96e9a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_d2f5cfd435914ff79a6b5ec165eb991c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_a834e99521a342968ed049cd9018765f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_368aa2f7d8f843508c1434ee4c9483aa(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_a8cf91de524d4990853190090965d2ff(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_5a1da4b690934fcfa28be57548550a80(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_c24477c0275f4141bc5892c5976f4776(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_347910efdefd4af6a57bfb08473be165(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_fb81a2754a094fd5a2d0d9692c491195(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_4ef8b31e24144bee942d35ba1d2774b8(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_c39bfa9851fc481fae8afe335afe55fd(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_8f7d9b18b0f14b1e8ab440a10887730d(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_70a941215b834f7eac54b7c1636adfb4(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_b4cd67a31efc4ead91b67fbc22e24dac(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q def func_a22c619581fb44ae9f584033f0899eb8(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_693ed1bad29e4b8a95d978208b7d6f86(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_07cf1ae667834722a41368a3a3a52f0c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_c172c6329ac8403aae7f07e75e313b64(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_6c62f09ceaea47129e83e1b939749cb9(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_01dc285a49b245bb9b0949a7ec01a023(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_f1811e15e03843e49fea3ba532ea8abe(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_dd8add574ccb4aae9485ee4faad801bf(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_afac472c35384280869ae404198805bc(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_ebc4290fb5fb4b4299252ce7da042619(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_7f3b9e7f1be74cb8a0529d04b3de64d8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_735b12cfd01b4a4c81f3ece45e4a28c2(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_cf36e98c4f894327bcf08c3194ae7721(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return infile def func_cb643894a3014ef1b37f5c0d1b54a565(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_a107482df78246eb8d81ca5011347c4c(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_918853ad2ecf47eaba61a6f1fc6d92df(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_8f053287fe174bdf8ad67b55f778290f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_4e14ae8b08734803a9a1388cc930810a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_dbd53d84aa8b47279f057ebe3203305e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_0bd728dcd1ac4427bbd2f8f5b9caf23d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_745b0911081e4c1096ca52012199c83c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_779e7f4767144f6e8016401603b095b1(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_68558b99861c4206a49c8c7e776ad176(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q def func_9317c45f78c1496bb6b2d72ec0df9393(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_f74e74844ed94f00bade2c9e428e8d12(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_8b1d8cfc9aa14b8e86397102da61361d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_5a3ff70a1bc943febae09e1fabf395d2(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_512bd04277844ab09213194c90f64f0f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_de5c06ddd14d4f9a800fe3568514c055(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_3dabdf4bb9bd4b19862c5bafe2e6a31d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_905f4c30854f45e6a2a1e429dcc65ffa(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return infile def func_c4b455e670464f0abb57a45a200956ec(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_424728ccf8bf444ebac61c68c76f4d3f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_b2fbcb34b7bc404195a6d2b707095403(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_9c2399ce63344af09045aa205c8e5ec3(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_0baf7a2224154215ad97b22e7a041b21(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_d1a5f32b7cd240c0b383329cd5fc9faa(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_7a1ced1d999d45729628f9914c8dc9a8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_5c85d4feecc64c9cbbafcefb97477778(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_a0bf93db7a5e4eff9bf8c8b9f3acefae(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_acfda2965eb343009d6f0e762bc726f0(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_4898b02e04f14731b38090bd045f16b8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_48cfc21f8f454641b8ba772c3aae73e7(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_109fbb71de58446b8ad0e46b3e8f694f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q
projects/src/main/python/CodeJam/Y14R5P1/Grzesiu/generated_py_84e0dc4f0d374ae0ba338a870469e2f9.py
import sys sys.path.append('/home/george2/Raise/ProgramRepair/CodeSeer/projects/src/main/python') from CodeJam.Y14R5P1.Grzesiu.A import * def func_0c1046dd31d944ea823eab991f0e63dc(totalsum, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA return kA def func_422fc4f073a5491ca907af456989307d(totalsum, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA return kB def func_cb25b39d091a4ed0be971403e40545e8(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return kC def func_48ddb4d7198042df9124af4330d4a9de(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return kB def func_bba41d648d0441dca54c56d48145d9af(kB, kA, totalsum, total, b): kC = total - totalsum[b] return max(kA, kB, kC) def func_130b9eec4f0f4f0491610e9a630f05df(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kB def func_c418382fb0eb4534952deae538bb9d95(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kA def func_dfb1511a80fe42d0920b4b71b233a7ac(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return kC def func_b007cdf7074f4d2382215cd9b63f23b6(kA, totalsum, total, b): kB = totalsum[b] - kA kC = total - totalsum[b] return max(kA, kB, kC) def func_e65f348d9f5c470e812bbdfd0bb9769b(totalsum, total, b, a): kA = totalsum[a - 1] if a > 0 else 0 kB = totalsum[b] - kA kC = total - totalsum[b] return max(kA, kB, kC) def func_8e4850ce4f84418ebfc04ad182d62d33(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return p def func_7116f7f249d84c3e8c2e9376e5e146f0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return s def func_416f54a060fd409d8a38cf6f7339f537(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return A def func_da0f02fa2fab4bfd90e55bb5c1f3897a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return q def func_f1cafdeac7924855905a43e0e50f8c85(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return i def func_af94cd7291db4d8392637e0964190c75(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return r def func_dd4ee7dff058465e8f9093c72bf44be5(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] return N def func_6dd4a037ee1c41ed8bdf11451d7e1266(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return total def func_954d03bde7054130aab706fa6da97018(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return A def func_82ac2147bb5d453ca2588da6a7904c95(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return i def func_9391841ca22f4e45864b78ca7501bd3b(A): total = sum(A) totalsum = [a for a in A] return total def func_5fa8c3c70c6b4c4d824ad7d14417620a(A): total = sum(A) totalsum = [a for a in A] return totalsum def func_94aff88d4b4848d3bd7c9da2849f2741(A): total = sum(A) totalsum = [a for a in A] return a def func_deacbfabc9ed40e0a33ec1637bf3430d(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_9d5cfc4a34764e4f867da51ac2811b37(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_03d2f890a2c949a89793ecdc37f01f8f(N, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_bc6e0ffb677a4a67b1ba826848706e9a(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_6193114b510e409fbb3ed2fb52bd8b7d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_78f971ff88584c14ad46ac76e6fc8032(total): best = total b = 0 return b def func_f3a042db45ca47a0880954620f7b5783(total): best = total b = 0 return best def func_d26fbe01c90148db82aaa7350d85683b(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_b2b1a0159b424f4a8e5e2b5bac201d3d(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_00ae7a5021ec492d8850a5f8530f152f(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_eba418b4202c415fb7e3f41e9688876c(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_a55d54ba506b4cd2ad93472f66412496(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_5c90fc2fd4474d2f8fe63538661a736b(N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_cb9fa78f3b444f86ad7698e0c085d7c8(T, total): best = total - best('Case #%d' % T) return best def func_93deb75380134701984007a407855566(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return q def func_d92a13d828a942c28298b66ca886930d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return p def func_5a6d25f1446a46529d652fb6c2ae134f(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return r def func_150486a3999145ec89520933b8f88e70(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return i def func_0d712110dc7c47779dd70c540d1aa50d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return A def func_7937b50a609540bdb874c3ad9fcda873(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return s def func_3073a97d9ecd4a1c92b7db471d088adb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return total def func_b43a45da96df4bc199eada33015296a5(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) return N def func_6a89344f1c3c4b8da1b282d31691fa98(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return totalsum def func_8fb52450fc054702b35b62053f47b93d(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return A def func_a5faeb40726d4e7287b8837bc707874f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return i def func_bb60e94bb9a14c1bae93b1a33d441eef(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return a def func_b47f7a892dd2437bbb253b9fb787f688(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return total def func_0287b13dbc004259bde8be86e46d338a(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_721f8e105ea84f1eac5263bbeb281074(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_8007080568044eaaa1129ad105693aaf(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_8c742d967969486fb7cf47965a68ccad(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_cba549662da849b58feff5076242d903(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_5427bae4642e4fdeb8cc62f7b3113952(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_099d62d420a14be2af61d0eef35882cc(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_412aa6909aca4e2f958cf37202da9dd7(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_e35f043e8aa84ecc8b3e0393dfd707bc(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_8beeb2ec54f54b3391cac4ec0668b67d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_652d5bbc2211491288de6c3066a45dce(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_d184302c4fe64cde800c5118ad0b7f31(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_d016d8debeab484193fc6070b396464f(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_c668763de076457cafe3d525f03b9aed(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_ce9c680390fa4a739bcb2f216f41cc08(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_8cefb7563b65491f840bd963a4e06e28(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_9205e1b6d15c47ae95da73e32aa7d2c2(N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_7d3bdd4aaa334ab79331397a4270a372(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_8819fef0fc5148e4a0470dcfa8346b13(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_83b5413719db4c81ba4a54550c7a474e(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_4628dff9ecb34bc9b8665814ed14c2d3(T, total): best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_f6c3835ea4824cbf80d96583a94cb3d0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return A def func_a2a7841663d749e0b6a1538c684e1b57(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return N def func_a433cc19c124454a97c8a4cf27bcd898(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return total def func_f24006dc23f846e185568867764af2ee(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return totalsum def func_c3c09e290323417ba11580f0e7713ce4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return s def func_0945d65e8a434ee9a719cfdfaf94fcd4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return r def func_f149df5fefb448f49ed7ffaf58d287e6(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return p def func_d7b19a4983f64e608c3a2995ec0ffc2d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return a def func_5aaf89c6004f40429b036ef3d20be59f(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return i def func_b33308ebf4ba4c2f86b38d6d146ad9cc(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] return q def func_ed829d76cfdd4b59a9adc102aa0fbaa5(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_95540fe1d5db495a96297feb9ab821b2(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return A def func_8ab2527b70af452baf1cf9779d1cbcaf(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_a8cd2d6b156e44b2ad0e6504ac6bbed1(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_d06f6698c2a846998ba7071fd9458b55(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_3644d4881d65454a8b0e9d0510e38422(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_b3feac9ec0694c90b19b8e431568b51d(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_f9479ff289a948be8c2d7a7b0f2dfa83(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_ac8b92c83ce248479046b3d1191f9935(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_4875af921b0c4977ba51da4e664ab59b(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_31a999361e184b9b8d1f149a051ddcc1(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_df07ccb748a54e528df29cc926af1ee4(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_d398a0b3c1c94fae9678823ece240fea(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_faff262f409e4f248fa54d003c00fefb(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_114e4fe8358a4f32a697fd438e39773e(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_668cfa2fae264d36867d27ffd2ae1e2b(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_cdd19a5dbfc643abaeaec08464a05c9d(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_2174296acb144810a55351d88c5dcce7(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1f03d84bfae0482f9aa5f9d61a1da0c7(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_5833337ca69a40a181bf8c1cc7d68ff7(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_fe7110a853a64080b6fbd23084718eaa(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_b1f3ff45a4c94846843ba29db93fe331(N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_81ea9263f3e842a9ae01a7433382d4c8(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_bf9d5058feb84aee80c5ca00a2cb54b2(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_030442168f234726b610e6a0c02e47a9(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_ec1d02104ff94365a146555cb0225777(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_68b2410982af4f4a96700459610ac3f8(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_ea040bbde3f44a7cb65e7b1f853f83e2(T, N, total, totalsum): for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_0e8c513fb442411f97db0855e99c9cfc(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return N def func_c7aac4232ceb4332bb6765fe230eb8cb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return r def func_c64ef9dd33e540a1933b88193be1c149(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return s def func_b70140caa4824149831541bdc759ac7b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return total def func_d8e62241fbe24924a08ed3df065f67da(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return totalsum def func_3c475224df74450ebbbebd68db957a8b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return q def func_43f87e93b79b46e9b36f5ec1ac85c946(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return a def func_241fa146277d48f2b99447ee62343980(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return i def func_190c482f8d024b3599d388e753beb073(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return A def func_8c8a3306df2b4e8c8535f5c1df820f9e(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] return p def func_cd51604d70bb4ef5933fa927221116fa(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_bb3e4b971f22470da676c5b725207f07(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_a019d6d9f147401e9081f89d7dbe4bba(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_e05db95d4c7a47b89133877c29283d4e(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return A def func_771e4fdad22c419e80e2672653ef8ad7(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_6e414cd37558425f9ae245e0f4b7c937(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_785e8ebf3c9146ce952803401103dabe(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_9d95579b9fda4f26b88e39b79c5059d5(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_1b7921098626402992761f63a58479ce(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_68e5b2a66f5a4bddae385b8336308872(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_9dc316eb090e414098169c7abcf13cb7(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_80d4864700ce4dd0ad11216a8af20a43(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_b64703189512463e9ee70d7dc83fc375(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_bd4c2269f3a444c580534180fd56666c(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_0eb21573e19d44e0904f29a1a176a7b4(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_6e165c549d7349069dcad42585d4381a(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_f5e3925197d94712bb243ebda63886d0(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_0932f865260643f1a109fb1ae90c5edf(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_1390dd1047e146e1b1a6cf7838cfb5c2(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_75b310ced29e4f85b6ffa5be84905f4e(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_e19d5aceda4d42708e3d55d1748c2237(N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_a4c25e095ba743018293dafb1fadc8fb(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_fc482b6c95e542c4b070b3f2c6e75c4c(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_68482c37c95e43219306daddda33308c(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_689e87938d01400d89fcdbd0a1657e42(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_a33e235cc6ce497db3a71f850c881560(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_73eacd2b66e2428facf6fe9dcd7caa33(T, N, total, totalsum): b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_fcb42c7f0c6141958b4c4eb757cf8ced(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return best def func_1b522bba99d244768f92ca0d66907596(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return r def func_f7b9697a0bbe437eaca9e33bb5952488(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return totalsum def func_fe527a3ce0b3419aae5f158d3651b562(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return a def func_63de86573b224aae9f1f9e8474443dcb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return s def func_6462f1db1fbf46449e1f9f9c17b4ca86(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return A def func_15a8181c64ab4692a82de8ea05f134df(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return total def func_8b434e63e32147d2bc32c6d882bf50f6(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return q def func_06849a63535c47c5a28626d1066aa50c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return p def func_993fcca1c0e649cc8d64de87bd4242ee(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return i def func_e2f8594e9ca64dcd8654f23efbcc83ad(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total return N def func_a8bb40fc65134737ba360f8f3cd4b5ba(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_5c936034506c47c5bd14033a6b953f6a(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_ed345658196c43768f6c38d1cd4015d4(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_3e88384849a9496ba926be882060713b(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_6d4fff6f763647ea8f0e9dd103679f30(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_a5c7bc28811e4fd1ac02c08c235801d5(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return A def func_7248f802060a4e7794c8959d6107aced(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_bed0aeae57e14a26a98754c47d037921(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1031ea5561494143b4f27b3c582366d1(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_53561c5d176f45759894a733267b6035(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_88aabe94e6764b318ca15090dd04797b(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_aeff768c0ff849b28f22b3666805f417(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_7f27c39d96914c7ca3021ab236623286(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_9bd6ec8d36d940eeb9c65f5f0fee09bd(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_fff41eaa356b426abbec77e0ae7cc499(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_76d4ce7de8cd4ebdaea20dfb1d396722(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_533c9fcc8ae8408a928cf5db36ca6bab(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_c6ebc6f32ada46b89d186717cd7f078e(N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_f781a8c9fa3547e0bbec9cee8cd9dc58(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_71f4942496a64bf18d521cf89329fc4c(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_c3f89268148b4e67be97d9e5a2e5914e(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_1e34644ed714453fa16f2cadc0130a53(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_01e307c903734bd9aefbc95a706f28b8(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_61e5332a00f8429382f5e19b86b0d934(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_5eb9c9bbd97d4c67928fcd40c9ac09e6(T, N, total, totalsum): best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_3eca48fdc68a451eb952d89dadf9c55d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return p def func_7d3910e9f0b74b938c3dd982d0e5d964(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return q def func_d917dff6872b4f9088039baa3af2221d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return N def func_01a1ccf646a24ddb8981de1e709514b2(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return r def func_6cc54bb0375142feb13cf04e82a65936(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return A def func_0be6caff8ed74f02b53e6aa04d43bf93(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return i def func_3d82270a03184d0e85302a0befa29e7d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return best def func_2199d683b992451d9c735d69c8380c8c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return a def func_13c29f009dca43cea9c187660f33a6db(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return b def func_49b4495284ab46febcbc82c7168483c0(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return total def func_7a087966ced24570a7629b2dc30f9a29(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return s def func_479c4c122a8b4679b2faaa9b5d48f378(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 return totalsum def func_f4ad26e4e8b4430daaf801ac9274191c(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_d9e3392f603c479ca85259bc0c7b34b2(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_1d7d2382410e4afbad6e132229e3df25(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return A def func_893929db04274d1f82a7d73563096ef6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_50795ee331ee43258656611679f9b6d6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_818782be43824fbabb7740c3f72462ce(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_1b4eba326d7447e585ef56ee6461ac8f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_d28aa504c42b4e95a31d5ecc209cc372(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_a0601ae8aa534f048cb6098f9f85db51(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_c952a48a25e247f8be18eabaf023cdfd(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_835332840fcf4d8e917feeca658aec77(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_1a6aa03d8fed4735b6c35cda31b064e8(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_41a16dbe9ef949c3a0325a4933038f16(N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_297acb7c309b46209e1a96b19a82e91a(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_8c735db321ef4188a222ecdcd7b2efe8(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_dd31827642ae4575831fe6cda5a39b91(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_1d7e4a5716a44b22a2305573c28676a1(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_c4ac65d1931343bb9b6e996ad4152ef3(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_f27c58c7cc4d4147a89c1096958515f5(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_e62fe36dc80e44a0a41bea416e4f92f1(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_e11294462e2445489b52e6b0eed435ee(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_49924ab686004a759bf4948f2bb194d6(T, N, total, totalsum): for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_75b0e58d5c2046e0bb5b1406882523c4(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return r def func_4e2e5c8fcc194f20993cddfdc052c55a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return b def func_7403b011372b40a3a65d9ad4ebe400ba(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return N def func_27cd90810fbf4495ae543bd7962d072b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return A def func_00ffe956dfba46ddbc805bd41de24ddf(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return p def func_9bbacec9b3af419cb486abe3fb656408(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return totalsum def func_93308f57be724854adc102abcc118d34(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return i def func_b0aa3e8451194389961221e9c416616a(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return a def func_f56482a2429e4e148f120717c06e84b8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return q def func_8055994d0065464d93ef85cd8c21131e(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return s def func_3bcd690eec1940128543fccbf5c22bfb(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return total def func_0221858737204fa389e982dac0799bbd(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) return best def func_5139fada504242c281e3dfaf4c5444b6(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_4df52d7b70ad4a37810abf46330a3aa3(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_c5d31a6eb622455b9f7c863026b5eada(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_6d0a581ab9084400bc2ad4509dd962e0(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_47d3b72343c94709985a4ec5a9754219(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_10c189a3fd28494689725a3fdc8f9891(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return A def func_d43643d34ebd49c591a6a144a9caf44f(p, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_c6d2018833c143c2bd608c67feb3227d(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_526fa2fc984f4447b08763398b048a81(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_3366a28a998f41dc933c3362dceb1430(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_e61ed751ed6c464ea3c72675a48a505b(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_698f2fced81d49a7b92b09b9cc787229(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_2e985ed82f844b43a73426f35f0d4513(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_326a084b251c474aba3bf5157e019e23(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_83f866438efe4c8f894f8b44ba707abe(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_192877dd3f8542e0a895f6b9f318d9a9(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_6be1570d9df14bdeabe0c780d71063f1(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_ea53fec8af8b41f69313c3e927e451d9(T, N, total, A): totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_172a73f5168749b1ac20de58ee22ef30(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return N def func_76570db24c144caa91967ac9ac1e9e4c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return r def func_adbf640f1e9e4cc0a7fd3eaee07b38a9(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return totalsum def func_2aaa3e8ae0c640c793a528fc63a5e41c(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return total def func_957089c5fc5545cb9ce942b5d4ef80e8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return q def func_366f89dec9974b10990f0331536c05c8(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return p def func_7d49a5cd82954d9bb8f4557a9e1764de(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return s def func_59a339997e42418688238fc08183ea56(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return best def func_9411e23d1c104f8b81d7ae15d9cd790d(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return a def func_38ef4e85f58242eb890ce11e30ee544b(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return A def func_0a3d9c5358794d96a07a86e88bd11f43(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return i def func_a89677cd5d8b407aaf99ada694aa9eac(infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best return b def func_7fbab4a6a241418781b5a2d12d1a7f03(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_9aa3be1304334d078816c173dc2f37d7(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_6187c62abd5d4f4ea088f53fc2d4a8cf(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_ff3b2d5022b841e495bea0c9eb53a45a(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_1f93aa92e947411b91e6f2783d55222a(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return A def func_597204c0cb404c9983974cf8f235e6ca(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_8605c097769648f3819629d43916b606(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_ef7dba35d5834656a73cd78555f023b1(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_45b5aec34b7548d7b1f5f9d42de99bd8(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_d6b516d8e9234a5dad5dc8802b0504ab(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_611534ecf9b2487c9cdcd23bf333395c(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_7934f1a86e094e1d864da8df5603aa7c(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_e5b4633dc62346eba6d8ace8f7f5b9e6(T, N, A): total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_c8ac40984b3c4144871b8690b2828687(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return N def func_809b9e1e6c3a496f9caa599728bbb901(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return i def func_1ceb53a530e1435bb681a95a0d241be1(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return s def func_97d13fa555774b9e84f227df329b52f2(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return total def func_bb6de3759b69441ea78b54431633b006(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return A def func_05499c2e780348f98504bf8f7b9c7d9d(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return p def func_00d72e88b8404654b956708f231daadc(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return q def func_af9e65eec45c451b8eb830b4b95345aa(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return totalsum def func_b0ff1c498786447195d14db4860ca57f(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return r def func_411779ddb1ec4ade957f1d8871308397(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return a def func_81c3b38dac0c48fca84e80de2cad5358(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return best def func_72dc98d4f7504e5387cd75838acb038e(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T) return b def func_8ce62155b9734233b417516d60100590(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_70be2c23b409422c9fdf414d68939ccb(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_e3a7d5c635e54faa89dea71f048d02ab(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_0f4fb040495b4139925341acd807c78c(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_f539a9e24bac4f8796e02e51c3d12476(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_ec4ef50f73ed4cae94034202d150039b(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_5288b32e62e7470fab938555be76d716(p, T, N, q, s, r): A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return A def func_efaa44fe3f2b4b2c9855bfd133bd99b0(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return b def func_56c37c59c8934f7aa515817dbe7140a2(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return a def func_7495008816464a76bb91d2ffc4988345(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return i def func_beef533c5bd543f695c4e264d1cd8fe0(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return A def func_e3493e1ae4b94c3b88b0cacdc6ceb441(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return totalsum def func_48e70dfd9719447583b13b505e41e402(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return best def func_002b1a05bdcd4e15a8af5576d9b91ca5(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return p def func_1e9868541192432497f7afddf6598f40(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return r def func_15358d1d753f4af0b5abf587f122981a(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return s def func_525021bbfb694e2d81ea77e6dfdfb893(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return q def func_3085b093b0094ae3babe3700b49f3241(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return N def func_529d5d0ce6d24c7b89be80d23f00dc9d(T, infile): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best('Case #%d' % T)('Case #%d: %.10f' % (T, 1.0 * best / total)) return total def func_d3f7b486a618491a9a2c5ce79bc867c9(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) return T def func_0784b0652171461a8249f952f2b48000(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) return infile def func_379b3ac414f3412d82a2a3d21559845e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return i def func_a15be2b4249741d2a57c8a1a96e038dd(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return p def func_ddaa4aa4e21a46f1a02effc47cf59045(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return r def func_f2ee59dcc42c4d53b8a37093f7e40f19(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return A def func_4e6cc241c7314974b4d28fd300c27ef7(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return totalsum def func_dc36827cd4164af3965269e69805f105(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return N def func_311acdaf55a14825b30544b6f62de751(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return best def func_2b849feb727142e989b398248e69c4b0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return total def func_84004c157eb24824a7dd45092acff705(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return a def func_ed9f2e9046bd48a6bc7b1f2cbd4b3307(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return s def func_06ac1429d0dd4b6786a480a62be93d63(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return q def func_358f85f329ad449f915a3878e2b03ee6(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return b def func_d96a764c862148198fc928d5c4aea2ef(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return T def func_392b3c81c3aa40eda55980e1c2344b73(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_d17b7e8cddaf4ab9b9cec7ed00676ccb(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_160b060d21ff4a44a65dff46a628505c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_d52463c4007c4b1298b2c5b933e78cab(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_03d836aa566443159aaee96fbb4e9967(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_7e38d9e98b1049158c869d531753c12f(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_10894e4371e1435d9b05f716a68add7b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_0a11821b1137476e88c18298384deb8b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_15bad475ff63420baa3ece9f13f35a04(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_caf0cedfefe54103993a5aaffc3a5f5b(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_73f6530a43ca4df1af33294cc65337cc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_5ad67b425b01433da824f5b458409971(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_2a6eb9490f3b4fa89c4c00fe246f8bcf(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_39b5ff4411a3446aa7aa21c266357ed7(N, a, total, totalsum): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_8abb784db8474fe48574d1cf6e65cedc(N, a, total, totalsum, infile): while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_c10f7260f9ae4d4db9084aa2e4364cda(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return A def func_1e62ef3080d34852a8994b744dd7cf8b(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return totalsum def func_2fe7817bb9454ac4a7f42c36b06e5656(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return N def func_41b7bcd3d9054f88afd5d7481ab082db(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return s def func_2c40fb27367d4bb09fd59d10002217fe(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return best def func_879c0a5a046d402197301a1dd262a502(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return T def func_5700b7f5ad5445a2ae57b59931d8218f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return q def func_3fb83ef4cbac4845919264234344ea5b(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return total def func_ed1ca0fdfe934213a9689a109a05a323(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return a def func_14b182e6c4d442a2a6333c20f33098af(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return b def func_74cdc7c4ea58410b9e9e3d4153b8528f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return infile def func_52fd8244225c47539b667eff5ac1c506(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return r def func_1e280bac5e4f4881b06a6ffb6c3bcd27(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return p def func_97bfc163c6f94530a61ae008f98138c5(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) return i def func_7f420ba7f38040f9bdf680eed5f6ca30(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_f1905696e0384d21b40588505d7d96a4(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_10ccb346b51f4c6bbbd2924a66031d26(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_dd77ecfb51634b54906d9828787b665a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_2df92723130a4dbb9e3bd917045f1364(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_a4f0e5f3379042e6868bfda705691e5a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_eeffb7d067d94cf895a14810273b3adb(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_5b593d280d894227886d9820e2620ed7(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_8fc587178b0f425893cfb8b8d0bf3ab0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_eb5f88e2fd7749f08864f8f47842b573(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_1ca496655a6749638375900047039b79(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_d398731c95e149a2a588991bfb6cc19c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_10873cb0fc834b2e8aae8c536c30e9ff(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_b564fdc0138845c596ef79cd1a15d0bc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_b42646bf57b04e1ba5eb398e69ab566a(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_f13a21b1f8294c6ea4692285e7257508(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_e6c89cbce82b4fe59072ac31bd8cccfc(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_7b973b66bfe248a1b083a7b65d8747cb(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_06a170a9d28944df9bd77ac6dbfc9bb9(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_e56980d85c51442fa98eaac3e42761f6(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_ff24164b9e5c498eb583322af419353c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_d22a16a174d74323bcdfc0748c900fb7(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_3198becba046425b9f7701a079086953(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_42bb0ea960504637ac6203bee7e46b30(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_510efd6a1bef4ea4915b38410ec44f95(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_d4db808b5c5f4ad19f746d92b5eceea1(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_0fe0cb5387d84c33a820ce7538128287(N, a, total, totalsum, infile): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_a4c9e7f7ac2d41169d555389b022f1b2(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return totalsum def func_df00b7d4111b4b17ae5338bc5d859307(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return A def func_e3759d7baf854516acd05dd65f58e267(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return p def func_001061ffe51349cbb94a04ecda918986(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return N def func_b5cf5d42ed4d46ce9647adf74afadbdf(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return best def func_c8c31fa793ec4baf9ebe919e60d10e63(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return r def func_81d7ec305fd14deea9aae3abfb35ea46(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return T def func_b78708fc55d5493dbd5bf9e59d12fffc(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return a def func_dc22601ca4164c319547ec8092cd1ca0(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return total def func_c41e70b8b5b145f3b436438803d19f3e(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return i def func_7649988e353d42b4b610723f812d4f3e(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return q def func_60b98beb7ef74a05829454996e6baf05(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return infile def func_3fd2df326bee456eba012bbca72a6827(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return s def func_8b92c7641e484c3185ac21b876e1c6a3(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 return b def func_a058fb23c70c4f83b621ff8b996ca757(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_79cd49364c704b2481ae80b0d388570e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_6beb80e3001a481a84058c4d33a9c8ce(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_1691ea258a804e008ed80b0b27bfe0b0(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_684fcc825d8c47bcad7082f202f2183f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_c1bd00b0cf194523b77e76a0ff6c7b63(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_cedb8992c5f34bb4a21e2acfb535ab9a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_f25afc94d1bf4c3cb31d44c394340e06(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_754e6e270ffc43aea9841c9db716860a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_ad489c77b0394a6d991496c4c1d96e9a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_d2f5cfd435914ff79a6b5ec165eb991c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_a834e99521a342968ed049cd9018765f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_368aa2f7d8f843508c1434ee4c9483aa(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_a8cf91de524d4990853190090965d2ff(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_5a1da4b690934fcfa28be57548550a80(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_c24477c0275f4141bc5892c5976f4776(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_347910efdefd4af6a57bfb08473be165(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_fb81a2754a094fd5a2d0d9692c491195(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_4ef8b31e24144bee942d35ba1d2774b8(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_c39bfa9851fc481fae8afe335afe55fd(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_8f7d9b18b0f14b1e8ab440a10887730d(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_70a941215b834f7eac54b7c1636adfb4(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_b4cd67a31efc4ead91b67fbc22e24dac(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q def func_a22c619581fb44ae9f584033f0899eb8(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_693ed1bad29e4b8a95d978208b7d6f86(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_07cf1ae667834722a41368a3a3a52f0c(infile): for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_c172c6329ac8403aae7f07e75e313b64(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return a def func_6c62f09ceaea47129e83e1b939749cb9(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return T def func_01dc285a49b245bb9b0949a7ec01a023(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return r def func_f1811e15e03843e49fea3ba532ea8abe(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return A def func_dd8add574ccb4aae9485ee4faad801bf(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return b def func_afac472c35384280869ae404198805bc(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return best def func_ebc4290fb5fb4b4299252ce7da042619(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return i def func_7f3b9e7f1be74cb8a0529d04b3de64d8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return totalsum def func_735b12cfd01b4a4c81f3ece45e4a28c2(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return N def func_cf36e98c4f894327bcf08c3194ae7721(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return infile def func_cb643894a3014ef1b37f5c0d1b54a565(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return p def func_a107482df78246eb8d81ca5011347c4c(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return q def func_918853ad2ecf47eaba61a6f1fc6d92df(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return s def func_8f053287fe174bdf8ad67b55f778290f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 return total def func_4e14ae8b08734803a9a1388cc930810a(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_dbd53d84aa8b47279f057ebe3203305e(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_0bd728dcd1ac4427bbd2f8f5b9caf23d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_745b0911081e4c1096ca52012199c83c(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_779e7f4767144f6e8016401603b095b1(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_68558b99861c4206a49c8c7e776ad176(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q def func_9317c45f78c1496bb6b2d72ec0df9393(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_f74e74844ed94f00bade2c9e428e8d12(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_8b1d8cfc9aa14b8e86397102da61361d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_5a3ff70a1bc943febae09e1fabf395d2(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_512bd04277844ab09213194c90f64f0f(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_de5c06ddd14d4f9a800fe3568514c055(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_3dabdf4bb9bd4b19862c5bafe2e6a31d(infile): T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_905f4c30854f45e6a2a1e429dcc65ffa(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return infile def func_c4b455e670464f0abb57a45a200956ec(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return r def func_424728ccf8bf444ebac61c68c76f4d3f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return b def func_b2fbcb34b7bc404195a6d2b707095403(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return A def func_9c2399ce63344af09045aa205c8e5ec3(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return T def func_0baf7a2224154215ad97b22e7a041b21(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return best def func_d1a5f32b7cd240c0b383329cd5fc9faa(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return N def func_7a1ced1d999d45729628f9914c8dc9a8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return a def func_5c85d4feecc64c9cbbafcefb97477778(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return i def func_a0bf93db7a5e4eff9bf8c8b9f3acefae(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return s def func_acfda2965eb343009d6f0e762bc726f0(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return p def func_4898b02e04f14731b38090bd045f16b8(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return total def func_48cfc21f8f454641b8ba772c3aae73e7(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return totalsum def func_109fbb71de58446b8ad0e46b3e8f694f(): infile = open('codejam/test_files/Y14R5P1/A.in') T, = line(infile) for T in xrange(1, T + 1): N, p, q, r, s = line(infile) A = [((i * p + q) % r + s) for i in xrange(N)] total = sum(A) totalsum = [a for a in A] for i in xrange(1, N): totalsum[i] += totalsum[i - 1] best = total b = 0 for a in xrange(N): if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 best = min(best, getsum(a, b, total, totalsum)) best = total - best print >> stderr, 'Case #%d' % T print 'Case #%d: %.10f' % (T, 1.0 * best / total) if b < a: b += 1 while b < N - 1 and getsum(a, b, total, totalsum) >= getsum(a, b + 1, total, totalsum): b += 1 infile.close() return q
0.205535
0.34798
from __future__ import absolute_import from __future__ import print_function import sys import getopt import os import csv from six.moves import range from six.moves import zip PROG = os.path.basename(sys.argv[0]) def main(args): opts, args = getopt.getopt(args, "f:s:hk:H") func = None sep = "," lambda_key = "" has_header = False for opt, arg in opts: if opt == "-s": sep = arg elif opt == "-f": func = eval(arg) elif opt == "-k": lambda_key = arg elif opt == "-H": has_header = True elif opt == "-h": usage() raise SystemExit if func is None: usage("lambda expression is required!") return 1 rdr = csv.reader(sys.stdin) wtr = csv.writer(sys.stdout) first = next(rdr) indexes = None if has_header: # Treat first row as a header. if lambda_key: if lambda_key in first: raise ValueError("%r is already in %s" % (lambda_key, first)) first.append(lambda_key) rdr = csv.DictReader(sys.stdin, fieldnames=first, restval="") wtr = csv.DictWriter(sys.stdout, fieldnames=first) wtr.writerow(dict(list(zip(first, first)))) indexes = enumerate(first) for row in rdr: type_convert(row) if has_header: eff_row = row.copy() for index, key in indexes: eff_row[index] = eff_row[key] val = func(eff_row) if lambda_key: row[lambda_key] = val wtr.writerow(row) elif val: wtr.writerow(row) else: val = func(row) if lambda_key: row.append(val) wtr.writerow(row) elif val: wtr.writerow(row) return 0 def no_floats(row): for elt in row: try: float(elt) except ValueError: pass else: return False return True def type_convert(row): if isinstance(row, dict): for k in row: row[k] = floatify(row[k]) else: for i in range(len(row)): row[i] = floatify(row[i]) def floatify(val): try: val = int(val) except ValueError: try: val = float(val) except ValueError: pass return val def usage(msg=""): if msg: print(msg, file=sys.stderr) print(__doc__ % globals(), file=sys.stderr) if __name__ == "__main__": sys.exit(main(sys.argv[1:]))
data_filters/src/filter.py
from __future__ import absolute_import from __future__ import print_function import sys import getopt import os import csv from six.moves import range from six.moves import zip PROG = os.path.basename(sys.argv[0]) def main(args): opts, args = getopt.getopt(args, "f:s:hk:H") func = None sep = "," lambda_key = "" has_header = False for opt, arg in opts: if opt == "-s": sep = arg elif opt == "-f": func = eval(arg) elif opt == "-k": lambda_key = arg elif opt == "-H": has_header = True elif opt == "-h": usage() raise SystemExit if func is None: usage("lambda expression is required!") return 1 rdr = csv.reader(sys.stdin) wtr = csv.writer(sys.stdout) first = next(rdr) indexes = None if has_header: # Treat first row as a header. if lambda_key: if lambda_key in first: raise ValueError("%r is already in %s" % (lambda_key, first)) first.append(lambda_key) rdr = csv.DictReader(sys.stdin, fieldnames=first, restval="") wtr = csv.DictWriter(sys.stdout, fieldnames=first) wtr.writerow(dict(list(zip(first, first)))) indexes = enumerate(first) for row in rdr: type_convert(row) if has_header: eff_row = row.copy() for index, key in indexes: eff_row[index] = eff_row[key] val = func(eff_row) if lambda_key: row[lambda_key] = val wtr.writerow(row) elif val: wtr.writerow(row) else: val = func(row) if lambda_key: row.append(val) wtr.writerow(row) elif val: wtr.writerow(row) return 0 def no_floats(row): for elt in row: try: float(elt) except ValueError: pass else: return False return True def type_convert(row): if isinstance(row, dict): for k in row: row[k] = floatify(row[k]) else: for i in range(len(row)): row[i] = floatify(row[i]) def floatify(val): try: val = int(val) except ValueError: try: val = float(val) except ValueError: pass return val def usage(msg=""): if msg: print(msg, file=sys.stderr) print(__doc__ % globals(), file=sys.stderr) if __name__ == "__main__": sys.exit(main(sys.argv[1:]))
0.308086
0.142411
from src.params.NeuronTypes import * class ParamsIzhikevich: """ This class contains Izhikevich parameters. :param peak_potential: potential at which spikes terminate. :type peak_potential: float :param alpha_E: describes the timescale of recovery for excitatory neurons. :type alpha_E: float :param beta_E: describes the sensitivity of recovery to the subthreshold fluctuations of potential for excitatory neurons. :type beta_E: float :param gamma_E: describes the after-spike reset value of potential for excitatory neurons. :type gamma_E: float :param zeta_E: describes the after-spike reset of recovery for excitatory neurons. :type zeta_E: float :param alpha_I: describes the timescale of recovery for inhibitory neurons. :type alpha_I: float :param beta_I: describes the sensitivity of recovery to the subthreshold fluctuations of potential for inhibitory neurons. :type beta_I: float :param gamma_I: describes the after-spike reset value of potential for inhibitory neurons. :type gamma_I: float :param zeta_I: describes the after-spike reset of recovery for inhibitory neurons. :type zeta_I: float :ivar peak_potential: potential at which spikes terminate. :ivar alpha: describes the timescale of recovery. :ivar beta: describes the sensitivity of recovery to the subthreshold fluctuations of potential. :ivar gamma: gamma describes the after-spike reset value of potential. :ivar zeta: zeta describes the after-spike reset of recovery. """ def __init__( self, peak_potential: float, alpha_E: float, beta_E: float, gamma_E: float, zeta_E: float, alpha_I: float, beta_I: float, gamma_I: float, zeta_I: float ): self.peak_potential: float = peak_potential self.alpha: dict[NeuronTypes, float] = { NeuronTypes.EX: alpha_E, NeuronTypes.IN: alpha_I } self.beta: dict[NeuronTypes, float] = { NeuronTypes.EX: beta_E, NeuronTypes.IN: beta_I } self.gamma: dict[NeuronTypes, float] = { NeuronTypes.EX: gamma_E, NeuronTypes.IN: gamma_I } self.zeta: dict[NeuronTypes, float] = { NeuronTypes.EX: zeta_E, NeuronTypes.IN: zeta_I }
src/params/ParamsIzhikevich.py
from src.params.NeuronTypes import * class ParamsIzhikevich: """ This class contains Izhikevich parameters. :param peak_potential: potential at which spikes terminate. :type peak_potential: float :param alpha_E: describes the timescale of recovery for excitatory neurons. :type alpha_E: float :param beta_E: describes the sensitivity of recovery to the subthreshold fluctuations of potential for excitatory neurons. :type beta_E: float :param gamma_E: describes the after-spike reset value of potential for excitatory neurons. :type gamma_E: float :param zeta_E: describes the after-spike reset of recovery for excitatory neurons. :type zeta_E: float :param alpha_I: describes the timescale of recovery for inhibitory neurons. :type alpha_I: float :param beta_I: describes the sensitivity of recovery to the subthreshold fluctuations of potential for inhibitory neurons. :type beta_I: float :param gamma_I: describes the after-spike reset value of potential for inhibitory neurons. :type gamma_I: float :param zeta_I: describes the after-spike reset of recovery for inhibitory neurons. :type zeta_I: float :ivar peak_potential: potential at which spikes terminate. :ivar alpha: describes the timescale of recovery. :ivar beta: describes the sensitivity of recovery to the subthreshold fluctuations of potential. :ivar gamma: gamma describes the after-spike reset value of potential. :ivar zeta: zeta describes the after-spike reset of recovery. """ def __init__( self, peak_potential: float, alpha_E: float, beta_E: float, gamma_E: float, zeta_E: float, alpha_I: float, beta_I: float, gamma_I: float, zeta_I: float ): self.peak_potential: float = peak_potential self.alpha: dict[NeuronTypes, float] = { NeuronTypes.EX: alpha_E, NeuronTypes.IN: alpha_I } self.beta: dict[NeuronTypes, float] = { NeuronTypes.EX: beta_E, NeuronTypes.IN: beta_I } self.gamma: dict[NeuronTypes, float] = { NeuronTypes.EX: gamma_E, NeuronTypes.IN: gamma_I } self.zeta: dict[NeuronTypes, float] = { NeuronTypes.EX: zeta_E, NeuronTypes.IN: zeta_I }
0.9231
0.812867
class Filter: exactKeyFilter = ['name', 'ele', 'comment', 'image', 'symbol', 'deanery', 'jel', 'rating', 'school:FR', 'alt', 'is_in', 'url', 'web', 'wikipedia', 'email', 'converted_by', 'phone', 'opening_hours', 'date', 'time', 'collection_times', 'website', 'colour', 'fee', 'population', 'access', 'noexit', 'towards', 'bus_routes', 'busline', 'lines', 'type', 'denotation', 'CONTINUE', 'continue', 'copyright', 'stop', 'network', 'comment', 'old_name', 'destination', 'brand', 'fax', 'designation', 'turn:lanes', 'owner', 'fire_hydrant:city', 'fire_hydrant:street', 'country', 'contact:google_plus', 'wikipedia:ru', 'note', 'height', 'short_name:ru', 'tpuk_ref', 'wikimedia_commons', 'operator', 'source', 'wikipedia', 'wikipedia:en', 'wikipedia:de', 'railway:etcs', 'de:regionalschluessel', 'de:amtlicher_gemeindeschluessel', 'contact:xing', 'nspn', '_picture_', 'postal_code', 'exit_to', '_waypoint_', 'label', 'branch', 'note', 'phone', 'created_by', 'start_date', 'end_date', 'description', 'description:ru', 'lacounty:bld_id', 'lacounty:ain', 'uir_adr:ADRESA_KOD'] prefixKeyFilter = ['name:', 'note:', 'alt_name', 'int_name', 'loc_name', 'not:name', 'nat_name', 'official_name', 'short_name', 'reg_name', 'sorting_name', 'contact:', 'addr', 'icao', 'iata', 'onkz', 'is_in', 'fixme', 'seamark:fixme', 'ois:fixme', 'todo', 'type:', 'admin_level', 'AND_', 'AND:', 'seamark:', 'attribution', 'openGeoDB', 'ref', 'source_ref', 'tiger', 'yh:', 'ngbe:', 'gvr:code', 'old_ref_legislative', 'sl_stop_id', 'ele:', 'source:', 'osak:', 'kms', 'gnis:', 'nhd', 'chicago:building_id', 'hgv', 'nhs', 'ncat', 'nhd-shp:', 'osmc:', 'kp', 'int_name', 'CLC:', 'naptan:', 'building:ruian:', 'massgis:', 'WroclawGIS:', 'ref:FR:FANTOIR', 'rednap:', 'ts_', 'type:FR:FINESS', 'route_ref', 'lcn_ref', 'ncn_ref', 'rcn', 'rwn_ref', 'old_ref', 'prow_ref', 'local_ref', 'loc_ref', 'reg_ref', 'url', 'nat_ref', 'int_ref', 'uic_ref', 'asset_ref', 'carriageway_ref', 'junction:ref', 'fhrs:', 'osmc:', 'cep', 'protection_title', 'bag:extract', 'ref:bagid', 'adr_les', 'bag:', 'fresno_', 'uuid', 'uic_name', 'gtfs_id', 'USGS-LULC:', 'reg_', 'IBGE:', 'sagns_id', 'protect_id', 'PMSA_ref', 'destination:', 'EH_ref', 'rtc_rate', 'cyclestreets_id', 'woeid', 'CEMT', 'depth:dredged'] exactValueFilter = [] prefixValueFilter = [] def completeFilterList(self): '''Merges and returns the exact and prefix filter list''' return self.exactKeyFilter + list(set(self.prefixKeyFilter) - set(self.exactKeyFilter)) def hasKey(self, strKey): ''' Checks if 'strKey' is in any key filter list''' return self.hasKeyExact(strKey) or self.hasKeyPrefix(strKey) def hasKeyExact(self, strKey): return strKey in self.exactKeyFilter def hasKeyPrefix(self, strKey): '''Checks if 'strKey' is in prefixKeyFilter list.''' for pkf in self.prefixKeyFilter: lowStrKey = strKey.lower() lowKeyFilter = pkf.lower() if(lowStrKey.startswith(lowKeyFilter)): return True return False def hasValue(self, strValue): ''' Checks if 'strValue' is in any key filter list''' return self.hasValueExact(strValue) or self.hasValuePrefix(strValue) def hasValueExact(self, strValue): return strValue in self.exactValueFilter def hasValuePrefix(self, strValue): '''Checks if 'strValue' is in prefixValueFilter list.''' for pvf in self.prefixValueFilter: lowStrValue = strValue.lower() lowValueFilter = pvf.lower() if(lowStrValue.startswith(lowValueFilter)): return True return False
OSMTagFinder/thesaurus/filter.py
class Filter: exactKeyFilter = ['name', 'ele', 'comment', 'image', 'symbol', 'deanery', 'jel', 'rating', 'school:FR', 'alt', 'is_in', 'url', 'web', 'wikipedia', 'email', 'converted_by', 'phone', 'opening_hours', 'date', 'time', 'collection_times', 'website', 'colour', 'fee', 'population', 'access', 'noexit', 'towards', 'bus_routes', 'busline', 'lines', 'type', 'denotation', 'CONTINUE', 'continue', 'copyright', 'stop', 'network', 'comment', 'old_name', 'destination', 'brand', 'fax', 'designation', 'turn:lanes', 'owner', 'fire_hydrant:city', 'fire_hydrant:street', 'country', 'contact:google_plus', 'wikipedia:ru', 'note', 'height', 'short_name:ru', 'tpuk_ref', 'wikimedia_commons', 'operator', 'source', 'wikipedia', 'wikipedia:en', 'wikipedia:de', 'railway:etcs', 'de:regionalschluessel', 'de:amtlicher_gemeindeschluessel', 'contact:xing', 'nspn', '_picture_', 'postal_code', 'exit_to', '_waypoint_', 'label', 'branch', 'note', 'phone', 'created_by', 'start_date', 'end_date', 'description', 'description:ru', 'lacounty:bld_id', 'lacounty:ain', 'uir_adr:ADRESA_KOD'] prefixKeyFilter = ['name:', 'note:', 'alt_name', 'int_name', 'loc_name', 'not:name', 'nat_name', 'official_name', 'short_name', 'reg_name', 'sorting_name', 'contact:', 'addr', 'icao', 'iata', 'onkz', 'is_in', 'fixme', 'seamark:fixme', 'ois:fixme', 'todo', 'type:', 'admin_level', 'AND_', 'AND:', 'seamark:', 'attribution', 'openGeoDB', 'ref', 'source_ref', 'tiger', 'yh:', 'ngbe:', 'gvr:code', 'old_ref_legislative', 'sl_stop_id', 'ele:', 'source:', 'osak:', 'kms', 'gnis:', 'nhd', 'chicago:building_id', 'hgv', 'nhs', 'ncat', 'nhd-shp:', 'osmc:', 'kp', 'int_name', 'CLC:', 'naptan:', 'building:ruian:', 'massgis:', 'WroclawGIS:', 'ref:FR:FANTOIR', 'rednap:', 'ts_', 'type:FR:FINESS', 'route_ref', 'lcn_ref', 'ncn_ref', 'rcn', 'rwn_ref', 'old_ref', 'prow_ref', 'local_ref', 'loc_ref', 'reg_ref', 'url', 'nat_ref', 'int_ref', 'uic_ref', 'asset_ref', 'carriageway_ref', 'junction:ref', 'fhrs:', 'osmc:', 'cep', 'protection_title', 'bag:extract', 'ref:bagid', 'adr_les', 'bag:', 'fresno_', 'uuid', 'uic_name', 'gtfs_id', 'USGS-LULC:', 'reg_', 'IBGE:', 'sagns_id', 'protect_id', 'PMSA_ref', 'destination:', 'EH_ref', 'rtc_rate', 'cyclestreets_id', 'woeid', 'CEMT', 'depth:dredged'] exactValueFilter = [] prefixValueFilter = [] def completeFilterList(self): '''Merges and returns the exact and prefix filter list''' return self.exactKeyFilter + list(set(self.prefixKeyFilter) - set(self.exactKeyFilter)) def hasKey(self, strKey): ''' Checks if 'strKey' is in any key filter list''' return self.hasKeyExact(strKey) or self.hasKeyPrefix(strKey) def hasKeyExact(self, strKey): return strKey in self.exactKeyFilter def hasKeyPrefix(self, strKey): '''Checks if 'strKey' is in prefixKeyFilter list.''' for pkf in self.prefixKeyFilter: lowStrKey = strKey.lower() lowKeyFilter = pkf.lower() if(lowStrKey.startswith(lowKeyFilter)): return True return False def hasValue(self, strValue): ''' Checks if 'strValue' is in any key filter list''' return self.hasValueExact(strValue) or self.hasValuePrefix(strValue) def hasValueExact(self, strValue): return strValue in self.exactValueFilter def hasValuePrefix(self, strValue): '''Checks if 'strValue' is in prefixValueFilter list.''' for pvf in self.prefixValueFilter: lowStrValue = strValue.lower() lowValueFilter = pvf.lower() if(lowStrValue.startswith(lowValueFilter)): return True return False
0.494385
0.433082
import os import re import sys import math import time import jieba import torch import config # 常规参数设置 import random import argparse import numpy as np import pandas as pd import torch.nn as nn from torch import optim import torch.nn.functional as F from torch.autograd import Variable from preprocessing import Corpuspreprocessing import seq2seq.seq2seq as Encoder_Decoder os.environ['CUDA_LAUNCH_BLOCKING'] = "1" # 方便定位报错信息 USE_CUDA = torch.cuda.is_available() SOS_token = 2 EOS_token = 1 parser = argparse.ArgumentParser(description='manual to seq2seq.py') parser.add_argument('--run_type', help="本文件运行模式,主要分为train和predict两种", type=str, default = "train") parser.add_argument('--input_size', help="Encoder对应的词嵌入的词库大小,等于vocab的大小+1", type=int, default = config.question_word_num) parser.add_argument('--hidden_size', help="隐层大小", type=int, default = 256) parser.add_argument('--output_size', help="Decoder对应的词嵌入的词库大小,等于vocab的大小+1", type=int, default = config.answer_word_num) parser.add_argument('--n_layers', help="Encoder/Decoder网络层数", type=int, default = 2) parser.add_argument('--dropout_p', help="dropout概率", type=float, default = 0.25) parser.add_argument('--max_length', help="最大长度", type=int, default = 32) parser.add_argument('--max_epoches', help="最大epoches", type=int, default = 100000) parser.add_argument('--beam_search', help="是否进行beam_search算法搜索", type=bool, default = True) parser.add_argument('--use_cuda', help="是否使用CUDA训练", type=bool, default = USE_CUDA) parser.add_argument('--model_path', help="训练好的模型路径,默认为: .model/+Corpus+/", type=str, default = config.Modelpath) parser.add_argument('--Corpus', help="对话语料库名称,文件格式为.tsv,每一行为一个句子对,形式为:Q \t A, 可选择: Chatterbot、Douban、Ptt、Qingyun、Subtitle、Tieba、Weibo、Xiaohuangji", type=str, default = config.Corpus) parser.add_argument('--Filepath', help="文件路径", type=str, default = config.Filepath) parser.add_argument('--rnn_type', help="RNN结构,可以选择RNN、LSTM、GRU,默认为GRU", type=str, default = "GRU") parser.add_argument('--gpu_id', help="GPU_ID", type=str, default = "0,1,2,3,4") args = parser.parse_args() os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_id device = torch.device("cuda:"+re.split(r",",args.gpu_id)[0] if USE_CUDA else "cpu") gpu_id = list(map(int, re.split(r",",args.gpu_id))) print("当前GPU: ", torch.cuda.current_device()) if __name__ == '__main__': question_word_num, answer_word_num = config.Check_Preprocess(Filepath = args.Filepath, Corpus = args.Corpus) gcr = Encoder_Decoder(input_size = question_word_num, hidden_size = args.hidden_size, output_size = answer_word_num, n_layers = args.n_layers, dropout_p = args.dropout_p, max_length = args.max_length, max_epoches = args.max_epoches, beam_search = args.beam_search, rnn_type = args.rnn_type, use_cuda = args.use_cuda, model_path = "./model/"+args.Corpus+"/", Corpus = args.Corpus, Filepath = args.Filepath) gcr = torch.nn.DataParallel(gcr, device_ids = gpu_id) gcr.to(device) print("网络参数如下: ") print("input_size: ", question_word_num) print("hidden_size: ", args.hidden_size) print("output_size: ", answer_word_num) print("n_layers: ", args.n_layers) print("dropout_p: ", args.dropout_p) print("max_length: ", args.max_length) print("max_epoches: ", args.max_epoches) print("beam_search: ", args.beam_search) print("rnn_type: ", args.rnn_type) print("use_cuda: ", args.use_cuda) print("model_path: ", "./model/"+args.Corpus+"/") print("Corpus: ", args.Corpus) print("Filepath: ", args.Filepath) if os.path.exists("./model/"+args.Corpus+"/") == False: os.mkdir("./model/"+args.Corpus+"/") netparam = open("./model/"+str(args.Corpus)+"/"+"Networkparameters.txt", "w") netparam.write("input_size: "+str(question_word_num)+"\n") netparam.write("hidden_size: "+str(args.hidden_size)+"\n") netparam.write("output_size: "+str(answer_word_num)+"\n") netparam.write("n_layers: "+str(args.n_layers)+"\n") netparam.write("dropout_p: "+str(args.dropout_p)+"\n") netparam.write("max_length: "+str(args.max_length)+"\n") netparam.write("imax_epoches: "+str(args.max_epoches)+"\n") netparam.write("beam_search: "+str(args.beam_search)+"\n") netparam.write("rnn_type: "+str(args.rnn_type)+"\n") netparam.write("use_cuda: "+str(args.use_cuda)+"\n") netparam.write("model_path: "+str("./model/"+args.Corpus+"/")+"\n") netparam.write("Corpus: "+str(args.Corpus)+"\n") netparam.write("Filepath: "+str(args.Filepath)+"\n") netparam.close() if args.run_type == 'train': #seq.train() # 单GPU seq.module.train() # 加上.module elif args.run_type == 'predict': #seq.predict() # 单GPU seq.module.predict() # 加上.module elif args.run_type == 'retrain': #seq.retrain() # 单GPU seq.module.retrain() # 加上.module
gru_seq2seq/evaluate.py
import os import re import sys import math import time import jieba import torch import config # 常规参数设置 import random import argparse import numpy as np import pandas as pd import torch.nn as nn from torch import optim import torch.nn.functional as F from torch.autograd import Variable from preprocessing import Corpuspreprocessing import seq2seq.seq2seq as Encoder_Decoder os.environ['CUDA_LAUNCH_BLOCKING'] = "1" # 方便定位报错信息 USE_CUDA = torch.cuda.is_available() SOS_token = 2 EOS_token = 1 parser = argparse.ArgumentParser(description='manual to seq2seq.py') parser.add_argument('--run_type', help="本文件运行模式,主要分为train和predict两种", type=str, default = "train") parser.add_argument('--input_size', help="Encoder对应的词嵌入的词库大小,等于vocab的大小+1", type=int, default = config.question_word_num) parser.add_argument('--hidden_size', help="隐层大小", type=int, default = 256) parser.add_argument('--output_size', help="Decoder对应的词嵌入的词库大小,等于vocab的大小+1", type=int, default = config.answer_word_num) parser.add_argument('--n_layers', help="Encoder/Decoder网络层数", type=int, default = 2) parser.add_argument('--dropout_p', help="dropout概率", type=float, default = 0.25) parser.add_argument('--max_length', help="最大长度", type=int, default = 32) parser.add_argument('--max_epoches', help="最大epoches", type=int, default = 100000) parser.add_argument('--beam_search', help="是否进行beam_search算法搜索", type=bool, default = True) parser.add_argument('--use_cuda', help="是否使用CUDA训练", type=bool, default = USE_CUDA) parser.add_argument('--model_path', help="训练好的模型路径,默认为: .model/+Corpus+/", type=str, default = config.Modelpath) parser.add_argument('--Corpus', help="对话语料库名称,文件格式为.tsv,每一行为一个句子对,形式为:Q \t A, 可选择: Chatterbot、Douban、Ptt、Qingyun、Subtitle、Tieba、Weibo、Xiaohuangji", type=str, default = config.Corpus) parser.add_argument('--Filepath', help="文件路径", type=str, default = config.Filepath) parser.add_argument('--rnn_type', help="RNN结构,可以选择RNN、LSTM、GRU,默认为GRU", type=str, default = "GRU") parser.add_argument('--gpu_id', help="GPU_ID", type=str, default = "0,1,2,3,4") args = parser.parse_args() os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_id device = torch.device("cuda:"+re.split(r",",args.gpu_id)[0] if USE_CUDA else "cpu") gpu_id = list(map(int, re.split(r",",args.gpu_id))) print("当前GPU: ", torch.cuda.current_device()) if __name__ == '__main__': question_word_num, answer_word_num = config.Check_Preprocess(Filepath = args.Filepath, Corpus = args.Corpus) gcr = Encoder_Decoder(input_size = question_word_num, hidden_size = args.hidden_size, output_size = answer_word_num, n_layers = args.n_layers, dropout_p = args.dropout_p, max_length = args.max_length, max_epoches = args.max_epoches, beam_search = args.beam_search, rnn_type = args.rnn_type, use_cuda = args.use_cuda, model_path = "./model/"+args.Corpus+"/", Corpus = args.Corpus, Filepath = args.Filepath) gcr = torch.nn.DataParallel(gcr, device_ids = gpu_id) gcr.to(device) print("网络参数如下: ") print("input_size: ", question_word_num) print("hidden_size: ", args.hidden_size) print("output_size: ", answer_word_num) print("n_layers: ", args.n_layers) print("dropout_p: ", args.dropout_p) print("max_length: ", args.max_length) print("max_epoches: ", args.max_epoches) print("beam_search: ", args.beam_search) print("rnn_type: ", args.rnn_type) print("use_cuda: ", args.use_cuda) print("model_path: ", "./model/"+args.Corpus+"/") print("Corpus: ", args.Corpus) print("Filepath: ", args.Filepath) if os.path.exists("./model/"+args.Corpus+"/") == False: os.mkdir("./model/"+args.Corpus+"/") netparam = open("./model/"+str(args.Corpus)+"/"+"Networkparameters.txt", "w") netparam.write("input_size: "+str(question_word_num)+"\n") netparam.write("hidden_size: "+str(args.hidden_size)+"\n") netparam.write("output_size: "+str(answer_word_num)+"\n") netparam.write("n_layers: "+str(args.n_layers)+"\n") netparam.write("dropout_p: "+str(args.dropout_p)+"\n") netparam.write("max_length: "+str(args.max_length)+"\n") netparam.write("imax_epoches: "+str(args.max_epoches)+"\n") netparam.write("beam_search: "+str(args.beam_search)+"\n") netparam.write("rnn_type: "+str(args.rnn_type)+"\n") netparam.write("use_cuda: "+str(args.use_cuda)+"\n") netparam.write("model_path: "+str("./model/"+args.Corpus+"/")+"\n") netparam.write("Corpus: "+str(args.Corpus)+"\n") netparam.write("Filepath: "+str(args.Filepath)+"\n") netparam.close() if args.run_type == 'train': #seq.train() # 单GPU seq.module.train() # 加上.module elif args.run_type == 'predict': #seq.predict() # 单GPU seq.module.predict() # 加上.module elif args.run_type == 'retrain': #seq.retrain() # 单GPU seq.module.retrain() # 加上.module
0.145813
0.060363
import numpy as np from qlazy import QState Hamming = np.array([[0,1,1,1,1,0,0], [1,0,1,1,0,1,0], [1,1,0,1,0,0,1]]) Hamming_T = Hamming.T Steane_0 = ['0000000', '1101001', '1011010', '0110011', '0111100', '1010101', '1100110', '0001111'] Steane_1 = ['1111111', '0010110', '0100101', '1001100', '1000011', '0101010', '0011001', '1110000'] class MyQState(QState): def noise(self, qid): i = np.random.randint(len(qid)) alpha, beta, gamma = np.random.rand(3) self.u3(qid[i], alpha=alpha, beta=beta, gamma=gamma) print("== random noise (random U3 operation)==") print("- qubit id = #{0:}".format(i, alpha, beta, gamma)) print("- parameter of U3 = {0:.4f},{1:.4f},{2:.4f}".format(alpha, beta, gamma)) return self def correct(self, kind, qid_C, qid_S): self.reset(qid=qid_S) if kind == 'phase_flip': [self.h(q) for q in qid_C] # syndrome for i, row in enumerate(Hamming): [self.cx(qid_C[j], qid_S[i]) if row[j] == 1 else False for j in range(len(row))] #[self.cx(qid_C[j], qid_S[i], cond=(row[j] == 1)) for j in range(len(row))] # correction for i, row in enumerate(Hamming_T): [self.x(qid_S[j]) if row[j] == 0 else False for j in range(len(row))] self.mcx(qid=qid_S+[qid_C[i]]) [self.x(qid_S[j]) if row[j] == 0 else False for j in range(len(row))] if kind == 'phase_flip': [self.h(q) for q in qid_C] return self def generate_qstate(qid_C, qid_S): a = np.random.rand() + np.random.rand() * 1.j b = np.random.rand() + np.random.rand() * 1.j qvec = np.full(2**len(qid_C), 0.+0.j) for s in Steane_0: qvec[int(s, 2)] = a for s in Steane_1: qvec[int(s, 2)] = b norm = np.linalg.norm(qvec) qvec = qvec / norm qs_C = MyQState(vector=qvec) qs_S = MyQState(len(qid_S)) qs_ini = qs_C.tenspro(qs_S) qs_fin = qs_ini.clone() print("== random state (a |0L> + b |1L>) ==") print("- a = {:.4f}".format(a)) print("- b = {:.4f}".format(b)) # QState.free_all(qs_C, qs_S) return qs_ini, qs_fin if __name__ == '__main__': # set registers qid_C = QState.create_register(7) # registers for code space qid_S = QState.create_register(3) # registers for error syndrome QState.init_register(qid_C, qid_S) # generate initial quantum state qs_ini, qs_fin = generate_qstate(qid_C, qid_S) # add noise qs_fin.noise(qid_C) # error correction qs_fin.correct('bit_flip', qid_C, qid_S) qs_fin.correct('phase_flip', qid_C, qid_S) # print result print("== result ==") print("- fidelity = {:.6f}".format(qs_fin.fidelity(qs_ini, qid=qid_C)))
example/py/ErrorCorrection/steane_code_0.py
import numpy as np from qlazy import QState Hamming = np.array([[0,1,1,1,1,0,0], [1,0,1,1,0,1,0], [1,1,0,1,0,0,1]]) Hamming_T = Hamming.T Steane_0 = ['0000000', '1101001', '1011010', '0110011', '0111100', '1010101', '1100110', '0001111'] Steane_1 = ['1111111', '0010110', '0100101', '1001100', '1000011', '0101010', '0011001', '1110000'] class MyQState(QState): def noise(self, qid): i = np.random.randint(len(qid)) alpha, beta, gamma = np.random.rand(3) self.u3(qid[i], alpha=alpha, beta=beta, gamma=gamma) print("== random noise (random U3 operation)==") print("- qubit id = #{0:}".format(i, alpha, beta, gamma)) print("- parameter of U3 = {0:.4f},{1:.4f},{2:.4f}".format(alpha, beta, gamma)) return self def correct(self, kind, qid_C, qid_S): self.reset(qid=qid_S) if kind == 'phase_flip': [self.h(q) for q in qid_C] # syndrome for i, row in enumerate(Hamming): [self.cx(qid_C[j], qid_S[i]) if row[j] == 1 else False for j in range(len(row))] #[self.cx(qid_C[j], qid_S[i], cond=(row[j] == 1)) for j in range(len(row))] # correction for i, row in enumerate(Hamming_T): [self.x(qid_S[j]) if row[j] == 0 else False for j in range(len(row))] self.mcx(qid=qid_S+[qid_C[i]]) [self.x(qid_S[j]) if row[j] == 0 else False for j in range(len(row))] if kind == 'phase_flip': [self.h(q) for q in qid_C] return self def generate_qstate(qid_C, qid_S): a = np.random.rand() + np.random.rand() * 1.j b = np.random.rand() + np.random.rand() * 1.j qvec = np.full(2**len(qid_C), 0.+0.j) for s in Steane_0: qvec[int(s, 2)] = a for s in Steane_1: qvec[int(s, 2)] = b norm = np.linalg.norm(qvec) qvec = qvec / norm qs_C = MyQState(vector=qvec) qs_S = MyQState(len(qid_S)) qs_ini = qs_C.tenspro(qs_S) qs_fin = qs_ini.clone() print("== random state (a |0L> + b |1L>) ==") print("- a = {:.4f}".format(a)) print("- b = {:.4f}".format(b)) # QState.free_all(qs_C, qs_S) return qs_ini, qs_fin if __name__ == '__main__': # set registers qid_C = QState.create_register(7) # registers for code space qid_S = QState.create_register(3) # registers for error syndrome QState.init_register(qid_C, qid_S) # generate initial quantum state qs_ini, qs_fin = generate_qstate(qid_C, qid_S) # add noise qs_fin.noise(qid_C) # error correction qs_fin.correct('bit_flip', qid_C, qid_S) qs_fin.correct('phase_flip', qid_C, qid_S) # print result print("== result ==") print("- fidelity = {:.6f}".format(qs_fin.fidelity(qs_ini, qid=qid_C)))
0.50293
0.459925
import sys from xml.sax.saxutils import escape USAGE_TEXT = """ usage: python3 Ch02Ex04.py [maxwidth=int] [format=str] <infile.csv> <outfile.html> maxwidth is an optional integer; if specified, it sets the maximum number of characters that can be output for string fields, otherwise a default of 100 characters is used. format is the format to use for numbers; if not specified it defaults to ".0f". For allowed format types, see Figure 2.6. """ NUMBER_TEMPLATE = "<td align='right'>{0:{1}}</td>\n" def main(): # Get parameters from command line max_width, int_format = process_options(sys.argv) if max_width is None or int_format is None: return input_filename = sys.argv[-2] output_filename = sys.argv[-1] table = "" table += print_start() count = 0 # Read in data from file, instead of with call to input() file_object = open(input_filename, "r") data = file_object.read() file_object.close() # Convert data to html lines = data.splitlines() for line in lines: try: if count == 0: color = "lightgreen" elif count % 2 == 0: color = "white" else: color = "lightyellow" table = print_line(table, line, color, max_width, int_format) count += 1 except EOFError: break table += print_end() # Dump html into output file output_file_object = open(output_filename, "w") output_file_object.write(table) output_file_object.close() def process_options(cmd_args): # Set the defaults. These will change if the user has defined alternatives max_width = 100 int_format = '.0f' # Produce the USAGE_TEXT if user asks for help, otherwise handle maxwidth # and format if they are defined by the user if cmd_args[1] in ('-h', '--help'): print(USAGE_TEXT) return None, None else: # cmd_args[1:-2] excludes the script name, input filename and output # filename, leaving only maxwidth and format should they exist. for arg in cmd_args[1:-2]: if 'maxwidth' in arg: width_num = arg.replace('maxwidth=', '') try: # If the user enters maxwidth=5.0, this is a valid integer # but not a valid int. We should handle this. if '.' in width_num: max_width = int(float(width_num)) else: max_width = int(width_num) # If the user entered a width that couldn't be converted to an # int terminate the program except ValueError: print('Incorrect value for ' 'maxwidth. Enter an ' 'integer.') max_width = None break elif 'format' in arg: int_format = arg.replace('format=', '') # Call str.format(...) and terminate the program if an # exception is raised try: '{0:{1}}'.format(1, int_format) except ValueError as e: print('Incorrect value for format. ' + e.__str__() + '.') int_format = None break return max_width, int_format def print_start(): return "<table border='1'>\n" def print_end(): return "</table>\n" def print_line(table, line, color, max_width, int_format): table += "<tr bgcolor='{0}'>\n".format(color) fields = extract_fields(line) for field in fields: if not field: table += "<td></td>\n" else: number = field.replace(",", "") try: x = float(number) # const NUMBER_TEMPLATE is defined so this line isn't too long table += NUMBER_TEMPLATE.format(round(x), int_format) except ValueError: field = field.title() field = field.replace(" And ", " and ") if len(field) <= max_width: field = escape(field) else: field = "{0} ...".format(escape(field[:max_width])) table += "<td>{0}</td>\n".format(field) table += "</tr>\n" return table def extract_fields(line): fields = [] field = "" quote = None for c in line: if c in "\"'": if quote is None: # start of quoted string quote = c elif quote == c: # end of quoted string quote = None else: field += c # other quote inside quoted string continue if quote is None and c == ",": # end of a field fields.append(field) field = "" else: field += c # accumulating a field if field: fields.append(field) # adding the last field return fields main()
Chapter 02/Ch02Ex04.py
import sys from xml.sax.saxutils import escape USAGE_TEXT = """ usage: python3 Ch02Ex04.py [maxwidth=int] [format=str] <infile.csv> <outfile.html> maxwidth is an optional integer; if specified, it sets the maximum number of characters that can be output for string fields, otherwise a default of 100 characters is used. format is the format to use for numbers; if not specified it defaults to ".0f". For allowed format types, see Figure 2.6. """ NUMBER_TEMPLATE = "<td align='right'>{0:{1}}</td>\n" def main(): # Get parameters from command line max_width, int_format = process_options(sys.argv) if max_width is None or int_format is None: return input_filename = sys.argv[-2] output_filename = sys.argv[-1] table = "" table += print_start() count = 0 # Read in data from file, instead of with call to input() file_object = open(input_filename, "r") data = file_object.read() file_object.close() # Convert data to html lines = data.splitlines() for line in lines: try: if count == 0: color = "lightgreen" elif count % 2 == 0: color = "white" else: color = "lightyellow" table = print_line(table, line, color, max_width, int_format) count += 1 except EOFError: break table += print_end() # Dump html into output file output_file_object = open(output_filename, "w") output_file_object.write(table) output_file_object.close() def process_options(cmd_args): # Set the defaults. These will change if the user has defined alternatives max_width = 100 int_format = '.0f' # Produce the USAGE_TEXT if user asks for help, otherwise handle maxwidth # and format if they are defined by the user if cmd_args[1] in ('-h', '--help'): print(USAGE_TEXT) return None, None else: # cmd_args[1:-2] excludes the script name, input filename and output # filename, leaving only maxwidth and format should they exist. for arg in cmd_args[1:-2]: if 'maxwidth' in arg: width_num = arg.replace('maxwidth=', '') try: # If the user enters maxwidth=5.0, this is a valid integer # but not a valid int. We should handle this. if '.' in width_num: max_width = int(float(width_num)) else: max_width = int(width_num) # If the user entered a width that couldn't be converted to an # int terminate the program except ValueError: print('Incorrect value for ' 'maxwidth. Enter an ' 'integer.') max_width = None break elif 'format' in arg: int_format = arg.replace('format=', '') # Call str.format(...) and terminate the program if an # exception is raised try: '{0:{1}}'.format(1, int_format) except ValueError as e: print('Incorrect value for format. ' + e.__str__() + '.') int_format = None break return max_width, int_format def print_start(): return "<table border='1'>\n" def print_end(): return "</table>\n" def print_line(table, line, color, max_width, int_format): table += "<tr bgcolor='{0}'>\n".format(color) fields = extract_fields(line) for field in fields: if not field: table += "<td></td>\n" else: number = field.replace(",", "") try: x = float(number) # const NUMBER_TEMPLATE is defined so this line isn't too long table += NUMBER_TEMPLATE.format(round(x), int_format) except ValueError: field = field.title() field = field.replace(" And ", " and ") if len(field) <= max_width: field = escape(field) else: field = "{0} ...".format(escape(field[:max_width])) table += "<td>{0}</td>\n".format(field) table += "</tr>\n" return table def extract_fields(line): fields = [] field = "" quote = None for c in line: if c in "\"'": if quote is None: # start of quoted string quote = c elif quote == c: # end of quoted string quote = None else: field += c # other quote inside quoted string continue if quote is None and c == ",": # end of a field fields.append(field) field = "" else: field += c # accumulating a field if field: fields.append(field) # adding the last field return fields main()
0.260672
0.139279
"""Take usage data .csv file from SCE, parse it, and analyze it""" import sys import os import re import datetime from power_plotting import PowerPlotting def print_usage(error_string=""): """Print usage in the case of bad inputs""" script_name = os.path.basename(__file__) print "==========================" if error_string: print "Error: " print "\t " + error_string print "Usage: " print "\t" + script_name + " /path/to/usage.csv" print "==========================" raise ValueError("Incorrect Parameters") def verify_inputs(args): """Verify the validity of the inputs. We need at least one argument, the csv file we are going to process.""" if not args: print_usage(error_string="Not enough arguments") return False for csv_file_path in args: if not os.path.exists(csv_file_path): print_usage(error_string="Cannot locate file: " + str(csv_file_path)) return False return True def convert_date_dict_to_datetime(date_dict): """Take in a dictionary and return datetime""" return datetime.datetime(int(date_dict['year']), int(date_dict['month']), \ int(date_dict['day']), int(date_dict['hour']), \ int(date_dict['minute']), int(date_dict['second'])) def get_dates_from_line(csv_line): """Take in CSV line. If it is a line that contains two dates, extract and return them""" line_regex = re.compile(r'((?P<year>(?:19|20)\d\d)([- /.])' + \ '(?P<month>0[1-9]|1[012])-(?P<day>0[1-9]|[12][0-9]|3[01])' + \ '.(?P<hour>[0-1][0-9]|2[0-3]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9]))') dates = [m.groupdict() for m in line_regex.finditer(csv_line)] if len(dates) >= 2: #Make sure we get both a start and end time start_date = convert_date_dict_to_datetime(dates[0]) end_date = convert_date_dict_to_datetime(dates[1]) return [start_date, end_date] return None def parse_csv_file(csv_path): """Read in a CSV file and return the data""" # This is only a CSV in that it's values are separted by commas. # There is a lot of non-tabular data in this file. print "Parsing " + csv_path consumption_data = [] with open(csv_path) as csv_file_handle: for line in csv_file_handle: #Replace non-printable characters with a space line = re.sub(r'[^\x00-\x7F]+', ' ', line) times = get_dates_from_line(line) if times: split_line = line.split(",") #Second column contains usage data we are interested in consumption_value = float(split_line[1].replace('"', '')) #The end time is implied. Data is in one hour increments. consumption_data.append({'time': times[0], 'value': consumption_value}) return consumption_data def main(args): """Main function. Takes a list of csv filenames/paths""" print "Starting" verify_inputs(args) parsed_files = [] for csv_file in args: parsed_files.append(parse_csv_file(csv_file)) plotting = PowerPlotting(parsed_files[0]) plotting.plot_all_usage() plotting.plot_usage_per_week_day() plotting.plot_weekly_usage() plotting.plot_hourly_usage() #All days plotting.plot_hourly_usage(valid_days=range(0, 5)) #Only Week Days plotting.plot_hourly_usage(valid_days=range(5, 7)) #Only weekends plotting.show_plots() return True if __name__ == "__main__": main(sys.argv[1:])
power_parser.py
"""Take usage data .csv file from SCE, parse it, and analyze it""" import sys import os import re import datetime from power_plotting import PowerPlotting def print_usage(error_string=""): """Print usage in the case of bad inputs""" script_name = os.path.basename(__file__) print "==========================" if error_string: print "Error: " print "\t " + error_string print "Usage: " print "\t" + script_name + " /path/to/usage.csv" print "==========================" raise ValueError("Incorrect Parameters") def verify_inputs(args): """Verify the validity of the inputs. We need at least one argument, the csv file we are going to process.""" if not args: print_usage(error_string="Not enough arguments") return False for csv_file_path in args: if not os.path.exists(csv_file_path): print_usage(error_string="Cannot locate file: " + str(csv_file_path)) return False return True def convert_date_dict_to_datetime(date_dict): """Take in a dictionary and return datetime""" return datetime.datetime(int(date_dict['year']), int(date_dict['month']), \ int(date_dict['day']), int(date_dict['hour']), \ int(date_dict['minute']), int(date_dict['second'])) def get_dates_from_line(csv_line): """Take in CSV line. If it is a line that contains two dates, extract and return them""" line_regex = re.compile(r'((?P<year>(?:19|20)\d\d)([- /.])' + \ '(?P<month>0[1-9]|1[012])-(?P<day>0[1-9]|[12][0-9]|3[01])' + \ '.(?P<hour>[0-1][0-9]|2[0-3]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9]))') dates = [m.groupdict() for m in line_regex.finditer(csv_line)] if len(dates) >= 2: #Make sure we get both a start and end time start_date = convert_date_dict_to_datetime(dates[0]) end_date = convert_date_dict_to_datetime(dates[1]) return [start_date, end_date] return None def parse_csv_file(csv_path): """Read in a CSV file and return the data""" # This is only a CSV in that it's values are separted by commas. # There is a lot of non-tabular data in this file. print "Parsing " + csv_path consumption_data = [] with open(csv_path) as csv_file_handle: for line in csv_file_handle: #Replace non-printable characters with a space line = re.sub(r'[^\x00-\x7F]+', ' ', line) times = get_dates_from_line(line) if times: split_line = line.split(",") #Second column contains usage data we are interested in consumption_value = float(split_line[1].replace('"', '')) #The end time is implied. Data is in one hour increments. consumption_data.append({'time': times[0], 'value': consumption_value}) return consumption_data def main(args): """Main function. Takes a list of csv filenames/paths""" print "Starting" verify_inputs(args) parsed_files = [] for csv_file in args: parsed_files.append(parse_csv_file(csv_file)) plotting = PowerPlotting(parsed_files[0]) plotting.plot_all_usage() plotting.plot_usage_per_week_day() plotting.plot_weekly_usage() plotting.plot_hourly_usage() #All days plotting.plot_hourly_usage(valid_days=range(0, 5)) #Only Week Days plotting.plot_hourly_usage(valid_days=range(5, 7)) #Only weekends plotting.show_plots() return True if __name__ == "__main__": main(sys.argv[1:])
0.369884
0.38027
import random from pathlib import Path import numpy as np import tensorflow as tf from models.PositiveLearningElkan.pu_learning import PULogisticRegressionSK from models.baselines import LogisticRegressionSK from models.recurrent.basic_recurrent import BasicRecurrent from project_paths import ProjectPaths from run_files.single_train import single_training from util.learning_rate_utilities import linear_geometric_curve from util.tensor_provider import TensorProvider if __name__ == "__main__": # Initialize tensor-provider (data-source) the_tensor_provider = TensorProvider(verbose=True) # Results path used_base_path = Path(ProjectPaths.results, "single_train") # Settings test_ratio = 0.11 # Models n_batches = 2000 learning_rates = linear_geometric_curve(n=n_batches, starting_value=5e-4, end_value=1e-10, geometric_component=3. / 4, geometric_end=5) a_model = BasicRecurrent( tensor_provider=the_tensor_provider, results_path=used_base_path, use_bow=False, n_batches=n_batches, batch_size=64, learning_rate_progression=learning_rates, recurrent_units=400, feedforward_units=[200], dropouts=[1], recurrent_neuron_type=tf.nn.rnn_cell.GRUCell, training_curve_y_limit=1000 ) # a_model = LogisticRegression( # tensor_provider=the_tensor_provider, # ) # a_model = MLP( # tensor_provider=the_tensor_provider, # ) # a_model = SVMSK( # tensor_provider=the_tensor_provider, # verbose=True # ) # a_model = LogisticRegressionSK( # tensor_provider=the_tensor_provider, # ) # a_model = PULogisticRegressionSK( # tensor_provider=the_tensor_provider, # ) # Select random sentences for training and test keys = the_tensor_provider.accessible_annotated_keys random.shuffle(keys) loc_split = int(len(keys) * test_ratio) training_keys = keys[loc_split:] test_keys = keys[:loc_split] # Run training on a single model single_training( tensor_provider=the_tensor_provider, model=a_model, test_split=test_keys, training_split=training_keys, base_path=used_base_path, split_is_keys=True )
run_files/random_sample_train.py
import random from pathlib import Path import numpy as np import tensorflow as tf from models.PositiveLearningElkan.pu_learning import PULogisticRegressionSK from models.baselines import LogisticRegressionSK from models.recurrent.basic_recurrent import BasicRecurrent from project_paths import ProjectPaths from run_files.single_train import single_training from util.learning_rate_utilities import linear_geometric_curve from util.tensor_provider import TensorProvider if __name__ == "__main__": # Initialize tensor-provider (data-source) the_tensor_provider = TensorProvider(verbose=True) # Results path used_base_path = Path(ProjectPaths.results, "single_train") # Settings test_ratio = 0.11 # Models n_batches = 2000 learning_rates = linear_geometric_curve(n=n_batches, starting_value=5e-4, end_value=1e-10, geometric_component=3. / 4, geometric_end=5) a_model = BasicRecurrent( tensor_provider=the_tensor_provider, results_path=used_base_path, use_bow=False, n_batches=n_batches, batch_size=64, learning_rate_progression=learning_rates, recurrent_units=400, feedforward_units=[200], dropouts=[1], recurrent_neuron_type=tf.nn.rnn_cell.GRUCell, training_curve_y_limit=1000 ) # a_model = LogisticRegression( # tensor_provider=the_tensor_provider, # ) # a_model = MLP( # tensor_provider=the_tensor_provider, # ) # a_model = SVMSK( # tensor_provider=the_tensor_provider, # verbose=True # ) # a_model = LogisticRegressionSK( # tensor_provider=the_tensor_provider, # ) # a_model = PULogisticRegressionSK( # tensor_provider=the_tensor_provider, # ) # Select random sentences for training and test keys = the_tensor_provider.accessible_annotated_keys random.shuffle(keys) loc_split = int(len(keys) * test_ratio) training_keys = keys[loc_split:] test_keys = keys[:loc_split] # Run training on a single model single_training( tensor_provider=the_tensor_provider, model=a_model, test_split=test_keys, training_split=training_keys, base_path=used_base_path, split_is_keys=True )
0.563618
0.268538
import scrapy from alleco.objects.official import Official class braddock_b(scrapy.Spider): name = "braddock_b" muniName = "BRADDOCK" muniType = "BOROUGH" complete = True def start_requests(self): urls = ['http://www.braddockborough.com/council/', 'http://www.braddockborough.com/staff', 'https://www.braddockborough.com/council/chardae-jones'] for url in urls: yield scrapy.Request(url=url, callback=self.parse) def parse(self, response): if response.url[-1] == "s": for quote in response.xpath("//div[contains(@class, 'row container-box-med') and contains(.//div/@class, 'it-grid-one start bl')]"): bio = quote.xpath('div/p/text()').getall() yield Official( muniName=self.muniName, muniType=self.muniType, office="MAYOR", name=" ".join(quote.xpath("div/h1/text()").get().split(" ")[1:3]), phone=bio[-1], email=bio[-3].replace(" ",""), url=response.url) elif response.url[-1] == "/": for quote in response.xpath("//div[@class='med information-text']//div[@class='itg-teambox']")[1:]: name = quote.xpath("h3/text()").get() yield Official( muniName=self.muniName, muniType=self.muniType, office="MEMBER OF COUNCIL", name=name, district=self._districts(name.split(" ")[-1]), url=response.url) elif response.url[-1] == "f": for quote in response.xpath("//p[contains(text(), 'Tax Department Manager')]/.."): yield Official( muniName=self.muniName, muniType=self.muniType, office="TAX COLLECTOR", name=quote.xpath("h3/text()").get(), url=response.url) def _districts(self, string): #Note: In the future, figure out a better way to do this #Because this information is not on the Braddock website, #I am using the 2017 and 2019 election records to deduce districts if string=="Parker": return "WARD 3" elif string=="Berry": return "WARD 2" elif string=="Doose": return "WARD 2" elif string=="Dudley": return "WARD 1" elif string=="Clark": return "WARD 3" elif string=="Henderson": return "WARD 1" elif string=="Scales": return "AT-LARGE" else: return None
alleco/spiders/braddock_b.py
import scrapy from alleco.objects.official import Official class braddock_b(scrapy.Spider): name = "braddock_b" muniName = "BRADDOCK" muniType = "BOROUGH" complete = True def start_requests(self): urls = ['http://www.braddockborough.com/council/', 'http://www.braddockborough.com/staff', 'https://www.braddockborough.com/council/chardae-jones'] for url in urls: yield scrapy.Request(url=url, callback=self.parse) def parse(self, response): if response.url[-1] == "s": for quote in response.xpath("//div[contains(@class, 'row container-box-med') and contains(.//div/@class, 'it-grid-one start bl')]"): bio = quote.xpath('div/p/text()').getall() yield Official( muniName=self.muniName, muniType=self.muniType, office="MAYOR", name=" ".join(quote.xpath("div/h1/text()").get().split(" ")[1:3]), phone=bio[-1], email=bio[-3].replace(" ",""), url=response.url) elif response.url[-1] == "/": for quote in response.xpath("//div[@class='med information-text']//div[@class='itg-teambox']")[1:]: name = quote.xpath("h3/text()").get() yield Official( muniName=self.muniName, muniType=self.muniType, office="MEMBER OF COUNCIL", name=name, district=self._districts(name.split(" ")[-1]), url=response.url) elif response.url[-1] == "f": for quote in response.xpath("//p[contains(text(), 'Tax Department Manager')]/.."): yield Official( muniName=self.muniName, muniType=self.muniType, office="TAX COLLECTOR", name=quote.xpath("h3/text()").get(), url=response.url) def _districts(self, string): #Note: In the future, figure out a better way to do this #Because this information is not on the Braddock website, #I am using the 2017 and 2019 election records to deduce districts if string=="Parker": return "WARD 3" elif string=="Berry": return "WARD 2" elif string=="Doose": return "WARD 2" elif string=="Dudley": return "WARD 1" elif string=="Clark": return "WARD 3" elif string=="Henderson": return "WARD 1" elif string=="Scales": return "AT-LARGE" else: return None
0.064831
0.140926
#SILENCING THE FALSE POSITIVE WARNINGS import warnings warnings.simplefilter('always') with warnings.catch_warnings(): warnings.filterwarnings('ignore', category=pd.core.common.SettingWithCopyWarning) #IMPORTING DEPENDENCIES import tensorflow as tf import pandas as pd import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Embedding, Conv1D, GlobalMaxPooling1D, Activation #IMPORTING DATASET data = pd.read_csv('/content/gdrive/My Drive/Colab Notebooks/train.csv', index_col=False) df = data #Filling Missing Values in Data #print(df.isna().sum()) df[['title', 'author']] = df[['title', 'author']].fillna(value = 'Missing Value') df = df.dropna() df['length'] = df.iloc[:,3].str.len() #print(df.isna().sum()) df[df['length'] < 50].count() df = df.drop(df['text'][df['length'] < 50].index, axis=0) df_reverse = pd.DataFrame() #Categorical to Numeric for col_name in df.columns: if(df[col_name].dtype == 'object'): df[col_name]= df[col_name].astype('category') d = dict(enumerate(df[col_name].cat.categories)) df[col_name] = df[col_name].cat.codes df_reverse[col_name+"_code"] = df[col_name] df_reverse[col_name] = df[col_name].map(d) features_cols = ['id', 'title', 'author', 'text'] #FEATURES AND LABELS X = df[features_cols] Y = df.label #PREPARING TRAINING DATASET AND TEST DATASET from sklearn.model_selection import train_test_split X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=1) #DECISION TREE CLASSIFIER - UNPRUNDED TREE from sklearn.tree import DecisionTreeClassifier from sklearn import metrics dtc_unpruned = DecisionTreeClassifier() dtc_unpruned.fit(X_train, Y_train) Y_pred_dtc_unpruned = dtc_unpruned.predict(X_test) acc_score_dtc_unpruned = round(metrics.accuracy_score(Y_test,Y_pred_dtc_unpruned) * 100) print("Accuracy of DecisionTreeClassifier:", acc_score_dtc_unpruned, "%") X_test_cp = X_test #Decoding Data - ONE TIME STEP - DO NOT REPEAT df_reverse.set_index('title_code', inplace=False) title_dict = df_reverse.to_dict()['title'] df_reverse.set_index('author_code', inplace=False) author_dict = df_reverse.to_dict()['author'] df_reverse.set_index('text_code', inplace=False) text_dict = df_reverse.to_dict()['text'] X_test_cp['title'] = X_test_cp['title'].map(title_dict) X_test_cp['author'] = X_test_cp['author'].map(author_dict) X_test_cp['text'] = X_test_cp['text'].map(text_dict) X_test_cp.set_index('id', inplace=True) #DISPLAYING DECSIONTREECLASSIFIER - DECODED - RESULTS X_test_cp['Prediction'] = Y_pred_dtc_unpruned X_test_cp['Prediction'].replace([0,1],['Fake News','Relaible News'],inplace=True) pd.set_option('display.max_columns', 1000) pd.set_option('display.max_rows', 1000) #PREDICTION RESULTS X_test_cp.tail() #Visualizing DecisionTree from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO from IPython.display import Image import pydotplus dot_data = StringIO() export_graphviz(dtc_unpruned, out_file=dot_data, filled=True, rounded=True, special_characters=True,feature_names = features_cols,class_names=['0','1']) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_png('fakeNews.png') Image(graph.create_png())
.py files/decisiontreeclassifier_unpruned(fake_news_detection).py
#SILENCING THE FALSE POSITIVE WARNINGS import warnings warnings.simplefilter('always') with warnings.catch_warnings(): warnings.filterwarnings('ignore', category=pd.core.common.SettingWithCopyWarning) #IMPORTING DEPENDENCIES import tensorflow as tf import pandas as pd import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Embedding, Conv1D, GlobalMaxPooling1D, Activation #IMPORTING DATASET data = pd.read_csv('/content/gdrive/My Drive/Colab Notebooks/train.csv', index_col=False) df = data #Filling Missing Values in Data #print(df.isna().sum()) df[['title', 'author']] = df[['title', 'author']].fillna(value = 'Missing Value') df = df.dropna() df['length'] = df.iloc[:,3].str.len() #print(df.isna().sum()) df[df['length'] < 50].count() df = df.drop(df['text'][df['length'] < 50].index, axis=0) df_reverse = pd.DataFrame() #Categorical to Numeric for col_name in df.columns: if(df[col_name].dtype == 'object'): df[col_name]= df[col_name].astype('category') d = dict(enumerate(df[col_name].cat.categories)) df[col_name] = df[col_name].cat.codes df_reverse[col_name+"_code"] = df[col_name] df_reverse[col_name] = df[col_name].map(d) features_cols = ['id', 'title', 'author', 'text'] #FEATURES AND LABELS X = df[features_cols] Y = df.label #PREPARING TRAINING DATASET AND TEST DATASET from sklearn.model_selection import train_test_split X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=1) #DECISION TREE CLASSIFIER - UNPRUNDED TREE from sklearn.tree import DecisionTreeClassifier from sklearn import metrics dtc_unpruned = DecisionTreeClassifier() dtc_unpruned.fit(X_train, Y_train) Y_pred_dtc_unpruned = dtc_unpruned.predict(X_test) acc_score_dtc_unpruned = round(metrics.accuracy_score(Y_test,Y_pred_dtc_unpruned) * 100) print("Accuracy of DecisionTreeClassifier:", acc_score_dtc_unpruned, "%") X_test_cp = X_test #Decoding Data - ONE TIME STEP - DO NOT REPEAT df_reverse.set_index('title_code', inplace=False) title_dict = df_reverse.to_dict()['title'] df_reverse.set_index('author_code', inplace=False) author_dict = df_reverse.to_dict()['author'] df_reverse.set_index('text_code', inplace=False) text_dict = df_reverse.to_dict()['text'] X_test_cp['title'] = X_test_cp['title'].map(title_dict) X_test_cp['author'] = X_test_cp['author'].map(author_dict) X_test_cp['text'] = X_test_cp['text'].map(text_dict) X_test_cp.set_index('id', inplace=True) #DISPLAYING DECSIONTREECLASSIFIER - DECODED - RESULTS X_test_cp['Prediction'] = Y_pred_dtc_unpruned X_test_cp['Prediction'].replace([0,1],['Fake News','Relaible News'],inplace=True) pd.set_option('display.max_columns', 1000) pd.set_option('display.max_rows', 1000) #PREDICTION RESULTS X_test_cp.tail() #Visualizing DecisionTree from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO from IPython.display import Image import pydotplus dot_data = StringIO() export_graphviz(dtc_unpruned, out_file=dot_data, filled=True, rounded=True, special_characters=True,feature_names = features_cols,class_names=['0','1']) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_png('fakeNews.png') Image(graph.create_png())
0.357119
0.260754
import base64 import rapidjson import logging import asyncio # redis pool import aioredis from aiohttp import web, hdrs from .base import BaseAuthBackend from navigator.exceptions import ( NavException, UserDoesntExists, InvalidAuth ) from datetime import datetime, timedelta from navigator.conf import ( SESSION_URL, SESSION_TIMEOUT, SECRET_KEY, SESSION_PREFIX, SESSION_KEY ) class DjangoAuth(BaseAuthBackend): """Django SessionID Authentication Handler.""" redis = None _scheme: str = "Bearer" def configure(self, app, router): async def _setup_redis(app): self.redis = aioredis.from_url( SESSION_URL, decode_responses=True, encoding='utf-8' ) async def _close_redis(app): await self.redis.close() app.on_cleanup.append(_close_redis) return self.redis asyncio.get_event_loop().run_until_complete(_setup_redis(app)) # executing parent configurations super(DjangoAuth, self).configure(app, router) async def check_credentials(self, request): """ Authentication and create a session.""" return True async def get_payload(self, request): id = None try: if "Authorization" in request.headers: try: scheme, id = request.headers.get("Authorization").strip().split(" ") except ValueError: raise web.HTTPForbidden( reason="Invalid authorization Header", ) if scheme != self._scheme: raise web.HTTPForbidden( reason="Invalid Session scheme", ) elif "X-Sessionid" in request.headers: id = request.headers.get("X-Sessionid", None) except Exception as e: print(e) return None return id async def validate_session(self, key: str = None): try: print(SESSION_PREFIX) async with await self.redis as redis: result = await redis.get("{}:{}".format(SESSION_PREFIX, key)) print(result) if not result: raise Exception('Empty or non-existing Session') data = base64.b64decode(result) session_data = data.decode("utf-8").split(":", 1) user = rapidjson.loads(session_data[1]) session = { "key": key, "session_id": session_data[0], self.user_property: user, } return session except Exception as err: logging.debug("Django Decoding Error: {}".format(err)) raise Exception("Django Decoding Error: {}".format(err)) async def validate_user(self, login: str = None): # get the user based on Model search = {self.userid_attribute: login} try: user = await self.get_user(**search) return user except UserDoesntExists as err: raise UserDoesntExists(f"User {login} doesn\'t exists") except Exception as err: raise Exception(err) return None async def authenticate(self, request): """ Authenticate against user credentials (django session id).""" try: sessionid = await self.get_payload(request) logging.debug(f"Session ID: {sessionid}") except Exception as err: raise NavException(err, state=400) if not sessionid: raise InvalidAuth( "Auth: Invalid Credentials", state=401 ) else: try: data = await self.validate_session(key=sessionid) except Exception as err: raise InvalidAuth(f"Invalid Session: {err!s}", state=401) # making validation if not data: raise InvalidAuth("Missing User Information", state=403) try: u = data[self.user_property] username = u[self.userid_attribute] except KeyError as err: print(err) raise InvalidAuth( f"Missing {self.userid_attribute} attribute: {err!s}", state=401 ) try: user = await self.validate_user(login=username) except UserDoesntExists as err: raise UserDoesntExists(err) except Exception as err: raise NavException(err, state=500) try: userdata = self.get_userdata(user) userdata["session"] = data userdata[self.session_key_property] = sessionid # saving user-data into request: request['userdata'] = userdata request[SESSION_KEY] = sessionid payload = { self.user_property: user[self.userid_attribute], self.username_attribute: user[self.username_attribute], self.userid_attribute: user[self.userid_attribute], self.session_key_property: sessionid } token = self.create_jwt( data=payload ) return { "token": token, **userdata } except Exception as err: print(err) return False
navigator/auth/backends/django.py
import base64 import rapidjson import logging import asyncio # redis pool import aioredis from aiohttp import web, hdrs from .base import BaseAuthBackend from navigator.exceptions import ( NavException, UserDoesntExists, InvalidAuth ) from datetime import datetime, timedelta from navigator.conf import ( SESSION_URL, SESSION_TIMEOUT, SECRET_KEY, SESSION_PREFIX, SESSION_KEY ) class DjangoAuth(BaseAuthBackend): """Django SessionID Authentication Handler.""" redis = None _scheme: str = "Bearer" def configure(self, app, router): async def _setup_redis(app): self.redis = aioredis.from_url( SESSION_URL, decode_responses=True, encoding='utf-8' ) async def _close_redis(app): await self.redis.close() app.on_cleanup.append(_close_redis) return self.redis asyncio.get_event_loop().run_until_complete(_setup_redis(app)) # executing parent configurations super(DjangoAuth, self).configure(app, router) async def check_credentials(self, request): """ Authentication and create a session.""" return True async def get_payload(self, request): id = None try: if "Authorization" in request.headers: try: scheme, id = request.headers.get("Authorization").strip().split(" ") except ValueError: raise web.HTTPForbidden( reason="Invalid authorization Header", ) if scheme != self._scheme: raise web.HTTPForbidden( reason="Invalid Session scheme", ) elif "X-Sessionid" in request.headers: id = request.headers.get("X-Sessionid", None) except Exception as e: print(e) return None return id async def validate_session(self, key: str = None): try: print(SESSION_PREFIX) async with await self.redis as redis: result = await redis.get("{}:{}".format(SESSION_PREFIX, key)) print(result) if not result: raise Exception('Empty or non-existing Session') data = base64.b64decode(result) session_data = data.decode("utf-8").split(":", 1) user = rapidjson.loads(session_data[1]) session = { "key": key, "session_id": session_data[0], self.user_property: user, } return session except Exception as err: logging.debug("Django Decoding Error: {}".format(err)) raise Exception("Django Decoding Error: {}".format(err)) async def validate_user(self, login: str = None): # get the user based on Model search = {self.userid_attribute: login} try: user = await self.get_user(**search) return user except UserDoesntExists as err: raise UserDoesntExists(f"User {login} doesn\'t exists") except Exception as err: raise Exception(err) return None async def authenticate(self, request): """ Authenticate against user credentials (django session id).""" try: sessionid = await self.get_payload(request) logging.debug(f"Session ID: {sessionid}") except Exception as err: raise NavException(err, state=400) if not sessionid: raise InvalidAuth( "Auth: Invalid Credentials", state=401 ) else: try: data = await self.validate_session(key=sessionid) except Exception as err: raise InvalidAuth(f"Invalid Session: {err!s}", state=401) # making validation if not data: raise InvalidAuth("Missing User Information", state=403) try: u = data[self.user_property] username = u[self.userid_attribute] except KeyError as err: print(err) raise InvalidAuth( f"Missing {self.userid_attribute} attribute: {err!s}", state=401 ) try: user = await self.validate_user(login=username) except UserDoesntExists as err: raise UserDoesntExists(err) except Exception as err: raise NavException(err, state=500) try: userdata = self.get_userdata(user) userdata["session"] = data userdata[self.session_key_property] = sessionid # saving user-data into request: request['userdata'] = userdata request[SESSION_KEY] = sessionid payload = { self.user_property: user[self.userid_attribute], self.username_attribute: user[self.username_attribute], self.userid_attribute: user[self.userid_attribute], self.session_key_property: sessionid } token = self.create_jwt( data=payload ) return { "token": token, **userdata } except Exception as err: print(err) return False
0.475605
0.080683
import os import json import iso8601 from hashlib import sha256 import requests from requests.compat import urlencode PYBOSSA_API_KEY = os.environ.get("PYBOSSA_API_KEY") SCISTARTER_API_KEY = os.environ.get("SCISTARTER_API_KEY") def retrieve_email(user_id): """ Input: A user_id mapping to some User Profile in Public Editor Output: The email that belongs to the user with the userid input """ # Construct and call a GET request to public editor to get email given id url = f"https://pe.goodlylabs.org/api/user/{user_id}?api_key={PYBOSSA_API_KEY}" response = requests.get(url, headers={"Content-Type": "application/json"}) # error handling if response.status_code != 200: raise Exception(response.status_code, response.reason) data = response.json() return data["email_addr"] def retrieve_taskrun(taskrun_id): """ Input: A taskrun_id mapping to some Taskrun in Public Editor Output: A json representing the data of a taskrun instance """ url = f"https://pe.goodlylabs.org/api/taskrun/{taskrun_id}?api_key={PYBOSSA_API_KEY}" response = requests.get(url, headers={"Content-Type": "application/json"}) # error handling if response.status_code != 200: raise Exception(response.status_code, response.reason) data = response.json() return data def record_participation(taskrun_id, project_slug): """ Input: A userid mapping to some User Profile in Public Editor, A project_slug representing a unique project on SciStarter Action: Retrieves the email associated with userid and hashes the email. Record participation for the specified user in the specified project This will appear to succeed, regardless of whether the user is actually a SciStarter user or not. However, in that case this API call is a no-op. It only reports an error if the request is incorrect in some way. If the email address does *not* belong to a SciStarter user, all we've received is an opaque hash value, which preserves the user's privacy; we have no way of reversing the hashing process to discover the email. The project_slug parameter should contain the textual unique identifier of the project. It is easily accesible from the project URL. In the URL https://scistarter.org/airborne-walrus-capture the slug is the string airborne-walrus-capture """ # retrieve necessary data from a specific taskrun taskrun_json = retrieve_taskrun(taskrun_id) # calculate the total seconds user spent on task pybossa_created = iso8601.parse_date(taskrun_json.get('created')) pybossa_finish_time = iso8601.parse_date(taskrun_json.get('finish_time')) elapsed_time = pybossa_finish_time - pybossa_created total_seconds = int(elapsed_time.total_seconds()) # retrieve email from user_id and hash the email email = retrieve_email(taskrun_json.get('user_id')) hashed = sha256(email.encode("utf8")).hexdigest() # construct parameters for POST request to SciStarter url = "https://scistarter.org/api/participation/hashed/" + \ project_slug + "?key=" + SCISTARTER_API_KEY data = { "hashed": hashed, "type": "classification", # other options: 'collection', 'signup' "duration": total_seconds, # Seconds the user spent participating, or an estimate } response = requests.post(url=url, data=data) if response.status_code != 200: raise Exception(response.status_code, response.reason) return response.json() if __name__ == "__main__": print(record_participation(input("TaskRun ID: "), input("Project slug: ")))
vdashboard/scistarter.py
import os import json import iso8601 from hashlib import sha256 import requests from requests.compat import urlencode PYBOSSA_API_KEY = os.environ.get("PYBOSSA_API_KEY") SCISTARTER_API_KEY = os.environ.get("SCISTARTER_API_KEY") def retrieve_email(user_id): """ Input: A user_id mapping to some User Profile in Public Editor Output: The email that belongs to the user with the userid input """ # Construct and call a GET request to public editor to get email given id url = f"https://pe.goodlylabs.org/api/user/{user_id}?api_key={PYBOSSA_API_KEY}" response = requests.get(url, headers={"Content-Type": "application/json"}) # error handling if response.status_code != 200: raise Exception(response.status_code, response.reason) data = response.json() return data["email_addr"] def retrieve_taskrun(taskrun_id): """ Input: A taskrun_id mapping to some Taskrun in Public Editor Output: A json representing the data of a taskrun instance """ url = f"https://pe.goodlylabs.org/api/taskrun/{taskrun_id}?api_key={PYBOSSA_API_KEY}" response = requests.get(url, headers={"Content-Type": "application/json"}) # error handling if response.status_code != 200: raise Exception(response.status_code, response.reason) data = response.json() return data def record_participation(taskrun_id, project_slug): """ Input: A userid mapping to some User Profile in Public Editor, A project_slug representing a unique project on SciStarter Action: Retrieves the email associated with userid and hashes the email. Record participation for the specified user in the specified project This will appear to succeed, regardless of whether the user is actually a SciStarter user or not. However, in that case this API call is a no-op. It only reports an error if the request is incorrect in some way. If the email address does *not* belong to a SciStarter user, all we've received is an opaque hash value, which preserves the user's privacy; we have no way of reversing the hashing process to discover the email. The project_slug parameter should contain the textual unique identifier of the project. It is easily accesible from the project URL. In the URL https://scistarter.org/airborne-walrus-capture the slug is the string airborne-walrus-capture """ # retrieve necessary data from a specific taskrun taskrun_json = retrieve_taskrun(taskrun_id) # calculate the total seconds user spent on task pybossa_created = iso8601.parse_date(taskrun_json.get('created')) pybossa_finish_time = iso8601.parse_date(taskrun_json.get('finish_time')) elapsed_time = pybossa_finish_time - pybossa_created total_seconds = int(elapsed_time.total_seconds()) # retrieve email from user_id and hash the email email = retrieve_email(taskrun_json.get('user_id')) hashed = sha256(email.encode("utf8")).hexdigest() # construct parameters for POST request to SciStarter url = "https://scistarter.org/api/participation/hashed/" + \ project_slug + "?key=" + SCISTARTER_API_KEY data = { "hashed": hashed, "type": "classification", # other options: 'collection', 'signup' "duration": total_seconds, # Seconds the user spent participating, or an estimate } response = requests.post(url=url, data=data) if response.status_code != 200: raise Exception(response.status_code, response.reason) return response.json() if __name__ == "__main__": print(record_participation(input("TaskRun ID: "), input("Project slug: ")))
0.588889
0.171651
import django.db.models.deletion from django.conf import settings from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("contenttypes", "0002_remove_content_type_name"), ("checkerapp", "0011_auto_20200702_0615"), ] operations = [ migrations.CreateModel( name="AlertPluginUserData", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("sent_at", models.DateTimeField(auto_now_add=True)), ( "alert_receiver", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="alert_receiver", to=settings.AUTH_USER_MODEL, ), ), ( "check_obj", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="checkerapp.BaseCheck", ), ), ( "polymorphic_ctype", models.ForeignKey( editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="polymorphic_checkerapp.alertpluginuserdata_set+", to="contenttypes.ContentType", ), ), ], options={"abstract": False, "base_manager_name": "objects"}, ), migrations.CreateModel( name="AlertPlugin", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("title", models.CharField(editable=False, max_length=30, unique=True)), ("enabled", models.BooleanField(default=True)), ( "polymorphic_ctype", models.ForeignKey( editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="polymorphic_checkerapp.alertplugin_set+", to="contenttypes.ContentType", ), ), ], options={"abstract": False, "base_manager_name": "objects"}, ), ]
checkerapp/migrations/0012_alertplugin_alertpluginuserdata.py
import django.db.models.deletion from django.conf import settings from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("contenttypes", "0002_remove_content_type_name"), ("checkerapp", "0011_auto_20200702_0615"), ] operations = [ migrations.CreateModel( name="AlertPluginUserData", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("sent_at", models.DateTimeField(auto_now_add=True)), ( "alert_receiver", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="alert_receiver", to=settings.AUTH_USER_MODEL, ), ), ( "check_obj", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="checkerapp.BaseCheck", ), ), ( "polymorphic_ctype", models.ForeignKey( editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="polymorphic_checkerapp.alertpluginuserdata_set+", to="contenttypes.ContentType", ), ), ], options={"abstract": False, "base_manager_name": "objects"}, ), migrations.CreateModel( name="AlertPlugin", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("title", models.CharField(editable=False, max_length=30, unique=True)), ("enabled", models.BooleanField(default=True)), ( "polymorphic_ctype", models.ForeignKey( editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="polymorphic_checkerapp.alertplugin_set+", to="contenttypes.ContentType", ), ), ], options={"abstract": False, "base_manager_name": "objects"}, ), ]
0.426799
0.124266
import datetime import json import logging from decimal import Decimal from typing import Generator, Tuple import boto3 from botocore.config import Config from igata import settings logger = logging.getLogger("cliexecutor") TEN_SECONDS = 10 config = Config(connect_timeout=TEN_SECONDS, retries={"max_attempts": 5}) DYNAMODB = boto3.resource("dynamodb", config=config, region_name=settings.AWS_REGION, endpoint_url=settings.DYNAMODB_ENDPOINT) def update_item(item: dict, tablename: str) -> dict: """ Update the given item entry in the Dynamodb REQUESTS table item is expected to have the following keys: - REQUESTS_TABLE_HASHKEY_KEYNAME - RESULTS_TABLE_STATE_FIELDNAME """ table = DYNAMODB.Table(tablename) logger.info(f"Updating item in Table({tablename})...") logger.debug(f"item: {item}") processed_timestamp_utc = int(datetime.datetime.now(datetime.timezone.utc).timestamp()) try: # Assure that updated `errors` field is not None errors_field_value = "[]" if "errors" in item and item["errors"] is not None: errors_field_value = item["errors"] logger.info(f"errors={errors_field_value}") response = table.update_item( Key={settings.DYNAMODB_REQUESTS_TABLE_HASHKEY_KEYNAME: item[settings.DYNAMODB_REQUESTS_TABLE_HASHKEY_KEYNAME]}, UpdateExpression=( # should be REQUESTS_TABLE_RESULTS_KEYNAME "SET #s = :predictor_status, #r = :result_s3_uris, #e = :errors, #u = :updated_timestamp, #c = :completed_timestamp" ), ExpressionAttributeNames={ "#s": "predictor_status", # settings.DYNAMODB_RESULTS_TABLE_STATE_FIELDNAME, "#u": "updated_timestamp", # settings.DYNAMODB_REQUESTS_TABLE_RESULTS_KEYNAME, "#c": "completed_timestamp", "#r": "result_s3_uris", "#e": "errors", }, ExpressionAttributeValues={ ":predictor_status": item[settings.DYNAMODB_RESULTS_TABLE_STATE_FIELDNAME], ":result_s3_uris": item["result_s3_uris"], ":errors": errors_field_value, ":updated_timestamp": item.get("updated_timestamp", processed_timestamp_utc), ":completed_timestamp": item.get("completed_timestamp", processed_timestamp_utc), }, ) except Exception as e: logger.exception(e) logger.error(f"unable to put_item() to table: {tablename}") response = {} return response def get_nested_keys(record: dict) -> Generator[str, None, None]: """get all keys in a dictionary that contains nested mappings/elements""" for k, v in record.items(): if isinstance(v, (list, tuple, dict)): yield k def check_and_convert(value, precision=settings.DYNAMODB_DECIMAL_PRECISION_DIGITS): """convert float to decimal for dynamodb""" return value if not isinstance(value, float) else round(Decimal(value), precision) def prepare_record(record: dict) -> Tuple[dict, dict]: """ Convert record data for DynamoDB insertion record: updated record with json dumps fields for nested record values original_nested_data: untouched nested key record data """ original_nested_data = {} # used for processing the results into the results table nested_keys = get_nested_keys(record) if not nested_keys: logger.warning(f"No nested_keys found for record: {record}") else: for nested_key in nested_keys: # jsonize and byteify nested items value = record[nested_key] original_nested_data[nested_key] = value # keep original value for later processing value_json_bytes = json.dumps(value) record[nested_key] = value_json_bytes non_nested_keys = set(record.keys()) - set(nested_keys) for k in non_nested_keys: v = record[k] record[k] = check_and_convert(v) return record, original_nested_data
igata/handlers/aws/output/utils.py
import datetime import json import logging from decimal import Decimal from typing import Generator, Tuple import boto3 from botocore.config import Config from igata import settings logger = logging.getLogger("cliexecutor") TEN_SECONDS = 10 config = Config(connect_timeout=TEN_SECONDS, retries={"max_attempts": 5}) DYNAMODB = boto3.resource("dynamodb", config=config, region_name=settings.AWS_REGION, endpoint_url=settings.DYNAMODB_ENDPOINT) def update_item(item: dict, tablename: str) -> dict: """ Update the given item entry in the Dynamodb REQUESTS table item is expected to have the following keys: - REQUESTS_TABLE_HASHKEY_KEYNAME - RESULTS_TABLE_STATE_FIELDNAME """ table = DYNAMODB.Table(tablename) logger.info(f"Updating item in Table({tablename})...") logger.debug(f"item: {item}") processed_timestamp_utc = int(datetime.datetime.now(datetime.timezone.utc).timestamp()) try: # Assure that updated `errors` field is not None errors_field_value = "[]" if "errors" in item and item["errors"] is not None: errors_field_value = item["errors"] logger.info(f"errors={errors_field_value}") response = table.update_item( Key={settings.DYNAMODB_REQUESTS_TABLE_HASHKEY_KEYNAME: item[settings.DYNAMODB_REQUESTS_TABLE_HASHKEY_KEYNAME]}, UpdateExpression=( # should be REQUESTS_TABLE_RESULTS_KEYNAME "SET #s = :predictor_status, #r = :result_s3_uris, #e = :errors, #u = :updated_timestamp, #c = :completed_timestamp" ), ExpressionAttributeNames={ "#s": "predictor_status", # settings.DYNAMODB_RESULTS_TABLE_STATE_FIELDNAME, "#u": "updated_timestamp", # settings.DYNAMODB_REQUESTS_TABLE_RESULTS_KEYNAME, "#c": "completed_timestamp", "#r": "result_s3_uris", "#e": "errors", }, ExpressionAttributeValues={ ":predictor_status": item[settings.DYNAMODB_RESULTS_TABLE_STATE_FIELDNAME], ":result_s3_uris": item["result_s3_uris"], ":errors": errors_field_value, ":updated_timestamp": item.get("updated_timestamp", processed_timestamp_utc), ":completed_timestamp": item.get("completed_timestamp", processed_timestamp_utc), }, ) except Exception as e: logger.exception(e) logger.error(f"unable to put_item() to table: {tablename}") response = {} return response def get_nested_keys(record: dict) -> Generator[str, None, None]: """get all keys in a dictionary that contains nested mappings/elements""" for k, v in record.items(): if isinstance(v, (list, tuple, dict)): yield k def check_and_convert(value, precision=settings.DYNAMODB_DECIMAL_PRECISION_DIGITS): """convert float to decimal for dynamodb""" return value if not isinstance(value, float) else round(Decimal(value), precision) def prepare_record(record: dict) -> Tuple[dict, dict]: """ Convert record data for DynamoDB insertion record: updated record with json dumps fields for nested record values original_nested_data: untouched nested key record data """ original_nested_data = {} # used for processing the results into the results table nested_keys = get_nested_keys(record) if not nested_keys: logger.warning(f"No nested_keys found for record: {record}") else: for nested_key in nested_keys: # jsonize and byteify nested items value = record[nested_key] original_nested_data[nested_key] = value # keep original value for later processing value_json_bytes = json.dumps(value) record[nested_key] = value_json_bytes non_nested_keys = set(record.keys()) - set(nested_keys) for k in non_nested_keys: v = record[k] record[k] = check_and_convert(v) return record, original_nested_data
0.658966
0.291731
import json import requests from config import Config, CAR0, CAR1, CAR2, CAR3 #pylint: disable=unused-import class Coordinator: """ Provides all communication between the Starting Gate and the Race Coordinator The local race controller communicates with the Race Coordinator at via 4 interactions: * register: upon startup, if multi-track racing is selected, the local track registers with the Race Coordinator providing the track_name, number of lanes, and car icon selections. * deregister: at shut-down or if the user switches to single-track racing, the local track removes its registration with the Race Coordinator. * start: Indicates that the local track is ready to start a race. The Race Coordinator will only respond to the request once all tracks are ready * results: The local track reports its results and awaits the global results. """ # PUBLIC: def __init__(self, config): self.config = config self.register_url = "http://{}:{}/register".format(config.coord_host, config.coord_port) self.start_url = "http://{}:{}/start".format(config.coord_host, config.coord_port) self.results_url = "http://{}:{}/results".format(config.coord_host, config.coord_port) self.deregister_url = "http://{}:{}/deregister".format(config.coord_host, config.coord_port) def register(self): """ Register with the race coordinator. See Coordinator/drr_server.js for detail of the json request/response format """ headers = {'Content-Type': 'application/json'} registration = {} registration['circuit'] = self.config.circuit registration['trackName'] = self.config.track_name registration['numLanes'] = self.config.num_lanes registration['carIcons'] = self.config.car_icons json_string = json.dumps(registration).encode('utf-8') print("register: ", json_string) response = requests.post(self.register_url, data=json_string, headers=headers) print("response=", response) reply = response.json() print("reply=", reply) remote = reply['remoteRegistrations'][0] self.config.ip_address = reply['ip'] self.config.remote_track_name = remote['trackName'] self.config.remote_num_lanes = remote['numLanes'] self.config.remote_car_icons = remote['carIcons'] def deregister(self): """ Deregister from the race coordinator, thus leaving the circuit """ print("deregister: ") response = requests.post(self.deregister_url, data="") print("response=", response) def start_race(self): """ Send message to coordinator that the local track is ready for the start of the race. The GET request only returns when all tracks in the circuit are ready. """ print("start_race: GET ", self.start_url) response = requests.get(self.start_url) print("response=", response) def results(self, local_results): """ Send local race results to the race coordintor and collect circuit-wide results in the response. """ headers = {'Content-Type': 'application/json'} json_string = json.dumps(local_results).encode('utf-8') print("register: ", json_string) response = requests.post(self.results_url, data=json_string, headers=headers) print("response=", response) print("response.text=", response.text) result_string = response.text return result_string # PRIVATE: if __name__ == '__main__': def do_main(): #pylint: disable=attribute-defined-outside-init, no-member """ At some point I should write legitimate unit tests. But for now, I just exercise some basic functionality if the class is invoked as the Python main. """ main_config = Config("/home/tom/Raceway/StartingGate/config/starting_gate.json") main_config.car_icons[CAR1] = "white" main_config.car_icons[CAR2] = "police" main_coord = Coordinator(main_config) main_coord.register() main_coord.start_race() do_main() # vim: expandtab sw=4
StartingGate/coordinator.py
import json import requests from config import Config, CAR0, CAR1, CAR2, CAR3 #pylint: disable=unused-import class Coordinator: """ Provides all communication between the Starting Gate and the Race Coordinator The local race controller communicates with the Race Coordinator at via 4 interactions: * register: upon startup, if multi-track racing is selected, the local track registers with the Race Coordinator providing the track_name, number of lanes, and car icon selections. * deregister: at shut-down or if the user switches to single-track racing, the local track removes its registration with the Race Coordinator. * start: Indicates that the local track is ready to start a race. The Race Coordinator will only respond to the request once all tracks are ready * results: The local track reports its results and awaits the global results. """ # PUBLIC: def __init__(self, config): self.config = config self.register_url = "http://{}:{}/register".format(config.coord_host, config.coord_port) self.start_url = "http://{}:{}/start".format(config.coord_host, config.coord_port) self.results_url = "http://{}:{}/results".format(config.coord_host, config.coord_port) self.deregister_url = "http://{}:{}/deregister".format(config.coord_host, config.coord_port) def register(self): """ Register with the race coordinator. See Coordinator/drr_server.js for detail of the json request/response format """ headers = {'Content-Type': 'application/json'} registration = {} registration['circuit'] = self.config.circuit registration['trackName'] = self.config.track_name registration['numLanes'] = self.config.num_lanes registration['carIcons'] = self.config.car_icons json_string = json.dumps(registration).encode('utf-8') print("register: ", json_string) response = requests.post(self.register_url, data=json_string, headers=headers) print("response=", response) reply = response.json() print("reply=", reply) remote = reply['remoteRegistrations'][0] self.config.ip_address = reply['ip'] self.config.remote_track_name = remote['trackName'] self.config.remote_num_lanes = remote['numLanes'] self.config.remote_car_icons = remote['carIcons'] def deregister(self): """ Deregister from the race coordinator, thus leaving the circuit """ print("deregister: ") response = requests.post(self.deregister_url, data="") print("response=", response) def start_race(self): """ Send message to coordinator that the local track is ready for the start of the race. The GET request only returns when all tracks in the circuit are ready. """ print("start_race: GET ", self.start_url) response = requests.get(self.start_url) print("response=", response) def results(self, local_results): """ Send local race results to the race coordintor and collect circuit-wide results in the response. """ headers = {'Content-Type': 'application/json'} json_string = json.dumps(local_results).encode('utf-8') print("register: ", json_string) response = requests.post(self.results_url, data=json_string, headers=headers) print("response=", response) print("response.text=", response.text) result_string = response.text return result_string # PRIVATE: if __name__ == '__main__': def do_main(): #pylint: disable=attribute-defined-outside-init, no-member """ At some point I should write legitimate unit tests. But for now, I just exercise some basic functionality if the class is invoked as the Python main. """ main_config = Config("/home/tom/Raceway/StartingGate/config/starting_gate.json") main_config.car_icons[CAR1] = "white" main_config.car_icons[CAR2] = "police" main_coord = Coordinator(main_config) main_coord.register() main_coord.start_race() do_main() # vim: expandtab sw=4
0.606265
0.294262
from django.conf import settings from django.contrib.auth import get_backends from django.utils.functional import cached_property from social_core.backends.base import BaseAuth class BackendMetaMetaclass(type): def __new__(mcs, name, bases, attrs): cls = type.__new__(mcs, name, bases, attrs) if cls.backend_id: cls.registry[cls.backend_id] = cls() return cls class BackendMeta(metaclass=BackendMetaMetaclass): registry = {} backend_id = None @classmethod def wrap(cls, user_social_auth): return type(cls.registry.get(user_social_auth.provider))(user_social_auth) def __init__(self, user_social_auth=None): self.user_social_auth = user_social_auth @property def username(self): return self.user_social_auth.uid @property def provider(self): return self.user_social_auth.provider @property def id(self): return self.user_social_auth.id @cached_property def enabled(self): return any(isinstance(b, BaseAuth) and b.name == self.backend_id and all(b.get_key_and_secret()) for b in get_backends()) @property def show(self): return self.enabled @property def profile_url(self): return None class TwitterBackendMeta(BackendMeta): backend_id = 'twitter' name = 'Twitter' font_icon = 'fab fa-twitter' @property def username(self): return self.user_social_auth.extra_data['access_token']['screen_name'] @property def profile_url(self): return 'https://twitter.com/' + self.username class GoogleOAuth2BackendMeta(BackendMeta): backend_id = 'google-oauth2' name = 'Google' font_icon = 'fab fa-google' class ORCIDBackendMeta(BackendMeta): backend_id = 'orcid' name = 'ORCID' font_icon = 'ai ai-orcid' class FacebookBackendMeta(BackendMeta): backend_id = 'facebook' name = 'Facebook' font_icon = 'fab fa-facebook' class FigshareBackendMeta(BackendMeta): backend_id = 'figshare' name = 'Figshare' font_icon = 'ai ai-figshare' class LinkedinBackendMeta(BackendMeta): backend_id = 'linkedin-oauth2' name = 'LinkedIn' font_icon = 'fab fa-linkedin' @property def username(self): return None class GithubBackendMeta(BackendMeta): backend_id = 'github' name = 'GitHub' font_icon = 'fab fa-github' @property def username(self): return self.user_social_auth.extra_data['login'] @property def profile_url(self): return 'https://github.com/' + self.username
forsta_auth/backend_meta.py
from django.conf import settings from django.contrib.auth import get_backends from django.utils.functional import cached_property from social_core.backends.base import BaseAuth class BackendMetaMetaclass(type): def __new__(mcs, name, bases, attrs): cls = type.__new__(mcs, name, bases, attrs) if cls.backend_id: cls.registry[cls.backend_id] = cls() return cls class BackendMeta(metaclass=BackendMetaMetaclass): registry = {} backend_id = None @classmethod def wrap(cls, user_social_auth): return type(cls.registry.get(user_social_auth.provider))(user_social_auth) def __init__(self, user_social_auth=None): self.user_social_auth = user_social_auth @property def username(self): return self.user_social_auth.uid @property def provider(self): return self.user_social_auth.provider @property def id(self): return self.user_social_auth.id @cached_property def enabled(self): return any(isinstance(b, BaseAuth) and b.name == self.backend_id and all(b.get_key_and_secret()) for b in get_backends()) @property def show(self): return self.enabled @property def profile_url(self): return None class TwitterBackendMeta(BackendMeta): backend_id = 'twitter' name = 'Twitter' font_icon = 'fab fa-twitter' @property def username(self): return self.user_social_auth.extra_data['access_token']['screen_name'] @property def profile_url(self): return 'https://twitter.com/' + self.username class GoogleOAuth2BackendMeta(BackendMeta): backend_id = 'google-oauth2' name = 'Google' font_icon = 'fab fa-google' class ORCIDBackendMeta(BackendMeta): backend_id = 'orcid' name = 'ORCID' font_icon = 'ai ai-orcid' class FacebookBackendMeta(BackendMeta): backend_id = 'facebook' name = 'Facebook' font_icon = 'fab fa-facebook' class FigshareBackendMeta(BackendMeta): backend_id = 'figshare' name = 'Figshare' font_icon = 'ai ai-figshare' class LinkedinBackendMeta(BackendMeta): backend_id = 'linkedin-oauth2' name = 'LinkedIn' font_icon = 'fab fa-linkedin' @property def username(self): return None class GithubBackendMeta(BackendMeta): backend_id = 'github' name = 'GitHub' font_icon = 'fab fa-github' @property def username(self): return self.user_social_auth.extra_data['login'] @property def profile_url(self): return 'https://github.com/' + self.username
0.554832
0.070977
import pandas as pd TIME = { 'a': 3, 'b': 5, 'c': 2, 'd': 4, 'e': 3, 'f': 1, 'g': 4, 'h': 3, 'i': 3, 'j': 2, 'k': 5 } # Функция формирования таблицы. def create_table(data_, id_): with pd.option_context('display.width', None): table = pd.DataFrame(data_, index=id_) print(table) # Парсер файла с исходными данными. def parse_file(file_): counter_ = -1 tasks_ = {} for line in file_: parsed_line = line.split(',') counter_ += 1 for i in range(len(parsed_line)): tasks_['task' + str(parsed_line[0])] = dict() tasks_['task' + str(parsed_line[0])]['id'] = parsed_line[0] tasks_['task' + str(parsed_line[0])]['name'] = parsed_line[0] tasks_['task' + str(parsed_line[0])]['duration'] = parsed_line[1] if parsed_line[2] != "\n": tasks_['task' + str(parsed_line[0])]['dependencies'] = parsed_line[2].strip().split(';') else: tasks_['task' + str(parsed_line[0])]['dependencies'] = ['-1'] tasks_['task' + str(parsed_line[0])]['e_s'] = 0 tasks_['task' + str(parsed_line[0])]['e_f'] = 0 tasks_['task' + str(parsed_line[0])]['l_s'] = 0 tasks_['task' + str(parsed_line[0])]['l_f'] = 0 tasks_['task' + str(parsed_line[0])]['f'] = 0 tasks_['task' + str(parsed_line[0])]['isCritical'] = False return tasks_ def forward(__data): for forward_bypass in __data: # Если это первая задача. if '-1' in __data[forward_bypass]['dependencies']: __data[forward_bypass]['e_s'] = 0 __data[forward_bypass]['e_f'] = (__data[forward_bypass]['duration']) else: for key in __data.keys(): for dependence in __data[key]['dependencies']: # Если у задачи есть одна предшествующая задача. if dependence != '-1' and len(__data[key]['dependencies']) == 1: __data[key]['e_s'] = int(__data['task' + dependence]['e_f']) __data[key]['e_f'] = int(__data[key]['e_s']) + int(__data[key]['duration']) # Если у задачи есть более одной предшествующей задачи. elif dependence != '-1': if int(__data['task' + dependence]['e_f']) > int(__data[key]['e_s']): __data[key]['e_s'] = int(__data['task' + dependence]['e_f']) __data[key]['e_f'] = int(__data[key]['e_s']) + int(__data[key]['duration']) return __data def backward(data__, tasks): for backward_bypass in data__: # Если задача последняя. if data__.index(backward_bypass) == 0: tasks[backward_bypass]['l_f'] = tasks[backward_bypass]['e_f'] tasks[backward_bypass]['l_s'] = tasks[backward_bypass]['e_s'] for dependence in tasks[backward_bypass]['dependencies']: # Если задача не последняя. if dependence != '-1': if tasks['task' + dependence]['l_f'] == 0: tasks['task' + dependence]['l_f'] = int(tasks[backward_bypass]['l_s']) tasks['task' + dependence]['l_s'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['duration']) tasks['task' + dependence]['f'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['e_f']) if int(tasks['task' + dependence]['l_f']) > int(tasks[backward_bypass]['l_s']): tasks['task' + dependence]['l_f'] = int(tasks[backward_bypass]['l_s']) tasks['task' + dependence]['l_s'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['duration']) tasks['task' + dependence]['f'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['e_f']) return tasks if __name__ == '__main__': file = open('input.txt') tasks = parse_file(file) # Прямой проход. tasks = forward(tasks) # Копируем и переворачиваем tasks. array1 = [] for task in tasks.keys(): array1.append(task) array2 = array1[:] array2.reverse() # Обратный проход. tasks = backward(array2, tasks) ID = [] data = { 'Длительность задачи': [], 'Раннее начало': [], 'Раннее окончание': [], 'Позднее начало': [], 'Позднее окончание': [], 'Полный резерв': [], 'Критический путь': [] } for task in tasks: ID.append(tasks[task]['id']) data['Длительность задачи'].append(tasks[task]['duration']) data['Раннее начало'].append(tasks[task]['e_s']) data['Раннее окончание'].append(tasks[task]['e_f']) data['Позднее начало'].append((tasks[task]['l_s'])) data['Позднее окончание'].append((tasks[task]['l_f'])) data['Полный резерв'].append((tasks[task]['f'])) data['Критический путь'].append(tasks[task]['f'] == 0) create_table(data, ID) print('\nДлина критического пути:', tasks['taskstop']['l_s'])
lab7/main.py
import pandas as pd TIME = { 'a': 3, 'b': 5, 'c': 2, 'd': 4, 'e': 3, 'f': 1, 'g': 4, 'h': 3, 'i': 3, 'j': 2, 'k': 5 } # Функция формирования таблицы. def create_table(data_, id_): with pd.option_context('display.width', None): table = pd.DataFrame(data_, index=id_) print(table) # Парсер файла с исходными данными. def parse_file(file_): counter_ = -1 tasks_ = {} for line in file_: parsed_line = line.split(',') counter_ += 1 for i in range(len(parsed_line)): tasks_['task' + str(parsed_line[0])] = dict() tasks_['task' + str(parsed_line[0])]['id'] = parsed_line[0] tasks_['task' + str(parsed_line[0])]['name'] = parsed_line[0] tasks_['task' + str(parsed_line[0])]['duration'] = parsed_line[1] if parsed_line[2] != "\n": tasks_['task' + str(parsed_line[0])]['dependencies'] = parsed_line[2].strip().split(';') else: tasks_['task' + str(parsed_line[0])]['dependencies'] = ['-1'] tasks_['task' + str(parsed_line[0])]['e_s'] = 0 tasks_['task' + str(parsed_line[0])]['e_f'] = 0 tasks_['task' + str(parsed_line[0])]['l_s'] = 0 tasks_['task' + str(parsed_line[0])]['l_f'] = 0 tasks_['task' + str(parsed_line[0])]['f'] = 0 tasks_['task' + str(parsed_line[0])]['isCritical'] = False return tasks_ def forward(__data): for forward_bypass in __data: # Если это первая задача. if '-1' in __data[forward_bypass]['dependencies']: __data[forward_bypass]['e_s'] = 0 __data[forward_bypass]['e_f'] = (__data[forward_bypass]['duration']) else: for key in __data.keys(): for dependence in __data[key]['dependencies']: # Если у задачи есть одна предшествующая задача. if dependence != '-1' and len(__data[key]['dependencies']) == 1: __data[key]['e_s'] = int(__data['task' + dependence]['e_f']) __data[key]['e_f'] = int(__data[key]['e_s']) + int(__data[key]['duration']) # Если у задачи есть более одной предшествующей задачи. elif dependence != '-1': if int(__data['task' + dependence]['e_f']) > int(__data[key]['e_s']): __data[key]['e_s'] = int(__data['task' + dependence]['e_f']) __data[key]['e_f'] = int(__data[key]['e_s']) + int(__data[key]['duration']) return __data def backward(data__, tasks): for backward_bypass in data__: # Если задача последняя. if data__.index(backward_bypass) == 0: tasks[backward_bypass]['l_f'] = tasks[backward_bypass]['e_f'] tasks[backward_bypass]['l_s'] = tasks[backward_bypass]['e_s'] for dependence in tasks[backward_bypass]['dependencies']: # Если задача не последняя. if dependence != '-1': if tasks['task' + dependence]['l_f'] == 0: tasks['task' + dependence]['l_f'] = int(tasks[backward_bypass]['l_s']) tasks['task' + dependence]['l_s'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['duration']) tasks['task' + dependence]['f'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['e_f']) if int(tasks['task' + dependence]['l_f']) > int(tasks[backward_bypass]['l_s']): tasks['task' + dependence]['l_f'] = int(tasks[backward_bypass]['l_s']) tasks['task' + dependence]['l_s'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['duration']) tasks['task' + dependence]['f'] = \ int(tasks['task' + dependence]['l_f']) - int(tasks['task' + dependence]['e_f']) return tasks if __name__ == '__main__': file = open('input.txt') tasks = parse_file(file) # Прямой проход. tasks = forward(tasks) # Копируем и переворачиваем tasks. array1 = [] for task in tasks.keys(): array1.append(task) array2 = array1[:] array2.reverse() # Обратный проход. tasks = backward(array2, tasks) ID = [] data = { 'Длительность задачи': [], 'Раннее начало': [], 'Раннее окончание': [], 'Позднее начало': [], 'Позднее окончание': [], 'Полный резерв': [], 'Критический путь': [] } for task in tasks: ID.append(tasks[task]['id']) data['Длительность задачи'].append(tasks[task]['duration']) data['Раннее начало'].append(tasks[task]['e_s']) data['Раннее окончание'].append(tasks[task]['e_f']) data['Позднее начало'].append((tasks[task]['l_s'])) data['Позднее окончание'].append((tasks[task]['l_f'])) data['Полный резерв'].append((tasks[task]['f'])) data['Критический путь'].append(tasks[task]['f'] == 0) create_table(data, ID) print('\nДлина критического пути:', tasks['taskstop']['l_s'])
0.224565
0.318684
# Manage DNS Records # Functions: # - Add # - Update # - Delete # Usage: # ./dns_records.py <zone_id> <command> [name] [type] [content] [ttl] [record_id] # WGM CloudFlare integration import cf # WGM DB Integration import wgm_db # Other dependencies import sys import psycopg2.extras def update_dns_record(zone_id,record_id,name,rtype,content,ttl): record_name = name record_type = rtype record_content = content record_ttl = ttl status = {"command":"update_dns_record","status":False,"message":"False"} # Should have everything we need. Let's find out what type of provider this is. # Now check to make sure provider id is valid, die quickly otherwise. db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) #print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+zone_id cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: status['message']="Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+zone_id # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: status['message']="Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] # Find out Record UID get_record_sql = "SELECT provider_uid FROM dns_zone_records WHERE id="+record_id cur.execute(get_record_sql) get_record_row = cur.fetchone() if get_record_row is None: status['message']="Record has no uid" return status # Setup record variables record_uid = get_record_row['provider_uid'] if provider_type == "1": ## UPDATE A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare DNS Provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+provider_id cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: status['message']="Auth Token Unavailable" return status # Setup Auth Token auth_token = get_auth_row['auth_key0'] success = cf.update_dns_record(zone_uid,record_uid,auth_token,record_name,record_type,record_content,record_ttl) if success == True: #print("---SUCCESS---") #print("Updating db") update_rec_sql = "UPDATE dns_zone_records SET name = %s, type = %s, content = %s, ttl = %s WHERE id = %s" cur.execute(update_rec_sql,(record_name,record_type,record_content,record_ttl,record_id)) db_conn.commit() #print("DB Updated") else: status['message']="Failed to update DNS record" return status else: status['message']="Provider Type Unknown" return status status['status']=True status['message']="Success" return status def delete_dns_record(zone_id,record_id): status = {"command":"delete_dns_record","status":False,"message":"False"} # Find out what kind of provider this is. # Should have everything we need. Let's find out what type of provider this is. # Now check to make sure provider id is valid, die quickly otherwise. db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) #print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+str(zone_id) cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: #print("Zone Not Found") status['message']="Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+str(zone_id) # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: status['message']="Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] # Find Record provider_uid get_record_sql = "SELECT provider_uid FROM dns_zone_records WHERE id="+str(record_id) cur.execute(get_record_sql) get_record_row = cur.fetchone() if get_record_row is None: status['message'] = "Provider uid does not exist" return status record_uid = get_record_row['provider_uid'] if provider_type == "1": ## DELETE A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+str(provider_id) cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: status['message']="Auth Token Unavailable" return status # Setup Auth Token auth_token = get_auth_row['auth_key0'] # Deleting DNS Record #print("Deleting Record in Cloudflare") success = cf.delete_dns_record(zone_uid,record_uid,auth_token) if success == True: #print("---SUCCESS---") #print("Deleting from DB") delete_rec_sql = "DELETE FROM dns_zone_records WHERE id="+str(record_id) cur.execute(delete_rec_sql) db_conn.commit() else: status['Message']="Failed to delete DNS Record" return status else: status['message']="Unknown Provider" return status status['status']=True status['message']="Success" return status def add_dns_record(zone_id,name,rtype,content,ttl): record_name = name record_type = rtype record_content = content record_ttl = ttl status = {"command":"add_dns_record","status":False,"message":"False","record_uid":""} db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+zone_id cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: #print("Zone Not Found") status['message'] = "Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+zone_id # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: #print("Provider Does Not Exist") status['message'] = "Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] if provider_type == "1": ## ADD A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare DNS Provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+provider_id cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: #print("Auth Token Unavailable") status['message'] = "Auth Token Unavailable" return status # Setup Auth token auth_token = get_auth_row['auth_key0'] # We should have everything we need now to create the record in Cloudflare #print("Creating Record in Cloudflare") record_uid = cf.add_dns_record(zone_uid, auth_token, record_name, record_type, record_content, record_ttl) if record_uid != "FALSE": #print("Successfully created record in Cloudflare with uid: "+record_uid) #print("---SUCCESS---") #print("Updating Database") new_unique_id = wgm_db.get_unique_id(64,'dns_zone_records',db_conn) sql = "INSERT INTO dns_zone_records (name, type, content, zone, ttl, unique_id, provider_uid) VALUES (%s, %s, %s, %s, %s, %s, %s)" cur.execute(sql,(record_name,record_type,record_content,zone_id,record_ttl,new_unique_id,record_uid)) db_conn.commit() #print("DB Updated") else: #print("---FAILED---") status['message']="Failed to Create DNS Record" return status else: #print("Unknown Provider Type, Failing") status['message']="Unknown Provider Type" return status status['message']="Success" status['status']=True status['record_uid']=record_uid return status
wgm/cli/dns/dns_records.py
# Manage DNS Records # Functions: # - Add # - Update # - Delete # Usage: # ./dns_records.py <zone_id> <command> [name] [type] [content] [ttl] [record_id] # WGM CloudFlare integration import cf # WGM DB Integration import wgm_db # Other dependencies import sys import psycopg2.extras def update_dns_record(zone_id,record_id,name,rtype,content,ttl): record_name = name record_type = rtype record_content = content record_ttl = ttl status = {"command":"update_dns_record","status":False,"message":"False"} # Should have everything we need. Let's find out what type of provider this is. # Now check to make sure provider id is valid, die quickly otherwise. db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) #print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+zone_id cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: status['message']="Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+zone_id # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: status['message']="Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] # Find out Record UID get_record_sql = "SELECT provider_uid FROM dns_zone_records WHERE id="+record_id cur.execute(get_record_sql) get_record_row = cur.fetchone() if get_record_row is None: status['message']="Record has no uid" return status # Setup record variables record_uid = get_record_row['provider_uid'] if provider_type == "1": ## UPDATE A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare DNS Provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+provider_id cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: status['message']="Auth Token Unavailable" return status # Setup Auth Token auth_token = get_auth_row['auth_key0'] success = cf.update_dns_record(zone_uid,record_uid,auth_token,record_name,record_type,record_content,record_ttl) if success == True: #print("---SUCCESS---") #print("Updating db") update_rec_sql = "UPDATE dns_zone_records SET name = %s, type = %s, content = %s, ttl = %s WHERE id = %s" cur.execute(update_rec_sql,(record_name,record_type,record_content,record_ttl,record_id)) db_conn.commit() #print("DB Updated") else: status['message']="Failed to update DNS record" return status else: status['message']="Provider Type Unknown" return status status['status']=True status['message']="Success" return status def delete_dns_record(zone_id,record_id): status = {"command":"delete_dns_record","status":False,"message":"False"} # Find out what kind of provider this is. # Should have everything we need. Let's find out what type of provider this is. # Now check to make sure provider id is valid, die quickly otherwise. db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) #print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+str(zone_id) cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: #print("Zone Not Found") status['message']="Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+str(zone_id) # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: status['message']="Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] # Find Record provider_uid get_record_sql = "SELECT provider_uid FROM dns_zone_records WHERE id="+str(record_id) cur.execute(get_record_sql) get_record_row = cur.fetchone() if get_record_row is None: status['message'] = "Provider uid does not exist" return status record_uid = get_record_row['provider_uid'] if provider_type == "1": ## DELETE A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+str(provider_id) cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: status['message']="Auth Token Unavailable" return status # Setup Auth Token auth_token = get_auth_row['auth_key0'] # Deleting DNS Record #print("Deleting Record in Cloudflare") success = cf.delete_dns_record(zone_uid,record_uid,auth_token) if success == True: #print("---SUCCESS---") #print("Deleting from DB") delete_rec_sql = "DELETE FROM dns_zone_records WHERE id="+str(record_id) cur.execute(delete_rec_sql) db_conn.commit() else: status['Message']="Failed to delete DNS Record" return status else: status['message']="Unknown Provider" return status status['status']=True status['message']="Success" return status def add_dns_record(zone_id,name,rtype,content,ttl): record_name = name record_type = rtype record_content = content record_ttl = ttl status = {"command":"add_dns_record","status":False,"message":"False","record_uid":""} db_conn = wgm_db.connect() #print("DB Connection Open") cur = db_conn.cursor(cursor_factory = psycopg2.extras.DictCursor) print("Zone id: %s" % zone_id) # Find out Zone specific information get_zone_sql = "SELECT * FROM dns_zones WHERE id="+zone_id cur.execute(get_zone_sql) get_zone_row = cur.fetchone() if get_zone_row is None: #print("Zone Not Found") status['message'] = "Zone Not Found" return status # Setup Zone provider_uid zone_uid = get_zone_row['value'] #print("Zone value: "+zone_uid) # Find out Provider Specific Information get_provider_sql = "SELECT p.type,p.id FROM dns_providers AS p JOIN dns_zones AS z ON z.provider=p.id WHERE z.id="+zone_id # query db for zone cur.execute(get_provider_sql) get_provider_row = cur.fetchone() # make sure we have a legit digitalocean provider if get_provider_row is None: #print("Provider Does Not Exist") status['message'] = "Provider Does Not Exist" return status # Set up provider variables provider_id = str(get_provider_row['id']) provider_type = get_provider_row['type'] if provider_type == "1": ## ADD A RECORD FOR A CLOUDFLARE DNS PROVIDER TYPE #print("Cloudflare DNS Provider") #print("Unique Provider ID: "+provider_id) # Now we can get the auth_token get_auth_sql = "SELECT auth_key0 FROM dns_auth_configs WHERE provider="+provider_id cur.execute(get_auth_sql) get_auth_row = cur.fetchone() if get_auth_row is None: #print("Auth Token Unavailable") status['message'] = "Auth Token Unavailable" return status # Setup Auth token auth_token = get_auth_row['auth_key0'] # We should have everything we need now to create the record in Cloudflare #print("Creating Record in Cloudflare") record_uid = cf.add_dns_record(zone_uid, auth_token, record_name, record_type, record_content, record_ttl) if record_uid != "FALSE": #print("Successfully created record in Cloudflare with uid: "+record_uid) #print("---SUCCESS---") #print("Updating Database") new_unique_id = wgm_db.get_unique_id(64,'dns_zone_records',db_conn) sql = "INSERT INTO dns_zone_records (name, type, content, zone, ttl, unique_id, provider_uid) VALUES (%s, %s, %s, %s, %s, %s, %s)" cur.execute(sql,(record_name,record_type,record_content,zone_id,record_ttl,new_unique_id,record_uid)) db_conn.commit() #print("DB Updated") else: #print("---FAILED---") status['message']="Failed to Create DNS Record" return status else: #print("Unknown Provider Type, Failing") status['message']="Unknown Provider Type" return status status['message']="Success" status['status']=True status['record_uid']=record_uid return status
0.106058
0.089694
import math import components_3d as com import esper import glm import pygame import pygame.locals import resources as res def add_systems_1_to_world(world): world.add_processor(GameControlSystem()) def add_systems_2_to_world(world): world.add_processor(ThirdPersonCameraSystem()) world.add_processor(FreeCamOrientation()) def clamp(value, m_min, m_max): if value <= m_min: return m_min if value >= m_max: return m_max return value class GameControlSystem(esper.Processor): def process(self): keys = pygame.key.get_pressed() controls: res.GameControlState = self.world.controls # Swap camera if keys[controls.key_swap_camera] and not controls.key_swap_camera_state and controls.allow_camera_swap: # swap camera self.world._swap_camera() # Reset if keys[controls.key_return_to_home] and not controls.key_return_to_home_state: self.world.home_entities() controls.key_swap_camera_state = keys[controls.key_swap_camera] controls.key_return_to_home_state = keys[controls.key_return_to_home] self._acknowledge_input() def _acknowledge_input(self): controls: res.GameControlState = self.world.controls if controls.control_mode == res.GameControlState.PLAYER_MODE: self._wasd_movement( self.world.player_object, controls.player_speed, False, 0.0) self._arrow_key_rotation(self.world.player_object, enable_pitch=False) self._mouse_control(self.world.player_object, enable_pitch=False) # self._player_jump() else: self._wasd_movement( self.world.free_cam, controls.free_camera_speed, True, controls.free_camera_vertical_speed) self._arrow_key_rotation(self.world.free_cam) self._mouse_control(self.world.free_cam) # self._change_light(self.world.win_object) def _wasd_movement(self, entity_id, speed, vertical_movement, vertical_speed): keys = pygame.key.get_pressed() velocity = self.world.component_for_entity(entity_id, com.Velocity) # WASD direction = glm.vec3() if keys[pygame.locals.K_w]: direction.y += 1 if keys[pygame.locals.K_s]: direction.y -= 1 if keys[pygame.locals.K_a]: direction.x += 1 if keys[pygame.locals.K_d]: direction.x -= 1 if glm.length(direction) > 0.001: new_v = glm.normalize(direction) * speed velocity.value.x = new_v.x velocity.value.y = new_v.y else: velocity.value.x = 0.0 velocity.value.y = 0.0 if vertical_movement: velocity.value.z = 0 if keys[pygame.locals.K_SPACE]: velocity.value.z += vertical_speed if keys[pygame.locals.K_LSHIFT]: velocity.value.z -= vertical_speed if keys[pygame.locals.K_p]: tra = self.world.component_for_entity(entity_id, com.Transformation) print(f"Transformation(Position: {tra.position}, Rotation: {tra.rotation})") def _mouse_control(self, entity_id, enable_pitch=True): controls: res.GameControlState = self.world.controls screen_center = self.world.resolution / 2.0 # If python breaks on this try updating pygame :D (is_pressed, _, _, _, _) = pygame.mouse.get_pressed() if is_pressed: transformation = self.world.component_for_entity(entity_id, com.Transformation) #(rel_x, rel_y) = pygame.mouse.get_rel() (pos_x, pos_y) = pygame.mouse.get_pos() rel_x = screen_center.x - pos_x rel_y = screen_center.y - pos_y if enable_pitch: pitch_change = rel_y * controls.mouse_sensitivity transformation.rotation.y = clamp( transformation.rotation.y + pitch_change, (math.pi - 0.2) / -2, (math.pi - 0.2) / 2) transformation.rotation.x += rel_x * controls.mouse_sensitivity pygame.mouse.set_pos([screen_center.x, screen_center.y]) def _arrow_key_rotation(self, entity_id, enable_pitch=True): transformation = self.world.component_for_entity(entity_id, com.Transformation) keys = pygame.key.get_pressed() if enable_pitch: pitch_change = 0.0 if keys[pygame.locals.K_UP]: pitch_change += 0.1 if keys[pygame.locals.K_DOWN]: pitch_change -= 0.1 transformation.rotation.y = clamp( transformation.rotation.y + pitch_change, (math.pi - 0.2) / -2, (math.pi - 0.2) / 2) if keys[pygame.locals.K_LEFT]: transformation.rotation.x += 0.1 if keys[pygame.locals.K_RIGHT]: transformation.rotation.x -= 0.1 def _player_jump(self): collision = self.world.component_for_entity(self.world.player_object, com.CollisionComponent) if collision.is_colliding_z: keys = pygame.key.get_pressed() if keys[pygame.locals.K_SPACE]: v = self.world.component_for_entity(self.world.player_object, com.Velocity) v.value.z += self.world.controls.player_jump_height def _change_light(self, entity_id): keys = pygame.key.get_pressed() light: com.Light = self.world.component_for_entity(entity_id, com.Light) if keys[pygame.locals.K_t]: light.color.x += 0.01 if keys[pygame.locals.K_g]: light.color.x -= 0.01 if keys[pygame.locals.K_z]: light.color.y += 0.01 if keys[pygame.locals.K_h]: light.color.y -= 0.01 if keys[pygame.locals.K_u]: light.color.z += 0.01 if keys[pygame.locals.K_h]: light.color.z -= 0.01 if keys[pygame.locals.K_u]: light.attenuation.x += 0.01 if keys[pygame.locals.K_j]: light.attenuation.x -= 0.01 if keys[pygame.locals.K_i]: light.attenuation.y += 0.01 if keys[pygame.locals.K_k]: light.attenuation.y -= 0.01 if keys[pygame.locals.K_o]: light.attenuation.z += 0.01 if keys[pygame.locals.K_l]: light.attenuation.z -= 0.01 if keys[pygame.locals.K_p]: print(f"Light(color: {light.color}, attenuation: {light.attenuation})") class ThirdPersonCameraSystem(esper.Processor): def process(self): for _id, (transformation, orientation, third_person_cam) in self.world.get_components( com.Transformation, com.CameraOrientation, com.ThirdPersonCamera): orientation.look_at = self.world.component_for_entity(third_person_cam.target, com.Transformation).position yaw = self.world.component_for_entity(third_person_cam.target, com.Transformation).rotation.x pitch = third_person_cam.pitch dir_height = math.sin(pitch) dir_vec = glm.vec3( math.cos(yaw) * (1.0 - abs(dir_height)), math.sin(yaw) * (1.0 - abs(dir_height)), dir_height ) target_pos = self.world.component_for_entity(third_person_cam.target, com.Transformation).position transformation.position = target_pos - (dir_vec * third_person_cam.distance) class FreeCamOrientation(esper.Processor): def process(self): for _id, (transformation, orientation, _free_cam) in self.world.get_components( com.Transformation, com.CameraOrientation, com.FreeCamera): height = math.sin(transformation.rotation.y) orientation.look_at = transformation.position + glm.vec3( math.cos(transformation.rotation.x) * (1.0 - abs(height)), math.sin(transformation.rotation.x) * (1.0 - abs(height)), height )
src/control_system.py
import math import components_3d as com import esper import glm import pygame import pygame.locals import resources as res def add_systems_1_to_world(world): world.add_processor(GameControlSystem()) def add_systems_2_to_world(world): world.add_processor(ThirdPersonCameraSystem()) world.add_processor(FreeCamOrientation()) def clamp(value, m_min, m_max): if value <= m_min: return m_min if value >= m_max: return m_max return value class GameControlSystem(esper.Processor): def process(self): keys = pygame.key.get_pressed() controls: res.GameControlState = self.world.controls # Swap camera if keys[controls.key_swap_camera] and not controls.key_swap_camera_state and controls.allow_camera_swap: # swap camera self.world._swap_camera() # Reset if keys[controls.key_return_to_home] and not controls.key_return_to_home_state: self.world.home_entities() controls.key_swap_camera_state = keys[controls.key_swap_camera] controls.key_return_to_home_state = keys[controls.key_return_to_home] self._acknowledge_input() def _acknowledge_input(self): controls: res.GameControlState = self.world.controls if controls.control_mode == res.GameControlState.PLAYER_MODE: self._wasd_movement( self.world.player_object, controls.player_speed, False, 0.0) self._arrow_key_rotation(self.world.player_object, enable_pitch=False) self._mouse_control(self.world.player_object, enable_pitch=False) # self._player_jump() else: self._wasd_movement( self.world.free_cam, controls.free_camera_speed, True, controls.free_camera_vertical_speed) self._arrow_key_rotation(self.world.free_cam) self._mouse_control(self.world.free_cam) # self._change_light(self.world.win_object) def _wasd_movement(self, entity_id, speed, vertical_movement, vertical_speed): keys = pygame.key.get_pressed() velocity = self.world.component_for_entity(entity_id, com.Velocity) # WASD direction = glm.vec3() if keys[pygame.locals.K_w]: direction.y += 1 if keys[pygame.locals.K_s]: direction.y -= 1 if keys[pygame.locals.K_a]: direction.x += 1 if keys[pygame.locals.K_d]: direction.x -= 1 if glm.length(direction) > 0.001: new_v = glm.normalize(direction) * speed velocity.value.x = new_v.x velocity.value.y = new_v.y else: velocity.value.x = 0.0 velocity.value.y = 0.0 if vertical_movement: velocity.value.z = 0 if keys[pygame.locals.K_SPACE]: velocity.value.z += vertical_speed if keys[pygame.locals.K_LSHIFT]: velocity.value.z -= vertical_speed if keys[pygame.locals.K_p]: tra = self.world.component_for_entity(entity_id, com.Transformation) print(f"Transformation(Position: {tra.position}, Rotation: {tra.rotation})") def _mouse_control(self, entity_id, enable_pitch=True): controls: res.GameControlState = self.world.controls screen_center = self.world.resolution / 2.0 # If python breaks on this try updating pygame :D (is_pressed, _, _, _, _) = pygame.mouse.get_pressed() if is_pressed: transformation = self.world.component_for_entity(entity_id, com.Transformation) #(rel_x, rel_y) = pygame.mouse.get_rel() (pos_x, pos_y) = pygame.mouse.get_pos() rel_x = screen_center.x - pos_x rel_y = screen_center.y - pos_y if enable_pitch: pitch_change = rel_y * controls.mouse_sensitivity transformation.rotation.y = clamp( transformation.rotation.y + pitch_change, (math.pi - 0.2) / -2, (math.pi - 0.2) / 2) transformation.rotation.x += rel_x * controls.mouse_sensitivity pygame.mouse.set_pos([screen_center.x, screen_center.y]) def _arrow_key_rotation(self, entity_id, enable_pitch=True): transformation = self.world.component_for_entity(entity_id, com.Transformation) keys = pygame.key.get_pressed() if enable_pitch: pitch_change = 0.0 if keys[pygame.locals.K_UP]: pitch_change += 0.1 if keys[pygame.locals.K_DOWN]: pitch_change -= 0.1 transformation.rotation.y = clamp( transformation.rotation.y + pitch_change, (math.pi - 0.2) / -2, (math.pi - 0.2) / 2) if keys[pygame.locals.K_LEFT]: transformation.rotation.x += 0.1 if keys[pygame.locals.K_RIGHT]: transformation.rotation.x -= 0.1 def _player_jump(self): collision = self.world.component_for_entity(self.world.player_object, com.CollisionComponent) if collision.is_colliding_z: keys = pygame.key.get_pressed() if keys[pygame.locals.K_SPACE]: v = self.world.component_for_entity(self.world.player_object, com.Velocity) v.value.z += self.world.controls.player_jump_height def _change_light(self, entity_id): keys = pygame.key.get_pressed() light: com.Light = self.world.component_for_entity(entity_id, com.Light) if keys[pygame.locals.K_t]: light.color.x += 0.01 if keys[pygame.locals.K_g]: light.color.x -= 0.01 if keys[pygame.locals.K_z]: light.color.y += 0.01 if keys[pygame.locals.K_h]: light.color.y -= 0.01 if keys[pygame.locals.K_u]: light.color.z += 0.01 if keys[pygame.locals.K_h]: light.color.z -= 0.01 if keys[pygame.locals.K_u]: light.attenuation.x += 0.01 if keys[pygame.locals.K_j]: light.attenuation.x -= 0.01 if keys[pygame.locals.K_i]: light.attenuation.y += 0.01 if keys[pygame.locals.K_k]: light.attenuation.y -= 0.01 if keys[pygame.locals.K_o]: light.attenuation.z += 0.01 if keys[pygame.locals.K_l]: light.attenuation.z -= 0.01 if keys[pygame.locals.K_p]: print(f"Light(color: {light.color}, attenuation: {light.attenuation})") class ThirdPersonCameraSystem(esper.Processor): def process(self): for _id, (transformation, orientation, third_person_cam) in self.world.get_components( com.Transformation, com.CameraOrientation, com.ThirdPersonCamera): orientation.look_at = self.world.component_for_entity(third_person_cam.target, com.Transformation).position yaw = self.world.component_for_entity(third_person_cam.target, com.Transformation).rotation.x pitch = third_person_cam.pitch dir_height = math.sin(pitch) dir_vec = glm.vec3( math.cos(yaw) * (1.0 - abs(dir_height)), math.sin(yaw) * (1.0 - abs(dir_height)), dir_height ) target_pos = self.world.component_for_entity(third_person_cam.target, com.Transformation).position transformation.position = target_pos - (dir_vec * third_person_cam.distance) class FreeCamOrientation(esper.Processor): def process(self): for _id, (transformation, orientation, _free_cam) in self.world.get_components( com.Transformation, com.CameraOrientation, com.FreeCamera): height = math.sin(transformation.rotation.y) orientation.look_at = transformation.position + glm.vec3( math.cos(transformation.rotation.x) * (1.0 - abs(height)), math.sin(transformation.rotation.x) * (1.0 - abs(height)), height )
0.383295
0.272917
from unittest import TestCase from exceptions import InvalidCardSize, InvalidPlayerMove from game.game_state_machine import GameStateMachine from game.game_variant import GameVariantGrand from game.state.game_state_bid import GameStateBid, BidStateCallTurn, BidCallAction, BidStateResponseTurn, \ BidAcceptAction, BidPassAction, BidStateEnd from game.game import Game from game.state.game_state_play import GameStatePlay from model.player import Player from model.card import Card # TODO check for correct action delegation with substates class GameStateBidTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_pickUpSkat(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) skat = self.game.skat skat.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) skat.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when self.state.pick_up_skat(player) # then self.assertEquals(len(player.cards), 4) self.assertEquals(len(skat), 0) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) in player.cards) def test_pickUpSkat_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) skat = self.game.skat skat.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) skat.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when/then self.assertRaises(InvalidPlayerMove, self.state.pick_up_skat, player) def test_putDownSkat(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when self.state.put_down_skat(player, cards_to_put) # then self.assertEquals(len(player.cards), 2) self.assertEquals(len(self.game.skat), 2) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) not in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) not in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) in self.game.skat) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) in self.game.skat) def test_putDownSkat_lessThanTwoFails(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) # when/then self.assertRaises(InvalidCardSize, self.state.put_down_skat, player, cards_to_put) def test_putDownSkat_moreThanTwoFails(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.NINE)) # when/then self.assertRaises(InvalidCardSize, self.state.put_down_skat, player, cards_to_put) def test_putDownSkat_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when/then self.assertRaises(InvalidPlayerMove, self.state.put_down_skat, player, cards_to_put) def test_declareGame(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER game_variant = GameVariantGrand() # when self.state.declare_game(player, game_variant) # then self.assertEquals(self.game.game_variant, game_variant) self.assertTrue(isinstance(self.state_machine.current_state, GameStatePlay)) def test_declareGame_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER game_variant = GameVariantGrand() # when/then self.assertRaises(InvalidPlayerMove, self.state.declare_game, player, game_variant) def test_bidPass(self): # given player = self.game.players[0] # when self.state.bid_pass(self.game, player) # then self.assertEquals(player.type, Player.Type.DEFENDER) self.assertTrue(player in self.game.passed_bid_players) def test_bidPass_playerAlreadyPassedFails(self): # given player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.bid_pass, self.game, player) def test_checkPlayerHasPassed(self): # given player = self.game.players[0] # when self.state.check_player_has_passed(self.game, player) # then nothing happens def test_checkPlayerHasPassed_Fails(self): # given player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.check_player_has_passed, self.game, player) def test_twoPlayerPasses(self): # given self.game.dealer = 0 declarer = self.game.get_second_seat() defender1 = self.game.get_first_seat() defender2 = self.game.get_third_seat() # when self.state.handle_action(BidCallAction(declarer, 18)) self.state.handle_action(BidPassAction(defender1, 18)) self.state.handle_action(BidPassAction(defender2, 18)) # then self.assertEquals(declarer.type, Player.Type.DECLARER) self.assertEquals(defender1.type, Player.Type.DEFENDER) self.assertEquals(defender2.type, Player.Type.DEFENDER) class BidResponseAction(object): pass class BidStateCallTurnTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_transitionFromCallTurnToResponseTurn(self): # given value = 18 player = self.game.players[0] self.state.current_bid_state = BidStateCallTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidCallAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateResponseTurn)) def test_transitionFromCallTurnToEnd(self): # given value = 18 player = self.game.players[0] self.game.passed_bid_players.append(self.game.players[1]) self.state.current_bid_state = BidStateCallTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidPassAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateEnd)) def test_bidCall(self): # given value = 18 self.game.bid_value = -1 player = self.game.players[0] # when self.state.current_bid_state.bid_call(player, value) # then self.assertEquals(self.game.bid_value, value) def test_bidCall_playerAlreadyPassedFails(self): # given value = 18 player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_call, player, value) def test_bidCall_unavailableBidValueFails(self): # given value = 5 player = self.game.players[0] # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_call, player, value) class BidStateCallResponseTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler self.state_machine = GameStateMachine(self.state) def test_transitionFromResponseTurnToEnd(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.game.passed_bid_players.append(self.game.players[1]) self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidPassAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateEnd)) def test_transitionFromResponseTurnToCallTurn(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidAcceptAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateCallTurn)) def test_bidAccept(self): # given value = 18 self.game.bid_value = 18 player = self.game.players[0] # when self.state.current_bid_state.bid_accept(player, value) # then nothing should happen (beside state changed) def test_bidCall_playerAlreadyPassedFails(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_accept, player, value) def test_bidCall_unavailableBidValueFails(self): # given value = 18 self.game.bid_value = 20 player = self.game.players[0] # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_accept, player, value) class BidStateEndTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_firstSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_second_seat(), self.game.get_third_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_first_seat().type, Player.Type.DECLARER) def test_secondSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_first_seat(), self.game.get_third_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_second_seat().type, Player.Type.DECLARER) def test_thirdSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_first_seat(), self.game.get_second_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_third_seat().type, Player.Type.DECLARER)
tests/game/state/test_game_state_bid.py
from unittest import TestCase from exceptions import InvalidCardSize, InvalidPlayerMove from game.game_state_machine import GameStateMachine from game.game_variant import GameVariantGrand from game.state.game_state_bid import GameStateBid, BidStateCallTurn, BidCallAction, BidStateResponseTurn, \ BidAcceptAction, BidPassAction, BidStateEnd from game.game import Game from game.state.game_state_play import GameStatePlay from model.player import Player from model.card import Card # TODO check for correct action delegation with substates class GameStateBidTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_pickUpSkat(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) skat = self.game.skat skat.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) skat.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when self.state.pick_up_skat(player) # then self.assertEquals(len(player.cards), 4) self.assertEquals(len(skat), 0) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) in player.cards) def test_pickUpSkat_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) skat = self.game.skat skat.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) skat.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when/then self.assertRaises(InvalidPlayerMove, self.state.pick_up_skat, player) def test_putDownSkat(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when self.state.put_down_skat(player, cards_to_put) # then self.assertEquals(len(player.cards), 2) self.assertEquals(len(self.game.skat), 2) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) not in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) not in player.cards) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.SEVEN) in self.game.skat) self.assertTrue(Card(Card.Suit.HEARTS, Card.Face.EIGHT) in self.game.skat) def test_putDownSkat_lessThanTwoFails(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) # when/then self.assertRaises(InvalidCardSize, self.state.put_down_skat, player, cards_to_put) def test_putDownSkat_moreThanTwoFails(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.NINE)) # when/then self.assertRaises(InvalidCardSize, self.state.put_down_skat, player, cards_to_put) def test_putDownSkat_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.DIAMOND, Card.Face.EIGHT)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) player.cards.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) cards_to_put = list() cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.SEVEN)) cards_to_put.append(Card(Card.Suit.HEARTS, Card.Face.EIGHT)) # when/then self.assertRaises(InvalidPlayerMove, self.state.put_down_skat, player, cards_to_put) def test_declareGame(self): # given player = self.game.players[0] player.type = Player.Type.DECLARER game_variant = GameVariantGrand() # when self.state.declare_game(player, game_variant) # then self.assertEquals(self.game.game_variant, game_variant) self.assertTrue(isinstance(self.state_machine.current_state, GameStatePlay)) def test_declareGame_notDeclarerFails(self): # given player = self.game.players[0] player.type = Player.Type.DEFENDER game_variant = GameVariantGrand() # when/then self.assertRaises(InvalidPlayerMove, self.state.declare_game, player, game_variant) def test_bidPass(self): # given player = self.game.players[0] # when self.state.bid_pass(self.game, player) # then self.assertEquals(player.type, Player.Type.DEFENDER) self.assertTrue(player in self.game.passed_bid_players) def test_bidPass_playerAlreadyPassedFails(self): # given player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.bid_pass, self.game, player) def test_checkPlayerHasPassed(self): # given player = self.game.players[0] # when self.state.check_player_has_passed(self.game, player) # then nothing happens def test_checkPlayerHasPassed_Fails(self): # given player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.check_player_has_passed, self.game, player) def test_twoPlayerPasses(self): # given self.game.dealer = 0 declarer = self.game.get_second_seat() defender1 = self.game.get_first_seat() defender2 = self.game.get_third_seat() # when self.state.handle_action(BidCallAction(declarer, 18)) self.state.handle_action(BidPassAction(defender1, 18)) self.state.handle_action(BidPassAction(defender2, 18)) # then self.assertEquals(declarer.type, Player.Type.DECLARER) self.assertEquals(defender1.type, Player.Type.DEFENDER) self.assertEquals(defender2.type, Player.Type.DEFENDER) class BidResponseAction(object): pass class BidStateCallTurnTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_transitionFromCallTurnToResponseTurn(self): # given value = 18 player = self.game.players[0] self.state.current_bid_state = BidStateCallTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidCallAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateResponseTurn)) def test_transitionFromCallTurnToEnd(self): # given value = 18 player = self.game.players[0] self.game.passed_bid_players.append(self.game.players[1]) self.state.current_bid_state = BidStateCallTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidPassAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateEnd)) def test_bidCall(self): # given value = 18 self.game.bid_value = -1 player = self.game.players[0] # when self.state.current_bid_state.bid_call(player, value) # then self.assertEquals(self.game.bid_value, value) def test_bidCall_playerAlreadyPassedFails(self): # given value = 18 player = self.game.players[0] self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_call, player, value) def test_bidCall_unavailableBidValueFails(self): # given value = 5 player = self.game.players[0] # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_call, player, value) class BidStateCallResponseTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler self.state_machine = GameStateMachine(self.state) def test_transitionFromResponseTurnToEnd(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.game.passed_bid_players.append(self.game.players[1]) self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidPassAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateEnd)) def test_transitionFromResponseTurnToCallTurn(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler # when self.state.current_bid_state.handle_action(BidAcceptAction(player, value)) # then self.assertTrue(isinstance(self.state.current_bid_state, BidStateCallTurn)) def test_bidAccept(self): # given value = 18 self.game.bid_value = 18 player = self.game.players[0] # when self.state.current_bid_state.bid_accept(player, value) # then nothing should happen (beside state changed) def test_bidCall_playerAlreadyPassedFails(self): # given value = 18 player = self.game.players[0] self.game.bid_value = 18 self.game.passed_bid_players.append(player) # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_accept, player, value) def test_bidCall_unavailableBidValueFails(self): # given value = 18 self.game.bid_value = 20 player = self.game.players[0] # when/then self.assertRaises(InvalidPlayerMove, self.state.current_bid_state.bid_accept, player, value) class BidStateEndTest(TestCase): def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state) def test_firstSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_second_seat(), self.game.get_third_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_first_seat().type, Player.Type.DECLARER) def test_secondSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_first_seat(), self.game.get_third_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_second_seat().type, Player.Type.DECLARER) def test_thirdSeatIsDeclarer(self): # given self.game.bid_value = 18 self.game.passed_bid_players = [self.game.get_first_seat(), self.game.get_second_seat()] self.state.current_bid_state = BidStateEnd(self.game) # then self.assertEquals(self.game.get_third_seat().type, Player.Type.DECLARER)
0.400515
0.308529
from __future__ import unicode_literals from rest_framework.views import APIView from rest_framework.parsers import JSONParser from rest_framework.response import Response from rest_framework import status from credocommon.exceptions import RegistrationException from credoapiv2.authentication import DRFTokenAuthentication from credoapiv2.exceptions import CredoAPIException, LoginException from credoapiv2.handlers import ( handle_registration, handle_login, handle_oauth_login, handle_user_id, handle_detection, handle_update_info, handle_ping, handle_data_export, handle_mapping_export, ) import logging logger = logging.getLogger(__name__) class UserRegistrationView(APIView): """ post: Register user """ parser_classes = (JSONParser,) def post(self, request): try: handle_registration(request) return Response( status=status.HTTP_200_OK, data={"message": "Please check your email for activation link."}, ) except RegistrationException as e: return Response( data={"message": "Registration failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserLoginView(APIView): """ post: Login user """ parser_classes = (JSONParser,) def post(self, request, format=None): try: return Response(data=handle_login(request), status=status.HTTP_200_OK) except LoginException as e: return Response( data={"message": "Login failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserOAuthLoginView(APIView): """ post: Login user with OAuth provider """ parser_classes = (JSONParser,) def post(self, request, format=None): try: return Response(data=handle_oauth_login(request), status=status.HTTP_200_OK) except LoginException as e: return Response( data={"message": "OAuth login failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserInfoView(APIView): """ post: Change information about user """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: data = handle_update_info(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Updating user info failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class UserIdView(APIView): """ get: Get unique user ID """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def get(self, request): if request.user.is_authenticated: try: data = handle_user_id(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Getting user ID failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class DetectionView(APIView): """ post: Submit detection """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: data = handle_detection(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Submitting detection failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class PingView(APIView): """ post: Submit ping """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: handle_ping(request) return Response(status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Ping failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class DataExportView(APIView): """ post: Export data """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) throttle_scope = "data_export" def post(self, request): if request.user.is_authenticated and request.user.is_staff: try: return Response( data=handle_data_export(request), status=status.HTTP_200_OK ) except CredoAPIException as e: return Response( data={"message": "Data export failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class MappingExportView(APIView): """ post: Export mapping """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) throttle_scope = "mapping_export" def post(self, request): if request.user.is_authenticated and request.user.is_staff: try: return Response( data=handle_mapping_export(request), status=status.HTTP_200_OK ) except CredoAPIException as e: return Response( data={"message": "Mapping export failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED )
credoapiv2/views.py
from __future__ import unicode_literals from rest_framework.views import APIView from rest_framework.parsers import JSONParser from rest_framework.response import Response from rest_framework import status from credocommon.exceptions import RegistrationException from credoapiv2.authentication import DRFTokenAuthentication from credoapiv2.exceptions import CredoAPIException, LoginException from credoapiv2.handlers import ( handle_registration, handle_login, handle_oauth_login, handle_user_id, handle_detection, handle_update_info, handle_ping, handle_data_export, handle_mapping_export, ) import logging logger = logging.getLogger(__name__) class UserRegistrationView(APIView): """ post: Register user """ parser_classes = (JSONParser,) def post(self, request): try: handle_registration(request) return Response( status=status.HTTP_200_OK, data={"message": "Please check your email for activation link."}, ) except RegistrationException as e: return Response( data={"message": "Registration failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserLoginView(APIView): """ post: Login user """ parser_classes = (JSONParser,) def post(self, request, format=None): try: return Response(data=handle_login(request), status=status.HTTP_200_OK) except LoginException as e: return Response( data={"message": "Login failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserOAuthLoginView(APIView): """ post: Login user with OAuth provider """ parser_classes = (JSONParser,) def post(self, request, format=None): try: return Response(data=handle_oauth_login(request), status=status.HTTP_200_OK) except LoginException as e: return Response( data={"message": "OAuth login failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except CredoAPIException as e: return Response( data={"message": str(e)}, status=status.HTTP_400_BAD_REQUEST ) except Exception as e: logger.exception(e) raise e class UserInfoView(APIView): """ post: Change information about user """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: data = handle_update_info(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Updating user info failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class UserIdView(APIView): """ get: Get unique user ID """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def get(self, request): if request.user.is_authenticated: try: data = handle_user_id(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Getting user ID failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class DetectionView(APIView): """ post: Submit detection """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: data = handle_detection(request) return Response(data=data, status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Submitting detection failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class PingView(APIView): """ post: Submit ping """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) def post(self, request): if request.user.is_authenticated: try: handle_ping(request) return Response(status=status.HTTP_200_OK) except CredoAPIException as e: return Response( data={"message": "Ping failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class DataExportView(APIView): """ post: Export data """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) throttle_scope = "data_export" def post(self, request): if request.user.is_authenticated and request.user.is_staff: try: return Response( data=handle_data_export(request), status=status.HTTP_200_OK ) except CredoAPIException as e: return Response( data={"message": "Data export failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED ) class MappingExportView(APIView): """ post: Export mapping """ authentication_classes = (DRFTokenAuthentication,) parser_classes = (JSONParser,) throttle_scope = "mapping_export" def post(self, request): if request.user.is_authenticated and request.user.is_staff: try: return Response( data=handle_mapping_export(request), status=status.HTTP_200_OK ) except CredoAPIException as e: return Response( data={"message": "Mapping export failed. Reason: " + str(e)}, status=status.HTTP_400_BAD_REQUEST, ) except Exception as e: logger.exception(e) raise e else: return Response( data={"message": "Invalid token"}, status=status.HTTP_401_UNAUTHORIZED )
0.500244
0.088583
from __future__ import absolute_import import sys from esky.util import lazy_import @lazy_import def os(): import os return os @lazy_import def tempfile(): import tempfile return tempfile @lazy_import def threading(): try: import threading except ImportError: threading = None return threading @lazy_import def ctypes(): import ctypes import ctypes.wintypes return ctypes def monitor_master_process(fpath): """Watch the given path to detect the master process dying. If the master process dies, the current process is terminated. """ if not threading: return None def monitor(): if wait_for_master(fpath): os._exit(1) t = threading.Thread(target=monitor) t.daemon = True t.start() return t def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" def run_startup_hooks(): if len(sys.argv) > 1 and sys.argv[1] == "--esky-slave-proc": del sys.argv[1] if len(sys.argv) > 1: arg = sys.argv[1] del sys.argv[1] else: arg = None monitor_master_process(arg) if sys.platform == "win32": # On win32, the master process creates a tempfile that will be deleted # when it exits. Use ReadDirectoryChanges to block on this event. def wait_for_master(fpath): """Wait for the master process to die.""" try: RDCW = ctypes.windll.kernel32.ReadDirectoryChangesW except AttributeError: return False INVALID_HANDLE_VALUE = 0xFFFFFFFF FILE_NOTIFY_CHANGE_FILE_NAME = 0x01 FILE_LIST_DIRECTORY = 0x01 FILE_SHARE_READ = 0x01 FILE_SHARE_WRITE = 0x02 OPEN_EXISTING = 3 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 try: ctypes.wintypes.LPVOID except AttributeError: ctypes.wintypes.LPVOID = ctypes.c_void_p def _errcheck_bool(value,func,args): if not value: raise ctypes.WinError() return args def _errcheck_handle(value,func,args): if not value: raise ctypes.WinError() if value == INVALID_HANDLE_VALUE: raise ctypes.WinError() return args RDCW.errcheck = _errcheck_bool RDCW.restype = ctypes.wintypes.BOOL RDCW.argtypes = ( ctypes.wintypes.HANDLE, # hDirectory ctypes.wintypes.LPVOID, # lpBuffer ctypes.wintypes.DWORD, # nBufferLength ctypes.wintypes.BOOL, # bWatchSubtree ctypes.wintypes.DWORD, # dwNotifyFilter ctypes.POINTER(ctypes.wintypes.DWORD), # lpBytesReturned ctypes.wintypes.LPVOID, # lpOverlapped ctypes.wintypes.LPVOID # lpCompletionRoutine ) CreateFileW = ctypes.windll.kernel32.CreateFileW CreateFileW.errcheck = _errcheck_handle CreateFileW.restype = ctypes.wintypes.HANDLE CreateFileW.argtypes = ( ctypes.wintypes.LPCWSTR, # lpFileName ctypes.wintypes.DWORD, # dwDesiredAccess ctypes.wintypes.DWORD, # dwShareMode ctypes.wintypes.LPVOID, # lpSecurityAttributes ctypes.wintypes.DWORD, # dwCreationDisposition ctypes.wintypes.DWORD, # dwFlagsAndAttributes ctypes.wintypes.HANDLE # hTemplateFile ) CloseHandle = ctypes.windll.kernel32.CloseHandle CloseHandle.restype = ctypes.wintypes.BOOL CloseHandle.argtypes = ( ctypes.wintypes.HANDLE, # hObject ) result = ctypes.create_string_buffer(1024) nbytes = ctypes.c_ulong() handle = CreateFileW(os.path.join(os.path.dirname(fpath),u""), FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE, None, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) # Since this loop may still be running at interpreter close, we # take local references to our imported functions to avoid # garbage-collection-related errors at shutdown. byref = ctypes.byref pathexists = os.path.exists try: while pathexists(fpath): RDCW(handle,byref(result),len(result), True,FILE_NOTIFY_CHANGE_FILE_NAME, byref(nbytes),None,None) finally: CloseHandle(handle) return True def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" try: flags = os.O_CREAT|os.O_EXCL|os.O_TEMPORARY|os.O_NOINHERIT tfile = tempfile.mktemp() fd = os.open(tfile,flags) except EnvironmentError: return [] else: return ["--esky-slave-proc",tfile] else: # On unix, the master process takes an exclusive flock on the given file. # We try to take one as well, which will block until the master dies. import fcntl def wait_for_master(fpath): """Wait for the master process to die.""" try: fd = os.open(fpath,os.O_RDWR) fcntl.flock(fd,fcntl.LOCK_EX) return True except EnvironmentError: return False def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" try: (fd,tfile) = tempfile.mkstemp() fcntl.flock(fd,fcntl.LOCK_EX) except EnvironmentError: return [] else: return ["--esky-slave-proc",tfile]
esky/slaveproc.py
from __future__ import absolute_import import sys from esky.util import lazy_import @lazy_import def os(): import os return os @lazy_import def tempfile(): import tempfile return tempfile @lazy_import def threading(): try: import threading except ImportError: threading = None return threading @lazy_import def ctypes(): import ctypes import ctypes.wintypes return ctypes def monitor_master_process(fpath): """Watch the given path to detect the master process dying. If the master process dies, the current process is terminated. """ if not threading: return None def monitor(): if wait_for_master(fpath): os._exit(1) t = threading.Thread(target=monitor) t.daemon = True t.start() return t def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" def run_startup_hooks(): if len(sys.argv) > 1 and sys.argv[1] == "--esky-slave-proc": del sys.argv[1] if len(sys.argv) > 1: arg = sys.argv[1] del sys.argv[1] else: arg = None monitor_master_process(arg) if sys.platform == "win32": # On win32, the master process creates a tempfile that will be deleted # when it exits. Use ReadDirectoryChanges to block on this event. def wait_for_master(fpath): """Wait for the master process to die.""" try: RDCW = ctypes.windll.kernel32.ReadDirectoryChangesW except AttributeError: return False INVALID_HANDLE_VALUE = 0xFFFFFFFF FILE_NOTIFY_CHANGE_FILE_NAME = 0x01 FILE_LIST_DIRECTORY = 0x01 FILE_SHARE_READ = 0x01 FILE_SHARE_WRITE = 0x02 OPEN_EXISTING = 3 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 try: ctypes.wintypes.LPVOID except AttributeError: ctypes.wintypes.LPVOID = ctypes.c_void_p def _errcheck_bool(value,func,args): if not value: raise ctypes.WinError() return args def _errcheck_handle(value,func,args): if not value: raise ctypes.WinError() if value == INVALID_HANDLE_VALUE: raise ctypes.WinError() return args RDCW.errcheck = _errcheck_bool RDCW.restype = ctypes.wintypes.BOOL RDCW.argtypes = ( ctypes.wintypes.HANDLE, # hDirectory ctypes.wintypes.LPVOID, # lpBuffer ctypes.wintypes.DWORD, # nBufferLength ctypes.wintypes.BOOL, # bWatchSubtree ctypes.wintypes.DWORD, # dwNotifyFilter ctypes.POINTER(ctypes.wintypes.DWORD), # lpBytesReturned ctypes.wintypes.LPVOID, # lpOverlapped ctypes.wintypes.LPVOID # lpCompletionRoutine ) CreateFileW = ctypes.windll.kernel32.CreateFileW CreateFileW.errcheck = _errcheck_handle CreateFileW.restype = ctypes.wintypes.HANDLE CreateFileW.argtypes = ( ctypes.wintypes.LPCWSTR, # lpFileName ctypes.wintypes.DWORD, # dwDesiredAccess ctypes.wintypes.DWORD, # dwShareMode ctypes.wintypes.LPVOID, # lpSecurityAttributes ctypes.wintypes.DWORD, # dwCreationDisposition ctypes.wintypes.DWORD, # dwFlagsAndAttributes ctypes.wintypes.HANDLE # hTemplateFile ) CloseHandle = ctypes.windll.kernel32.CloseHandle CloseHandle.restype = ctypes.wintypes.BOOL CloseHandle.argtypes = ( ctypes.wintypes.HANDLE, # hObject ) result = ctypes.create_string_buffer(1024) nbytes = ctypes.c_ulong() handle = CreateFileW(os.path.join(os.path.dirname(fpath),u""), FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE, None, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) # Since this loop may still be running at interpreter close, we # take local references to our imported functions to avoid # garbage-collection-related errors at shutdown. byref = ctypes.byref pathexists = os.path.exists try: while pathexists(fpath): RDCW(handle,byref(result),len(result), True,FILE_NOTIFY_CHANGE_FILE_NAME, byref(nbytes),None,None) finally: CloseHandle(handle) return True def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" try: flags = os.O_CREAT|os.O_EXCL|os.O_TEMPORARY|os.O_NOINHERIT tfile = tempfile.mktemp() fd = os.open(tfile,flags) except EnvironmentError: return [] else: return ["--esky-slave-proc",tfile] else: # On unix, the master process takes an exclusive flock on the given file. # We try to take one as well, which will block until the master dies. import fcntl def wait_for_master(fpath): """Wait for the master process to die.""" try: fd = os.open(fpath,os.O_RDWR) fcntl.flock(fd,fcntl.LOCK_EX) return True except EnvironmentError: return False def get_slave_process_args(): """Get the arguments that should be passed to a new slave process.""" try: (fd,tfile) = tempfile.mkstemp() fcntl.flock(fd,fcntl.LOCK_EX) except EnvironmentError: return [] else: return ["--esky-slave-proc",tfile]
0.382949
0.124612
import random from typing import Type, Union, Dict, Any, List, Tuple # 3rd party imports import streamlit as st import numpy as np import pandas as pd import altair as alt import seaborn as sns from wordcloud import WordCloud from yellowbrick.classifier import classification_report from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB def sidebar() -> None: """ Purpose: Shows the side bar Args: N/A Returns: N/A """ st.sidebar.title("Python Web Conf") # Create the Navigation Section st.sidebar.image( "https://2022.pythonwebconf.com/python-web-conference-2022/@@images/logo_image" ) pages = ["Home", "Playground", "Schedule", "Team"] default_page = 0 page = st.sidebar.selectbox("Go To", options=pages, index=default_page) if page == "Home": home_page() elif page == "Playground": playground_page() elif page == "Schedule": schedule_page() elif page == "Team": team_page() else: st.error("Invalid Page") def app() -> None: """ Purpose: Controls the app flow Args: N/A Returns: N/A """ # Spin up the sidebar, will control which page is loaded in the # main app sidebar() def data_prep(df: pd.DataFrame) -> Tuple[List, List, List, List]: """ Purpose: Prep data for modeling Args: df - Pandas dataframe Returns: test_features - test set features train_features - train set feautres test_target - test set target train_target - train set target """ # Specify the target classes target_string = st.selectbox("Select Target Column", df.columns) target = np.array(df[target_string]) # Select Features you want feature_cols = st.multiselect("Select Modeling Features", df.columns) # Get all features features = df[feature_cols] featurestmp = np.array(features) feats = [] # find all bad rows for index, featarr in enumerate(featurestmp): try: featarr = featarr.astype(float) feats.append(featarr) except Exception as error: st.error(error) st.error(featarr) st.stop() featuresarr = np.array(feats) # Split Data randInt = random.randint(1, 200) ( test_features, train_features, test_target, train_target, ) = train_test_split(featuresarr, target, test_size=0.75, random_state=randInt) return ( test_features, train_features, test_target, train_target, ) def show_classification_report( df: pd.DataFrame, ) -> None: """ Purpose: Renders a classification_report Args: df - Pandas dataframe Returns: N/A """ # Prep data for model training ( test_features, train_features, test_target, train_target, ) = data_prep(df) if st.button("Train Model"): st.header("Classification Report") st.markdown( "The classification report visualizer displays the precision, recall, F1, and support scores for the model. In order to support easier interpretation and problem detection, the report integrates numerical scores with a color-coded heatmap. All heatmaps are in the range (0.0, 1.0) to facilitate easy comparison of classification models across different classification reports." ) # Instantiate the visualizer visualizer = classification_report( GaussianNB(), train_features, train_target, test_features, test_target, support=True, ) # Get the viz fig = visualizer.fig ax = visualizer.show() fig.axes.append(ax) # show the viz st.write(fig) def gen_wordcloud(df: pd.DataFrame, repeat: bool) -> None: """ Purpose: Generate Word Cloud from Column Args: df - Pandas dataframe Returns: N/A """ # List of all non-numeric fields of given dataframe non_num_cols = df.select_dtypes(include=object).columns # selected column column = st.selectbox("Column", non_num_cols) column = df[column] # generate word cloud image from unique values of selected non-numeric field wc = WordCloud( max_font_size=25, background_color="white", repeat=repeat, height=500, width=800 ).generate(" ".join(column.unique())) # Display the generated image: st.image(wc.to_image()) def bar_chart( df: pd.DataFrame, ): """ Purpose: Renders bar chart Args: df - Pandas dataframe Returns: N/A """ # Bar Chart Example x_col = st.selectbox("Select x axis for bar chart", df.columns) xcol_string = x_col + ":O" if st.checkbox("Show as continuous?", key="bar_chart_x_is_cont"): xcol_string = x_col + ":Q" y_col = st.selectbox("Select y axis for bar chart", df.columns) z_col = st.selectbox("Select z axis for bar chart", df.columns) chart = ( alt.Chart(df) .mark_bar() .encode(x=xcol_string, y=y_col, color=z_col, tooltip=list(df.columns)) .interactive() .properties(title="Bar Chart for " + x_col + "," + y_col) .configure_title( fontSize=20, ) .configure_axis(labelFontSize=20, titleFontSize=20) .configure_legend(labelFontSize=20, titleFontSize=20) ) st.altair_chart(chart, use_container_width=True) def show_metrics(df: pd.DataFrame) -> None: """ Purpose: Render mean,max,min,std,count metrics of numeric fields Args: df - Pandas dataframe Returns: N/A """ # List of all numeric fields of given dataframe columns = df.select_dtypes(include="number").columns # selected column column = st.selectbox("Column", options=columns) column = df[column] # Rendering metrics col1, col2, col3, col4, col5 = st.columns(5) col1.metric("Mean", round(column.mean(), 2)) col2.metric("Max", column.max()) col3.metric("Min", column.min()) col4.metric("Std", round(column.std(), 2)) col5.metric("Count", int(column.count())) def playground_page(): """ Purpose: Render playground page Args: N/A Returns: N/A """ st.header("Playground") df = pd.read_csv("data/iris.csv") bar_chart(df) st.subheader("Metrics") show_metrics(df) talk_df = pd.read_csv("data/talks.csv") st.subheader("WordCloud") repeat = st.checkbox("Repeat words?") gen_wordcloud(talk_df, repeat) st.subheader("Classification Report") show_classification_report(df) def write_talk_data(datum, col): """ Purpose: Render schedule data Args: datum - data col - column to write Returns: N/A """ col.write(datum["title"]) col.write(datum["speaker"]) def schedule_page(): """ Purpose: Render schedule page Args: N/A Returns: N/A """ st.header("Schedule") talk_data = pd.read_csv("data/talks.csv") with st.expander("Monday,March 21,2022"): datum = talk_data.iloc[0] col1, col2 = st.columns([1, 3]) col1.write(datum["time"]) col2.header("KEYNOTE") col2.subheader(datum["title"]) col2.write(datum["speaker"]) with st.expander("Tuesday,March 22,2022"): datum = talk_data.iloc[2] col1, col2, col3, col4, col5, col6, col7 = st.columns(7) # Header rows col1.write("TIME(US EDT/UTC-4)") col2.write("APP DEV 1") col3.write("APP DEV 2") col4.write("CLOUD") col5.write("CULTURE") col6.write("PYDATA") col7.write("TUTORIALS") # Data Rows col1.write(datum["time"]) write_talk_data(datum, col2) datum = talk_data.iloc[3] write_talk_data(datum, col3) datum = talk_data.iloc[4] write_talk_data(datum, col4) datum = talk_data.iloc[5] write_talk_data(datum, col5) datum = talk_data.iloc[6] write_talk_data(datum, col6) datum = talk_data.iloc[7] write_talk_data(datum, col7) def render_team_member(datum): """ Purpose: Render team members Args: N/A Returns: N/A """ st.image(datum["picture"]) st.write(datum["name"]) st.write(datum["title"]) st.markdown(f"[Linkedin]({datum['linkedin']})") st.markdown(f"[Twitter]({datum['twitter']})") def team_page(): """ Purpose: Show team page Args: N/A Returns: N/A """ st.header("Meet the Team") st.subheader( "Meet the Sixie team behind the 4th annual 2022 Python Web Conference:" ) team_data = pd.read_csv("data/team.csv") # st.write(team_data) col1, col2, col3 = st.columns(3) with col1: datum = team_data.iloc[0] render_team_member(datum) datum = team_data.iloc[3] render_team_member(datum) with col2: datum = team_data.iloc[1] render_team_member(datum) datum = team_data.iloc[4] render_team_member(datum) with col3: datum = team_data.iloc[2] render_team_member(datum) def home_page(): """ Purpose: Show home page Args: N/A Returns: N/A """ with st.echo(code_location="below"): st.title("Python Web Conf") st.subheader("The most in-depth Python conference for web developers") st.image( "https://2022.pythonwebconf.com/python-web-conference-2022/@@images/logo_image" ) st.write("https://2022.pythonwebconf.com/") def main() -> None: """ Purpose: Controls the flow of the streamlit app Args: N/A Returns: N/A """ # Start the streamlit app app() if __name__ == "__main__": main()
pywebconf_st.py
import random from typing import Type, Union, Dict, Any, List, Tuple # 3rd party imports import streamlit as st import numpy as np import pandas as pd import altair as alt import seaborn as sns from wordcloud import WordCloud from yellowbrick.classifier import classification_report from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB def sidebar() -> None: """ Purpose: Shows the side bar Args: N/A Returns: N/A """ st.sidebar.title("Python Web Conf") # Create the Navigation Section st.sidebar.image( "https://2022.pythonwebconf.com/python-web-conference-2022/@@images/logo_image" ) pages = ["Home", "Playground", "Schedule", "Team"] default_page = 0 page = st.sidebar.selectbox("Go To", options=pages, index=default_page) if page == "Home": home_page() elif page == "Playground": playground_page() elif page == "Schedule": schedule_page() elif page == "Team": team_page() else: st.error("Invalid Page") def app() -> None: """ Purpose: Controls the app flow Args: N/A Returns: N/A """ # Spin up the sidebar, will control which page is loaded in the # main app sidebar() def data_prep(df: pd.DataFrame) -> Tuple[List, List, List, List]: """ Purpose: Prep data for modeling Args: df - Pandas dataframe Returns: test_features - test set features train_features - train set feautres test_target - test set target train_target - train set target """ # Specify the target classes target_string = st.selectbox("Select Target Column", df.columns) target = np.array(df[target_string]) # Select Features you want feature_cols = st.multiselect("Select Modeling Features", df.columns) # Get all features features = df[feature_cols] featurestmp = np.array(features) feats = [] # find all bad rows for index, featarr in enumerate(featurestmp): try: featarr = featarr.astype(float) feats.append(featarr) except Exception as error: st.error(error) st.error(featarr) st.stop() featuresarr = np.array(feats) # Split Data randInt = random.randint(1, 200) ( test_features, train_features, test_target, train_target, ) = train_test_split(featuresarr, target, test_size=0.75, random_state=randInt) return ( test_features, train_features, test_target, train_target, ) def show_classification_report( df: pd.DataFrame, ) -> None: """ Purpose: Renders a classification_report Args: df - Pandas dataframe Returns: N/A """ # Prep data for model training ( test_features, train_features, test_target, train_target, ) = data_prep(df) if st.button("Train Model"): st.header("Classification Report") st.markdown( "The classification report visualizer displays the precision, recall, F1, and support scores for the model. In order to support easier interpretation and problem detection, the report integrates numerical scores with a color-coded heatmap. All heatmaps are in the range (0.0, 1.0) to facilitate easy comparison of classification models across different classification reports." ) # Instantiate the visualizer visualizer = classification_report( GaussianNB(), train_features, train_target, test_features, test_target, support=True, ) # Get the viz fig = visualizer.fig ax = visualizer.show() fig.axes.append(ax) # show the viz st.write(fig) def gen_wordcloud(df: pd.DataFrame, repeat: bool) -> None: """ Purpose: Generate Word Cloud from Column Args: df - Pandas dataframe Returns: N/A """ # List of all non-numeric fields of given dataframe non_num_cols = df.select_dtypes(include=object).columns # selected column column = st.selectbox("Column", non_num_cols) column = df[column] # generate word cloud image from unique values of selected non-numeric field wc = WordCloud( max_font_size=25, background_color="white", repeat=repeat, height=500, width=800 ).generate(" ".join(column.unique())) # Display the generated image: st.image(wc.to_image()) def bar_chart( df: pd.DataFrame, ): """ Purpose: Renders bar chart Args: df - Pandas dataframe Returns: N/A """ # Bar Chart Example x_col = st.selectbox("Select x axis for bar chart", df.columns) xcol_string = x_col + ":O" if st.checkbox("Show as continuous?", key="bar_chart_x_is_cont"): xcol_string = x_col + ":Q" y_col = st.selectbox("Select y axis for bar chart", df.columns) z_col = st.selectbox("Select z axis for bar chart", df.columns) chart = ( alt.Chart(df) .mark_bar() .encode(x=xcol_string, y=y_col, color=z_col, tooltip=list(df.columns)) .interactive() .properties(title="Bar Chart for " + x_col + "," + y_col) .configure_title( fontSize=20, ) .configure_axis(labelFontSize=20, titleFontSize=20) .configure_legend(labelFontSize=20, titleFontSize=20) ) st.altair_chart(chart, use_container_width=True) def show_metrics(df: pd.DataFrame) -> None: """ Purpose: Render mean,max,min,std,count metrics of numeric fields Args: df - Pandas dataframe Returns: N/A """ # List of all numeric fields of given dataframe columns = df.select_dtypes(include="number").columns # selected column column = st.selectbox("Column", options=columns) column = df[column] # Rendering metrics col1, col2, col3, col4, col5 = st.columns(5) col1.metric("Mean", round(column.mean(), 2)) col2.metric("Max", column.max()) col3.metric("Min", column.min()) col4.metric("Std", round(column.std(), 2)) col5.metric("Count", int(column.count())) def playground_page(): """ Purpose: Render playground page Args: N/A Returns: N/A """ st.header("Playground") df = pd.read_csv("data/iris.csv") bar_chart(df) st.subheader("Metrics") show_metrics(df) talk_df = pd.read_csv("data/talks.csv") st.subheader("WordCloud") repeat = st.checkbox("Repeat words?") gen_wordcloud(talk_df, repeat) st.subheader("Classification Report") show_classification_report(df) def write_talk_data(datum, col): """ Purpose: Render schedule data Args: datum - data col - column to write Returns: N/A """ col.write(datum["title"]) col.write(datum["speaker"]) def schedule_page(): """ Purpose: Render schedule page Args: N/A Returns: N/A """ st.header("Schedule") talk_data = pd.read_csv("data/talks.csv") with st.expander("Monday,March 21,2022"): datum = talk_data.iloc[0] col1, col2 = st.columns([1, 3]) col1.write(datum["time"]) col2.header("KEYNOTE") col2.subheader(datum["title"]) col2.write(datum["speaker"]) with st.expander("Tuesday,March 22,2022"): datum = talk_data.iloc[2] col1, col2, col3, col4, col5, col6, col7 = st.columns(7) # Header rows col1.write("TIME(US EDT/UTC-4)") col2.write("APP DEV 1") col3.write("APP DEV 2") col4.write("CLOUD") col5.write("CULTURE") col6.write("PYDATA") col7.write("TUTORIALS") # Data Rows col1.write(datum["time"]) write_talk_data(datum, col2) datum = talk_data.iloc[3] write_talk_data(datum, col3) datum = talk_data.iloc[4] write_talk_data(datum, col4) datum = talk_data.iloc[5] write_talk_data(datum, col5) datum = talk_data.iloc[6] write_talk_data(datum, col6) datum = talk_data.iloc[7] write_talk_data(datum, col7) def render_team_member(datum): """ Purpose: Render team members Args: N/A Returns: N/A """ st.image(datum["picture"]) st.write(datum["name"]) st.write(datum["title"]) st.markdown(f"[Linkedin]({datum['linkedin']})") st.markdown(f"[Twitter]({datum['twitter']})") def team_page(): """ Purpose: Show team page Args: N/A Returns: N/A """ st.header("Meet the Team") st.subheader( "Meet the Sixie team behind the 4th annual 2022 Python Web Conference:" ) team_data = pd.read_csv("data/team.csv") # st.write(team_data) col1, col2, col3 = st.columns(3) with col1: datum = team_data.iloc[0] render_team_member(datum) datum = team_data.iloc[3] render_team_member(datum) with col2: datum = team_data.iloc[1] render_team_member(datum) datum = team_data.iloc[4] render_team_member(datum) with col3: datum = team_data.iloc[2] render_team_member(datum) def home_page(): """ Purpose: Show home page Args: N/A Returns: N/A """ with st.echo(code_location="below"): st.title("Python Web Conf") st.subheader("The most in-depth Python conference for web developers") st.image( "https://2022.pythonwebconf.com/python-web-conference-2022/@@images/logo_image" ) st.write("https://2022.pythonwebconf.com/") def main() -> None: """ Purpose: Controls the flow of the streamlit app Args: N/A Returns: N/A """ # Start the streamlit app app() if __name__ == "__main__": main()
0.847211
0.379608
import os import shutil import math import time import menpo.io as mio import menpo3d.io as m3io import numpy as np from pathlib import Path from functools import partial # deepmachine import keras import tensorflow as tf import deepmachine as dm # flag definitions from deepmachine.flags import FLAGS def main(): tf.reset_default_graph() BATCH_SIZE = FLAGS.batch_size INPUT_SHAPE = 256 LR = FLAGS.lr DATA_PATH = FLAGS.dataset_path LOGDIR = "{}/model_{}".format(FLAGS.logdir, time.time() ) if 'model_' not in FLAGS.logdir else FLAGS.logdir # Dataset def build_data(): dataset = dm.data.provider.TFRecordNoFlipProvider( DATA_PATH, dm.data.provider.features.FeatureIUVHM, augmentation=True, resolvers={ 'images': dm.data.provider.resolvers.image_resolver, 'iuvs': partial(dm.data.provider.resolvers.iuv_resolver, n_parts=2, dtype=tf.float32), 'heatmaps': dm.data.provider.resolvers.heatmap_resolver_face, } ) dataset = dm.data.provider.DatasetQueue( dataset, n_proccess=FLAGS.no_thread, batch_size=BATCH_SIZE) tf_data = dataset.get('images', 'iuvs', 'heatmaps') return [tf_data['images']], [tf_data['iuvs'], tf_data['heatmaps']] # Model def build_model(): input_image = dm.layers.Input( shape=[INPUT_SHAPE, INPUT_SHAPE, 3], name='input_image') iuv_prediction = dm.networks.Hourglass( input_image, [INPUT_SHAPE, INPUT_SHAPE, 6], depth=4, batch_norm=True, use_coordconv=False) merged_inputs = dm.layers.Concatenate()([input_image, iuv_prediction]) hm_prediction = dm.networks.Hourglass( merged_inputs, [INPUT_SHAPE, INPUT_SHAPE, 68], depth=4, batch_norm=True, use_coordconv=False) train_model = dm.DeepMachine( inputs=input_image, outputs=[ iuv_prediction, hm_prediction]) train_model.compile( optimizer=dm.optimizers.Adam(lr=LR), loss=[dm.losses.loss_iuv_regression, dm.losses.loss_heatmap_regression], ) return train_model build_model().fit( build_data(), epochs=200, step_per_epoch=40000 // BATCH_SIZE, logdir=LOGDIR, lr_decay=0.99, verbose=2 ) if __name__ == '__main__': main()
deepmachine/contrib/training/DenseRegFace.py
import os import shutil import math import time import menpo.io as mio import menpo3d.io as m3io import numpy as np from pathlib import Path from functools import partial # deepmachine import keras import tensorflow as tf import deepmachine as dm # flag definitions from deepmachine.flags import FLAGS def main(): tf.reset_default_graph() BATCH_SIZE = FLAGS.batch_size INPUT_SHAPE = 256 LR = FLAGS.lr DATA_PATH = FLAGS.dataset_path LOGDIR = "{}/model_{}".format(FLAGS.logdir, time.time() ) if 'model_' not in FLAGS.logdir else FLAGS.logdir # Dataset def build_data(): dataset = dm.data.provider.TFRecordNoFlipProvider( DATA_PATH, dm.data.provider.features.FeatureIUVHM, augmentation=True, resolvers={ 'images': dm.data.provider.resolvers.image_resolver, 'iuvs': partial(dm.data.provider.resolvers.iuv_resolver, n_parts=2, dtype=tf.float32), 'heatmaps': dm.data.provider.resolvers.heatmap_resolver_face, } ) dataset = dm.data.provider.DatasetQueue( dataset, n_proccess=FLAGS.no_thread, batch_size=BATCH_SIZE) tf_data = dataset.get('images', 'iuvs', 'heatmaps') return [tf_data['images']], [tf_data['iuvs'], tf_data['heatmaps']] # Model def build_model(): input_image = dm.layers.Input( shape=[INPUT_SHAPE, INPUT_SHAPE, 3], name='input_image') iuv_prediction = dm.networks.Hourglass( input_image, [INPUT_SHAPE, INPUT_SHAPE, 6], depth=4, batch_norm=True, use_coordconv=False) merged_inputs = dm.layers.Concatenate()([input_image, iuv_prediction]) hm_prediction = dm.networks.Hourglass( merged_inputs, [INPUT_SHAPE, INPUT_SHAPE, 68], depth=4, batch_norm=True, use_coordconv=False) train_model = dm.DeepMachine( inputs=input_image, outputs=[ iuv_prediction, hm_prediction]) train_model.compile( optimizer=dm.optimizers.Adam(lr=LR), loss=[dm.losses.loss_iuv_regression, dm.losses.loss_heatmap_regression], ) return train_model build_model().fit( build_data(), epochs=200, step_per_epoch=40000 // BATCH_SIZE, logdir=LOGDIR, lr_decay=0.99, verbose=2 ) if __name__ == '__main__': main()
0.537284
0.183246
import logging import os.path import subprocess import tarfile import tempfile from dbnd import output, task from dbnd._core.constants import CloudType from dbnd._core.errors import DatabandRuntimeError from dbnd._core.utils.timezone import utcnow from targets.types import Path logger = logging.getLogger(__name__) @task(archive=output(output_ext=".tar.gz")[Path]) def export_db( archive, include_db=True, include_logs=True, task_version=utcnow().strftime("%Y%m%d_%H%M%S"), ): # type: (Path, bool, bool, str)-> None from dbnd._core.current import get_databand_context logger.info("Compressing files to %s..." % archive) with tarfile.open(str(archive), "w:gz") as tar: if include_db: dbnd_context = get_databand_context() conn_string = dbnd_context.settings.web.get_sql_alchemy_conn() if conn_string.startswith("sqlite:"): from dbnd_web.utils.dbnd_db import get_sqlite_db_location db_file = get_sqlite_db_location(conn_string) logger.info("Exporting DB=%s", db_file) tar.add(db_file, arcname="dbnd.db") elif conn_string.startswith("postgresql"): with tempfile.NamedTemporaryFile(prefix="dbdump.", suffix=".sql") as tf: from dbnd_web.utils.dbnd_db import dump_postgres dump_postgres(conn_string, tf.name) tar.add(tf.name, arcname="postgres-dbnd.sql") else: raise DatabandRuntimeError( "Can not export db! " "Currently, we support only sqlite and postgres db in automatic export" ) if include_logs: context = get_databand_context() local_env = context.settings.get_env_config(CloudType.local) logs_folder = local_env.dbnd_local_root.folder("logs").path if os.path.exists(logs_folder): logger.info("Adding run folder from '%s'", logs_folder) tar.add(logs_folder, "run") else: logger.warning("Logs dir '%s' is not found", logs_folder) def dump_postgres(conn_string, dump_file): logger.info( "backing up postgres DB to %s, pg_dump and sqlalchemy are required!", dump_file ) from sqlalchemy.engine.url import make_url url = make_url(conn_string) cmd = [ "pg_dump", "-h", url.host, "-p", str(url.port), "-U", url.username, "-Fc", "-f", dump_file, "-d", url.database, ] logger.info("Running command: %s", subprocess.list2cmdline(cmd)) env = os.environ.copy() env["PGPASSWORD"] = <PASSWORD> subprocess.check_call(args=cmd, env=env)
modules/dbnd/src/dbnd/tasks/basics/export.py
import logging import os.path import subprocess import tarfile import tempfile from dbnd import output, task from dbnd._core.constants import CloudType from dbnd._core.errors import DatabandRuntimeError from dbnd._core.utils.timezone import utcnow from targets.types import Path logger = logging.getLogger(__name__) @task(archive=output(output_ext=".tar.gz")[Path]) def export_db( archive, include_db=True, include_logs=True, task_version=utcnow().strftime("%Y%m%d_%H%M%S"), ): # type: (Path, bool, bool, str)-> None from dbnd._core.current import get_databand_context logger.info("Compressing files to %s..." % archive) with tarfile.open(str(archive), "w:gz") as tar: if include_db: dbnd_context = get_databand_context() conn_string = dbnd_context.settings.web.get_sql_alchemy_conn() if conn_string.startswith("sqlite:"): from dbnd_web.utils.dbnd_db import get_sqlite_db_location db_file = get_sqlite_db_location(conn_string) logger.info("Exporting DB=%s", db_file) tar.add(db_file, arcname="dbnd.db") elif conn_string.startswith("postgresql"): with tempfile.NamedTemporaryFile(prefix="dbdump.", suffix=".sql") as tf: from dbnd_web.utils.dbnd_db import dump_postgres dump_postgres(conn_string, tf.name) tar.add(tf.name, arcname="postgres-dbnd.sql") else: raise DatabandRuntimeError( "Can not export db! " "Currently, we support only sqlite and postgres db in automatic export" ) if include_logs: context = get_databand_context() local_env = context.settings.get_env_config(CloudType.local) logs_folder = local_env.dbnd_local_root.folder("logs").path if os.path.exists(logs_folder): logger.info("Adding run folder from '%s'", logs_folder) tar.add(logs_folder, "run") else: logger.warning("Logs dir '%s' is not found", logs_folder) def dump_postgres(conn_string, dump_file): logger.info( "backing up postgres DB to %s, pg_dump and sqlalchemy are required!", dump_file ) from sqlalchemy.engine.url import make_url url = make_url(conn_string) cmd = [ "pg_dump", "-h", url.host, "-p", str(url.port), "-U", url.username, "-Fc", "-f", dump_file, "-d", url.database, ] logger.info("Running command: %s", subprocess.list2cmdline(cmd)) env = os.environ.copy() env["PGPASSWORD"] = <PASSWORD> subprocess.check_call(args=cmd, env=env)
0.26218
0.069668
import cv2 from image_morphing.np import np, GPU from image_morphing.utils import load_points, resize_v from image_morphing.render import render_animation from image_morphing.optimize_v import adam from image_morphing.quadratic_motion_path import adam_w import os def image_morphing(img0_path, img1_path, p0_path, p1_path, vmax_size=32, render_name='animation.mov', lr_v=7e-2, tol_v=1e-1, lr_w=7e-2, tol_w=1e-3, lambda_tps=1e-3, gamma_ui=1e2, tol_count_v=20, tol_count_w=3, render=False, render_steps=60, render_time=1, save_dir='.cache'): img0_src = cv2.imread(img0_path) img1_src = cv2.imread(img1_path) p0_src = load_points(p0_path) p1_src = load_points(p1_path) size = 8 v = np.random.randn(size, size, 2) w = np.random.randn(size, size, 2) # sizes = np.arange(8, vmax_size + 1, 8) sizes = 2 ** np.arange(3, 10) sizes = sizes[sizes <= vmax_size] if GPU: sizes = np.asnumpy(sizes) for size in sizes: print('\nOptimization size {:3d} start.'.format(size)) name = os.path.join(save_dir, 'v{:03d}'.format(size)) if os.path.exists(name): v = np.load(name) else: print('Optimization of v start.') v = adam(size, img0_src, img1_src, v, p0_src, p1_src, lr=lr_v, tol=tol_v, render=render, tol_count=tol_count_v, lambda_tps=lambda_tps, gamma_ui=gamma_ui, save_dir=save_dir) name = os.path.join(save_dir, 'w{:03d}'.format(size)) if os.path.exists(name): w = np.load(w) else: print('Optimization of w start.') w = adam_w(size, w, v, lr=lr_w, tol=tol_w, tol_count=tol_count_w, save_dir=save_dir) v_final = resize_v(v=v, size=img0_src.shape[0], size_x=img0_src.shape[1]) w_final = resize_v(v=w, size=img0_src.shape[0], size_x=img0_src.shape[1]) img1 = cv2.resize(img1_src, (img0_src.shape[0], img0_src.shape[1])) render_path = os.path.join(save_dir, render_name) render_animation(img0_src, img1, v_final, w=w_final, steps=render_steps, time=render_time, file_name=render_path)
image_morphing/morpher.py
import cv2 from image_morphing.np import np, GPU from image_morphing.utils import load_points, resize_v from image_morphing.render import render_animation from image_morphing.optimize_v import adam from image_morphing.quadratic_motion_path import adam_w import os def image_morphing(img0_path, img1_path, p0_path, p1_path, vmax_size=32, render_name='animation.mov', lr_v=7e-2, tol_v=1e-1, lr_w=7e-2, tol_w=1e-3, lambda_tps=1e-3, gamma_ui=1e2, tol_count_v=20, tol_count_w=3, render=False, render_steps=60, render_time=1, save_dir='.cache'): img0_src = cv2.imread(img0_path) img1_src = cv2.imread(img1_path) p0_src = load_points(p0_path) p1_src = load_points(p1_path) size = 8 v = np.random.randn(size, size, 2) w = np.random.randn(size, size, 2) # sizes = np.arange(8, vmax_size + 1, 8) sizes = 2 ** np.arange(3, 10) sizes = sizes[sizes <= vmax_size] if GPU: sizes = np.asnumpy(sizes) for size in sizes: print('\nOptimization size {:3d} start.'.format(size)) name = os.path.join(save_dir, 'v{:03d}'.format(size)) if os.path.exists(name): v = np.load(name) else: print('Optimization of v start.') v = adam(size, img0_src, img1_src, v, p0_src, p1_src, lr=lr_v, tol=tol_v, render=render, tol_count=tol_count_v, lambda_tps=lambda_tps, gamma_ui=gamma_ui, save_dir=save_dir) name = os.path.join(save_dir, 'w{:03d}'.format(size)) if os.path.exists(name): w = np.load(w) else: print('Optimization of w start.') w = adam_w(size, w, v, lr=lr_w, tol=tol_w, tol_count=tol_count_w, save_dir=save_dir) v_final = resize_v(v=v, size=img0_src.shape[0], size_x=img0_src.shape[1]) w_final = resize_v(v=w, size=img0_src.shape[0], size_x=img0_src.shape[1]) img1 = cv2.resize(img1_src, (img0_src.shape[0], img0_src.shape[1])) render_path = os.path.join(save_dir, render_name) render_animation(img0_src, img1, v_final, w=w_final, steps=render_steps, time=render_time, file_name=render_path)
0.386532
0.24271
import os from pathlib import Path import albumentations as A import cv2 import matplotlib.pyplot as plt import torch from albumentations.pytorch import ToTensorV2 from ignite.contrib.handlers import ProgressBar from ignite.contrib.metrics import GpuInfo from ignite.engine import Events, create_supervised_evaluator, create_supervised_trainer from ignite.metrics import Accuracy, Loss from segmentation_models_pytorch.losses import DiceLoss from torch.optim import SGD from torch.utils.data import DataLoader, Dataset from unet.model import Unet dataset = Path("/home/dylan/Dropbox/Projects/datasets/aerial_segmentation/dataset/semantic_drone_dataset") imgs = dataset / "original_images" masks = dataset / "label_images_semantic" class SemanticDroneDataset(Dataset): def __init__(self, images_path, masks_path): super().__init__() self.images_path, self.masks_path = images_path, masks_path self.image_names = self._get_matched_images() self.output_transform = A.Compose( [ A.RandomCrop(height=256, width=256, always_apply=True), # A.Resize(height=256, width=256, always_apply=True), A.ToFloat(always_apply=True), ToTensorV2(always_apply=True), ], ) def _get_matched_images(self): matched_image_names = [] for img_name in self.images_path.glob(f"*.jpg"): label_name = img_name.with_suffix(".png").name labels = list(self.masks_path.glob(label_name)) if len(labels) == 1: matched_image_names.append(img_name.stem) return matched_image_names def __len__(self): return len(self.image_names) def __getitem__(self, item): filename = self.image_names[item] img_path, mask_path = self.images_path / filename, self.masks_path / filename img = cv2.imread(str(img_path.with_suffix(".jpg")), cv2.IMREAD_COLOR) mask = cv2.imread(str(mask_path.with_suffix(".png")), cv2.IMREAD_GRAYSCALE) aug = self.output_transform(image=img, mask=mask) return aug["image"], aug["mask"].to(torch.int64) def show_plot(self, item): img, mask = self[0] img, mask = img.numpy(), mask.numpy() fig, (ax1, ax2) = plt.subplots(2, 1) ax1.imshow(img) ax2.imshow(mask) plt.tight_layout() plt.show() train_dataset = SemanticDroneDataset(imgs, masks) img, mask = train_dataset[0] train_loader = DataLoader(train_dataset, batch_size=8, shuffle=True, num_workers=os.cpu_count()) model = Unet(3, 24, attention=True) criterion = DiceLoss("multiclass") device = "cuda" model.to(device) # Move model before creating optimizer optimizer = SGD(model.parameters(), lr=0.001, momentum=0.1) trainer = create_supervised_trainer(model, optimizer, criterion, device=device) evaluator = create_supervised_evaluator(model, metrics={"accuracy": Accuracy(), "loss": Loss(criterion)}, device=device) GpuInfo().attach(trainer, name="gpu") pbar = ProgressBar(persist=True) pbar.attach(trainer, metric_names="all") @trainer.on(Events.EPOCH_COMPLETED) def log_training_results(engine): evaluator.run(train_loader) metrics = evaluator.state.metrics avg_accuracy = metrics["accuracy"] avg_loss = metrics["loss"] pbar.log_message( f"Training Results - Epoch: {engine.state.epoch} Avg accuracy: {avg_accuracy:.2f} Avg loss: {avg_loss:.2f}" ) trainer.run(train_loader, max_epochs=3)
unet/train.py
import os from pathlib import Path import albumentations as A import cv2 import matplotlib.pyplot as plt import torch from albumentations.pytorch import ToTensorV2 from ignite.contrib.handlers import ProgressBar from ignite.contrib.metrics import GpuInfo from ignite.engine import Events, create_supervised_evaluator, create_supervised_trainer from ignite.metrics import Accuracy, Loss from segmentation_models_pytorch.losses import DiceLoss from torch.optim import SGD from torch.utils.data import DataLoader, Dataset from unet.model import Unet dataset = Path("/home/dylan/Dropbox/Projects/datasets/aerial_segmentation/dataset/semantic_drone_dataset") imgs = dataset / "original_images" masks = dataset / "label_images_semantic" class SemanticDroneDataset(Dataset): def __init__(self, images_path, masks_path): super().__init__() self.images_path, self.masks_path = images_path, masks_path self.image_names = self._get_matched_images() self.output_transform = A.Compose( [ A.RandomCrop(height=256, width=256, always_apply=True), # A.Resize(height=256, width=256, always_apply=True), A.ToFloat(always_apply=True), ToTensorV2(always_apply=True), ], ) def _get_matched_images(self): matched_image_names = [] for img_name in self.images_path.glob(f"*.jpg"): label_name = img_name.with_suffix(".png").name labels = list(self.masks_path.glob(label_name)) if len(labels) == 1: matched_image_names.append(img_name.stem) return matched_image_names def __len__(self): return len(self.image_names) def __getitem__(self, item): filename = self.image_names[item] img_path, mask_path = self.images_path / filename, self.masks_path / filename img = cv2.imread(str(img_path.with_suffix(".jpg")), cv2.IMREAD_COLOR) mask = cv2.imread(str(mask_path.with_suffix(".png")), cv2.IMREAD_GRAYSCALE) aug = self.output_transform(image=img, mask=mask) return aug["image"], aug["mask"].to(torch.int64) def show_plot(self, item): img, mask = self[0] img, mask = img.numpy(), mask.numpy() fig, (ax1, ax2) = plt.subplots(2, 1) ax1.imshow(img) ax2.imshow(mask) plt.tight_layout() plt.show() train_dataset = SemanticDroneDataset(imgs, masks) img, mask = train_dataset[0] train_loader = DataLoader(train_dataset, batch_size=8, shuffle=True, num_workers=os.cpu_count()) model = Unet(3, 24, attention=True) criterion = DiceLoss("multiclass") device = "cuda" model.to(device) # Move model before creating optimizer optimizer = SGD(model.parameters(), lr=0.001, momentum=0.1) trainer = create_supervised_trainer(model, optimizer, criterion, device=device) evaluator = create_supervised_evaluator(model, metrics={"accuracy": Accuracy(), "loss": Loss(criterion)}, device=device) GpuInfo().attach(trainer, name="gpu") pbar = ProgressBar(persist=True) pbar.attach(trainer, metric_names="all") @trainer.on(Events.EPOCH_COMPLETED) def log_training_results(engine): evaluator.run(train_loader) metrics = evaluator.state.metrics avg_accuracy = metrics["accuracy"] avg_loss = metrics["loss"] pbar.log_message( f"Training Results - Epoch: {engine.state.epoch} Avg accuracy: {avg_accuracy:.2f} Avg loss: {avg_loss:.2f}" ) trainer.run(train_loader, max_epochs=3)
0.782164
0.356587
import builtins import keyword import sys import textwrap from typing import Any, List, Optional, TextIO, Tuple import pydantic from . import utils def build_from_document(doc: dict) -> dict: return build_models(doc["schemas"]) def build_models(schemas: dict) -> dict: """Create schema models from an API service discovery document.""" parser = SchemaParser(schemas) global_context = dict(globals()) local_context = {} for name, model_string in parser.model_defs.items(): code_obj = compile(model_string, "<string>", "exec") exec(code_obj, global_context, local_context) for name in local_context: # Resolve ForwardRef types to actual models. local_context[name].update_forward_refs(**local_context) return local_context def write_models(schemas: dict, fh: TextIO): """Create data models for schemas and write them to a file.""" parser = SchemaParser(schemas) value = "\n\n".join(parser.model_defs.values()) fh.write(value) class SchemaParser: simple_types = { # There's also "object" and "array" which are special-cased. # https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 "any": "Any", "boolean": "bool", "integer": "int", "null": "None", "number": "float", "string": "str", } python_keywords = set(keyword.kwlist) | set(dir(builtins)) def __init__(self, schemas: dict): # Parsing a schema may result in several data models for the nested # objects, so we use the model_defs dict to collect the results. self.model_defs = {} for name, schema in schemas.items(): self.schema_as_string(schema, class_name=name) def schema_as_string(self, schema: dict, class_name: Optional[str] = None): """Make a string for a data class from a schema, that can be exec'd.""" indent = " " * 4 description = schema.get("description", "") docstring = self.format_docstring(description, indent=indent) type_ = schema.get("type") id_ = schema.get("id") # Items are (name, type_, default). properties = [] if "properties" in schema: for pname, pschema in schema["properties"].items(): pname = self.valid_property_name(pname) prop_type, pdefault = self.parse_property(pschema, pname) properties.append((pname, prop_type, pdefault)) # Some objects have no structure, e.g. storage#bucket which has "labels" # which are arbitrary key/value pairs. Ignoring them for now. if "additionalProperties" in schema: pass if not id_: if class_name: id_ = class_name else: # Make up a name for the model. names = "".join(name.capitalize() for name, _, _ in properties) id_ = "_" + names result = f'''class {id_}(pydantic.BaseModel):\n{docstring}''' for name, type_, default in properties: if default: line = f"{name}: {type_} = {default}" else: line = f"{name}: {type_}" result += f"{indent}{line}\n" # No class body, make it valid Python. if not properties and not docstring: result += f"{indent}pass\n" self.model_defs[id_] = result @classmethod def valid_property_name(cls, name: str) -> str: """Make valid Python identifiers for a property name. A name like "class" is a Python keyword so has to be converted. A name like "next" is a built-in, so it can be confusing to have it re-defined by a model. """ if name in cls.python_keywords: name += "_" return name def parse_property(self, schema: dict, name: str) -> Tuple[str, Optional[str]]: """Return the type (as a string) and default value (as string or None).""" # Easy case. try: type_ = schema["type"] except KeyError: type_ = schema["$ref"] if type_ in self.simple_types: default = schema.get("default") if default is not None: default = repr(default) py_type = self.simple_types[type_] return py_type, default elif type_ == "object": class_name = f"_{name}" self.schema_as_string(schema, class_name=class_name) return f'"{class_name}"', None elif type_ == "array": items = schema["items"] py_type, default = self.parse_property(items, name) return f"List[{py_type}]", default else: # Must be a $ref. return f'"{type_}"', None @classmethod def format_docstring(cls, text: str, indent: str = "") -> str: if text: wrapper = textwrap.TextWrapper(subsequent_indent=indent) result = wrapper.fill(text) result = f'{indent}"""{result}' max_line_length = 80 if len(result) > (max_line_length - len('"""')): result += f'\n{indent}"""\n' else: result += '"""\n' else: result = "" return result def main(argv: list): """Write API schema classes for a service discovery document to STDOUT.""" location = argv[1] doc = utils.load_location(location) write_models(doc["schemas"], sys.stdout)
src/verydisco/schemas.py
import builtins import keyword import sys import textwrap from typing import Any, List, Optional, TextIO, Tuple import pydantic from . import utils def build_from_document(doc: dict) -> dict: return build_models(doc["schemas"]) def build_models(schemas: dict) -> dict: """Create schema models from an API service discovery document.""" parser = SchemaParser(schemas) global_context = dict(globals()) local_context = {} for name, model_string in parser.model_defs.items(): code_obj = compile(model_string, "<string>", "exec") exec(code_obj, global_context, local_context) for name in local_context: # Resolve ForwardRef types to actual models. local_context[name].update_forward_refs(**local_context) return local_context def write_models(schemas: dict, fh: TextIO): """Create data models for schemas and write them to a file.""" parser = SchemaParser(schemas) value = "\n\n".join(parser.model_defs.values()) fh.write(value) class SchemaParser: simple_types = { # There's also "object" and "array" which are special-cased. # https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 "any": "Any", "boolean": "bool", "integer": "int", "null": "None", "number": "float", "string": "str", } python_keywords = set(keyword.kwlist) | set(dir(builtins)) def __init__(self, schemas: dict): # Parsing a schema may result in several data models for the nested # objects, so we use the model_defs dict to collect the results. self.model_defs = {} for name, schema in schemas.items(): self.schema_as_string(schema, class_name=name) def schema_as_string(self, schema: dict, class_name: Optional[str] = None): """Make a string for a data class from a schema, that can be exec'd.""" indent = " " * 4 description = schema.get("description", "") docstring = self.format_docstring(description, indent=indent) type_ = schema.get("type") id_ = schema.get("id") # Items are (name, type_, default). properties = [] if "properties" in schema: for pname, pschema in schema["properties"].items(): pname = self.valid_property_name(pname) prop_type, pdefault = self.parse_property(pschema, pname) properties.append((pname, prop_type, pdefault)) # Some objects have no structure, e.g. storage#bucket which has "labels" # which are arbitrary key/value pairs. Ignoring them for now. if "additionalProperties" in schema: pass if not id_: if class_name: id_ = class_name else: # Make up a name for the model. names = "".join(name.capitalize() for name, _, _ in properties) id_ = "_" + names result = f'''class {id_}(pydantic.BaseModel):\n{docstring}''' for name, type_, default in properties: if default: line = f"{name}: {type_} = {default}" else: line = f"{name}: {type_}" result += f"{indent}{line}\n" # No class body, make it valid Python. if not properties and not docstring: result += f"{indent}pass\n" self.model_defs[id_] = result @classmethod def valid_property_name(cls, name: str) -> str: """Make valid Python identifiers for a property name. A name like "class" is a Python keyword so has to be converted. A name like "next" is a built-in, so it can be confusing to have it re-defined by a model. """ if name in cls.python_keywords: name += "_" return name def parse_property(self, schema: dict, name: str) -> Tuple[str, Optional[str]]: """Return the type (as a string) and default value (as string or None).""" # Easy case. try: type_ = schema["type"] except KeyError: type_ = schema["$ref"] if type_ in self.simple_types: default = schema.get("default") if default is not None: default = repr(default) py_type = self.simple_types[type_] return py_type, default elif type_ == "object": class_name = f"_{name}" self.schema_as_string(schema, class_name=class_name) return f'"{class_name}"', None elif type_ == "array": items = schema["items"] py_type, default = self.parse_property(items, name) return f"List[{py_type}]", default else: # Must be a $ref. return f'"{type_}"', None @classmethod def format_docstring(cls, text: str, indent: str = "") -> str: if text: wrapper = textwrap.TextWrapper(subsequent_indent=indent) result = wrapper.fill(text) result = f'{indent}"""{result}' max_line_length = 80 if len(result) > (max_line_length - len('"""')): result += f'\n{indent}"""\n' else: result += '"""\n' else: result = "" return result def main(argv: list): """Write API schema classes for a service discovery document to STDOUT.""" location = argv[1] doc = utils.load_location(location) write_models(doc["schemas"], sys.stdout)
0.656328
0.241959
from __future__ import annotations from typing import Tuple, Union, Any, Optional from engine.threed.base.plane import AbstractPlane from engine.threed.base.vector import AbstractVector from engine.threed.base.point import AbstractPoint from engine.threed.base.line import AbstractLine from engine.threed.point import Point from engine.tools.options import Options class Plane(AbstractPlane): """Mathmatical 3d plane.""" def __repr__(self) -> str: """ Returns: str: readable representation of the values of this class. """ text = "Plane(position=%(position)s, " % self.__dict__ text += "direction_a=%(direction_a)s, direction_b=%(direction_b)s)" % self.__dict__ return text def __eq__(self, other: object) -> bool: """ Args: other(Plane): another plane to use for comparison. Returns: bool: True when both planes are equal otherwise false """ if isinstance(other, Plane): return self.position == other.position and \ self.direction_a == other.direction_a and \ self.direction_b == other.direction_b return False def point(self, factor_a: Union[int, float], factor_b: Union[int, float]) -> AbstractPoint: """ Provide point on plane by two factors (0=start point, 1=end point). Args: factor_a(float or int): the factor to control which point (0=start point, 1=end point). factor_b(float or int): the factor to control which point (0=start point, 1=end point). Raises: TypeError: when given parameter is not an int or a float """ if isinstance(factor_a, (int, float)) and isinstance(factor_b, (int, float)): return self.position \ + self.direction_a.scaled(factor_a) \ + self.direction_b.scaled(factor_b) raise TypeError("Not all parameter are either an int or a float") def intersection(self, other: Any) -> Optional[AbstractPoint]: """ Calculate intersection between given plane and a line. Args: other(AbstractLine): line to find intersection point. Returns: Point: found intersection point or None if not found. Raises: TypeError: when given parameter is not a line. Note: The method does not check whether a found point lies inbetween the start point and end point of the line or inside the limits defined for the plane. """ if isinstance(other, AbstractLine): line = other # p1 + a * v1 = p2 + b * v2 + c * v3 | - p1 # a * v1 = (p2 - p1) + b * v2 + c * v3 | x v3 # a * (v1 x v3) = (p2 - p1) x v3 + b * (v2 x v3) | x (v2 x v3) # a * (v1 x v3) x (v2 x v3) = ((p2 - p1) x v3)) x (v2 x v3) vector_a = line.direction.cross_product(self.direction_b) \ .cross_product(self.direction_a.cross_product(self.direction_b)) vector_b = (self.position - line.position).cross_product(self.direction_b) \ .cross_product(self.direction_a.cross_product(self.direction_b)) if abs(vector_a.x) > Options.PRECISION: return line.point(vector_b.x / vector_a.x) if abs(vector_a.y) > Options.PRECISION: return line.point(vector_b.y / vector_a.y) if abs(vector_a.z) > Options.PRECISION: return line.point(vector_b.z / vector_a.z) # no intersection return None raise TypeError("Given parameter is not a line") def has_point(self, point: AbstractPoint, exact_match: bool = True) -> bool: """ Args: point(AbstractPoint): point to check to be on the plane. exact_match(bool): when true (default) both factors have to be in range(0.0..1.0) Returns: bool: True when point is on the plane. Raises: TypeError: if given Parameter is not a point """ factor_a, factor_b = self.calculate_point_factors(point) if factor_a is not None and factor_b is not None: return not exact_match or (0.0 <= factor_a <= 1.0 and 0.0 <= factor_b <= 1.0) return False def normal(self) -> AbstractVector: """ Returns: AbstractVector: plane normal. """ return self.direction_a.cross_product(self.direction_b).normalized() def calculate_point_factors( self, point: AbstractPoint) -> Tuple[Optional[float], Optional[float]]: """ Args: point(Point): point to check to be on the plane. exact_match(bool): when true (default) both factors have to be in range(0.0..1.0) Returns: Tuple[float, float]: tuple of two float factors or None's if no intersection is possible. Raises: TypeError: if given Parameter is not a point """ if isinstance(point, AbstractPoint): # p1 = p2 + a * v1 + b * v2 | -p2 # p1 - p2 = a * v1 + b * v2 # 1) -b * v2 # (p1 - p2) - b * v2 = a * v1 | x v2 # (p1 - p2) x v2 = a * v1 x v2 # 2) -a * v1 # (p1 - p2) - a * v1 = b * v2 | x v1 # (p1 - p2) x v1 = b * v2 x v1 vector_a = (point - self.position).cross_product(self.direction_b) vector_b = self.direction_a.cross_product(self.direction_b) factor_a = Plane.factor_check(vector_a, vector_b) factor_b = None if factor_a is not None: vector_c = (point - self.position).cross_product(self.direction_a) vector_d = self.direction_b.cross_product(self.direction_a) factor_b = Plane.factor_check(vector_c, vector_d) return factor_a, factor_b raise TypeError("Given parameter is not a point") @staticmethod def factor_check(vector_a: AbstractVector, vector_b: AbstractVector) -> Optional[float]: """ Args: vector_a(AbstractVector): first vector vector_b(AbstractVector): second vector to use for division Returns: float: factor if found otherwise None """ factor = None if abs(vector_b.x) > Options.PRECISION: factor = vector_a.x / vector_b.x elif not vector_a.x == vector_b.x: return None if abs(vector_b.y) > Options.PRECISION: factor = vector_a.y / vector_b.y elif not vector_a.y == vector_b.y: return None if abs(vector_b.z) > Options.PRECISION: factor = vector_a.z / vector_b.z elif not vector_b.z == vector_a.z: return None return factor def projection_point(self, point: AbstractPoint) -> AbstractPoint: """ Projection of point on given plane. Args: plane(AbstractPlane): plane to use for point -> plane projection. Returns: AbstractPoint: projection point onto given plane. """ if isinstance(point, AbstractPoint): vector_1 = point - self.position vector_2 = self.normal() return Point.from_vector(vector_1 - vector_2.scaled(vector_1.dot_product(vector_2))) raise TypeError("Given parameter is not a point")
engine/threed/plane.py
from __future__ import annotations from typing import Tuple, Union, Any, Optional from engine.threed.base.plane import AbstractPlane from engine.threed.base.vector import AbstractVector from engine.threed.base.point import AbstractPoint from engine.threed.base.line import AbstractLine from engine.threed.point import Point from engine.tools.options import Options class Plane(AbstractPlane): """Mathmatical 3d plane.""" def __repr__(self) -> str: """ Returns: str: readable representation of the values of this class. """ text = "Plane(position=%(position)s, " % self.__dict__ text += "direction_a=%(direction_a)s, direction_b=%(direction_b)s)" % self.__dict__ return text def __eq__(self, other: object) -> bool: """ Args: other(Plane): another plane to use for comparison. Returns: bool: True when both planes are equal otherwise false """ if isinstance(other, Plane): return self.position == other.position and \ self.direction_a == other.direction_a and \ self.direction_b == other.direction_b return False def point(self, factor_a: Union[int, float], factor_b: Union[int, float]) -> AbstractPoint: """ Provide point on plane by two factors (0=start point, 1=end point). Args: factor_a(float or int): the factor to control which point (0=start point, 1=end point). factor_b(float or int): the factor to control which point (0=start point, 1=end point). Raises: TypeError: when given parameter is not an int or a float """ if isinstance(factor_a, (int, float)) and isinstance(factor_b, (int, float)): return self.position \ + self.direction_a.scaled(factor_a) \ + self.direction_b.scaled(factor_b) raise TypeError("Not all parameter are either an int or a float") def intersection(self, other: Any) -> Optional[AbstractPoint]: """ Calculate intersection between given plane and a line. Args: other(AbstractLine): line to find intersection point. Returns: Point: found intersection point or None if not found. Raises: TypeError: when given parameter is not a line. Note: The method does not check whether a found point lies inbetween the start point and end point of the line or inside the limits defined for the plane. """ if isinstance(other, AbstractLine): line = other # p1 + a * v1 = p2 + b * v2 + c * v3 | - p1 # a * v1 = (p2 - p1) + b * v2 + c * v3 | x v3 # a * (v1 x v3) = (p2 - p1) x v3 + b * (v2 x v3) | x (v2 x v3) # a * (v1 x v3) x (v2 x v3) = ((p2 - p1) x v3)) x (v2 x v3) vector_a = line.direction.cross_product(self.direction_b) \ .cross_product(self.direction_a.cross_product(self.direction_b)) vector_b = (self.position - line.position).cross_product(self.direction_b) \ .cross_product(self.direction_a.cross_product(self.direction_b)) if abs(vector_a.x) > Options.PRECISION: return line.point(vector_b.x / vector_a.x) if abs(vector_a.y) > Options.PRECISION: return line.point(vector_b.y / vector_a.y) if abs(vector_a.z) > Options.PRECISION: return line.point(vector_b.z / vector_a.z) # no intersection return None raise TypeError("Given parameter is not a line") def has_point(self, point: AbstractPoint, exact_match: bool = True) -> bool: """ Args: point(AbstractPoint): point to check to be on the plane. exact_match(bool): when true (default) both factors have to be in range(0.0..1.0) Returns: bool: True when point is on the plane. Raises: TypeError: if given Parameter is not a point """ factor_a, factor_b = self.calculate_point_factors(point) if factor_a is not None and factor_b is not None: return not exact_match or (0.0 <= factor_a <= 1.0 and 0.0 <= factor_b <= 1.0) return False def normal(self) -> AbstractVector: """ Returns: AbstractVector: plane normal. """ return self.direction_a.cross_product(self.direction_b).normalized() def calculate_point_factors( self, point: AbstractPoint) -> Tuple[Optional[float], Optional[float]]: """ Args: point(Point): point to check to be on the plane. exact_match(bool): when true (default) both factors have to be in range(0.0..1.0) Returns: Tuple[float, float]: tuple of two float factors or None's if no intersection is possible. Raises: TypeError: if given Parameter is not a point """ if isinstance(point, AbstractPoint): # p1 = p2 + a * v1 + b * v2 | -p2 # p1 - p2 = a * v1 + b * v2 # 1) -b * v2 # (p1 - p2) - b * v2 = a * v1 | x v2 # (p1 - p2) x v2 = a * v1 x v2 # 2) -a * v1 # (p1 - p2) - a * v1 = b * v2 | x v1 # (p1 - p2) x v1 = b * v2 x v1 vector_a = (point - self.position).cross_product(self.direction_b) vector_b = self.direction_a.cross_product(self.direction_b) factor_a = Plane.factor_check(vector_a, vector_b) factor_b = None if factor_a is not None: vector_c = (point - self.position).cross_product(self.direction_a) vector_d = self.direction_b.cross_product(self.direction_a) factor_b = Plane.factor_check(vector_c, vector_d) return factor_a, factor_b raise TypeError("Given parameter is not a point") @staticmethod def factor_check(vector_a: AbstractVector, vector_b: AbstractVector) -> Optional[float]: """ Args: vector_a(AbstractVector): first vector vector_b(AbstractVector): second vector to use for division Returns: float: factor if found otherwise None """ factor = None if abs(vector_b.x) > Options.PRECISION: factor = vector_a.x / vector_b.x elif not vector_a.x == vector_b.x: return None if abs(vector_b.y) > Options.PRECISION: factor = vector_a.y / vector_b.y elif not vector_a.y == vector_b.y: return None if abs(vector_b.z) > Options.PRECISION: factor = vector_a.z / vector_b.z elif not vector_b.z == vector_a.z: return None return factor def projection_point(self, point: AbstractPoint) -> AbstractPoint: """ Projection of point on given plane. Args: plane(AbstractPlane): plane to use for point -> plane projection. Returns: AbstractPoint: projection point onto given plane. """ if isinstance(point, AbstractPoint): vector_1 = point - self.position vector_2 = self.normal() return Point.from_vector(vector_1 - vector_2.scaled(vector_1.dot_product(vector_2))) raise TypeError("Given parameter is not a point")
0.968306
0.568655
import logging import pyarrow as pa import pyarrow.csv as pv import pyarrow.parquet as pq from dataset_builder.exceptions.exceptions import BuilderStepError logger = logging.getLogger() def _get_read_options(): return pv.ReadOptions( skip_rows=0, encoding="utf8", column_names=[ "unit_id", "value", "start", "stop", "start_year", "start_epoch_days", "stop_epoch_days" ] ) def _create_table(csv_convert_options: str, csv_parse_options: str, data_path: str) -> pa.Table: table = pv.read_csv( input_file=data_path, read_options=_get_read_options(), parse_options=csv_parse_options, convert_options=csv_convert_options ) return table def _create_list_of_fields(data_type: str, partitioned: bool = False) -> list: types = dict( STRING=pa.string(), LONG=pa.int64(), DOUBLE=pa.float64(), INSTANT=pa.int64(), DATE=pa.int64() ) if data_type.upper() not in types: raise ValueError(f'Unknown datatype {data_type}') fields = [ pa.field(name='unit_id', type=pa.uint64(), nullable=False), pa.field(name='value', type=types[data_type.upper()], nullable=False), pa.field(name='start_epoch_days', type=pa.int16(), nullable=False), pa.field(name='stop_epoch_days', type=pa.int16(), nullable=False) ] if partitioned: start_year_field = [ pa.field(name='start_year', type=pa.string(), nullable=True) ] fields = start_year_field + fields return fields def _create_table_for_simple_parquet(data_path: str, data_type: str) -> pa.Table: data_schema = pa.schema(_create_list_of_fields(data_type)) csv_convert_options = pv.ConvertOptions( column_types=data_schema, include_columns=[ "unit_id", "value", "start_epoch_days", "stop_epoch_days" ] ) return _create_table( csv_convert_options, pv.ParseOptions(delimiter=';'), data_path ) def _create_table_for_partitioned_parquet(data_path: str, data_type: str) -> pa.Table: data_schema = pa.schema(_create_list_of_fields(data_type, True)) csv_convert_options = pv.ConvertOptions( column_types=data_schema, include_columns=[ "unit_id", "value", "start_year", "start_epoch_days", "stop_epoch_days" ] ) return _create_table( csv_convert_options, pv.ParseOptions(delimiter=';'), data_path ) def _convert_csv_to_simple_parquet(csv_data_path: str, data_type: str) -> str: parquet_file_path = csv_data_path.replace( '_enhanced.csv', '__0_0.parquet' ) logger.info( f"Converts csv {csv_data_path} " f"to simple parquet {parquet_file_path}" ) table = _create_table_for_simple_parquet(csv_data_path, data_type) logger.info(f"Number of rows in parquet file: {table.num_rows}") pq.write_table(table, parquet_file_path) logger.info("Converted csv to simple parquet successfully") return parquet_file_path def _convert_csv_to_partitioned_parquet(csv_data_path: str, data_type: str) -> str: parquet_partition_path = csv_data_path.replace( '_enhanced.csv', '__0_0' ) logger.info( f"Converts csv {csv_data_path} " f"to partitioned parquet {parquet_partition_path}" ) table = _create_table_for_partitioned_parquet(csv_data_path, data_type) logger.info(f"Number of rows in parquet file: {table.num_rows}") metadata_collector = [] pq.write_to_dataset( table, root_path=parquet_partition_path, partition_cols=['start_year'], metadata_collector=metadata_collector ) logger.info("Converted csv to partitioned parquet successfully") return parquet_partition_path def run(csv_data_path: str, temporality_type: str, data_type: str) -> str: """ Converts a csv file to parquet format. Will partition the parquet if given temporality type is "STATUS" or "ACCUMULATED". """ try: logger.info( f''' Converting {csv_data_path} to parquet data_type: {data_type} temporality_type: {temporality_type} ''' ) if temporality_type in ["STATUS", "ACCUMULATED"]: parquet_path = _convert_csv_to_partitioned_parquet( csv_data_path, data_type ) logger.info( 'Converted csv to partitioned parquet and wrote to ' f'{parquet_path}' ) else: parquet_path = _convert_csv_to_simple_parquet( csv_data_path, data_type ) logger.info( 'Converted csv to parquet and wrote to ' f'{parquet_path}' ) return parquet_path except Exception as e: logger.error(f'Error during conversion: {str(e)}') raise BuilderStepError('Failed to convert dataset')
dataset_builder/steps/dataset_converter.py
import logging import pyarrow as pa import pyarrow.csv as pv import pyarrow.parquet as pq from dataset_builder.exceptions.exceptions import BuilderStepError logger = logging.getLogger() def _get_read_options(): return pv.ReadOptions( skip_rows=0, encoding="utf8", column_names=[ "unit_id", "value", "start", "stop", "start_year", "start_epoch_days", "stop_epoch_days" ] ) def _create_table(csv_convert_options: str, csv_parse_options: str, data_path: str) -> pa.Table: table = pv.read_csv( input_file=data_path, read_options=_get_read_options(), parse_options=csv_parse_options, convert_options=csv_convert_options ) return table def _create_list_of_fields(data_type: str, partitioned: bool = False) -> list: types = dict( STRING=pa.string(), LONG=pa.int64(), DOUBLE=pa.float64(), INSTANT=pa.int64(), DATE=pa.int64() ) if data_type.upper() not in types: raise ValueError(f'Unknown datatype {data_type}') fields = [ pa.field(name='unit_id', type=pa.uint64(), nullable=False), pa.field(name='value', type=types[data_type.upper()], nullable=False), pa.field(name='start_epoch_days', type=pa.int16(), nullable=False), pa.field(name='stop_epoch_days', type=pa.int16(), nullable=False) ] if partitioned: start_year_field = [ pa.field(name='start_year', type=pa.string(), nullable=True) ] fields = start_year_field + fields return fields def _create_table_for_simple_parquet(data_path: str, data_type: str) -> pa.Table: data_schema = pa.schema(_create_list_of_fields(data_type)) csv_convert_options = pv.ConvertOptions( column_types=data_schema, include_columns=[ "unit_id", "value", "start_epoch_days", "stop_epoch_days" ] ) return _create_table( csv_convert_options, pv.ParseOptions(delimiter=';'), data_path ) def _create_table_for_partitioned_parquet(data_path: str, data_type: str) -> pa.Table: data_schema = pa.schema(_create_list_of_fields(data_type, True)) csv_convert_options = pv.ConvertOptions( column_types=data_schema, include_columns=[ "unit_id", "value", "start_year", "start_epoch_days", "stop_epoch_days" ] ) return _create_table( csv_convert_options, pv.ParseOptions(delimiter=';'), data_path ) def _convert_csv_to_simple_parquet(csv_data_path: str, data_type: str) -> str: parquet_file_path = csv_data_path.replace( '_enhanced.csv', '__0_0.parquet' ) logger.info( f"Converts csv {csv_data_path} " f"to simple parquet {parquet_file_path}" ) table = _create_table_for_simple_parquet(csv_data_path, data_type) logger.info(f"Number of rows in parquet file: {table.num_rows}") pq.write_table(table, parquet_file_path) logger.info("Converted csv to simple parquet successfully") return parquet_file_path def _convert_csv_to_partitioned_parquet(csv_data_path: str, data_type: str) -> str: parquet_partition_path = csv_data_path.replace( '_enhanced.csv', '__0_0' ) logger.info( f"Converts csv {csv_data_path} " f"to partitioned parquet {parquet_partition_path}" ) table = _create_table_for_partitioned_parquet(csv_data_path, data_type) logger.info(f"Number of rows in parquet file: {table.num_rows}") metadata_collector = [] pq.write_to_dataset( table, root_path=parquet_partition_path, partition_cols=['start_year'], metadata_collector=metadata_collector ) logger.info("Converted csv to partitioned parquet successfully") return parquet_partition_path def run(csv_data_path: str, temporality_type: str, data_type: str) -> str: """ Converts a csv file to parquet format. Will partition the parquet if given temporality type is "STATUS" or "ACCUMULATED". """ try: logger.info( f''' Converting {csv_data_path} to parquet data_type: {data_type} temporality_type: {temporality_type} ''' ) if temporality_type in ["STATUS", "ACCUMULATED"]: parquet_path = _convert_csv_to_partitioned_parquet( csv_data_path, data_type ) logger.info( 'Converted csv to partitioned parquet and wrote to ' f'{parquet_path}' ) else: parquet_path = _convert_csv_to_simple_parquet( csv_data_path, data_type ) logger.info( 'Converted csv to parquet and wrote to ' f'{parquet_path}' ) return parquet_path except Exception as e: logger.error(f'Error during conversion: {str(e)}') raise BuilderStepError('Failed to convert dataset')
0.461502
0.213039
from ion_functions.data.perf.test_performance import PerformanceTestCase, a_deca from ion_functions.data import opt_functions as optfunc import numpy as np class TestOPTAAPerformance(PerformanceTestCase): def setUp(self): ### realistic values for ac-s data packets: n_wvl = 90 # number of wavelengths specified in DPS is incorrect wvl_tile = n_wvl/6 # test arrays have 6 values n_tbins = 35 tbin_tile = n_tbins/7 # test array has 7 tbin values ### test data common to both OPTATTN and OPTABSN self.traw = 48355 self.tcal = 20.0 self.T = 12.0 self.S = 35.0 # tbin values are used in an interpolation algorithm; make sure # their values are monotonic self.tbins = np.array(range(n_tbins)) ### test data for OPTATTN self.c_sig = np.tile([150., 225., 200., 350., 450., 495.], (1, wvl_tile)) self.c_ref = np.tile([550., 540., 530., 520., 510., 500.], (1, wvl_tile)) self.c_off = np.tile([1.35, 1.30, 1.25, 1.20, 1.15, 1.10], (1, wvl_tile)) self.c_wvl = np.tile([510., 540., 580., 630., 670., 710.], (1, wvl_tile)) self.tc_arr = np.tile([ [0.0, -0.004929, -0.004611, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004611, -0.004418, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004418, -0.004355, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004355, -0.004131, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004131, -0.003422, 0.0, 0.0, 0.0, 0.0], [0.0, -0.003422, -0.002442, 0.0, 0.0, 0.0, 0.0]], (wvl_tile, tbin_tile)) ### test data for OPTABSN self.a_sig = np.tile([250., 300., 210., 430., 470., 495.], (1, wvl_tile)) self.a_ref = np.tile([450., 460., 470., 480., 490., 500.], (1, wvl_tile)) self.a_off = np.tile([0.35, 0.30, 0.25, 0.20, 0.15, 0.10], (1, wvl_tile)) self.a_wvl = np.tile([500., 550., 600., 650., 700., 715.], (1, wvl_tile)) # note, even though here ta_arr and tc_arr are identical, in actual calibration # data they will be different. self.ta_arr = np.tile([ [0.0, -0.004929, -0.004611, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004611, -0.004418, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004418, -0.004355, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004355, -0.004131, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004131, -0.003422, 0.0, 0.0, 0.0, 0.0], [0.0, -0.003422, -0.002442, 0.0, 0.0, 0.0, 0.0]], (wvl_tile, tbin_tile)) self.cpd_ts = np.tile([6.553771, 4.807914, 5.156010, 2.788715, 1.655607, 1.171965], (1, wvl_tile)) # test data for ocr-507 (spectir = downwelling irradiance) # counts offset scale mrsn self.ocr_507 = np.transpose(np.array([ [2148370944, 2148377867.8, 2.09023117662E-07, 1.368], [2200000000, 2148218092.4, 2.06543624674E-07, 1.410], [2300000000, 2147607229.7, 2.12484770952E-07, 1.365], [2400000000, 2147789959.1, 2.07241106309E-07, 1.354], [2500000000, 2148047456.7, 1.99358530187E-07, 1.372], [2600000000, 2147335412.8, 2.06033896796E-07, 1.404], [2700000000, 2146998228.4, 2.14806273478E-07, 1.347] ])) def test_opt_beam_attenuation(self): stats = [] # create 10000 data packets # common input variables: traw, Tcal, T, and PS traw = np.tile(self.traw, (a_deca, 1)) tcal = np.tile(self.tcal, (a_deca, 1)) T = np.tile(self.T, (a_deca, 1)) PS = np.tile(self.S, (a_deca, 1)) tbins = np.tile(self.tbins, (a_deca, 1)) # variables unique to beam attenuation: 1D -> 2D c_sig = np.tile(self.c_sig, (a_deca, 1)) c_ref = np.tile(self.c_ref, (a_deca, 1)) c_off = np.tile(self.c_off, (a_deca, 1)) c_wvl = np.tile(self.c_wvl, (a_deca, 1)) # variables unique to beam attenuation: 2D -> 3D tc_arr = np.tile(self.tc_arr, (a_deca, 1, 1)) # timing test self.profile(stats, optfunc.opt_beam_attenuation, c_ref, c_sig, traw, c_wvl, c_off, tcal, tbins, tc_arr, T, PS) def test_opt_optical_absorption(self): stats = [] # create 10000 data packets # common input variables: traw, Tcal, T, and PS traw = np.tile(self.traw, (a_deca, 1)) tcal = np.tile(self.tcal, (a_deca, 1)) T = np.tile(self.T, (a_deca, 1)) PS = np.tile(self.S, (a_deca, 1)) tbins = np.tile(self.tbins, (a_deca, 1)) # variables unique to beam attenuation: 1D -> 2D a_sig = np.tile(self.a_sig, (a_deca, 1)) a_ref = np.tile(self.a_ref, (a_deca, 1)) a_off = np.tile(self.a_off, (a_deca, 1)) a_wvl = np.tile(self.a_wvl, (a_deca, 1)) # variables unique to beam attenuation: 2D -> 3D ta_arr = np.tile(self.ta_arr, (a_deca, 1, 1)) cpd_ts = np.tile(self.cpd_ts, (a_deca, 1)) c_wvl = np.tile(self.c_wvl, (a_deca, 1)) # timing test self.profile(stats, optfunc.opt_optical_absorption, a_ref, a_sig, traw, a_wvl, a_off, tcal, tbins, ta_arr, cpd_ts, c_wvl, T, PS) def test_opt_ocr507_irradiance(self): stats = [] # create 10000 data packets counts = np.tile(self.ocr_507[0, :], (a_deca, 1)) offset = np.tile(self.ocr_507[1, :], (a_deca, 1)) scale = np.tile(self.ocr_507[2, :], (a_deca, 1)) immersion_factor = np.tile(self.ocr_507[3, :], (a_deca, 1)) # timing test self.profile(stats, optfunc.opt_ocr507_irradiance, counts, offset, scale, immersion_factor)
ion_functions/data/perf/test_opt_performance.py
from ion_functions.data.perf.test_performance import PerformanceTestCase, a_deca from ion_functions.data import opt_functions as optfunc import numpy as np class TestOPTAAPerformance(PerformanceTestCase): def setUp(self): ### realistic values for ac-s data packets: n_wvl = 90 # number of wavelengths specified in DPS is incorrect wvl_tile = n_wvl/6 # test arrays have 6 values n_tbins = 35 tbin_tile = n_tbins/7 # test array has 7 tbin values ### test data common to both OPTATTN and OPTABSN self.traw = 48355 self.tcal = 20.0 self.T = 12.0 self.S = 35.0 # tbin values are used in an interpolation algorithm; make sure # their values are monotonic self.tbins = np.array(range(n_tbins)) ### test data for OPTATTN self.c_sig = np.tile([150., 225., 200., 350., 450., 495.], (1, wvl_tile)) self.c_ref = np.tile([550., 540., 530., 520., 510., 500.], (1, wvl_tile)) self.c_off = np.tile([1.35, 1.30, 1.25, 1.20, 1.15, 1.10], (1, wvl_tile)) self.c_wvl = np.tile([510., 540., 580., 630., 670., 710.], (1, wvl_tile)) self.tc_arr = np.tile([ [0.0, -0.004929, -0.004611, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004611, -0.004418, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004418, -0.004355, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004355, -0.004131, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004131, -0.003422, 0.0, 0.0, 0.0, 0.0], [0.0, -0.003422, -0.002442, 0.0, 0.0, 0.0, 0.0]], (wvl_tile, tbin_tile)) ### test data for OPTABSN self.a_sig = np.tile([250., 300., 210., 430., 470., 495.], (1, wvl_tile)) self.a_ref = np.tile([450., 460., 470., 480., 490., 500.], (1, wvl_tile)) self.a_off = np.tile([0.35, 0.30, 0.25, 0.20, 0.15, 0.10], (1, wvl_tile)) self.a_wvl = np.tile([500., 550., 600., 650., 700., 715.], (1, wvl_tile)) # note, even though here ta_arr and tc_arr are identical, in actual calibration # data they will be different. self.ta_arr = np.tile([ [0.0, -0.004929, -0.004611, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004611, -0.004418, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004418, -0.004355, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004355, -0.004131, 0.0, 0.0, 0.0, 0.0], [0.0, -0.004131, -0.003422, 0.0, 0.0, 0.0, 0.0], [0.0, -0.003422, -0.002442, 0.0, 0.0, 0.0, 0.0]], (wvl_tile, tbin_tile)) self.cpd_ts = np.tile([6.553771, 4.807914, 5.156010, 2.788715, 1.655607, 1.171965], (1, wvl_tile)) # test data for ocr-507 (spectir = downwelling irradiance) # counts offset scale mrsn self.ocr_507 = np.transpose(np.array([ [2148370944, 2148377867.8, 2.09023117662E-07, 1.368], [2200000000, 2148218092.4, 2.06543624674E-07, 1.410], [2300000000, 2147607229.7, 2.12484770952E-07, 1.365], [2400000000, 2147789959.1, 2.07241106309E-07, 1.354], [2500000000, 2148047456.7, 1.99358530187E-07, 1.372], [2600000000, 2147335412.8, 2.06033896796E-07, 1.404], [2700000000, 2146998228.4, 2.14806273478E-07, 1.347] ])) def test_opt_beam_attenuation(self): stats = [] # create 10000 data packets # common input variables: traw, Tcal, T, and PS traw = np.tile(self.traw, (a_deca, 1)) tcal = np.tile(self.tcal, (a_deca, 1)) T = np.tile(self.T, (a_deca, 1)) PS = np.tile(self.S, (a_deca, 1)) tbins = np.tile(self.tbins, (a_deca, 1)) # variables unique to beam attenuation: 1D -> 2D c_sig = np.tile(self.c_sig, (a_deca, 1)) c_ref = np.tile(self.c_ref, (a_deca, 1)) c_off = np.tile(self.c_off, (a_deca, 1)) c_wvl = np.tile(self.c_wvl, (a_deca, 1)) # variables unique to beam attenuation: 2D -> 3D tc_arr = np.tile(self.tc_arr, (a_deca, 1, 1)) # timing test self.profile(stats, optfunc.opt_beam_attenuation, c_ref, c_sig, traw, c_wvl, c_off, tcal, tbins, tc_arr, T, PS) def test_opt_optical_absorption(self): stats = [] # create 10000 data packets # common input variables: traw, Tcal, T, and PS traw = np.tile(self.traw, (a_deca, 1)) tcal = np.tile(self.tcal, (a_deca, 1)) T = np.tile(self.T, (a_deca, 1)) PS = np.tile(self.S, (a_deca, 1)) tbins = np.tile(self.tbins, (a_deca, 1)) # variables unique to beam attenuation: 1D -> 2D a_sig = np.tile(self.a_sig, (a_deca, 1)) a_ref = np.tile(self.a_ref, (a_deca, 1)) a_off = np.tile(self.a_off, (a_deca, 1)) a_wvl = np.tile(self.a_wvl, (a_deca, 1)) # variables unique to beam attenuation: 2D -> 3D ta_arr = np.tile(self.ta_arr, (a_deca, 1, 1)) cpd_ts = np.tile(self.cpd_ts, (a_deca, 1)) c_wvl = np.tile(self.c_wvl, (a_deca, 1)) # timing test self.profile(stats, optfunc.opt_optical_absorption, a_ref, a_sig, traw, a_wvl, a_off, tcal, tbins, ta_arr, cpd_ts, c_wvl, T, PS) def test_opt_ocr507_irradiance(self): stats = [] # create 10000 data packets counts = np.tile(self.ocr_507[0, :], (a_deca, 1)) offset = np.tile(self.ocr_507[1, :], (a_deca, 1)) scale = np.tile(self.ocr_507[2, :], (a_deca, 1)) immersion_factor = np.tile(self.ocr_507[3, :], (a_deca, 1)) # timing test self.profile(stats, optfunc.opt_ocr507_irradiance, counts, offset, scale, immersion_factor)
0.498779
0.512693
import numpy as np import tensorflow as tf class ANN(object): def __init__(self, size, logPath): """ 创建一个神经网络 """ # 重置tensorflow的graph,确保神经网络可多次运行 tf.reset_default_graph() tf.set_random_seed(1908) self.logPath = logPath self.layerNum = len(size) self.size = size def defineANN(self): """ 定义神经网络的结构 """ # self.input是训练数据里自变量 prevSize = self.input.shape[1].value prevOut = self.input # self.size是神经网络的结构,也就是每一层的神经元个数 size = self.size layer = 1 # 定义隐藏层 for currentSize in size[:-1]: weights = tf.Variable( tf.truncated_normal([prevSize, currentSize], stddev=1.0 / np.sqrt(float(prevSize)))) # 记录隐藏层的模型参数 tf.summary.histogram("hidden%s" % layer, weights) layer += 1 biases = tf.Variable(tf.zeros([currentSize])) prevOut = tf.nn.sigmoid(tf.matmul(prevOut, weights) + biases) prevSize = currentSize # 定义输出层 weights = tf.Variable( tf.truncated_normal([prevSize, size[-1]], stddev=1.0 / np.sqrt(float(prevSize)))) biases = tf.Variable(tf.zeros([size[-1]])) self.out = tf.matmul(prevOut, weights) + biases return self def defineLoss(self): """ 定义神经网络的损失函数 """ # 定义单点损失,self.label是训练数据里的标签变量 loss = tf.nn.softmax_cross_entropy_with_logits( labels=self.label, logits=self.out, name="loss") # 定义整体损失 self.loss = tf.reduce_mean(loss, name="average_loss") return self def SGD(self, X, Y, learningRate, miniBatchFraction, epoch): """ 使用随机梯度下降法训练模型 参数 ---- X : np.array, 自变量 Y : np.array, 因变量 """ # 记录训练的细节 tf.summary.scalar("loss", self.loss) summary = tf.summary.merge_all() method = tf.train.GradientDescentOptimizer(learningRate) optimizer= method.minimize(self.loss) batchSize = int(X.shape[0] * miniBatchFraction) batchNum = int(np.ceil(1 / miniBatchFraction)) sess = tf.Session() init = tf.global_variables_initializer() sess.run(init) summary_writer = tf.summary.FileWriter(self.logPath, graph=tf.get_default_graph()) step = 0 while (step < epoch): for i in range(batchNum): batchX = X[i * batchSize: (i + 1) * batchSize] batchY = Y[i * batchSize: (i + 1) * batchSize] sess.run([optimizer], feed_dict={self.input: batchX, self.label: batchY}) step += 1 # 将日志写入文件 summary_str = sess.run(summary, feed_dict={self.input: X, self.label: Y}) summary_writer.add_summary(summary_str, step) summary_writer.flush() self.sess = sess return self def fit(self, X, Y, learningRate=0.3, miniBatchFraction=0.1, epoch=2500): """ 训练模型 参数 ---- X : np.array, 自变量 Y : np.array, 因变量 """ self.input = tf.placeholder(tf.float32, shape=[None, X.shape[1]], name="X") self.label = tf.placeholder(tf.int64, shape=[None, self.size[-1]], name="Y") self.defineANN() self.defineLoss() self.SGD(X, Y, learningRate, miniBatchFraction, epoch) def predict_proba(self, X): """ 使用神经网络对未知数据进行预测 """ sess = self.sess pred = tf.nn.softmax(logits=self.out, name="pred") prob = sess.run(pred, feed_dict={self.input: X}) return prob
ch12-ann/mlp.py
import numpy as np import tensorflow as tf class ANN(object): def __init__(self, size, logPath): """ 创建一个神经网络 """ # 重置tensorflow的graph,确保神经网络可多次运行 tf.reset_default_graph() tf.set_random_seed(1908) self.logPath = logPath self.layerNum = len(size) self.size = size def defineANN(self): """ 定义神经网络的结构 """ # self.input是训练数据里自变量 prevSize = self.input.shape[1].value prevOut = self.input # self.size是神经网络的结构,也就是每一层的神经元个数 size = self.size layer = 1 # 定义隐藏层 for currentSize in size[:-1]: weights = tf.Variable( tf.truncated_normal([prevSize, currentSize], stddev=1.0 / np.sqrt(float(prevSize)))) # 记录隐藏层的模型参数 tf.summary.histogram("hidden%s" % layer, weights) layer += 1 biases = tf.Variable(tf.zeros([currentSize])) prevOut = tf.nn.sigmoid(tf.matmul(prevOut, weights) + biases) prevSize = currentSize # 定义输出层 weights = tf.Variable( tf.truncated_normal([prevSize, size[-1]], stddev=1.0 / np.sqrt(float(prevSize)))) biases = tf.Variable(tf.zeros([size[-1]])) self.out = tf.matmul(prevOut, weights) + biases return self def defineLoss(self): """ 定义神经网络的损失函数 """ # 定义单点损失,self.label是训练数据里的标签变量 loss = tf.nn.softmax_cross_entropy_with_logits( labels=self.label, logits=self.out, name="loss") # 定义整体损失 self.loss = tf.reduce_mean(loss, name="average_loss") return self def SGD(self, X, Y, learningRate, miniBatchFraction, epoch): """ 使用随机梯度下降法训练模型 参数 ---- X : np.array, 自变量 Y : np.array, 因变量 """ # 记录训练的细节 tf.summary.scalar("loss", self.loss) summary = tf.summary.merge_all() method = tf.train.GradientDescentOptimizer(learningRate) optimizer= method.minimize(self.loss) batchSize = int(X.shape[0] * miniBatchFraction) batchNum = int(np.ceil(1 / miniBatchFraction)) sess = tf.Session() init = tf.global_variables_initializer() sess.run(init) summary_writer = tf.summary.FileWriter(self.logPath, graph=tf.get_default_graph()) step = 0 while (step < epoch): for i in range(batchNum): batchX = X[i * batchSize: (i + 1) * batchSize] batchY = Y[i * batchSize: (i + 1) * batchSize] sess.run([optimizer], feed_dict={self.input: batchX, self.label: batchY}) step += 1 # 将日志写入文件 summary_str = sess.run(summary, feed_dict={self.input: X, self.label: Y}) summary_writer.add_summary(summary_str, step) summary_writer.flush() self.sess = sess return self def fit(self, X, Y, learningRate=0.3, miniBatchFraction=0.1, epoch=2500): """ 训练模型 参数 ---- X : np.array, 自变量 Y : np.array, 因变量 """ self.input = tf.placeholder(tf.float32, shape=[None, X.shape[1]], name="X") self.label = tf.placeholder(tf.int64, shape=[None, self.size[-1]], name="Y") self.defineANN() self.defineLoss() self.SGD(X, Y, learningRate, miniBatchFraction, epoch) def predict_proba(self, X): """ 使用神经网络对未知数据进行预测 """ sess = self.sess pred = tf.nn.softmax(logits=self.out, name="pred") prob = sess.run(pred, feed_dict={self.input: X}) return prob
0.581065
0.549943
from sns_boomerang.common.items import sns_client, Job, Topic, JOB_TABLE from contextlib import contextmanager import pytest from unittest.mock import MagicMock from datetime import datetime def test_new_job(): job = Job('topic', 'payload', 123) assert job.id assert job.topic == 'topic' assert job.payload == 'payload' def test_add_or_update(monkeypatch): def mock_put_item(Item, **kwargs): assert Item['topic'] == 'topic' assert Item['time_scheduled'] > 0 # mock_datetime = datetime.now() # monkeypatch.setattr(datetime, 'utcnow', mock_datetime) monkeypatch.setattr(JOB_TABLE, 'put_item', mock_put_item) job = Job('topic', 'payload', 123) job.add_or_update() @pytest.mark.parametrize("test_input, status, check, expected", [ ("active-job", 1, True, True), ("not-active-check-status", 0, True, False), ("not-active-check-status", 0, False, True) ]) def test_job_get_by_id_status(test_input, status, check, expected, monkeypatch): topic_name = f'{test_input}-topic' def mock_get_item(Key, **kwargs): assert Key['id'] == test_input return {'Item': {'topic': topic_name, 'payload': 'payload', 'time_due': 111, 'is_valid': status}} monkeypatch.setattr(JOB_TABLE, 'get_item', mock_get_item) job = Job.get(test_input, check) if expected: assert job.topic == topic_name else: assert job == None def test_job_flush(monkeypatch): test_key_id = 'x' class batch_mock: def delete_item(self, Key): assert Key['id'] == test_key_id @contextmanager def mock_managed_context(*args, **kwds): try: yield batch_mock() finally: pass def mock_query(IndexName, KeyConditionExpression, **kwargs): assert IndexName == 'is_valid-time_due-index' assert KeyConditionExpression is not None return {'Items': [{'id': test_key_id, 'is_valid': 1}]} monkeypatch.setattr(JOB_TABLE, 'query', mock_query) monkeypatch.setattr(JOB_TABLE, 'batch_writer', mock_managed_context) Job.flush() def test_job_publish_success(monkeypatch): mock_topic = Topic('x', arn='existing') mock_job = Job('x', '{"a": "b"}', 123) def mock_publish(TopicArn, Message, MessageStructure, **kwargs): assert MessageStructure == 'json' def mock_topic_get(topic_name): assert topic_name == 'x' return mock_topic monkeypatch.setattr(Topic, 'get', mock_topic_get) monkeypatch.setattr(sns_client, 'publish', mock_publish) mock_job.publish()
tests/test_item_job.py
from sns_boomerang.common.items import sns_client, Job, Topic, JOB_TABLE from contextlib import contextmanager import pytest from unittest.mock import MagicMock from datetime import datetime def test_new_job(): job = Job('topic', 'payload', 123) assert job.id assert job.topic == 'topic' assert job.payload == 'payload' def test_add_or_update(monkeypatch): def mock_put_item(Item, **kwargs): assert Item['topic'] == 'topic' assert Item['time_scheduled'] > 0 # mock_datetime = datetime.now() # monkeypatch.setattr(datetime, 'utcnow', mock_datetime) monkeypatch.setattr(JOB_TABLE, 'put_item', mock_put_item) job = Job('topic', 'payload', 123) job.add_or_update() @pytest.mark.parametrize("test_input, status, check, expected", [ ("active-job", 1, True, True), ("not-active-check-status", 0, True, False), ("not-active-check-status", 0, False, True) ]) def test_job_get_by_id_status(test_input, status, check, expected, monkeypatch): topic_name = f'{test_input}-topic' def mock_get_item(Key, **kwargs): assert Key['id'] == test_input return {'Item': {'topic': topic_name, 'payload': 'payload', 'time_due': 111, 'is_valid': status}} monkeypatch.setattr(JOB_TABLE, 'get_item', mock_get_item) job = Job.get(test_input, check) if expected: assert job.topic == topic_name else: assert job == None def test_job_flush(monkeypatch): test_key_id = 'x' class batch_mock: def delete_item(self, Key): assert Key['id'] == test_key_id @contextmanager def mock_managed_context(*args, **kwds): try: yield batch_mock() finally: pass def mock_query(IndexName, KeyConditionExpression, **kwargs): assert IndexName == 'is_valid-time_due-index' assert KeyConditionExpression is not None return {'Items': [{'id': test_key_id, 'is_valid': 1}]} monkeypatch.setattr(JOB_TABLE, 'query', mock_query) monkeypatch.setattr(JOB_TABLE, 'batch_writer', mock_managed_context) Job.flush() def test_job_publish_success(monkeypatch): mock_topic = Topic('x', arn='existing') mock_job = Job('x', '{"a": "b"}', 123) def mock_publish(TopicArn, Message, MessageStructure, **kwargs): assert MessageStructure == 'json' def mock_topic_get(topic_name): assert topic_name == 'x' return mock_topic monkeypatch.setattr(Topic, 'get', mock_topic_get) monkeypatch.setattr(sns_client, 'publish', mock_publish) mock_job.publish()
0.520496
0.468122
__author__ = '<EMAIL> (<NAME>)' import logging from categories import test_set_base from categories import test_set_params _CATEGORY = 'reflow' class ReflowTest(test_set_base.TestBase): TESTS_URL_PATH = '/%s/test' % _CATEGORY def __init__(self, key, name, doc): test_set_base.TestBase.__init__( self, key=key, name=name, url='%s?t=%s' % (self.TESTS_URL_PATH, key), doc=doc, min_value=0, max_value=60000) _TESTS = ( # key, name, doc ReflowTest('testDisplay', 'Display Block', '''This test takes an element and sets its style.display="none". According to the folks at Mozilla this has the effect of taking an element out of the browser's "render tree" (the in-memory representation of all of results of geometry/positioning calculations for that particular element). Setting an element to display="none" has the additional effect of removing all of an element's children from the render tree as well. Next, the test resets the element's style.display="", which sets the element's display back to its original value. Our thinking was that this operation ought to approximate the max cost of reflowing an element on a page since the browser has to recalculate all positions and sizes for every child within the element as well as any changes to the overall document.'''), ReflowTest('testVisibility', 'Visiblility None', '''Much like the display test above, this test sets an element's style.visibility="hidden" and then resets it back to its default, which is "visible". This change should be less costly than changing display from "none" to the default since the browser should not be purging the element from the render tree.'''), ReflowTest('testNonMatchingClass', 'Non Matching Class', '''This test adds a class name to an element where that class name is not present in the document's CSS object model. This tests CSS selector match time, and more specifically against selectors with classnames.'''), ReflowTest('testFourClassReflows', 'Four Reflows by Class', '''This test adds a class name to an element that will match a previously added CSS declaration added to the CSSOM. This declaration is set with four property value pairs which should in and of themselves be capable of causing a 1x reflow time. For instance, "font-size: 20px; line-height: 10px; padding-left: 10px; margin-top: 7px;". This test aims to test whether reflow operations occur in a single queue flush or if they are performed one at a time when these changes are made via a CSS classname. This test is a sort of opposite to the Four Reflows By Script.'''), ReflowTest('testFourScriptReflows', 'Four Reflows by Script', '''Like the Four Reflows By Class test, but instead this test has four lines of Javascript, each of which alters the style object with a property/value that by itself could cause a 1x reflow time.'''), ReflowTest('testTwoScriptReflows', 'Two Reflows by Script', '''Like the Four Reflows By Script test, except with only two lines of Javascript.'''), ReflowTest('testPaddingPx', 'Padding px', '''This test sets style.padding="FOOpx", aka padding on all sides of the box model.'''), ReflowTest('testPaddingLeftPx', 'Padding Left px', '''This test sets style.paddingLeft="FOOpx", aka padding on only the left side of the box.'''), ReflowTest('testFontSizeEm', 'Font Size em', '''This test changes an element's style.fontSize to an em-based value.'''), ReflowTest('testWidthPercent', 'Width %', '''This test sets an element's style.width="FOO%"'''), ReflowTest('testBackground', 'Background Color', '''This test sets an element's style.background="#FOO", aka a hexadecimal color.'''), ReflowTest('testOverflowHidden', 'Overflow Hidden', '''This test sets an element's style.overflow="hidden" and then back again, timing the cost of an element returning to the default overflow which is "visible"'''), ReflowTest('testGetOffsetHeight', 'Do Nothing / OffsetHeight', '''This test does nothing other than the request for offsetHeight after already having done so. Theoretically, this test is something like a control for our test and should have a 0 or very low time.'''), ) BASELINE_TEST_NAME = 'testDisplay' class ReflowTestSet(test_set_base.TestSet): def AdjustResults(self, results): """Re-scores the actual value against a baseline score for reflow. Sets the 1x reflow time for this test run and compares other times against that. This is to try to account for issues around selection bias, processor speed, etc... We'll preserve the original millisecond time as an expando value in case we want to do some calculations with it later. Args: results: { test_key_1: {'raw_score': raw_score_1}, test_key_2: {'raw_score': raw_score_2}, ... } Returns: { test_key_1: {'raw_score': adjusted_raw_score_1, 'expando': score_1}, test_key_2: {'raw_score': adjusted_raw_score_2, 'expando': score_2}, ... } """ if BASELINE_TEST_NAME not in results: raise NameError('No baseline score found in the test results') baseline_score = float(results[BASELINE_TEST_NAME]['raw_score']) # Turn all values into some computed percentage of the baseline score. # This resets the score in the dict, but adds an expando to preserve the # original score's milliseconds value. for result in results.values(): result['expando'] = result['raw_score'] result['raw_score'] = int(100.0 * result['raw_score'] / baseline_score) return results def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell. """ raw_score = raw_scores.get(test_key, None) if raw_score in (None, ''): return 0, '' raw_score = int(raw_score) if raw_score <= 10: score, display = 100, '0X' elif raw_score <= 35: score, display = 97, '¼X' elif raw_score <= 65: score, display = 95, '½X' elif raw_score <= 85: score, display = 93, '¾X' elif raw_score <= 110: score, display = 90, '1X' elif raw_score <= 180: score, display = 80, '2X' else: score, display = 60, '3X' return score, display def GetRowScoreAndDisplayValue(self, results): """Get the overall score for this row of results data. Args: results: { 'test_key_1': {'score': score_1, 'raw_score': raw_score_1, ...}, 'test_key_2': {'score': score_2, 'raw_score': raw_score_2, ...}, ... } Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell. """ return 90, '' TEST_SET = ReflowTestSet( category=_CATEGORY, category_name='Reflow', summary_doc='Tests of reflow time for different CSS selectors.', tests=_TESTS, # default_params=Params( # 'nested_anchors', 'num_elements=400', 'num_nest=4', # 'css_selector=#g-content *', 'num_css_rules=1000', # 'css_text=border: 1px solid #0C0; padding: 8px;'), #default_params=test_set_params.Params('acid1', 'num_elements=300'), test_page='/%s/test_acid1' % _CATEGORY )
categories/reflow/test_set.py
__author__ = '<EMAIL> (<NAME>)' import logging from categories import test_set_base from categories import test_set_params _CATEGORY = 'reflow' class ReflowTest(test_set_base.TestBase): TESTS_URL_PATH = '/%s/test' % _CATEGORY def __init__(self, key, name, doc): test_set_base.TestBase.__init__( self, key=key, name=name, url='%s?t=%s' % (self.TESTS_URL_PATH, key), doc=doc, min_value=0, max_value=60000) _TESTS = ( # key, name, doc ReflowTest('testDisplay', 'Display Block', '''This test takes an element and sets its style.display="none". According to the folks at Mozilla this has the effect of taking an element out of the browser's "render tree" (the in-memory representation of all of results of geometry/positioning calculations for that particular element). Setting an element to display="none" has the additional effect of removing all of an element's children from the render tree as well. Next, the test resets the element's style.display="", which sets the element's display back to its original value. Our thinking was that this operation ought to approximate the max cost of reflowing an element on a page since the browser has to recalculate all positions and sizes for every child within the element as well as any changes to the overall document.'''), ReflowTest('testVisibility', 'Visiblility None', '''Much like the display test above, this test sets an element's style.visibility="hidden" and then resets it back to its default, which is "visible". This change should be less costly than changing display from "none" to the default since the browser should not be purging the element from the render tree.'''), ReflowTest('testNonMatchingClass', 'Non Matching Class', '''This test adds a class name to an element where that class name is not present in the document's CSS object model. This tests CSS selector match time, and more specifically against selectors with classnames.'''), ReflowTest('testFourClassReflows', 'Four Reflows by Class', '''This test adds a class name to an element that will match a previously added CSS declaration added to the CSSOM. This declaration is set with four property value pairs which should in and of themselves be capable of causing a 1x reflow time. For instance, "font-size: 20px; line-height: 10px; padding-left: 10px; margin-top: 7px;". This test aims to test whether reflow operations occur in a single queue flush or if they are performed one at a time when these changes are made via a CSS classname. This test is a sort of opposite to the Four Reflows By Script.'''), ReflowTest('testFourScriptReflows', 'Four Reflows by Script', '''Like the Four Reflows By Class test, but instead this test has four lines of Javascript, each of which alters the style object with a property/value that by itself could cause a 1x reflow time.'''), ReflowTest('testTwoScriptReflows', 'Two Reflows by Script', '''Like the Four Reflows By Script test, except with only two lines of Javascript.'''), ReflowTest('testPaddingPx', 'Padding px', '''This test sets style.padding="FOOpx", aka padding on all sides of the box model.'''), ReflowTest('testPaddingLeftPx', 'Padding Left px', '''This test sets style.paddingLeft="FOOpx", aka padding on only the left side of the box.'''), ReflowTest('testFontSizeEm', 'Font Size em', '''This test changes an element's style.fontSize to an em-based value.'''), ReflowTest('testWidthPercent', 'Width %', '''This test sets an element's style.width="FOO%"'''), ReflowTest('testBackground', 'Background Color', '''This test sets an element's style.background="#FOO", aka a hexadecimal color.'''), ReflowTest('testOverflowHidden', 'Overflow Hidden', '''This test sets an element's style.overflow="hidden" and then back again, timing the cost of an element returning to the default overflow which is "visible"'''), ReflowTest('testGetOffsetHeight', 'Do Nothing / OffsetHeight', '''This test does nothing other than the request for offsetHeight after already having done so. Theoretically, this test is something like a control for our test and should have a 0 or very low time.'''), ) BASELINE_TEST_NAME = 'testDisplay' class ReflowTestSet(test_set_base.TestSet): def AdjustResults(self, results): """Re-scores the actual value against a baseline score for reflow. Sets the 1x reflow time for this test run and compares other times against that. This is to try to account for issues around selection bias, processor speed, etc... We'll preserve the original millisecond time as an expando value in case we want to do some calculations with it later. Args: results: { test_key_1: {'raw_score': raw_score_1}, test_key_2: {'raw_score': raw_score_2}, ... } Returns: { test_key_1: {'raw_score': adjusted_raw_score_1, 'expando': score_1}, test_key_2: {'raw_score': adjusted_raw_score_2, 'expando': score_2}, ... } """ if BASELINE_TEST_NAME not in results: raise NameError('No baseline score found in the test results') baseline_score = float(results[BASELINE_TEST_NAME]['raw_score']) # Turn all values into some computed percentage of the baseline score. # This resets the score in the dict, but adds an expando to preserve the # original score's milliseconds value. for result in results.values(): result['expando'] = result['raw_score'] result['raw_score'] = int(100.0 * result['raw_score'] / baseline_score) return results def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell. """ raw_score = raw_scores.get(test_key, None) if raw_score in (None, ''): return 0, '' raw_score = int(raw_score) if raw_score <= 10: score, display = 100, '0X' elif raw_score <= 35: score, display = 97, '¼X' elif raw_score <= 65: score, display = 95, '½X' elif raw_score <= 85: score, display = 93, '¾X' elif raw_score <= 110: score, display = 90, '1X' elif raw_score <= 180: score, display = 80, '2X' else: score, display = 60, '3X' return score, display def GetRowScoreAndDisplayValue(self, results): """Get the overall score for this row of results data. Args: results: { 'test_key_1': {'score': score_1, 'raw_score': raw_score_1, ...}, 'test_key_2': {'score': score_2, 'raw_score': raw_score_2, ...}, ... } Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell. """ return 90, '' TEST_SET = ReflowTestSet( category=_CATEGORY, category_name='Reflow', summary_doc='Tests of reflow time for different CSS selectors.', tests=_TESTS, # default_params=Params( # 'nested_anchors', 'num_elements=400', 'num_nest=4', # 'css_selector=#g-content *', 'num_css_rules=1000', # 'css_text=border: 1px solid #0C0; padding: 8px;'), #default_params=test_set_params.Params('acid1', 'num_elements=300'), test_page='/%s/test_acid1' % _CATEGORY )
0.713931
0.411702
__version__ = "1.0" __author__ = "2-REC" import logging logger = logging.getLogger(__name__) from Qt.QtCore import Qt as qt from Qt.QtWidgets import ( QMessageBox, QTextEdit, QDialogButtonBox, QSizePolicy ) class ResizableMessageBox(QMessageBox): _max_width = 4096 _max_height = 2048 def __init__(self, *args, **kwargs): super(ResizableMessageBox, self).__init__(*args, **kwargs) self.clearDetailBox() def setDetailedText(self, text): super(ResizableMessageBox, self).setDetailedText(text) if not text: self.clearDetailBox() return details_box = self.findChild(QTextEdit) if not details_box: logger.error("No 'QTextEdit' found in 'QDialogButtonBox'") return self.details_box = details_box dialog_button_box = self.findChild(QDialogButtonBox) if dialog_button_box: for button in dialog_button_box.buttons(): if ( dialog_button_box.buttonRole(button) == QDialogButtonBox.ButtonRole.ActionRole ): button.released.connect(self.detailsToggle) break else: logger.error("No 'ActionRole' button in 'QDialogButtonBox'") def resizeEvent(self, event): result = super(ResizableMessageBox, self).resizeEvent(event) if self.details_visible: self.setSizing() return result def clearDetailBox(self): self.details_box = None self.details_visible = False self.setSizeGripEnabled(False) def detailsToggle(self): self.details_visible = not self.details_visible self.setSizeGripEnabled(self.details_visible) if self.details_visible: self.setSizing() def setSizing(self): self.setWidgetSizing(self) self.setWidgetSizing(self.details_box) @classmethod def setWidgetSizing(cls, widget): widget.setMaximumHeight(cls._max_width) widget.setMaximumWidth(cls._max_height) widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
resizable_messagebox.py
__version__ = "1.0" __author__ = "2-REC" import logging logger = logging.getLogger(__name__) from Qt.QtCore import Qt as qt from Qt.QtWidgets import ( QMessageBox, QTextEdit, QDialogButtonBox, QSizePolicy ) class ResizableMessageBox(QMessageBox): _max_width = 4096 _max_height = 2048 def __init__(self, *args, **kwargs): super(ResizableMessageBox, self).__init__(*args, **kwargs) self.clearDetailBox() def setDetailedText(self, text): super(ResizableMessageBox, self).setDetailedText(text) if not text: self.clearDetailBox() return details_box = self.findChild(QTextEdit) if not details_box: logger.error("No 'QTextEdit' found in 'QDialogButtonBox'") return self.details_box = details_box dialog_button_box = self.findChild(QDialogButtonBox) if dialog_button_box: for button in dialog_button_box.buttons(): if ( dialog_button_box.buttonRole(button) == QDialogButtonBox.ButtonRole.ActionRole ): button.released.connect(self.detailsToggle) break else: logger.error("No 'ActionRole' button in 'QDialogButtonBox'") def resizeEvent(self, event): result = super(ResizableMessageBox, self).resizeEvent(event) if self.details_visible: self.setSizing() return result def clearDetailBox(self): self.details_box = None self.details_visible = False self.setSizeGripEnabled(False) def detailsToggle(self): self.details_visible = not self.details_visible self.setSizeGripEnabled(self.details_visible) if self.details_visible: self.setSizing() def setSizing(self): self.setWidgetSizing(self) self.setWidgetSizing(self.details_box) @classmethod def setWidgetSizing(cls, widget): widget.setMaximumHeight(cls._max_width) widget.setMaximumWidth(cls._max_height) widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
0.337968
0.052038