content
stringlengths
1
1.04M
input_ids
sequencelengths
1
774k
ratio_char_token
float64
0.38
22.9
token_count
int64
1
774k
""" Abstract types """ from abc import ABC, abstractmethod import typing from hacenada.const import STR_DICT class SessionStorage(ABC): """ Provide access to the session's underlying storage through any mechanism """ answer: typing.Any meta: typing.Any @property def script_path(self): """ The path to the script associated with this storage Concrete method, implementing this is optional """ @script_path.setter def script_path(self, value): """ Set the path to the script associated with this storage Concrete method, implementing this is optional """ @property # type: ignore @abstractmethod def description(self): """ A description of this hacenada session """ @description.setter # type: ignore @abstractmethod def description(self, val): """ Set the description """ @abstractmethod def save_answer(self, answer: STR_DICT): """ Save a single answer """ @abstractmethod def update_meta(self, **kw): """ Update meta properties based on keywords (e.g. description="hello world") """ @abstractmethod def get_answer(self, label: str): """ Look up a single answer by str """ def drop(self): """ Delete the storage Concrete method, implementing this is optional """ class Render(ABC): """ Rendering operations for question types """ @abstractmethod def render(self, step, context) -> STR_DICT: """ Output a question to a device, should return a 0-item label:value dict """
[ 37811, 198, 23839, 3858, 198, 37811, 198, 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 11748, 19720, 198, 198, 6738, 289, 330, 268, 4763, 13, 9979, 1330, 19269, 62, 35, 18379, 628, 198, 4871, 23575, 31425, 7, 24694, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 44290, 1895, 284, 262, 6246, 338, 10238, 6143, 832, 597, 9030, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 3280, 25, 19720, 13, 7149, 198, 220, 220, 220, 13634, 25, 19720, 13, 7149, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 4226, 62, 6978, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 383, 3108, 284, 262, 4226, 3917, 351, 428, 6143, 628, 220, 220, 220, 220, 220, 220, 220, 1482, 38669, 2446, 11, 15427, 428, 318, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 12048, 62, 6978, 13, 2617, 353, 198, 220, 220, 220, 825, 4226, 62, 6978, 7, 944, 11, 1988, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5345, 262, 3108, 284, 262, 4226, 3917, 351, 428, 6143, 628, 220, 220, 220, 220, 220, 220, 220, 1482, 38669, 2446, 11, 15427, 428, 318, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 26745, 220, 1303, 2099, 25, 8856, 198, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 6764, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 317, 6764, 286, 428, 289, 330, 268, 4763, 6246, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 11213, 13, 2617, 353, 220, 1303, 2099, 25, 8856, 198, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 6764, 7, 944, 11, 1188, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5345, 262, 6764, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 3613, 62, 41484, 7, 944, 11, 3280, 25, 19269, 62, 35, 18379, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 12793, 257, 2060, 3280, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 4296, 62, 28961, 7, 944, 11, 12429, 46265, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 10133, 13634, 6608, 1912, 319, 26286, 357, 68, 13, 70, 13, 6764, 2625, 31373, 995, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 651, 62, 41484, 7, 944, 11, 6167, 25, 965, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 6803, 510, 257, 2060, 3280, 416, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 4268, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 23520, 262, 6143, 628, 220, 220, 220, 220, 220, 220, 220, 1482, 38669, 2446, 11, 15427, 428, 318, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 198, 4871, 46722, 7, 24694, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 28703, 1586, 4560, 329, 1808, 3858, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 8543, 7, 944, 11, 2239, 11, 4732, 8, 4613, 19269, 62, 35, 18379, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 25235, 257, 1808, 284, 257, 3335, 11, 815, 1441, 257, 657, 12, 9186, 6167, 25, 8367, 8633, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198 ]
2.557353
680
#!/usr/bin/python # -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from logging import root, basicConfig import openbabel import sys import re import tempfile import os import codecs import md5 import compounddb.sdfiterator import string import random cur_dir = os.path.dirname(__file__) from compounddb.models import * basicConfig() inchiconv = openbabel.OBConversion() ######################### # sdf-related processings ######################### def get_sdf_tags(sdf): """parse the sdf tags""" tag_pattern = re.compile(""">\s+<([^>]+)>[^ ]* ([^>$]+)""") tags = tag_pattern.findall(sdf) tagdict = dict() # process each tag for (name, value) in tags: tagdict[name.strip()] = value.strip() return tagdict def parse_annotation(sdf, namekey): """ parse annotation from SDF file """ # parse the sdf tags moldata = get_sdf_tags(sdf) # --- inchi inchiconv.SetInAndOutFormats('sdf', 'Inchi') mol = openbabel.OBMol() res = inchiconv.ReadString(mol, codecs.encode(sdf, 'utf-8')) if mol.Empty(): root.warning(' --> ERROR on sdf') raise Exception # standard data generated # --- inchi/formula/weight moldata['inchi'] = inchiconv.WriteString(mol).strip() moldata['formula'] = mol.GetFormula() moldata['id'] = mol.GetTitle() if moldata['id'] == '': moldata['id'] = 'unspecified_' \ + ''.join(random.sample(string.digits, 6)) mol.AddHydrogens() moldata['weight'] = str(mol.GetMolWt()) # if the name is not in sdf: if not moldata.has_key(namekey): moldata[namekey] = '' # smiles inchiconv.SetInAndOutFormats('sdf', 'smi') mol = openbabel.OBMol() res = inchiconv.ReadString(mol, codecs.encode(sdf, 'utf-8')) if mol.Empty(): root.warning(' --> ERROR on sdf') raise Exception moldata['smiles'] = inchiconv.WriteString(mol).strip() return moldata ############################ # single compound operations ############################ def insert_single_compound( moldata, sdf, namekey, idkey, user, ): """ insert single compound into database """ cid = moldata[idkey] name = moldata[namekey] if '\n' in name: name = name.split('\n')[0] # compound c = Compound( cid=cid, name=name, formula=moldata['formula'], weight=moldata['weight'], inchi=moldata['inchi'], smiles=moldata['smiles'], user=user, ) # sdf_file=s) c.save() c_id = c.id root.warning(' -->new compound inserted: c_id=%s, cid=%s' % (c_id, cid)) # sdf file s = SDFFile(sdffile=sdf, compound=c) s.save() sdfid = s.id return c.id ##################################### # Physical Chemical Property - JOELib ##################################### def gen_joelib_property(sdf): """run and parse the property output """ # save the input in FS t = tempfile.NamedTemporaryFile(suffix='.sdf') t.write(codecs.encode(sdf, 'utf-8')) t.flush() # prepare the output file (f, out) = tempfile.mkstemp(suffix='.sdf') os.close(f) # convert cmd = \ """JAVA_HOME=/opt/jre/ JOELIB2=/opt/JOELib2-alpha-20070303/ /opt/JOELib2-alpha-20070303/moleculeConversion.sh +d +h -iSDF -osdf "%s" "%s" > /dev/null""" \ % (t.name, out) root.warning(' --> running:%s' % cmd) if os.system(cmd) != 0: os.unlink(out) raise 'cannot run JOELib' # read and parse f = file(out) tags = get_sdf_tags(codecs.decode(f.read(), 'utf-8')) f.close() # clean os.unlink(out) return tags ###### # MISC ###### def update_mw( lib_name, lib_ver, input, rev=False, ): """goal: to update MW value with hydrogen added .... when calculating JOELib .... 'rev': in ChemMineV2, some libraries got compound ID and compound name switched, like 'Aurora'""" import datetime begin = datetime.datetime.now() print 'starts at: %s' % begin library = get_library(lib_name, lib_ver) mw = PropertyField.objects.get(name='MW') fp = file(input) line1 = fp.readline() count = 1 for line in fp: (cid, weight) = line.strip().split('\t') try: if rev: c = Compound.objects.get(library=library, name=cid) else: c = Compound.objects.get(library=library, cid=cid) except Compound.DoesNotExist: print 'not found: line %s, cid=%s' % (count, cid) pass try: p = Property.objects.get(compound=c, field=mw) p.value = weight p.save() except Property.DoesNotExist: p = Property(field=mw, compound=c, value=weight) p.save() print 'new p for %s, line %s' % (cid, count) except: print '----->line %s, cid=%s' % (count, cid) pass count += 1 # print "%s: %s -> %s", (cid, old, weight) fp.close() end = datetime.datetime.now() print 'ends at: %s' % end return def del_duplicate_mw(lib_name, lib_ver): """some libraries has 2 mw """ library = get_library(lib_name, lib_ver) mw = PropertyField.objects.get(name='MW') for c in library.compound_set.all(): if c.property_set.filter(field=mw).count() == 2: c.property_set.filter(field=mw)[1].delete() return def fix_kegg_cid(): """some cid in KEGG still has '(noMol)', fix them""" library = get_library('KEGG', 0) count = 0 for c in library.compound_set.all(): if '(noMol)' in c.cid: old = c.cid print old c.cid = old.strip('(noMol)') c.save() count += 1 print '%s compounds updated with new cid' % count return def format_sdf_for_qsar(sdffile, output, ID_tag): """Cerius2 uses 1st line in SDF as ID tag .... some sdf has blank 1st line, so we need to format SDF .... by filling cid to 1st line in SDF""" fp = file(output, 'w') for sdf in sdfiterator.sdf_iter(sdffile): tagdict = get_sdf_tags(sdf) cid = tagdict[ID_tag] fp.write('%s\n' % cid) fp.write(sdf.split('\n', 1)[1].split('M END')[0]) fp.write('M END\n') fp.write('''> <%s> %s ''' % (ID_tag, cid)) fp.write('$$$$\n') fp.close() return
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 18931, 1330, 6808, 11, 4096, 16934, 198, 11748, 1280, 65, 9608, 198, 11748, 25064, 198, 11748, 302, 198, 11748, 20218, 7753, 198, 11748, 28686, 198, 11748, 40481, 82, 198, 11748, 45243, 20, 198, 11748, 13061, 9945, 13, 82, 7568, 48727, 198, 11748, 4731, 198, 11748, 4738, 198, 198, 22019, 62, 15908, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 8, 198, 198, 6738, 13061, 9945, 13, 27530, 1330, 1635, 198, 198, 35487, 16934, 3419, 198, 8589, 4749, 85, 796, 1280, 65, 9608, 13, 46, 2749, 261, 9641, 3419, 628, 198, 14468, 7804, 2, 198, 2, 264, 7568, 12, 5363, 1429, 654, 198, 14468, 7804, 2, 198, 198, 4299, 651, 62, 82, 7568, 62, 31499, 7, 82, 7568, 2599, 198, 220, 220, 220, 37227, 29572, 262, 264, 7568, 15940, 37811, 628, 220, 220, 220, 7621, 62, 33279, 796, 302, 13, 5589, 576, 7203, 1, 5320, 59, 82, 10, 27, 26933, 61, 37981, 28988, 36937, 61, 198, 60, 9, 198, 26933, 61, 29, 3, 60, 28988, 15931, 4943, 198, 220, 220, 220, 15940, 796, 7621, 62, 33279, 13, 19796, 439, 7, 82, 7568, 8, 198, 220, 220, 220, 7621, 11600, 796, 8633, 3419, 628, 220, 220, 220, 1303, 1429, 1123, 7621, 628, 220, 220, 220, 329, 357, 3672, 11, 1988, 8, 287, 15940, 25, 198, 220, 220, 220, 220, 220, 220, 220, 7621, 11600, 58, 3672, 13, 36311, 3419, 60, 796, 1988, 13, 36311, 3419, 198, 220, 220, 220, 1441, 7621, 11600, 628, 198, 4299, 21136, 62, 1236, 14221, 7, 82, 7568, 11, 1438, 2539, 2599, 198, 220, 220, 220, 37227, 21136, 23025, 422, 311, 8068, 2393, 37227, 628, 220, 220, 220, 1303, 21136, 262, 264, 7568, 15940, 628, 220, 220, 220, 15936, 1045, 796, 651, 62, 82, 7568, 62, 31499, 7, 82, 7568, 8, 628, 220, 220, 220, 1303, 11420, 287, 11072, 628, 220, 220, 220, 11111, 4749, 85, 13, 7248, 818, 1870, 7975, 8479, 1381, 10786, 82, 7568, 3256, 705, 818, 11072, 11537, 198, 220, 220, 220, 18605, 796, 1280, 65, 9608, 13, 9864, 44, 349, 3419, 198, 220, 220, 220, 581, 796, 11111, 4749, 85, 13, 5569, 10100, 7, 43132, 11, 40481, 82, 13, 268, 8189, 7, 82, 7568, 11, 705, 40477, 12, 23, 6, 4008, 198, 220, 220, 220, 611, 18605, 13, 40613, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 6808, 13, 43917, 10786, 220, 14610, 220, 33854, 319, 264, 7568, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 35528, 628, 220, 220, 220, 1303, 3210, 1366, 7560, 198, 220, 220, 220, 1303, 11420, 287, 11072, 14, 687, 4712, 14, 6551, 628, 220, 220, 220, 15936, 1045, 17816, 8589, 72, 20520, 796, 11111, 4749, 85, 13, 16594, 10100, 7, 43132, 737, 36311, 3419, 198, 220, 220, 220, 15936, 1045, 17816, 687, 4712, 20520, 796, 18605, 13, 3855, 8479, 4712, 3419, 198, 220, 220, 220, 15936, 1045, 17816, 312, 20520, 796, 18605, 13, 3855, 19160, 3419, 198, 220, 220, 220, 611, 15936, 1045, 17816, 312, 20520, 6624, 10148, 25, 198, 220, 220, 220, 220, 220, 220, 220, 15936, 1045, 17816, 312, 20520, 796, 705, 403, 23599, 62, 6, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 705, 4458, 22179, 7, 25120, 13, 39873, 7, 8841, 13, 12894, 896, 11, 718, 4008, 198, 220, 220, 220, 18605, 13, 4550, 40436, 48686, 3419, 198, 220, 220, 220, 15936, 1045, 17816, 6551, 20520, 796, 965, 7, 43132, 13, 3855, 44, 349, 54, 83, 28955, 628, 220, 220, 220, 1303, 611, 262, 1438, 318, 407, 287, 264, 7568, 25, 628, 220, 220, 220, 611, 407, 15936, 1045, 13, 10134, 62, 2539, 7, 3672, 2539, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 15936, 1045, 58, 3672, 2539, 60, 796, 10148, 628, 220, 220, 220, 1303, 21845, 628, 220, 220, 220, 11111, 4749, 85, 13, 7248, 818, 1870, 7975, 8479, 1381, 10786, 82, 7568, 3256, 705, 5796, 72, 11537, 198, 220, 220, 220, 18605, 796, 1280, 65, 9608, 13, 9864, 44, 349, 3419, 198, 220, 220, 220, 581, 796, 11111, 4749, 85, 13, 5569, 10100, 7, 43132, 11, 40481, 82, 13, 268, 8189, 7, 82, 7568, 11, 705, 40477, 12, 23, 6, 4008, 198, 220, 220, 220, 611, 18605, 13, 40613, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 6808, 13, 43917, 10786, 220, 14610, 220, 33854, 319, 264, 7568, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 35528, 198, 220, 220, 220, 15936, 1045, 17816, 5796, 2915, 20520, 796, 11111, 4749, 85, 13, 16594, 10100, 7, 43132, 737, 36311, 3419, 628, 220, 220, 220, 1441, 15936, 1045, 628, 198, 14468, 7804, 4242, 198, 2, 2060, 13061, 4560, 198, 14468, 7804, 4242, 628, 198, 4299, 7550, 62, 29762, 62, 5589, 633, 7, 198, 220, 220, 220, 15936, 1045, 11, 198, 220, 220, 220, 264, 7568, 11, 198, 220, 220, 220, 1438, 2539, 11, 198, 220, 220, 220, 4686, 2539, 11, 198, 220, 220, 220, 2836, 11, 198, 220, 220, 220, 15179, 198, 220, 220, 220, 37227, 7550, 2060, 13061, 656, 6831, 37227, 628, 220, 220, 220, 269, 312, 796, 15936, 1045, 58, 312, 2539, 60, 198, 220, 220, 220, 1438, 796, 15936, 1045, 58, 3672, 2539, 60, 198, 220, 220, 220, 611, 705, 59, 77, 6, 287, 1438, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 796, 1438, 13, 35312, 10786, 59, 77, 11537, 58, 15, 60, 628, 220, 220, 220, 1303, 13061, 628, 220, 220, 220, 269, 796, 3082, 633, 7, 198, 220, 220, 220, 220, 220, 220, 220, 269, 312, 28, 66, 312, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 28, 3672, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10451, 28, 76, 727, 1045, 17816, 687, 4712, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 3463, 28, 76, 727, 1045, 17816, 6551, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 287, 11072, 28, 76, 727, 1045, 17816, 8589, 72, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 21845, 28, 76, 727, 1045, 17816, 5796, 2915, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 2836, 28, 7220, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 264, 7568, 62, 7753, 28, 82, 8, 628, 220, 220, 220, 269, 13, 21928, 3419, 198, 220, 220, 220, 269, 62, 312, 796, 269, 13, 312, 198, 220, 220, 220, 6808, 13, 43917, 10786, 220, 14610, 3605, 13061, 18846, 25, 269, 62, 312, 28, 4, 82, 11, 269, 312, 28, 4, 82, 6, 4064, 357, 66, 62, 312, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 312, 4008, 628, 220, 220, 220, 1303, 264, 7568, 2393, 628, 220, 220, 220, 264, 796, 9834, 5777, 576, 7, 21282, 487, 576, 28, 82, 7568, 11, 13061, 28, 66, 8, 198, 220, 220, 220, 264, 13, 21928, 3419, 198, 220, 220, 220, 264, 7568, 312, 796, 264, 13, 312, 628, 220, 220, 220, 1441, 269, 13, 312, 628, 198, 29113, 4242, 2, 198, 2, 16331, 24872, 14161, 532, 32357, 3698, 571, 198, 29113, 4242, 2, 198, 198, 4299, 2429, 62, 7639, 417, 571, 62, 26745, 7, 82, 7568, 2599, 198, 220, 220, 220, 37227, 5143, 290, 21136, 262, 3119, 5072, 37227, 628, 220, 220, 220, 1303, 3613, 262, 5128, 287, 23324, 628, 220, 220, 220, 256, 796, 20218, 7753, 13, 45, 2434, 12966, 5551, 8979, 7, 37333, 844, 28, 4458, 82, 7568, 11537, 198, 220, 220, 220, 256, 13, 13564, 7, 19815, 721, 82, 13, 268, 8189, 7, 82, 7568, 11, 705, 40477, 12, 23, 6, 4008, 198, 220, 220, 220, 256, 13, 25925, 3419, 628, 220, 220, 220, 1303, 8335, 262, 5072, 2393, 628, 220, 220, 220, 357, 69, 11, 503, 8, 796, 20218, 7753, 13, 28015, 927, 79, 7, 37333, 844, 28, 4458, 82, 7568, 11537, 198, 220, 220, 220, 28686, 13, 19836, 7, 69, 8, 628, 220, 220, 220, 1303, 10385, 628, 220, 220, 220, 23991, 796, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 41, 10116, 32, 62, 39069, 33223, 8738, 14, 73, 260, 14, 32357, 3698, 9865, 17, 33223, 8738, 14, 45006, 3698, 571, 17, 12, 26591, 12, 2167, 2154, 22572, 14, 1220, 8738, 14, 45006, 3698, 571, 17, 12, 26591, 12, 2167, 2154, 22572, 14, 76, 2305, 23172, 3103, 9641, 13, 1477, 1343, 67, 1343, 71, 532, 72, 50, 8068, 532, 418, 7568, 36521, 82, 1, 36521, 82, 1, 1875, 1220, 7959, 14, 8423, 37811, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 4064, 357, 83, 13, 3672, 11, 503, 8, 198, 220, 220, 220, 6808, 13, 43917, 10786, 220, 14610, 220, 220, 2491, 25, 4, 82, 6, 4064, 23991, 8, 198, 220, 220, 220, 611, 28686, 13, 10057, 7, 28758, 8, 14512, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 28686, 13, 403, 8726, 7, 448, 8, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 705, 66, 34574, 1057, 32357, 3698, 571, 6, 628, 220, 220, 220, 1303, 1100, 290, 21136, 628, 220, 220, 220, 277, 796, 2393, 7, 448, 8, 198, 220, 220, 220, 15940, 796, 651, 62, 82, 7568, 62, 31499, 7, 19815, 721, 82, 13, 12501, 1098, 7, 69, 13, 961, 22784, 705, 40477, 12, 23, 6, 4008, 198, 220, 220, 220, 277, 13, 19836, 3419, 628, 220, 220, 220, 1303, 3424, 628, 220, 220, 220, 28686, 13, 403, 8726, 7, 448, 8, 198, 220, 220, 220, 1441, 15940, 628, 198, 4242, 2235, 198, 2, 337, 37719, 198, 4242, 2235, 198, 198, 4299, 4296, 62, 76, 86, 7, 198, 220, 220, 220, 9195, 62, 3672, 11, 198, 220, 220, 220, 9195, 62, 332, 11, 198, 220, 220, 220, 5128, 11, 198, 220, 220, 220, 2710, 28, 25101, 11, 198, 220, 220, 220, 15179, 198, 220, 220, 220, 37227, 35231, 25, 284, 4296, 29961, 1988, 351, 17669, 2087, 220, 198, 1106, 220, 220, 618, 26019, 32357, 3698, 571, 198, 1106, 220, 220, 705, 18218, 10354, 287, 12870, 24461, 53, 17, 11, 617, 12782, 1392, 13061, 4522, 290, 13061, 1438, 15293, 11, 588, 705, 32, 333, 5799, 6, 37811, 628, 220, 220, 220, 1330, 4818, 8079, 198, 220, 220, 220, 2221, 796, 4818, 8079, 13, 19608, 8079, 13, 2197, 3419, 198, 220, 220, 220, 3601, 705, 301, 5889, 379, 25, 4064, 82, 6, 4064, 2221, 628, 220, 220, 220, 5888, 796, 651, 62, 32016, 7, 8019, 62, 3672, 11, 9195, 62, 332, 8, 198, 220, 220, 220, 285, 86, 796, 14161, 15878, 13, 48205, 13, 1136, 7, 3672, 11639, 14326, 11537, 628, 220, 220, 220, 277, 79, 796, 2393, 7, 15414, 8, 198, 220, 220, 220, 1627, 16, 796, 277, 79, 13, 961, 1370, 3419, 628, 220, 220, 220, 954, 796, 352, 198, 220, 220, 220, 329, 1627, 287, 277, 79, 25, 198, 220, 220, 220, 220, 220, 220, 220, 357, 66, 312, 11, 3463, 8, 796, 1627, 13, 36311, 22446, 35312, 10786, 59, 83, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2710, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 796, 3082, 633, 13, 48205, 13, 1136, 7, 32016, 28, 32016, 11, 1438, 28, 66, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 796, 3082, 633, 13, 48205, 13, 1136, 7, 32016, 28, 32016, 11, 269, 312, 28, 66, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 3082, 633, 13, 13921, 3673, 3109, 396, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 705, 1662, 1043, 25, 1627, 4064, 82, 11, 269, 312, 28, 4, 82, 6, 4064, 357, 9127, 11, 269, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1208, 628, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 796, 14161, 13, 48205, 13, 1136, 7, 5589, 633, 28, 66, 11, 2214, 28, 76, 86, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 13, 8367, 796, 3463, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 13, 21928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 14161, 13, 13921, 3673, 3109, 396, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 796, 14161, 7, 3245, 28, 76, 86, 11, 13061, 28, 66, 11, 1988, 28, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 13, 21928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 705, 3605, 279, 329, 4064, 82, 11, 1627, 4064, 82, 6, 4064, 357, 66, 312, 11, 954, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 705, 650, 3784, 1370, 4064, 82, 11, 269, 312, 28, 4, 82, 6, 4064, 357, 9127, 11, 269, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1208, 628, 220, 220, 220, 220, 220, 220, 220, 954, 15853, 352, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 3601, 36521, 82, 25, 4064, 82, 4613, 4064, 82, 1600, 357, 66, 312, 11, 1468, 11, 3463, 8, 628, 220, 220, 220, 277, 79, 13, 19836, 3419, 628, 220, 220, 220, 886, 796, 4818, 8079, 13, 19608, 8079, 13, 2197, 3419, 198, 220, 220, 220, 3601, 705, 2412, 379, 25, 4064, 82, 6, 4064, 886, 628, 220, 220, 220, 1441, 628, 198, 4299, 1619, 62, 646, 489, 5344, 62, 76, 86, 7, 8019, 62, 3672, 11, 9195, 62, 332, 2599, 198, 220, 220, 220, 37227, 11246, 12782, 468, 362, 285, 86, 37227, 628, 220, 220, 220, 5888, 796, 651, 62, 32016, 7, 8019, 62, 3672, 11, 9195, 62, 332, 8, 198, 220, 220, 220, 285, 86, 796, 14161, 15878, 13, 48205, 13, 1136, 7, 3672, 11639, 14326, 11537, 628, 220, 220, 220, 329, 269, 287, 5888, 13, 5589, 633, 62, 2617, 13, 439, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 611, 269, 13, 26745, 62, 2617, 13, 24455, 7, 3245, 28, 76, 86, 737, 9127, 3419, 6624, 362, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 13, 26745, 62, 2617, 13, 24455, 7, 3245, 28, 76, 86, 38381, 16, 4083, 33678, 3419, 628, 220, 220, 220, 1441, 628, 198, 4299, 4259, 62, 365, 1130, 62, 66, 312, 33529, 198, 220, 220, 220, 37227, 11246, 269, 312, 287, 509, 7156, 38, 991, 468, 29513, 3919, 44, 349, 8, 3256, 4259, 606, 37811, 628, 220, 220, 220, 5888, 796, 651, 62, 32016, 10786, 42, 7156, 38, 3256, 657, 8, 628, 220, 220, 220, 954, 796, 657, 198, 220, 220, 220, 329, 269, 287, 5888, 13, 5589, 633, 62, 2617, 13, 439, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 611, 29513, 3919, 44, 349, 33047, 287, 269, 13, 66, 312, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1468, 796, 269, 13, 66, 312, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 1468, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 13, 66, 312, 796, 1468, 13, 36311, 10786, 7, 3919, 44, 349, 8, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 13, 21928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 954, 15853, 352, 628, 220, 220, 220, 3601, 705, 4, 82, 16439, 6153, 351, 649, 269, 312, 6, 4064, 954, 198, 220, 220, 220, 1441, 628, 198, 4299, 5794, 62, 82, 7568, 62, 1640, 62, 48382, 283, 7, 21282, 487, 576, 11, 5072, 11, 4522, 62, 12985, 2599, 198, 220, 220, 220, 37227, 34, 263, 3754, 17, 3544, 352, 301, 1627, 287, 311, 8068, 355, 4522, 7621, 198, 1106, 220, 220, 617, 264, 7568, 468, 9178, 352, 301, 1627, 11, 523, 356, 761, 284, 5794, 311, 8068, 198, 1106, 220, 220, 416, 12591, 269, 312, 284, 352, 301, 1627, 287, 311, 8068, 37811, 628, 220, 220, 220, 277, 79, 796, 2393, 7, 22915, 11, 705, 86, 11537, 198, 220, 220, 220, 329, 264, 7568, 287, 264, 7568, 48727, 13, 82, 7568, 62, 2676, 7, 21282, 487, 576, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 7621, 11600, 796, 651, 62, 82, 7568, 62, 31499, 7, 82, 7568, 8, 198, 220, 220, 220, 220, 220, 220, 220, 269, 312, 796, 7621, 11600, 58, 2389, 62, 12985, 60, 628, 220, 220, 220, 220, 220, 220, 220, 277, 79, 13, 13564, 10786, 4, 82, 59, 77, 6, 4064, 269, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 277, 79, 13, 13564, 7, 82, 7568, 13, 35312, 10786, 59, 77, 3256, 352, 38381, 16, 4083, 35312, 10786, 44, 220, 23578, 11537, 58, 15, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 277, 79, 13, 13564, 10786, 44, 220, 23578, 59, 77, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 277, 79, 13, 13564, 7, 7061, 44167, 1279, 4, 82, 29, 198, 4, 82, 198, 198, 7061, 6, 4064, 357, 2389, 62, 12985, 11, 269, 312, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 277, 79, 13, 13564, 10786, 36737, 59, 77, 11537, 628, 220, 220, 220, 277, 79, 13, 19836, 3419, 198, 220, 220, 220, 1441, 628, 628 ]
2.182121
2,998
# Generated by Django 3.1.14 on 2021-12-13 11:06 import django.db.models.deletion from django.db import migrations, models import reservation_units.models
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 1415, 319, 33448, 12, 1065, 12, 1485, 1367, 25, 3312, 198, 198, 11748, 42625, 14208, 13, 9945, 13, 27530, 13, 2934, 1616, 295, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 198, 198, 11748, 24048, 62, 41667, 13, 27530, 628 ]
3.038462
52
"""xtapi""" from fastapi import ( Query, Path, Body, Cookie, Header, Form, File, UploadFile, Request, Response, status, Depends, APIRouter, HTTPException, BackgroundTasks ) from .main import MainApp from .templates import Templates __all__ = [ 'Query', 'Path', 'Body', 'Cookie', 'Header', 'Form', 'File', 'UploadFile', 'status', 'Request', 'Response', 'Depends', 'APIRouter', 'HTTPException', 'BackgroundTasks', 'MainApp', 'Templates' ]
[ 37811, 742, 15042, 37811, 198, 6738, 3049, 15042, 1330, 357, 198, 220, 220, 220, 43301, 11, 198, 220, 220, 220, 10644, 11, 198, 220, 220, 220, 12290, 11, 198, 220, 220, 220, 39606, 11, 198, 220, 220, 220, 48900, 11, 198, 220, 220, 220, 5178, 11, 198, 220, 220, 220, 9220, 11, 198, 220, 220, 220, 36803, 8979, 11, 198, 220, 220, 220, 19390, 11, 198, 220, 220, 220, 18261, 11, 198, 220, 220, 220, 3722, 11, 198, 220, 220, 220, 2129, 2412, 11, 198, 220, 220, 220, 3486, 4663, 39605, 11, 198, 220, 220, 220, 14626, 16922, 11, 198, 220, 220, 220, 25353, 51, 6791, 198, 8, 198, 198, 6738, 764, 12417, 1330, 8774, 4677, 198, 6738, 764, 11498, 17041, 1330, 5825, 17041, 628, 198, 834, 439, 834, 796, 685, 198, 220, 220, 220, 705, 20746, 3256, 198, 220, 220, 220, 705, 15235, 3256, 198, 220, 220, 220, 705, 25842, 3256, 198, 220, 220, 220, 705, 34, 18055, 3256, 198, 220, 220, 220, 705, 39681, 3256, 198, 220, 220, 220, 705, 8479, 3256, 198, 220, 220, 220, 705, 8979, 3256, 198, 220, 220, 220, 705, 41592, 8979, 3256, 198, 220, 220, 220, 705, 13376, 3256, 198, 220, 220, 220, 705, 18453, 3256, 198, 220, 220, 220, 705, 31077, 3256, 198, 220, 220, 220, 705, 12156, 2412, 3256, 198, 220, 220, 220, 705, 2969, 4663, 39605, 3256, 198, 220, 220, 220, 705, 40717, 16922, 3256, 198, 220, 220, 220, 705, 21756, 51, 6791, 3256, 628, 220, 220, 220, 705, 13383, 4677, 3256, 198, 220, 220, 220, 705, 12966, 17041, 6, 198, 60, 198 ]
2.163498
263
from abc import ABC, ABCMeta from typing import Any from . import registry from tensortrade.core.context import TradingContext, Context from tensortrade.core.base import Identifiable class InitContextMeta(ABCMeta): """Metaclass that executes `__init__` of instance in its core. This class works with the `TradingContext` class to ensure the correct data is being given to the instance created by a concrete class that has subclassed `Component`. """ def __call__(cls, *args, **kwargs) -> 'InitContextMeta': """ Parameters ---------- args : positional arguments to give constructor of subclass of `Component` kwargs : keyword arguments to give constructor of subclass of `Component` Returns ------- `Component` An instance of a concrete class the subclasses `Component` """ context = TradingContext.get_context() registered_name = registry.registry()[cls] data = context.data.get(registered_name, {}) config = {**context.shared, **data} instance = cls.__new__(cls, *args, **kwargs) setattr(instance, 'context', Context(**config)) instance.__init__(*args, **kwargs) return instance class ContextualizedMixin(object): """A mixin that is to be mixed with any class that must function in a contextual setting. """ @property def context(self) -> Context: """Gets the `Context` the object is under. Returns ------- `Context` The context the object is under. """ return self._context @context.setter def context(self, context: Context) -> None: """Sets the context for the object. Parameters ---------- context : `Context` The context to set for the object. """ self._context = context class Component(ABC, ContextualizedMixin, Identifiable, metaclass=InitContextMeta): """The main class for setting up components to be used in the `TradingEnv`. This class if responsible for providing a common way in which different components of the library can be created. Specifically, it enables the creation of components from a `TradingContext`. Therefore making the creation of complex environments simpler where there are only a few things that need to be changed from case to case. Attributes ---------- registered_name : str The name under which constructor arguments are to be given in a dictionary and passed to a `TradingContext`. """ registered_name = None def __init_subclass__(cls, **kwargs) -> None: """Constructs the concrete subclass of `Component`. In constructing the subclass, the concrete subclass is also registered into the project level registry. Parameters ---------- kwargs : keyword arguments The keyword arguments to be provided to the concrete subclass of `Component` to create an instance. """ super().__init_subclass__(**kwargs) if cls not in registry.registry(): registry.register(cls, cls.registered_name) def default(self, key: str, value: Any, kwargs: dict = None) -> Any: """Resolves which defaults value to use for construction. A concrete subclass will use this method to resolve which default value it should use when creating an instance. The default value should go to the value specified for the variable within the `TradingContext`. If that one is not provided it will resolve to `value`. Parameters ---------- key : str The name of the attribute to be resolved for the class. value : any The `value` the attribute should be set to if not provided in the `TradingContext`. kwargs : dict, optional The dictionary to search through for the value associated with `key`. """ if not kwargs: return self.context.get(key, None) or value return self.context.get(key, None) or kwargs.get(key, value)
[ 198, 6738, 450, 66, 1330, 9738, 11, 9738, 48526, 198, 6738, 19720, 1330, 4377, 198, 198, 6738, 764, 1330, 20478, 198, 6738, 11192, 419, 27585, 13, 7295, 13, 22866, 1330, 25469, 21947, 11, 30532, 198, 6738, 11192, 419, 27585, 13, 7295, 13, 8692, 1330, 11440, 16823, 628, 198, 4871, 44707, 21947, 48526, 7, 24694, 48526, 2599, 198, 220, 220, 220, 37227, 9171, 330, 31172, 326, 42985, 4600, 834, 15003, 834, 63, 286, 4554, 287, 663, 4755, 13, 628, 220, 220, 220, 770, 1398, 2499, 351, 262, 4600, 2898, 4980, 21947, 63, 1398, 284, 4155, 262, 3376, 198, 220, 220, 220, 1366, 318, 852, 1813, 284, 262, 4554, 2727, 416, 257, 10017, 1398, 326, 468, 198, 220, 220, 220, 47611, 276, 4600, 21950, 44646, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 11593, 13345, 834, 7, 565, 82, 11, 1635, 22046, 11, 12429, 46265, 22046, 8, 4613, 705, 31768, 21947, 48526, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 26498, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 45203, 7159, 284, 1577, 23772, 286, 47611, 286, 4600, 21950, 63, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21179, 7159, 284, 1577, 23772, 286, 47611, 286, 4600, 21950, 63, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 220, 220, 220, 35656, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 21950, 63, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1052, 4554, 286, 257, 10017, 1398, 262, 850, 37724, 4600, 21950, 63, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 4732, 796, 25469, 21947, 13, 1136, 62, 22866, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 6823, 62, 3672, 796, 20478, 13, 2301, 4592, 3419, 58, 565, 82, 60, 628, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 4732, 13, 7890, 13, 1136, 7, 33736, 62, 3672, 11, 23884, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4566, 796, 1391, 1174, 22866, 13, 28710, 11, 12429, 7890, 92, 628, 220, 220, 220, 220, 220, 220, 220, 4554, 796, 537, 82, 13, 834, 3605, 834, 7, 565, 82, 11, 1635, 22046, 11, 12429, 46265, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 900, 35226, 7, 39098, 11, 705, 22866, 3256, 30532, 7, 1174, 11250, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 4554, 13, 834, 15003, 834, 46491, 22046, 11, 12429, 46265, 22046, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 4554, 628, 198, 4871, 30532, 723, 1143, 35608, 259, 7, 15252, 2599, 198, 220, 220, 220, 37227, 32, 5022, 259, 326, 318, 284, 307, 7668, 351, 597, 1398, 326, 1276, 2163, 287, 257, 198, 220, 220, 220, 38356, 4634, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 4732, 7, 944, 8, 4613, 30532, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 38, 1039, 262, 4600, 21947, 63, 262, 2134, 318, 739, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 220, 220, 220, 35656, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 21947, 63, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 4732, 262, 2134, 318, 739, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 22866, 628, 220, 220, 220, 2488, 22866, 13, 2617, 353, 198, 220, 220, 220, 825, 4732, 7, 944, 11, 4732, 25, 30532, 8, 4613, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 50, 1039, 262, 4732, 329, 262, 2134, 13, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 4732, 1058, 4600, 21947, 63, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 4732, 284, 900, 329, 262, 2134, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 22866, 796, 4732, 628, 198, 4871, 35100, 7, 24694, 11, 30532, 723, 1143, 35608, 259, 11, 11440, 16823, 11, 1138, 330, 31172, 28, 31768, 21947, 48526, 2599, 198, 220, 220, 220, 37227, 464, 1388, 1398, 329, 4634, 510, 6805, 284, 307, 973, 287, 262, 4600, 2898, 4980, 4834, 85, 44646, 628, 220, 220, 220, 770, 1398, 611, 4497, 329, 4955, 257, 2219, 835, 287, 543, 1180, 198, 220, 220, 220, 6805, 286, 262, 5888, 460, 307, 2727, 13, 22426, 11, 340, 13536, 262, 198, 220, 220, 220, 6282, 286, 6805, 422, 257, 4600, 2898, 4980, 21947, 44646, 8447, 1642, 262, 6282, 198, 220, 220, 220, 286, 3716, 12493, 18599, 810, 612, 389, 691, 257, 1178, 1243, 326, 198, 220, 220, 220, 761, 284, 307, 3421, 422, 1339, 284, 1339, 13, 628, 220, 220, 220, 49213, 198, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 6823, 62, 3672, 1058, 965, 198, 220, 220, 220, 220, 220, 220, 220, 383, 1438, 739, 543, 23772, 7159, 389, 284, 307, 1813, 287, 257, 22155, 198, 220, 220, 220, 220, 220, 220, 220, 290, 3804, 284, 257, 4600, 2898, 4980, 21947, 44646, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 6823, 62, 3672, 796, 6045, 628, 220, 220, 220, 825, 11593, 15003, 62, 7266, 4871, 834, 7, 565, 82, 11, 12429, 46265, 22046, 8, 4613, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 42316, 82, 262, 10017, 47611, 286, 4600, 21950, 44646, 628, 220, 220, 220, 220, 220, 220, 220, 554, 30580, 262, 47611, 11, 262, 10017, 47611, 318, 635, 6823, 198, 220, 220, 220, 220, 220, 220, 220, 656, 262, 1628, 1241, 20478, 13, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 1058, 21179, 7159, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 21179, 7159, 284, 307, 2810, 284, 262, 10017, 47611, 286, 4600, 21950, 63, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 284, 2251, 281, 4554, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 62, 7266, 4871, 834, 7, 1174, 46265, 22046, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 537, 82, 407, 287, 20478, 13, 2301, 4592, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20478, 13, 30238, 7, 565, 82, 11, 537, 82, 13, 33736, 62, 3672, 8, 628, 220, 220, 220, 825, 4277, 7, 944, 11, 1994, 25, 965, 11, 1988, 25, 4377, 11, 479, 86, 22046, 25, 8633, 796, 6045, 8, 4613, 4377, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 4965, 9010, 543, 26235, 1988, 284, 779, 329, 5103, 13, 628, 220, 220, 220, 220, 220, 220, 220, 317, 10017, 47611, 481, 779, 428, 2446, 284, 10568, 543, 4277, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 340, 815, 779, 618, 4441, 281, 4554, 13, 383, 4277, 1988, 815, 467, 284, 198, 220, 220, 220, 220, 220, 220, 220, 262, 1988, 7368, 329, 262, 7885, 1626, 262, 4600, 2898, 4980, 21947, 44646, 1002, 326, 198, 220, 220, 220, 220, 220, 220, 220, 530, 318, 407, 2810, 340, 481, 10568, 284, 4600, 8367, 44646, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 1994, 1058, 965, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 1438, 286, 262, 11688, 284, 307, 12939, 329, 262, 1398, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1988, 1058, 597, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 4600, 8367, 63, 262, 11688, 815, 307, 900, 284, 611, 407, 2810, 287, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4600, 2898, 4980, 21947, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 1058, 8633, 11, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 22155, 284, 2989, 832, 329, 262, 1988, 3917, 351, 4600, 2539, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 479, 86, 22046, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 22866, 13, 1136, 7, 2539, 11, 6045, 8, 393, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 22866, 13, 1136, 7, 2539, 11, 6045, 8, 393, 479, 86, 22046, 13, 1136, 7, 2539, 11, 1988, 8, 198 ]
2.787599
1,516
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import sqrt from math import sin # 函数作为参数传入 # 使用可变参数 print(same(3, abs, sqrt, sin)) print(do_fun([1, 2, 4, 9], abs, sqrt, sin))
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 10688, 1330, 19862, 17034, 198, 6738, 10688, 1330, 7813, 198, 198, 2, 10263, 229, 121, 46763, 108, 43291, 10310, 118, 20998, 224, 46763, 108, 27670, 254, 17739, 98, 198, 2, 220, 45635, 18796, 101, 20998, 107, 20998, 246, 20998, 224, 46763, 108, 198, 198, 4798, 7, 31642, 7, 18, 11, 2352, 11, 19862, 17034, 11, 7813, 4008, 198, 4798, 7, 4598, 62, 12543, 26933, 16, 11, 362, 11, 604, 11, 860, 4357, 2352, 11, 19862, 17034, 11, 7813, 4008 ]
1.780952
105
from selenium import webdriver import time try: # link = "http://suninjuly.github.io/registration1.html" link = "http://suninjuly.github.io/registration2.html" browser = webdriver.Chrome() browser.get(link) # Ваш код, который заполняет обязательные поля input_first_name = browser.find_element_by_tag_name("input") input_first_name.send_keys("Ivan") input_last_name = browser.find_element_by_css_selector('input[placeholder="Input your last name"]') input_last_name.send_keys("Petrov") input_email = browser.find_element_by_css_selector("[placeholder='Input your email']") input_email.send_keys("[email protected]") # Отправляем заполненную форму button = browser.find_element_by_css_selector("button.btn") button.click() # Проверяем, что смогли зарегистрироваться # ждем загрузки страницы time.sleep(3) # находим элемент, содержащий текст welcome_text_elt = browser.find_element_by_tag_name("h1") # записываем в переменную welcome_text текст из элемента welcome_text_elt welcome_text = welcome_text_elt.text # с помощью assert проверяем, что ожидаемый текст совпадает с текстом на странице сайта assert "Congratulations! You have successfully registered!" == welcome_text print("Тест успешно завершен. 10 сек на закрытие браузера...") finally: # ожидание чтобы визуально оценить результаты прохождения скрипта time.sleep(10) # закрываем браузер после всех манипуляций browser.close() time.sleep(2) browser.quit()
[ 6738, 384, 11925, 1505, 1330, 3992, 26230, 198, 11748, 640, 198, 198, 28311, 25, 220, 198, 220, 220, 220, 1303, 2792, 796, 366, 4023, 1378, 19155, 259, 73, 2062, 13, 12567, 13, 952, 14, 2301, 33397, 16, 13, 6494, 1, 198, 220, 220, 220, 2792, 796, 366, 4023, 1378, 19155, 259, 73, 2062, 13, 12567, 13, 952, 14, 2301, 33397, 17, 13, 6494, 1, 198, 220, 220, 220, 6444, 796, 3992, 26230, 13, 1925, 5998, 3419, 198, 220, 220, 220, 6444, 13, 1136, 7, 8726, 8, 628, 220, 220, 220, 1303, 12466, 240, 16142, 141, 230, 12466, 118, 25443, 112, 11, 12466, 118, 15166, 20375, 15166, 21169, 45035, 140, 117, 12466, 115, 16142, 140, 123, 25443, 119, 22177, 40623, 16843, 20375, 12466, 122, 140, 109, 40623, 140, 115, 16142, 20375, 16843, 30143, 45367, 22177, 45035, 16843, 12466, 123, 25443, 119, 40623, 198, 220, 220, 220, 5128, 62, 11085, 62, 3672, 796, 6444, 13, 19796, 62, 30854, 62, 1525, 62, 12985, 62, 3672, 7203, 15414, 4943, 198, 220, 220, 220, 5128, 62, 11085, 62, 3672, 13, 21280, 62, 13083, 7203, 40, 10438, 4943, 198, 220, 220, 220, 5128, 62, 12957, 62, 3672, 796, 6444, 13, 19796, 62, 30854, 62, 1525, 62, 25471, 62, 19738, 273, 10786, 15414, 58, 5372, 13829, 2625, 20560, 534, 938, 1438, 8973, 11537, 198, 220, 220, 220, 5128, 62, 12957, 62, 3672, 13, 21280, 62, 13083, 7203, 25803, 18657, 4943, 198, 220, 220, 220, 5128, 62, 12888, 796, 6444, 13, 19796, 62, 30854, 62, 1525, 62, 25471, 62, 19738, 273, 7203, 58, 5372, 13829, 11639, 20560, 534, 3053, 20520, 4943, 198, 220, 220, 220, 5128, 62, 12888, 13, 21280, 62, 13083, 7203, 9288, 31, 4529, 13, 785, 4943, 628, 220, 220, 220, 1303, 12466, 252, 20375, 140, 123, 21169, 16142, 38857, 30143, 40623, 16843, 43108, 12466, 115, 16142, 140, 123, 25443, 119, 22177, 16843, 22177, 22177, 35072, 141, 236, 220, 141, 226, 15166, 21169, 43108, 35072, 198, 220, 220, 220, 4936, 796, 6444, 13, 19796, 62, 30854, 62, 1525, 62, 25471, 62, 19738, 273, 7203, 16539, 13, 46118, 4943, 198, 220, 220, 220, 4936, 13, 12976, 3419, 628, 220, 220, 220, 1303, 12466, 253, 21169, 25443, 110, 16843, 21169, 40623, 16843, 43108, 11, 220, 141, 229, 20375, 15166, 220, 21727, 43108, 25443, 111, 30143, 18849, 12466, 115, 16142, 21169, 16843, 140, 111, 18849, 21727, 20375, 21169, 18849, 21169, 25443, 110, 16142, 20375, 45367, 21727, 40623, 198, 220, 220, 220, 1303, 12466, 114, 43666, 16843, 43108, 12466, 115, 16142, 140, 111, 21169, 35072, 140, 115, 31583, 18849, 220, 21727, 20375, 21169, 16142, 22177, 18849, 141, 228, 45035, 198, 220, 220, 220, 640, 13, 42832, 7, 18, 8, 628, 220, 220, 220, 1303, 12466, 121, 16142, 141, 227, 25443, 112, 18849, 43108, 220, 141, 235, 30143, 16843, 43108, 16843, 22177, 20375, 11, 220, 21727, 25443, 112, 16843, 21169, 140, 114, 16142, 141, 231, 18849, 140, 117, 220, 20375, 16843, 31583, 21727, 20375, 198, 220, 220, 220, 7062, 62, 5239, 62, 2120, 796, 6444, 13, 19796, 62, 30854, 62, 1525, 62, 12985, 62, 3672, 7203, 71, 16, 4943, 198, 220, 220, 220, 1303, 12466, 115, 16142, 140, 123, 18849, 21727, 45035, 38857, 16142, 16843, 43108, 12466, 110, 12466, 123, 16843, 21169, 16843, 43108, 16843, 22177, 22177, 35072, 141, 236, 7062, 62, 5239, 220, 20375, 16843, 31583, 21727, 20375, 12466, 116, 140, 115, 220, 141, 235, 30143, 16843, 43108, 16843, 22177, 20375, 16142, 7062, 62, 5239, 62, 2120, 198, 220, 220, 220, 7062, 62, 5239, 796, 7062, 62, 5239, 62, 2120, 13, 5239, 628, 220, 220, 220, 1303, 220, 21727, 12466, 123, 25443, 120, 15166, 141, 231, 45367, 141, 236, 6818, 12466, 123, 21169, 25443, 110, 16843, 21169, 40623, 16843, 43108, 11, 220, 141, 229, 20375, 15166, 12466, 122, 140, 114, 18849, 43666, 16142, 16843, 43108, 45035, 140, 117, 220, 20375, 16843, 31583, 21727, 20375, 220, 21727, 25443, 110, 140, 123, 16142, 43666, 16142, 16843, 20375, 220, 21727, 220, 20375, 16843, 31583, 21727, 20375, 25443, 120, 12466, 121, 16142, 220, 21727, 20375, 21169, 16142, 22177, 18849, 141, 228, 16843, 220, 21727, 16142, 140, 117, 20375, 16142, 198, 220, 220, 220, 6818, 366, 45048, 0, 921, 423, 7675, 6823, 2474, 6624, 7062, 62, 5239, 198, 220, 220, 220, 3601, 7203, 140, 95, 16843, 21727, 20375, 220, 35072, 21727, 140, 123, 16843, 141, 230, 22177, 15166, 12466, 115, 16142, 38857, 16843, 21169, 141, 230, 16843, 22177, 13, 838, 220, 21727, 16843, 31583, 12466, 121, 16142, 12466, 115, 16142, 31583, 21169, 45035, 20375, 18849, 16843, 12466, 109, 21169, 16142, 35072, 140, 115, 16843, 21169, 16142, 9313, 8, 198, 198, 69, 3289, 25, 198, 220, 220, 220, 1303, 12466, 122, 140, 114, 18849, 43666, 16142, 22177, 18849, 16843, 220, 141, 229, 20375, 25443, 109, 45035, 12466, 110, 18849, 140, 115, 35072, 16142, 30143, 45367, 22177, 15166, 12466, 122, 141, 228, 16843, 22177, 18849, 20375, 45367, 220, 21169, 16843, 140, 115, 35072, 30143, 45367, 20375, 16142, 20375, 45035, 12466, 123, 21169, 15166, 141, 227, 25443, 114, 43666, 16843, 22177, 18849, 40623, 220, 21727, 31583, 21169, 18849, 140, 123, 20375, 16142, 198, 220, 220, 220, 640, 13, 42832, 7, 940, 8, 198, 220, 220, 220, 1303, 12466, 115, 16142, 31583, 21169, 45035, 38857, 16142, 16843, 43108, 12466, 109, 21169, 16142, 35072, 140, 115, 16843, 21169, 12466, 123, 15166, 21727, 30143, 16843, 12466, 110, 21727, 16843, 141, 227, 12466, 120, 16142, 22177, 18849, 140, 123, 35072, 30143, 40623, 141, 228, 18849, 140, 117, 198, 220, 220, 220, 6444, 13, 19836, 3419, 198, 220, 220, 220, 640, 13, 42832, 7, 17, 8, 198, 220, 220, 220, 6444, 13, 47391, 3419 ]
1.668838
921
import numpy as np # https://gist.github.com/bwhite/3726239
[ 11748, 299, 32152, 355, 45941, 628, 198, 2, 3740, 1378, 70, 396, 13, 12567, 13, 785, 14, 65, 11186, 14, 2718, 2075, 23516, 628, 628, 198 ]
2.538462
26
from kfp.v2.dsl import ( component, Input, Output, Dataset, Artifact, HTML, ) @component( packages_to_install=[ "dask[dataframe]==2021.12.0", "gcsfs==2021.11.1"] )
[ 6738, 479, 46428, 13, 85, 17, 13, 67, 6649, 1330, 357, 198, 220, 220, 220, 7515, 11, 198, 220, 220, 220, 23412, 11, 198, 220, 220, 220, 25235, 11, 198, 220, 220, 220, 16092, 292, 316, 11, 198, 220, 220, 220, 45908, 11, 198, 220, 220, 220, 11532, 11, 198, 8, 198, 198, 31, 42895, 7, 198, 220, 220, 220, 10392, 62, 1462, 62, 17350, 41888, 198, 220, 220, 220, 220, 220, 220, 220, 366, 67, 2093, 58, 7890, 14535, 60, 855, 1238, 2481, 13, 1065, 13, 15, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 366, 70, 6359, 9501, 855, 1238, 2481, 13, 1157, 13, 16, 8973, 198, 8, 198, 220, 220, 220, 220, 198 ]
1.82906
117
import logging GROUP_SEPARATOR = f"{'-' * 10}" N_TEAMS = 42 N_MEMBERS = 3 N_TEAMS_MAX = 50 N_MEMBERS_MAX = 15 BODY_TEAMS_KEY = 'teams' BODY_ERRORS_KEY = 'errors' ERROR_TAG = 'Error' ERROR_MAX_MSG = f"User input Error. Maximum {N_TEAMS_MAX} teams and {N_MEMBERS_MAX} members for team. " \ f"Values must be numbers!" ERROR_NOT_ENOUGH_MSG = 'Not enough Characters to generate this team' CALC_TEAM_MEMBER_MAX_TRIES = 100 ERROR_MAX_TRIES_MSG = f"Max tries exceeded while choosing a team member: {CALC_TEAM_MEMBER_MAX_TRIES}. Name: %s" LOGGER_FORMAT = '%(asctime)s %(levelname)s %(name)s: %(message)s' logging.basicConfig(format=LOGGER_FORMAT) log = logging.getLogger(__name__) log.setLevel(logging.DEBUG)
[ 11748, 18931, 628, 198, 46846, 62, 5188, 27082, 25633, 796, 277, 1, 90, 6, 19355, 1635, 838, 36786, 198, 45, 62, 9328, 40834, 796, 5433, 198, 45, 62, 44, 3620, 33, 4877, 796, 513, 198, 198, 45, 62, 9328, 40834, 62, 22921, 796, 2026, 198, 45, 62, 44, 3620, 33, 4877, 62, 22921, 796, 1315, 198, 198, 33, 33076, 62, 9328, 40834, 62, 20373, 796, 705, 660, 4105, 6, 198, 33, 33076, 62, 24908, 50, 62, 20373, 796, 705, 48277, 6, 198, 198, 24908, 62, 42197, 796, 705, 12331, 6, 198, 24908, 62, 22921, 62, 5653, 38, 796, 277, 1, 12982, 5128, 13047, 13, 22246, 1391, 45, 62, 9328, 40834, 62, 22921, 92, 3466, 290, 1391, 45, 62, 44, 3620, 33, 4877, 62, 22921, 92, 1866, 329, 1074, 13, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 1, 40161, 1276, 307, 3146, 2474, 198, 24908, 62, 11929, 62, 1677, 32632, 62, 5653, 38, 796, 705, 3673, 1576, 26813, 284, 7716, 428, 1074, 6, 198, 198, 34, 1847, 34, 62, 9328, 2390, 62, 44, 28952, 62, 22921, 62, 5446, 11015, 796, 1802, 198, 24908, 62, 22921, 62, 5446, 11015, 62, 5653, 38, 796, 277, 1, 11518, 8404, 20672, 981, 11236, 257, 1074, 2888, 25, 1391, 34, 1847, 34, 62, 9328, 2390, 62, 44, 28952, 62, 22921, 62, 5446, 11015, 27422, 6530, 25, 4064, 82, 1, 198, 198, 25294, 30373, 62, 21389, 1404, 796, 705, 4, 7, 292, 310, 524, 8, 82, 4064, 7, 5715, 3672, 8, 82, 4064, 7, 3672, 8, 82, 25, 4064, 7, 20500, 8, 82, 6, 198, 6404, 2667, 13, 35487, 16934, 7, 18982, 28, 25294, 30373, 62, 21389, 1404, 8, 198, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 198, 6404, 13, 2617, 4971, 7, 6404, 2667, 13, 30531, 8, 198 ]
2.339806
309
import matplotlib as mpl import matplotlib.pyplot as plt import multiprocessing as multi import numpy as np import os import pandas as pd import pmagpy import pmagpy.ipmag as ipmag import pmagpy.pmag as pmag import pmagpy.pmagplotlib as pmagplotlib import re import scipy.integrate as integrate import scipy.stats as stats import seaborn as sns import SPD.lib.leastsq_jacobian as lib_k import sys from datetime import datetime as dt from importlib import reload from multiprocessing import Pool from scipy.stats import linregress def find_best_API_portion_r(combinedRegs1,minFrac,minR,minSlopeT,maxSlopeT): """ Finds the best portion for NRM-TRM1* and TRM1-TRM2* plots by r criteria of Yamamoto+2003 (1) calculate API statistics for all possible coercivity intervals (2) discard the statistics not satisfying the usual selection criteria (when applicable) omitted - (3) sort the statistics by dAPI (rel. departure from the expected API), and select the best 10 statistics (4) sort the statistics by frac_n, and select the best one Curvature (k) calculation is made by the code for Arai plot by Lisa. This is done for inverterd-X (e.g. -TRM1, -ARM1, ..) and original-Y (e.g. NRM, ARM0, ..). The inverted-X is offset (positive) to zero as a minimum. revised 2021/09/06 __________ combinedRegs1 : combined API parameters minFrac,minR,minSlopeT,maxSlopeT : thresholds for the r criteria Returns ______ trm1_star_min trm1_star_max trm2_star_min trm2_star_max """ print('[criteria, 2nd heating]') # screened=combinedRegs1[combinedRegs1.frac_t>=minFrac] if (len(screened)>0): print(' Frac_t >=', minFrac, ': ', len(screened),'step-combinations') else: print(' Frac_t >=', minFrac, ': no step-combinations satisfied') screened=combinedRegs1 # screened2=screened[screened.r_t>=minR] if (len(screened2)>0): print(' r_t >=', minR, ': ', len(screened2),'step-combinations') screened=screened2 else: print(' r_t >=', minR, ': no step-combinations satisfied') # screened3=screened[(screened.slope_t>=minSlopeT)\ &(screened.slope_t<=maxSlopeT)] if (len(screened3)>0): print(' ', minSlopeT, '<= slope_t <=', maxSlopeT, \ ': ', len(screened3),'step-combinations') screened=screened3 else: print(' ', minSlopeT, '<= slope_t <=', maxSlopeT, \ ': no step-combinations satisfied') # print('[criteria, 1st heating]') # screened4=screened[screened.frac_n>=minFrac] if (len(screened4)>0): print(' Frac_n >=', minFrac, ': ', len(screened4),'step-combinations') screened=screened4 else: print(' Frac_n >=', minFrac, ': no step-combinations satisfied') # screened5=screened[screened.r_n>=minR] if (len(screened5)>0): print(' r_n >=', minR, ': ', len(screened5),'step-combinations') screened=screened5 else: print(' r_n >=', minR, ': no step-combinations satisfied') ## sort by dAPI, then select top 10 #print('[sort by dAPI and select the top 10 data]') #screened=screened.sort_values('dAPI') #screened=screened.iloc[:10] # # sort by frac_n, then select the best print('[sort by frac_n and select the best step-combination]') screened=screened.sort_values('frac_n', ascending=False) screened_best_fn=screened.iloc[:1] #print(screened) trm2_star_min=screened_best_fn['step_min_t'].iloc[0] trm2_star_max=screened_best_fn['step_max'].iloc[0] trm1_star_min=screened_best_fn['step_min_n'].iloc[0] trm1_star_max=screened_best_fn['step_max'].iloc[0] # return trm1_star_min, trm1_star_max, trm2_star_min, trm2_star_max, screened def find_best_API_portion_k(combinedRegs1,maxBeta,maxFresid,maxKrv): """ Finds the best portion for NRM-TRM1* and TRM1-TRM2* plots by k' criteria of Lloyd+2021 (1) calculate API statistics for all possible coercivity intervals (2) discard the statistics not satisfying the Beta criterion (0.1) and the k' criterion (0.2) omitted - (3) sort the statistics by dAPI (rel. departure from the expected API), and select the best 10 statistics (4) sort the statistics by frac_n, and select the best one __________ combinedRegs1 : combined API parameters minFrac,minR,minSlopeT,maxSlopeT : thresholds for the r criteria Returns ______ trm1_star_min trm1_star_max trm2_star_min trm2_star_max """ print('[criteria, 2nd heating]') screened=combinedRegs1 # #screened=combinedRegs1[combinedRegs1.frac_t>=minFrac] #if (len(screened)>0): # print(' Frac_t >=', minFrac, ': ', len(screened),'step-combinations') #else: # print(' Frac_t >=', minFrac, ': no step-combinations satisfied') # screened=combinedRegs1 ## #screened2=screened[screened.krvd_t<=maxKrv] #if (len(screened2)>0): # print(' k\' <=', maxKrv, ': ', len(screened2),'step-combinations') # screened=screened2 #else: # print(' k\' <=', maxKrv, ': no step-combinations satisfied') ## #screened3=screened[(screened.slope_t>=minSlopeT)\ # &(screened.slope_t<=maxSlopeT)] #if (len(screened3)>0): # print(' ', minSlopeT, '<= slope_t <=', maxSlopeT, \ # ': ', len(screened3),'step-combinations') # screened=screened3 #else: # print(' ', minSlopeT, '<= slope_t <=', maxSlopeT, \ # ': no step-combinations satisfied') ## print('[criteria, 1st heating]') # #screened4=screened[screened.frac_n>=minFrac] #if (len(screened4)>0): # print(' Frac_n >=', minFrac, ': ', len(screened4),'step-combinations') # screened=screened4 #else: # print(' Frac_n >=', minFrac, ': no step-combinations satisfied') # screened5=screened[screened.beta_n<=maxBeta] if (len(screened5)>0): print(' beta <=', maxBeta, ': ', len(screened5),'step-combinations') screened=screened5 else: print(' beta <=', maxBeta, ': no step-combinations satisfied') # screened6=screened[screened.f_resid_n<=maxFresid] if (len(screened6)>0): print(' f_resid <=', maxBeta, ': ', len(screened6),'step-combinations') screened=screened6 else: print(' f_resid <=', maxBeta, ': no step-combinations satisfied') # screened7=screened[abs(screened.krvd_n)<=maxKrv] if (len(screened7)>0): print(' abs_k\' <=', maxKrv, ': ', len(screened7),'step-combinations') screened=screened7 else: print(' abs_k\' <=', maxKrv, ': no step-combinations satisfied') ## sort by dAPI, then select top 10 #print('[sort by dAPI and select the top 10 data]') #screened=screened.sort_values('dAPI') #screened=screened.iloc[:10] # sort by frac_n, then select the best print('[sort by frac_n and select the best step-combination]') screened=screened.sort_values('frac_n', ascending=False) screened_fn=screened.iloc[:1] #print(screened) trm2_star_min=screened_fn['step_min_t'].iloc[0] trm2_star_max=screened_fn['step_max'].iloc[0] trm1_star_min=screened_fn['step_min_n'].iloc[0] trm1_star_max=screened_fn['step_max'].iloc[0] # return trm1_star_min, trm1_star_max, trm2_star_min, trm2_star_max, screened def find_mdf(df): """ Finds the median destructive field for AF demag data Parameters __________ df : dataframe of measurements Returns ______ mdf : median destructive field """ mdf_df=df[df.meas_norm<=0.5] mdf_high=mdf_df.treat_ac_field_mT.values[0] mdf_df=df[df.meas_norm>=0.5] mdf_low=mdf_df.treat_ac_field_mT.values[-1] mdf=int(0.5*(mdf_high+mdf_low)) return mdf def set_ARM_data(df,rem_type): """ choose and calculate ARM data (except pre-LTD 0 data) from the inpud data Paramters _________ df : dataframe of measurement data rem_type : remanence type Returns ________ afxrm : XRM data with "meas_norm" column df3 : with base-vector-subtracted data """ XRM0 = str(rem_type) + '0' df2=subtract_base_vector(df,rem_type) df3=df2[df2.description.str.contains(rem_type)] afxrm=df3 if (len(afxrm)>0): meas0=afxrm.magn_mass_diff.tolist()[0] afxrm['meas_norm']=afxrm['magn_mass_diff']/meas0 afxrm=afxrm.loc[afxrm.method_codes.str.contains('LT-LT-Z')==False] afxrm=df2[df2.description.str.contains(rem_type)] afxrm=afxrm[afxrm.description.str.contains(XRM0)==False] meas0=afxrm.magn_mass_diff.tolist()[0] afxrm['meas_norm']=afxrm['magn_mass_diff']/meas0 return afxrm,df3 def set_NTRM_data(df,rem_type): """ choose and calculate NTRM data from the inpud data Paramters _________ df : dataframe of measurement data rem_type : remanence type Returns ________ afxrm : XRM data with "meas_norm" column df3 : with base-vector-subtracted data """ XRM0 = str(rem_type) + '0' df2=subtract_base_vector(df,rem_type) df3=df2[df2.description==rem_type] df4=df2[df2.description.str.contains(XRM0)==True] df5=pd.concat([df3,df4]) #df5.to_csv('_temp.csv',index=True) afxrm=df3 if (len(afxrm)>0): afxrm=afxrm[afxrm.description.str.contains(XRM0)==False] meas0=afxrm.magn_mass.tolist()[0] # get first measurement (after LTD) afxrm['meas_norm']=afxrm['magn_mass']/meas0 # normalized by first measurement return afxrm,df5
[ 11748, 2603, 29487, 8019, 355, 285, 489, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 18540, 305, 919, 278, 355, 5021, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28686, 220, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 9114, 363, 9078, 198, 11748, 9114, 363, 9078, 13, 541, 19726, 355, 20966, 19726, 198, 11748, 9114, 363, 9078, 13, 4426, 363, 355, 9114, 363, 198, 11748, 9114, 363, 9078, 13, 4426, 363, 29487, 8019, 355, 9114, 363, 29487, 8019, 198, 11748, 302, 198, 11748, 629, 541, 88, 13, 18908, 4873, 355, 19386, 198, 11748, 629, 541, 88, 13, 34242, 355, 9756, 198, 11748, 384, 397, 1211, 355, 3013, 82, 198, 11748, 30628, 13, 8019, 13, 293, 5773, 80, 62, 30482, 672, 666, 355, 9195, 62, 74, 198, 11748, 25064, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 355, 288, 83, 198, 6738, 1330, 8019, 1330, 18126, 198, 6738, 18540, 305, 919, 278, 1330, 19850, 198, 6738, 629, 541, 88, 13, 34242, 1330, 9493, 2301, 601, 628, 628, 628, 628, 198, 198, 4299, 1064, 62, 13466, 62, 17614, 62, 16864, 62, 81, 7, 24011, 1389, 8081, 82, 16, 11, 1084, 6732, 330, 11, 1084, 49, 11, 1084, 11122, 3008, 51, 11, 9806, 11122, 3008, 51, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 9938, 82, 262, 1266, 6903, 329, 23057, 44, 12, 5446, 44, 16, 9, 290, 7579, 44, 16, 12, 5446, 44, 17, 9, 21528, 416, 374, 9987, 286, 14063, 25384, 10, 16088, 198, 220, 220, 220, 357, 16, 8, 15284, 7824, 7869, 329, 477, 1744, 24029, 3458, 20016, 198, 220, 220, 220, 357, 17, 8, 27537, 262, 7869, 407, 19201, 262, 6678, 6356, 9987, 357, 12518, 9723, 8, 198, 220, 220, 220, 22532, 532, 357, 18, 8, 3297, 262, 7869, 416, 288, 17614, 357, 2411, 13, 12928, 422, 262, 2938, 7824, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 2922, 262, 1266, 838, 7869, 198, 220, 220, 220, 357, 19, 8, 3297, 262, 7869, 416, 1216, 330, 62, 77, 11, 290, 2922, 262, 1266, 530, 198, 220, 220, 220, 4424, 85, 1300, 357, 74, 8, 17952, 318, 925, 416, 262, 2438, 329, 30574, 72, 7110, 416, 15378, 13, 220, 198, 220, 220, 220, 220, 220, 220, 220, 770, 318, 1760, 329, 40631, 353, 67, 12, 55, 357, 68, 13, 70, 13, 532, 5446, 44, 16, 11, 532, 33456, 16, 11, 11485, 8, 290, 2656, 12, 56, 357, 68, 13, 70, 13, 23057, 44, 11, 20359, 15, 11, 11485, 737, 198, 220, 220, 220, 220, 220, 220, 220, 383, 37204, 12, 55, 318, 11677, 357, 24561, 8, 284, 6632, 355, 257, 5288, 13, 198, 220, 220, 220, 15556, 33448, 14, 2931, 14, 3312, 198, 220, 220, 220, 220, 2602, 834, 198, 220, 220, 220, 220, 220, 220, 220, 5929, 8081, 82, 16, 1058, 5929, 7824, 10007, 198, 220, 220, 220, 220, 220, 220, 220, 949, 6732, 330, 11, 1084, 49, 11, 1084, 11122, 3008, 51, 11, 9806, 11122, 3008, 51, 1058, 40885, 329, 262, 374, 9987, 198, 220, 220, 220, 16409, 198, 220, 220, 220, 44435, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 1084, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 9806, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 1084, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 9806, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 3601, 10786, 58, 22213, 5142, 11, 362, 358, 16930, 60, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 28, 24011, 1389, 8081, 82, 16, 58, 24011, 1389, 8081, 82, 16, 13, 31944, 62, 83, 29, 28, 1084, 6732, 330, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 83, 18189, 3256, 949, 6732, 330, 11, 705, 25, 46083, 18896, 7, 9612, 276, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 83, 18189, 3256, 949, 6732, 330, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 24011, 1389, 8081, 82, 16, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 17, 28, 9612, 276, 58, 9612, 276, 13, 81, 62, 83, 29, 28, 1084, 49, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 17, 8, 29, 15, 2599, 220, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 374, 62, 83, 18189, 3256, 949, 49, 11, 705, 25, 46083, 18896, 7, 9612, 276, 17, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 17, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 374, 62, 83, 18189, 3256, 949, 49, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 18, 28, 9612, 276, 58, 7, 9612, 276, 13, 6649, 3008, 62, 83, 29, 28, 1084, 11122, 3008, 51, 19415, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1222, 7, 9612, 276, 13, 6649, 3008, 62, 83, 27, 28, 9806, 11122, 3008, 51, 15437, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 18, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 46083, 949, 11122, 3008, 51, 11, 705, 27, 28, 22638, 62, 83, 19841, 3256, 3509, 11122, 3008, 51, 11, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 25, 46083, 18896, 7, 9612, 276, 18, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 18, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 46083, 949, 11122, 3008, 51, 11, 705, 27, 28, 22638, 62, 83, 19841, 3256, 3509, 11122, 3008, 51, 11, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 3601, 10786, 58, 22213, 5142, 11, 352, 301, 16930, 60, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 19, 28, 9612, 276, 58, 9612, 276, 13, 31944, 62, 77, 29, 28, 1084, 6732, 330, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 19, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 77, 18189, 3256, 949, 6732, 330, 11, 705, 25, 46083, 18896, 7, 9612, 276, 19, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 19, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 77, 18189, 3256, 949, 6732, 330, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 20, 28, 9612, 276, 58, 9612, 276, 13, 81, 62, 77, 29, 28, 1084, 49, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 20, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 374, 62, 77, 18189, 3256, 949, 49, 11, 705, 25, 46083, 18896, 7, 9612, 276, 20, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 20, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 374, 62, 77, 18189, 3256, 949, 49, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 22492, 3297, 416, 288, 17614, 11, 788, 2922, 1353, 838, 198, 220, 220, 220, 1303, 4798, 10786, 58, 30619, 416, 288, 17614, 290, 2922, 262, 1353, 838, 1366, 60, 11537, 198, 220, 220, 220, 1303, 9612, 276, 28, 9612, 276, 13, 30619, 62, 27160, 10786, 67, 17614, 11537, 198, 220, 220, 220, 1303, 9612, 276, 28, 9612, 276, 13, 346, 420, 58, 25, 940, 60, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 3297, 416, 1216, 330, 62, 77, 11, 788, 2922, 262, 1266, 198, 220, 220, 220, 3601, 10786, 58, 30619, 416, 1216, 330, 62, 77, 290, 2922, 262, 1266, 2239, 12, 24011, 1883, 60, 11537, 198, 220, 220, 220, 32862, 28, 9612, 276, 13, 30619, 62, 27160, 10786, 31944, 62, 77, 3256, 41988, 28, 25101, 8, 198, 220, 220, 220, 32862, 62, 13466, 62, 22184, 28, 9612, 276, 13, 346, 420, 58, 25, 16, 60, 198, 220, 220, 220, 1303, 4798, 7, 9612, 276, 8, 198, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 1084, 28, 9612, 276, 62, 13466, 62, 22184, 17816, 9662, 62, 1084, 62, 83, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 9806, 28, 9612, 276, 62, 13466, 62, 22184, 17816, 9662, 62, 9806, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 1084, 28, 9612, 276, 62, 13466, 62, 22184, 17816, 9662, 62, 1084, 62, 77, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 9806, 28, 9612, 276, 62, 13466, 62, 22184, 17816, 9662, 62, 9806, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1441, 491, 76, 16, 62, 7364, 62, 1084, 11, 491, 76, 16, 62, 7364, 62, 9806, 11, 491, 76, 17, 62, 7364, 62, 1084, 11, 491, 76, 17, 62, 7364, 62, 9806, 11, 32862, 628, 198, 198, 4299, 1064, 62, 13466, 62, 17614, 62, 16864, 62, 74, 7, 24011, 1389, 8081, 82, 16, 11, 9806, 43303, 11, 9806, 37, 411, 312, 11, 9806, 42, 81, 85, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 9938, 82, 262, 1266, 6903, 329, 23057, 44, 12, 5446, 44, 16, 9, 290, 7579, 44, 16, 12, 5446, 44, 17, 9, 21528, 416, 479, 6, 9987, 286, 22361, 10, 1238, 2481, 220, 198, 220, 220, 220, 357, 16, 8, 15284, 7824, 7869, 329, 477, 1744, 24029, 3458, 20016, 198, 220, 220, 220, 357, 17, 8, 27537, 262, 7869, 407, 19201, 262, 17993, 34054, 357, 15, 13, 16, 8, 290, 262, 479, 6, 34054, 357, 15, 13, 17, 8, 198, 220, 220, 220, 22532, 532, 357, 18, 8, 3297, 262, 7869, 416, 288, 17614, 357, 2411, 13, 12928, 422, 262, 2938, 7824, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 2922, 262, 1266, 838, 7869, 198, 220, 220, 220, 357, 19, 8, 3297, 262, 7869, 416, 1216, 330, 62, 77, 11, 290, 2922, 262, 1266, 530, 198, 220, 220, 220, 220, 2602, 834, 198, 220, 220, 220, 220, 220, 220, 220, 5929, 8081, 82, 16, 1058, 5929, 7824, 10007, 198, 220, 220, 220, 220, 220, 220, 220, 949, 6732, 330, 11, 1084, 49, 11, 1084, 11122, 3008, 51, 11, 9806, 11122, 3008, 51, 1058, 40885, 329, 262, 374, 9987, 198, 220, 220, 220, 16409, 198, 220, 220, 220, 44435, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 1084, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 9806, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 1084, 198, 220, 220, 220, 220, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 9806, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 3601, 10786, 58, 22213, 5142, 11, 362, 358, 16930, 60, 11537, 198, 220, 220, 220, 32862, 28, 24011, 1389, 8081, 82, 16, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 9612, 276, 28, 24011, 1389, 8081, 82, 16, 58, 24011, 1389, 8081, 82, 16, 13, 31944, 62, 83, 29, 28, 1084, 6732, 330, 60, 198, 220, 220, 220, 1303, 361, 357, 11925, 7, 9612, 276, 8, 29, 15, 2599, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 83, 18189, 3256, 949, 6732, 330, 11, 705, 25, 46083, 18896, 7, 9612, 276, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 1303, 17772, 25, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 83, 18189, 3256, 949, 6732, 330, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 220, 220, 220, 32862, 28, 24011, 1389, 8081, 82, 16, 198, 220, 220, 220, 22492, 198, 220, 220, 220, 1303, 9612, 276, 17, 28, 9612, 276, 58, 9612, 276, 13, 38584, 20306, 62, 83, 27, 28, 9806, 42, 81, 85, 60, 198, 220, 220, 220, 1303, 361, 357, 11925, 7, 9612, 276, 17, 8, 29, 15, 2599, 220, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 479, 43054, 19841, 3256, 3509, 42, 81, 85, 11, 705, 25, 46083, 18896, 7, 9612, 276, 17, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 1303, 220, 220, 220, 32862, 28, 9612, 276, 17, 198, 220, 220, 220, 1303, 17772, 25, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 479, 43054, 19841, 3256, 3509, 42, 81, 85, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 22492, 198, 220, 220, 220, 1303, 9612, 276, 18, 28, 9612, 276, 58, 7, 9612, 276, 13, 6649, 3008, 62, 83, 29, 28, 1084, 11122, 3008, 51, 19415, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1222, 7, 9612, 276, 13, 6649, 3008, 62, 83, 27, 28, 9806, 11122, 3008, 51, 15437, 198, 220, 220, 220, 1303, 361, 357, 11925, 7, 9612, 276, 18, 8, 29, 15, 2599, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 46083, 949, 11122, 3008, 51, 11, 705, 27, 28, 22638, 62, 83, 19841, 3256, 3509, 11122, 3008, 51, 11, 3467, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 705, 25, 46083, 18896, 7, 9612, 276, 18, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 1303, 220, 220, 220, 32862, 28, 9612, 276, 18, 198, 220, 220, 220, 1303, 17772, 25, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 46083, 949, 11122, 3008, 51, 11, 705, 27, 28, 22638, 62, 83, 19841, 3256, 3509, 11122, 3008, 51, 11, 3467, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 22492, 198, 220, 220, 220, 3601, 10786, 58, 22213, 5142, 11, 352, 301, 16930, 60, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 9612, 276, 19, 28, 9612, 276, 58, 9612, 276, 13, 31944, 62, 77, 29, 28, 1084, 6732, 330, 60, 198, 220, 220, 220, 1303, 361, 357, 11925, 7, 9612, 276, 19, 8, 29, 15, 2599, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 77, 18189, 3256, 949, 6732, 330, 11, 705, 25, 46083, 18896, 7, 9612, 276, 19, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 1303, 220, 220, 220, 32862, 28, 9612, 276, 19, 198, 220, 220, 220, 1303, 17772, 25, 198, 220, 220, 220, 1303, 220, 220, 220, 3601, 10786, 220, 1305, 330, 62, 77, 18189, 3256, 949, 6732, 330, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 20, 28, 9612, 276, 58, 9612, 276, 13, 31361, 62, 77, 27, 28, 9806, 43303, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 20, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 12159, 19841, 3256, 3509, 43303, 11, 705, 25, 46083, 18896, 7, 9612, 276, 20, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 20, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 12159, 19841, 3256, 3509, 43303, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 21, 28, 9612, 276, 58, 9612, 276, 13, 69, 62, 411, 312, 62, 77, 27, 28, 9806, 37, 411, 312, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 21, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 277, 62, 411, 312, 19841, 3256, 3509, 43303, 11, 705, 25, 46083, 18896, 7, 9612, 276, 21, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 21, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 277, 62, 411, 312, 19841, 3256, 3509, 43303, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 32862, 22, 28, 9612, 276, 58, 8937, 7, 9612, 276, 13, 38584, 20306, 62, 77, 8, 27, 28, 9806, 42, 81, 85, 60, 198, 220, 220, 220, 611, 357, 11925, 7, 9612, 276, 22, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 2352, 62, 74, 43054, 19841, 3256, 3509, 42, 81, 85, 11, 705, 25, 46083, 18896, 7, 9612, 276, 22, 828, 6, 9662, 12, 24011, 7352, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 32862, 28, 9612, 276, 22, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 220, 2352, 62, 74, 43054, 19841, 3256, 3509, 42, 81, 85, 11, 705, 25, 645, 2239, 12, 24011, 7352, 11378, 11537, 198, 220, 220, 220, 22492, 3297, 416, 288, 17614, 11, 788, 2922, 1353, 838, 198, 220, 220, 220, 1303, 4798, 10786, 58, 30619, 416, 288, 17614, 290, 2922, 262, 1353, 838, 1366, 60, 11537, 198, 220, 220, 220, 1303, 9612, 276, 28, 9612, 276, 13, 30619, 62, 27160, 10786, 67, 17614, 11537, 198, 220, 220, 220, 1303, 9612, 276, 28, 9612, 276, 13, 346, 420, 58, 25, 940, 60, 198, 220, 220, 220, 1303, 3297, 416, 1216, 330, 62, 77, 11, 788, 2922, 262, 1266, 198, 220, 220, 220, 3601, 10786, 58, 30619, 416, 1216, 330, 62, 77, 290, 2922, 262, 1266, 2239, 12, 24011, 1883, 60, 11537, 198, 220, 220, 220, 32862, 28, 9612, 276, 13, 30619, 62, 27160, 10786, 31944, 62, 77, 3256, 41988, 28, 25101, 8, 198, 220, 220, 220, 32862, 62, 22184, 28, 9612, 276, 13, 346, 420, 58, 25, 16, 60, 198, 220, 220, 220, 1303, 4798, 7, 9612, 276, 8, 198, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 1084, 28, 9612, 276, 62, 22184, 17816, 9662, 62, 1084, 62, 83, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 17, 62, 7364, 62, 9806, 28, 9612, 276, 62, 22184, 17816, 9662, 62, 9806, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 1084, 28, 9612, 276, 62, 22184, 17816, 9662, 62, 1084, 62, 77, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 491, 76, 16, 62, 7364, 62, 9806, 28, 9612, 276, 62, 22184, 17816, 9662, 62, 9806, 6, 4083, 346, 420, 58, 15, 60, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1441, 491, 76, 16, 62, 7364, 62, 1084, 11, 491, 76, 16, 62, 7364, 62, 9806, 11, 491, 76, 17, 62, 7364, 62, 1084, 11, 491, 76, 17, 62, 7364, 62, 9806, 11, 32862, 628, 198, 198, 4299, 1064, 62, 76, 7568, 7, 7568, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 9938, 82, 262, 14288, 17656, 2214, 329, 12341, 1357, 363, 1366, 198, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 2602, 834, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 1058, 1366, 14535, 286, 13871, 198, 220, 220, 220, 16409, 198, 220, 220, 220, 44435, 198, 220, 220, 220, 220, 220, 220, 220, 285, 7568, 1058, 14288, 17656, 2214, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 285, 7568, 62, 7568, 28, 7568, 58, 7568, 13, 1326, 292, 62, 27237, 27, 28, 15, 13, 20, 60, 198, 220, 220, 220, 285, 7568, 62, 8929, 28, 76, 7568, 62, 7568, 13, 83, 630, 62, 330, 62, 3245, 62, 76, 51, 13, 27160, 58, 15, 60, 198, 220, 220, 220, 285, 7568, 62, 7568, 28, 7568, 58, 7568, 13, 1326, 292, 62, 27237, 29, 28, 15, 13, 20, 60, 198, 220, 220, 220, 285, 7568, 62, 9319, 28, 76, 7568, 62, 7568, 13, 83, 630, 62, 330, 62, 3245, 62, 76, 51, 13, 27160, 58, 12, 16, 60, 198, 220, 220, 220, 285, 7568, 28, 600, 7, 15, 13, 20, 9, 7, 76, 7568, 62, 8929, 10, 76, 7568, 62, 9319, 4008, 198, 220, 220, 220, 1441, 285, 7568, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 4299, 900, 62, 33456, 62, 7890, 7, 7568, 11, 2787, 62, 4906, 2599, 198, 220, 220, 220, 37227, 3853, 290, 15284, 20359, 1366, 357, 16341, 662, 12, 43, 21016, 657, 1366, 8, 422, 262, 287, 79, 463, 1366, 198, 220, 220, 220, 25139, 1010, 198, 220, 220, 220, 220, 2602, 62, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 1058, 1366, 14535, 286, 15558, 1366, 198, 220, 220, 220, 220, 220, 220, 220, 816, 62, 4906, 1058, 302, 805, 594, 2099, 198, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 2602, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 1058, 1395, 29138, 1366, 351, 366, 1326, 292, 62, 27237, 1, 5721, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 18, 220, 220, 1058, 351, 2779, 12, 31364, 12, 7266, 83, 20216, 1366, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1395, 29138, 15, 796, 965, 7, 2787, 62, 4906, 8, 1343, 705, 15, 6, 198, 220, 220, 220, 47764, 17, 28, 7266, 83, 974, 62, 8692, 62, 31364, 7, 7568, 11, 2787, 62, 4906, 8, 198, 220, 220, 220, 47764, 18, 28, 7568, 17, 58, 7568, 17, 13, 11213, 13, 2536, 13, 3642, 1299, 7, 2787, 62, 4906, 15437, 198, 220, 220, 220, 6580, 87, 26224, 28, 7568, 18, 198, 220, 220, 220, 611, 357, 11925, 7, 1878, 87, 26224, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 2212, 15, 28, 1878, 87, 26224, 13, 76, 4660, 62, 22208, 62, 26069, 13, 83, 349, 396, 3419, 58, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 17816, 1326, 292, 62, 27237, 20520, 28, 1878, 87, 26224, 17816, 76, 4660, 62, 22208, 62, 26069, 20520, 14, 1326, 292, 15, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 28, 1878, 87, 26224, 13, 17946, 58, 1878, 87, 26224, 13, 24396, 62, 40148, 13, 2536, 13, 3642, 1299, 10786, 27734, 12, 27734, 12, 57, 11537, 855, 25101, 60, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 28, 7568, 17, 58, 7568, 17, 13, 11213, 13, 2536, 13, 3642, 1299, 7, 2787, 62, 4906, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 28, 1878, 87, 26224, 58, 1878, 87, 26224, 13, 11213, 13, 2536, 13, 3642, 1299, 7, 55, 29138, 15, 8, 855, 25101, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2212, 15, 28, 1878, 87, 26224, 13, 76, 4660, 62, 22208, 62, 26069, 13, 83, 349, 396, 3419, 58, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 17816, 1326, 292, 62, 27237, 20520, 28, 1878, 87, 26224, 17816, 76, 4660, 62, 22208, 62, 26069, 20520, 14, 1326, 292, 15, 198, 220, 220, 220, 1441, 6580, 87, 26224, 11, 7568, 18, 628, 198, 198, 4299, 900, 62, 45, 5446, 44, 62, 7890, 7, 7568, 11, 2787, 62, 4906, 2599, 198, 220, 220, 220, 37227, 3853, 290, 15284, 399, 5446, 44, 1366, 422, 262, 287, 79, 463, 1366, 198, 220, 220, 220, 25139, 1010, 198, 220, 220, 220, 220, 2602, 62, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 1058, 1366, 14535, 286, 15558, 1366, 198, 220, 220, 220, 220, 220, 220, 220, 816, 62, 4906, 1058, 302, 805, 594, 2099, 198, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 2602, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 1058, 1395, 29138, 1366, 351, 366, 1326, 292, 62, 27237, 1, 5721, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 18, 220, 220, 1058, 351, 2779, 12, 31364, 12, 7266, 83, 20216, 1366, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1395, 29138, 15, 796, 965, 7, 2787, 62, 4906, 8, 1343, 705, 15, 6, 198, 220, 220, 220, 47764, 17, 28, 7266, 83, 974, 62, 8692, 62, 31364, 7, 7568, 11, 2787, 62, 4906, 8, 198, 220, 220, 220, 47764, 18, 28, 7568, 17, 58, 7568, 17, 13, 11213, 855, 2787, 62, 4906, 60, 198, 220, 220, 220, 47764, 19, 28, 7568, 17, 58, 7568, 17, 13, 11213, 13, 2536, 13, 3642, 1299, 7, 55, 29138, 15, 8, 855, 17821, 60, 198, 220, 220, 220, 47764, 20, 28, 30094, 13, 1102, 9246, 26933, 7568, 18, 11, 7568, 19, 12962, 198, 220, 220, 220, 1303, 7568, 20, 13, 1462, 62, 40664, 10786, 62, 29510, 13, 40664, 3256, 9630, 28, 17821, 8, 198, 220, 220, 220, 6580, 87, 26224, 28, 7568, 18, 198, 220, 220, 220, 611, 357, 11925, 7, 1878, 87, 26224, 8, 29, 15, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 28, 1878, 87, 26224, 58, 1878, 87, 26224, 13, 11213, 13, 2536, 13, 3642, 1299, 7, 55, 29138, 15, 8, 855, 25101, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2212, 15, 28, 1878, 87, 26224, 13, 76, 4660, 62, 22208, 13, 83, 349, 396, 3419, 58, 15, 60, 1303, 651, 717, 15558, 357, 8499, 42513, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6580, 87, 26224, 17816, 1326, 292, 62, 27237, 20520, 28, 1878, 87, 26224, 17816, 76, 4660, 62, 22208, 20520, 14, 1326, 292, 15, 1303, 39279, 416, 717, 15558, 198, 220, 220, 220, 1441, 6580, 87, 26224, 11, 7568, 20, 628, 628, 628, 628, 628, 628 ]
2.197628
4,468
import datetime from sqlalchemy import Boolean, Column, Integer, String, ForeignKey, Date from sqlalchemy.orm import relationship from app.db.base_class import Base class User(Base): """用户表""" id = Column(Integer, primary_key=True, index=True) username = Column(String(32), unique=True, index=True, nullable=False, doc="编码") nickname = Column(String(32), doc="姓名") sex = Column(String(8), doc="性别") identity_card = Column(String(32), doc="身份证") phone = Column(String(32), doc="手机号") address = Column(String(32), doc="地址") work_start = Column(Date, doc="入职日期", default=datetime.datetime.today()) hashed_password = Column(String(128), nullable=False, doc="密码") avatar = Column(String(128), doc="头像", default="https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif?imageView2/1/w/80/h/80") introduction = Column(String(256), doc="自我介绍") status = Column(String(32), nullable=False, doc="状态") is_active = Column(Boolean(), default=True, doc="是否活跃") is_superuser = Column(Boolean(), default=False, doc="是否超级管理员") user_role = relationship("UserRole", backref="user") user_department = relationship("UserDepartment", backref="user") user_dict = relationship("UserDict", backref="user") class UserRole(Base): """用户-权限组-中间表""" id = Column(Integer, primary_key=True, index=True) user_id = Column(Integer, ForeignKey("user.id", ondelete='CASCADE')) role_id = Column(Integer, ForeignKey("role.id")) role = relationship("Role") class UserDepartment(Base): """用户-部门-中间表""" id = Column(Integer, primary_key=True, index=True) user_id = Column(Integer, ForeignKey("user.id", ondelete='CASCADE')) department_id = Column(Integer, ForeignKey("department.id")) department = relationship("Department") class UserDict(Base): """用户-字典-中间表""" id = Column(Integer, primary_key=True, index=True) user_id = Column(Integer, ForeignKey("user.id", ondelete='CASCADE')) dict_id = Column(Integer, ForeignKey("dict_data.id", ondelete='CASCADE')) dict_data = relationship("DictData", backref="user_dict")
[ 11748, 4818, 8079, 198, 198, 6738, 44161, 282, 26599, 1330, 41146, 11, 29201, 11, 34142, 11, 10903, 11, 8708, 9218, 11, 7536, 198, 6738, 44161, 282, 26599, 13, 579, 1330, 2776, 198, 198, 6738, 598, 13, 9945, 13, 8692, 62, 4871, 1330, 7308, 628, 198, 4871, 11787, 7, 14881, 2599, 198, 220, 220, 220, 37227, 18796, 101, 22755, 115, 26193, 101, 37811, 198, 220, 220, 220, 4686, 796, 29201, 7, 46541, 11, 4165, 62, 2539, 28, 17821, 11, 6376, 28, 17821, 8, 198, 220, 220, 220, 20579, 796, 29201, 7, 10100, 7, 2624, 828, 3748, 28, 17821, 11, 6376, 28, 17821, 11, 9242, 540, 28, 25101, 11, 2205, 2625, 163, 120, 244, 163, 254, 223, 4943, 198, 220, 220, 220, 21814, 796, 29201, 7, 10100, 7, 2624, 828, 2205, 2625, 34650, 241, 28938, 235, 4943, 198, 220, 220, 220, 1714, 796, 29201, 7, 10100, 7, 23, 828, 2205, 2625, 45250, 100, 26344, 104, 4943, 198, 220, 220, 220, 5369, 62, 9517, 796, 29201, 7, 10100, 7, 2624, 828, 2205, 2625, 164, 118, 104, 20015, 121, 46237, 223, 4943, 198, 220, 220, 220, 3072, 796, 29201, 7, 10100, 7, 2624, 828, 2205, 2625, 33699, 233, 17312, 118, 20998, 115, 4943, 198, 220, 220, 220, 2209, 796, 29201, 7, 10100, 7, 2624, 828, 2205, 2625, 28839, 108, 161, 251, 222, 4943, 198, 220, 220, 220, 670, 62, 9688, 796, 29201, 7, 10430, 11, 2205, 2625, 17739, 98, 164, 223, 234, 33768, 98, 17312, 253, 1600, 4277, 28, 19608, 8079, 13, 19608, 8079, 13, 40838, 28955, 198, 220, 220, 220, 468, 704, 62, 28712, 796, 29201, 7, 10100, 7, 12762, 828, 9242, 540, 28, 25101, 11, 2205, 2625, 43380, 228, 163, 254, 223, 4943, 198, 220, 220, 220, 30919, 796, 29201, 7, 10100, 7, 12762, 828, 2205, 2625, 13783, 112, 161, 225, 237, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 2625, 5450, 1378, 24142, 9600, 13, 11930, 301, 31522, 13, 785, 14, 69, 3324, 5774, 2548, 66, 12, 68, 19, 69, 23, 12, 2780, 2154, 12, 65, 21, 2682, 12, 3980, 36809, 65, 19, 330, 8635, 13, 27908, 30, 9060, 7680, 17, 14, 16, 14, 86, 14, 1795, 14, 71, 14, 1795, 4943, 198, 220, 220, 220, 9793, 796, 29201, 7, 10100, 7, 11645, 828, 2205, 2625, 164, 229, 103, 22755, 239, 20015, 233, 163, 119, 235, 4943, 198, 220, 220, 220, 3722, 796, 29201, 7, 10100, 7, 2624, 828, 9242, 540, 28, 25101, 11, 2205, 2625, 163, 232, 35050, 222, 223, 4943, 198, 220, 220, 220, 318, 62, 5275, 796, 29201, 7, 46120, 13087, 22784, 4277, 28, 17821, 11, 2205, 2625, 42468, 28938, 99, 162, 112, 119, 164, 115, 225, 4943, 198, 220, 220, 220, 318, 62, 16668, 7220, 796, 29201, 7, 46120, 13087, 22784, 4277, 28, 25101, 11, 2205, 2625, 42468, 28938, 99, 164, 41678, 163, 118, 100, 163, 106, 94, 49426, 228, 37772, 246, 4943, 628, 220, 220, 220, 2836, 62, 18090, 796, 2776, 7203, 12982, 47445, 1600, 736, 5420, 2625, 7220, 4943, 198, 220, 220, 220, 2836, 62, 10378, 1823, 796, 2776, 7203, 12982, 36261, 1600, 736, 5420, 2625, 7220, 4943, 198, 220, 220, 220, 2836, 62, 11600, 796, 2776, 7203, 12982, 35, 713, 1600, 736, 5420, 2625, 7220, 4943, 628, 198, 4871, 11787, 47445, 7, 14881, 2599, 198, 220, 220, 220, 37227, 18796, 101, 22755, 115, 12, 30266, 225, 165, 247, 238, 163, 119, 226, 12, 40792, 29785, 112, 26193, 101, 37811, 198, 220, 220, 220, 4686, 796, 29201, 7, 46541, 11, 4165, 62, 2539, 28, 17821, 11, 6376, 28, 17821, 8, 198, 220, 220, 220, 2836, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 7220, 13, 312, 1600, 319, 33678, 11639, 34, 42643, 19266, 6, 4008, 198, 220, 220, 220, 2597, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 18090, 13, 312, 48774, 628, 220, 220, 220, 2597, 796, 2776, 7203, 47445, 4943, 628, 198, 4871, 11787, 36261, 7, 14881, 2599, 198, 220, 220, 220, 37227, 18796, 101, 22755, 115, 12, 32849, 101, 29785, 101, 12, 40792, 29785, 112, 26193, 101, 37811, 198, 220, 220, 220, 4686, 796, 29201, 7, 46541, 11, 4165, 62, 2539, 28, 17821, 11, 6376, 28, 17821, 8, 198, 220, 220, 220, 2836, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 7220, 13, 312, 1600, 319, 33678, 11639, 34, 42643, 19266, 6, 4008, 198, 220, 220, 220, 5011, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 10378, 1823, 13, 312, 48774, 628, 220, 220, 220, 5011, 796, 2776, 7203, 36261, 4943, 628, 198, 4871, 11787, 35, 713, 7, 14881, 2599, 198, 220, 220, 220, 37227, 18796, 101, 22755, 115, 12, 27764, 245, 17739, 116, 12, 40792, 29785, 112, 26193, 101, 37811, 198, 220, 220, 220, 4686, 796, 29201, 7, 46541, 11, 4165, 62, 2539, 28, 17821, 11, 6376, 28, 17821, 8, 198, 220, 220, 220, 2836, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 7220, 13, 312, 1600, 319, 33678, 11639, 34, 42643, 19266, 6, 4008, 198, 220, 220, 220, 8633, 62, 312, 796, 29201, 7, 46541, 11, 8708, 9218, 7203, 11600, 62, 7890, 13, 312, 1600, 319, 33678, 11639, 34, 42643, 19266, 6, 4008, 628, 220, 220, 220, 8633, 62, 7890, 796, 2776, 7203, 35, 713, 6601, 1600, 736, 5420, 2625, 7220, 62, 11600, 4943, 198 ]
2.416198
889
from .model import HighResNet3D
[ 6738, 764, 19849, 1330, 3334, 4965, 7934, 18, 35, 198 ]
3.2
10
# Copyright 2021 Hathor Labs # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from enum import Enum from typing import List, NamedTuple
[ 2, 15069, 33448, 36556, 273, 23500, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 198, 198, 6738, 33829, 1330, 2039, 388, 198, 6738, 19720, 1330, 7343, 11, 34441, 51, 29291, 628, 628, 628 ]
3.843373
166
import sys from libya_elections.settings.base import * # noqa DEBUG = True SECRET_KEY = 'dummy secret key for testing only' INTERNAL_IPS = ('127.0.0.1', ) EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' CELERY_TASK_ALWAYS_EAGER = False INSTALLED_BACKENDS = { HTTPTESTER_BACKEND: { "ENGINE": "rapidsms.backends.database.DatabaseBackend", }, "vumi-fake-smsc": { "ENGINE": "rapidsms.backends.vumi.VumiBackend", # Default to localhost, but allow override "sendsms_url": os.getenv("vumi_fake_smsc_sendsms_url", "http://127.0.0.1:9000/send/"), }, "vumi-http": { "ENGINE": "rapidsms.backends.vumi.VumiBackend", # Default to localhost, but allow override "sendsms_url": os.getenv("VUMI_HTTP_SENDSMS_URL", "http://127.0.0.1:9000/send/"), }, } CACHES = { 'default': { # Use same backend as in production 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', # Assume memcached is local 'LOCATION': '127.0.0.1:11211', 'TIMEOUT': 60 * 60, # one hour } } # Special test settings if 'test' in sys.argv: CELERY_TASK_ALWAYS_EAGER = True CELERY_TASK_EAGER_PROPAGATES = True PASSWORD_HASHERS = ( 'django.contrib.auth.hashers.SHA1PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher', ) CAPTCHA_TEST_MODE = True REPORTING_REDIS_KEY_PREFIX = 'os_reporting_api_ut_' # use default storage for tests, since we don't run collectstatic for tests STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' else: # Enable all tools for local development, but not when running tests. ENABLE_ALL_TOOLS = True # Enable django-debug-toolbar if not running tests INSTALLED_APPS[-1:-1] = ( "debug_toolbar", ) DEBUG_TOOLBAR_PATCH_SETTINGS = False MIDDLEWARE += ( 'debug_toolbar.middleware.DebugToolbarMiddleware', )
[ 11748, 25064, 198, 198, 6738, 9195, 3972, 62, 9509, 507, 13, 33692, 13, 8692, 1330, 1635, 220, 1303, 645, 20402, 198, 198, 30531, 796, 6407, 198, 198, 23683, 26087, 62, 20373, 796, 705, 67, 13513, 3200, 1994, 329, 4856, 691, 6, 198, 198, 1268, 31800, 1847, 62, 47643, 796, 19203, 16799, 13, 15, 13, 15, 13, 16, 3256, 1267, 198, 198, 27630, 4146, 62, 31098, 10619, 796, 705, 28241, 14208, 13, 7295, 13, 4529, 13, 1891, 2412, 13, 41947, 13, 15333, 7282, 437, 6, 198, 198, 34, 3698, 19664, 62, 51, 1921, 42, 62, 1847, 42451, 62, 36, 4760, 1137, 796, 10352, 198, 198, 38604, 7036, 1961, 62, 31098, 1677, 5258, 796, 1391, 198, 220, 220, 220, 14626, 51, 1546, 5781, 62, 31098, 10619, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 26808, 8881, 1298, 366, 2416, 2340, 907, 13, 1891, 2412, 13, 48806, 13, 38105, 7282, 437, 1600, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 366, 85, 12994, 12, 30706, 12, 82, 907, 66, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 26808, 8881, 1298, 366, 2416, 2340, 907, 13, 1891, 2412, 13, 85, 12994, 13, 53, 12994, 7282, 437, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 15161, 284, 1957, 4774, 11, 475, 1249, 20957, 198, 220, 220, 220, 220, 220, 220, 220, 366, 82, 2412, 907, 62, 6371, 1298, 28686, 13, 1136, 24330, 7203, 85, 12994, 62, 30706, 62, 82, 907, 66, 62, 82, 2412, 907, 62, 6371, 1600, 366, 4023, 1378, 16799, 13, 15, 13, 15, 13, 16, 25, 24, 830, 14, 21280, 14, 12340, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 366, 85, 12994, 12, 4023, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 26808, 8881, 1298, 366, 2416, 2340, 907, 13, 1891, 2412, 13, 85, 12994, 13, 53, 12994, 7282, 437, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 15161, 284, 1957, 4774, 11, 475, 1249, 20957, 198, 220, 220, 220, 220, 220, 220, 220, 366, 82, 2412, 907, 62, 6371, 1298, 28686, 13, 1136, 24330, 7203, 53, 5883, 40, 62, 40717, 62, 50, 1677, 5258, 5653, 62, 21886, 1600, 366, 4023, 1378, 16799, 13, 15, 13, 15, 13, 16, 25, 24, 830, 14, 21280, 14, 12340, 198, 220, 220, 220, 8964, 198, 92, 198, 198, 34, 16219, 1546, 796, 1391, 198, 220, 220, 220, 705, 12286, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 5765, 976, 30203, 355, 287, 3227, 198, 220, 220, 220, 220, 220, 220, 220, 705, 31098, 10619, 10354, 705, 28241, 14208, 13, 7295, 13, 23870, 13, 1891, 2412, 13, 11883, 66, 2317, 13, 13579, 66, 2317, 30562, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 2195, 2454, 1066, 66, 2317, 318, 1957, 198, 220, 220, 220, 220, 220, 220, 220, 705, 29701, 6234, 10354, 705, 16799, 13, 15, 13, 15, 13, 16, 25, 14686, 1157, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 34694, 12425, 10354, 3126, 1635, 3126, 11, 220, 1303, 530, 1711, 198, 220, 220, 220, 1782, 198, 92, 198, 198, 2, 6093, 1332, 6460, 198, 361, 705, 9288, 6, 287, 25064, 13, 853, 85, 25, 198, 220, 220, 220, 327, 3698, 19664, 62, 51, 1921, 42, 62, 1847, 42451, 62, 36, 4760, 1137, 796, 6407, 198, 220, 220, 220, 327, 3698, 19664, 62, 51, 1921, 42, 62, 36, 4760, 1137, 62, 4805, 3185, 4760, 29462, 796, 6407, 628, 220, 220, 220, 41752, 54, 12532, 62, 39, 11211, 4877, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 28241, 14208, 13, 3642, 822, 13, 18439, 13, 10134, 7084, 13, 37596, 16, 35215, 19242, 372, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 28241, 14208, 13, 3642, 822, 13, 18439, 13, 10134, 7084, 13, 12740, 20, 35215, 19242, 372, 3256, 198, 220, 220, 220, 1267, 628, 220, 220, 220, 20176, 51, 49285, 62, 51, 6465, 62, 49058, 796, 6407, 628, 220, 220, 220, 39099, 2751, 62, 22083, 1797, 62, 20373, 62, 47, 31688, 10426, 796, 705, 418, 62, 49914, 62, 15042, 62, 315, 62, 6, 628, 220, 220, 220, 1303, 779, 4277, 6143, 329, 5254, 11, 1201, 356, 836, 470, 1057, 2824, 12708, 329, 5254, 198, 220, 220, 220, 15486, 2149, 46700, 1546, 62, 2257, 1581, 11879, 796, 705, 28241, 14208, 13, 3642, 822, 13, 12708, 16624, 13, 35350, 13, 45442, 25876, 31425, 6, 198, 17772, 25, 198, 220, 220, 220, 1303, 27882, 477, 4899, 329, 1957, 2478, 11, 475, 407, 618, 2491, 5254, 13, 198, 220, 220, 220, 412, 4535, 19146, 62, 7036, 62, 10468, 3535, 50, 796, 6407, 198, 220, 220, 220, 1303, 27882, 42625, 14208, 12, 24442, 12, 25981, 5657, 611, 407, 2491, 5254, 198, 220, 220, 220, 40589, 7036, 1961, 62, 2969, 3705, 58, 12, 16, 21912, 16, 60, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 366, 24442, 62, 25981, 5657, 1600, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 16959, 62, 10468, 3535, 33, 1503, 62, 47, 11417, 62, 28480, 51, 20754, 796, 10352, 198, 220, 220, 220, 25269, 35, 2538, 33746, 15853, 357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 24442, 62, 25981, 5657, 13, 27171, 1574, 13, 27509, 25391, 5657, 34621, 1574, 3256, 198, 220, 220, 220, 1267, 198 ]
2.244898
882
# -*- coding: utf-8 -*- import pytest from django.core.urlresolvers import reverse from pontoon.administration.forms import ( ProjectForm, ) from pontoon.administration.views import _create_or_update_translated_resources from pontoon.base.models import ( Entity, Locale, Project, ProjectLocale, Resource, TranslatedResource, ) from pontoon.test.factories import ( EntityFactory, LocaleFactory, ProjectFactory, ResourceFactory, TranslationFactory, UserFactory, ) @pytest.mark.django_db @pytest.mark.django_db @pytest.mark.django_db @pytest.mark.django_db @pytest.mark.django_db def test_manage_project_strings_translated_resource(client_superuser): """Test that adding new strings to a project enables translation of that project on all enabled locales. """ locales = [ LocaleFactory.create(code='kl', name='Klingon'), LocaleFactory.create(code='gs', name='Geonosian'), ] project = ProjectFactory.create( data_source='database', locales=locales, repositories=[] ) locales_count = len(locales) _create_or_update_translated_resources(project, locales) url = reverse('pontoon.admin.project.strings', args=(project.slug,)) new_strings = """ Morty, do you know what "Wubba lubba dub dub" means? Oh that's just Rick's stupid non-sense catch phrase. It's not. In my people's tongue, it means "I am in great pain, please help me". """ strings_count = 4 response = client_superuser.post(url, {'new_strings': new_strings}) assert response.status_code == 200 # Verify no strings have been created as entities. entities = list(Entity.objects.filter(resource__project=project)) assert len(entities) == strings_count # Verify the resource has the right stats. resources = Resource.objects.filter(project=project) assert len(resources) == 1 resource = resources[0] assert resource.total_strings == strings_count # Verify the correct TranslatedResource objects have been created. translated_resources = TranslatedResource.objects.filter(resource__project=project) assert len(translated_resources) == locales_count # Verify stats have been correctly updated on locale, project and resource. for tr in translated_resources: assert tr.total_strings == strings_count project = Project.objects.get(id=project.id) assert project.total_strings == strings_count * locales_count for l in locales: locale = Locale.objects.get(id=l.id) assert locale.total_strings == strings_count @pytest.mark.django_db def test_manage_project_strings_new_all_empty(client_superuser): """Test that sending empty data doesn't create empty strings in the database. """ project = ProjectFactory.create(data_source='database', repositories=[]) url = reverse('pontoon.admin.project.strings', args=(project.slug,)) # Test sending an empty batch of strings. new_strings = " \n \n\n" response = client_superuser.post(url, {'new_strings': new_strings}) assert response.status_code == 200 # Verify no strings have been created as entities. entities = list(Entity.objects.filter(resource__project=project)) assert len(entities) == 0 @pytest.mark.django_db @pytest.mark.django_db @pytest.mark.django_db
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 12972, 9288, 198, 198, 6738, 42625, 14208, 13, 7295, 13, 6371, 411, 349, 690, 1330, 9575, 198, 198, 6738, 45443, 2049, 13, 39081, 1358, 13, 23914, 1330, 357, 198, 220, 220, 220, 4935, 8479, 11, 198, 8, 198, 6738, 45443, 2049, 13, 39081, 1358, 13, 33571, 1330, 4808, 17953, 62, 273, 62, 19119, 62, 7645, 17249, 62, 37540, 198, 6738, 45443, 2049, 13, 8692, 13, 27530, 1330, 357, 198, 220, 220, 220, 20885, 11, 198, 220, 220, 220, 15181, 1000, 11, 198, 220, 220, 220, 4935, 11, 198, 220, 220, 220, 4935, 33711, 1000, 11, 198, 220, 220, 220, 20857, 11, 198, 220, 220, 220, 3602, 17249, 26198, 11, 198, 8, 198, 6738, 45443, 2049, 13, 9288, 13, 22584, 1749, 1330, 357, 198, 220, 220, 220, 20885, 22810, 11, 198, 220, 220, 220, 15181, 1000, 22810, 11, 198, 220, 220, 220, 4935, 22810, 11, 198, 220, 220, 220, 20857, 22810, 11, 198, 220, 220, 220, 33322, 22810, 11, 198, 220, 220, 220, 11787, 22810, 11, 198, 8, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 198, 4299, 1332, 62, 805, 496, 62, 16302, 62, 37336, 62, 7645, 17249, 62, 31092, 7, 16366, 62, 16668, 7220, 2599, 198, 220, 220, 220, 37227, 14402, 326, 4375, 649, 13042, 284, 257, 1628, 13536, 11059, 286, 326, 198, 220, 220, 220, 1628, 319, 477, 9343, 1957, 274, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1957, 274, 796, 685, 198, 220, 220, 220, 220, 220, 220, 220, 15181, 1000, 22810, 13, 17953, 7, 8189, 11639, 41582, 3256, 1438, 11639, 42, 1359, 261, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 15181, 1000, 22810, 13, 17953, 7, 8189, 11639, 14542, 3256, 1438, 11639, 10082, 261, 418, 666, 33809, 198, 220, 220, 220, 2361, 198, 220, 220, 220, 1628, 796, 4935, 22810, 13, 17953, 7, 198, 220, 220, 220, 220, 220, 220, 220, 1366, 62, 10459, 11639, 48806, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 1957, 274, 28, 17946, 2040, 11, 198, 220, 220, 220, 220, 220, 220, 220, 38072, 28, 21737, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 1957, 274, 62, 9127, 796, 18896, 7, 17946, 2040, 8, 198, 220, 220, 220, 4808, 17953, 62, 273, 62, 19119, 62, 7645, 17249, 62, 37540, 7, 16302, 11, 1957, 274, 8, 628, 220, 220, 220, 19016, 796, 9575, 10786, 79, 756, 2049, 13, 28482, 13, 16302, 13, 37336, 3256, 26498, 16193, 16302, 13, 6649, 1018, 11, 4008, 628, 220, 220, 220, 649, 62, 37336, 796, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 30395, 11, 466, 345, 760, 644, 366, 54, 549, 7012, 300, 549, 7012, 10873, 10873, 1, 1724, 30, 198, 220, 220, 220, 220, 220, 220, 220, 3966, 326, 338, 655, 8759, 338, 8531, 1729, 12, 33819, 4929, 9546, 13, 198, 220, 220, 220, 220, 220, 220, 220, 632, 338, 407, 13, 198, 220, 220, 220, 220, 220, 220, 220, 554, 616, 661, 338, 11880, 11, 340, 1724, 366, 40, 716, 287, 1049, 2356, 11, 3387, 1037, 502, 1911, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 13042, 62, 9127, 796, 604, 198, 220, 220, 220, 2882, 796, 5456, 62, 16668, 7220, 13, 7353, 7, 6371, 11, 1391, 6, 3605, 62, 37336, 10354, 649, 62, 37336, 30072, 198, 220, 220, 220, 6818, 2882, 13, 13376, 62, 8189, 6624, 939, 628, 220, 220, 220, 1303, 49899, 645, 13042, 423, 587, 2727, 355, 12066, 13, 198, 220, 220, 220, 12066, 796, 1351, 7, 32398, 13, 48205, 13, 24455, 7, 31092, 834, 16302, 28, 16302, 4008, 198, 220, 220, 220, 6818, 18896, 7, 298, 871, 8, 6624, 13042, 62, 9127, 628, 220, 220, 220, 1303, 49899, 262, 8271, 468, 262, 826, 9756, 13, 198, 220, 220, 220, 4133, 796, 20857, 13, 48205, 13, 24455, 7, 16302, 28, 16302, 8, 198, 220, 220, 220, 6818, 18896, 7, 37540, 8, 6624, 352, 198, 220, 220, 220, 8271, 796, 4133, 58, 15, 60, 198, 220, 220, 220, 6818, 8271, 13, 23350, 62, 37336, 6624, 13042, 62, 9127, 628, 220, 220, 220, 1303, 49899, 262, 3376, 3602, 17249, 26198, 5563, 423, 587, 2727, 13, 198, 220, 220, 220, 14251, 62, 37540, 796, 3602, 17249, 26198, 13, 48205, 13, 24455, 7, 31092, 834, 16302, 28, 16302, 8, 198, 220, 220, 220, 6818, 18896, 7, 7645, 17249, 62, 37540, 8, 6624, 1957, 274, 62, 9127, 628, 220, 220, 220, 1303, 49899, 9756, 423, 587, 9380, 6153, 319, 36693, 11, 1628, 290, 8271, 13, 198, 220, 220, 220, 329, 491, 287, 14251, 62, 37540, 25, 198, 220, 220, 220, 220, 220, 220, 220, 6818, 491, 13, 23350, 62, 37336, 6624, 13042, 62, 9127, 628, 220, 220, 220, 1628, 796, 4935, 13, 48205, 13, 1136, 7, 312, 28, 16302, 13, 312, 8, 198, 220, 220, 220, 6818, 1628, 13, 23350, 62, 37336, 6624, 13042, 62, 9127, 1635, 1957, 274, 62, 9127, 628, 220, 220, 220, 329, 300, 287, 1957, 274, 25, 198, 220, 220, 220, 220, 220, 220, 220, 36693, 796, 15181, 1000, 13, 48205, 13, 1136, 7, 312, 28, 75, 13, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6818, 36693, 13, 23350, 62, 37336, 6624, 13042, 62, 9127, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 198, 4299, 1332, 62, 805, 496, 62, 16302, 62, 37336, 62, 3605, 62, 439, 62, 28920, 7, 16366, 62, 16668, 7220, 2599, 198, 220, 220, 220, 37227, 14402, 326, 7216, 6565, 1366, 1595, 470, 2251, 6565, 13042, 287, 262, 6831, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1628, 796, 4935, 22810, 13, 17953, 7, 7890, 62, 10459, 11639, 48806, 3256, 38072, 41888, 12962, 198, 220, 220, 220, 19016, 796, 9575, 10786, 79, 756, 2049, 13, 28482, 13, 16302, 13, 37336, 3256, 26498, 16193, 16302, 13, 6649, 1018, 11, 4008, 628, 220, 220, 220, 1303, 6208, 7216, 281, 6565, 15458, 286, 13042, 13, 198, 220, 220, 220, 649, 62, 37336, 796, 366, 220, 3467, 77, 220, 220, 3467, 77, 59, 77, 1, 198, 220, 220, 220, 2882, 796, 5456, 62, 16668, 7220, 13, 7353, 7, 6371, 11, 1391, 6, 3605, 62, 37336, 10354, 649, 62, 37336, 30072, 198, 220, 220, 220, 6818, 2882, 13, 13376, 62, 8189, 6624, 939, 628, 220, 220, 220, 1303, 49899, 645, 13042, 423, 587, 2727, 355, 12066, 13, 198, 220, 220, 220, 12066, 796, 1351, 7, 32398, 13, 48205, 13, 24455, 7, 31092, 834, 16302, 28, 16302, 4008, 198, 220, 220, 220, 6818, 18896, 7, 298, 871, 8, 6624, 657, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 628, 198, 31, 9078, 9288, 13, 4102, 13, 28241, 14208, 62, 9945, 198 ]
2.881255
1,179
# -*- coding: utf-8 -*- # Copyright 2018-2022 the orix developers # # This file is part of orix. # # orix is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # orix is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with orix. If not, see <http://www.gnu.org/licenses/>. """Four-dimensional objects. In a simplified sense, quaternions are an extension of the concept of complex numbers, represented by :math:`a + bi + cj + dk` where :math:`i`, :math:`j`, and :math:`k` are quaternion units and :math:`i^2 = j^2 = k^2 = ijk = -1`. For further reference see `the Wikipedia article <https://en.wikipedia.org/wiki/Quaternion>`_. Unit quaternions are efficient objects for representing rotations, and hence orientations. """ from orix.quaternion.quaternion import Quaternion, check_quaternion # isort: skip from orix.quaternion.orientation import Misorientation, Orientation from orix.quaternion.orientation_region import OrientationRegion, get_proper_groups from orix.quaternion.rotation import Rotation, von_mises from orix.quaternion.symmetry import Symmetry, get_distinguished_points, get_point_group # Lists what will be imported when calling "from orix.quaternion import *" __all__ = [ "check_quaternion", "Quaternion", "Rotation", "von_mises", "Misorientation", "Orientation", "get_proper_groups", "OrientationRegion", "get_distinguished_points", "get_point_group", "Symmetry", ]
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 2864, 12, 1238, 1828, 262, 267, 8609, 6505, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 267, 8609, 13, 198, 2, 198, 2, 267, 8609, 318, 1479, 3788, 25, 345, 460, 17678, 4163, 340, 290, 14, 273, 13096, 198, 2, 340, 739, 262, 2846, 286, 262, 22961, 3611, 5094, 13789, 355, 3199, 416, 198, 2, 262, 3232, 10442, 5693, 11, 2035, 2196, 513, 286, 262, 13789, 11, 393, 198, 2, 357, 265, 534, 3038, 8, 597, 1568, 2196, 13, 198, 2, 198, 2, 267, 8609, 318, 9387, 287, 262, 2911, 326, 340, 481, 307, 4465, 11, 198, 2, 475, 42881, 15529, 34764, 56, 26, 1231, 772, 262, 17142, 18215, 286, 198, 2, 34482, 3398, 1565, 5603, 25382, 393, 376, 46144, 7473, 317, 16652, 2149, 37232, 33079, 48933, 13, 220, 4091, 262, 198, 2, 22961, 3611, 5094, 13789, 329, 517, 3307, 13, 198, 2, 198, 2, 921, 815, 423, 2722, 257, 4866, 286, 262, 22961, 3611, 5094, 13789, 198, 2, 1863, 351, 267, 8609, 13, 220, 1002, 407, 11, 766, 1279, 4023, 1378, 2503, 13, 41791, 13, 2398, 14, 677, 4541, 15913, 13, 198, 198, 37811, 15137, 12, 19577, 5563, 13, 198, 198, 818, 257, 27009, 2565, 11, 627, 9205, 507, 389, 281, 7552, 286, 262, 3721, 286, 3716, 198, 77, 17024, 11, 7997, 416, 1058, 11018, 25, 63, 64, 1343, 3182, 1343, 269, 73, 1343, 288, 74, 63, 810, 1058, 11018, 25, 63, 72, 47671, 1058, 11018, 25, 63, 73, 47671, 290, 198, 25, 11018, 25, 63, 74, 63, 389, 627, 9205, 295, 4991, 290, 1058, 11018, 25, 63, 72, 61, 17, 796, 474, 61, 17, 796, 479, 61, 17, 796, 1312, 73, 74, 796, 532, 16, 44646, 1114, 198, 69, 1914, 4941, 766, 198, 63, 1169, 15312, 2708, 1279, 5450, 1378, 268, 13, 31266, 13, 2398, 14, 15466, 14, 4507, 9205, 295, 29, 63, 44807, 198, 198, 26453, 627, 9205, 507, 389, 6942, 5563, 329, 10200, 5724, 602, 11, 290, 12891, 198, 13989, 602, 13, 198, 37811, 198, 198, 6738, 267, 8609, 13, 421, 9205, 295, 13, 421, 9205, 295, 1330, 2264, 9205, 295, 11, 2198, 62, 421, 9205, 295, 220, 1303, 318, 419, 25, 14267, 198, 6738, 267, 8609, 13, 421, 9205, 295, 13, 13989, 341, 1330, 14136, 13989, 341, 11, 35275, 341, 198, 6738, 267, 8609, 13, 421, 9205, 295, 13, 13989, 341, 62, 36996, 1330, 35275, 341, 47371, 11, 651, 62, 1676, 525, 62, 24432, 198, 6738, 267, 8609, 13, 421, 9205, 295, 13, 10599, 341, 1330, 371, 14221, 11, 18042, 62, 76, 2696, 198, 6738, 267, 8609, 13, 421, 9205, 295, 13, 1837, 3020, 11973, 1330, 1632, 3020, 11973, 11, 651, 62, 17080, 46709, 62, 13033, 11, 651, 62, 4122, 62, 8094, 198, 198, 2, 44968, 644, 481, 307, 17392, 618, 4585, 366, 6738, 267, 8609, 13, 421, 9205, 295, 1330, 1635, 1, 198, 834, 439, 834, 796, 685, 198, 220, 220, 220, 366, 9122, 62, 421, 9205, 295, 1600, 198, 220, 220, 220, 366, 4507, 9205, 295, 1600, 198, 220, 220, 220, 366, 49, 14221, 1600, 198, 220, 220, 220, 366, 26982, 62, 76, 2696, 1600, 198, 220, 220, 220, 366, 31281, 13989, 341, 1600, 198, 220, 220, 220, 366, 46, 8289, 341, 1600, 198, 220, 220, 220, 366, 1136, 62, 1676, 525, 62, 24432, 1600, 198, 220, 220, 220, 366, 46, 8289, 341, 47371, 1600, 198, 220, 220, 220, 366, 1136, 62, 17080, 46709, 62, 13033, 1600, 198, 220, 220, 220, 366, 1136, 62, 4122, 62, 8094, 1600, 198, 220, 220, 220, 366, 13940, 3020, 11973, 1600, 198, 60, 198 ]
3.096026
604
import numpy as np
[ 11748, 299, 32152, 355, 45941, 628, 628, 628, 628 ]
2.888889
9
import random import matplotlib.pyplot as plt import numpy as np from prettytable import PrettyTable from auction import Auction if __name__ == '__main__': buyers = 10 strategy = [1 for n in range(buyers)] # strategy[0] = 4 auctioneer = Auctioneer(0.1, bidding_factor_strategy=strategy, M_types=3, K_sellers=4, N_buyers=buyers, R_rounds=100, level_comm_flag=False, use_seller=False, debug=True) auctioneer.start_auction() auctioneer.plot_statistics() print("\nBidding factors when the simulation is finished") auctioneer.print_alphas()
[ 11748, 4738, 198, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 2495, 11487, 1330, 20090, 10962, 198, 198, 6738, 14389, 1330, 36071, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 14456, 796, 838, 198, 220, 220, 220, 4811, 796, 685, 16, 329, 299, 287, 2837, 7, 17846, 364, 15437, 198, 220, 220, 220, 1303, 4811, 58, 15, 60, 796, 604, 198, 220, 220, 220, 14389, 28153, 796, 36071, 28153, 7, 15, 13, 16, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 23829, 62, 31412, 62, 2536, 4338, 28, 2536, 4338, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 337, 62, 19199, 28, 18, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 509, 62, 7255, 364, 28, 19, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 399, 62, 17846, 364, 28, 17846, 364, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 371, 62, 744, 82, 28, 3064, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1241, 62, 9503, 62, 32109, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 779, 62, 32932, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14257, 28, 17821, 8, 198, 220, 220, 220, 14389, 28153, 13, 9688, 62, 559, 596, 3419, 198, 220, 220, 220, 14389, 28153, 13, 29487, 62, 14269, 3969, 3419, 198, 220, 220, 220, 3601, 7203, 59, 77, 33, 13494, 5087, 618, 262, 18640, 318, 5201, 4943, 198, 220, 220, 220, 14389, 28153, 13, 4798, 62, 282, 5902, 3419, 198 ]
1.86215
428
import argparse from utils.utils import * from utils.line import Line from tqdm import trange import torch import torch.optim as optim import sys import pickle if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-g", "--graph_path", type=str) parser.add_argument("-save", "--save_path", type=str) parser.add_argument("-lossdata", "--lossdata_path", type=str) # Hyperparams. parser.add_argument("-order", "--order", type=int, default=2) parser.add_argument("-neg", "--negsamplesize", type=int, default=5) parser.add_argument("-dim", "--dimension", type=int, default=128) parser.add_argument("-batchsize", "--batchsize", type=int, default=5) parser.add_argument("-epochs", "--epochs", type=int, default=1) parser.add_argument("-lr", "--learning_rate", type=float, default=0.025) # As starting value in paper parser.add_argument("-negpow", "--negativepower", type=float, default=0.75) args = parser.parse_args() # Create dict of distribution when opening file edgedistdict, nodedistdict, weights, nodedegrees, maxindex = makeDist( args.graph_path, args.negativepower) edgesaliassampler = VoseAlias(edgedistdict) nodesaliassampler = VoseAlias(nodedistdict) batchrange = int(len(edgedistdict) / args.batchsize) print(maxindex) line = Line(maxindex + 1, embed_dim=args.dimension, order=args.order) opt = optim.SGD(line.parameters(), lr=args.learning_rate, momentum=0.9, nesterov=True) device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") lossdata = {"it": [], "loss": []} it = 0 print("\nTraining on {}...\n".format(device)) for epoch in range(args.epochs): print("Epoch {}".format(epoch)) for b in trange(batchrange): samplededges = edgesaliassampler.sample_n(args.batchsize) batch = list(makeData(samplededges, args.negsamplesize, weights, nodedegrees, nodesaliassampler)) batch = torch.LongTensor(batch) v_i = batch[:, 0] v_j = batch[:, 1] negsamples = batch[:, 2:] line.zero_grad() loss = line(v_i, v_j, negsamples, device) loss.backward() opt.step() lossdata["loss"].append(loss.item()) lossdata["it"].append(it) it += 1 print("\nDone training, saving model to {}".format(args.save_path)) torch.save(line, "{}".format(args.save_path)) print("Saving loss data at {}".format(args.lossdata_path)) with open(args.lossdata_path, "wb") as ldata: pickle.dump(lossdata, ldata) sys.exit()
[ 11748, 1822, 29572, 198, 6738, 3384, 4487, 13, 26791, 1330, 1635, 198, 6738, 3384, 4487, 13, 1370, 1330, 6910, 198, 6738, 256, 80, 36020, 1330, 491, 858, 198, 11748, 28034, 198, 11748, 28034, 13, 40085, 355, 6436, 198, 11748, 25064, 198, 11748, 2298, 293, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 3419, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 70, 1600, 366, 438, 34960, 62, 6978, 1600, 2099, 28, 2536, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 21928, 1600, 366, 438, 21928, 62, 6978, 1600, 2099, 28, 2536, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 22462, 7890, 1600, 366, 438, 22462, 7890, 62, 6978, 1600, 2099, 28, 2536, 8, 628, 220, 220, 220, 1303, 15079, 37266, 13, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 2875, 1600, 366, 438, 2875, 1600, 2099, 28, 600, 11, 4277, 28, 17, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 12480, 1600, 366, 438, 12480, 82, 12629, 1096, 1600, 2099, 28, 600, 11, 4277, 28, 20, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 27740, 1600, 366, 438, 46156, 1600, 2099, 28, 600, 11, 4277, 28, 12762, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 43501, 7857, 1600, 366, 438, 43501, 7857, 1600, 2099, 28, 600, 11, 4277, 28, 20, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 538, 5374, 82, 1600, 366, 438, 538, 5374, 82, 1600, 2099, 28, 600, 11, 4277, 28, 16, 8, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 14050, 1600, 366, 438, 40684, 62, 4873, 1600, 2099, 28, 22468, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 28, 15, 13, 36629, 8, 220, 1303, 1081, 3599, 1988, 287, 3348, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 12480, 79, 322, 1600, 366, 438, 31591, 6477, 1600, 2099, 28, 22468, 11, 4277, 28, 15, 13, 2425, 8, 198, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 220, 220, 220, 1303, 13610, 8633, 286, 6082, 618, 4756, 2393, 198, 220, 220, 220, 45871, 396, 11600, 11, 299, 9043, 396, 11600, 11, 19590, 11, 299, 9043, 1533, 6037, 11, 3509, 9630, 796, 787, 20344, 7, 198, 220, 220, 220, 220, 220, 220, 220, 26498, 13, 34960, 62, 6978, 11, 26498, 13, 31591, 6477, 8, 628, 220, 220, 220, 13015, 7344, 562, 321, 20053, 796, 569, 577, 40489, 7, 48916, 396, 11600, 8, 198, 220, 220, 220, 13760, 7344, 562, 321, 20053, 796, 569, 577, 40489, 7, 77, 9043, 396, 11600, 8, 628, 220, 220, 220, 15458, 9521, 796, 493, 7, 11925, 7, 48916, 396, 11600, 8, 1220, 26498, 13, 43501, 7857, 8, 198, 220, 220, 220, 3601, 7, 9806, 9630, 8, 198, 220, 220, 220, 1627, 796, 6910, 7, 9806, 9630, 1343, 352, 11, 11525, 62, 27740, 28, 22046, 13, 46156, 11, 1502, 28, 22046, 13, 2875, 8, 628, 220, 220, 220, 2172, 796, 6436, 13, 38475, 35, 7, 1370, 13, 17143, 7307, 22784, 300, 81, 28, 22046, 13, 40684, 62, 4873, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12858, 28, 15, 13, 24, 11, 299, 7834, 709, 28, 17821, 8, 628, 220, 220, 220, 3335, 796, 28034, 13, 25202, 7203, 66, 15339, 25, 15, 1, 611, 28034, 13, 66, 15339, 13, 271, 62, 15182, 3419, 2073, 366, 36166, 4943, 628, 220, 220, 220, 2994, 7890, 796, 19779, 270, 1298, 685, 4357, 366, 22462, 1298, 17635, 92, 198, 220, 220, 220, 340, 796, 657, 628, 220, 220, 220, 3601, 7203, 59, 77, 44357, 319, 23884, 986, 59, 77, 1911, 18982, 7, 25202, 4008, 198, 220, 220, 220, 329, 36835, 287, 2837, 7, 22046, 13, 538, 5374, 82, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 13807, 5374, 23884, 1911, 18982, 7, 538, 5374, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 329, 275, 287, 491, 858, 7, 43501, 9521, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 35846, 276, 3212, 796, 13015, 7344, 562, 321, 20053, 13, 39873, 62, 77, 7, 22046, 13, 43501, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15458, 796, 1351, 7, 15883, 6601, 7, 37687, 10137, 276, 3212, 11, 26498, 13, 12480, 82, 12629, 1096, 11, 19590, 11, 299, 9043, 1533, 6037, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13760, 7344, 562, 321, 20053, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15458, 796, 28034, 13, 14617, 51, 22854, 7, 43501, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 410, 62, 72, 796, 15458, 58, 45299, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 410, 62, 73, 796, 15458, 58, 45299, 352, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2469, 82, 12629, 796, 15458, 58, 45299, 362, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 13, 22570, 62, 9744, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2994, 796, 1627, 7, 85, 62, 72, 11, 410, 62, 73, 11, 2469, 82, 12629, 11, 3335, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2994, 13, 1891, 904, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2172, 13, 9662, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2994, 7890, 14692, 22462, 1, 4083, 33295, 7, 22462, 13, 9186, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2994, 7890, 14692, 270, 1, 4083, 33295, 7, 270, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 340, 15853, 352, 628, 220, 220, 220, 3601, 7203, 59, 77, 45677, 3047, 11, 8914, 2746, 284, 23884, 1911, 18982, 7, 22046, 13, 21928, 62, 6978, 4008, 198, 220, 220, 220, 28034, 13, 21928, 7, 1370, 11, 45144, 92, 1911, 18982, 7, 22046, 13, 21928, 62, 6978, 4008, 628, 220, 220, 220, 3601, 7203, 50, 2703, 2994, 1366, 379, 23884, 1911, 18982, 7, 22046, 13, 22462, 7890, 62, 6978, 4008, 198, 220, 220, 220, 351, 1280, 7, 22046, 13, 22462, 7890, 62, 6978, 11, 366, 39346, 4943, 355, 300, 7890, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2298, 293, 13, 39455, 7, 22462, 7890, 11, 300, 7890, 8, 198, 220, 220, 220, 25064, 13, 37023, 3419, 198 ]
2.341902
1,167
# SDT4Parser.py # # Callback target class for the ElementTree parser to parse a SDT4 from .SDT4Classes import * # # Hanlder for each of the element types # # # Assignment of element types and (handlerFunction, (tuple of allowed parents)) # handlers = { SDT4Parser.actionTag : (handleAction, (SDT4ModuleClass,)), SDT4Parser.argTag : (handleArg, (SDT4Action,)), SDT4Parser.arrayTypeTag : (handleArrayType, (SDT4DataType,)), SDT4Parser.bTag : (handleB, (SDT4Doc, SDT4DocP)), SDT4Parser.constraintTag : (handleConstraint, (SDT4DataType,)), SDT4Parser.dataPointTag : (handleDataPoint, (SDT4Event, SDT4ModuleClass)), SDT4Parser.dataTypeTag : (handleDataType, (SDT4Action, SDT4DataPoint, SDT4Event, SDT4Arg, SDT4StructType, SDT4ArrayType, SDT4Domain)), SDT4Parser.deviceClassTag : (handleDeviceClass, (SDT4Domain,)), SDT4Parser.docTag : (handleDoc, (SDT4Domain, SDT4ProductClass, SDT4DeviceClass, SDT4SubDevice, SDT4DataType, SDT4ModuleClass, SDT4Action, SDT4DataPoint, SDT4Event, SDT4EnumValue, SDT4Arg, SDT4Constraint, SDT4Property)), SDT4Parser.domainTag : (handleDomain, None), SDT4Parser.emTag : (handleEM, (SDT4Doc, SDT4DocP)), SDT4Parser.enumTypeTag : (handleEnumType, (SDT4DataType,)), SDT4Parser.enumValueTag : (handleEnumValue, (SDT4EnumType,)), SDT4Parser.eventTag : (handleEvent, (SDT4ModuleClass,)), SDT4Parser.excludeTag : (handleExtendExclude, (SDT4Extend,)), SDT4Parser.extendTag : (handleExtend, (SDT4ModuleClass, SDT4DataType, SDT4ProductClass, SDT4SubDevice)), SDT4Parser.imgTag : (handleImg, (SDT4Doc, SDT4DocP)), SDT4Parser.imgCaptionTag : (handleImgCaption, (SDT4DocIMG,)), SDT4Parser.includeTag : (handleInclude, (SDT4Domain, SDT4Extend)), SDT4Parser.moduleClassTag : (handleModuleClass, (SDT4Domain, SDT4ProductClass, SDT4DeviceClass, SDT4SubDevice, SDT4ProductClass)), SDT4Parser.pTag : (handleP, (SDT4Doc, SDT4DocP)), SDT4Parser.productClassTag : (handleProductClass, (SDT4Domain,)), SDT4Parser.propertyTag : (handleProperty, (SDT4ProductClass, SDT4DeviceClass, SDT4SubDevice, SDT4ModuleClass)), SDT4Parser.simpleTypeTag : (handleSimpleType, (SDT4DataType, SDT4Property)), SDT4Parser.structTypeTag : (handleStructType, (SDT4DataType,)), SDT4Parser.subDeviceTag : (handleSubDevice, (SDT4DeviceClass, SDT4ProductClass, SDT4Domain)), SDT4Parser.ttTag : (handleTT, (SDT4Doc, SDT4DocP)) }
[ 2, 197, 10305, 51, 19, 46677, 13, 9078, 198, 2, 198, 2, 197, 47258, 2496, 1398, 329, 262, 11703, 27660, 30751, 284, 21136, 257, 9834, 51, 19, 198, 198, 6738, 764, 10305, 51, 19, 9487, 274, 1330, 1635, 628, 628, 198, 2, 198, 2, 197, 29919, 6499, 329, 1123, 286, 262, 5002, 3858, 198, 2, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 198, 2, 198, 2, 197, 8021, 16747, 286, 5002, 3858, 290, 357, 30281, 22203, 11, 357, 83, 29291, 286, 3142, 3397, 4008, 198, 2, 628, 198, 4993, 8116, 796, 1391, 198, 197, 10305, 51, 19, 46677, 13, 2673, 24835, 220, 197, 197, 25, 357, 28144, 12502, 11, 357, 10305, 51, 19, 26796, 9487, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 853, 24835, 220, 197, 197, 197, 25, 357, 28144, 28100, 11, 357, 10305, 51, 19, 12502, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 18747, 6030, 24835, 220, 197, 25, 357, 28144, 19182, 6030, 11, 357, 10305, 51, 19, 6601, 6030, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 65, 24835, 220, 197, 197, 197, 25, 357, 28144, 33, 11, 357, 10305, 51, 19, 23579, 11, 9834, 51, 19, 23579, 47, 36911, 198, 197, 10305, 51, 19, 46677, 13, 1102, 2536, 2913, 24835, 220, 197, 25, 357, 28144, 3103, 2536, 2913, 11, 357, 10305, 51, 19, 6601, 6030, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 7890, 12727, 24835, 197, 197, 25, 357, 28144, 6601, 12727, 11, 357, 10305, 51, 19, 9237, 11, 9834, 51, 19, 26796, 9487, 36911, 198, 197, 10305, 51, 19, 46677, 13, 7890, 6030, 24835, 220, 197, 197, 25, 357, 28144, 6601, 6030, 11, 357, 10305, 51, 19, 12502, 11, 9834, 51, 19, 6601, 12727, 11, 9834, 51, 19, 9237, 11, 9834, 51, 19, 28100, 11, 9834, 51, 19, 44909, 6030, 11, 9834, 51, 19, 19182, 6030, 11, 9834, 51, 19, 43961, 36911, 198, 197, 10305, 51, 19, 46677, 13, 25202, 9487, 24835, 220, 197, 25, 357, 28144, 24728, 9487, 11, 357, 10305, 51, 19, 43961, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 15390, 24835, 220, 197, 197, 197, 25, 357, 28144, 23579, 11, 357, 10305, 51, 19, 43961, 11, 9834, 51, 19, 15667, 9487, 11, 9834, 51, 19, 24728, 9487, 11, 9834, 51, 19, 7004, 24728, 11, 9834, 51, 19, 6601, 6030, 11, 9834, 51, 19, 26796, 9487, 11, 9834, 51, 19, 12502, 11, 9834, 51, 19, 6601, 12727, 11, 9834, 51, 19, 9237, 11, 9834, 51, 19, 4834, 388, 11395, 11, 9834, 51, 19, 28100, 11, 9834, 51, 19, 3103, 2536, 2913, 11, 9834, 51, 19, 21746, 36911, 198, 197, 10305, 51, 19, 46677, 13, 27830, 24835, 220, 197, 197, 25, 357, 28144, 43961, 11, 6045, 828, 198, 197, 10305, 51, 19, 46677, 13, 368, 24835, 220, 197, 197, 197, 25, 357, 28144, 3620, 11, 357, 10305, 51, 19, 23579, 11, 9834, 51, 19, 23579, 47, 36911, 198, 197, 10305, 51, 19, 46677, 13, 44709, 6030, 24835, 220, 197, 197, 25, 357, 28144, 4834, 388, 6030, 11, 357, 10305, 51, 19, 6601, 6030, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 44709, 11395, 24835, 220, 197, 25, 357, 28144, 4834, 388, 11395, 11, 357, 10305, 51, 19, 4834, 388, 6030, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 15596, 24835, 220, 197, 197, 25, 357, 28144, 9237, 11, 357, 10305, 51, 19, 26796, 9487, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 1069, 9152, 24835, 220, 197, 197, 25, 357, 28144, 11627, 437, 3109, 9152, 11, 357, 10305, 51, 19, 11627, 437, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 2302, 437, 24835, 220, 197, 197, 25, 357, 28144, 11627, 437, 11, 357, 10305, 51, 19, 26796, 9487, 11, 9834, 51, 19, 6601, 6030, 11, 9834, 51, 19, 15667, 9487, 11, 9834, 51, 19, 7004, 24728, 36911, 198, 197, 10305, 51, 19, 46677, 13, 9600, 24835, 220, 197, 197, 197, 25, 357, 28144, 3546, 70, 11, 357, 10305, 51, 19, 23579, 11, 9834, 51, 19, 23579, 47, 36911, 198, 197, 10305, 51, 19, 46677, 13, 9600, 24334, 1159, 24835, 220, 197, 25, 357, 28144, 3546, 70, 24334, 1159, 11, 357, 10305, 51, 19, 23579, 3955, 38, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 17256, 24835, 220, 197, 197, 25, 357, 28144, 818, 9152, 11, 357, 10305, 51, 19, 43961, 11, 9834, 51, 19, 11627, 437, 36911, 198, 197, 10305, 51, 19, 46677, 13, 21412, 9487, 24835, 220, 197, 25, 357, 28144, 26796, 9487, 11, 357, 10305, 51, 19, 43961, 11, 9834, 51, 19, 15667, 9487, 11, 9834, 51, 19, 24728, 9487, 11, 9834, 51, 19, 7004, 24728, 11, 9834, 51, 19, 15667, 9487, 36911, 198, 197, 10305, 51, 19, 46677, 13, 79, 24835, 220, 197, 197, 197, 25, 357, 28144, 47, 11, 357, 10305, 51, 19, 23579, 11, 9834, 51, 19, 23579, 47, 36911, 198, 197, 10305, 51, 19, 46677, 13, 11167, 9487, 24835, 197, 25, 357, 28144, 15667, 9487, 11, 357, 10305, 51, 19, 43961, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 26745, 24835, 197, 197, 25, 357, 28144, 21746, 11, 357, 10305, 51, 19, 15667, 9487, 11, 9834, 51, 19, 24728, 9487, 11, 9834, 51, 19, 7004, 24728, 11, 9834, 51, 19, 26796, 9487, 36911, 198, 197, 10305, 51, 19, 46677, 13, 36439, 6030, 24835, 220, 197, 25, 357, 28144, 26437, 6030, 11, 357, 10305, 51, 19, 6601, 6030, 11, 9834, 51, 19, 21746, 36911, 198, 197, 10305, 51, 19, 46677, 13, 7249, 6030, 24835, 197, 25, 357, 28144, 44909, 6030, 11, 357, 10305, 51, 19, 6601, 6030, 35751, 828, 198, 197, 10305, 51, 19, 46677, 13, 7266, 24728, 24835, 220, 197, 25, 357, 28144, 7004, 24728, 11, 357, 10305, 51, 19, 24728, 9487, 11, 9834, 51, 19, 15667, 9487, 11, 9834, 51, 19, 43961, 36911, 198, 197, 10305, 51, 19, 46677, 13, 926, 24835, 220, 197, 197, 197, 25, 357, 28144, 15751, 11, 357, 10305, 51, 19, 23579, 11, 9834, 51, 19, 23579, 47, 4008, 198, 92, 198 ]
2.408184
1,002
from data import dex import re def validate_team(team): ''' team is an array of six pokemon sets ''' if len(team) > 6: raise InValidSetError("more than 6 pokemon") pokemon_names = set() for pokemon in team: # check if the pokemon is an actual pokemon species = re.sub(r'\W+', '', pokemon['species'].lower()) pokemon_names.add(species) if species not in dex.pokedex: raise InValidSetError(species + " is not a real pokemon species") if len(pokemon['moves']) > 4: raise InValidSetError("more than 4 moves") for move in pokemon['moves']: if move not in dex.simple_learnsets[species]: raise InValidSetError(species + " can't learn the move " + move) if pokemon['ability'] not in [re.sub(r'\W+', '', ability.lower()) for ability in list(filter(None.__ne__, list(dex.pokedex[species].abilities)))]: raise InValidSetError(species + " cant have the ability, " + pokemon['ability']) for i in range(6): if pokemon['evs'][i] > 255 or pokemon['evs'][i] < 0: raise InVaidSetError("ev value is out of range: " + str(pokemon['evs'][i])) if pokemon['ivs'][i] > 31 or pokemon['ivs'][i] < 0: raise InVaidSetError("iv value is out of range: " + str(pokemon['ivs'][i])) if sum(pokemon['evs']) > 510: raise InValidSetError("sum of evs is over 510") if len(team) != len(pokemon_names): raise InValidSetError("cannot have multiple of the same pokemon") return True
[ 6738, 1366, 1330, 36017, 198, 11748, 302, 198, 198, 4299, 26571, 62, 15097, 7, 15097, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 1074, 318, 281, 7177, 286, 2237, 43962, 5621, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 611, 18896, 7, 15097, 8, 1875, 718, 25, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7203, 3549, 621, 718, 43962, 4943, 198, 220, 220, 220, 43962, 62, 14933, 796, 900, 3419, 628, 220, 220, 220, 329, 43962, 287, 1074, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 2198, 611, 262, 43962, 318, 281, 4036, 43962, 198, 220, 220, 220, 220, 220, 220, 220, 4693, 796, 302, 13, 7266, 7, 81, 6, 59, 54, 10, 3256, 705, 3256, 43962, 17816, 35448, 6, 4083, 21037, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 43962, 62, 14933, 13, 2860, 7, 35448, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 4693, 407, 287, 36017, 13, 79, 6545, 1069, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7, 35448, 1343, 366, 318, 407, 257, 1103, 43962, 4693, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 79, 12717, 17816, 76, 5241, 6, 12962, 1875, 604, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7203, 3549, 621, 604, 6100, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1445, 287, 43962, 17816, 76, 5241, 6, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1445, 407, 287, 36017, 13, 36439, 62, 35720, 28709, 58, 35448, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7, 35448, 1343, 366, 460, 470, 2193, 262, 1445, 366, 1343, 1445, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 43962, 17816, 1799, 20520, 407, 287, 685, 260, 13, 7266, 7, 81, 6, 59, 54, 10, 3256, 705, 3256, 2694, 13, 21037, 28955, 329, 2694, 287, 1351, 7, 24455, 7, 14202, 13, 834, 710, 834, 11, 1351, 7, 67, 1069, 13, 79, 6545, 1069, 58, 35448, 4083, 5738, 22305, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7, 35448, 1343, 366, 18548, 423, 262, 2694, 11, 366, 1343, 43962, 17816, 1799, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 21, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 43962, 17816, 1990, 82, 6, 7131, 72, 60, 1875, 14280, 393, 43962, 17816, 1990, 82, 6, 7131, 72, 60, 1279, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 53, 1698, 7248, 12331, 7203, 1990, 1988, 318, 503, 286, 2837, 25, 366, 1343, 965, 7, 79, 12717, 17816, 1990, 82, 6, 7131, 72, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 43962, 17816, 452, 82, 6, 7131, 72, 60, 1875, 3261, 393, 43962, 17816, 452, 82, 6, 7131, 72, 60, 1279, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 53, 1698, 7248, 12331, 7203, 452, 1988, 318, 503, 286, 2837, 25, 366, 1343, 965, 7, 79, 12717, 17816, 452, 82, 6, 7131, 72, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2160, 7, 79, 12717, 17816, 1990, 82, 6, 12962, 1875, 35148, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7203, 16345, 286, 819, 82, 318, 625, 35148, 4943, 628, 220, 220, 220, 611, 18896, 7, 15097, 8, 14512, 18896, 7, 79, 12717, 62, 14933, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 554, 47139, 7248, 12331, 7203, 66, 34574, 423, 3294, 286, 262, 976, 43962, 4943, 628, 220, 220, 220, 1441, 6407, 628 ]
2.361891
677
from collections import namedtuple as Struct from sklearn.model_selection import GroupShuffleSplit, ShuffleSplit DataSplitConfig = Struct('DataSplitConfig', ['validation_size', 'test_size', 'random_seed']) DEFAULT_SPLIT_CONFIG = DataSplitConfig(0.2, 0.2, 1337)
[ 6738, 17268, 1330, 3706, 83, 29291, 355, 32112, 198, 6738, 1341, 35720, 13, 19849, 62, 49283, 1330, 4912, 2484, 18137, 41205, 11, 911, 18137, 41205, 198, 198, 6601, 41205, 16934, 796, 32112, 10786, 6601, 41205, 16934, 3256, 37250, 12102, 341, 62, 7857, 3256, 705, 9288, 62, 7857, 3256, 705, 25120, 62, 28826, 6, 12962, 198, 198, 7206, 38865, 62, 4303, 43, 2043, 62, 10943, 16254, 796, 6060, 41205, 16934, 7, 15, 13, 17, 11, 657, 13, 17, 11, 1511, 2718, 8, 198 ]
3.207317
82
import csv file = open("sex-ratio.csv") csvreader = csv.reader(file) header = next(csvreader) mapped = {} for row in csvreader: if(row[0] not in mapped): mapped[row[0]]={} mapped[row[0]][row[2]] = row[3] # f = open("converted.csv",'w') rows=[] for c in mapped: row = [c] for y in mapped[c]: row.append(mapped[c][y]) rows.append(row) header =['country'] for i in range(1950,2018): header.append(str(i)) with open('converted.csv', 'w', encoding='UTF8') as f: writer = csv.writer(f) # write the header writer.writerow(header) # write the data for row in rows: writer.writerow(row)
[ 11748, 269, 21370, 198, 198, 7753, 220, 796, 1280, 7203, 8044, 12, 10366, 952, 13, 40664, 4943, 198, 198, 40664, 46862, 796, 269, 21370, 13, 46862, 7, 7753, 8, 198, 198, 25677, 796, 1306, 7, 40664, 46862, 8, 198, 198, 76, 6320, 796, 23884, 198, 1640, 5752, 287, 269, 21370, 46862, 25, 198, 220, 220, 220, 611, 7, 808, 58, 15, 60, 407, 287, 27661, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 27661, 58, 808, 58, 15, 11907, 34758, 92, 198, 220, 220, 220, 27661, 58, 808, 58, 15, 60, 7131, 808, 58, 17, 11907, 796, 5752, 58, 18, 60, 198, 198, 2, 277, 796, 1280, 7203, 1102, 13658, 13, 40664, 1600, 6, 86, 11537, 198, 8516, 28, 21737, 198, 1640, 269, 287, 27661, 25, 198, 220, 220, 220, 5752, 796, 685, 66, 60, 198, 220, 220, 220, 329, 331, 287, 27661, 58, 66, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 5752, 13, 33295, 7, 76, 6320, 58, 66, 7131, 88, 12962, 198, 220, 220, 220, 15274, 13, 33295, 7, 808, 8, 198, 25677, 796, 17816, 19315, 20520, 198, 1640, 1312, 287, 2837, 7, 42751, 11, 7908, 2599, 198, 220, 220, 220, 13639, 13, 33295, 7, 2536, 7, 72, 4008, 198, 198, 4480, 1280, 10786, 1102, 13658, 13, 40664, 3256, 705, 86, 3256, 21004, 11639, 48504, 23, 11537, 355, 277, 25, 198, 220, 220, 220, 6260, 796, 269, 21370, 13, 16002, 7, 69, 8, 628, 220, 220, 220, 1303, 3551, 262, 13639, 198, 220, 220, 220, 6260, 13, 16002, 322, 7, 25677, 8, 198, 220, 220, 220, 1303, 3551, 262, 1366, 198, 220, 220, 220, 329, 5752, 287, 15274, 25, 198, 220, 220, 220, 220, 220, 220, 220, 6260, 13, 16002, 322, 7, 808, 8, 628, 198 ]
2.254296
291
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import # Markdown is optional try: import markdown def apply_markdown(text): """ Simple wrapper around :func:`markdown.markdown` to set the base level of '#' style headers to <h2>. """ extensions = ['headerid(level=2)'] safe_mode = False md = markdown.Markdown(extensions=extensions, safe_mode=safe_mode) return md.convert(text) except ImportError: apply_markdown = None
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 11, 4112, 62, 11748, 198, 198, 2, 2940, 2902, 318, 11902, 198, 28311, 25, 198, 220, 220, 220, 1330, 1317, 2902, 628, 220, 220, 220, 825, 4174, 62, 4102, 2902, 7, 5239, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 17427, 29908, 1088, 1058, 20786, 25, 63, 4102, 2902, 13, 4102, 2902, 63, 284, 900, 262, 2779, 1241, 198, 220, 220, 220, 220, 220, 220, 220, 286, 705, 2, 6, 3918, 24697, 284, 1279, 71, 17, 28401, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 18366, 796, 37250, 25677, 312, 7, 5715, 28, 17, 8, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 3338, 62, 14171, 796, 10352, 198, 220, 220, 220, 220, 220, 220, 220, 45243, 796, 1317, 2902, 13, 9704, 2902, 7, 2302, 5736, 28, 2302, 5736, 11, 3338, 62, 14171, 28, 21230, 62, 14171, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 45243, 13, 1102, 1851, 7, 5239, 8, 198, 198, 16341, 17267, 12331, 25, 198, 220, 220, 220, 4174, 62, 4102, 2902, 796, 6045, 198 ]
2.44186
215
"""Finite Difference Methods """ import numpy as np def FDMWeights(M, x0, alpha): """Calculate the weights in finite difference formulas for any order of derivative and to any order of accuracy on onedimensional grids with arbitrary spacing. Args: M (int): Order of derivative x0 (float): Approximations at this point alpha (np.array): x-cordinates. length must be N Attributes: N (int): Order of accuracy, which is equivalent to len(alpha)-1. Returns: np.array: Weights References: Bengt Fornberg, "Generation of Finite Difference Formulas on Arbitrarily Spaced Grids", 1988. """ N = len(alpha) - 1 delta = np.zeros([M+1,N+1,N+1]) delta[0,0,0] = 1. c1 = 1. for n in range(1, N+1): c2 = 1. for nu in range(n): c3 = alpha[n] - alpha[nu] c2 *= c3 for m in range(min(n, M)+1): delta[m,n,nu] = ((alpha[n]-x0)*delta[m,n-1,nu] - m*delta[m-1,n-1,nu]) / c3 for m in range(min(n, M)+1): delta[m,n,n] = c1/c2 * (m*delta[m-1,n-1,n-1] - (alpha[n-1]-x0)*delta[m,n-1,n-1]) c1 = c2 return delta class centralFDM(object): """Central Finite Difference Method Args: order (int, optional): The order of the accuracy. Defaults to 2. highestDerivative (int, optional): The order of the highest derivative. Defaults to 1. """ def __call__(self, f, axis=-1, derivative=1, h=1.): """Calculate the derivative. Args: f (np.array): An array containing samples. axis (int, optional): The derivative is calculated only along the given axis. Defaults to -1. derivative (int, optional): The order of the derivative. Defaults to 1. h (float, optional): The space of the uniform grid. Defaults to 1.. Returns: np.array: The derivative. """ df = np.zeros_like(f) weight_ = self.weight[derivative] alpha_ = self.alpha[weight_!=0] weight_ = weight_[weight_!=0] for i, alpha_i in enumerate(alpha_): df += np.roll(f, shift=-int(alpha_i), axis=axis) * weight_[i] return df / h**derivative class upwindFDM(object): """Upwind Finite Difference Method Args: order (int, optional): The order of the accuracy. Defaults to 1. highestDerivative (int, optional): The order of the highest derivative. Defaults to 1. """ def __call__(self, f, axis=-1, derivative=1, h=1., c=None): """Calculate the derivative. Args: f (np.array): An array containing samples. axis (int, optional): The derivative is calculated only along the given axis. Defaults to -1. derivative (int, optional): The order of the derivative. Defaults to 1. h (float, optional): The space of the uniform grid. Defaults to 1.. c (float or np.array, optional): The advection speed. Defaults to None. Returns: np.array: The derivative. """ df = np.zeros_like(f) df2 = np.zeros_like(f) for i, alpha_i in enumerate(self.alpha): df += np.roll(f, shift=-int(alpha_i), axis=axis) * self.weight[derivative,i] df2 += np.roll(f, shift=int(alpha_i), axis=axis) * self.weight2[derivative,i] if c == None: c = f df = np.where(c>=0, df, df2) return df / h**derivative
[ 37811, 37, 9504, 43795, 25458, 198, 37811, 198, 198, 11748, 299, 32152, 355, 45941, 628, 198, 4299, 376, 23127, 1135, 2337, 7, 44, 11, 2124, 15, 11, 17130, 2599, 198, 220, 220, 220, 37227, 9771, 3129, 378, 262, 19590, 287, 27454, 3580, 32126, 198, 220, 220, 220, 329, 597, 1502, 286, 27255, 290, 284, 597, 1502, 286, 9922, 198, 220, 220, 220, 319, 319, 276, 16198, 50000, 351, 14977, 31050, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 337, 357, 600, 2599, 8284, 286, 27255, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 15, 357, 22468, 2599, 2034, 13907, 320, 602, 379, 428, 966, 198, 220, 220, 220, 220, 220, 220, 220, 17130, 357, 37659, 13, 18747, 2599, 2124, 12, 66, 585, 17540, 13, 4129, 1276, 307, 399, 198, 220, 220, 220, 220, 198, 220, 220, 220, 49213, 25, 198, 220, 220, 220, 220, 220, 220, 220, 399, 357, 600, 2599, 8284, 286, 9922, 11, 543, 318, 7548, 284, 18896, 7, 26591, 13219, 16, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 45941, 13, 18747, 25, 775, 2337, 628, 220, 220, 220, 31458, 25, 220, 198, 220, 220, 220, 220, 220, 220, 220, 14964, 83, 1114, 77, 3900, 11, 366, 8645, 341, 286, 4463, 578, 43795, 5178, 25283, 319, 33619, 39000, 1338, 2286, 1902, 2340, 1600, 12122, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 399, 796, 18896, 7, 26591, 8, 532, 352, 198, 220, 220, 220, 25979, 796, 45941, 13, 9107, 418, 26933, 44, 10, 16, 11, 45, 10, 16, 11, 45, 10, 16, 12962, 198, 220, 220, 220, 25979, 58, 15, 11, 15, 11, 15, 60, 796, 352, 13, 198, 220, 220, 220, 269, 16, 796, 352, 13, 198, 220, 220, 220, 329, 299, 287, 2837, 7, 16, 11, 399, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 269, 17, 796, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 329, 14364, 287, 2837, 7, 77, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 18, 796, 17130, 58, 77, 60, 532, 17130, 58, 28803, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 17, 1635, 28, 269, 18, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 285, 287, 2837, 7, 1084, 7, 77, 11, 337, 47762, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25979, 58, 76, 11, 77, 11, 28803, 60, 796, 14808, 26591, 58, 77, 45297, 87, 15, 27493, 67, 12514, 58, 76, 11, 77, 12, 16, 11, 28803, 60, 532, 285, 9, 67, 12514, 58, 76, 12, 16, 11, 77, 12, 16, 11, 28803, 12962, 1220, 269, 18, 198, 220, 220, 220, 220, 220, 220, 220, 329, 285, 287, 2837, 7, 1084, 7, 77, 11, 337, 47762, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25979, 58, 76, 11, 77, 11, 77, 60, 796, 269, 16, 14, 66, 17, 1635, 357, 76, 9, 67, 12514, 58, 76, 12, 16, 11, 77, 12, 16, 11, 77, 12, 16, 60, 532, 357, 26591, 58, 77, 12, 16, 45297, 87, 15, 27493, 67, 12514, 58, 76, 11, 77, 12, 16, 11, 77, 12, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 269, 16, 796, 269, 17, 198, 220, 220, 220, 1441, 25979, 628, 198, 4871, 4318, 37, 23127, 7, 15252, 2599, 198, 220, 220, 220, 37227, 30645, 4463, 578, 43795, 11789, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1502, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 9922, 13, 2896, 13185, 284, 362, 13, 198, 220, 220, 220, 220, 220, 220, 220, 4511, 28532, 452, 876, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 4511, 27255, 13, 2896, 13185, 284, 352, 13, 198, 220, 220, 220, 37227, 220, 220, 220, 220, 628, 220, 220, 220, 825, 11593, 13345, 834, 7, 944, 11, 277, 11, 16488, 10779, 16, 11, 27255, 28, 16, 11, 289, 28, 16, 47308, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 9771, 3129, 378, 262, 27255, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 357, 37659, 13, 18747, 2599, 1052, 7177, 7268, 8405, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 357, 600, 11, 11902, 2599, 383, 27255, 318, 10488, 691, 1863, 262, 1813, 16488, 13, 2896, 13185, 284, 532, 16, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 27255, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 27255, 13, 2896, 13185, 284, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 289, 357, 22468, 11, 11902, 2599, 383, 2272, 286, 262, 8187, 10706, 13, 2896, 13185, 284, 352, 492, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 45941, 13, 18747, 25, 383, 27255, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 796, 45941, 13, 9107, 418, 62, 2339, 7, 69, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3463, 62, 796, 2116, 13, 6551, 58, 1082, 452, 876, 60, 198, 220, 220, 220, 220, 220, 220, 220, 17130, 62, 796, 2116, 13, 26591, 58, 6551, 62, 0, 28, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 3463, 62, 796, 3463, 62, 58, 6551, 62, 0, 28, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 11, 17130, 62, 72, 287, 27056, 378, 7, 26591, 62, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 15853, 45941, 13, 2487, 7, 69, 11, 6482, 10779, 600, 7, 26591, 62, 72, 828, 16488, 28, 22704, 8, 1635, 3463, 62, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 47764, 1220, 289, 1174, 1082, 452, 876, 628, 198, 4871, 510, 7972, 37, 23127, 7, 15252, 2599, 198, 220, 220, 220, 37227, 4933, 7972, 4463, 578, 43795, 11789, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1502, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 9922, 13, 2896, 13185, 284, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 4511, 28532, 452, 876, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 4511, 27255, 13, 2896, 13185, 284, 352, 13, 198, 220, 220, 220, 37227, 220, 220, 628, 220, 220, 220, 825, 11593, 13345, 834, 7, 944, 11, 277, 11, 16488, 10779, 16, 11, 27255, 28, 16, 11, 289, 28, 16, 1539, 269, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 9771, 3129, 378, 262, 27255, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 357, 37659, 13, 18747, 2599, 1052, 7177, 7268, 8405, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 357, 600, 11, 11902, 2599, 383, 27255, 318, 10488, 691, 1863, 262, 1813, 16488, 13, 2896, 13185, 284, 532, 16, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 27255, 357, 600, 11, 11902, 2599, 383, 1502, 286, 262, 27255, 13, 2896, 13185, 284, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 289, 357, 22468, 11, 11902, 2599, 383, 2272, 286, 262, 8187, 10706, 13, 2896, 13185, 284, 352, 492, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 357, 22468, 393, 45941, 13, 18747, 11, 11902, 2599, 383, 512, 303, 596, 2866, 13, 2896, 13185, 284, 6045, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 45941, 13, 18747, 25, 383, 27255, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 796, 45941, 13, 9107, 418, 62, 2339, 7, 69, 8, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 17, 796, 45941, 13, 9107, 418, 62, 2339, 7, 69, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 11, 17130, 62, 72, 287, 27056, 378, 7, 944, 13, 26591, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 15853, 45941, 13, 2487, 7, 69, 11, 6482, 10779, 600, 7, 26591, 62, 72, 828, 16488, 28, 22704, 8, 1635, 2116, 13, 6551, 58, 1082, 452, 876, 11, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 17, 15853, 45941, 13, 2487, 7, 69, 11, 6482, 28, 600, 7, 26591, 62, 72, 828, 16488, 28, 22704, 8, 1635, 2116, 13, 6551, 17, 58, 1082, 452, 876, 11, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 611, 269, 6624, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 796, 277, 198, 220, 220, 220, 220, 220, 220, 220, 47764, 796, 45941, 13, 3003, 7, 66, 29, 28, 15, 11, 47764, 11, 47764, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 47764, 1220, 289, 1174, 1082, 452, 876, 198 ]
2.21195
1,590
#!/usr/bin/env python3 import os import time import datetime from bluepy import btle from bluepy.btle import Scanner, DefaultDelegate, Peripheral, Characteristic, ScanEntry, Service, UUID import curses import curses.textpad from carcontrol import CarControl # Scan timeout in seconds SCAN_TIMEOUT = 10 ## screen parts LINE_HEADING = 0 LINE_OPTIONS = 1 LINE_STATUS = 5 LINE_ERROR = 6 COL_START = 0 HEIGHT_TOP = 8 HEIGHT_BOT = 3 LOOP_DURATION = 0.05 DISPLAY_COUNT = 100 LINE_RECT = 30 RECT_HEIGHT = 12 RECT_WIDTH = 40 MSG_WELCOME = "Welcome to Carmageddon - in real life!\n" MSG_OPTIONS = " [S] - start scanning...\t\t\t\t[Q] - Exit\n" MSG_OPTIONS = MSG_OPTIONS + " [1...9] - Direct connect to device by number\t\t[D] - Disconnect \n" MSG_DRIVE_HELP = "Use [Arrows] to drive, [SPACE] to Fire" if __name__ == '__main__': try: screen = MainScreen() except KeyboardInterrupt: os.sys.exit(0) # finally:
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 28686, 198, 11748, 640, 198, 11748, 4818, 8079, 198, 198, 6738, 4171, 9078, 1330, 275, 7100, 198, 6738, 4171, 9078, 13, 65, 7100, 1330, 20937, 1008, 11, 15161, 5005, 34637, 11, 2448, 10803, 282, 11, 15684, 2569, 11, 20937, 30150, 11, 4809, 11, 471, 27586, 198, 11748, 43878, 198, 11748, 43878, 13, 5239, 15636, 198, 6738, 1097, 13716, 1330, 1879, 15988, 198, 198, 2, 20937, 26827, 287, 4201, 198, 6173, 1565, 62, 34694, 12425, 796, 838, 198, 198, 2235, 3159, 3354, 198, 24027, 62, 37682, 2751, 796, 657, 198, 24027, 62, 3185, 51, 11053, 796, 352, 198, 24027, 62, 35744, 2937, 796, 642, 198, 24027, 62, 24908, 796, 718, 198, 25154, 62, 2257, 7227, 796, 657, 198, 198, 13909, 9947, 62, 35222, 796, 807, 198, 13909, 9947, 62, 33, 2394, 796, 513, 198, 198, 21982, 3185, 62, 35, 4261, 6234, 796, 657, 13, 2713, 198, 26288, 31519, 62, 34, 28270, 796, 1802, 198, 198, 24027, 62, 23988, 796, 1542, 198, 23988, 62, 13909, 9947, 796, 1105, 198, 23988, 62, 54, 2389, 4221, 796, 2319, 198, 198, 5653, 38, 62, 54, 3698, 9858, 36, 796, 366, 14618, 284, 17998, 33054, 532, 287, 1103, 1204, 0, 59, 77, 1, 198, 5653, 38, 62, 3185, 51, 11053, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 366, 220, 685, 50, 60, 532, 923, 21976, 986, 59, 83, 59, 83, 59, 83, 59, 83, 58, 48, 60, 532, 29739, 59, 77, 1, 198, 5653, 38, 62, 3185, 51, 11053, 796, 49064, 62, 3185, 51, 11053, 1343, 366, 220, 685, 16, 986, 24, 60, 532, 4128, 2018, 284, 3335, 416, 1271, 59, 83, 59, 83, 58, 35, 60, 532, 3167, 8443, 3467, 77, 1, 198, 5653, 38, 62, 7707, 9306, 62, 39, 3698, 47, 796, 366, 11041, 685, 3163, 8516, 60, 284, 3708, 11, 685, 4303, 11598, 60, 284, 3764, 1, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3159, 796, 8774, 23901, 3419, 198, 220, 220, 220, 2845, 31973, 9492, 3622, 25, 198, 220, 220, 220, 220, 220, 220, 220, 28686, 13, 17597, 13, 37023, 7, 15, 8, 198, 2, 220, 220, 220, 3443, 25, 198 ]
2.373171
410
import math import torch import torch.nn as nn
[ 11748, 10688, 198, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 628, 628 ]
3.1875
16
import json from app.models import BaseModel
[ 11748, 33918, 198, 198, 6738, 598, 13, 27530, 1330, 7308, 17633, 628 ]
3.916667
12
""" This module contains all the functions from the ``operator`` module (bar some functions that dind't feel like they belonged here) transformed into a spice so it can be used more confortable. :Example: Consider adding ``2`` to a list of numbers:: map(add(2), [1,2,3,4,5]) """ import operator from spycy import spice __all__ = [ 'add', 'and_', 'contains', 'concat', 'countOf', 'eq', 'floordiv' , 'ge', 'getitem', 'gt', 'indexOf', 'is_', 'is_not', 'le', 'lshift' , 'lt', 'matmul', 'mod', 'mul', 'ne', 'or_', 'pos', 'pow', 'rshift' , 'sub', 'truediv', 'xor', 'neg', 'not_', 'index', 'itemgetter' , 'methodcaller', 'attrgetter', 'truth'] add = spice(lambda x,y: operator.__add__(x,y), name='add', doc=operator.add.__doc__) __add__ = spice(lambda x,y: operator.__add__(x,y), name='__add__', doc=operator.add.__doc__) and_ = spice(lambda x,y: operator.and_(x,y), name='and_', doc=operator.and_.__doc__) __and__ = spice(lambda x,y: operator.__and__(x,y), name='__and__', doc=operator.and_.__doc__) __contains__ = spice(lambda x,y: operator.__contains__(x,y), name='__contains__', doc=operator.contains.__doc__) contains = spice(lambda x,y: operator.contains(x,y), name='contains', doc=operator.contains.__doc__) concat = spice(lambda x,y: operator.concat(x,y), name='concat', doc=operator.concat.__doc__) countOf = spice(lambda x,y: operator.countOf(x,y), name='countOf', doc=operator.countOf.__doc__) eq = spice(lambda x,y: operator.eq(x,y), name='eq', doc=operator.eq.__doc__) __eq__ = spice(lambda x,y: operator.__eq__(x,y), name='__eq__', doc=operator.eq.__doc__) floordiv = spice(lambda x,y: operator.floordiv(x,y), name='floordiv', doc=operator.floordiv.__doc__) __floordiv__ = spice(lambda x,y: operator.__floordiv__(x,y), name='__floordiv__', doc=operator.floordiv.__doc__) # reversed ge = spice(lambda x,y: operator.ge(y,x), name='ge') __ge__ = spice(lambda x,y: operator.__ge__(y,x), name='__ge__') getitem = spice(lambda x,y: operator.getitem(x,y), name='getitem', doc=operator.getitem.__doc__) __getitem__ = spice(lambda x,y: operator.__getitem__(x,y), name='__getitem__', doc=operator.getitem.__doc__) # reversed gt = spice(lambda x,y: operator.gt(y,x), name='gt') __gt__ = spice(lambda x,y: operator.__gt__(y,x)) indexOf = spice(lambda x,y: operator.indexOf(x,y), name='indexOf', doc=operator.indexOf.__doc__) is_ = spice(lambda x,y: operator.is_(x,y), name='is_', doc=operator.is_.__doc__) is_not = spice(lambda x,y: operator.is_not(x,y), name='is_not', doc=operator.is_not.__doc__) # reversed le = spice(lambda x,y: operator.le(y,x), name='le') __le__ = spice(lambda x,y: operator.__le__(y,x), name='__le__') # reversed lshift = spice(lambda x,y: operator.lshift(y,x), name='lshift') __lshift__ = spice(lambda x,y: operator.__lshift__(y,x), name='__lshift__') # reversed lt = spice(lambda x,y: operator.lt(y,x), name='lt') __lt__ = spice(lambda x,y: operator.__lt__(y,x), name='__lt__') # reversed matmul = spice(lambda x,y: operator.matmul(y,x), name='matmul') __matmul__ = spice(lambda x,y: operator.__matmul__(y,x), name='__matmul__') # reversed mod = spice(lambda x,y: operator.mod(y,x), name='mod') __mod__ = spice(lambda x,y: operator.__mod__(y,x), name='__mod__') mul = spice(lambda x,y: operator.mul(x,y), name='mul', doc=operator.mul.__doc__) __mul__ = spice(lambda x,y: operator.__mul__(x,y), name='__mul__', doc=operator.mul.__doc__) ne = spice(lambda x,y: operator.ne(x,y), name='ne', doc=operator.ne.__doc__) __ne__ = spice(lambda x,y: operator.__ne__(x,y), name='__ne__', doc=operator.ne.__doc__) or_ = spice(lambda x,y: operator.or_(x,y), name='or_', doc=operator.or_.__doc__) __or__ = spice(lambda x,y: operator.__or__(x,y), name='__or__', doc=operator.or_.__doc__) pos = spice(lambda x,y: operator.pos(x,y), name='pos', doc=operator.pos.__doc__) #reversed pow = spice(lambda x,y: operator.pow(y,x), name='pow') __pow__ = spice(lambda x,y: operator.__pow__(y,x), name='__pow__') # reversed rshift = spice(lambda x,y: operator.rshift(y,x), name='rshift') __rshift__ = spice(lambda x,y: operator.__rshift__(y,x), name='__rshift__') # reversed sub = spice(lambda x,y: operator.sub(y,x), name='sub') __sub__ = spice(lambda x,y: operator.__sub__(y,x), name='__sub__') # reversed truediv = spice(lambda x,y: operator.truediv(y,x), name='truediv') __truediv__ = spice(lambda x,y: operator.__truediv__(y,x), name='__truediv__') xor = spice(lambda x,y: operator.xor(x,y), name='xor', doc=operator.xor.__doc__) __xor__ = spice(lambda x,y: operator.__xor__(x,y), name='__xor__', doc=operator.xor.__doc__) ################################################# neg = spice(lambda x: operator.neg(x), name='neg', doc=operator.neg.__doc__) __neg__ = spice(lambda x: operator.__neg__(x), name='__neg__', doc=operator.neg.__doc__) not_ = spice(lambda x: operator.not_(x), name='not_', doc=operator.not_.__doc__) __not__ = spice(lambda x: operator.__not__(x), name='__not__', doc=operator.not_.__doc__) index = spice(lambda x: operator.index(x), name='index', doc=operator.index.__doc__) __index__ = spice(lambda x: operator.__index__(x), name='__index__', doc=operator.index.__doc__) itemgetter = spice(lambda x: operator.itemgetter(x), name='itemgetter', doc=operator.itemgetter.__doc__) methodcaller = spice(lambda x: operator.methodcaller(x), name='methodcaller', doc=operator.methodcaller.__doc__) attrgetter = spice(lambda x: operator.attrgetter(x), name='attrgetter', doc=operator.attrgetter.__doc__) truth = spice(lambda x: operator.truth(x), name='truth', doc=operator.truth.__doc__)
[ 37811, 198, 1212, 8265, 4909, 477, 262, 5499, 422, 262, 7559, 46616, 15506, 8265, 357, 5657, 617, 198, 12543, 2733, 326, 288, 521, 470, 1254, 588, 484, 19611, 994, 8, 14434, 656, 257, 198, 2777, 501, 523, 340, 460, 307, 973, 517, 1013, 419, 540, 13, 198, 198, 25, 16281, 25, 198, 198, 19626, 4375, 7559, 17, 15506, 284, 257, 1351, 286, 3146, 3712, 628, 220, 220, 220, 3975, 7, 2860, 7, 17, 828, 685, 16, 11, 17, 11, 18, 11, 19, 11, 20, 12962, 198, 198, 37811, 198, 198, 11748, 10088, 198, 6738, 13997, 948, 1330, 25721, 198, 198, 834, 439, 834, 796, 685, 705, 2860, 3256, 705, 392, 62, 3256, 705, 3642, 1299, 3256, 705, 1102, 9246, 3256, 705, 9127, 5189, 3256, 705, 27363, 3256, 705, 48679, 585, 452, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 837, 705, 469, 3256, 705, 1136, 9186, 3256, 705, 13655, 3256, 705, 9630, 5189, 3256, 705, 271, 62, 3256, 705, 271, 62, 1662, 3256, 705, 293, 3256, 705, 75, 30846, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 837, 705, 2528, 3256, 705, 6759, 76, 377, 3256, 705, 4666, 3256, 705, 76, 377, 3256, 705, 710, 3256, 705, 273, 62, 3256, 705, 1930, 3256, 705, 79, 322, 3256, 705, 81, 30846, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 837, 705, 7266, 3256, 705, 83, 21556, 452, 3256, 705, 87, 273, 3256, 705, 12480, 3256, 705, 1662, 62, 3256, 705, 9630, 3256, 705, 9186, 1136, 353, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 837, 705, 24396, 13345, 263, 3256, 705, 35226, 1136, 353, 3256, 705, 35310, 20520, 198, 198, 2860, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 2860, 834, 7, 87, 11, 88, 828, 1438, 11639, 2860, 3256, 2205, 28, 46616, 13, 2860, 13, 834, 15390, 834, 8, 198, 834, 2860, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 2860, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 2860, 834, 3256, 2205, 28, 46616, 13, 2860, 13, 834, 15390, 834, 8, 198, 198, 392, 62, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 392, 41052, 87, 11, 88, 828, 1438, 11639, 392, 62, 3256, 2205, 28, 46616, 13, 392, 44807, 834, 15390, 834, 8, 198, 834, 392, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 392, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 392, 834, 3256, 2205, 28, 46616, 13, 392, 44807, 834, 15390, 834, 8, 198, 198, 834, 3642, 1299, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 3642, 1299, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 3642, 1299, 834, 3256, 2205, 28, 46616, 13, 3642, 1299, 13, 834, 15390, 834, 8, 198, 3642, 1299, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 3642, 1299, 7, 87, 11, 88, 828, 1438, 11639, 3642, 1299, 3256, 2205, 28, 46616, 13, 3642, 1299, 13, 834, 15390, 834, 8, 198, 198, 1102, 9246, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 1102, 9246, 7, 87, 11, 88, 828, 1438, 11639, 1102, 9246, 3256, 2205, 28, 46616, 13, 1102, 9246, 13, 834, 15390, 834, 8, 198, 198, 9127, 5189, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 9127, 5189, 7, 87, 11, 88, 828, 1438, 11639, 9127, 5189, 3256, 2205, 28, 46616, 13, 9127, 5189, 13, 834, 15390, 834, 8, 198, 198, 27363, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 27363, 7, 87, 11, 88, 828, 1438, 11639, 27363, 3256, 2205, 28, 46616, 13, 27363, 13, 834, 15390, 834, 8, 198, 834, 27363, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 27363, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 27363, 834, 3256, 2205, 28, 46616, 13, 27363, 13, 834, 15390, 834, 8, 198, 198, 48679, 585, 452, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 48679, 585, 452, 7, 87, 11, 88, 828, 1438, 11639, 48679, 585, 452, 3256, 2205, 28, 46616, 13, 48679, 585, 452, 13, 834, 15390, 834, 8, 198, 834, 48679, 585, 452, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 48679, 585, 452, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 48679, 585, 452, 834, 3256, 2205, 28, 46616, 13, 48679, 585, 452, 13, 834, 15390, 834, 8, 198, 198, 2, 17687, 198, 469, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 469, 7, 88, 11, 87, 828, 1438, 11639, 469, 11537, 198, 834, 469, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 469, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 469, 834, 11537, 198, 198, 1136, 9186, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 1136, 9186, 7, 87, 11, 88, 828, 1438, 11639, 1136, 9186, 3256, 2205, 28, 46616, 13, 1136, 9186, 13, 834, 15390, 834, 8, 198, 834, 1136, 9186, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 1136, 9186, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 1136, 9186, 834, 3256, 2205, 28, 46616, 13, 1136, 9186, 13, 834, 15390, 834, 8, 198, 198, 2, 17687, 198, 13655, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 13655, 7, 88, 11, 87, 828, 1438, 11639, 13655, 11537, 198, 834, 13655, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 13655, 834, 7, 88, 11, 87, 4008, 198, 198, 9630, 5189, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 9630, 5189, 7, 87, 11, 88, 828, 1438, 11639, 9630, 5189, 3256, 2205, 28, 46616, 13, 9630, 5189, 13, 834, 15390, 834, 8, 198, 271, 62, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 271, 41052, 87, 11, 88, 828, 1438, 11639, 271, 62, 3256, 2205, 28, 46616, 13, 271, 44807, 834, 15390, 834, 8, 198, 271, 62, 1662, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 271, 62, 1662, 7, 87, 11, 88, 828, 1438, 11639, 271, 62, 1662, 3256, 2205, 28, 46616, 13, 271, 62, 1662, 13, 834, 15390, 834, 8, 198, 198, 2, 17687, 198, 293, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 293, 7, 88, 11, 87, 828, 1438, 11639, 293, 11537, 198, 834, 293, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 293, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 293, 834, 11537, 198, 198, 2, 17687, 198, 75, 30846, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 75, 30846, 7, 88, 11, 87, 828, 1438, 11639, 75, 30846, 11537, 198, 834, 75, 30846, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 75, 30846, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 75, 30846, 834, 11537, 198, 198, 2, 17687, 198, 2528, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 2528, 7, 88, 11, 87, 828, 1438, 11639, 2528, 11537, 198, 834, 2528, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 2528, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 2528, 834, 11537, 198, 198, 2, 17687, 198, 6759, 76, 377, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 6759, 76, 377, 7, 88, 11, 87, 828, 1438, 11639, 6759, 76, 377, 11537, 198, 834, 6759, 76, 377, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 6759, 76, 377, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 6759, 76, 377, 834, 11537, 198, 198, 2, 17687, 198, 4666, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 4666, 7, 88, 11, 87, 828, 1438, 11639, 4666, 11537, 198, 834, 4666, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 4666, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 4666, 834, 11537, 198, 198, 76, 377, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 76, 377, 7, 87, 11, 88, 828, 1438, 11639, 76, 377, 3256, 2205, 28, 46616, 13, 76, 377, 13, 834, 15390, 834, 8, 198, 834, 76, 377, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 76, 377, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 76, 377, 834, 3256, 2205, 28, 46616, 13, 76, 377, 13, 834, 15390, 834, 8, 198, 198, 710, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 710, 7, 87, 11, 88, 828, 1438, 11639, 710, 3256, 2205, 28, 46616, 13, 710, 13, 834, 15390, 834, 8, 198, 834, 710, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 710, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 710, 834, 3256, 2205, 28, 46616, 13, 710, 13, 834, 15390, 834, 8, 198, 198, 273, 62, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 273, 41052, 87, 11, 88, 828, 1438, 11639, 273, 62, 3256, 2205, 28, 46616, 13, 273, 44807, 834, 15390, 834, 8, 198, 834, 273, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 273, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 273, 834, 3256, 2205, 28, 46616, 13, 273, 44807, 834, 15390, 834, 8, 198, 198, 1930, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 1930, 7, 87, 11, 88, 828, 1438, 11639, 1930, 3256, 2205, 28, 46616, 13, 1930, 13, 834, 15390, 834, 8, 198, 198, 2, 260, 690, 276, 198, 79, 322, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 79, 322, 7, 88, 11, 87, 828, 1438, 11639, 79, 322, 11537, 198, 834, 79, 322, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 79, 322, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 79, 322, 834, 11537, 198, 198, 2, 17687, 198, 81, 30846, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 81, 30846, 7, 88, 11, 87, 828, 1438, 11639, 81, 30846, 11537, 198, 834, 81, 30846, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 81, 30846, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 81, 30846, 834, 11537, 198, 198, 2, 17687, 198, 7266, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 7266, 7, 88, 11, 87, 828, 1438, 11639, 7266, 11537, 198, 834, 7266, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 7266, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 7266, 834, 11537, 198, 198, 2, 17687, 198, 83, 21556, 452, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 83, 21556, 452, 7, 88, 11, 87, 828, 1438, 11639, 83, 21556, 452, 11537, 198, 834, 83, 21556, 452, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 83, 21556, 452, 834, 7, 88, 11, 87, 828, 1438, 11639, 834, 83, 21556, 452, 834, 11537, 198, 198, 87, 273, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 87, 273, 7, 87, 11, 88, 828, 1438, 11639, 87, 273, 3256, 2205, 28, 46616, 13, 87, 273, 13, 834, 15390, 834, 8, 198, 834, 87, 273, 834, 796, 25721, 7, 50033, 2124, 11, 88, 25, 10088, 13, 834, 87, 273, 834, 7, 87, 11, 88, 828, 1438, 11639, 834, 87, 273, 834, 3256, 2205, 28, 46616, 13, 87, 273, 13, 834, 15390, 834, 8, 198, 198, 29113, 14468, 2, 198, 198, 12480, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 12480, 7, 87, 828, 1438, 11639, 12480, 3256, 2205, 28, 46616, 13, 12480, 13, 834, 15390, 834, 8, 198, 834, 12480, 834, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 834, 12480, 834, 7, 87, 828, 1438, 11639, 834, 12480, 834, 3256, 2205, 28, 46616, 13, 12480, 13, 834, 15390, 834, 8, 198, 198, 1662, 62, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 1662, 41052, 87, 828, 1438, 11639, 1662, 62, 3256, 2205, 28, 46616, 13, 1662, 44807, 834, 15390, 834, 8, 198, 834, 1662, 834, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 834, 1662, 834, 7, 87, 828, 1438, 11639, 834, 1662, 834, 3256, 2205, 28, 46616, 13, 1662, 44807, 834, 15390, 834, 8, 198, 198, 9630, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 9630, 7, 87, 828, 1438, 11639, 9630, 3256, 2205, 28, 46616, 13, 9630, 13, 834, 15390, 834, 8, 198, 834, 9630, 834, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 834, 9630, 834, 7, 87, 828, 1438, 11639, 834, 9630, 834, 3256, 2205, 28, 46616, 13, 9630, 13, 834, 15390, 834, 8, 198, 198, 9186, 1136, 353, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 9186, 1136, 353, 7, 87, 828, 1438, 11639, 9186, 1136, 353, 3256, 2205, 28, 46616, 13, 9186, 1136, 353, 13, 834, 15390, 834, 8, 198, 24396, 13345, 263, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 24396, 13345, 263, 7, 87, 828, 1438, 11639, 24396, 13345, 263, 3256, 2205, 28, 46616, 13, 24396, 13345, 263, 13, 834, 15390, 834, 8, 198, 35226, 1136, 353, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 35226, 1136, 353, 7, 87, 828, 1438, 11639, 35226, 1136, 353, 3256, 2205, 28, 46616, 13, 35226, 1136, 353, 13, 834, 15390, 834, 8, 198, 198, 35310, 796, 25721, 7, 50033, 2124, 25, 10088, 13, 35310, 7, 87, 828, 1438, 11639, 35310, 3256, 2205, 28, 46616, 13, 35310, 13, 834, 15390, 834, 8, 198 ]
2.504488
2,228
# Copyright 2021 curoky([email protected]). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. config = { "name": "com_github_google_brotli", "type": "git_repository", # "remote": "https://github.com/google/brotli", "remote": "https://github.com/pefoley2/brotli", "used_version": "heads/master", "versions": { "heads/master": {}, "tags/v1.0.9": {}, }, } # Note: # 1: after v1.0.9, brotli use vla-parameter, which gcc-11 throw error by default # fix pr: https://github.com/google/brotli/pull/904 # external/com_github_google_brotli/c/dec/decode.c:2036:41: error: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=vla-parameter] # 2036 | size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, # | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ # In file included from external/com_github_google_brotli/c/dec/decode.c:7: # bazel-out/k8-dbg/bin/external/com_github_google_brotli/_virtual_includes/brotli_inc/brotli/decode.h:204:19: note: previously declared as a variable length array 'const uint8_t[*decoded_size]' {aka 'const unsigned char[*decoded_size]'} # 204 | const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], # | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # external/com_github_google_brotli/c/dec/decode.c:2037:14: error: argument 4 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Werror=vla-parameter] # 2037 | uint8_t* decoded_buffer) { # | ~~~~~~~~~^~~~~~~~~~~~~~ # In file included from external/com_github_google_brotli/c/dec/decode.c:7: # bazel-out/k8-dbg/bin/external/com_github_google_brotli/_virtual_includes/brotli_inc/brotli/decode.h:206:13: note: previously declared as a variable length array 'uint8_t[encoded_size]' {aka 'unsigned char[encoded_size]'} # 206 | uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]); # | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # cc1: all warnings being treated as errors
[ 2, 15069, 33448, 269, 1434, 2584, 7, 535, 66, 1434, 2584, 31, 14816, 13, 785, 737, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 198, 198, 11250, 796, 1391, 198, 220, 220, 220, 366, 3672, 1298, 366, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 1600, 198, 220, 220, 220, 366, 4906, 1298, 366, 18300, 62, 260, 1930, 37765, 1600, 198, 220, 220, 220, 1303, 366, 47960, 1298, 366, 5450, 1378, 12567, 13, 785, 14, 13297, 14, 7957, 83, 4528, 1600, 198, 220, 220, 220, 366, 47960, 1298, 366, 5450, 1378, 12567, 13, 785, 14, 431, 6513, 1636, 17, 14, 7957, 83, 4528, 1600, 198, 220, 220, 220, 366, 1484, 62, 9641, 1298, 366, 16600, 14, 9866, 1600, 198, 220, 220, 220, 366, 47178, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 16600, 14, 9866, 1298, 1391, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 366, 31499, 14, 85, 16, 13, 15, 13, 24, 1298, 1391, 5512, 198, 220, 220, 220, 8964, 198, 92, 198, 198, 2, 5740, 25, 198, 2, 352, 25, 706, 410, 16, 13, 15, 13, 24, 11, 1379, 83, 4528, 779, 410, 5031, 12, 17143, 2357, 11, 543, 49582, 12, 1157, 3714, 4049, 416, 4277, 198, 2, 220, 220, 220, 4259, 778, 25, 3740, 1378, 12567, 13, 785, 14, 13297, 14, 7957, 83, 4528, 14, 31216, 14, 24, 3023, 198, 2, 7097, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 14, 66, 14, 12501, 14, 12501, 1098, 13, 66, 25, 1238, 2623, 25, 3901, 25, 4049, 25, 4578, 362, 286, 2099, 705, 9979, 20398, 23, 62, 83, 1635, 6, 1391, 8130, 705, 9979, 22165, 1149, 1635, 6, 92, 6875, 355, 257, 17562, 25915, 54, 18224, 28, 85, 5031, 12, 17143, 2357, 60, 198, 2, 220, 1160, 2623, 930, 220, 220, 220, 220, 2546, 62, 83, 30240, 62, 7857, 11, 1500, 20398, 23, 62, 83, 9, 30240, 62, 22252, 11, 2546, 62, 83, 9, 875, 9043, 62, 7857, 11, 198, 2, 220, 220, 220, 220, 220, 220, 930, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15116, 8728, 4907, 93, 61, 15116, 8728, 93, 198, 2, 554, 2393, 3017, 422, 7097, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 14, 66, 14, 12501, 14, 12501, 1098, 13, 66, 25, 22, 25, 198, 2, 275, 41319, 12, 448, 14, 74, 23, 12, 9945, 70, 14, 8800, 14, 22615, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 47835, 32844, 62, 42813, 14, 7957, 83, 4528, 62, 1939, 14, 7957, 83, 4528, 14, 12501, 1098, 13, 71, 25, 18638, 25, 1129, 25, 3465, 25, 4271, 6875, 355, 257, 7885, 4129, 7177, 705, 9979, 20398, 23, 62, 83, 58, 9, 12501, 9043, 62, 7857, 49946, 1391, 8130, 705, 9979, 22165, 1149, 58, 9, 12501, 9043, 62, 7857, 49946, 92, 198, 2, 220, 220, 26956, 930, 220, 220, 220, 220, 1500, 20398, 23, 62, 83, 30240, 62, 22252, 58, 11473, 2394, 31271, 62, 1503, 30631, 62, 27082, 2390, 7, 12685, 9043, 62, 7857, 8, 4357, 198, 2, 220, 220, 220, 220, 220, 220, 930, 220, 220, 220, 220, 220, 15116, 8728, 4907, 61, 27156, 27156, 15116, 8728, 4907, 93, 198, 2, 7097, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 14, 66, 14, 12501, 14, 12501, 1098, 13, 66, 25, 1238, 2718, 25, 1415, 25, 4049, 25, 4578, 604, 286, 2099, 705, 28611, 23, 62, 83, 1635, 6, 1391, 8130, 705, 43375, 1149, 1635, 6, 92, 6875, 355, 257, 17562, 25915, 54, 18224, 28, 85, 5031, 12, 17143, 2357, 60, 198, 2, 220, 1160, 2718, 930, 220, 220, 220, 220, 20398, 23, 62, 83, 9, 875, 9043, 62, 22252, 8, 1391, 198, 2, 220, 220, 220, 220, 220, 220, 930, 220, 220, 220, 220, 220, 15116, 93, 61, 15116, 8728, 93, 198, 2, 554, 2393, 3017, 422, 7097, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 14, 66, 14, 12501, 14, 12501, 1098, 13, 66, 25, 22, 25, 198, 2, 275, 41319, 12, 448, 14, 74, 23, 12, 9945, 70, 14, 8800, 14, 22615, 14, 785, 62, 12567, 62, 13297, 62, 7957, 83, 4528, 47835, 32844, 62, 42813, 14, 7957, 83, 4528, 62, 1939, 14, 7957, 83, 4528, 14, 12501, 1098, 13, 71, 25, 22136, 25, 1485, 25, 3465, 25, 4271, 6875, 355, 257, 7885, 4129, 7177, 705, 28611, 23, 62, 83, 58, 12685, 9043, 62, 7857, 49946, 1391, 8130, 705, 43375, 1149, 58, 12685, 9043, 62, 7857, 49946, 92, 198, 2, 220, 220, 27253, 930, 220, 220, 220, 220, 20398, 23, 62, 83, 875, 9043, 62, 22252, 58, 11473, 2394, 31271, 62, 1503, 30631, 62, 27082, 2390, 46491, 12501, 9043, 62, 7857, 15437, 1776, 198, 2, 220, 220, 220, 220, 220, 220, 930, 220, 220, 220, 220, 220, 15116, 61, 27156, 27156, 27156, 198, 2, 36624, 16, 25, 477, 14601, 852, 5716, 355, 8563, 198 ]
2.681582
961
# -*- coding: utf-8 -*- from django.contrib.contenttypes.models import ContentType from rest_framework import serializers from vvphotos.models import Album
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 11299, 19199, 13, 27530, 1330, 14041, 6030, 198, 6738, 1334, 62, 30604, 1330, 11389, 11341, 198, 6738, 410, 85, 24729, 13, 27530, 1330, 23999, 628, 628 ]
3.333333
48
# coding: utf-8 """ DocuSign REST API The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. OpenAPI spec version: v2.1 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class CurrencyFeatureSetPrice(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, currency_code=None, currency_symbol=None, envelope_fee=None, fixed_fee=None, seat_fee=None): """ CurrencyFeatureSetPrice - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition. """ self.swagger_types = { 'currency_code': 'str', 'currency_symbol': 'str', 'envelope_fee': 'str', 'fixed_fee': 'str', 'seat_fee': 'str' } self.attribute_map = { 'currency_code': 'currencyCode', 'currency_symbol': 'currencySymbol', 'envelope_fee': 'envelopeFee', 'fixed_fee': 'fixedFee', 'seat_fee': 'seatFee' } self._currency_code = currency_code self._currency_symbol = currency_symbol self._envelope_fee = envelope_fee self._fixed_fee = fixed_fee self._seat_fee = seat_fee @property def currency_code(self): """ Gets the currency_code of this CurrencyFeatureSetPrice. Specifies the alternate ISO currency code for the account. :return: The currency_code of this CurrencyFeatureSetPrice. :rtype: str """ return self._currency_code @currency_code.setter def currency_code(self, currency_code): """ Sets the currency_code of this CurrencyFeatureSetPrice. Specifies the alternate ISO currency code for the account. :param currency_code: The currency_code of this CurrencyFeatureSetPrice. :type: str """ self._currency_code = currency_code @property def currency_symbol(self): """ Gets the currency_symbol of this CurrencyFeatureSetPrice. Specifies the alternate currency symbol for the account. :return: The currency_symbol of this CurrencyFeatureSetPrice. :rtype: str """ return self._currency_symbol @currency_symbol.setter def currency_symbol(self, currency_symbol): """ Sets the currency_symbol of this CurrencyFeatureSetPrice. Specifies the alternate currency symbol for the account. :param currency_symbol: The currency_symbol of this CurrencyFeatureSetPrice. :type: str """ self._currency_symbol = currency_symbol @property def envelope_fee(self): """ Gets the envelope_fee of this CurrencyFeatureSetPrice. An incremental envelope cost for plans with envelope overages (when `isEnabled` is set to **true**.) :return: The envelope_fee of this CurrencyFeatureSetPrice. :rtype: str """ return self._envelope_fee @envelope_fee.setter def envelope_fee(self, envelope_fee): """ Sets the envelope_fee of this CurrencyFeatureSetPrice. An incremental envelope cost for plans with envelope overages (when `isEnabled` is set to **true**.) :param envelope_fee: The envelope_fee of this CurrencyFeatureSetPrice. :type: str """ self._envelope_fee = envelope_fee @property def fixed_fee(self): """ Gets the fixed_fee of this CurrencyFeatureSetPrice. Specifies a one-time fee associated with the plan (when `isEnabled` is set to **true**.) :return: The fixed_fee of this CurrencyFeatureSetPrice. :rtype: str """ return self._fixed_fee @fixed_fee.setter def fixed_fee(self, fixed_fee): """ Sets the fixed_fee of this CurrencyFeatureSetPrice. Specifies a one-time fee associated with the plan (when `isEnabled` is set to **true**.) :param fixed_fee: The fixed_fee of this CurrencyFeatureSetPrice. :type: str """ self._fixed_fee = fixed_fee @property def seat_fee(self): """ Gets the seat_fee of this CurrencyFeatureSetPrice. Specifies an incremental seat cost for seat-based plans (when `isEnabled` is set to **true**.) :return: The seat_fee of this CurrencyFeatureSetPrice. :rtype: str """ return self._seat_fee @seat_fee.setter def seat_fee(self, seat_fee): """ Sets the seat_fee of this CurrencyFeatureSetPrice. Specifies an incremental seat cost for seat-based plans (when `isEnabled` is set to **true**.) :param seat_fee: The seat_fee of this CurrencyFeatureSetPrice. :type: str """ self._seat_fee = seat_fee def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 37811, 198, 220, 220, 220, 14432, 84, 11712, 30617, 7824, 628, 220, 220, 220, 383, 14432, 84, 11712, 30617, 7824, 3769, 345, 351, 257, 3665, 11, 11282, 11, 290, 2829, 5313, 2594, 7824, 329, 24986, 351, 14432, 84, 11712, 13, 628, 220, 220, 220, 4946, 17614, 1020, 2196, 25, 410, 17, 13, 16, 198, 220, 220, 220, 14039, 25, 1614, 16159, 31, 67, 10901, 570, 13, 785, 198, 220, 220, 220, 2980, 515, 416, 25, 3740, 1378, 12567, 13, 785, 14, 2032, 7928, 12, 15042, 14, 2032, 7928, 12, 8189, 5235, 13, 18300, 198, 37811, 628, 198, 6738, 279, 4798, 1330, 279, 18982, 198, 6738, 2237, 1330, 11629, 23814, 198, 11748, 302, 628, 198, 4871, 20113, 38816, 7248, 18124, 7, 15252, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 24550, 25, 770, 1398, 318, 8295, 7560, 416, 262, 1509, 7928, 2438, 17301, 1430, 13, 198, 220, 220, 220, 2141, 407, 4370, 262, 1398, 14500, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 7395, 62, 8189, 28, 14202, 11, 7395, 62, 1837, 23650, 28, 14202, 11, 22878, 62, 39071, 28, 14202, 11, 5969, 62, 39071, 28, 14202, 11, 5852, 62, 39071, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 20113, 38816, 7248, 18124, 532, 257, 2746, 5447, 287, 2451, 7928, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 8633, 1509, 7928, 31431, 25, 383, 1994, 318, 11688, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 262, 1988, 318, 11688, 2099, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 8633, 11688, 13912, 25, 383, 1994, 318, 11688, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 262, 1988, 318, 33918, 1994, 287, 6770, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2032, 7928, 62, 19199, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34415, 62, 8189, 10354, 705, 2536, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34415, 62, 1837, 23650, 10354, 705, 2536, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 268, 1091, 68, 62, 39071, 10354, 705, 2536, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34021, 62, 39071, 10354, 705, 2536, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 24073, 62, 39071, 10354, 705, 2536, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1782, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 42348, 62, 8899, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34415, 62, 8189, 10354, 705, 34415, 10669, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34415, 62, 1837, 23650, 10354, 705, 34415, 13940, 23650, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 268, 1091, 68, 62, 39071, 10354, 705, 268, 1091, 68, 37, 1453, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 34021, 62, 39071, 10354, 705, 34021, 37, 1453, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 24073, 62, 39071, 10354, 705, 24073, 37, 1453, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1782, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34415, 62, 8189, 796, 7395, 62, 8189, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34415, 62, 1837, 23650, 796, 7395, 62, 1837, 23650, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 268, 1091, 68, 62, 39071, 796, 22878, 62, 39071, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34021, 62, 39071, 796, 5969, 62, 39071, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 24073, 62, 39071, 796, 5852, 62, 39071, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 7395, 62, 8189, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29620, 262, 7395, 62, 8189, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 262, 13527, 19694, 7395, 2438, 329, 262, 1848, 13, 220, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 383, 7395, 62, 8189, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 81, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 34415, 62, 8189, 628, 220, 220, 220, 2488, 34415, 62, 8189, 13, 2617, 353, 198, 220, 220, 220, 825, 7395, 62, 8189, 7, 944, 11, 7395, 62, 8189, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 21394, 262, 7395, 62, 8189, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 262, 13527, 19694, 7395, 2438, 329, 262, 1848, 13, 220, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 7395, 62, 8189, 25, 383, 7395, 62, 8189, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34415, 62, 8189, 796, 7395, 62, 8189, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 7395, 62, 1837, 23650, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29620, 262, 7395, 62, 1837, 23650, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 262, 13527, 7395, 6194, 329, 262, 1848, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 383, 7395, 62, 1837, 23650, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 81, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 34415, 62, 1837, 23650, 628, 220, 220, 220, 2488, 34415, 62, 1837, 23650, 13, 2617, 353, 198, 220, 220, 220, 825, 7395, 62, 1837, 23650, 7, 944, 11, 7395, 62, 1837, 23650, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 21394, 262, 7395, 62, 1837, 23650, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 262, 13527, 7395, 6194, 329, 262, 1848, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 7395, 62, 1837, 23650, 25, 383, 7395, 62, 1837, 23650, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34415, 62, 1837, 23650, 796, 7395, 62, 1837, 23650, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 22878, 62, 39071, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29620, 262, 22878, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1052, 29497, 22878, 1575, 329, 3352, 351, 22878, 625, 1095, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 383, 22878, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 81, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 268, 1091, 68, 62, 39071, 628, 220, 220, 220, 2488, 268, 1091, 68, 62, 39071, 13, 2617, 353, 198, 220, 220, 220, 825, 22878, 62, 39071, 7, 944, 11, 22878, 62, 39071, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 21394, 262, 22878, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1052, 29497, 22878, 1575, 329, 3352, 351, 22878, 625, 1095, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 22878, 62, 39071, 25, 383, 22878, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 268, 1091, 68, 62, 39071, 796, 22878, 62, 39071, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 5969, 62, 39071, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29620, 262, 5969, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 257, 530, 12, 2435, 6838, 3917, 351, 262, 1410, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 383, 5969, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 81, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 34021, 62, 39071, 628, 220, 220, 220, 2488, 34021, 62, 39071, 13, 2617, 353, 198, 220, 220, 220, 825, 5969, 62, 39071, 7, 944, 11, 5969, 62, 39071, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 21394, 262, 5969, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 257, 530, 12, 2435, 6838, 3917, 351, 262, 1410, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 5969, 62, 39071, 25, 383, 5969, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 34021, 62, 39071, 796, 5969, 62, 39071, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 5852, 62, 39071, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 29620, 262, 5852, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 281, 29497, 5852, 1575, 329, 5852, 12, 3106, 3352, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 383, 5852, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 81, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 24073, 62, 39071, 628, 220, 220, 220, 2488, 24073, 62, 39071, 13, 2617, 353, 198, 220, 220, 220, 825, 5852, 62, 39071, 7, 944, 11, 5852, 62, 39071, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 21394, 262, 5852, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 18291, 6945, 281, 29497, 5852, 1575, 329, 5852, 12, 3106, 3352, 357, 12518, 4600, 271, 20491, 63, 318, 900, 284, 12429, 7942, 1174, 2014, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 5852, 62, 39071, 25, 383, 5852, 62, 39071, 286, 428, 20113, 38816, 7248, 18124, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 4906, 25, 965, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 24073, 62, 39071, 796, 5852, 62, 39071, 628, 220, 220, 220, 825, 284, 62, 11600, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 262, 2746, 6608, 355, 257, 8633, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 796, 23884, 628, 220, 220, 220, 220, 220, 220, 220, 329, 708, 81, 11, 4808, 287, 11629, 23814, 7, 944, 13, 2032, 7928, 62, 19199, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1988, 796, 651, 35226, 7, 944, 11, 708, 81, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 8367, 11, 1351, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 35226, 60, 796, 1351, 7, 8899, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2124, 25, 2124, 13, 1462, 62, 11600, 3419, 611, 468, 35226, 7, 87, 11, 366, 1462, 62, 11600, 4943, 2073, 2124, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 468, 35226, 7, 8367, 11, 366, 1462, 62, 11600, 1, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 35226, 60, 796, 1988, 13, 1462, 62, 11600, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 318, 39098, 7, 8367, 11, 8633, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 35226, 60, 796, 8633, 7, 8899, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2378, 25, 357, 9186, 58, 15, 4357, 2378, 58, 16, 4083, 1462, 62, 11600, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 468, 35226, 7, 9186, 58, 16, 4357, 366, 1462, 62, 11600, 4943, 2073, 2378, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1988, 13, 23814, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 35226, 60, 796, 1988, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 1255, 628, 220, 220, 220, 825, 284, 62, 2536, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 262, 4731, 10552, 286, 262, 2746, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 279, 18982, 7, 944, 13, 1462, 62, 11600, 28955, 628, 220, 220, 220, 825, 11593, 260, 1050, 834, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1114, 4600, 4798, 63, 290, 4600, 381, 22272, 63, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 1462, 62, 2536, 3419, 628, 220, 220, 220, 825, 11593, 27363, 834, 7, 944, 11, 584, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 2081, 611, 1111, 5563, 389, 4961, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 834, 11600, 834, 6624, 584, 13, 834, 11600, 834, 628, 220, 220, 220, 825, 11593, 710, 834, 7, 944, 11, 584, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 2081, 611, 1111, 5563, 389, 407, 4961, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 407, 2116, 6624, 584, 198 ]
2.327616
2,857
from flask.helpers import url_for from pyTrendsExtensions import GetTrendingOverTime from flask import Flask, redirect # from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with # from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # api = Api(app) @app.route("/") @app.route("/<keyword>")
[ 6738, 42903, 13, 16794, 364, 1330, 19016, 62, 1640, 198, 6738, 12972, 45461, 82, 11627, 5736, 1330, 3497, 45461, 278, 5886, 7575, 198, 6738, 42903, 1330, 46947, 11, 18941, 198, 2, 422, 42903, 62, 2118, 913, 1330, 5949, 72, 11, 20857, 11, 43089, 29572, 11, 15614, 11, 7032, 11, 22397, 282, 62, 4480, 198, 2, 422, 42903, 62, 25410, 282, 26599, 1330, 16363, 2348, 26599, 198, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 198, 2, 40391, 796, 5949, 72, 7, 1324, 8, 198, 198, 31, 1324, 13, 38629, 7203, 14, 4943, 198, 198, 31, 1324, 13, 38629, 7203, 14, 27, 2539, 4775, 29, 4943 ]
3.056604
106
''' TCP server interface for console. The TCP server will be automatically built. - @interface: The function for user interface, and keep the server running. ''' from . import logger from .defines import TCPServer server = TCPServer() server.start()
[ 7061, 6, 201, 198, 4825, 47, 4382, 7071, 329, 8624, 13, 201, 198, 464, 23633, 4382, 481, 307, 6338, 3170, 13, 201, 198, 201, 198, 12, 2488, 39994, 25, 383, 2163, 329, 2836, 7071, 11, 290, 1394, 262, 4382, 2491, 13, 201, 198, 7061, 6, 201, 198, 201, 198, 6738, 764, 1330, 49706, 201, 198, 6738, 764, 4299, 1127, 1330, 17283, 3705, 18497, 201, 198, 201, 198, 15388, 796, 17283, 3705, 18497, 3419, 201, 198, 15388, 13, 9688, 3419, 201, 198, 201, 198 ]
3.216867
83
from django.shortcuts import render from django.views.generic import ListView from .models import Video,Audio,Image,Note
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 1330, 7343, 7680, 198, 6738, 764, 27530, 1330, 7623, 11, 21206, 11, 5159, 11, 6425, 198 ]
3.78125
32
from worldtools import * from enum import Enum from math import sin, cos, pi from random import uniform class Animal: """Class representing Animal in the world""" def __init__(self, world, pos: (float, float), speed: float): """ Initializes the Animal Args: world (World): The world pos ( (float, float) ): Starting position speed (float): Animal speed """ self.speed = speed self.pos = pos self.world = world # Movement variables self.target = None self.movement_angle = uniform(0, pi*2) # Food variables self.hunger = 100 self.eat_count = 0 self._food_checkpoint = 0 # Set state self.state = State.ROAM def move(self) -> Exception: """ Moves an animal based on state Raises: NotImplementedError: Should be overwritten in a derived class Returns: Exception: Will always raise NotImplementedError if called from Animal class """ raise NotImplementedError() def draw(self, screen) -> Exception: """ Draws an animal to the screen Args: screen (pygame.screen): pygame screen Raises: NotImplementedError: Should be overwritten in a derived class Returns: Exception: Will always raise NotImplementedError if called from Animal class """ raise NotImplementedError() def sight_entities(self) -> (["Food"], ["Rabbit"], ["Wolf"]): """ Returns all entites in vision of the Animal Args: self (Animal): self Returns: ([Food], [Rabbit], [Wolf]): Returns a 3-tuple with Food, Rabbit, Wolf in vision """ # Get foods around self foodlist = [] for food in self.world.food: if self != food and self._in_sight(food): foodlist.append(food) # Get rabbits around self rabbitlist = [] for rabbit in self.world.rabbits: if self != rabbit and self._in_sight(rabbit): rabbitlist.append(rabbit) # Get wolves around self wolflist = [] for wolf in self.world.wolves: if self != wolf and self._in_sight(wolf): wolflist.append(wolf) # Sort by distance to self foodlist.sort(key=lambda x: distance(self.pos, x.pos)) rabbitlist.sort(key=lambda x: distance(self.pos, x.pos)) wolflist.sort(key=lambda x: distance(self.pos, x.pos)) return (foodlist, rabbitlist, wolflist) def eat(self, inc: float) -> None: """ Increments eating food source and adds to hunger Args: inc (int): Amount to increase hunger """ # Increment eat count self.eat_count += 1 # Limit to 100 if self.hunger + inc >= 100: self.hunger = 100 else: self.hunger += inc def roam_move(self) -> None: """ Moves Animal in the direction they are facing and slightly changes movement angle """ # Proposed move new_x = self.pos[0] + (self.speed * cos(self.movement_angle)) new_y = self.pos[1] + (self.speed * sin(self.movement_angle)) # Check if valid move while not self.world.in_bounds((new_x, new_y)): # Reset move self.movement_angle += pi/2 new_x = self.pos[0] + (self.speed * cos(self.movement_angle)) new_y = self.pos[1] + (self.speed * sin(self.movement_angle)) # Confirm move self.pos = ( new_x, new_y ) # Adjust movement angle self.movement_angle += uniform(-pi*2 / 36, pi*2 / 36) def _in_sight(self, entity) -> bool: """ Returns if an entity (which has a pos) is in sight of the Animal Args: entity (Animal or Food): Entity to check Returns: bool: True if entity is in sight, False otherwise """ return distance(self.pos, entity.pos) <= self.sight
[ 6738, 995, 31391, 1330, 1635, 198, 6738, 33829, 1330, 2039, 388, 198, 6738, 10688, 1330, 7813, 11, 8615, 11, 31028, 198, 6738, 4738, 1330, 8187, 198, 198, 4871, 13792, 25, 198, 197, 37811, 9487, 10200, 13792, 287, 262, 995, 37811, 628, 197, 4299, 11593, 15003, 834, 7, 944, 11, 995, 11, 1426, 25, 357, 22468, 11, 12178, 828, 2866, 25, 12178, 2599, 198, 197, 197, 37811, 198, 197, 197, 24243, 4340, 262, 13792, 628, 197, 197, 42035, 25, 198, 197, 197, 197, 6894, 357, 10603, 2599, 383, 995, 198, 197, 197, 197, 1930, 357, 357, 22468, 11, 12178, 8, 15179, 17962, 2292, 198, 197, 197, 197, 12287, 357, 22468, 2599, 13792, 2866, 198, 197, 197, 37811, 628, 197, 197, 944, 13, 12287, 796, 2866, 198, 197, 197, 944, 13, 1930, 796, 1426, 198, 197, 197, 944, 13, 6894, 796, 995, 628, 197, 197, 2, 15477, 9633, 198, 197, 197, 944, 13, 16793, 796, 6045, 198, 197, 197, 944, 13, 21084, 434, 62, 9248, 796, 8187, 7, 15, 11, 31028, 9, 17, 8, 628, 197, 197, 2, 7318, 9633, 198, 197, 197, 944, 13, 20088, 1362, 796, 1802, 198, 197, 197, 944, 13, 4098, 62, 9127, 796, 657, 198, 197, 197, 944, 13557, 19425, 62, 9122, 4122, 796, 657, 628, 197, 197, 2, 5345, 1181, 198, 197, 197, 944, 13, 5219, 796, 1812, 13, 13252, 2390, 198, 197, 198, 197, 4299, 1445, 7, 944, 8, 4613, 35528, 25, 198, 197, 197, 37811, 198, 197, 197, 44, 5241, 281, 5044, 1912, 319, 1181, 628, 197, 197, 21762, 2696, 25, 198, 197, 197, 197, 3673, 3546, 1154, 12061, 12331, 25, 10358, 307, 6993, 9108, 287, 257, 10944, 1398, 628, 197, 197, 35561, 25, 198, 197, 197, 197, 16922, 25, 2561, 1464, 5298, 1892, 3546, 1154, 12061, 12331, 611, 1444, 422, 13792, 1398, 198, 197, 197, 37811, 198, 197, 197, 198, 197, 197, 40225, 1892, 3546, 1154, 12061, 12331, 3419, 198, 197, 197, 198, 197, 4299, 3197, 7, 944, 11, 3159, 8, 4613, 35528, 25, 198, 197, 197, 37811, 198, 197, 197, 25302, 82, 281, 5044, 284, 262, 3159, 628, 197, 197, 42035, 25, 198, 197, 197, 197, 9612, 357, 9078, 6057, 13, 9612, 2599, 12972, 6057, 3159, 628, 197, 197, 21762, 2696, 25, 198, 197, 197, 197, 3673, 3546, 1154, 12061, 12331, 25, 10358, 307, 6993, 9108, 287, 257, 10944, 1398, 628, 197, 197, 35561, 25, 198, 197, 197, 197, 16922, 25, 2561, 1464, 5298, 1892, 3546, 1154, 12061, 12331, 611, 1444, 422, 13792, 1398, 198, 197, 197, 37811, 628, 197, 197, 40225, 1892, 3546, 1154, 12061, 12331, 3419, 628, 197, 4299, 6504, 62, 298, 871, 7, 944, 8, 4613, 357, 14692, 24602, 33116, 14631, 49, 14229, 33116, 14631, 32069, 8973, 2599, 198, 197, 197, 37811, 198, 197, 197, 35561, 477, 920, 2737, 287, 5761, 286, 262, 13792, 628, 197, 197, 42035, 25, 198, 197, 197, 197, 944, 357, 40002, 2599, 2116, 628, 197, 197, 35561, 25, 198, 197, 197, 197, 26933, 24602, 4357, 685, 49, 14229, 4357, 685, 32069, 60, 2599, 16409, 257, 513, 12, 83, 29291, 351, 7318, 11, 25498, 11, 8662, 287, 5761, 198, 197, 197, 37811, 628, 197, 197, 2, 3497, 9013, 1088, 2116, 198, 197, 197, 19425, 4868, 796, 17635, 198, 197, 197, 1640, 2057, 287, 2116, 13, 6894, 13, 19425, 25, 198, 197, 197, 197, 361, 2116, 14512, 2057, 290, 2116, 13557, 259, 62, 18627, 7, 19425, 2599, 197, 19425, 4868, 13, 33295, 7, 19425, 8, 628, 197, 197, 2, 3497, 33043, 1088, 2116, 198, 197, 197, 81, 14229, 4868, 796, 17635, 198, 197, 197, 1640, 22746, 287, 2116, 13, 6894, 13, 81, 6485, 896, 25, 198, 197, 197, 197, 361, 2116, 14512, 22746, 290, 2116, 13557, 259, 62, 18627, 7, 81, 14229, 2599, 22746, 4868, 13, 33295, 7, 81, 14229, 8, 628, 197, 197, 2, 3497, 23214, 1088, 2116, 198, 197, 197, 86, 349, 2704, 396, 796, 17635, 198, 197, 197, 1640, 17481, 287, 2116, 13, 6894, 13, 29664, 25, 198, 197, 197, 197, 361, 2116, 14512, 17481, 290, 2116, 13557, 259, 62, 18627, 7, 18829, 2599, 197, 86, 349, 2704, 396, 13, 33295, 7, 18829, 8, 628, 197, 197, 2, 33947, 416, 5253, 284, 2116, 198, 197, 197, 19425, 4868, 13, 30619, 7, 2539, 28, 50033, 2124, 25, 5253, 7, 944, 13, 1930, 11, 2124, 13, 1930, 4008, 198, 197, 197, 81, 14229, 4868, 13, 30619, 7, 2539, 28, 50033, 2124, 25, 5253, 7, 944, 13, 1930, 11, 2124, 13, 1930, 4008, 198, 197, 197, 86, 349, 2704, 396, 13, 30619, 7, 2539, 28, 50033, 2124, 25, 5253, 7, 944, 13, 1930, 11, 2124, 13, 1930, 4008, 628, 197, 197, 7783, 357, 19425, 4868, 11, 22746, 4868, 11, 266, 349, 2704, 396, 8, 198, 197, 198, 197, 4299, 4483, 7, 944, 11, 753, 25, 12178, 8, 4613, 6045, 25, 198, 197, 197, 37811, 198, 197, 197, 15562, 902, 6600, 2057, 2723, 290, 6673, 284, 16460, 628, 197, 197, 42035, 25, 198, 197, 197, 197, 1939, 357, 600, 2599, 26308, 284, 2620, 16460, 198, 197, 197, 37811, 628, 197, 197, 2, 10791, 434, 4483, 954, 198, 197, 197, 944, 13, 4098, 62, 9127, 15853, 352, 628, 197, 197, 2, 27272, 284, 1802, 198, 197, 197, 361, 2116, 13, 20088, 1362, 1343, 753, 18189, 1802, 25, 198, 197, 197, 197, 944, 13, 20088, 1362, 796, 1802, 198, 197, 197, 17772, 25, 198, 197, 197, 197, 944, 13, 20088, 1362, 15853, 753, 198, 197, 198, 197, 4299, 35563, 62, 21084, 7, 944, 8, 4613, 6045, 25, 198, 197, 197, 37811, 198, 197, 197, 44, 5241, 13792, 287, 262, 4571, 484, 389, 6476, 290, 4622, 2458, 3356, 9848, 198, 197, 197, 37811, 628, 197, 197, 2, 8772, 1335, 1445, 198, 197, 197, 3605, 62, 87, 796, 2116, 13, 1930, 58, 15, 60, 1343, 357, 944, 13, 12287, 1635, 8615, 7, 944, 13, 21084, 434, 62, 9248, 4008, 198, 197, 197, 3605, 62, 88, 796, 2116, 13, 1930, 58, 16, 60, 1343, 357, 944, 13, 12287, 1635, 7813, 7, 944, 13, 21084, 434, 62, 9248, 4008, 628, 197, 197, 2, 6822, 611, 4938, 1445, 198, 197, 197, 4514, 407, 2116, 13, 6894, 13, 259, 62, 65, 3733, 19510, 3605, 62, 87, 11, 649, 62, 88, 8, 2599, 198, 197, 197, 197, 2, 30027, 1445, 198, 197, 197, 197, 944, 13, 21084, 434, 62, 9248, 15853, 31028, 14, 17, 198, 197, 197, 197, 3605, 62, 87, 796, 2116, 13, 1930, 58, 15, 60, 1343, 357, 944, 13, 12287, 1635, 8615, 7, 944, 13, 21084, 434, 62, 9248, 4008, 198, 197, 197, 197, 3605, 62, 88, 796, 2116, 13, 1930, 58, 16, 60, 1343, 357, 944, 13, 12287, 1635, 7813, 7, 944, 13, 21084, 434, 62, 9248, 4008, 198, 197, 197, 197, 198, 197, 197, 2, 7326, 2533, 1445, 198, 197, 197, 944, 13, 1930, 796, 357, 198, 197, 197, 197, 3605, 62, 87, 11, 198, 197, 197, 197, 3605, 62, 88, 198, 197, 197, 8, 628, 197, 197, 2, 20292, 3356, 9848, 198, 197, 197, 944, 13, 21084, 434, 62, 9248, 15853, 8187, 32590, 14415, 9, 17, 1220, 4570, 11, 31028, 9, 17, 1220, 4570, 8, 198, 197, 197, 198, 197, 4299, 4808, 259, 62, 18627, 7, 944, 11, 9312, 8, 4613, 20512, 25, 198, 197, 197, 37811, 198, 197, 197, 35561, 611, 281, 9312, 357, 4758, 468, 257, 1426, 8, 318, 287, 6504, 286, 262, 13792, 628, 197, 197, 42035, 25, 198, 197, 197, 197, 26858, 357, 40002, 393, 7318, 2599, 20885, 284, 2198, 628, 197, 197, 35561, 25, 198, 197, 197, 197, 30388, 25, 6407, 611, 9312, 318, 287, 6504, 11, 10352, 4306, 198, 197, 197, 37811, 198, 197, 197, 198, 197, 197, 7783, 5253, 7, 944, 13, 1930, 11, 9312, 13, 1930, 8, 19841, 2116, 13, 18627 ]
2.709148
1,279
import graphgallery.nn.models.dgl as models from graphgallery.data.sequence import FullBatchSequence from graphgallery import functional as gf from graphgallery.gallery.nodeclas import NodeClasTrainer from graphgallery.gallery.nodeclas import DGL @DGL.register() class APPNP(NodeClasTrainer): """Implementation of approximated personalized propagation of neural predictions (APPNP). `Predict then Propagate: Graph Neural Networks meet Personalized PageRank" <https://arxiv.org/abs/1810.05997>` Tensorflow 1.x implementation: <https://github.com/klicperajo/ppnp> Pytorch implementation: <https://github.com/klicperajo/ppnp> """
[ 11748, 4823, 24460, 13, 20471, 13, 27530, 13, 67, 4743, 355, 4981, 201, 198, 6738, 4823, 24460, 13, 7890, 13, 43167, 1330, 6462, 33, 963, 44015, 594, 201, 198, 6738, 4823, 24460, 1330, 10345, 355, 308, 69, 201, 198, 6738, 4823, 24460, 13, 24460, 13, 17440, 565, 292, 1330, 19081, 2601, 292, 2898, 10613, 201, 198, 201, 198, 6738, 4823, 24460, 13, 24460, 13, 17440, 565, 292, 1330, 360, 8763, 201, 198, 201, 198, 201, 198, 31, 35, 8763, 13, 30238, 3419, 201, 198, 4871, 3486, 13137, 47, 7, 19667, 2601, 292, 2898, 10613, 2599, 201, 198, 220, 220, 220, 37227, 3546, 32851, 286, 5561, 15655, 28949, 43594, 286, 17019, 220, 201, 198, 220, 220, 220, 220, 220, 220, 220, 16277, 357, 2969, 13137, 47, 737, 201, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 47, 17407, 788, 8772, 37861, 25, 29681, 47986, 27862, 1826, 15644, 1143, 201, 198, 220, 220, 220, 220, 220, 220, 220, 7873, 27520, 1, 1279, 5450, 1378, 283, 87, 452, 13, 2398, 14, 8937, 14, 1507, 940, 13, 2713, 39647, 29, 63, 201, 198, 220, 220, 220, 220, 220, 220, 220, 309, 22854, 11125, 352, 13, 87, 7822, 25, 1279, 5450, 1378, 12567, 13, 785, 14, 74, 677, 525, 34944, 14, 381, 37659, 29, 201, 198, 220, 220, 220, 220, 220, 220, 220, 9485, 13165, 354, 7822, 25, 1279, 5450, 1378, 12567, 13, 785, 14, 74, 677, 525, 34944, 14, 381, 37659, 29, 201, 198, 220, 220, 220, 37227, 201, 198 ]
2.817814
247
#!/usr/bin/env python3 """ This module contains all class to manage variable choice Heuristic """ class VariableChoiceHeuristic: """ Super class to handle variable choice heuristic """ def __init__(self, vars): """ Args: vars (set): variables used in all clauses. """ #: set: All variables of a set of clauses program must be analyzed self.vars = vars def getVariabeTriplet(self, S): """Method to get variable Args: S: assignment set Returns: a triplet (X, v, v') such as X is variable, v is value of X and v' is alternative value of X """ if len(S) == 0: return (min(self.vars), 1, -1) s = set(list(zip(*S))[0]) return (min(self.vars-s), 1, -1) class SimpleVariableChoiceHeuristic(VariableChoiceHeuristic): """ First approach to choose variable, it is simple. we choose the first variable wich is not yet in assignment set (S) """ def getVariableTriplet(self, S): """Method to get variable Args: S: assignment set Returns: a triplet (X, v, v') such as X is variable, v is value of X and v' is alternative value of X """ return super().getVariabeTriplet(S) class LevelTwoVariableChoiceHeuristic(VariableChoiceHeuristic): """ This approach to choose variable is better than SimpleVariableChoiceHeuristic because it considers unitary clause""" def getVariableTriplet(self, S): """Method to get variable Args: S(list): assignment set Returns: a set of tuple, i.e a triplet (X, v, v') such as X is variable, v is value of X and v' is alternative value of X """ if len(self.unitClauseLitteral)!=0: return self.unitClauseLitteral return super().getVariabeTriplet(S)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 770, 8265, 4909, 477, 1398, 284, 6687, 7885, 3572, 679, 27915, 37227, 198, 198, 4871, 35748, 46770, 1544, 27915, 25, 198, 220, 220, 220, 37227, 3115, 1398, 284, 5412, 7885, 3572, 339, 27915, 37227, 198, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 410, 945, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 410, 945, 357, 2617, 2599, 9633, 973, 287, 477, 31485, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 25, 900, 25, 1439, 9633, 286, 257, 900, 286, 31485, 1430, 1276, 307, 15475, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 85, 945, 796, 410, 945, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 825, 651, 23907, 11231, 14824, 37069, 7, 944, 11, 311, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 17410, 284, 651, 7885, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 311, 25, 16237, 900, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 15055, 83, 357, 55, 11, 410, 11, 410, 11537, 884, 355, 1395, 318, 7885, 11, 410, 318, 1988, 286, 1395, 290, 410, 6, 318, 5559, 1988, 286, 1395, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 50, 8, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 357, 1084, 7, 944, 13, 85, 945, 828, 352, 11, 532, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 264, 796, 900, 7, 4868, 7, 13344, 46491, 50, 4008, 58, 15, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 357, 1084, 7, 944, 13, 85, 945, 12, 82, 828, 352, 11, 532, 16, 8, 198, 198, 4871, 17427, 43015, 46770, 1544, 27915, 7, 43015, 46770, 1544, 27915, 2599, 198, 220, 220, 220, 37227, 3274, 3164, 284, 3853, 7885, 11, 340, 318, 2829, 13, 356, 3853, 262, 717, 7885, 266, 488, 318, 407, 1865, 287, 16237, 900, 357, 50, 8, 37227, 198, 220, 220, 220, 220, 198, 220, 220, 220, 825, 651, 43015, 14824, 37069, 7, 944, 11, 311, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 17410, 284, 651, 7885, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 311, 25, 16237, 900, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 15055, 83, 357, 55, 11, 410, 11, 410, 11537, 884, 355, 1395, 318, 7885, 11, 410, 318, 1988, 286, 1395, 290, 410, 6, 318, 5559, 1988, 286, 1395, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2208, 22446, 1136, 23907, 11231, 14824, 37069, 7, 50, 8, 198, 198, 4871, 5684, 7571, 43015, 46770, 1544, 27915, 7, 43015, 46770, 1544, 27915, 2599, 198, 220, 220, 220, 37227, 770, 3164, 284, 3853, 7885, 318, 1365, 621, 220, 17427, 43015, 46770, 1544, 27915, 780, 340, 14358, 4326, 560, 13444, 37811, 198, 220, 220, 220, 220, 198, 220, 220, 220, 825, 651, 43015, 14824, 37069, 7, 944, 11, 311, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 17410, 284, 651, 7885, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 311, 7, 4868, 2599, 16237, 900, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 900, 286, 46545, 11, 1312, 13, 68, 257, 15055, 83, 357, 55, 11, 410, 11, 410, 11537, 884, 355, 1395, 318, 7885, 11, 410, 318, 1988, 286, 1395, 290, 410, 6, 318, 5559, 1988, 286, 1395, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 944, 13, 20850, 2601, 682, 43, 1967, 282, 31520, 28, 15, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 20850, 2601, 682, 43, 1967, 282, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2208, 22446, 1136, 23907, 11231, 14824, 37069, 7, 50, 8 ]
2.35006
837
from mayan.apps.views.forms import FileDisplayForm
[ 6738, 743, 272, 13, 18211, 13, 33571, 13, 23914, 1330, 9220, 23114, 8479, 201, 198, 201, 198 ]
3.176471
17
from matplotlib import pyplot as plt import math, sigfig, warnings # module "sigfig" requires "pip install sigfig" at command line import numpy as np # TRUSS INNER CLASSES END HERE # MAIN FUNCTIONS END HERE build_truss(815, True)
[ 6738, 2603, 29487, 8019, 1330, 12972, 29487, 355, 458, 83, 198, 11748, 10688, 11, 43237, 5647, 11, 14601, 1303, 8265, 366, 82, 328, 5647, 1, 4433, 366, 79, 541, 2721, 43237, 5647, 1, 379, 3141, 1627, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 7579, 32835, 3268, 21479, 42715, 1546, 23578, 15698, 198, 220, 220, 220, 220, 220, 198, 198, 2, 8779, 1268, 29397, 4177, 11053, 23578, 15698, 198, 198, 11249, 62, 2213, 1046, 7, 49503, 11, 6407, 8, 628 ]
2.962963
81
import rospy import numpy as np from std_msgs.msg import Float64 from gazebo_msgs.srv import * from geometry_msgs.msg import * import sys, select, os import roslib if os.name == 'nt': import msvcrt else: import tty, termios roslib.load_manifest('dual_gazebo') if __name__ == '__main__': try: rospy.init_node('mecanum_key') if os.name != 'nt': settings = termios.tcgetattr(sys.stdin) linear = [0, 0, 0] angular = [0, 0, 0] plant_x = 0 while(1): key = getKey() if key == 'w' : linear[0] += 1 linear, angular[2] = move_mecanum([linear,angular]) elif key == 'x' : linear[0] -= 1 linear, angular[2] = move_mecanum([linear,angular]) elif key == 'a' : angular[2] += 0.5 linear, angular[2] = move_mecanum([linear,angular]) elif key == 'd' : angular[2] -= 0.5 linear, angular[2] = move_mecanum([linear,angular]) elif key == 'q' : plant_x += 0.01 move_chassis(plant_x) elif key == 'e' : plant_x -= 0.01 move_chassis(plant_x) elif key == 's' : linear = [0, 0, 0] angular = [0, 0, 0] linear, angular[2] = move_mecanum([linear,angular]) if (key == '\x03'): linear = [0, 0, 0] angular = [0, 0, 0] linear, angular[2] = move_mecanum([linear,angular]) break except rospy.ROSInt: pass
[ 11748, 686, 2777, 88, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 14367, 62, 907, 14542, 13, 19662, 1330, 48436, 2414, 198, 6738, 308, 1031, 1765, 78, 62, 907, 14542, 13, 27891, 85, 1330, 1635, 198, 6738, 22939, 62, 907, 14542, 13, 19662, 1330, 1635, 198, 11748, 25064, 11, 2922, 11, 28686, 198, 11748, 686, 6649, 571, 198, 361, 28686, 13, 3672, 6624, 705, 429, 10354, 198, 220, 1330, 13845, 85, 6098, 83, 198, 17772, 25, 198, 220, 1330, 256, 774, 11, 3381, 4267, 628, 198, 198, 4951, 8019, 13, 2220, 62, 805, 8409, 10786, 646, 282, 62, 70, 1031, 1765, 78, 11537, 628, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 686, 2777, 88, 13, 15003, 62, 17440, 10786, 76, 721, 272, 388, 62, 2539, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 611, 28686, 13, 3672, 14512, 705, 429, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6460, 796, 3381, 4267, 13, 23047, 1136, 35226, 7, 17597, 13, 19282, 259, 8, 198, 220, 220, 220, 220, 220, 220, 220, 14174, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 32558, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4618, 62, 87, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 981, 7, 16, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1994, 796, 651, 9218, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1994, 6624, 705, 86, 6, 1058, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 58, 15, 60, 15853, 352, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 87, 6, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 58, 15, 60, 48185, 352, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 628, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 64, 6, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32558, 58, 17, 60, 15853, 657, 13, 20, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 628, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 67, 6, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32558, 58, 17, 60, 48185, 657, 13, 20, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 80, 6, 1058, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4618, 62, 87, 15853, 657, 13, 486, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1445, 62, 354, 20297, 7, 15060, 62, 87, 8, 628, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 68, 6, 1058, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4618, 62, 87, 48185, 657, 13, 486, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1445, 62, 354, 20297, 7, 15060, 62, 87, 8, 628, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 6624, 705, 82, 6, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32558, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 2539, 6624, 705, 59, 87, 3070, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32558, 796, 685, 15, 11, 657, 11, 657, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14174, 11, 32558, 58, 17, 60, 796, 1445, 62, 76, 721, 272, 388, 26933, 29127, 11, 21413, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 628, 220, 220, 220, 2845, 686, 2777, 88, 13, 49, 2640, 5317, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1208, 198 ]
1.738555
983
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## from os.path import exists from requests.exceptions import InvalidURL from ....utils import chpwd from ....dochelpers import exc_str from ....tests.utils import assert_true, assert_raises, assert_false from ....tests.utils import SkipTest from ....tests.utils import with_tempfile, skip_if_no_network, use_cassette from ....tests.utils import skip_if_url_is_not_available from datalad.crawler.pipelines.tests.utils import _test_smoke_pipelines from datalad.crawler.pipelines.fcptable import * from datalad.crawler.pipeline import run_pipeline import logging from logging import getLogger lgr = getLogger('datalad.crawl.tests') from ..fcptable import pipeline, superdataset_pipeline TOPURL = "http://fcon_1000.projects.nitrc.org/fcpClassic/FcpTable.html" @use_cassette('test_fcptable_dataset') @skip_if_no_network @with_tempfile(mkdir=True)
[ 2, 795, 16436, 25, 532, 9, 12, 4235, 25, 21015, 26, 12972, 12, 521, 298, 12, 28968, 25, 604, 26, 7400, 12, 10394, 25, 604, 26, 33793, 12, 8658, 82, 12, 14171, 25, 18038, 532, 9, 12, 198, 2, 409, 25, 900, 39747, 28, 19, 40379, 28, 19, 1509, 28, 19, 645, 316, 25, 198, 2, 22492, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 22492, 198, 2, 198, 2, 220, 220, 4091, 27975, 45761, 2393, 9387, 1863, 351, 262, 4818, 282, 324, 5301, 329, 262, 198, 2, 220, 220, 6634, 290, 5964, 2846, 13, 198, 2, 198, 2, 22492, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 44386, 22492, 198, 198, 6738, 28686, 13, 6978, 1330, 7160, 198, 6738, 7007, 13, 1069, 11755, 1330, 17665, 21886, 198, 198, 6738, 19424, 26791, 1330, 442, 79, 16993, 198, 6738, 19424, 15390, 16794, 364, 1330, 2859, 62, 2536, 198, 6738, 19424, 41989, 13, 26791, 1330, 6818, 62, 7942, 11, 6818, 62, 430, 2696, 11, 6818, 62, 9562, 198, 6738, 19424, 41989, 13, 26791, 1330, 32214, 14402, 198, 6738, 19424, 41989, 13, 26791, 1330, 351, 62, 29510, 7753, 11, 14267, 62, 361, 62, 3919, 62, 27349, 11, 779, 62, 66, 562, 5857, 198, 6738, 19424, 41989, 13, 26791, 1330, 14267, 62, 361, 62, 6371, 62, 271, 62, 1662, 62, 15182, 198, 6738, 4818, 282, 324, 13, 66, 39464, 13, 79, 541, 20655, 13, 41989, 13, 26791, 1330, 4808, 9288, 62, 5796, 2088, 62, 79, 541, 20655, 198, 6738, 4818, 282, 324, 13, 66, 39464, 13, 79, 541, 20655, 13, 16072, 457, 540, 1330, 1635, 198, 6738, 4818, 282, 324, 13, 66, 39464, 13, 79, 541, 4470, 1330, 1057, 62, 79, 541, 4470, 628, 198, 11748, 18931, 198, 6738, 18931, 1330, 651, 11187, 1362, 198, 75, 2164, 796, 651, 11187, 1362, 10786, 67, 10254, 324, 13, 66, 13132, 13, 41989, 11537, 198, 198, 6738, 11485, 16072, 457, 540, 1330, 11523, 11, 2208, 19608, 292, 316, 62, 79, 541, 4470, 198, 198, 35222, 21886, 796, 366, 4023, 1378, 69, 1102, 62, 12825, 13, 42068, 13, 48825, 6015, 13, 2398, 14, 69, 13155, 39914, 14, 37, 13155, 10962, 13, 6494, 1, 628, 198, 31, 1904, 62, 66, 562, 5857, 10786, 9288, 62, 16072, 457, 540, 62, 19608, 292, 316, 11537, 198, 31, 48267, 62, 361, 62, 3919, 62, 27349, 198, 31, 4480, 62, 29510, 7753, 7, 28015, 15908, 28, 17821, 8, 628, 198 ]
2.978365
416
# Water Jug problem print("Solution for Water Jug problem!") x = int(input("Enter the capacity of jug1 : ")) y = int(input("Entert the capacity of jug2 : ")) target = int(input("Enter the target volume : ")) start = [0, 0] if target % gcd(x,y) == 0: print(bfs(start, target, x, y)) else: print("No solution")
[ 2, 5638, 449, 1018, 1917, 201, 198, 201, 198, 4798, 7203, 46344, 329, 5638, 449, 1018, 1917, 2474, 8, 201, 198, 87, 796, 493, 7, 15414, 7203, 17469, 262, 5339, 286, 45808, 16, 1058, 366, 4008, 201, 198, 88, 796, 493, 7, 15414, 7203, 17469, 83, 262, 5339, 286, 45808, 17, 1058, 366, 4008, 201, 198, 201, 198, 16793, 796, 493, 7, 15414, 7203, 17469, 262, 2496, 6115, 1058, 366, 4008, 201, 198, 201, 198, 9688, 796, 685, 15, 11, 657, 60, 220, 201, 198, 201, 198, 361, 2496, 4064, 308, 10210, 7, 87, 11, 88, 8, 6624, 657, 25, 201, 198, 197, 4798, 7, 65, 9501, 7, 9688, 11, 2496, 11, 2124, 11, 331, 4008, 201, 198, 17772, 25, 201, 198, 197, 4798, 7203, 2949, 4610, 4943, 201, 198, 201, 198, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 201, 198, 220, 220, 220, 220 ]
2.315789
152
''' author: cxn version: 0.1.0 read camera calibration from mat ''' import numpy as np import cv2 from scipy.io import loadmat import matplotlib.pyplot as plt #双目相机参数 # 畸变校正和立体校正 def rectifyImage(image1, image2, map1x, map1y, map2x, map2y): """ cv2.remap重映射,就是把一幅图像中某位置的像素放置到另一个图片指定位置的过程 """ rectifyed_img1 = cv2.remap(image1, map1x, map1y, cv2.INTER_AREA) rectifyed_img2 = cv2.remap(image2, map2x, map2y, cv2.INTER_AREA) return rectifyed_img1, rectifyed_img2 #视差计算 #计算三维坐标,并删除错误点 # 立体校正检验----画线 imgL = cv2.imread("D:/cxn_project/Strain-gauges-recognition/cali_img/left/l6.bmp") imgR = cv2.imread("D:/cxn_project/Strain-gauges-recognition/cali_img/right/r6.bmp") height, width = imgL.shape[0:2] # 读取相机内参和外参 config = stereoCameral() map1x, map1y, map2x, map2y, Q = getRectifyTransform(height, width, config) iml_rectified, imr_rectified = rectifyImage(imgL, imgR, map1x, map1y, map2x, map2y) disp = sgbm(iml_rectified, imr_rectified) plt.imshow(disp) target_point = threeD(disp, Q) # 计算目标点的3D坐标(左相机坐标系下) print(target_point)
[ 7061, 6, 198, 9800, 25, 43213, 77, 198, 9641, 25, 657, 13, 16, 13, 15, 198, 961, 4676, 36537, 422, 2603, 198, 7061, 6, 628, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 269, 85, 17, 198, 6738, 629, 541, 88, 13, 952, 1330, 3440, 6759, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 628, 198, 2, 20998, 234, 33566, 106, 33566, 116, 17312, 118, 20998, 224, 46763, 108, 628, 198, 198, 2, 13328, 243, 116, 20998, 246, 43718, 94, 29826, 96, 161, 240, 234, 44165, 233, 19526, 241, 43718, 94, 29826, 96, 198, 4299, 13621, 1958, 5159, 7, 9060, 16, 11, 2939, 17, 11, 3975, 16, 87, 11, 3975, 16, 88, 11, 3975, 17, 87, 11, 3975, 17, 88, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 269, 85, 17, 13, 2787, 499, 34932, 235, 23626, 254, 22887, 226, 11, 22887, 109, 42468, 162, 232, 232, 31660, 33176, 227, 32368, 122, 161, 225, 237, 40792, 162, 253, 238, 19526, 235, 163, 121, 106, 21410, 161, 225, 237, 163, 112, 254, 162, 242, 122, 163, 121, 106, 26344, 108, 20998, 99, 31660, 10310, 103, 32368, 122, 31965, 229, 162, 234, 229, 22522, 248, 19526, 235, 163, 121, 106, 21410, 32573, 229, 163, 101, 233, 198, 220, 220, 220, 220, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 13621, 1958, 276, 62, 9600, 16, 796, 269, 85, 17, 13, 2787, 499, 7, 9060, 16, 11, 3975, 16, 87, 11, 3975, 16, 88, 11, 269, 85, 17, 13, 41358, 62, 12203, 32, 8, 198, 220, 220, 220, 13621, 1958, 276, 62, 9600, 17, 796, 269, 85, 17, 13, 2787, 499, 7, 9060, 17, 11, 3975, 17, 87, 11, 3975, 17, 88, 11, 269, 85, 17, 13, 41358, 62, 12203, 32, 8, 198, 220, 220, 220, 1441, 13621, 1958, 276, 62, 9600, 16, 11, 13621, 1958, 276, 62, 9600, 17, 628, 198, 2, 164, 100, 228, 32432, 106, 164, 106, 94, 163, 106, 245, 628, 198, 2, 164, 106, 94, 163, 106, 245, 49011, 163, 119, 112, 161, 251, 238, 43718, 229, 11, 33176, 114, 26344, 254, 165, 247, 97, 165, 242, 247, 46237, 107, 163, 224, 117, 628, 198, 2, 13328, 104, 233, 19526, 241, 43718, 94, 29826, 96, 162, 96, 222, 165, 103, 234, 650, 18796, 119, 163, 118, 123, 198, 220, 628, 198, 9600, 43, 796, 269, 85, 17, 13, 320, 961, 7203, 35, 14079, 66, 87, 77, 62, 16302, 14, 1273, 3201, 12, 70, 559, 3212, 12, 26243, 653, 14, 66, 7344, 62, 9600, 14, 9464, 14, 75, 21, 13, 65, 3149, 4943, 198, 9600, 49, 796, 269, 85, 17, 13, 320, 961, 7203, 35, 14079, 66, 87, 77, 62, 16302, 14, 1273, 3201, 12, 70, 559, 3212, 12, 26243, 653, 14, 66, 7344, 62, 9600, 14, 3506, 14, 81, 21, 13, 65, 3149, 4943, 198, 198, 17015, 11, 9647, 796, 33705, 43, 13, 43358, 58, 15, 25, 17, 60, 198, 2, 5525, 107, 119, 20998, 244, 33566, 116, 17312, 118, 37863, 227, 20998, 224, 161, 240, 234, 13783, 244, 20998, 224, 198, 11250, 796, 24820, 21701, 1691, 3419, 198, 198, 8899, 16, 87, 11, 3975, 16, 88, 11, 3975, 17, 87, 11, 3975, 17, 88, 11, 1195, 796, 651, 45474, 1958, 41762, 7, 17015, 11, 9647, 11, 4566, 8, 198, 320, 75, 62, 2554, 1431, 11, 545, 81, 62, 2554, 1431, 796, 13621, 1958, 5159, 7, 9600, 43, 11, 33705, 49, 11, 3975, 16, 87, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3975, 16, 88, 11, 3975, 17, 87, 11, 3975, 17, 88, 8, 198, 198, 6381, 79, 796, 264, 70, 20475, 7, 320, 75, 62, 2554, 1431, 11, 545, 81, 62, 2554, 1431, 8, 198, 489, 83, 13, 320, 12860, 7, 6381, 79, 8, 198, 16793, 62, 4122, 796, 1115, 35, 7, 6381, 79, 11, 1195, 8, 1303, 5525, 106, 94, 163, 106, 245, 33566, 106, 43718, 229, 163, 224, 117, 21410, 18, 35, 161, 251, 238, 43718, 229, 171, 120, 230, 32432, 99, 33566, 116, 17312, 118, 161, 251, 238, 43718, 229, 163, 111, 119, 10310, 233, 171, 120, 231, 198, 4798, 7, 16793, 62, 4122, 8, 628 ]
1.538567
726
#! /usr/bin/env python # -*- coding: utf-8 -*- # Put your models here from sqlalchemy import Column, BigInteger, Integer, String, SmallInteger, Float, Boolean, DECIMAL, Text, DateTime, Date, \ Index, UniqueConstraint from sqlalchemy.dialects.mysql import MEDIUMTEXT, LONGTEXT, BIGINT, INTEGER, SMALLINT, TINYINT, TIMESTAMP from sqlalchemy.ext.declarative import declarative_base from decimal import Decimal from sqlalchemy.schema import Sequence from lib.model.base import Base, BaseModel """ 建表规范 1.之后建表 请继承BaseModel 2.表字段主键自增强制取名 不允许是id 3.comment备注强制每个字段都要 4.建表之后如果如果关联其他表字段时候 名字别乱取 要统一 5.字段取名 出现下划线警示时候请自行注意单词拼写 """ if __name__ == '__main__': from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy import create_engine from setting import MYSQL engine = create_engine(MYSQL) DBSession = scoped_session(sessionmaker(bind=engine)) Base.metadata.create_all(engine)
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 5930, 534, 4981, 994, 198, 198, 6738, 44161, 282, 26599, 1330, 29201, 11, 4403, 46541, 11, 34142, 11, 10903, 11, 10452, 46541, 11, 48436, 11, 41146, 11, 27196, 3955, 1847, 11, 8255, 11, 7536, 7575, 11, 7536, 11, 3467, 198, 220, 220, 220, 12901, 11, 30015, 3103, 2536, 2913, 198, 6738, 44161, 282, 26599, 13, 38969, 478, 82, 13, 28744, 13976, 1330, 26112, 41796, 32541, 11, 44533, 32541, 11, 26746, 12394, 11, 17828, 7156, 1137, 11, 9447, 7036, 12394, 11, 309, 1268, 56, 12394, 11, 31742, 6465, 23518, 198, 6738, 44161, 282, 26599, 13, 2302, 13, 32446, 283, 876, 1330, 2377, 283, 876, 62, 8692, 198, 6738, 32465, 1330, 4280, 4402, 198, 6738, 44161, 282, 26599, 13, 15952, 2611, 1330, 45835, 198, 6738, 9195, 13, 19849, 13, 8692, 1330, 7308, 11, 7308, 17633, 198, 198, 37811, 220, 198, 161, 119, 118, 26193, 101, 164, 100, 226, 164, 234, 225, 198, 16, 13, 45298, 28938, 236, 161, 119, 118, 26193, 101, 5525, 107, 115, 163, 119, 100, 33699, 123, 14881, 17633, 198, 17, 13, 26193, 101, 27764, 245, 162, 106, 113, 10310, 119, 165, 242, 106, 164, 229, 103, 161, 95, 252, 28156, 118, 26344, 114, 20998, 244, 28938, 235, 220, 38834, 17739, 223, 164, 106, 116, 42468, 312, 198, 18, 13, 23893, 13783, 229, 37345, 101, 28156, 118, 26344, 35050, 107, 237, 10310, 103, 27764, 245, 162, 106, 113, 32849, 121, 17358, 223, 198, 19, 13, 161, 119, 118, 26193, 101, 45298, 28938, 236, 36685, 224, 162, 252, 250, 36685, 224, 162, 252, 250, 17739, 111, 164, 223, 242, 17739, 114, 20015, 244, 26193, 101, 27764, 245, 162, 106, 113, 33768, 114, 161, 222, 247, 10263, 238, 235, 27764, 245, 26344, 104, 20046, 109, 20998, 244, 5525, 99, 223, 163, 119, 253, 31660, 198, 20, 13, 27764, 245, 162, 106, 113, 20998, 244, 28938, 235, 10263, 229, 118, 163, 236, 108, 10310, 233, 161, 7134, 163, 118, 123, 164, 255, 99, 163, 97, 118, 33768, 114, 161, 222, 247, 46237, 115, 164, 229, 103, 26193, 234, 37345, 101, 35707, 237, 39355, 243, 46237, 235, 162, 233, 120, 37863, 247, 198, 37811, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 422, 44161, 282, 26599, 1330, 2251, 62, 18392, 198, 220, 220, 220, 422, 44161, 282, 26599, 13, 579, 1330, 6246, 10297, 11, 629, 19458, 62, 29891, 198, 220, 220, 220, 422, 44161, 282, 26599, 1330, 2251, 62, 18392, 198, 220, 220, 220, 422, 4634, 1330, 337, 16309, 9711, 628, 220, 220, 220, 3113, 796, 2251, 62, 18392, 7, 44, 16309, 9711, 8, 198, 220, 220, 220, 360, 4462, 2521, 796, 629, 19458, 62, 29891, 7, 29891, 10297, 7, 21653, 28, 18392, 4008, 628, 220, 220, 220, 7308, 13, 38993, 13, 17953, 62, 439, 7, 18392, 8, 198 ]
1.95723
491
# -*- coding: utf-8 -*- """ Author: Zhao Xinlu School: BUPT Date: 2018-01-15 Function: Some different searching algorithms and its performance """ def Simple_search(lists, key): ''' Simple_search: 数据不排序的线性查找,遍历数据元素; 性能: 时间复杂度:O(n) :param lists: search list :param key: the value of key :return: the key's location in the list ''' length = len(lists) for i in range(0, length): if lists[i] == key: return i return False def Binary_search(lists, key): ''' Binary search(二分查找):在查找表中不断取中间元素与查找值进行比较,以二分之一的倍率进行表范围的缩小。 性能: 时间复杂度:O(logn) :param lists: search list :param key: the value of key :return: the key's location in the list ''' length = len(lists) low = 0 high = length - 1 while low < high: mid = int((low + high) / 2) # mid = low + 1/2 * (high - low) if lists[mid] > key: high = mid - 1 elif lists[mid] < key: low = mid + 1 else: return mid return False def Binary_search2(lists, key, low, high): ''' Binary search 2(二分查找的递归实现) :param lists: search list :param key: the value of key :param low: :param high: :return: the key's location in the list ''' mid = int((low + high) / 2) if lists[mid] == key: return mid elif lists[mid] < key: return Binary_search2(lists, key, mid+1, high) else: return Binary_search2(lists, key, low, mid-1) def Binary_search_plus(lists, key): ''' Binary search plus(插值查找):二分查找的优化 对半过滤还不够狠,要是每次都排除十分之九的数据岂不是更好?选择这个值就是关键问题 :param lists: search list :param key: the value of key :return: the key's location in the list ''' length = len(lists) low = 0 high = length - 1 while low < high: mid = low + int((high - low) * (key - lists[low]) / (lists[high] - lists[low])) # 插值的核心公式: value = (key - list[low])/(list[high] - list[low]) if lists[mid] > key: high = mid - 1 elif lists[mid] < key: low = mid + 1 else: return mid return False def Fibonacci_search(lists, key): ''' Fibonacci search(斐波那契查找):利用斐波那契数列的性质,黄金分割的原理来确定mid的位置. 性能: 时间复杂的:O(logn) :param lists: search list :param key: the value of search key :return: the key's location in the list ''' # 需要一个现成的斐波那契列表, 其最大元素的值必须超过查找表中元素个数的数值。 FibonacciList = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368] length = len(lists) low = 0 high = length - 1 # 为了使得查找表满足斐波那契特性,在表的最后添加几个同样的值 # 这个值是原查找表的最后那个元素的值 # 添加的个数由F[k]-1-high决定 k = 0 while high > FibonacciList[k] - 1: k += 1 print k i = high while FibonacciList[k] - 1 > i: lists.append(lists[high]) i += 1 print lists # 算法主逻辑 while low <= high: if k < 2: mid = low else: mid = low + FibonacciList[k] - 1 # 利用斐波那契数列来找寻下一个要比较的关键字的位置 if key < lists[mid]: high = mid - 1 k -= 1 elif key > lists[mid]: low = mid + 1 k -= 2 else: if mid <= high: return mid else: return high return False if __name__ == '__main__': key = 7 TestList1 = [3, 6, 5, 9, 7, 1, 8, 2, 4] TestList2 = [1, 2, 3, 4, 5, 6, 7, 8, 9] TestList3 = [1, 5, 7, 8, 22, 54, 99, 123, 200, 222, 444] # result = Simple_search(TestList1, key) # result = Binary_search(TestList2, key) # result = Binary_search2(TestList2, key, 0, len(TestList2)) # result = Binary_search_plus(TestList2, key) result = Fibonacci_search(TestList3, key=444) print "Key's location of the list is : lists[", result, "]"
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 13838, 25, 29436, 25426, 2290, 198, 26130, 25, 347, 8577, 51, 198, 10430, 25, 2864, 12, 486, 12, 1314, 198, 22203, 25, 2773, 1180, 10342, 16113, 290, 663, 2854, 198, 37811, 198, 198, 4299, 17427, 62, 12947, 7, 20713, 11, 1994, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 17427, 62, 12947, 25, 10545, 243, 108, 162, 235, 106, 38834, 162, 236, 240, 41753, 237, 21410, 163, 118, 123, 45250, 100, 162, 253, 98, 33699, 122, 171, 120, 234, 34402, 235, 43889, 228, 46763, 108, 162, 235, 106, 17739, 225, 163, 112, 254, 26, 198, 220, 220, 220, 10545, 222, 100, 47797, 121, 171, 120, 248, 198, 220, 220, 220, 220, 220, 220, 220, 10545, 245, 114, 29785, 112, 13783, 235, 30266, 224, 41753, 99, 171, 120, 248, 46, 7, 77, 8, 198, 220, 220, 220, 1058, 17143, 8341, 25, 2989, 1351, 198, 220, 220, 220, 1058, 17143, 1994, 25, 262, 1988, 286, 1994, 198, 220, 220, 220, 1058, 7783, 25, 262, 1994, 338, 4067, 287, 262, 1351, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 4129, 796, 18896, 7, 20713, 8, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 15, 11, 4129, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 611, 8341, 58, 72, 60, 6624, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1312, 198, 220, 220, 220, 1441, 10352, 198, 198, 4299, 45755, 62, 12947, 7, 20713, 11, 1994, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 45755, 2989, 7, 12859, 234, 26344, 228, 162, 253, 98, 33699, 122, 2599, 28839, 101, 162, 253, 98, 33699, 122, 26193, 101, 40792, 38834, 23877, 255, 20998, 244, 40792, 29785, 112, 17739, 225, 163, 112, 254, 10310, 236, 162, 253, 98, 33699, 122, 161, 222, 120, 32573, 249, 26193, 234, 162, 107, 242, 164, 122, 225, 171, 120, 234, 20015, 98, 12859, 234, 26344, 228, 45298, 31660, 21410, 161, 222, 235, 163, 236, 229, 32573, 249, 26193, 234, 26193, 101, 164, 234, 225, 32368, 112, 21410, 163, 120, 102, 22887, 237, 16764, 198, 220, 220, 220, 10545, 222, 100, 47797, 121, 171, 120, 248, 198, 220, 220, 220, 220, 220, 220, 220, 10545, 245, 114, 29785, 112, 13783, 235, 30266, 224, 41753, 99, 171, 120, 248, 46, 7, 75, 2360, 8, 198, 220, 220, 220, 1058, 17143, 8341, 25, 2989, 1351, 198, 220, 220, 220, 1058, 17143, 1994, 25, 262, 1988, 286, 1994, 198, 220, 220, 220, 1058, 7783, 25, 262, 1994, 338, 4067, 287, 262, 1351, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 4129, 796, 18896, 7, 20713, 8, 198, 220, 220, 220, 1877, 796, 657, 198, 220, 220, 220, 1029, 796, 4129, 532, 352, 198, 220, 220, 220, 981, 1877, 1279, 1029, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3095, 796, 493, 19510, 9319, 1343, 1029, 8, 1220, 362, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3095, 796, 1877, 1343, 352, 14, 17, 1635, 357, 8929, 532, 1877, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 8341, 58, 13602, 60, 1875, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1029, 796, 3095, 532, 352, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 8341, 58, 13602, 60, 1279, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1877, 796, 3095, 1343, 352, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3095, 628, 220, 220, 220, 1441, 10352, 198, 198, 4299, 45755, 62, 12947, 17, 7, 20713, 11, 1994, 11, 1877, 11, 1029, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 45755, 2989, 362, 7, 12859, 234, 26344, 228, 162, 253, 98, 33699, 122, 21410, 34460, 240, 37605, 240, 22522, 252, 163, 236, 108, 8, 198, 220, 220, 220, 1058, 17143, 8341, 25, 2989, 1351, 198, 220, 220, 220, 1058, 17143, 1994, 25, 262, 1988, 286, 1994, 198, 220, 220, 220, 1058, 17143, 1877, 25, 198, 220, 220, 220, 1058, 17143, 1029, 25, 198, 220, 220, 220, 1058, 7783, 25, 262, 1994, 338, 4067, 287, 262, 1351, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 3095, 796, 493, 19510, 9319, 1343, 1029, 8, 1220, 362, 8, 198, 220, 220, 220, 611, 8341, 58, 13602, 60, 6624, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 3095, 198, 220, 220, 220, 1288, 361, 8341, 58, 13602, 60, 1279, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 45755, 62, 12947, 17, 7, 20713, 11, 1994, 11, 3095, 10, 16, 11, 1029, 8, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 45755, 62, 12947, 17, 7, 20713, 11, 1994, 11, 1877, 11, 3095, 12, 16, 8, 198, 198, 4299, 45755, 62, 12947, 62, 9541, 7, 20713, 11, 1994, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 45755, 2989, 5556, 7, 162, 237, 240, 161, 222, 120, 162, 253, 98, 33699, 122, 2599, 12859, 234, 26344, 228, 162, 253, 98, 33699, 122, 21410, 27670, 246, 44293, 244, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10263, 107, 117, 39355, 232, 32573, 229, 162, 119, 97, 32573, 246, 38834, 13783, 253, 45379, 254, 171, 120, 234, 17358, 223, 42468, 162, 107, 237, 162, 105, 94, 32849, 121, 162, 236, 240, 165, 247, 97, 39355, 223, 26344, 228, 45298, 20046, 251, 21410, 46763, 108, 162, 235, 106, 161, 110, 224, 38834, 42468, 162, 249, 112, 25001, 121, 171, 120, 253, 34460, 231, 162, 233, 102, 32573, 247, 10310, 103, 161, 222, 120, 22887, 109, 42468, 17739, 111, 165, 242, 106, 29785, 106, 165, 95, 246, 198, 220, 220, 220, 1058, 17143, 8341, 25, 2989, 1351, 198, 220, 220, 220, 1058, 17143, 1994, 25, 262, 1988, 286, 1994, 198, 220, 220, 220, 1058, 7783, 25, 262, 1994, 338, 4067, 287, 262, 1351, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 4129, 796, 18896, 7, 20713, 8, 198, 220, 220, 220, 1877, 796, 657, 198, 220, 220, 220, 1029, 796, 4129, 532, 352, 198, 220, 220, 220, 981, 1877, 1279, 1029, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3095, 796, 1877, 1343, 493, 19510, 8929, 532, 1877, 8, 1635, 357, 2539, 532, 8341, 58, 9319, 12962, 1220, 357, 20713, 58, 8929, 60, 532, 8341, 58, 9319, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 10545, 237, 240, 161, 222, 120, 21410, 43718, 116, 33232, 225, 17739, 105, 28156, 237, 171, 120, 248, 1988, 796, 357, 2539, 532, 1351, 58, 9319, 12962, 29006, 4868, 58, 8929, 60, 532, 1351, 58, 9319, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 611, 8341, 58, 13602, 60, 1875, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1029, 796, 3095, 532, 352, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 8341, 58, 13602, 60, 1279, 1994, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1877, 796, 3095, 1343, 352, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3095, 628, 220, 220, 220, 1441, 10352, 198, 198, 4299, 41566, 261, 44456, 62, 12947, 7, 20713, 11, 1994, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 41566, 261, 44456, 2989, 7, 23877, 238, 37345, 95, 165, 224, 96, 25001, 239, 162, 253, 98, 33699, 122, 2599, 26344, 102, 18796, 101, 23877, 238, 37345, 95, 165, 224, 96, 25001, 239, 46763, 108, 26344, 245, 21410, 45250, 100, 164, 112, 101, 171, 120, 234, 165, 119, 226, 34932, 239, 26344, 228, 30298, 110, 21410, 43889, 253, 49426, 228, 30266, 98, 163, 94, 106, 22522, 248, 13602, 21410, 19526, 235, 163, 121, 106, 13, 198, 220, 220, 220, 10545, 222, 100, 47797, 121, 171, 120, 248, 198, 220, 220, 220, 220, 220, 220, 220, 10545, 245, 114, 29785, 112, 13783, 235, 30266, 224, 21410, 171, 120, 248, 46, 7, 75, 2360, 8, 198, 220, 220, 220, 1058, 17143, 8341, 25, 2989, 1351, 198, 220, 220, 220, 1058, 17143, 1994, 25, 262, 1988, 286, 2989, 1994, 198, 220, 220, 220, 1058, 7783, 25, 262, 1994, 338, 4067, 287, 262, 1351, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 1303, 16268, 250, 222, 17358, 223, 31660, 10310, 103, 163, 236, 108, 22755, 238, 21410, 23877, 238, 37345, 95, 165, 224, 96, 25001, 239, 26344, 245, 26193, 101, 11, 10263, 227, 114, 17312, 222, 32014, 17739, 225, 163, 112, 254, 21410, 161, 222, 120, 33232, 227, 165, 94, 119, 164, 41678, 32573, 229, 162, 253, 98, 33699, 122, 26193, 101, 40792, 17739, 225, 163, 112, 254, 10310, 103, 46763, 108, 21410, 46763, 108, 161, 222, 120, 16764, 198, 220, 220, 220, 41566, 261, 44456, 8053, 796, 685, 16, 11, 352, 11, 362, 11, 513, 11, 642, 11, 807, 11, 1511, 11, 2310, 11, 4974, 11, 5996, 11, 9919, 11, 20224, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 30435, 11, 42163, 11, 44300, 11, 860, 5774, 11, 1315, 5607, 11, 1679, 5705, 11, 604, 27057, 11, 8275, 2996, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16003, 3510, 11, 26607, 1157, 11, 2579, 37680, 11, 6337, 27412, 60, 198, 220, 220, 220, 4129, 796, 18896, 7, 20713, 8, 198, 220, 220, 220, 1877, 796, 657, 198, 220, 220, 220, 1029, 796, 4129, 532, 352, 628, 220, 220, 220, 1303, 220, 10310, 118, 12859, 228, 45635, 36181, 245, 162, 253, 98, 33699, 122, 26193, 101, 162, 119, 94, 164, 114, 111, 23877, 238, 37345, 95, 165, 224, 96, 25001, 239, 31965, 117, 45250, 100, 171, 120, 234, 28839, 101, 26193, 101, 21410, 17312, 222, 28938, 236, 162, 115, 119, 27950, 254, 49035, 254, 10310, 103, 28938, 234, 43718, 115, 21410, 161, 222, 120, 198, 220, 220, 220, 1303, 5525, 123, 247, 10310, 103, 161, 222, 120, 42468, 43889, 253, 162, 253, 98, 33699, 122, 26193, 101, 21410, 17312, 222, 28938, 236, 165, 224, 96, 10310, 103, 17739, 225, 163, 112, 254, 21410, 161, 222, 120, 198, 220, 220, 220, 1303, 10545, 115, 119, 27950, 254, 21410, 10310, 103, 46763, 108, 18796, 109, 37, 58, 74, 45297, 16, 12, 8929, 37863, 111, 22522, 248, 198, 220, 220, 220, 479, 796, 657, 198, 220, 220, 220, 981, 1029, 1875, 41566, 261, 44456, 8053, 58, 74, 60, 532, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 479, 15853, 352, 198, 220, 220, 220, 3601, 479, 198, 220, 220, 220, 1312, 796, 1029, 198, 220, 220, 220, 981, 41566, 261, 44456, 8053, 58, 74, 60, 532, 352, 1875, 1312, 25, 198, 220, 220, 220, 220, 220, 220, 220, 8341, 13, 33295, 7, 20713, 58, 8929, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 1312, 15853, 352, 198, 220, 220, 220, 3601, 8341, 628, 220, 220, 220, 1303, 13328, 106, 245, 37345, 243, 10310, 119, 34460, 119, 164, 122, 239, 198, 220, 220, 220, 981, 1877, 19841, 1029, 25, 198, 220, 220, 220, 220, 220, 220, 220, 611, 479, 1279, 362, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3095, 796, 1877, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3095, 796, 1877, 1343, 41566, 261, 44456, 8053, 58, 74, 60, 532, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10263, 230, 102, 18796, 101, 23877, 238, 37345, 95, 165, 224, 96, 25001, 239, 46763, 108, 26344, 245, 30266, 98, 33699, 122, 43380, 119, 10310, 233, 31660, 10310, 103, 17358, 223, 162, 107, 242, 164, 122, 225, 21410, 17739, 111, 165, 242, 106, 27764, 245, 21410, 19526, 235, 163, 121, 106, 628, 220, 220, 220, 220, 220, 220, 220, 611, 1994, 1279, 8341, 58, 13602, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1029, 796, 3095, 532, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 48185, 352, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1994, 1875, 8341, 58, 13602, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1877, 796, 3095, 1343, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 48185, 362, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 3095, 19841, 1029, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3095, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1029, 628, 220, 220, 220, 1441, 10352, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1994, 796, 767, 198, 220, 220, 220, 6208, 8053, 16, 796, 685, 18, 11, 718, 11, 642, 11, 860, 11, 767, 11, 352, 11, 807, 11, 362, 11, 604, 60, 198, 220, 220, 220, 6208, 8053, 17, 796, 685, 16, 11, 362, 11, 513, 11, 604, 11, 642, 11, 718, 11, 767, 11, 807, 11, 860, 60, 198, 220, 220, 220, 6208, 8053, 18, 796, 685, 16, 11, 642, 11, 767, 11, 807, 11, 2534, 11, 7175, 11, 7388, 11, 17031, 11, 939, 11, 27795, 11, 45095, 60, 198, 220, 220, 220, 1303, 1255, 796, 17427, 62, 12947, 7, 14402, 8053, 16, 11, 1994, 8, 198, 220, 220, 220, 1303, 1255, 796, 45755, 62, 12947, 7, 14402, 8053, 17, 11, 1994, 8, 198, 220, 220, 220, 1303, 1255, 796, 45755, 62, 12947, 17, 7, 14402, 8053, 17, 11, 1994, 11, 657, 11, 18896, 7, 14402, 8053, 17, 4008, 198, 220, 220, 220, 1303, 1255, 796, 45755, 62, 12947, 62, 9541, 7, 14402, 8053, 17, 11, 1994, 8, 198, 220, 220, 220, 1255, 796, 41566, 261, 44456, 62, 12947, 7, 14402, 8053, 18, 11, 1994, 28, 30272, 8, 198, 220, 220, 220, 3601, 366, 9218, 338, 4067, 286, 262, 1351, 318, 1058, 8341, 58, 1600, 1255, 11, 366, 30866 ]
1.626442
2,428
""" resources.oauth_ropc ~~~~~~~~~~~~~~~~~~~~ OAuth2 Resource Owner Password Credentials Grant resource object with responders. This resource should be used to accept access_token requests according to RFC 6749 section 4.3: tools.ietf.org/html/rfc6749#section-4.3 The resource requires a callable to be passed in as the auth_creds property which will be given a username & password. The callable should return a token. Returning a string will be interpreted as an error & a RFC 6749 compliant error response will be sent with the error message as the error_description field in the response. """ import falcon import goldman from goldman.exceptions import AuthRejected from ..resources.base import Resource as BaseResource class Resource(BaseResource): """ OAuth2 Resource Owner Password Credentials Grant resource """ DESERIALIZERS = [ goldman.FormUrlEncodedDeserializer, ] SERIALIZERS = [ goldman.JsonSerializer, ] @property def _realm(self): """ Return a string representation of the authentication realm """ return 'Bearer realm="%s"' % goldman.config.AUTH_REALM def on_post(self, req, resp): """ Validate the access token request for spec compliance The spec also dictates the JSON based error response on failure & is handled in this responder. """ grant_type = req.get_param('grant_type') password = req.get_param('password') username = req.get_param('username') # errors or not, disable client caching along the way # per the spec resp.disable_caching() if not grant_type or not password or not username: resp.status = falcon.HTTP_400 resp.serialize({ 'error': 'invalid_request', 'error_description': 'A grant_type, username, & password ' 'parameters are all required when ' 'requesting an OAuth access_token', 'error_uri': 'tools.ietf.org/html/rfc6749#section-4.3.2', }) elif grant_type != 'password': resp.status = falcon.HTTP_400 resp.serialize({ 'error': 'unsupported_grant_type', 'error_description': 'The grant_type parameter MUST be set ' 'to "password" not "%s"' % grant_type, 'error_uri': 'tools.ietf.org/html/rfc6749#section-4.3.2', }) else: try: token = self.auth_creds(username, password) resp.serialize({ 'access_token': token, 'token_type': 'Bearer', }) except AuthRejected as exc: resp.status = falcon.HTTP_401 resp.set_header('WWW-Authenticate', self._realm) resp.serialize({ 'error': 'invalid_client', 'error_description': exc.detail, })
[ 37811, 198, 220, 220, 220, 4133, 13, 12162, 1071, 62, 1773, 66, 198, 220, 220, 220, 220, 27156, 8728, 628, 220, 220, 220, 440, 30515, 17, 20857, 23853, 30275, 327, 445, 14817, 12181, 8271, 198, 220, 220, 220, 2134, 351, 33339, 13, 628, 220, 220, 220, 770, 8271, 815, 307, 973, 284, 2453, 1895, 62, 30001, 7007, 198, 220, 220, 220, 1864, 284, 30978, 8275, 2920, 2665, 604, 13, 18, 25, 628, 220, 220, 220, 220, 220, 220, 220, 4899, 13, 1155, 69, 13, 2398, 14, 6494, 14, 81, 16072, 3134, 2920, 2, 5458, 12, 19, 13, 18, 628, 220, 220, 220, 383, 8271, 4433, 257, 869, 540, 284, 307, 3804, 287, 355, 262, 198, 220, 220, 220, 6284, 62, 66, 445, 82, 3119, 543, 481, 307, 1813, 257, 20579, 1222, 198, 220, 220, 220, 9206, 13, 383, 869, 540, 815, 1441, 257, 11241, 13, 628, 220, 220, 220, 42882, 257, 4731, 481, 307, 16173, 355, 281, 4049, 1222, 198, 220, 220, 220, 257, 30978, 8275, 2920, 31332, 4049, 2882, 481, 307, 1908, 351, 198, 220, 220, 220, 262, 4049, 3275, 355, 262, 4049, 62, 11213, 2214, 287, 198, 220, 220, 220, 262, 2882, 13, 198, 37811, 198, 198, 11748, 24215, 1102, 198, 11748, 3869, 805, 198, 198, 6738, 3869, 805, 13, 1069, 11755, 1330, 26828, 3041, 35408, 198, 6738, 11485, 37540, 13, 8692, 1330, 20857, 355, 7308, 26198, 628, 198, 4871, 20857, 7, 14881, 26198, 2599, 198, 220, 220, 220, 37227, 440, 30515, 17, 20857, 23853, 30275, 327, 445, 14817, 12181, 8271, 37227, 628, 220, 220, 220, 22196, 1137, 12576, 14887, 4877, 796, 685, 198, 220, 220, 220, 220, 220, 220, 220, 3869, 805, 13, 8479, 28165, 27195, 9043, 5960, 48499, 7509, 11, 198, 220, 220, 220, 2361, 628, 220, 220, 220, 18871, 12576, 14887, 4877, 796, 685, 198, 220, 220, 220, 220, 220, 220, 220, 3869, 805, 13, 41, 1559, 32634, 7509, 11, 198, 220, 220, 220, 2361, 628, 220, 220, 220, 2488, 26745, 198, 220, 220, 220, 825, 4808, 5305, 76, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 8229, 257, 4731, 10552, 286, 262, 18239, 13360, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 705, 3856, 11258, 13360, 2625, 4, 82, 30543, 4064, 3869, 805, 13, 11250, 13, 32, 24318, 62, 2200, 1847, 44, 628, 220, 220, 220, 825, 319, 62, 7353, 7, 944, 11, 43089, 11, 1217, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 3254, 20540, 262, 1895, 11241, 2581, 329, 1020, 11846, 628, 220, 220, 220, 220, 220, 220, 220, 383, 1020, 635, 35054, 262, 19449, 1912, 4049, 2882, 198, 220, 220, 220, 220, 220, 220, 220, 319, 5287, 1222, 318, 12118, 287, 428, 3031, 263, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 7264, 62, 4906, 796, 43089, 13, 1136, 62, 17143, 10786, 2164, 415, 62, 4906, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 9206, 796, 43089, 13, 1136, 62, 17143, 10786, 28712, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 20579, 796, 43089, 13, 1136, 62, 17143, 10786, 29460, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 8563, 393, 407, 11, 15560, 5456, 40918, 1863, 262, 835, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 583, 262, 1020, 198, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 40223, 62, 66, 8103, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 611, 407, 7264, 62, 4906, 393, 407, 9206, 393, 407, 20579, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 13376, 796, 24215, 1102, 13, 40717, 62, 7029, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 46911, 1096, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 10354, 705, 259, 12102, 62, 25927, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 62, 11213, 10354, 705, 32, 7264, 62, 4906, 11, 20579, 11, 1222, 9206, 705, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 17143, 7307, 389, 477, 2672, 618, 705, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 25927, 278, 281, 440, 30515, 1895, 62, 30001, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 62, 9900, 10354, 705, 31391, 13, 1155, 69, 13, 2398, 14, 6494, 14, 81, 16072, 3134, 2920, 2, 5458, 12, 19, 13, 18, 13, 17, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32092, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 7264, 62, 4906, 14512, 705, 28712, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 13376, 796, 24215, 1102, 13, 40717, 62, 7029, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 46911, 1096, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 10354, 705, 403, 15999, 62, 2164, 415, 62, 4906, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 62, 11213, 10354, 705, 464, 7264, 62, 4906, 11507, 17191, 307, 900, 705, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 1462, 366, 28712, 1, 407, 36521, 82, 30543, 4064, 7264, 62, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 62, 9900, 10354, 705, 31391, 13, 1155, 69, 13, 2398, 14, 6494, 14, 81, 16072, 3134, 2920, 2, 5458, 12, 19, 13, 18, 13, 17, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32092, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11241, 796, 2116, 13, 18439, 62, 66, 445, 82, 7, 29460, 11, 9206, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 46911, 1096, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 15526, 62, 30001, 10354, 11241, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 30001, 62, 4906, 10354, 705, 3856, 11258, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32092, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2845, 26828, 3041, 35408, 355, 2859, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 13376, 796, 24215, 1102, 13, 40717, 62, 21844, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 2617, 62, 25677, 10786, 17947, 54, 12, 47649, 5344, 3256, 2116, 13557, 5305, 76, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1217, 13, 46911, 1096, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 10354, 705, 259, 12102, 62, 16366, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18224, 62, 11213, 10354, 2859, 13, 49170, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 32092, 198 ]
2.254176
1,377
import os from flask import Flask, request from fbmessenger import BaseMessenger from fbmessenger import quick_replies from fbmessenger.elements import Text from fbmessenger.thread_settings import GreetingText, GetStartedButton, MessengerProfile from fbmessenger import elements from fbmessenger import templates ACCESS_TOKEN = "Baisiai slaptas" VERIFY_TOKEN = "Dar slaptesnis" app = Flask(__name__) app.debug = True messenger = Messenger(ACCESS_TOKEN) @app.route("/", methods=["GET", "POST"]) if __name__ == "__main__": app.run(host="0.0.0.0")
[ 11748, 28686, 198, 6738, 42903, 1330, 46947, 11, 2581, 198, 6738, 277, 20475, 408, 6540, 1330, 7308, 36479, 6540, 198, 6738, 277, 20475, 408, 6540, 1330, 2068, 62, 35666, 444, 198, 6738, 277, 20475, 408, 6540, 13, 68, 3639, 1330, 8255, 198, 6738, 277, 20475, 408, 6540, 13, 16663, 62, 33692, 1330, 402, 2871, 278, 8206, 11, 3497, 10434, 276, 21864, 11, 24306, 37046, 198, 6738, 277, 20475, 408, 6540, 1330, 4847, 198, 6738, 277, 20475, 408, 6540, 1330, 24019, 198, 198, 26861, 7597, 62, 10468, 43959, 796, 366, 33, 15152, 544, 72, 1017, 2373, 292, 1, 198, 5959, 5064, 56, 62, 10468, 43959, 796, 366, 32708, 1017, 2373, 274, 21361, 1, 628, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 198, 1324, 13, 24442, 796, 6407, 198, 37348, 6540, 796, 24306, 7, 26861, 7597, 62, 10468, 43959, 8, 628, 198, 31, 1324, 13, 38629, 7203, 14, 1600, 5050, 28, 14692, 18851, 1600, 366, 32782, 8973, 8, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 598, 13, 5143, 7, 4774, 2625, 15, 13, 15, 13, 15, 13, 15, 4943 ]
2.952128
188
# -*- coding: utf-8 -*- from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from model.contact import ContactBaseData import re
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 384, 11925, 1505, 13, 12384, 26230, 13, 11284, 13, 17077, 1330, 5313, 32103, 21321, 198, 6738, 384, 11925, 1505, 13, 12384, 26230, 13, 11284, 1330, 2938, 62, 17561, 1756, 355, 13182, 198, 198, 6738, 2746, 13, 32057, 1330, 14039, 14881, 6601, 198, 11748, 302, 628 ]
3.35
60
# ################################################################################################ # ------------------------------------------------------------------------------------------------ # File: text_recognition_tesseract_engine.py # Author: Luis Monteiro # # Created on nov 17, 2019, 22:00 PM # ------------------------------------------------------------------------------------------------ # ################################################################################################ # external from pytesseract import image_to_string # ################################################################################################ # ------------------------------------------------------------------------------------------------ # TextRecognitionTesseract # ------------------------------------------------------------------------------------------------ # ################################################################################################ # # ------------------------------------------------------------------------- # initialization # ------------------------------------------------------------------------- # # # ------------------------------------------------------------------------- # process # ------------------------------------------------------------------------- # # ################################################################################################ # ------------------------------------------------------------------------------------------------ # End # ------------------------------------------------------------------------------------------------ # ################################################################################################
[ 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198, 2, 16529, 3880, 198, 2, 9220, 25, 220, 220, 2420, 62, 26243, 653, 62, 83, 408, 263, 529, 62, 18392, 13, 9078, 198, 2, 6434, 25, 20894, 22489, 7058, 198, 2, 198, 2, 15622, 319, 645, 85, 1596, 11, 13130, 11, 2534, 25, 405, 3122, 198, 2, 16529, 3880, 198, 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198, 198, 2, 7097, 198, 6738, 12972, 83, 408, 263, 529, 1330, 2939, 62, 1462, 62, 8841, 198, 198, 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198, 2, 16529, 3880, 198, 2, 8255, 6690, 2360, 653, 51, 408, 263, 529, 220, 198, 2, 16529, 3880, 198, 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 16529, 45537, 198, 220, 220, 220, 1303, 37588, 198, 220, 220, 220, 1303, 16529, 45537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 16529, 45537, 198, 220, 220, 220, 1303, 1429, 198, 220, 220, 220, 1303, 16529, 45537, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 220, 198, 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198, 2, 16529, 3880, 198, 2, 5268, 198, 2, 16529, 3880, 198, 2, 1303, 29113, 29113, 14468, 7804, 4242, 21017, 198 ]
8.147465
217
import OSC, time #import rtmidi_python as rtmidi #midi_out = rtmidi.MidiOut() #midi_out.open_port(0) if __name__ == "__main__": s = OSC.OSCServer(('10.100.7.151', 57120)) # listen on localhost, port 57120 s.addMsgHandler('/startup', handler) # call handler() for OSC messages received with the /startup address s.serve_forever()
[ 11748, 440, 6173, 11, 640, 198, 2, 11748, 374, 83, 13602, 72, 62, 29412, 355, 374, 83, 13602, 72, 198, 2, 13602, 72, 62, 448, 796, 374, 83, 13602, 72, 13, 44, 19830, 7975, 3419, 198, 2, 13602, 72, 62, 448, 13, 9654, 62, 634, 7, 15, 8, 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 264, 796, 440, 6173, 13, 2640, 34, 10697, 7, 10786, 940, 13, 3064, 13, 22, 13, 24309, 3256, 7632, 10232, 4008, 220, 1303, 6004, 319, 1957, 4774, 11, 2493, 7632, 10232, 198, 220, 220, 220, 264, 13, 2860, 50108, 25060, 10786, 14, 9688, 929, 3256, 21360, 8, 220, 220, 220, 220, 1303, 869, 21360, 3419, 329, 440, 6173, 6218, 2722, 351, 262, 1220, 9688, 929, 2209, 198, 220, 220, 220, 264, 13, 2655, 303, 62, 754, 332, 3419, 198 ]
2.423611
144
# -*- coding: utf-8 -*- # @Author: Manuel Rodriguez <valle> # @Date: 28-Aug-2017 # @Email: [email protected] # @Filename: views.py # @Last modified by: valle # @Last modified time: 02-Mar-2018 # @License: Apache license vesion 2.0 from django.forms.models import model_to_dict from django.db.models import Q from django.conf import settings from django.shortcuts import render, redirect try: from django.core.urlresolvers import reverse except ImportError: from django.urls import reverse from django.contrib.auth.decorators import login_required, permission_required from django.template.loader import render_to_string from django.http import HttpResponse #from django.template import Context from django.template.loader import get_template from adminshop.utility import get_documento_compra, get_documento_testeo from adminshop.forms import (CPClientesForm, CPProductosForm, ProductosForm, MODProductosForm, FinTratoForm, ValidarCompra, VistaValidarForm, ModelosForm) from adminshop.models import (Modelos, Clientes, Testeo, ConfigSite, Historial, Firmas, Productos, Compras, Tipos, Direcciones, DocumentoTesteo, ListaTesteo) from adminshop.utility import save_historial, save_doc_firmas, save_doc_testeo from . import (validoDNI, get_first_direccion, set_first_direccion) from tokenapi.http import JsonResponse import threading import base64 import json import trml2pdf import os @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk') @login_required(login_url='login_tk')
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 2488, 13838, 25, 25995, 19391, 1279, 2100, 293, 29, 198, 2, 2488, 10430, 25, 220, 220, 2579, 12, 12512, 12, 5539, 198, 2, 2488, 15333, 25, 220, 1188, 293, 13, 43395, 85, 31, 14816, 13, 785, 198, 2, 2488, 35063, 25, 5009, 13, 9078, 198, 2, 2488, 5956, 9518, 416, 25, 220, 220, 1188, 293, 198, 2, 2488, 5956, 9518, 640, 25, 7816, 12, 7676, 12, 7908, 198, 2, 2488, 34156, 25, 24843, 5964, 410, 274, 295, 362, 13, 15, 198, 198, 6738, 42625, 14208, 13, 23914, 13, 27530, 1330, 2746, 62, 1462, 62, 11600, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 1330, 1195, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 18941, 198, 28311, 25, 198, 220, 220, 220, 422, 42625, 14208, 13, 7295, 13, 6371, 411, 349, 690, 1330, 9575, 198, 16341, 17267, 12331, 25, 198, 220, 220, 220, 422, 42625, 14208, 13, 6371, 82, 1330, 9575, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 12501, 273, 2024, 1330, 17594, 62, 35827, 11, 7170, 62, 35827, 198, 6738, 42625, 14208, 13, 28243, 13, 29356, 1330, 8543, 62, 1462, 62, 8841, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 198, 2, 6738, 42625, 14208, 13, 28243, 1330, 30532, 198, 6738, 42625, 14208, 13, 28243, 13, 29356, 1330, 651, 62, 28243, 198, 6738, 44563, 8548, 13, 315, 879, 1330, 651, 62, 22897, 78, 62, 5589, 430, 11, 651, 62, 22897, 78, 62, 9288, 68, 78, 198, 6738, 44563, 8548, 13, 23914, 1330, 357, 8697, 11792, 274, 8479, 11, 327, 10246, 2076, 310, 418, 8479, 11, 8721, 418, 8479, 11, 19164, 15667, 418, 8479, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4463, 2898, 5549, 8479, 11, 48951, 283, 7293, 430, 11, 25160, 47139, 283, 8479, 11, 9104, 418, 8479, 8, 198, 6738, 44563, 8548, 13, 27530, 1330, 357, 17633, 418, 11, 20985, 274, 11, 6208, 68, 78, 11, 17056, 29123, 11, 5590, 5132, 11, 31623, 292, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8721, 418, 11, 955, 1050, 292, 11, 23095, 418, 11, 34177, 535, 295, 274, 11, 16854, 78, 14402, 68, 78, 11, 7343, 64, 14402, 68, 78, 8, 198, 198, 6738, 44563, 8548, 13, 315, 879, 1330, 3613, 62, 10034, 5132, 11, 3613, 62, 15390, 62, 69, 2533, 292, 11, 3613, 62, 15390, 62, 9288, 68, 78, 198, 6738, 764, 1330, 357, 12102, 78, 35, 22125, 11, 651, 62, 11085, 62, 67, 557, 535, 295, 11, 900, 62, 11085, 62, 67, 557, 535, 295, 8, 198, 6738, 11241, 15042, 13, 4023, 1330, 449, 1559, 31077, 198, 11748, 4704, 278, 198, 11748, 2779, 2414, 198, 11748, 33918, 198, 11748, 491, 4029, 17, 12315, 198, 11748, 28686, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 198, 198, 31, 38235, 62, 35827, 7, 38235, 62, 6371, 11639, 38235, 62, 30488, 11537, 628, 628, 198 ]
2.751765
850
from __future__ import ( absolute_import, unicode_literals, ) import unittest from pysoa.common.errors import Error from pysoa.test.plan.grammar import assertions from pysoa.test.plan.grammar.data_types import AnyValue # noinspection PyTypeChecker
[ 6738, 11593, 37443, 834, 1330, 357, 198, 220, 220, 220, 4112, 62, 11748, 11, 198, 220, 220, 220, 28000, 1098, 62, 17201, 874, 11, 198, 8, 198, 198, 11748, 555, 715, 395, 198, 198, 6738, 12972, 568, 64, 13, 11321, 13, 48277, 1330, 13047, 198, 6738, 12972, 568, 64, 13, 9288, 13, 11578, 13, 4546, 3876, 1330, 29965, 198, 6738, 12972, 568, 64, 13, 9288, 13, 11578, 13, 4546, 3876, 13, 7890, 62, 19199, 1330, 4377, 11395, 628, 198, 2, 645, 1040, 14978, 9485, 6030, 9787, 263, 198 ]
2.954545
88
import asyncio import socket import time import logging from unittest.mock import Mock from torba.testcase import IntegrationTestCase, Conductor import lbry.wallet from lbry.schema.claim import Claim from lbry.wallet.transaction import Transaction, Output from lbry.wallet.dewies import dewies_to_lbc as d2l, lbc_to_dewies as l2d log = logging.getLogger(__name__) class TestSessionBloat(IntegrationTestCase): """ ERROR:asyncio:Fatal read error on socket transport protocol: <lbrynet.wallet.server.session.LBRYElectrumX object at 0x7f7e3bfcaf60> transport: <_SelectorSocketTransport fd=3236 read=polling write=<idle, bufsize=0>> Traceback (most recent call last): File "/usr/lib/python3.7/asyncio/selector_events.py", line 801, in _read_ready__data_received data = self._sock.recv(self.max_size) TimeoutError: [Errno 110] Connection timed out """ LEDGER = lbry.wallet
[ 11748, 30351, 952, 198, 11748, 17802, 198, 11748, 640, 198, 11748, 18931, 198, 6738, 555, 715, 395, 13, 76, 735, 1330, 44123, 198, 6738, 7332, 7012, 13, 9288, 7442, 1330, 38410, 14402, 20448, 11, 9724, 33029, 198, 11748, 18360, 563, 13, 44623, 198, 6738, 18360, 563, 13, 15952, 2611, 13, 6604, 1330, 22070, 198, 6738, 18360, 563, 13, 44623, 13, 7645, 2673, 1330, 45389, 11, 25235, 198, 6738, 18360, 563, 13, 44623, 13, 67, 413, 444, 1330, 390, 86, 444, 62, 1462, 62, 75, 15630, 355, 288, 17, 75, 11, 300, 15630, 62, 1462, 62, 67, 413, 444, 355, 300, 17, 67, 628, 198, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198, 4871, 6208, 36044, 3629, 15073, 7, 34500, 1358, 14402, 20448, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 33854, 25, 292, 13361, 952, 25, 37, 10254, 1100, 4049, 319, 17802, 4839, 198, 220, 220, 220, 8435, 25, 1279, 23160, 563, 3262, 13, 44623, 13, 15388, 13, 29891, 13, 43, 11473, 56, 19453, 6582, 55, 2134, 379, 657, 87, 22, 69, 22, 68, 18, 65, 16072, 1878, 1899, 29, 198, 220, 220, 220, 4839, 25, 1279, 62, 17563, 273, 39105, 8291, 634, 277, 67, 28, 18, 24940, 1100, 28, 30393, 278, 3551, 28, 27, 312, 293, 11, 42684, 7857, 28, 15, 4211, 198, 220, 220, 220, 34912, 1891, 357, 1712, 2274, 869, 938, 2599, 198, 220, 220, 220, 220, 220, 9220, 12813, 14629, 14, 8019, 14, 29412, 18, 13, 22, 14, 292, 13361, 952, 14, 19738, 273, 62, 31534, 13, 9078, 1600, 1627, 807, 486, 11, 287, 4808, 961, 62, 1493, 834, 7890, 62, 47844, 198, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 2116, 13557, 82, 735, 13, 8344, 85, 7, 944, 13, 9806, 62, 7857, 8, 198, 220, 220, 220, 3862, 448, 12331, 25, 685, 9139, 81, 3919, 9796, 60, 26923, 28805, 503, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 12365, 30373, 796, 18360, 563, 13, 44623, 198 ]
2.76506
332
import sqlite3 conn = sqlite3.connect('northwind_small.sqlite3') curs = conn.cursor() query = '''SELECT ProductName FROM Product ORDER BY UnitPrice DESC LIMIT 10''' curs.execute(query) results = curs.fetchall() print('Ten most expensive items (per unit price):') for result in results: print(result[0]) query = '''SELECT avg(HireDate - BirthDate) FROM Employee''' curs.execute(query) print('Average age of an employee at the time of their hiring:', curs.fetchall()[0][0]) query = '''SELECT City, avg(HireDate - BirthDate) as Age FROM Employee GROUP BY City''' curs.execute(query) print('Average age of an employee at the time of their hiring by city:') results = curs.fetchall() for result in results: print(result[0], result[1]) query = '''SELECT ProductName, CompanyName FROM Product INNER JOIN Supplier ON Product.SupplierId = Supplier.Id ORDER BY UnitPrice DESC LIMIT 10''' curs.execute(query) results = curs.fetchall() print('Ten most expensive items (per unit price) and their suppliers:') print('Product', 'Supplier', sep='\t\t\t') for result in results: if len(result[0]) > 15: sep = '\t' else: sep = '\t\t' print(result[0], result[1], sep=sep) query = '''SELECT CategoryName, count(Product.Id) as ProductCount FROM Category INNER JOIN Product ON Category.Id = Product.CategoryId GROUP BY CategoryId ORDER BY ProductCount DESC LIMIT 1''' curs.execute(query) print('Largest category (by number of products in it):', curs.fetchall()[0][0]) query = '''SELECT LastName, FirstName, count(Territory.TerritoryDescription) as TerritoryCount FROM Employee, Territory JOIN EmployeeTerritory ON Employee.Id = EmployeeTerritory.EmployeeId GROUP BY Employee.Id ORDER BY TerritoryCount DESC LIMIT 1''' curs.execute(query) results = curs.fetchall() print('Employee with the most territories, and number of territories they have:', results[0][1], results[0][0] + ';', results[0][2])
[ 11748, 44161, 578, 18, 198, 37043, 796, 44161, 578, 18, 13, 8443, 10786, 43588, 7972, 62, 17470, 13, 25410, 578, 18, 11537, 198, 66, 1834, 796, 48260, 13, 66, 21471, 3419, 198, 22766, 796, 705, 7061, 46506, 8721, 5376, 16034, 8721, 198, 12532, 1137, 11050, 11801, 18124, 22196, 34, 198, 43, 3955, 2043, 838, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 43420, 796, 13882, 13, 69, 7569, 439, 3419, 198, 4798, 10786, 24893, 749, 5789, 3709, 357, 525, 4326, 2756, 2599, 11537, 198, 1640, 1255, 287, 2482, 25, 198, 220, 220, 220, 3601, 7, 20274, 58, 15, 12962, 198, 198, 22766, 796, 705, 7061, 46506, 42781, 7, 39, 557, 10430, 532, 17647, 10430, 8, 198, 10913, 2662, 36824, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 4798, 10786, 26287, 2479, 286, 281, 6538, 379, 262, 640, 286, 511, 12965, 25, 3256, 13882, 13, 69, 7569, 439, 3419, 58, 15, 7131, 15, 12962, 198, 198, 22766, 796, 705, 7061, 46506, 2254, 11, 42781, 7, 39, 557, 10430, 532, 17647, 10430, 8, 355, 7129, 198, 10913, 2662, 36824, 198, 46846, 11050, 2254, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 4798, 10786, 26287, 2479, 286, 281, 6538, 379, 262, 640, 286, 511, 12965, 416, 1748, 25, 11537, 198, 43420, 796, 13882, 13, 69, 7569, 439, 3419, 198, 1640, 1255, 287, 2482, 25, 198, 220, 220, 220, 3601, 7, 20274, 58, 15, 4357, 1255, 58, 16, 12962, 198, 198, 22766, 796, 705, 7061, 46506, 8721, 5376, 11, 5834, 5376, 16034, 8721, 198, 1268, 21479, 32357, 1268, 8105, 2505, 198, 1340, 8721, 13, 15979, 2505, 7390, 796, 8105, 2505, 13, 7390, 198, 12532, 1137, 11050, 11801, 18124, 22196, 34, 198, 43, 3955, 2043, 838, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 43420, 796, 13882, 13, 69, 7569, 439, 3419, 198, 4798, 10786, 24893, 749, 5789, 3709, 357, 525, 4326, 2756, 8, 290, 511, 20499, 25, 11537, 198, 4798, 10786, 15667, 3256, 705, 15979, 2505, 3256, 41767, 11639, 59, 83, 59, 83, 59, 83, 11537, 198, 1640, 1255, 287, 2482, 25, 198, 220, 220, 220, 611, 18896, 7, 20274, 58, 15, 12962, 1875, 1315, 25, 198, 220, 220, 220, 220, 220, 220, 220, 41767, 796, 705, 59, 83, 6, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 41767, 796, 705, 59, 83, 59, 83, 6, 198, 220, 220, 220, 3601, 7, 20274, 58, 15, 4357, 1255, 58, 16, 4357, 41767, 28, 325, 79, 8, 198, 198, 22766, 796, 705, 7061, 46506, 21743, 5376, 11, 954, 7, 15667, 13, 7390, 8, 355, 8721, 12332, 16034, 21743, 198, 1268, 21479, 32357, 1268, 8721, 198, 1340, 21743, 13, 7390, 796, 8721, 13, 27313, 7390, 198, 46846, 11050, 21743, 7390, 198, 12532, 1137, 11050, 8721, 12332, 22196, 34, 198, 43, 3955, 2043, 352, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 4798, 10786, 43, 853, 395, 6536, 357, 1525, 1271, 286, 3186, 287, 340, 2599, 3256, 13882, 13, 69, 7569, 439, 3419, 58, 15, 7131, 15, 12962, 198, 198, 22766, 796, 705, 7061, 46506, 4586, 5376, 11, 3274, 5376, 11, 954, 7, 15156, 799, 652, 13, 15156, 799, 652, 11828, 8, 355, 25219, 12332, 198, 10913, 2662, 36824, 11, 25219, 198, 45006, 1268, 36824, 15156, 799, 652, 198, 1340, 36824, 13, 7390, 796, 36824, 15156, 799, 652, 13, 29733, 1453, 7390, 198, 46846, 11050, 36824, 13, 7390, 198, 12532, 1137, 11050, 25219, 12332, 22196, 34, 198, 43, 3955, 2043, 352, 7061, 6, 198, 66, 1834, 13, 41049, 7, 22766, 8, 198, 43420, 796, 13882, 13, 69, 7569, 439, 3419, 198, 4798, 10786, 29733, 1453, 351, 262, 749, 16771, 11, 290, 1271, 286, 16771, 484, 423, 25, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 2482, 58, 15, 7131, 16, 4357, 2482, 58, 15, 7131, 15, 60, 1343, 705, 26, 3256, 2482, 58, 15, 7131, 17, 12962, 198 ]
2.95092
652
"""Module for functional data manipulation in a basis system. Defines functional data object in a basis function system representation and the corresponding basis classes. """ import copy import warnings from abc import ABC, abstractmethod from typing import Tuple import numpy as np from ..._utils import _domain_range, _reshape_eval_points, _same_domain from . import _fdatabasis class Basis(ABC): """Defines the structure of a basis function system. Attributes: domain_range (tuple): a tuple of length 2 containing the initial and end values of the interval over which the basis can be evaluated. n_basis (int): number of functions in the basis. """ def __init__(self, *, domain_range=None, n_basis: int = 1): """Basis constructor. Args: domain_range (tuple or list of tuples, optional): Definition of the interval where the basis defines a space. Defaults to (0,1). n_basis: Number of functions that form the basis. Defaults to 1. """ if domain_range is not None: domain_range = _domain_range(domain_range) # Some checks _check_domain(domain_range) if n_basis < 1: raise ValueError( "The number of basis has to be strictly positive.", ) self._domain_range = domain_range self._n_basis = n_basis super().__init__() def __call__(self, *args, **kwargs) -> np.ndarray: """Evaluate the basis using :meth:`evaluate`.""" return self.evaluate(*args, **kwargs) @property @property @property @property @abstractmethod def _evaluate(self, eval_points) -> np.ndarray: """Subclasses must override this to provide basis evaluation.""" pass def evaluate(self, eval_points, *, derivative: int = 0) -> np.ndarray: """Evaluate Basis objects and its derivatives. Evaluates the basis function system or its derivatives at a list of given values. Args: eval_points (array_like): List of points where the basis is evaluated. Returns: Matrix whose rows are the values of the each basis function or its derivatives at the values specified in eval_points. """ if derivative < 0: raise ValueError("derivative only takes non-negative values.") elif derivative != 0: warnings.warn("Parameter derivative is deprecated. Use the " "derivative function instead.", DeprecationWarning) return self.derivative(order=derivative)(eval_points) eval_points = _reshape_eval_points(eval_points, aligned=True, n_samples=self.n_basis, dim_domain=self.dim_domain) return self._evaluate(eval_points).reshape( (self.n_basis, len(eval_points), self.dim_codomain)) def derivative(self, *, order: int = 1) -> '_fdatabasis.FDataBasis': """Construct a FDataBasis object containing the derivative. Args: order: Order of the derivative. Defaults to 1. Returns: Derivative object. """ return self.to_basis().derivative(order=order) def _derivative_basis_and_coefs(self, coefs: np.ndarray, order: int = 1): """ Subclasses can override this to provide derivative construction. A basis can provide derivative evaluation at given points without providing a basis representation for its derivatives, although is recommended to provide both if possible. """ raise NotImplementedError(f"{type(self)} basis does not support " "the construction of a basis of the " "derivatives.") def plot(self, chart=None, **kwargs): """Plot the basis object or its derivatives. Args: chart (figure object, axe or list of axes, optional): figure over with the graphs are plotted or axis over where the graphs are plotted. **kwargs: keyword arguments to be passed to the fdata.plot function. Returns: fig (figure): figure object in which the graphs are plotted. """ self.to_basis().plot(chart=chart, **kwargs) def _coordinate_nonfull(self, fdatabasis, key): """ Returns a fdatagrid for the coordinate functions indexed by key. Subclasses can override this to provide coordinate indexing. The key parameter has been already validated and is an integer or slice in the range [0, self.dim_codomain. """ raise NotImplementedError("Coordinate indexing not implemented") def _coordinate(self, fdatabasis, key): """Returns a fdatagrid for the coordinate functions indexed by key.""" # Raises error if not in range and normalize key r_key = range(self.dim_codomain)[key] if isinstance(r_key, range) and len(r_key) == 0: raise IndexError("Empty number of coordinates selected") # Full fdatabasis case if (self.dim_codomain == 1 and r_key == 0) or ( isinstance(r_key, range) and len(r_key) == self.dim_codomain): return fdatabasis.copy() else: return self._coordinate_nonfull(fdatabasis=fdatabasis, key=r_key) def rescale(self, domain_range=None): r"""Return a copy of the basis with a new :term:`domain` range, with the corresponding values rescaled to the new bounds. Args: domain_range (tuple, optional): Definition of the interval where the basis defines a space. Defaults uses the same as the original basis. """ return self.copy(domain_range=domain_range) def copy(self, domain_range=None): """Basis copy""" new_copy = copy.deepcopy(self) if domain_range is not None: domain_range = _domain_range(domain_range) # Some checks _check_domain(domain_range) new_copy._domain_range = domain_range return new_copy def to_basis(self) -> '_fdatabasis.FDataBasis': """Convert the Basis to FDatabasis. Returns: FDataBasis with this basis as its basis, and all basis functions as observations. """ from . import FDataBasis return FDataBasis(self.copy(), np.identity(self.n_basis)) def inner_product_matrix(self, other: 'Basis' = None) -> np.array: r"""Return the Inner Product Matrix of a pair of basis. The Inner Product Matrix is defined as .. math:: IP_{ij} = \langle\phi_i, \theta_j\rangle where :math:`\phi_i` is the ith element of the basi and :math:`\theta_j` is the jth element of the second basis. This matrix helps on the calculation of the inner product between objects on two basis and for the change of basis. Args: other: Basis to compute the inner product matrix. If not basis is given, it computes the matrix with itself returning the Gram Matrix Returns: Inner Product Matrix of two basis """ from ...misc import inner_product_matrix if other is None or self == other: return self.gram_matrix() return inner_product_matrix(self, other) def _gram_matrix_numerical(self) -> np.array: """ Compute the Gram matrix numerically. """ from ...misc import inner_product_matrix return inner_product_matrix(self, force_numerical=True) def _gram_matrix(self) -> np.array: """ Compute the Gram matrix. Subclasses may override this method for improving computation of the Gram matrix. """ return self._gram_matrix_numerical() def gram_matrix(self) -> np.array: r"""Return the Gram Matrix of a basis The Gram Matrix is defined as .. math:: G_{ij} = \langle\phi_i, \phi_j\rangle where :math:`\phi_i` is the ith element of the basis. This is a symmetric matrix and positive-semidefinite. Returns: Gram Matrix of the basis. """ gram = getattr(self, "_gram_matrix_cached", None) if gram is None: gram = self._gram_matrix() self._gram_matrix_cached = gram return gram def __repr__(self) -> str: """Representation of a Basis object.""" return (f"{self.__class__.__name__}(domain_range={self.domain_range}, " f"n_basis={self.n_basis})") def __eq__(self, other) -> bool: """Equality of Basis""" return (type(self) == type(other) and _same_domain(self, other) and self.n_basis == other.n_basis) def __hash__(self) -> int: """Hash of Basis""" return hash((self.domain_range, self.n_basis))
[ 37811, 26796, 329, 10345, 1366, 17512, 287, 257, 4308, 1080, 13, 198, 198, 7469, 1127, 10345, 1366, 2134, 287, 257, 4308, 2163, 1080, 10552, 290, 198, 1169, 11188, 4308, 6097, 13, 198, 198, 37811, 198, 11748, 4866, 198, 11748, 14601, 198, 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 19720, 1330, 309, 29291, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 2644, 62, 26791, 1330, 4808, 27830, 62, 9521, 11, 4808, 3447, 1758, 62, 18206, 62, 13033, 11, 4808, 31642, 62, 27830, 198, 6738, 764, 1330, 4808, 16344, 265, 397, 17765, 628, 198, 198, 4871, 6455, 271, 7, 24694, 2599, 198, 220, 220, 220, 37227, 7469, 1127, 262, 4645, 286, 257, 4308, 2163, 1080, 13, 628, 220, 220, 220, 49213, 25, 198, 220, 220, 220, 220, 220, 220, 220, 7386, 62, 9521, 357, 83, 29291, 2599, 257, 46545, 286, 4129, 362, 7268, 262, 4238, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 3815, 286, 262, 16654, 625, 543, 262, 4308, 460, 307, 16726, 13, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 12093, 271, 357, 600, 2599, 1271, 286, 5499, 287, 262, 4308, 13, 628, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1635, 11, 7386, 62, 9521, 28, 14202, 11, 299, 62, 12093, 271, 25, 493, 796, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 15522, 271, 23772, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7386, 62, 9521, 357, 83, 29291, 393, 1351, 286, 12777, 2374, 11, 11902, 2599, 30396, 286, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16654, 810, 262, 4308, 15738, 257, 2272, 13, 2896, 13185, 284, 357, 15, 11, 16, 737, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 299, 62, 12093, 271, 25, 7913, 286, 5499, 326, 1296, 262, 4308, 13, 2896, 13185, 284, 352, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 7386, 62, 9521, 318, 407, 6045, 25, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7386, 62, 9521, 796, 4808, 27830, 62, 9521, 7, 27830, 62, 9521, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 2773, 8794, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4808, 9122, 62, 27830, 7, 27830, 62, 9521, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 299, 62, 12093, 271, 1279, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 11052, 12331, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 464, 1271, 286, 4308, 468, 284, 307, 14084, 3967, 33283, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 27830, 62, 9521, 796, 7386, 62, 9521, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 77, 62, 12093, 271, 796, 299, 62, 12093, 271, 628, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 3419, 628, 220, 220, 220, 825, 11593, 13345, 834, 7, 944, 11, 1635, 22046, 11, 12429, 46265, 22046, 8, 4613, 45941, 13, 358, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 36, 2100, 4985, 262, 4308, 1262, 1058, 76, 2788, 25, 63, 49786, 63, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 49786, 46491, 22046, 11, 12429, 46265, 22046, 8, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 397, 8709, 24396, 198, 220, 220, 220, 825, 4808, 49786, 7, 944, 11, 5418, 62, 13033, 8, 4613, 45941, 13, 358, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7004, 37724, 1276, 20957, 428, 284, 2148, 4308, 12660, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 1208, 628, 220, 220, 220, 825, 13446, 7, 944, 11, 5418, 62, 13033, 11, 1635, 11, 27255, 25, 493, 796, 657, 8, 4613, 45941, 13, 358, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 36, 2100, 4985, 6455, 271, 5563, 290, 663, 28486, 13, 628, 220, 220, 220, 220, 220, 220, 220, 26439, 12632, 262, 4308, 2163, 1080, 393, 663, 28486, 379, 257, 1351, 286, 198, 220, 220, 220, 220, 220, 220, 220, 1813, 3815, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5418, 62, 13033, 357, 18747, 62, 2339, 2599, 7343, 286, 2173, 810, 262, 4308, 318, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16726, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 24936, 3025, 15274, 389, 262, 3815, 286, 262, 1123, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4308, 2163, 393, 663, 28486, 379, 262, 3815, 7368, 287, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5418, 62, 13033, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 27255, 1279, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 11052, 12331, 7203, 1082, 452, 876, 691, 2753, 1729, 12, 31591, 3815, 19570, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 27255, 14512, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14601, 13, 40539, 7203, 36301, 27255, 318, 39224, 13, 5765, 262, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 1082, 452, 876, 2163, 2427, 33283, 2129, 8344, 341, 20361, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 1082, 452, 876, 7, 2875, 28, 1082, 452, 876, 5769, 18206, 62, 13033, 8, 628, 220, 220, 220, 220, 220, 220, 220, 5418, 62, 13033, 796, 4808, 3447, 1758, 62, 18206, 62, 13033, 7, 18206, 62, 13033, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19874, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 299, 62, 82, 12629, 28, 944, 13, 77, 62, 12093, 271, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5391, 62, 27830, 28, 944, 13, 27740, 62, 27830, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 49786, 7, 18206, 62, 13033, 737, 3447, 1758, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 944, 13, 77, 62, 12093, 271, 11, 18896, 7, 18206, 62, 13033, 828, 2116, 13, 27740, 62, 19815, 296, 391, 4008, 628, 220, 220, 220, 825, 27255, 7, 944, 11, 1635, 11, 1502, 25, 493, 796, 352, 8, 4613, 705, 62, 16344, 265, 397, 17765, 13, 37, 6601, 15522, 271, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 42316, 257, 376, 6601, 15522, 271, 2134, 7268, 262, 27255, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1502, 25, 8284, 286, 262, 27255, 13, 2896, 13185, 284, 352, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9626, 452, 876, 2134, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 1462, 62, 12093, 271, 22446, 1082, 452, 876, 7, 2875, 28, 2875, 8, 628, 220, 220, 220, 825, 4808, 1082, 452, 876, 62, 12093, 271, 62, 392, 62, 1073, 891, 82, 7, 944, 11, 763, 891, 82, 25, 45941, 13, 358, 18747, 11, 1502, 25, 493, 796, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3834, 37724, 460, 20957, 428, 284, 2148, 27255, 5103, 13, 628, 220, 220, 220, 220, 220, 220, 220, 317, 4308, 460, 2148, 27255, 12660, 379, 1813, 2173, 198, 220, 220, 220, 220, 220, 220, 220, 1231, 4955, 257, 4308, 10552, 329, 663, 28486, 11, 198, 220, 220, 220, 220, 220, 220, 220, 3584, 318, 7151, 284, 2148, 1111, 611, 1744, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 1892, 3546, 1154, 12061, 12331, 7, 69, 1, 90, 4906, 7, 944, 38165, 4308, 857, 407, 1104, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 1169, 5103, 286, 257, 4308, 286, 262, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 1082, 452, 2929, 19570, 628, 220, 220, 220, 825, 7110, 7, 944, 11, 8262, 28, 14202, 11, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 43328, 262, 4308, 2134, 393, 663, 28486, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8262, 357, 26875, 2134, 11, 23272, 393, 1351, 286, 34197, 11, 11902, 2599, 3785, 625, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 262, 28770, 389, 37515, 393, 16488, 625, 810, 262, 28770, 389, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37515, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12429, 46265, 22046, 25, 21179, 7159, 284, 307, 3804, 284, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 7890, 13, 29487, 2163, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2336, 357, 26875, 2599, 3785, 2134, 287, 543, 262, 28770, 389, 37515, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 1462, 62, 12093, 271, 22446, 29487, 7, 40926, 28, 40926, 11, 12429, 46265, 22046, 8, 628, 220, 220, 220, 825, 4808, 37652, 4559, 62, 13159, 12853, 7, 944, 11, 277, 19608, 397, 17765, 11, 1994, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 16409, 257, 277, 19608, 363, 6058, 329, 262, 20435, 5499, 41497, 416, 1994, 13, 628, 220, 220, 220, 220, 220, 220, 220, 3834, 37724, 460, 20957, 428, 284, 2148, 20435, 6376, 278, 13, 628, 220, 220, 220, 220, 220, 220, 220, 383, 1994, 11507, 468, 587, 1541, 31031, 290, 318, 281, 18253, 393, 198, 220, 220, 220, 220, 220, 220, 220, 16416, 287, 262, 2837, 685, 15, 11, 2116, 13, 27740, 62, 19815, 296, 391, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 1892, 3546, 1154, 12061, 12331, 7203, 7222, 45480, 6376, 278, 407, 9177, 4943, 628, 220, 220, 220, 825, 4808, 37652, 4559, 7, 944, 11, 277, 19608, 397, 17765, 11, 1994, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 35561, 257, 277, 19608, 363, 6058, 329, 262, 20435, 5499, 41497, 416, 1994, 526, 15931, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 7567, 2696, 4049, 611, 407, 287, 2837, 290, 3487, 1096, 1994, 198, 220, 220, 220, 220, 220, 220, 220, 374, 62, 2539, 796, 2837, 7, 944, 13, 27740, 62, 19815, 296, 391, 38381, 2539, 60, 628, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 81, 62, 2539, 11, 2837, 8, 290, 18896, 7, 81, 62, 2539, 8, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5298, 12901, 12331, 7203, 40613, 1271, 286, 22715, 6163, 4943, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 6462, 277, 19608, 397, 17765, 1339, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 944, 13, 27740, 62, 19815, 296, 391, 6624, 352, 290, 374, 62, 2539, 6624, 657, 8, 393, 357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 318, 39098, 7, 81, 62, 2539, 11, 2837, 8, 290, 18896, 7, 81, 62, 2539, 8, 6624, 2116, 13, 27740, 62, 19815, 296, 391, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 277, 19608, 397, 17765, 13, 30073, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 37652, 4559, 62, 13159, 12853, 7, 16344, 265, 397, 17765, 28, 16344, 265, 397, 17765, 11, 1994, 28, 81, 62, 2539, 8, 628, 220, 220, 220, 825, 6811, 1000, 7, 944, 11, 7386, 62, 9521, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 13615, 257, 4866, 286, 262, 4308, 351, 257, 649, 1058, 4354, 25, 63, 27830, 63, 2837, 11, 351, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 262, 11188, 3815, 6811, 3021, 284, 262, 649, 22303, 13, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7386, 62, 9521, 357, 83, 29291, 11, 11902, 2599, 30396, 286, 262, 16654, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 810, 262, 4308, 15738, 257, 2272, 13, 2896, 13185, 3544, 262, 976, 355, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 262, 2656, 4308, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 30073, 7, 27830, 62, 9521, 28, 27830, 62, 9521, 8, 628, 220, 220, 220, 825, 4866, 7, 944, 11, 7386, 62, 9521, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 15522, 271, 4866, 37811, 628, 220, 220, 220, 220, 220, 220, 220, 649, 62, 30073, 796, 4866, 13, 22089, 30073, 7, 944, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 7386, 62, 9521, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7386, 62, 9521, 796, 4808, 27830, 62, 9521, 7, 27830, 62, 9521, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 2773, 8794, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4808, 9122, 62, 27830, 7, 27830, 62, 9521, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 649, 62, 30073, 13557, 27830, 62, 9521, 796, 7386, 62, 9521, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 649, 62, 30073, 628, 220, 220, 220, 825, 284, 62, 12093, 271, 7, 944, 8, 4613, 705, 62, 16344, 265, 397, 17765, 13, 37, 6601, 15522, 271, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 3103, 1851, 262, 6455, 271, 284, 376, 27354, 397, 17765, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 376, 6601, 15522, 271, 351, 428, 4308, 355, 663, 4308, 11, 290, 477, 4308, 5499, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 355, 13050, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 422, 764, 1330, 376, 6601, 15522, 271, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 376, 6601, 15522, 271, 7, 944, 13, 30073, 22784, 45941, 13, 738, 414, 7, 944, 13, 77, 62, 12093, 271, 4008, 628, 220, 220, 220, 825, 8434, 62, 11167, 62, 6759, 8609, 7, 944, 11, 584, 25, 705, 15522, 271, 6, 796, 6045, 8, 4613, 45941, 13, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 13615, 262, 24877, 8721, 24936, 286, 257, 5166, 286, 4308, 13, 628, 220, 220, 220, 220, 220, 220, 220, 383, 24877, 8721, 24936, 318, 5447, 355, 628, 220, 220, 220, 220, 220, 220, 220, 11485, 10688, 3712, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6101, 23330, 2926, 92, 796, 3467, 75, 9248, 59, 34846, 62, 72, 11, 3467, 1169, 8326, 62, 73, 59, 81, 9248, 628, 220, 220, 220, 220, 220, 220, 220, 810, 1058, 11018, 25, 63, 59, 34846, 62, 72, 63, 318, 262, 340, 71, 5002, 286, 262, 1615, 72, 290, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 11018, 25, 63, 59, 1169, 8326, 62, 73, 63, 318, 262, 474, 400, 5002, 286, 262, 1218, 4308, 13, 198, 220, 220, 220, 220, 220, 220, 220, 770, 17593, 5419, 319, 262, 17952, 286, 262, 8434, 1720, 198, 220, 220, 220, 220, 220, 220, 220, 1022, 5563, 319, 734, 4308, 290, 329, 262, 1487, 286, 4308, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 584, 25, 6455, 271, 284, 24061, 262, 8434, 1720, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17593, 13, 1002, 407, 4308, 318, 1813, 11, 340, 552, 1769, 262, 17593, 351, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2346, 8024, 262, 20159, 24936, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 24877, 8721, 24936, 286, 734, 4308, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 422, 2644, 44374, 1330, 8434, 62, 11167, 62, 6759, 8609, 628, 220, 220, 220, 220, 220, 220, 220, 611, 584, 318, 6045, 393, 2116, 6624, 584, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 4546, 62, 6759, 8609, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 8434, 62, 11167, 62, 6759, 8609, 7, 944, 11, 584, 8, 628, 220, 220, 220, 825, 4808, 4546, 62, 6759, 8609, 62, 77, 6975, 605, 7, 944, 8, 4613, 45941, 13, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3082, 1133, 262, 20159, 17593, 5470, 1146, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 422, 2644, 44374, 1330, 8434, 62, 11167, 62, 6759, 8609, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 8434, 62, 11167, 62, 6759, 8609, 7, 944, 11, 2700, 62, 77, 6975, 605, 28, 17821, 8, 628, 220, 220, 220, 825, 4808, 4546, 62, 6759, 8609, 7, 944, 8, 4613, 45941, 13, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3082, 1133, 262, 20159, 17593, 13, 628, 220, 220, 220, 220, 220, 220, 220, 3834, 37724, 743, 20957, 428, 2446, 329, 10068, 29964, 198, 220, 220, 220, 220, 220, 220, 220, 286, 262, 20159, 17593, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 4546, 62, 6759, 8609, 62, 77, 6975, 605, 3419, 628, 220, 220, 220, 825, 14599, 62, 6759, 8609, 7, 944, 8, 4613, 45941, 13, 18747, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 13615, 262, 20159, 24936, 286, 257, 4308, 628, 220, 220, 220, 220, 220, 220, 220, 383, 20159, 24936, 318, 5447, 355, 628, 220, 220, 220, 220, 220, 220, 220, 11485, 10688, 3712, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 402, 23330, 2926, 92, 796, 3467, 75, 9248, 59, 34846, 62, 72, 11, 3467, 34846, 62, 73, 59, 81, 9248, 628, 220, 220, 220, 220, 220, 220, 220, 810, 1058, 11018, 25, 63, 59, 34846, 62, 72, 63, 318, 262, 340, 71, 5002, 286, 262, 4308, 13, 770, 318, 257, 198, 220, 220, 220, 220, 220, 220, 220, 23606, 19482, 17593, 290, 3967, 12, 43616, 485, 69, 9504, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20159, 24936, 286, 262, 4308, 13, 628, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 14599, 796, 651, 35226, 7, 944, 11, 45434, 4546, 62, 6759, 8609, 62, 66, 2317, 1600, 6045, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 14599, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14599, 796, 2116, 13557, 4546, 62, 6759, 8609, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 4546, 62, 6759, 8609, 62, 66, 2317, 796, 14599, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 14599, 628, 220, 220, 220, 825, 11593, 260, 1050, 834, 7, 944, 8, 4613, 965, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 40171, 341, 286, 257, 6455, 271, 2134, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 357, 69, 1, 90, 944, 13, 834, 4871, 834, 13, 834, 3672, 834, 92, 7, 27830, 62, 9521, 34758, 944, 13, 27830, 62, 9521, 5512, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 1, 77, 62, 12093, 271, 34758, 944, 13, 77, 62, 12093, 271, 30072, 4943, 628, 220, 220, 220, 825, 11593, 27363, 834, 7, 944, 11, 584, 8, 4613, 20512, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 36, 13237, 286, 6455, 271, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 357, 4906, 7, 944, 8, 6624, 2099, 7, 847, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 4808, 31642, 62, 27830, 7, 944, 11, 584, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 2116, 13, 77, 62, 12093, 271, 6624, 584, 13, 77, 62, 12093, 271, 8, 628, 220, 220, 220, 825, 11593, 17831, 834, 7, 944, 8, 4613, 493, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 26257, 286, 6455, 271, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 12234, 19510, 944, 13, 27830, 62, 9521, 11, 2116, 13, 77, 62, 12093, 271, 4008, 198 ]
2.346202
3,963
from collections import defaultdict import math import time import random import tensorflow as tf import numpy as np # The length of the n-gram N = 2 # Functions to read in the corpus # NOTE: We are using data from the Penn Treebank, which is already converted # into an easy-to-use format with "<unk>" symbols. If we were using other # data we would have to do pre-processing and consider how to choose # unknown words, etc. w2i = defaultdict(lambda: len(w2i)) S = w2i["<s>"] UNK = w2i["<unk>"] # Read in the data train = list(read_dataset("../data/ptb/train.txt")) w2i = defaultdict(lambda: UNK, w2i) dev = list(read_dataset("../data/ptb/valid.txt")) i2w = {v: k for k, v in w2i.items()} nwords = len(w2i) x1 = tf.placeholder(shape=(1,), dtype=tf.int32) x2 = tf.placeholder(shape=(1,), dtype=tf.int32) y = tf.placeholder(shape=(1,None), dtype=tf.int32) embedding1 = tf.get_variable(name="embedding1", shape=(nwords, nwords), initializer=tf.glorot_normal_initializer()) embedding2 = tf.get_variable(name="embedding2",shape=(nwords, nwords), initializer=tf.glorot_normal_initializer()) bias = tf.get_variable(name="bias", shape=(nwords), initializer=tf.glorot_normal_initializer()) embed1 = tf.nn.embedding_lookup(embedding1, x1) embed2 = tf.nn.embedding_lookup(embedding2, x2) score = embed1 + embed2 + bias loss = tf.nn.softmax_cross_entropy_with_logits(logits=score, labels=y) optimizer = tf.train.AdamOptimizer().minimize(loss) session = tf.Session() session.run(tf.global_variables_initializer()) for i in range(10): random.shuffle(train) total_loss = 0 train_words = 0 for id, sentence in enumerate(train): history = [S] * N sentence_loss = 0 for i in sentence + [S]: y_one_hot = np.zeros(shape=(1, nwords)) y_one_hot[0][i] = 1 input1, input2 = history history = history[1:] + [nwords] feed_train = {x1: [input1], x2: [input2], y: y_one_hot} char_loss, _ = session.run(fetches=[loss, optimizer], feed_dict=feed_train) sentence_loss += char_loss total_loss += sentence_loss train_words += len(sentence) if (id + 1) % 5000 == 0: print("--finished %r sentences, %.4f" % (id + 1, (total_loss / train_words))) print("iter %r: train loss/word=%.4f, ppl=%.4f" % ( i, total_loss / train_words, math.exp(total_loss / train_words)))
[ 6738, 17268, 1330, 4277, 11600, 198, 11748, 10688, 198, 11748, 640, 198, 11748, 4738, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 383, 4129, 286, 262, 299, 12, 4546, 198, 45, 796, 362, 198, 198, 2, 40480, 284, 1100, 287, 262, 35789, 198, 2, 24550, 25, 775, 389, 1262, 1366, 422, 262, 6595, 12200, 17796, 11, 543, 318, 1541, 11513, 198, 2, 220, 220, 220, 220, 220, 220, 656, 281, 2562, 12, 1462, 12, 1904, 5794, 351, 33490, 2954, 24618, 14354, 13, 1002, 356, 547, 1262, 584, 198, 2, 220, 220, 220, 220, 220, 220, 1366, 356, 561, 423, 284, 466, 662, 12, 36948, 290, 2074, 703, 284, 3853, 198, 2, 220, 220, 220, 220, 220, 220, 6439, 2456, 11, 3503, 13, 198, 86, 17, 72, 796, 4277, 11600, 7, 50033, 25, 18896, 7, 86, 17, 72, 4008, 198, 50, 796, 266, 17, 72, 14692, 27, 82, 29, 8973, 198, 4944, 42, 796, 266, 17, 72, 14692, 27, 2954, 29, 8973, 198, 198, 2, 4149, 287, 262, 1366, 198, 27432, 796, 1351, 7, 961, 62, 19608, 292, 316, 7203, 40720, 7890, 14, 457, 65, 14, 27432, 13, 14116, 48774, 198, 86, 17, 72, 796, 4277, 11600, 7, 50033, 25, 4725, 42, 11, 266, 17, 72, 8, 198, 7959, 796, 1351, 7, 961, 62, 19608, 292, 316, 7203, 40720, 7890, 14, 457, 65, 14, 12102, 13, 14116, 48774, 198, 72, 17, 86, 796, 1391, 85, 25, 479, 329, 479, 11, 410, 287, 266, 17, 72, 13, 23814, 3419, 92, 198, 77, 10879, 796, 18896, 7, 86, 17, 72, 8, 198, 198, 87, 16, 796, 48700, 13, 5372, 13829, 7, 43358, 16193, 16, 11, 828, 288, 4906, 28, 27110, 13, 600, 2624, 8, 198, 87, 17, 796, 48700, 13, 5372, 13829, 7, 43358, 16193, 16, 11, 828, 288, 4906, 28, 27110, 13, 600, 2624, 8, 198, 88, 796, 48700, 13, 5372, 13829, 7, 43358, 16193, 16, 11, 14202, 828, 288, 4906, 28, 27110, 13, 600, 2624, 8, 198, 20521, 12083, 16, 796, 48700, 13, 1136, 62, 45286, 7, 3672, 2625, 20521, 12083, 16, 1600, 5485, 16193, 77, 10879, 11, 299, 10879, 828, 4238, 7509, 28, 27110, 13, 70, 4685, 313, 62, 11265, 62, 36733, 7509, 28955, 198, 20521, 12083, 17, 796, 48700, 13, 1136, 62, 45286, 7, 3672, 2625, 20521, 12083, 17, 1600, 43358, 16193, 77, 10879, 11, 299, 10879, 828, 4238, 7509, 28, 27110, 13, 70, 4685, 313, 62, 11265, 62, 36733, 7509, 28955, 198, 65, 4448, 796, 48700, 13, 1136, 62, 45286, 7, 3672, 2625, 65, 4448, 1600, 5485, 16193, 77, 10879, 828, 4238, 7509, 28, 27110, 13, 70, 4685, 313, 62, 11265, 62, 36733, 7509, 28955, 198, 198, 20521, 16, 796, 48700, 13, 20471, 13, 20521, 12083, 62, 5460, 929, 7, 20521, 12083, 16, 11, 2124, 16, 8, 198, 20521, 17, 796, 48700, 13, 20471, 13, 20521, 12083, 62, 5460, 929, 7, 20521, 12083, 17, 11, 2124, 17, 8, 198, 26675, 796, 11525, 16, 1343, 11525, 17, 1343, 10690, 198, 198, 22462, 796, 48700, 13, 20471, 13, 4215, 9806, 62, 19692, 62, 298, 28338, 62, 4480, 62, 6404, 896, 7, 6404, 896, 28, 26675, 11, 14722, 28, 88, 8, 198, 198, 40085, 7509, 796, 48700, 13, 27432, 13, 23159, 27871, 320, 7509, 22446, 1084, 48439, 7, 22462, 8, 198, 198, 29891, 796, 48700, 13, 36044, 3419, 198, 29891, 13, 5143, 7, 27110, 13, 20541, 62, 25641, 2977, 62, 36733, 7509, 28955, 198, 198, 1640, 1312, 287, 2837, 7, 940, 2599, 198, 220, 220, 220, 4738, 13, 1477, 18137, 7, 27432, 8, 198, 220, 220, 220, 2472, 62, 22462, 796, 657, 198, 220, 220, 220, 4512, 62, 10879, 796, 657, 198, 220, 220, 220, 329, 4686, 11, 6827, 287, 27056, 378, 7, 27432, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 2106, 796, 685, 50, 60, 1635, 399, 198, 220, 220, 220, 220, 220, 220, 220, 6827, 62, 22462, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 6827, 1343, 685, 50, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 505, 62, 8940, 796, 45941, 13, 9107, 418, 7, 43358, 16193, 16, 11, 299, 10879, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 505, 62, 8940, 58, 15, 7131, 72, 60, 796, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5128, 16, 11, 5128, 17, 796, 2106, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2106, 796, 2106, 58, 16, 47715, 1343, 685, 77, 10879, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3745, 62, 27432, 796, 1391, 87, 16, 25, 685, 15414, 16, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 17, 25, 685, 15414, 17, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 25, 331, 62, 505, 62, 8940, 92, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1149, 62, 22462, 11, 4808, 220, 796, 6246, 13, 5143, 7, 34045, 2052, 41888, 22462, 11, 6436, 7509, 4357, 3745, 62, 11600, 28, 12363, 62, 27432, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6827, 62, 22462, 15853, 1149, 62, 22462, 198, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 22462, 15853, 6827, 62, 22462, 198, 220, 220, 220, 220, 220, 220, 220, 4512, 62, 10879, 15853, 18896, 7, 34086, 594, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 357, 312, 1343, 352, 8, 4064, 23336, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 438, 43952, 4064, 81, 13439, 11, 4064, 13, 19, 69, 1, 4064, 357, 312, 1343, 352, 11, 357, 23350, 62, 22462, 1220, 4512, 62, 10879, 22305, 628, 220, 220, 220, 3601, 7203, 2676, 4064, 81, 25, 4512, 2994, 14, 4775, 28, 7225, 19, 69, 11, 279, 489, 28, 7225, 19, 69, 1, 4064, 357, 198, 220, 220, 220, 1312, 11, 2472, 62, 22462, 1220, 4512, 62, 10879, 11, 10688, 13, 11201, 7, 23350, 62, 22462, 1220, 4512, 62, 10879, 22305, 198 ]
2.345317
1,057
# Generated by Django 2.2.12 on 2020-08-02 14:03 from django.db import migrations
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 1065, 319, 12131, 12, 2919, 12, 2999, 1478, 25, 3070, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628 ]
2.8
30
t.left(90) t.color("green") t.speed(1) tree(90)
[ 198, 83, 13, 9464, 7, 3829, 8, 198, 198, 83, 13, 8043, 7203, 14809, 4943, 198, 83, 13, 12287, 7, 16, 8, 198, 21048, 7, 3829, 8, 628 ]
1.821429
28
# genetic algorithm search of the one max optimization problem from numpy.random import randint from numpy.random import rand import numpy as np import json # objective function # tournament selection # crossover two parents to create two children # mutation operator # genetic algorithm if False: # define the total iterations n_iter = 100 # bits n_bits = 500 #20 # define the population size n_pop = n_bits * 5 #100 # crossover rate r_cross = 0.9 # mutation rate r_mut = 1.0 / float(n_bits) # perform the genetic algorithm search best, score = genetic_algorithm(onemax, n_bits, n_iter, n_pop, r_cross, r_mut) print('Done!') print('f(%s) = %f' % (best, score))
[ 2, 8513, 11862, 2989, 286, 262, 530, 3509, 23989, 1917, 198, 6738, 299, 32152, 13, 25120, 1330, 43720, 600, 198, 6738, 299, 32152, 13, 25120, 1330, 43720, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 33918, 198, 198, 2, 9432, 2163, 198, 198, 2, 7756, 6356, 198, 220, 198, 2, 27668, 734, 3397, 284, 2251, 734, 1751, 198, 220, 198, 2, 15148, 10088, 198, 198, 2, 8513, 11862, 198, 198, 361, 10352, 25, 198, 220, 220, 220, 1303, 8160, 262, 2472, 34820, 198, 220, 220, 220, 299, 62, 2676, 796, 1802, 198, 220, 220, 220, 1303, 10340, 198, 220, 220, 220, 299, 62, 9895, 796, 5323, 1303, 1238, 198, 220, 220, 220, 1303, 8160, 262, 3265, 2546, 198, 220, 220, 220, 299, 62, 12924, 796, 299, 62, 9895, 1635, 642, 1303, 3064, 198, 220, 220, 220, 1303, 27668, 2494, 198, 220, 220, 220, 374, 62, 19692, 796, 657, 13, 24, 198, 220, 220, 220, 1303, 15148, 2494, 198, 220, 220, 220, 374, 62, 21973, 796, 352, 13, 15, 1220, 12178, 7, 77, 62, 9895, 8, 198, 220, 220, 220, 1303, 1620, 262, 8513, 11862, 2989, 198, 220, 220, 220, 1266, 11, 4776, 796, 8513, 62, 282, 42289, 7, 261, 368, 897, 11, 299, 62, 9895, 11, 299, 62, 2676, 11, 299, 62, 12924, 11, 374, 62, 19692, 11, 374, 62, 21973, 8, 198, 220, 220, 220, 3601, 10786, 45677, 0, 11537, 198, 220, 220, 220, 3601, 10786, 69, 7, 4, 82, 8, 796, 4064, 69, 6, 4064, 357, 13466, 11, 4776, 4008, 198 ]
2.869565
253
from django import forms from joblistings.models import Job from accounts.models import Employer from ace.constants import CATEGORY_CHOICES, MAX_LENGTH_TITLE, MAX_LENGTH_DESCRIPTION, MAX_LENGTH_RESPONSABILITIES, MAX_LENGTH_REQUIREMENTS, MAX_LENGTH_STANDARDFIELDS, LOCATION_CHOICES from tinymce.widgets import TinyMCE from companies.models import Company from joblistings.models import Job, JobPDFDescription from django.shortcuts import get_object_or_404 from accounts.models import Employer
[ 6738, 42625, 14208, 1330, 5107, 198, 6738, 1693, 4868, 654, 13, 27530, 1330, 15768, 198, 6738, 5504, 13, 27530, 1330, 12645, 263, 198, 6738, 31506, 13, 9979, 1187, 1330, 327, 6158, 38, 15513, 62, 44899, 34444, 11, 25882, 62, 43, 49494, 62, 49560, 2538, 11, 25882, 62, 43, 49494, 62, 30910, 40165, 11, 25882, 62, 43, 49494, 62, 19535, 47, 1340, 4090, 49516, 11, 25882, 62, 43, 49494, 62, 2200, 49128, 28957, 11, 25882, 62, 43, 49494, 62, 2257, 6981, 1503, 8068, 40, 3698, 5258, 11, 37347, 6234, 62, 44899, 34444, 198, 6738, 7009, 76, 344, 13, 28029, 11407, 1330, 20443, 44, 5222, 198, 6738, 2706, 13, 27530, 1330, 5834, 198, 6738, 1693, 4868, 654, 13, 27530, 1330, 15768, 11, 15768, 20456, 11828, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 651, 62, 15252, 62, 273, 62, 26429, 198, 6738, 5504, 13, 27530, 1330, 12645, 263, 198 ]
3.346939
147
from .cluster_dw import ClusterWrapper from .graphsage_dw import GraphSAGEDataWrapper from .m3s_dw import M3SDataWrapper from .network_embedding_dw import NetworkEmbeddingDataWrapper from .node_classification_dw import FullBatchNodeClfDataWrapper from .pprgo_dw import PPRGoDataWrapper from .sagn_dw import SAGNDataWrapper
[ 6738, 764, 565, 5819, 62, 67, 86, 1330, 38279, 36918, 2848, 198, 6738, 764, 34960, 82, 496, 62, 67, 86, 1330, 29681, 4090, 38, 1961, 1045, 36918, 2848, 198, 6738, 764, 76, 18, 82, 62, 67, 86, 1330, 337, 18, 50, 6601, 36918, 2848, 198, 6738, 764, 27349, 62, 20521, 12083, 62, 67, 86, 1330, 7311, 31567, 6048, 278, 6601, 36918, 2848, 198, 6738, 764, 17440, 62, 4871, 2649, 62, 67, 86, 1330, 6462, 33, 963, 19667, 34, 1652, 6601, 36918, 2848, 198, 6738, 764, 381, 81, 2188, 62, 67, 86, 1330, 350, 4805, 5247, 6601, 36918, 2848, 198, 6738, 764, 82, 4660, 62, 67, 86, 1330, 311, 4760, 45, 6601, 36918, 2848, 198 ]
2.833333
114
#!/usr/bin/env python3 import io import sys import generator from generator.cmdline import * if __name__ == '__main__': if len(sys.argv) == 1: run_cli() else: cmds = [] line_buf = [] for arg in sys.argv[1:]: if arg == '--': cmds.append(' '.join(line_buf)) line_buf = [] else: line_buf.append(arg) cmds.append(' '.join(line_buf)) run_cmds(io.StringIO('\n'.join(cmds)))
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 11748, 33245, 198, 11748, 25064, 198, 198, 11748, 17301, 198, 6738, 17301, 13, 28758, 1370, 1330, 1635, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 611, 18896, 7, 17597, 13, 853, 85, 8, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1057, 62, 44506, 3419, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 23991, 82, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 1627, 62, 29325, 796, 17635, 628, 220, 220, 220, 220, 220, 220, 220, 329, 1822, 287, 25064, 13, 853, 85, 58, 16, 25, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1822, 6624, 705, 438, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 23991, 82, 13, 33295, 10786, 45302, 22179, 7, 1370, 62, 29325, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 62, 29325, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 62, 29325, 13, 33295, 7, 853, 8, 628, 220, 220, 220, 220, 220, 220, 220, 23991, 82, 13, 33295, 10786, 45302, 22179, 7, 1370, 62, 29325, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1057, 62, 28758, 82, 7, 952, 13, 10100, 9399, 10786, 59, 77, 4458, 22179, 7, 28758, 82, 22305, 198 ]
1.865672
268
import os import pathlib import click import parse from fishtools.config import Config @click.command() @click.argument('config_fpath') if __name__ == "__main__": main()
[ 11748, 28686, 198, 11748, 3108, 8019, 198, 198, 11748, 3904, 198, 11748, 21136, 198, 198, 6738, 5916, 31391, 13, 11250, 1330, 17056, 628, 198, 198, 31, 12976, 13, 21812, 3419, 198, 31, 12976, 13, 49140, 10786, 11250, 62, 69, 6978, 11537, 628, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1388, 3419, 198 ]
3
61
#!/usr/bin/env python # # Copyright 2015 Martin Cochran # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from game_model import Game from scores_messages import AgeBracket from scores_messages import Division from scores_messages import League class ListIdBiMap: """Encapsulates mappings to and from list id and structured properties.""" # List ID definitions corresponding to lists defined in the twitter account of # @martin_cochran. USAU_COLLEGE_OPEN_LIST_ID = '186814318' USAU_COLLEGE_WOMENS_LIST_ID = '186814882' USAU_CLUB_OPEN_LIST_ID = '186732484' USAU_CLUB_WOMENS_LIST_ID = '186732631' USAU_CLUB_MIXED_LIST_ID = '186815046' AUDL_LIST_ID = '186926608' MLU_LIST_ID = '186926651' ALL_LISTS = [ USAU_COLLEGE_OPEN_LIST_ID, USAU_COLLEGE_WOMENS_LIST_ID, USAU_CLUB_OPEN_LIST_ID, USAU_CLUB_WOMENS_LIST_ID, USAU_CLUB_MIXED_LIST_ID, AUDL_LIST_ID, MLU_LIST_ID ] # Simple data structure to lookup lists if the league, division, and age # bracket were specified in the request. LIST_ID_MAP = { League.USAU: { Division.OPEN: { AgeBracket.COLLEGE: USAU_COLLEGE_OPEN_LIST_ID, AgeBracket.NO_RESTRICTION: USAU_CLUB_OPEN_LIST_ID, }, Division.WOMENS: { AgeBracket.COLLEGE: USAU_COLLEGE_WOMENS_LIST_ID, AgeBracket.NO_RESTRICTION: USAU_CLUB_WOMENS_LIST_ID, }, Division.MIXED: { AgeBracket.NO_RESTRICTION: USAU_CLUB_MIXED_LIST_ID, }, }, League.AUDL: { Division.OPEN: { AgeBracket.NO_RESTRICTION: AUDL_LIST_ID, }, }, League.MLU: { Division.OPEN: { AgeBracket.NO_RESTRICTION: MLU_LIST_ID, }, }, } LIST_ID_TO_DIVISION = { USAU_COLLEGE_OPEN_LIST_ID: Division.OPEN, USAU_COLLEGE_WOMENS_LIST_ID: Division.WOMENS, USAU_CLUB_OPEN_LIST_ID: Division.OPEN, USAU_CLUB_WOMENS_LIST_ID: Division.WOMENS, USAU_CLUB_MIXED_LIST_ID: Division.MIXED, AUDL_LIST_ID: Division.OPEN, MLU_LIST_ID: Division.OPEN, } LIST_ID_TO_AGE_BRACKET = { USAU_COLLEGE_OPEN_LIST_ID: AgeBracket.COLLEGE, USAU_COLLEGE_WOMENS_LIST_ID: AgeBracket.COLLEGE, USAU_CLUB_OPEN_LIST_ID: AgeBracket.NO_RESTRICTION, USAU_CLUB_WOMENS_LIST_ID: AgeBracket.NO_RESTRICTION, USAU_CLUB_MIXED_LIST_ID: AgeBracket.NO_RESTRICTION, AUDL_LIST_ID: AgeBracket.NO_RESTRICTION, MLU_LIST_ID: AgeBracket.NO_RESTRICTION, } LIST_ID_TO_LEAGUE = { USAU_COLLEGE_OPEN_LIST_ID: League.USAU, USAU_COLLEGE_WOMENS_LIST_ID: League.USAU, USAU_CLUB_OPEN_LIST_ID: League.USAU, USAU_CLUB_WOMENS_LIST_ID: League.USAU, USAU_CLUB_MIXED_LIST_ID: League.USAU, AUDL_LIST_ID: League.AUDL, MLU_LIST_ID: League.MLU, } @staticmethod def GetListId(division, age_bracket, league): """Looks up the list_id which corresponds to the given division and league. Args: division: Division of interest age_bracket: AgeBracket of interest league: League of interest Returns: The list id corresponding to that league and division, or '' if no such list exists. """ d = ListIdBiMap.LIST_ID_MAP.get(league, {}) if not d: return '' d = d.get(division, {}) if not d: return '' return d.get(age_bracket, '') @staticmethod def GetStructuredPropertiesForList(list_id): """Returns the division, age_bracket, and league for the given list id. Defaults to Division.OPEN, AgeBracket.NO_RESTRICTION, and League.USAU, if the division, age_bracket, or leauge, respectively, does not exist in the map for the given list_id. Args: list_id: ID of list for which to retrieve properties. Returns: (division, age_bracket, league) tuple for the given list ID. """ division = ListIdBiMap.LIST_ID_TO_DIVISION.get(list_id, Division.OPEN) age_bracket = ListIdBiMap.LIST_ID_TO_AGE_BRACKET.get(list_id, AgeBracket.NO_RESTRICTION) league = ListIdBiMap.LIST_ID_TO_LEAGUE.get(list_id, League.USAU) return (division, age_bracket, league)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 15069, 1853, 5780, 33005, 2596, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 198, 198, 6738, 983, 62, 19849, 1330, 3776, 198, 6738, 8198, 62, 37348, 1095, 1330, 7129, 9414, 8317, 198, 6738, 8198, 62, 37348, 1095, 1330, 7458, 198, 6738, 8198, 62, 37348, 1095, 1330, 4041, 628, 198, 4871, 7343, 7390, 23286, 13912, 25, 198, 220, 37227, 27195, 1686, 15968, 285, 39242, 284, 290, 422, 1351, 4686, 290, 20793, 6608, 526, 15931, 628, 220, 1303, 7343, 4522, 17336, 11188, 284, 8341, 5447, 287, 262, 17044, 1848, 286, 198, 220, 1303, 2488, 13822, 259, 62, 1073, 354, 2596, 13, 198, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 796, 705, 1507, 3104, 21139, 1507, 6, 198, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 796, 705, 1507, 3104, 1415, 42980, 6, 198, 220, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 796, 705, 1507, 3134, 33916, 5705, 6, 198, 220, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 796, 705, 1507, 3134, 39195, 3132, 6, 198, 220, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 796, 705, 1507, 3104, 8628, 3510, 6, 198, 220, 41260, 43, 62, 45849, 62, 2389, 796, 705, 1507, 3388, 2075, 28688, 6, 198, 220, 10373, 52, 62, 45849, 62, 2389, 796, 705, 1507, 3388, 2075, 40639, 6, 628, 220, 11096, 62, 43, 1797, 4694, 796, 685, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 41260, 43, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 10373, 52, 62, 45849, 62, 2389, 198, 220, 2361, 628, 220, 1303, 17427, 1366, 4645, 284, 35847, 8341, 611, 262, 4652, 11, 7297, 11, 290, 2479, 198, 220, 1303, 19096, 547, 7368, 287, 262, 2581, 13, 198, 220, 39498, 62, 2389, 62, 33767, 796, 1391, 198, 220, 220, 220, 220, 220, 4041, 13, 14053, 52, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 7458, 13, 3185, 1677, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 25154, 2538, 8264, 25, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 25, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 220, 220, 7458, 13, 54, 2662, 16938, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 25154, 2538, 8264, 25, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 25, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 220, 220, 7458, 13, 8895, 55, 1961, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 25, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 4041, 13, 48877, 43, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 7458, 13, 3185, 1677, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 25, 41260, 43, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 4041, 13, 5805, 52, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 7458, 13, 3185, 1677, 25, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 25, 10373, 52, 62, 45849, 62, 2389, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 8964, 198, 220, 1782, 628, 220, 39498, 62, 2389, 62, 10468, 62, 33569, 42446, 796, 1391, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 7458, 13, 3185, 1677, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 7458, 13, 54, 2662, 16938, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 7458, 13, 3185, 1677, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 7458, 13, 54, 2662, 16938, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 25, 7458, 13, 8895, 55, 1961, 11, 198, 220, 220, 220, 220, 220, 41260, 43, 62, 45849, 62, 2389, 25, 7458, 13, 3185, 1677, 11, 198, 220, 220, 220, 220, 220, 10373, 52, 62, 45849, 62, 2389, 25, 7458, 13, 3185, 1677, 11, 198, 220, 1782, 628, 220, 39498, 62, 2389, 62, 10468, 62, 11879, 62, 11473, 8120, 2767, 796, 1391, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 25154, 2538, 8264, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 25154, 2538, 8264, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 198, 220, 220, 220, 220, 220, 41260, 43, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 198, 220, 220, 220, 220, 220, 10373, 52, 62, 45849, 62, 2389, 25, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 198, 220, 1782, 628, 220, 39498, 62, 2389, 62, 10468, 62, 2538, 4760, 8924, 796, 1391, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 25154, 2538, 8264, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 3185, 1677, 62, 45849, 62, 2389, 25, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 54, 2662, 16938, 62, 45849, 62, 2389, 25, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 220, 220, 4916, 52, 62, 5097, 10526, 62, 8895, 55, 1961, 62, 45849, 62, 2389, 25, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 220, 220, 41260, 43, 62, 45849, 62, 2389, 25, 4041, 13, 48877, 43, 11, 198, 220, 220, 220, 220, 220, 10373, 52, 62, 45849, 62, 2389, 25, 4041, 13, 5805, 52, 11, 198, 220, 1782, 628, 220, 2488, 12708, 24396, 198, 220, 825, 3497, 8053, 7390, 7, 21426, 11, 2479, 62, 1671, 8317, 11, 4652, 2599, 198, 220, 220, 220, 37227, 41102, 510, 262, 1351, 62, 312, 543, 24866, 284, 262, 1813, 7297, 290, 4652, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 7297, 25, 7458, 286, 1393, 198, 220, 220, 220, 220, 220, 2479, 62, 1671, 8317, 25, 7129, 9414, 8317, 286, 1393, 198, 220, 220, 220, 220, 220, 4652, 25, 4041, 286, 1393, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 383, 1351, 4686, 11188, 284, 326, 4652, 290, 7297, 11, 393, 10148, 611, 645, 884, 198, 220, 220, 220, 220, 220, 1351, 7160, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 288, 796, 7343, 7390, 23286, 13912, 13, 45849, 62, 2389, 62, 33767, 13, 1136, 7, 19316, 11, 23884, 8, 198, 220, 220, 220, 611, 407, 288, 25, 198, 220, 220, 220, 220, 220, 1441, 10148, 198, 220, 220, 220, 288, 796, 288, 13, 1136, 7, 21426, 11, 23884, 8, 198, 220, 220, 220, 611, 407, 288, 25, 198, 220, 220, 220, 220, 220, 1441, 10148, 198, 220, 220, 220, 1441, 288, 13, 1136, 7, 496, 62, 1671, 8317, 11, 10148, 8, 628, 220, 2488, 12708, 24396, 198, 220, 825, 3497, 44909, 1522, 2964, 18200, 1890, 8053, 7, 4868, 62, 312, 2599, 198, 220, 220, 220, 37227, 35561, 262, 7297, 11, 2479, 62, 1671, 8317, 11, 290, 4652, 329, 262, 1813, 1351, 4686, 13, 628, 220, 220, 220, 2896, 13185, 284, 7458, 13, 3185, 1677, 11, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 11, 290, 4041, 13, 14053, 52, 11, 198, 220, 220, 220, 611, 262, 7297, 11, 2479, 62, 1671, 8317, 11, 393, 443, 559, 469, 11, 8148, 11, 857, 407, 2152, 287, 198, 220, 220, 220, 262, 3975, 329, 262, 1813, 1351, 62, 312, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1351, 62, 312, 25, 4522, 286, 1351, 329, 543, 284, 19818, 6608, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 357, 21426, 11, 2479, 62, 1671, 8317, 11, 4652, 8, 46545, 329, 262, 1813, 1351, 4522, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 7297, 796, 7343, 7390, 23286, 13912, 13, 45849, 62, 2389, 62, 10468, 62, 33569, 42446, 13, 1136, 7, 4868, 62, 312, 11, 7458, 13, 3185, 1677, 8, 198, 220, 220, 220, 2479, 62, 1671, 8317, 796, 7343, 7390, 23286, 13912, 13, 45849, 62, 2389, 62, 10468, 62, 11879, 62, 11473, 8120, 2767, 13, 1136, 7, 4868, 62, 312, 11, 7129, 9414, 8317, 13, 15285, 62, 19535, 5446, 18379, 2849, 8, 198, 220, 220, 220, 4652, 796, 7343, 7390, 23286, 13912, 13, 45849, 62, 2389, 62, 10468, 62, 2538, 4760, 8924, 13, 1136, 7, 4868, 62, 312, 11, 4041, 13, 14053, 52, 8, 628, 220, 220, 220, 1441, 357, 21426, 11, 2479, 62, 1671, 8317, 11, 4652, 8, 628 ]
2.278214
2,038
from owslib.wms import WebMapService import pyproj from PIL import Image from typing import Tuple, List, Dict, Any import os.path from pathlib import Path FORMAT_ENDINGS = {"image/jpeg": "jpg"}
[ 6738, 12334, 6649, 571, 13, 86, 907, 1330, 5313, 13912, 16177, 198, 11748, 12972, 1676, 73, 198, 6738, 350, 4146, 1330, 7412, 198, 6738, 19720, 1330, 309, 29291, 11, 7343, 11, 360, 713, 11, 4377, 198, 11748, 28686, 13, 6978, 198, 6738, 3108, 8019, 1330, 10644, 628, 198, 21389, 1404, 62, 10619, 20754, 796, 19779, 9060, 14, 73, 22071, 1298, 366, 9479, 20662, 628 ]
3.078125
64
from __future__ import print_function import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials import time from email.mime.text import MIMEText from .models import Email import base64 import email import json import datetime import pytz import re # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/gmail.modify'] creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open('token.json', 'w') as token: token.write(creds.to_json()) service = build('gmail', 'v1', credentials=creds)
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 11748, 28686, 13, 6978, 198, 6738, 23645, 499, 291, 75, 1153, 13, 67, 40821, 1330, 1382, 198, 6738, 23645, 62, 18439, 62, 12162, 1071, 8019, 13, 11125, 1330, 2262, 4262, 4677, 37535, 198, 6738, 23645, 13, 18439, 13, 7645, 634, 13, 8897, 3558, 1330, 19390, 198, 6738, 23645, 13, 12162, 1071, 17, 13, 66, 445, 14817, 1330, 327, 445, 14817, 198, 11748, 640, 198, 198, 6738, 3053, 13, 76, 524, 13, 5239, 1330, 337, 3955, 2767, 2302, 198, 198, 6738, 764, 27530, 1330, 9570, 198, 198, 11748, 2779, 2414, 198, 11748, 3053, 198, 11748, 33918, 198, 11748, 4818, 8079, 198, 11748, 12972, 22877, 198, 11748, 302, 628, 198, 2, 1002, 30620, 777, 629, 13920, 11, 12233, 262, 2393, 11241, 13, 17752, 13, 198, 6173, 3185, 1546, 796, 37250, 5450, 1378, 2503, 13, 13297, 499, 271, 13, 785, 14, 18439, 14, 14816, 13, 4666, 1958, 20520, 628, 198, 66, 445, 82, 796, 6045, 198, 2, 383, 2393, 11241, 13, 17752, 7000, 262, 2836, 338, 1895, 290, 14976, 16326, 11, 290, 318, 198, 2, 2727, 6338, 618, 262, 19601, 5202, 32543, 329, 262, 717, 198, 2, 640, 13, 198, 361, 28686, 13, 6978, 13, 1069, 1023, 10786, 30001, 13, 17752, 6, 2599, 198, 220, 220, 220, 2600, 82, 796, 327, 445, 14817, 13, 6738, 62, 19721, 62, 7220, 62, 7753, 10786, 30001, 13, 17752, 3256, 6374, 3185, 1546, 8, 198, 2, 1002, 612, 389, 645, 357, 12102, 8, 18031, 1695, 11, 1309, 262, 2836, 2604, 287, 13, 198, 361, 407, 2600, 82, 393, 407, 2600, 82, 13, 12102, 25, 198, 220, 220, 220, 611, 2600, 82, 290, 2600, 82, 13, 1069, 6474, 290, 2600, 82, 13, 5420, 3447, 62, 30001, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2600, 82, 13, 5420, 3447, 7, 18453, 28955, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 5202, 796, 2262, 4262, 4677, 37535, 13, 6738, 62, 16366, 62, 2363, 8004, 62, 7753, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 66, 445, 14817, 13, 17752, 3256, 6374, 3185, 1546, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2600, 82, 796, 5202, 13, 5143, 62, 12001, 62, 15388, 7, 634, 28, 15, 8, 198, 220, 220, 220, 1303, 12793, 262, 18031, 329, 262, 1306, 1057, 198, 220, 220, 220, 351, 1280, 10786, 30001, 13, 17752, 3256, 705, 86, 11537, 355, 11241, 25, 198, 220, 220, 220, 220, 220, 220, 220, 11241, 13, 13564, 7, 66, 445, 82, 13, 1462, 62, 17752, 28955, 198, 198, 15271, 796, 1382, 10786, 14816, 3256, 705, 85, 16, 3256, 18031, 28, 66, 445, 82, 8, 628, 198 ]
2.953229
449
# This module is automatically generated by autogen.sh. DO NOT EDIT. from . import _IBM # Aliases
[ 2, 770, 8265, 318, 6338, 7560, 416, 1960, 6644, 13, 1477, 13, 8410, 5626, 48483, 13, 198, 198, 6738, 764, 1330, 4808, 9865, 44, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 198, 2, 12104, 1386, 198 ]
2.97561
41
_base_='../swin/mask_rcnn_swin-t-p4-w7_fpn_1x_coco.py' dataset_type='CocoDataset' prefix='../coco-annotator/datasets/test/' classes=('plasticbottle','alu can','box') # classes=('',) model = dict( roi_head=dict( bbox_head=dict(num_classes=3), mask_head=dict(num_classes=3))) # train_pipeline = [ # dict(type='LoadImageFromFile'), # dict(type='LoadAnnotations', with_bbox=True, with_mask=True), # dict(type='Resize', img_scale=(128,128), keep_ratio=True), # dict(type='RandomFlip', flip_ratio=0.5), # dict(type='Normalize', **img_norm_cfg), # dict(type='Pad', size_divisor=32), # dict(type='DefaultFormatBundle'), # dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']), # # ] # train1=dict( # type=dataset_type, # classes=classes, # ann_file=['data/own/test-1.json'], # img_prefix=prefix, # pipeline=train_pipeline # ) # train2=dict( # type=dataset_type, # classes=classes, # ann_file=['data/own/ann_map_to_1.json'], # img_prefix=prefix, # pipeline=train_pipeline # ) data=dict( train=dict( type=dataset_type, classes=classes, ann_file=['data/own/test-1.json','data/own/ann_map_to_1.json'], img_prefix=prefix ), # train=[train1,train2], val=dict( type=dataset_type, classes=classes, ann_file='data/own/ann_map_to_1.json', img_prefix=prefix ), test=dict( type=dataset_type, classes=classes, ann_file='data/own/ann_map_to_1.json', img_prefix=prefix ) )
[ 62, 8692, 62, 11639, 40720, 2032, 259, 14, 27932, 62, 6015, 20471, 62, 2032, 259, 12, 83, 12, 79, 19, 12, 86, 22, 62, 69, 21999, 62, 16, 87, 62, 66, 25634, 13, 9078, 6, 198, 19608, 292, 316, 62, 4906, 11639, 34, 25634, 27354, 292, 316, 6, 198, 40290, 11639, 40720, 66, 25634, 12, 34574, 1352, 14, 19608, 292, 1039, 14, 9288, 14, 6, 198, 37724, 28, 10786, 489, 3477, 10985, 293, 41707, 282, 84, 460, 41707, 3524, 11537, 198, 2, 6097, 28, 10786, 3256, 8, 198, 19849, 796, 8633, 7, 198, 220, 220, 220, 686, 72, 62, 2256, 28, 11600, 7, 198, 220, 220, 220, 220, 220, 220, 220, 275, 3524, 62, 2256, 28, 11600, 7, 22510, 62, 37724, 28, 18, 828, 198, 220, 220, 220, 220, 220, 220, 220, 9335, 62, 2256, 28, 11600, 7, 22510, 62, 37724, 28, 18, 22305, 198, 198, 2, 4512, 62, 79, 541, 4470, 796, 685, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 8912, 5159, 4863, 8979, 33809, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 8912, 2025, 30078, 3256, 351, 62, 65, 3524, 28, 17821, 11, 351, 62, 27932, 28, 17821, 828, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 4965, 1096, 3256, 33705, 62, 9888, 16193, 12762, 11, 12762, 828, 1394, 62, 10366, 952, 28, 17821, 828, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 29531, 7414, 541, 3256, 14283, 62, 10366, 952, 28, 15, 13, 20, 828, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 26447, 1096, 3256, 12429, 9600, 62, 27237, 62, 37581, 828, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 26114, 3256, 2546, 62, 7146, 271, 273, 28, 2624, 828, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 19463, 26227, 33, 31249, 33809, 198, 2, 220, 220, 220, 220, 8633, 7, 4906, 11639, 31337, 3256, 8251, 28, 17816, 9600, 3256, 705, 13655, 62, 65, 29305, 3256, 705, 13655, 62, 23912, 1424, 3256, 705, 13655, 62, 5356, 591, 20520, 828, 198, 2, 1303, 2361, 198, 2, 4512, 16, 28, 11600, 7, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 19608, 292, 316, 62, 4906, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 6097, 28, 37724, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 1529, 62, 7753, 28, 17816, 7890, 14, 593, 14, 9288, 12, 16, 13, 17752, 6, 4357, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 33705, 62, 40290, 28, 40290, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 11523, 28, 27432, 62, 79, 541, 4470, 198, 2, 220, 220, 220, 220, 1267, 198, 2, 4512, 17, 28, 11600, 7, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 19608, 292, 316, 62, 4906, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 6097, 28, 37724, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 1529, 62, 7753, 28, 17816, 7890, 14, 593, 14, 1236, 62, 8899, 62, 1462, 62, 16, 13, 17752, 6, 4357, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 33705, 62, 40290, 28, 40290, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 11523, 28, 27432, 62, 79, 541, 4470, 198, 2, 220, 220, 220, 220, 1267, 198, 7890, 28, 11600, 7, 198, 220, 220, 220, 4512, 28, 11600, 7, 198, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 19608, 292, 316, 62, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 6097, 28, 37724, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1529, 62, 7753, 28, 17816, 7890, 14, 593, 14, 9288, 12, 16, 13, 17752, 41707, 7890, 14, 593, 14, 1236, 62, 8899, 62, 1462, 62, 16, 13, 17752, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 33705, 62, 40290, 28, 40290, 198, 220, 220, 220, 10612, 198, 220, 220, 220, 1303, 4512, 41888, 27432, 16, 11, 27432, 17, 4357, 198, 220, 220, 220, 1188, 28, 11600, 7, 198, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 19608, 292, 316, 62, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 6097, 28, 37724, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1529, 62, 7753, 11639, 7890, 14, 593, 14, 1236, 62, 8899, 62, 1462, 62, 16, 13, 17752, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 33705, 62, 40290, 28, 40290, 198, 220, 220, 220, 10612, 628, 220, 220, 220, 1332, 28, 11600, 7, 198, 220, 220, 220, 220, 220, 220, 220, 2099, 28, 19608, 292, 316, 62, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 6097, 28, 37724, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1529, 62, 7753, 11639, 7890, 14, 593, 14, 1236, 62, 8899, 62, 1462, 62, 16, 13, 17752, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 33705, 62, 40290, 28, 40290, 198, 220, 220, 220, 1267, 198, 8 ]
1.97343
828
""" Handle MySQL I/O via sqlalchemy engine and ORM """ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from flickipedia.config import schema from flickipedia.config import log, settings class DataIOMySQL(object): """ Class implementing data IO for MySQL. Utilizes sqlalchemy [1]. Database and table schemas will be stored in schema. Modifications to this schema will be persisted with sync [1] http://docs.sqlalchemy.org """ DEFAULTS = { 'dialect': 'mysql', 'driver': '', 'host': 'localhost', 'port': 3306, 'db': settings.__mysql_db__, 'user': settings.__mysql_user__, 'pwrd': settings.__mysql_pass__, } def connect(self, log=False): """ dialect+driver://username:password@host:port/database """ if self.driver: connect_str = '{0}+{1}://{2}:{3}@{4}/{5}'.format( self.dialect, self.driver, self.user, self.pwrd, self.host, self.db, ) else: connect_str = '{0}://{1}:{2}@{3}/{4}'.format( self.dialect, self.user, self.pwrd, self.host, self.db, ) if log: log.info('Establishing connection to "%s://%s@%s/%s"' % ( self.dialect, self.user, self.host, self.db )) self.engine = create_engine(connect_str) self.make_session() def connect_lite(self): """ Use an in-memory db """ self.engine = create_engine('sqlite://') self.make_session() def make_session(self): """ Create a session """ Session = sessionmaker() Session.configure(bind=self.engine) self.sess = Session() @property def create_table(self, obj_name): """ Method for table creation :param name: schema object name :return: boolean indicating status """ if hasattr(schema, obj_name): getattr(schema, obj_name).__table__.create(bind=self.engine) return True else: log.error('Schema object not found for "%s"' % obj_name) return False def drop_table(self, obj_name): """ Method to drop creation :param name: schema object name :return: boolean indicating status """ if hasattr(schema, obj_name): getattr(schema, obj_name).__table__.drop(bind=self.engine) return True else: return False def fetch_all_rows(self, obj_name): """ Method to extract all rows from database. :param name: object to persist :return: row list from table """ obj = getattr(schema, obj_name) return self.session.query(obj, obj.name).all() def fetch_row(self, tbl, col, value): """ Fetch a row by id :param tbl: str, table name :param col: str, column name :param value: *, value on whih to filter """ schema_obj = getattr(schema, tbl) try: return self.session.query(schema_obj).filter( getattr(schema_obj, col) == value) except Exception as e: log.error('Couldn\'t filter row: "%s"' % e.message) return [] def insert(self, obj_name, **kwargs): """ Method to insert rows in database :param name: object to persist :param **kwargs: field values :return: boolean indicating status of action """ if not self.session: log.error('No session') return False try: log.info('Attempting to insert row in schema "%s": "%s"' % ( obj_name, str([key + ':' + str(kwargs[key])[:100] for key in kwargs]))) self.session.add(getattr(schema, obj_name)(**kwargs)) self.session.commit() return True except Exception as e: log.error('Failed to insert row: "%s"' % e.message) return False def delete(self, qry_obj): """ Method to delete rows from database :param qry_obj: object to delete :return: boolean indicating status of action """ if not self.session: log.error('No session') return False try: self.session.delete(qry_obj) self.session.commit() return True except Exception as e: log.error('Failed to delete row "%s": "%s"' % (str(qry_obj), e.message())) return False
[ 37811, 198, 37508, 33476, 314, 14, 46, 2884, 44161, 282, 26599, 3113, 290, 6375, 44, 198, 37811, 198, 198, 6738, 44161, 282, 26599, 1330, 2251, 62, 18392, 198, 6738, 44161, 282, 26599, 13, 579, 1330, 6246, 10297, 198, 6738, 26810, 11151, 13, 11250, 1330, 32815, 198, 198, 6738, 26810, 11151, 13, 11250, 1330, 2604, 11, 6460, 628, 198, 4871, 6060, 40, 2662, 88, 17861, 7, 15252, 2599, 198, 220, 220, 220, 37227, 5016, 15427, 1366, 24418, 329, 33476, 13, 7273, 346, 4340, 44161, 282, 26599, 685, 16, 4083, 628, 220, 220, 220, 24047, 290, 3084, 3897, 5356, 481, 307, 8574, 287, 32815, 13, 220, 3401, 6637, 198, 220, 220, 220, 284, 428, 32815, 481, 307, 33264, 351, 17510, 628, 220, 220, 220, 685, 16, 60, 2638, 1378, 31628, 13, 25410, 282, 26599, 13, 2398, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 5550, 7708, 35342, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 38969, 478, 10354, 705, 28744, 13976, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 26230, 10354, 705, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 4774, 10354, 705, 36750, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 705, 634, 10354, 513, 20548, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 9945, 10354, 6460, 13, 834, 28744, 13976, 62, 9945, 834, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7220, 10354, 6460, 13, 834, 28744, 13976, 62, 7220, 834, 11, 198, 220, 220, 220, 220, 220, 220, 220, 705, 79, 86, 4372, 10354, 6460, 13, 834, 28744, 13976, 62, 6603, 834, 11, 198, 220, 220, 220, 1782, 628, 220, 220, 220, 825, 2018, 7, 944, 11, 2604, 28, 25101, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 23637, 10, 26230, 1378, 29460, 25, 28712, 31, 4774, 25, 634, 14, 48806, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 26230, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2018, 62, 2536, 796, 705, 90, 15, 92, 10, 90, 16, 92, 1378, 90, 17, 92, 29164, 18, 92, 31, 90, 19, 92, 14, 90, 20, 92, 4458, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 38969, 478, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 26230, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 7220, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 79, 86, 4372, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4774, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9945, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2018, 62, 2536, 796, 705, 90, 15, 92, 1378, 90, 16, 92, 29164, 17, 92, 31, 90, 18, 92, 14, 90, 19, 92, 4458, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 38969, 478, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 7220, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 79, 86, 4372, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4774, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9945, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2604, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 10951, 10786, 22362, 17148, 278, 4637, 284, 36521, 82, 1378, 4, 82, 31, 4, 82, 14, 4, 82, 30543, 4064, 357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 38969, 478, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 7220, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4774, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9945, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15306, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 18392, 796, 2251, 62, 18392, 7, 8443, 62, 2536, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 15883, 62, 29891, 3419, 628, 220, 220, 220, 825, 2018, 62, 36890, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 5765, 281, 287, 12, 31673, 20613, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 18392, 796, 2251, 62, 18392, 10786, 25410, 578, 1378, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 15883, 62, 29891, 3419, 628, 220, 220, 220, 825, 787, 62, 29891, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 13610, 257, 6246, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 23575, 796, 6246, 10297, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 23575, 13, 11250, 495, 7, 21653, 28, 944, 13, 18392, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 82, 408, 796, 23575, 3419, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 825, 2251, 62, 11487, 7, 944, 11, 26181, 62, 3672, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 329, 3084, 6282, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1438, 25, 220, 220, 220, 32815, 2134, 1438, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 220, 220, 220, 220, 220, 220, 220, 25131, 12739, 3722, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 468, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 651, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 737, 834, 11487, 834, 13, 17953, 7, 21653, 28, 944, 13, 18392, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 27054, 2611, 2134, 407, 1043, 329, 36521, 82, 30543, 4064, 26181, 62, 3672, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 628, 220, 220, 220, 825, 4268, 62, 11487, 7, 944, 11, 26181, 62, 3672, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 284, 4268, 6282, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1438, 25, 220, 220, 220, 32815, 2134, 1438, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 220, 220, 220, 220, 220, 220, 220, 25131, 12739, 3722, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 468, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 651, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 737, 834, 11487, 834, 13, 14781, 7, 21653, 28, 944, 13, 18392, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 628, 220, 220, 220, 825, 21207, 62, 439, 62, 8516, 7, 944, 11, 26181, 62, 3672, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 284, 7925, 477, 15274, 422, 6831, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1438, 25, 220, 220, 220, 2134, 284, 21160, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 220, 220, 220, 220, 220, 220, 220, 5752, 1351, 422, 3084, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 26181, 796, 651, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 29891, 13, 22766, 7, 26801, 11, 26181, 13, 3672, 737, 439, 3419, 628, 220, 220, 220, 825, 21207, 62, 808, 7, 944, 11, 256, 2436, 11, 951, 11, 1988, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 376, 7569, 257, 5752, 416, 4686, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 256, 2436, 25, 220, 220, 220, 220, 965, 11, 3084, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 951, 25, 220, 220, 220, 220, 965, 11, 5721, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1988, 25, 220, 220, 1635, 11, 1988, 319, 348, 4449, 284, 8106, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 32815, 62, 26801, 796, 651, 35226, 7, 15952, 2611, 11, 256, 2436, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 29891, 13, 22766, 7, 15952, 2611, 62, 26801, 737, 24455, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 651, 35226, 7, 15952, 2611, 62, 26801, 11, 951, 8, 6624, 1988, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 35528, 355, 304, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 23722, 77, 43054, 83, 8106, 5752, 25, 36521, 82, 30543, 4064, 304, 13, 20500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 17635, 628, 220, 220, 220, 825, 7550, 7, 944, 11, 26181, 62, 3672, 11, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 284, 7550, 15274, 287, 6831, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1438, 25, 220, 220, 220, 220, 220, 220, 220, 2134, 284, 21160, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 12429, 46265, 22046, 25, 220, 220, 220, 2214, 3815, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 220, 220, 220, 25131, 12739, 3722, 286, 2223, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 2116, 13, 29891, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 2949, 6246, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 10951, 10786, 37177, 278, 284, 7550, 5752, 287, 32815, 36521, 82, 1298, 36521, 82, 30543, 4064, 357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26181, 62, 3672, 11, 965, 26933, 2539, 1343, 705, 32105, 1343, 220, 965, 7, 46265, 22046, 58, 2539, 12962, 58, 25, 3064, 60, 329, 1994, 287, 479, 86, 22046, 60, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 29891, 13, 2860, 7, 1136, 35226, 7, 15952, 2611, 11, 26181, 62, 3672, 5769, 1174, 46265, 22046, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 29891, 13, 41509, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 35528, 355, 304, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 37, 6255, 284, 7550, 5752, 25, 36521, 82, 30543, 4064, 304, 13, 20500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 628, 220, 220, 220, 825, 12233, 7, 944, 11, 10662, 563, 62, 26801, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 284, 12233, 15274, 422, 6831, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 10662, 563, 62, 26801, 25, 220, 220, 220, 220, 220, 220, 220, 2134, 284, 12233, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 220, 220, 220, 25131, 12739, 3722, 286, 2223, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 2116, 13, 29891, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 2949, 6246, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 198, 220, 220, 220, 220, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 29891, 13, 33678, 7, 80, 563, 62, 26801, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 29891, 13, 41509, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 198, 220, 220, 220, 220, 220, 220, 220, 2845, 35528, 355, 304, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 13, 18224, 10786, 37, 6255, 284, 12233, 5752, 36521, 82, 1298, 36521, 82, 30543, 4064, 357, 2536, 7, 80, 563, 62, 26801, 828, 304, 13, 20500, 3419, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 198 ]
2.028834
2,393
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-21 23:08 from __future__ import unicode_literals from django.db import migrations
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 1157, 13, 20, 319, 2177, 12, 940, 12, 2481, 2242, 25, 2919, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628, 628 ]
2.678571
56
"""Tests for the Patient model."""
[ 37811, 51, 3558, 329, 262, 35550, 2746, 526, 15931, 628 ]
3.6
10
# Python 3.7.9 # pip install clipboard # pip install pywin32 # pip install pyautogui # pip install pynput # Google chrome Keyboard Shortcuts for Google Translate https://chrome.google.com/webstore/detail/keyboard-shortcuts-for-go/akjhnbnjanndggbcegmdggfjjclohjpo # alt+j listen google translate # Google chrome Dark Reader https://chrome.google.com/webstore/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh # Microsoft edge 110% zoom - https://www.phrasereader.com/ # Google chrome 125% zoom - https://translate.google.com/ from clipboard import copy, paste from win32api import SetCursorPos, mouse_event from win32con import MOUSEEVENTF_LEFTDOWN, MOUSEEVENTF_LEFTUP from time import sleep from pyautogui import hotkey from pynput.keyboard import Listener, Key next_x = 612 next_y = 562 prev_x = 359 prev_y = 562 translate_text_x = 1356 translate_text_y = 352 translate_blank_x = 1392 translate_blank_y = 222 text = "" x = [] hasbeencaptured = False last_key = 0 was_pressed_next = False was_pressed_prev = False was_pressed_one = False was_pressed_two = False was_pressed_three = False was_pressed_four = False was_pressed_allwords = False with Listener(on_press=on_press, on_release=on_release) as listener: listener.join()
[ 2, 11361, 513, 13, 22, 13, 24, 198, 198, 2, 7347, 2721, 47999, 198, 2, 7347, 2721, 12972, 5404, 2624, 198, 2, 7347, 2721, 12972, 2306, 519, 9019, 198, 2, 7347, 2721, 279, 2047, 1996, 198, 198, 2, 3012, 32030, 31973, 10073, 23779, 329, 3012, 3602, 17660, 3740, 1378, 46659, 13, 13297, 13, 785, 14, 12384, 8095, 14, 49170, 14, 2539, 3526, 12, 19509, 23779, 12, 1640, 12, 2188, 14, 461, 73, 21116, 9374, 13881, 358, 1130, 65, 344, 70, 9132, 1130, 69, 41098, 565, 1219, 73, 7501, 198, 2, 5988, 10, 73, 6004, 23645, 15772, 198, 2, 3012, 32030, 3801, 25342, 3740, 1378, 46659, 13, 13297, 13, 785, 14, 12384, 8095, 14, 49170, 14, 21953, 12, 46862, 14, 68, 320, 324, 79, 15630, 19881, 77, 2022, 74, 404, 2238, 73, 69, 988, 21116, 14636, 9945, 494, 17231, 198, 2, 5413, 5743, 9796, 4, 19792, 532, 3740, 1378, 2503, 13, 746, 8847, 567, 5067, 13, 785, 14, 198, 2, 3012, 32030, 13151, 4, 19792, 532, 3740, 1378, 7645, 17660, 13, 13297, 13, 785, 14, 198, 198, 6738, 47999, 1330, 4866, 11, 17008, 198, 6738, 1592, 2624, 15042, 1330, 5345, 34, 21471, 21604, 11, 10211, 62, 15596, 198, 6738, 1592, 2624, 1102, 1330, 337, 2606, 5188, 20114, 3525, 37, 62, 2538, 9792, 41925, 11, 337, 2606, 5188, 20114, 3525, 37, 62, 2538, 9792, 8577, 198, 6738, 640, 1330, 3993, 198, 6738, 12972, 2306, 519, 9019, 1330, 3024, 2539, 198, 6738, 279, 2047, 1996, 13, 2539, 3526, 1330, 7343, 877, 11, 7383, 198, 198, 19545, 62, 87, 796, 718, 1065, 198, 19545, 62, 88, 796, 642, 5237, 198, 198, 47050, 62, 87, 796, 41934, 198, 47050, 62, 88, 796, 642, 5237, 198, 198, 7645, 17660, 62, 5239, 62, 87, 796, 1511, 3980, 198, 7645, 17660, 62, 5239, 62, 88, 796, 44063, 198, 198, 7645, 17660, 62, 27190, 62, 87, 796, 1511, 5892, 198, 7645, 17660, 62, 27190, 62, 88, 796, 27795, 198, 198, 5239, 796, 13538, 198, 87, 796, 17635, 198, 10134, 1350, 12685, 2373, 1522, 796, 10352, 198, 12957, 62, 2539, 796, 657, 198, 198, 9776, 62, 45477, 62, 19545, 796, 10352, 198, 9776, 62, 45477, 62, 47050, 796, 10352, 198, 198, 9776, 62, 45477, 62, 505, 796, 10352, 198, 9776, 62, 45477, 62, 11545, 796, 10352, 198, 9776, 62, 45477, 62, 15542, 796, 10352, 198, 9776, 62, 45477, 62, 14337, 796, 10352, 198, 9776, 62, 45477, 62, 439, 10879, 796, 10352, 628, 628, 628, 628, 198, 198, 4480, 7343, 877, 7, 261, 62, 8439, 28, 261, 62, 8439, 11, 319, 62, 20979, 28, 261, 62, 20979, 8, 355, 24783, 25, 198, 220, 220, 220, 24783, 13, 22179, 3419, 198 ]
2.851936
439
# -*- coding: UTF-8 -*- # # Given a linked list, swap every two adjacent nodes and return its head. # # For example, # Given 1->2->3->4, you should return the list as 2->1->4->3. # # Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed. # # Python, Python3 all accepted.
[ 2, 532, 9, 12, 19617, 25, 41002, 12, 23, 532, 9, 12, 198, 2, 198, 2, 11259, 257, 6692, 1351, 11, 16075, 790, 734, 15909, 13760, 290, 1441, 663, 1182, 13, 198, 2, 198, 2, 1114, 1672, 11, 198, 2, 11259, 352, 3784, 17, 3784, 18, 3784, 19, 11, 345, 815, 1441, 262, 1351, 355, 362, 3784, 16, 3784, 19, 3784, 18, 13, 198, 2, 198, 2, 3406, 11862, 815, 779, 691, 6937, 2272, 13, 921, 743, 407, 13096, 262, 3815, 287, 262, 1351, 11, 691, 13760, 2346, 460, 307, 3421, 13, 198, 2, 198, 2, 11361, 11, 11361, 18, 477, 6292, 13, 628, 198 ]
3.266667
105
from unittest.case import TestCase from probability.discrete import Discrete, Conditional
[ 6738, 555, 715, 395, 13, 7442, 1330, 6208, 20448, 198, 198, 6738, 12867, 13, 15410, 8374, 1330, 8444, 8374, 11, 9724, 1859, 628 ]
4
23
"""Adversarial Variational Bayes (AVB). Adversarial Variational Bayes: Unifying Variational Autoencoders and Generative Adversarial Networks http://arxiv.org/abs/1701.04722 Ref) https://github.com/gdikov/adversarial-variational-bayes http://seiya-kumada.blogspot.com/2018/07/adversarial-variational-bayes.html https://github.com/LMescheder/AdversarialVariationalBayes https://nbviewer.jupyter.org/github/hayashiyus/Thermal-VAE/blob/master/adversarial%20variational%20bayes%20toy%20example-cyclical-annealing-MNIST-898-4000.ipynb """ from typing import Dict, Iterator, Optional, Tuple import torch from torch import Tensor, nn from .base import BaseVAE, nll_bernoulli class Encoder(nn.Module): """Encoder q(z|x, e). Args: in_channels (int): Channel size of inputs. z_dim (int): Dimension size of latents. e_dim (int): Dimension size of noises. """ def forward(self, x: Tensor, e: Tensor) -> Tensor: """Encodes z given x, e. Args: x (torch.Tensor): Observations, size `(b, c, h, w)`. e (torch.Tensor): Noises, size `(b, e)`. Returns: z (torch.Tensor): Encoded latents, size `(b, z)`. """ h_x = self.conv(x) h_x = h_x.view(-1, 1024) h_x = self.fc_x(h_x) h_e = self.fc_e(e) z = self.fc(torch.cat([h_x, h_e], dim=1)) return z class Decoder(nn.Module): """Decoder p(x|z). Args: in_channels (int): Channel size of inputs. z_dim (int): Dimension size of latents. """ def forward(self, z: Tensor) -> Tensor: """Encodes z given x. Args: z (torch.Tensor): Latents, size `(b, z)`. Returns: probs (torch.Tensor): Decoded observations, size `(b, c, h, w)`. """ h = self.fc(z) h = h.view(-1, 64, 4, 4) probs = self.deconv(h) return probs class Discriminator(nn.Module): """Discriminator T(x, z). Args: in_channels (int): Channel size of inputs. z_dim (int): Dimension size of latents. """ def forward(self, x: Tensor, z: Tensor) -> Tensor: """Discriminate p(x)p(z) from p(x)q(z|x). Args: x (torch.Tensor): Observations, size `(b, c, h, w)`. z (torch.Tensor): Latents, size `(b, z)`. Returns: logits (torch.Tensor): Logits, size `(b, 1)`. """ h_x = self.disc_x(x) h_x = self.fc_x(h_x.view(-1, 1024)) h_z = self.disc_z(z) logits = self.fc(torch.cat([h_x, h_z], dim=1)) return logits class AVB(BaseVAE): """Adversarial Variational Bayes. Args: in_channels (int, optional): Channel size of inputs. z_dim (int, optional): Dimension size of latents. e_dim (int, optional): Dimension size of noises. """
[ 37811, 2782, 690, 36098, 15965, 864, 4696, 274, 357, 10116, 33, 737, 198, 198, 2782, 690, 36098, 15965, 864, 4696, 274, 25, 791, 4035, 15965, 864, 5231, 6571, 19815, 364, 290, 2980, 876, 198, 2782, 690, 36098, 27862, 198, 4023, 1378, 283, 87, 452, 13, 2398, 14, 8937, 14, 1558, 486, 13, 48000, 1828, 198, 198, 8134, 8, 198, 5450, 1378, 12567, 13, 785, 14, 21287, 1134, 709, 14, 324, 690, 36098, 12, 25641, 864, 12, 24406, 274, 198, 4023, 1378, 325, 21008, 12, 74, 388, 4763, 13, 35217, 13, 785, 14, 7908, 14, 2998, 14, 324, 690, 36098, 12, 25641, 864, 12, 24406, 274, 13, 6494, 198, 5450, 1378, 12567, 13, 785, 14, 31288, 274, 1740, 263, 14, 2782, 690, 36098, 23907, 864, 15262, 274, 198, 5450, 1378, 46803, 1177, 263, 13, 73, 929, 88, 353, 13, 2398, 14, 12567, 14, 71, 323, 1077, 7745, 385, 14, 35048, 7617, 12, 11731, 36, 14, 2436, 672, 14, 9866, 14, 324, 690, 36098, 4, 1238, 25641, 864, 4, 1238, 24406, 274, 4, 1238, 83, 726, 4, 1238, 20688, 12, 15539, 605, 12, 21952, 4272, 12, 39764, 8808, 12, 23, 4089, 12, 27559, 13, 541, 2047, 65, 198, 37811, 198, 198, 6738, 19720, 1330, 360, 713, 11, 40806, 1352, 11, 32233, 11, 309, 29291, 198, 198, 11748, 28034, 198, 6738, 28034, 1330, 309, 22854, 11, 299, 77, 198, 198, 6738, 764, 8692, 1330, 7308, 11731, 36, 11, 299, 297, 62, 33900, 280, 15516, 628, 198, 4871, 14711, 12342, 7, 20471, 13, 26796, 2599, 198, 220, 220, 220, 37227, 27195, 12342, 10662, 7, 89, 91, 87, 11, 304, 737, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 287, 62, 354, 8961, 357, 600, 2599, 11102, 2546, 286, 17311, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1976, 62, 27740, 357, 600, 2599, 34024, 2546, 286, 3042, 658, 13, 198, 220, 220, 220, 220, 220, 220, 220, 304, 62, 27740, 357, 600, 2599, 34024, 2546, 286, 26782, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 2651, 7, 944, 11, 2124, 25, 309, 22854, 11, 304, 25, 309, 22854, 8, 4613, 309, 22854, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 27195, 4147, 1976, 1813, 2124, 11, 304, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 357, 13165, 354, 13, 51, 22854, 2599, 19243, 602, 11, 2546, 4600, 7, 65, 11, 269, 11, 289, 11, 266, 8, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 304, 357, 13165, 354, 13, 51, 22854, 2599, 1400, 2696, 11, 2546, 4600, 7, 65, 11, 304, 8, 44646, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 357, 13165, 354, 13, 51, 22854, 2599, 14711, 9043, 3042, 658, 11, 2546, 4600, 7, 65, 11, 1976, 8, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 289, 62, 87, 796, 2116, 13, 42946, 7, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 289, 62, 87, 796, 289, 62, 87, 13, 1177, 32590, 16, 11, 28119, 8, 198, 220, 220, 220, 220, 220, 220, 220, 289, 62, 87, 796, 2116, 13, 16072, 62, 87, 7, 71, 62, 87, 8, 628, 220, 220, 220, 220, 220, 220, 220, 289, 62, 68, 796, 2116, 13, 16072, 62, 68, 7, 68, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1976, 796, 2116, 13, 16072, 7, 13165, 354, 13, 9246, 26933, 71, 62, 87, 11, 289, 62, 68, 4357, 5391, 28, 16, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 1976, 628, 198, 4871, 34580, 7, 20471, 13, 26796, 2599, 198, 220, 220, 220, 37227, 10707, 12342, 279, 7, 87, 91, 89, 737, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 287, 62, 354, 8961, 357, 600, 2599, 11102, 2546, 286, 17311, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1976, 62, 27740, 357, 600, 2599, 34024, 2546, 286, 3042, 658, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 2651, 7, 944, 11, 1976, 25, 309, 22854, 8, 4613, 309, 22854, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 27195, 4147, 1976, 1813, 2124, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 357, 13165, 354, 13, 51, 22854, 2599, 5476, 658, 11, 2546, 4600, 7, 65, 11, 1976, 8, 44646, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 386, 1443, 357, 13165, 354, 13, 51, 22854, 2599, 4280, 9043, 13050, 11, 2546, 4600, 7, 65, 11, 269, 11, 289, 11, 266, 8, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 289, 796, 2116, 13, 16072, 7, 89, 8, 198, 220, 220, 220, 220, 220, 220, 220, 289, 796, 289, 13, 1177, 32590, 16, 11, 5598, 11, 604, 11, 604, 8, 198, 220, 220, 220, 220, 220, 220, 220, 386, 1443, 796, 2116, 13, 12501, 261, 85, 7, 71, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 386, 1443, 628, 198, 4871, 8444, 3036, 20900, 7, 20471, 13, 26796, 2599, 198, 220, 220, 220, 37227, 15642, 3036, 20900, 309, 7, 87, 11, 1976, 737, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 287, 62, 354, 8961, 357, 600, 2599, 11102, 2546, 286, 17311, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1976, 62, 27740, 357, 600, 2599, 34024, 2546, 286, 3042, 658, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 2651, 7, 944, 11, 2124, 25, 309, 22854, 11, 1976, 25, 309, 22854, 8, 4613, 309, 22854, 25, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 15642, 3036, 4559, 279, 7, 87, 8, 79, 7, 89, 8, 422, 279, 7, 87, 8, 80, 7, 89, 91, 87, 737, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 357, 13165, 354, 13, 51, 22854, 2599, 19243, 602, 11, 2546, 4600, 7, 65, 11, 269, 11, 289, 11, 266, 8, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 357, 13165, 354, 13, 51, 22854, 2599, 5476, 658, 11, 2546, 4600, 7, 65, 11, 1976, 8, 44646, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2604, 896, 357, 13165, 354, 13, 51, 22854, 2599, 5972, 896, 11, 2546, 4600, 7, 65, 11, 352, 8, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 289, 62, 87, 796, 2116, 13, 15410, 62, 87, 7, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 289, 62, 87, 796, 2116, 13, 16072, 62, 87, 7, 71, 62, 87, 13, 1177, 32590, 16, 11, 28119, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 289, 62, 89, 796, 2116, 13, 15410, 62, 89, 7, 89, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2604, 896, 796, 2116, 13, 16072, 7, 13165, 354, 13, 9246, 26933, 71, 62, 87, 11, 289, 62, 89, 4357, 5391, 28, 16, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 1441, 2604, 896, 628, 198, 4871, 14661, 33, 7, 14881, 11731, 36, 2599, 198, 220, 220, 220, 37227, 2782, 690, 36098, 15965, 864, 4696, 274, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 287, 62, 354, 8961, 357, 600, 11, 11902, 2599, 11102, 2546, 286, 17311, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1976, 62, 27740, 357, 600, 11, 11902, 2599, 34024, 2546, 286, 3042, 658, 13, 198, 220, 220, 220, 220, 220, 220, 220, 304, 62, 27740, 357, 600, 11, 11902, 2599, 34024, 2546, 286, 26782, 13, 198, 220, 220, 220, 37227, 198 ]
2.088857
1,373
from pytest_httpx import HTTPXMock import httpx_auth from tests.auth_helper import get_header
[ 6738, 12972, 9288, 62, 4023, 87, 1330, 14626, 37643, 735, 198, 198, 11748, 2638, 87, 62, 18439, 198, 6738, 5254, 13, 18439, 62, 2978, 525, 1330, 651, 62, 25677, 628 ]
3.2
30
#!/usr/bin/env python3 import argparse import sys import os # This key table has to match the one in bootloader keyTbl = [0xDEADBEEF, 0xAAAAAAAA, 0x11111111, 0x00000000, 0xFFFFFFFF, 0x55555555, 0xA5A5A5A5, 0x66666666] #****************************************************************************** # # Main function # #****************************************************************************** #****************************************************************************** # # Turn a 32-bit number into a series of bytes for transmission. # # This command will split a 32-bit integer into an array of bytes, ordered # LSB-first for transmission over the UART. # #****************************************************************************** #****************************************************************************** # # Extract a word from a byte array # #****************************************************************************** #****************************************************************************** # # CRC function that matches the CRC used by the Apollo bootloader. # #****************************************************************************** poly32 = 0x1EDC6F41 #****************************************************************************** # # Main program flow # #****************************************************************************** if __name__ == '__main__': parser = argparse.ArgumentParser(description = 'Secure Image generation utility for Apollo or Apollo2') parser.add_argument('binfile', help = 'Binary file to program into the target device') parser.add_argument('keyidxVal', default=0, type=int, help = 'encryption key index') parser.add_argument('protectionVal', default=0, help = 'Image Protection Value (hex)') parser.add_argument('encimagefile', help = 'Destination file for Encrypted image') parser.add_argument('sectrailerfile', help = 'Destination file for security trailer') args = parser.parse_args() main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 1822, 29572, 198, 11748, 25064, 198, 11748, 28686, 198, 198, 2, 770, 1994, 3084, 468, 284, 2872, 262, 530, 287, 6297, 29356, 198, 2539, 51, 2436, 796, 685, 15, 87, 7206, 2885, 33, 6500, 37, 11, 657, 87, 43488, 11, 657, 87, 26259, 26259, 11, 657, 87, 8269, 11, 657, 87, 29312, 29312, 11, 657, 87, 2816, 2816, 2816, 2816, 11, 657, 87, 32, 20, 32, 20, 32, 20, 32, 20, 11, 657, 87, 41977, 60, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 8774, 2163, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 6756, 257, 3933, 12, 2545, 1271, 656, 257, 2168, 286, 9881, 329, 11478, 13, 198, 2, 198, 2, 770, 3141, 481, 6626, 257, 3933, 12, 2545, 18253, 656, 281, 7177, 286, 9881, 11, 6149, 198, 2, 406, 16811, 12, 11085, 329, 11478, 625, 262, 471, 7227, 13, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 29677, 257, 1573, 422, 257, 18022, 7177, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 45623, 2163, 326, 7466, 262, 45623, 973, 416, 262, 17508, 6297, 29356, 13, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 35428, 2624, 796, 657, 87, 16, 1961, 34, 21, 37, 3901, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 8774, 1430, 5202, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 628, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 11213, 796, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 49793, 7412, 5270, 10361, 329, 17508, 393, 17508, 17, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 8800, 7753, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 796, 705, 33, 3219, 2393, 284, 1430, 656, 262, 2496, 3335, 11537, 628, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 2539, 312, 87, 7762, 3256, 4277, 28, 15, 11, 2099, 28, 600, 11, 1037, 796, 705, 12685, 13168, 1994, 6376, 11537, 198, 220, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 42846, 7762, 3256, 4277, 28, 15, 11, 1037, 796, 705, 5159, 9985, 11052, 357, 33095, 8, 11537, 628, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 12685, 9060, 7753, 3256, 1037, 796, 705, 24159, 1883, 2393, 329, 14711, 15109, 2939, 11537, 628, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 8831, 430, 5329, 7753, 3256, 1037, 796, 705, 24159, 1883, 2393, 329, 2324, 12268, 11537, 628, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 220, 220, 220, 1388, 3419, 198 ]
4.005769
520
from django.views.generic import TemplateView from django.views.decorators.cache import never_cache from django.db.models import Count, Sum from django.db.models.functions import Coalesce from backend.api.models import Profile, ProfileDisplayFields, PostAggregateFields from django.http import JsonResponse from django.http import HttpRequest # Serve Vue Application index_view = never_cache(TemplateView.as_view(template_name="index.html")) def profiles(request: HttpRequest) -> JsonResponse: """ Data about profiles and their posts :param request: Request from the client :return: JsonResponse containing a list of dictionaries that represent profiles and their posts. EX: [ { "name": "lifeoftanyamarie", "thumbnail": "thumbnail.com", "followers": 90900, "post_count": 2, "likes": 4310 },... ] """ fields = [ display.value for display in [*ProfileDisplayFields, *PostAggregateFields] ] profiles_qs = ( Profile.objects.all() .annotate( post_count=Coalesce(Count("post"), 0), likes=Coalesce(Sum("post__likes"), 0), ) .values(*fields) ) return JsonResponse(list(profiles_qs), safe=False)
[ 6738, 42625, 14208, 13, 33571, 13, 41357, 1330, 37350, 7680, 198, 6738, 42625, 14208, 13, 33571, 13, 12501, 273, 2024, 13, 23870, 1330, 1239, 62, 23870, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 1330, 2764, 11, 5060, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 13, 12543, 2733, 1330, 1766, 2040, 344, 198, 6738, 30203, 13, 15042, 13, 27530, 1330, 13118, 11, 13118, 23114, 15878, 82, 11, 2947, 46384, 49373, 15878, 82, 198, 6738, 42625, 14208, 13, 4023, 1330, 449, 1559, 31077, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 18453, 198, 198, 2, 35557, 569, 518, 15678, 198, 9630, 62, 1177, 796, 1239, 62, 23870, 7, 30800, 7680, 13, 292, 62, 1177, 7, 28243, 62, 3672, 2625, 9630, 13, 6494, 48774, 628, 198, 4299, 16545, 7, 25927, 25, 367, 29281, 18453, 8, 4613, 449, 1559, 31077, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 6060, 546, 16545, 290, 511, 6851, 198, 220, 220, 220, 1058, 17143, 2581, 25, 19390, 422, 262, 5456, 198, 220, 220, 220, 1058, 7783, 25, 449, 1559, 31077, 7268, 257, 1351, 286, 48589, 3166, 326, 198, 220, 220, 220, 2380, 16545, 290, 511, 6851, 13, 628, 220, 220, 220, 7788, 25, 198, 220, 220, 220, 220, 220, 220, 220, 685, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 3672, 1298, 366, 6042, 11205, 1092, 39236, 494, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 400, 20566, 1298, 366, 400, 20566, 13, 785, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 27780, 364, 1298, 860, 2931, 405, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 7353, 62, 9127, 1298, 362, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 75, 7938, 1298, 5946, 940, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8964, 986, 198, 220, 220, 220, 220, 220, 220, 220, 2361, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 7032, 796, 685, 198, 220, 220, 220, 220, 220, 220, 220, 3359, 13, 8367, 329, 3359, 287, 30138, 37046, 23114, 15878, 82, 11, 1635, 6307, 46384, 49373, 15878, 82, 60, 198, 220, 220, 220, 2361, 198, 220, 220, 220, 16545, 62, 48382, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 13118, 13, 48205, 13, 439, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 764, 34574, 378, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1281, 62, 9127, 28, 7222, 2040, 344, 7, 12332, 7203, 7353, 12340, 657, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7832, 28, 7222, 2040, 344, 7, 13065, 7203, 7353, 834, 75, 7938, 12340, 657, 828, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 764, 27160, 46491, 25747, 8, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 1441, 449, 1559, 31077, 7, 4868, 7, 5577, 2915, 62, 48382, 828, 3338, 28, 25101, 8, 198 ]
2.477186
526
# # Created on Wed Nov 18 2020 # # Copyright (c) 2020 - Simon Prast # import os import uuid from django.conf import settings from django.db import models from user.models import User
[ 2, 198, 2, 15622, 319, 3300, 5267, 1248, 12131, 198, 2, 198, 2, 15069, 357, 66, 8, 12131, 532, 11288, 1736, 459, 198, 2, 628, 198, 11748, 28686, 198, 11748, 334, 27112, 198, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 198, 6738, 2836, 13, 27530, 1330, 11787, 628, 628, 198 ]
3.183333
60
p1 = People("Maria", 1999) print(p1.name) print(p1.birthYear) print(p1.age) p1.pillar = "Architecture and Sustainable Design (ASD)" print(f"{p1.name} is {p1.age} years old, and she is majored in {p1.pillar}")
[ 198, 198, 79, 16, 796, 4380, 7203, 46827, 1600, 7358, 8, 198, 4798, 7, 79, 16, 13, 3672, 8, 198, 4798, 7, 79, 16, 13, 24280, 17688, 8, 198, 4798, 7, 79, 16, 13, 496, 8, 198, 198, 79, 16, 13, 41643, 796, 366, 19895, 5712, 495, 290, 45276, 8495, 357, 1921, 35, 16725, 198, 198, 4798, 7, 69, 1, 90, 79, 16, 13, 3672, 92, 318, 1391, 79, 16, 13, 496, 92, 812, 1468, 11, 290, 673, 318, 16486, 1850, 287, 1391, 79, 16, 13, 41643, 92, 4943, 198 ]
2.366667
90
#!/usr/bin/env python # -*- coding: utf-8 -*- """Perform a functional test of the list command.""" import os import orion.core.cli def test_no_exp(monkeypatch, clean_db, capsys): """Test that nothing is printed when there are no experiments.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == "" def test_single_exp(clean_db, one_experiment, capsys): """Test that the name of the experiment is printed when there is one experiment.""" orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == " test_single_exp-v1\n" def test_no_version_backward_compatible(clean_db, one_experiment_no_version, capsys): """Test status with no experiments.""" orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == " test_single_exp-no-version-v1\n" def test_broken_refers(clean_db, broken_refers, capsys): """Test that experiment without refers dict can be handled properly.""" orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == " test_single_exp-v1\n" def test_two_exp(capsys, clean_db, two_experiments): """Test that experiment and child are printed.""" orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == """\ test_double_exp-v1┐ └test_double_exp_child-v1 """ def test_three_exp(capsys, clean_db, three_experiments): """Test that experiment, child and grand-child are printed.""" orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == """\ test_double_exp-v1┐ └test_double_exp_child-v1 test_single_exp-v1 """ def test_no_exp_name(clean_db, three_experiments, monkeypatch, capsys): """Test that nothing is printed when there are no experiments with a given name.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list', '--name', 'I don\'t exist']) captured = capsys.readouterr().out assert captured == "" def test_exp_name(clean_db, three_experiments, monkeypatch, capsys): """Test that only the specified experiment is printed.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list', '--name', 'test_single_exp']) captured = capsys.readouterr().out assert captured == " test_single_exp-v1\n" def test_exp_name_with_child(clean_db, three_experiments, monkeypatch, capsys): """Test that only the specified experiment is printed, and with its child.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list', '--name', 'test_double_exp']) captured = capsys.readouterr().out assert captured == """\ test_double_exp-v1┐ └test_double_exp_child-v1 """ def test_exp_name_child(clean_db, three_experiments, monkeypatch, capsys): """Test that only the specified child experiment is printed.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list', '--name', 'test_double_exp_child']) captured = capsys.readouterr().out assert captured == " test_double_exp_child-v1\n" def test_exp_same_name(clean_db, two_experiments_same_name, monkeypatch, capsys): """Test that two experiments with the same name and different versions are correctly printed.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == """\ test_single_exp-v1┐ └test_single_exp-v2 """ def test_exp_family_same_name(clean_db, three_experiments_family_same_name, monkeypatch, capsys): """Test that two experiments with the same name and different versions are correctly printed even when one of them has a child. """ monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == """\ ┌test_single_exp-v2 test_single_exp-v1┤ └test_single_exp_child-v1 """ def test_exp_family_branch_same_name(clean_db, three_experiments_branch_same_name, monkeypatch, capsys): """Test that two experiments with the same name and different versions are correctly printed even when last one has a child. """ monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli.main(['list']) captured = capsys.readouterr().out assert captured == """\ test_single_exp-v1┐ └test_single_exp-v2┐ └test_single_exp_child-v1 """
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 5990, 687, 257, 10345, 1332, 286, 262, 1351, 3141, 526, 15931, 198, 11748, 28686, 198, 198, 11748, 393, 295, 13, 7295, 13, 44506, 628, 198, 4299, 1332, 62, 3919, 62, 11201, 7, 49572, 17147, 11, 3424, 62, 9945, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 2147, 318, 10398, 618, 612, 389, 645, 10256, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 13538, 628, 198, 4299, 1332, 62, 29762, 62, 11201, 7, 27773, 62, 9945, 11, 530, 62, 23100, 3681, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 262, 1438, 286, 262, 6306, 318, 10398, 618, 612, 318, 530, 6306, 526, 15931, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 366, 1332, 62, 29762, 62, 11201, 12, 85, 16, 59, 77, 1, 628, 198, 4299, 1332, 62, 3919, 62, 9641, 62, 1891, 904, 62, 38532, 7, 27773, 62, 9945, 11, 530, 62, 23100, 3681, 62, 3919, 62, 9641, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 3722, 351, 645, 10256, 526, 15931, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 366, 1332, 62, 29762, 62, 11201, 12, 3919, 12, 9641, 12, 85, 16, 59, 77, 1, 628, 198, 4299, 1332, 62, 25826, 62, 5420, 364, 7, 27773, 62, 9945, 11, 5445, 62, 5420, 364, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 6306, 1231, 10229, 8633, 460, 307, 12118, 6105, 526, 15931, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 366, 1332, 62, 29762, 62, 11201, 12, 85, 16, 59, 77, 1, 628, 198, 4299, 1332, 62, 11545, 62, 11201, 7, 27979, 893, 11, 3424, 62, 9945, 11, 734, 62, 23100, 6800, 2599, 198, 220, 220, 220, 37227, 14402, 326, 6306, 290, 1200, 389, 10398, 526, 15931, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 1332, 62, 23352, 62, 11201, 12, 85, 16, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 23352, 62, 11201, 62, 9410, 12, 85, 16, 198, 37811, 628, 198, 4299, 1332, 62, 15542, 62, 11201, 7, 27979, 893, 11, 3424, 62, 9945, 11, 1115, 62, 23100, 6800, 2599, 198, 220, 220, 220, 37227, 14402, 326, 6306, 11, 1200, 220, 290, 4490, 12, 9410, 389, 10398, 526, 15931, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 1332, 62, 23352, 62, 11201, 12, 85, 16, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 23352, 62, 11201, 62, 9410, 12, 85, 16, 198, 1332, 62, 29762, 62, 11201, 12, 85, 16, 198, 37811, 628, 198, 4299, 1332, 62, 3919, 62, 11201, 62, 3672, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 2147, 318, 10398, 618, 612, 389, 645, 10256, 351, 257, 1813, 1438, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 3256, 705, 438, 3672, 3256, 705, 40, 836, 43054, 83, 2152, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 13538, 628, 198, 4299, 1332, 62, 11201, 62, 3672, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 691, 262, 7368, 6306, 318, 10398, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 3256, 705, 438, 3672, 3256, 705, 9288, 62, 29762, 62, 11201, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 366, 1332, 62, 29762, 62, 11201, 12, 85, 16, 59, 77, 1, 628, 198, 4299, 1332, 62, 11201, 62, 3672, 62, 4480, 62, 9410, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 691, 262, 7368, 6306, 318, 10398, 11, 290, 351, 663, 1200, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 3256, 705, 438, 3672, 3256, 705, 9288, 62, 23352, 62, 11201, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 1332, 62, 23352, 62, 11201, 12, 85, 16, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 23352, 62, 11201, 62, 9410, 12, 85, 16, 198, 37811, 628, 198, 4299, 1332, 62, 11201, 62, 3672, 62, 9410, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 691, 262, 7368, 1200, 6306, 318, 10398, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 3256, 705, 438, 3672, 3256, 705, 9288, 62, 23352, 62, 11201, 62, 9410, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 366, 1332, 62, 23352, 62, 11201, 62, 9410, 12, 85, 16, 59, 77, 1, 628, 198, 4299, 1332, 62, 11201, 62, 31642, 62, 3672, 7, 27773, 62, 9945, 11, 734, 62, 23100, 6800, 62, 31642, 62, 3672, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 734, 10256, 351, 262, 976, 1438, 290, 1180, 6300, 389, 9380, 10398, 526, 15931, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 1332, 62, 29762, 62, 11201, 12, 85, 16, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 29762, 62, 11201, 12, 85, 17, 198, 37811, 628, 198, 4299, 1332, 62, 11201, 62, 17989, 62, 31642, 62, 3672, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 62, 17989, 62, 31642, 62, 3672, 11, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 734, 10256, 351, 262, 976, 1438, 290, 1180, 6300, 389, 9380, 10398, 198, 220, 220, 220, 772, 618, 530, 286, 606, 468, 257, 1200, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 234, 9288, 62, 29762, 62, 11201, 12, 85, 17, 198, 1332, 62, 29762, 62, 11201, 12, 85, 16, 6552, 97, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 29762, 62, 11201, 62, 9410, 12, 85, 16, 198, 37811, 628, 198, 4299, 1332, 62, 11201, 62, 17989, 62, 1671, 3702, 62, 31642, 62, 3672, 7, 27773, 62, 9945, 11, 1115, 62, 23100, 6800, 62, 1671, 3702, 62, 31642, 62, 3672, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21657, 17147, 11, 11022, 893, 2599, 198, 220, 220, 220, 37227, 14402, 326, 734, 10256, 351, 262, 976, 1438, 290, 1180, 6300, 389, 9380, 10398, 198, 220, 220, 220, 772, 618, 938, 530, 468, 257, 1200, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 21657, 17147, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 220, 220, 220, 393, 295, 13, 7295, 13, 44506, 13, 12417, 7, 17816, 4868, 6, 12962, 628, 220, 220, 220, 7907, 796, 11022, 893, 13, 961, 39605, 81, 22446, 448, 628, 220, 220, 220, 6818, 7907, 6624, 37227, 59, 198, 1332, 62, 29762, 62, 11201, 12, 85, 16, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 29762, 62, 11201, 12, 85, 17, 6552, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13305, 242, 9288, 62, 29762, 62, 11201, 62, 9410, 12, 85, 16, 198, 37811, 198 ]
2.559429
1,893
from rest_framework import serializers from .models import Teacher,Timetable,Klass,Pupil,Cabinet,Subject, Grade class TeacherSerializer(serializers.ModelSerializer): """Список учителей""" class TeacherAddSerializer(serializers.ModelSerializer): """Добавление учителя""" class PupilSerializer(serializers.ModelSerializer): """Список учеников""" class GradeCreateSerializer(serializers.ModelSerializer): """Добавление оценки""" class GradeSerializer(serializers.ModelSerializer): """Вывод оценок""" subject = serializers.SlugRelatedField(slug_field="subject", read_only=True) class PupilDetailSerializer(serializers.ModelSerializer): """Досье ученика""" klass = serializers.SlugRelatedField(slug_field = "number", read_only=True) grades = GradeSerializer(many=True) class PupilAddSerializer(serializers.ModelSerializer): """Добавление ученика""" class TimetableAddSerializer(serializers.ModelSerializer): """Добавление расписания""" class TimetableSerializer(serializers.ModelSerializer): """Вывод расписания""" subject_name = serializers.SlugRelatedField(slug_field="subject", read_only=True) cabinet_number = serializers.SlugRelatedField(slug_field="number", read_only=True) teacher_name = serializers.SlugRelatedField(slug_field="last_name", read_only=True) klass_name = serializers.SlugRelatedField(slug_field="number", read_only=True) class KlassSerializer(serializers.ModelSerializer): """Список классов""" teacher = serializers.SlugRelatedField(slug_field="last_name", read_only=True) class KlassAddSerializer(serializers.ModelSerializer): """Добавление класса""" class KlassDetailSerializer(serializers.ModelSerializer): """Описание класса""" teacher = serializers.SlugRelatedField(slug_field="last_name", read_only=True) pupils = PupilSerializer(many=True) timetable = TimetableSerializer(many=True) class SubjectSerializer(serializers.ModelSerializer): """Список предметов""" class CabinetSerializer(serializers.ModelSerializer): """Список кабинетов""" teacher = serializers.SlugRelatedField(slug_field="last_name", read_only=True) class TeacherDetailSerializer(serializers.ModelSerializer): """Досье учителя""" subject = serializers.SlugRelatedField(slug_field="subject", read_only=True) klass = KlassSerializer(many=True) cabinet = CabinetSerializer(many=True)
[ 6738, 1334, 62, 30604, 1330, 11389, 11341, 201, 198, 6738, 764, 27530, 1330, 32019, 11, 14967, 316, 540, 11, 42, 31172, 11, 47, 929, 346, 11, 34, 6014, 316, 11, 19776, 11, 22653, 201, 198, 201, 198, 201, 198, 4871, 32019, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 94, 140, 123, 18849, 21727, 25443, 118, 220, 35072, 141, 229, 18849, 20375, 16843, 30143, 16843, 140, 117, 37811, 201, 198, 201, 198, 201, 198, 4871, 32019, 4550, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 25443, 109, 16142, 38857, 30143, 16843, 22177, 18849, 16843, 220, 35072, 141, 229, 18849, 20375, 16843, 30143, 40623, 37811, 201, 198, 201, 198, 201, 198, 4871, 350, 929, 346, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 94, 140, 123, 18849, 21727, 25443, 118, 220, 35072, 141, 229, 16843, 22177, 18849, 31583, 25443, 110, 37811, 201, 198, 201, 198, 201, 198, 4871, 22653, 16447, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 25443, 109, 16142, 38857, 30143, 16843, 22177, 18849, 16843, 12466, 122, 141, 228, 16843, 22177, 31583, 18849, 37811, 201, 198, 201, 198, 201, 198, 4871, 22653, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 240, 45035, 38857, 25443, 112, 12466, 122, 141, 228, 16843, 22177, 25443, 118, 37811, 201, 198, 220, 220, 220, 2426, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 32796, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 350, 929, 346, 11242, 603, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 15166, 21727, 45367, 16843, 220, 35072, 141, 229, 16843, 22177, 18849, 31583, 16142, 37811, 201, 198, 220, 220, 220, 479, 31172, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 796, 366, 17618, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 19051, 796, 22653, 32634, 7509, 7, 21834, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 350, 929, 346, 4550, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 25443, 109, 16142, 38857, 30143, 16843, 22177, 18849, 16843, 220, 35072, 141, 229, 16843, 22177, 18849, 31583, 16142, 37811, 201, 198, 201, 198, 201, 198, 4871, 5045, 316, 540, 4550, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 25443, 109, 16142, 38857, 30143, 16843, 22177, 18849, 16843, 220, 21169, 16142, 21727, 140, 123, 18849, 21727, 16142, 22177, 18849, 40623, 37811, 201, 198, 201, 198, 201, 198, 4871, 5045, 316, 540, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 240, 45035, 38857, 25443, 112, 220, 21169, 16142, 21727, 140, 123, 18849, 21727, 16142, 22177, 18849, 40623, 37811, 201, 198, 220, 220, 220, 2426, 62, 3672, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 32796, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 13447, 62, 17618, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 17618, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 4701, 62, 3672, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 12957, 62, 3672, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 479, 31172, 62, 3672, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 17618, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 14770, 562, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 94, 140, 123, 18849, 21727, 25443, 118, 12466, 118, 30143, 16142, 21727, 21727, 25443, 110, 37811, 201, 198, 220, 220, 220, 4701, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 12957, 62, 3672, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 14770, 562, 4550, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 25443, 109, 16142, 38857, 30143, 16843, 22177, 18849, 16843, 12466, 118, 30143, 16142, 21727, 21727, 16142, 37811, 201, 198, 201, 198, 201, 198, 4871, 14770, 562, 11242, 603, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 252, 140, 123, 18849, 21727, 16142, 22177, 18849, 16843, 12466, 118, 30143, 16142, 21727, 21727, 16142, 37811, 201, 198, 220, 220, 220, 4701, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 12957, 62, 3672, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 25613, 796, 350, 929, 346, 32634, 7509, 7, 21834, 28, 17821, 8, 201, 198, 220, 220, 220, 40021, 796, 5045, 316, 540, 32634, 7509, 7, 21834, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 15540, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 94, 140, 123, 18849, 21727, 25443, 118, 12466, 123, 21169, 16843, 43666, 43108, 16843, 20375, 25443, 110, 37811, 201, 198, 201, 198, 201, 198, 4871, 20384, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 94, 140, 123, 18849, 21727, 25443, 118, 12466, 118, 16142, 140, 109, 18849, 22177, 16843, 20375, 25443, 110, 37811, 201, 198, 220, 220, 220, 4701, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 12957, 62, 3672, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 201, 198, 201, 198, 4871, 32019, 11242, 603, 32634, 7509, 7, 46911, 11341, 13, 17633, 32634, 7509, 2599, 201, 198, 220, 220, 220, 37227, 140, 242, 15166, 21727, 45367, 16843, 220, 35072, 141, 229, 18849, 20375, 16843, 30143, 40623, 37811, 201, 198, 220, 220, 220, 2426, 796, 11389, 11341, 13, 11122, 1018, 9819, 15878, 7, 6649, 1018, 62, 3245, 2625, 32796, 1600, 1100, 62, 8807, 28, 17821, 8, 201, 198, 220, 220, 220, 479, 31172, 796, 14770, 562, 32634, 7509, 7, 21834, 28, 17821, 8, 201, 198, 220, 220, 220, 13447, 796, 20384, 32634, 7509, 7, 21834, 28, 17821, 8, 201 ]
2.307763
1,082
import argparse import os import numpy as np from tqdm import tqdm from mypath import Path from dataloaders import make_data_loader from modeling.sync_batchnorm.replicate import patch_replication_callback from modeling.erfnet_road import * from utils.loss import SegmentationLosses from utils.calculate_weights import calculate_weigths_labels from utils.lr_scheduler import LR_Scheduler from utils.saver import Saver from utils.summaries import TensorboardSummary from utils.metrics import Evaluator from utils.LossWithUncertainty import LossWithUncertainty from dataloaders.utils import decode_segmap if __name__ == "__main__": main()
[ 11748, 1822, 29572, 198, 11748, 28686, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 256, 80, 36020, 1330, 256, 80, 36020, 198, 198, 6738, 616, 6978, 1330, 10644, 198, 6738, 4818, 282, 1170, 364, 1330, 787, 62, 7890, 62, 29356, 198, 6738, 21128, 13, 27261, 62, 43501, 27237, 13, 35666, 5344, 1330, 8529, 62, 35666, 3299, 62, 47423, 198, 6738, 21128, 13, 263, 69, 3262, 62, 6344, 1330, 1635, 198, 6738, 3384, 4487, 13, 22462, 1330, 1001, 5154, 341, 43, 793, 274, 198, 6738, 3384, 4487, 13, 9948, 3129, 378, 62, 43775, 1330, 15284, 62, 732, 328, 9998, 62, 23912, 1424, 198, 6738, 3384, 4487, 13, 14050, 62, 1416, 704, 18173, 1330, 37491, 62, 50, 1740, 18173, 198, 6738, 3384, 4487, 13, 82, 8770, 1330, 311, 8770, 198, 6738, 3384, 4487, 13, 82, 13929, 3166, 1330, 309, 22854, 3526, 22093, 198, 6738, 3384, 4487, 13, 4164, 10466, 1330, 26439, 84, 1352, 198, 6738, 3384, 4487, 13, 43, 793, 3152, 3118, 39239, 774, 1330, 22014, 3152, 3118, 39239, 774, 198, 6738, 4818, 282, 1170, 364, 13, 26791, 1330, 36899, 62, 325, 70, 8899, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 1388, 3419, 198 ]
3.205
200
name0_1_0_0_0_3_0 = None name0_1_0_0_0_3_1 = None name0_1_0_0_0_3_2 = None name0_1_0_0_0_3_3 = None name0_1_0_0_0_3_4 = None
[ 3672, 15, 62, 16, 62, 15, 62, 15, 62, 15, 62, 18, 62, 15, 796, 6045, 198, 198, 3672, 15, 62, 16, 62, 15, 62, 15, 62, 15, 62, 18, 62, 16, 796, 6045, 198, 198, 3672, 15, 62, 16, 62, 15, 62, 15, 62, 15, 62, 18, 62, 17, 796, 6045, 198, 198, 3672, 15, 62, 16, 62, 15, 62, 15, 62, 15, 62, 18, 62, 18, 796, 6045, 198, 198, 3672, 15, 62, 16, 62, 15, 62, 15, 62, 15, 62, 18, 62, 19, 796, 6045 ]
1.454545
88
import csv import config as C import pandas as pd from sklearn import preprocessing import numpy as np if __name__ == '__main__': df = pd.read_csv('./JsonToCSV/data0126.csv') ecgList = [] recordLen = 10000 for i in range(len(df.ECG)): ecgList.append(changeToList(df.ECG[i].split(" "))) for j in range(len(ecgList)): if recordLen > len(ecgList[j]): recordLen = len(ecgList[j]) numOfRow = [] for k in range(recordLen - 1): numOfRow.append(k) with open('try0126.csv', 'w', newline='') as csvFile: writer = csv.writer(csvFile) writer.writerow(numOfRow) for j in range(len(ecgList)): # 標準化處理 # Min_Max_Scaler = preprocessing.MinMaxScaler(feature_range=(-5, 5)) # 設定縮放的區間上下限 # MinMax_Data = Min_Max_Scaler.fit_transform(ecgList[j]) # Data 為原始資料 # # npa = np.asarray(ecgList[j], dtype=np.float32) # # norm = np.linalg.norm(npa) # # normal_array = npa / norm X = preprocessing.scale(ecgList[j]) final = np.round(X, 4) writer.writerow(final[0:(recordLen - 1)])
[ 11748, 269, 21370, 198, 11748, 4566, 355, 327, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 1341, 35720, 1330, 662, 36948, 198, 11748, 299, 32152, 355, 45941, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 47764, 796, 279, 67, 13, 961, 62, 40664, 7, 4458, 14, 41, 1559, 2514, 7902, 53, 14, 7890, 486, 2075, 13, 40664, 11537, 198, 220, 220, 220, 9940, 70, 8053, 796, 17635, 198, 220, 220, 220, 1700, 30659, 796, 33028, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 11925, 7, 7568, 13, 2943, 38, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 9940, 70, 8053, 13, 33295, 7, 3803, 2514, 8053, 7, 7568, 13, 2943, 38, 58, 72, 4083, 35312, 7203, 366, 22305, 628, 220, 220, 220, 329, 474, 287, 2837, 7, 11925, 7, 721, 70, 8053, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1700, 30659, 1875, 18896, 7, 721, 70, 8053, 58, 73, 60, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1700, 30659, 796, 18896, 7, 721, 70, 8053, 58, 73, 12962, 198, 220, 220, 220, 997, 5189, 25166, 796, 17635, 628, 220, 220, 220, 329, 479, 287, 2837, 7, 22105, 30659, 532, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 997, 5189, 25166, 13, 33295, 7, 74, 8, 628, 220, 220, 220, 351, 1280, 10786, 28311, 486, 2075, 13, 40664, 3256, 705, 86, 3256, 649, 1370, 28, 7061, 8, 355, 269, 21370, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 6260, 796, 269, 21370, 13, 16002, 7, 40664, 8979, 8, 198, 220, 220, 220, 220, 220, 220, 220, 6260, 13, 16002, 322, 7, 22510, 5189, 25166, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 2837, 7, 11925, 7, 721, 70, 8053, 8, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10545, 101, 247, 162, 118, 244, 44293, 244, 164, 247, 243, 49426, 228, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1855, 62, 11518, 62, 3351, 36213, 796, 662, 36948, 13, 9452, 11518, 3351, 36213, 7, 30053, 62, 9521, 16193, 12, 20, 11, 642, 4008, 220, 1303, 5525, 101, 255, 22522, 248, 163, 116, 106, 162, 242, 122, 21410, 39355, 222, 38461, 241, 41468, 10310, 233, 165, 247, 238, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1855, 11518, 62, 6601, 796, 1855, 62, 11518, 62, 3351, 36213, 13, 11147, 62, 35636, 7, 721, 70, 8053, 58, 73, 12962, 220, 1303, 6060, 13328, 224, 118, 43889, 253, 34650, 233, 164, 111, 229, 23877, 247, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1303, 299, 8957, 796, 45941, 13, 292, 18747, 7, 721, 70, 8053, 58, 73, 4357, 288, 4906, 28, 37659, 13, 22468, 2624, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1303, 2593, 796, 45941, 13, 75, 1292, 70, 13, 27237, 7, 77, 8957, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1303, 3487, 62, 18747, 796, 299, 8957, 1220, 2593, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1395, 796, 662, 36948, 13, 9888, 7, 721, 70, 8053, 58, 73, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2457, 796, 45941, 13, 744, 7, 55, 11, 604, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6260, 13, 16002, 322, 7, 20311, 58, 15, 37498, 22105, 30659, 532, 352, 8, 12962, 198 ]
1.911184
608
import sys import piLock.configuration as conf import classErrorLog as errorLog
[ 11748, 25064, 198, 11748, 31028, 25392, 13, 11250, 3924, 355, 1013, 198, 11748, 1398, 12331, 11187, 355, 4049, 11187, 198 ]
4
20
# Github : https://github.com/adarsh2104 # HR-Profile: https://www.hackerrank.com/adarsh_2104 # Challenge : https://www.hackerrank.com/challenges/s10-quartiles # Max Score : 30 n = input() input_array = sorted([int(x) for x in input().split()]) print(find_median(input_array[:len(input_array)//2])) print(find_median(input_array)) print(find_median(input_array[len(input_array) // 2 + len(input_array) % 2:]))
[ 198, 2, 220, 38994, 220, 220, 220, 1058, 3740, 1378, 12567, 13, 785, 14, 324, 5406, 17, 13464, 198, 2, 220, 15172, 12, 37046, 25, 3740, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 324, 5406, 62, 17, 13464, 198, 2, 220, 13879, 1058, 3740, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 36747, 34120, 14, 82, 940, 12, 36008, 2915, 198, 2, 220, 5436, 15178, 1058, 1542, 628, 628, 198, 77, 796, 5128, 3419, 198, 15414, 62, 18747, 796, 23243, 26933, 600, 7, 87, 8, 329, 2124, 287, 5128, 22446, 35312, 3419, 12962, 198, 4798, 7, 19796, 62, 1150, 666, 7, 15414, 62, 18747, 58, 25, 11925, 7, 15414, 62, 18747, 8, 1003, 17, 60, 4008, 198, 4798, 7, 19796, 62, 1150, 666, 7, 15414, 62, 18747, 4008, 198, 4798, 7, 19796, 62, 1150, 666, 7, 15414, 62, 18747, 58, 11925, 7, 15414, 62, 18747, 8, 3373, 362, 1343, 18896, 7, 15414, 62, 18747, 8, 4064, 362, 47715, 4008, 198 ]
2.588957
163
import attr from couchexport.export import export_raw from couchexport.models import Format TITLE_ROW = [ 'Source Field', 'Field', 'Map Via', 'Data Source', 'Filter Name', 'Filter Value', 'Table Name', 'Format Via', ] @attr.s @attr.s @attr.s
[ 11748, 708, 81, 198, 198, 6738, 2284, 2395, 87, 634, 13, 39344, 1330, 10784, 62, 1831, 198, 6738, 2284, 2395, 87, 634, 13, 27530, 1330, 18980, 198, 198, 49560, 2538, 62, 49, 3913, 796, 685, 198, 220, 220, 220, 705, 7416, 7663, 3256, 198, 220, 220, 220, 705, 15878, 3256, 198, 220, 220, 220, 705, 13912, 33356, 3256, 198, 220, 220, 220, 705, 6601, 8090, 3256, 198, 220, 220, 220, 705, 22417, 6530, 3256, 198, 220, 220, 220, 705, 22417, 11052, 3256, 198, 220, 220, 220, 705, 10962, 6530, 3256, 198, 220, 220, 220, 705, 26227, 33356, 3256, 198, 60, 628, 198, 31, 35226, 13, 82, 628, 198, 31, 35226, 13, 82, 628, 198, 31, 35226, 13, 82, 198 ]
2.369748
119
""" Handles visit long trends (scaling factors) applied to the observation. The classic cases are the `hook' and long term ramp """ import abc import numpy as np class BaseVisitTrend(object): """ Visit trends take input the visit planner output and generate a scaling factor that will be multiplied per exposure. They must implement the method `_gen_scaling_factors` which outputs a list of scaling factors, one per exposure """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_scale_factor(self, exp_num): """ Returns the scale factor for the exposure number `exp_num`.""" return self.scale_factors[exp_num] def gen_orbit_start_times_per_exp(time_array, obs_start_index): """Generates t0, the time of an orbit for each orbit so it can vectorised i.e for each element time_array there will be a matching element in t_0 giving the orbit start time. """ obs_index = obs_start_index[:] obs_index.append(len(time_array)) t_0 = np.zeros(len(time_array)) for i in xrange(len(obs_index) - 1): t_0[obs_index[i]:obs_index[i + 1]] = time_array[obs_start_index[i]] return t_0
[ 37811, 7157, 829, 3187, 890, 11257, 357, 1416, 4272, 5087, 8, 5625, 284, 262, 13432, 13, 383, 198, 49421, 2663, 389, 262, 4600, 25480, 6, 290, 890, 3381, 10454, 198, 37811, 198, 198, 11748, 450, 66, 198, 198, 11748, 299, 32152, 355, 45941, 628, 198, 4871, 7308, 31141, 45461, 7, 15252, 2599, 198, 220, 220, 220, 37227, 16440, 11257, 1011, 5128, 262, 3187, 42351, 5072, 290, 7716, 257, 198, 220, 220, 220, 20796, 5766, 326, 481, 307, 33096, 583, 7111, 13, 628, 220, 220, 220, 1119, 1276, 3494, 262, 2446, 4600, 62, 5235, 62, 1416, 4272, 62, 22584, 669, 63, 543, 23862, 198, 220, 220, 220, 257, 1351, 286, 20796, 5087, 11, 530, 583, 7111, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 11593, 4164, 330, 31172, 834, 796, 450, 66, 13, 24694, 48526, 628, 220, 220, 220, 2488, 39305, 13, 397, 8709, 24396, 628, 220, 220, 220, 825, 651, 62, 9888, 62, 31412, 7, 944, 11, 1033, 62, 22510, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 16409, 262, 5046, 5766, 329, 262, 7111, 1271, 4600, 11201, 62, 22510, 63, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 9888, 62, 22584, 669, 58, 11201, 62, 22510, 60, 628, 198, 198, 4299, 2429, 62, 42594, 62, 9688, 62, 22355, 62, 525, 62, 11201, 7, 2435, 62, 18747, 11, 10201, 62, 9688, 62, 9630, 2599, 198, 220, 220, 220, 37227, 8645, 689, 256, 15, 11, 262, 640, 286, 281, 13066, 329, 1123, 13066, 523, 340, 460, 15879, 1417, 628, 220, 220, 220, 1312, 13, 68, 329, 1123, 5002, 640, 62, 18747, 612, 481, 307, 257, 12336, 5002, 287, 256, 62, 15, 3501, 262, 198, 220, 220, 220, 13066, 923, 640, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 10201, 62, 9630, 796, 10201, 62, 9688, 62, 9630, 58, 47715, 198, 220, 220, 220, 10201, 62, 9630, 13, 33295, 7, 11925, 7, 2435, 62, 18747, 4008, 198, 220, 220, 220, 256, 62, 15, 796, 45941, 13, 9107, 418, 7, 11925, 7, 2435, 62, 18747, 4008, 628, 220, 220, 220, 329, 1312, 287, 2124, 9521, 7, 11925, 7, 8158, 62, 9630, 8, 532, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 256, 62, 15, 58, 8158, 62, 9630, 58, 72, 5974, 8158, 62, 9630, 58, 72, 1343, 352, 11907, 796, 640, 62, 18747, 58, 8158, 62, 9688, 62, 9630, 58, 72, 11907, 628, 220, 220, 220, 1441, 256, 62, 15, 198 ]
2.873171
410
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime from django.db import migrations
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 4818, 8079, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628, 198 ]
2.9
40
# # Author    : Manuel Bernal Llinares # Project   : trackhub-creator # Timestamp : 07-09-2017 11:24 # --- # © 2017 Manuel Bernal Llinares <[email protected]> # All rights reserved. # """ This pipeline creates a trackhub for a PRIDE project, based on the information provided via a JSON formatted file, as it can be seen on this sample: { "trackHubName" : "PXD000625", "trackHubShortLabel" : "<a href=\"http://www.ebi.ac.uk/pride/archive/projects/PXD000625\">PXD000625</a> - Hepatoc...", "trackHubLongLabel" : "Experimental design For the label-free ...", "trackHubType" : "PROTEOMICS", "trackHubEmail" : "[email protected]", "trackHubInternalAbsolutePath" : "...", "trackhubCreationReportFilePath": "...", "trackMaps" : [ { "trackName" : "PXD000625_10090_Original", "trackShortLabel" : "<a href=\"http://www.ebi.ac.uk/pride/archive/projects/PXD000625\">PXD000625</a> - Mus musc...", "trackLongLabel" : "Experimental design For the label-free proteome analysis 17 mice were used composed of 5 ...", "trackSpecies" : "10090", "pogoFile" : "..." } ] } """ import os import json import time # App imports import config_manager import ensembl.service import ensembl.data_downloader import trackhub.models as trackhubs import toolbox.general as general_toolbox from parallel.models import ParallelRunnerManagerFactory from parallel.exceptions import NoMoreAliveRunnersException from pogo.models import PogoRunnerFactory from pipelines.template_pipeline import TrackhubCreationPogoBasedDirector, DirectorConfigurationManager # Globals __configuration_file = None __pipeline_arguments = None __pipeline_director = None # Pipeline properties access # Models for dealing with the data file that describes the project class ProjectTrackDescriptor: """ This class models the tracks that are defined in the given project under the "trackMaps" section """ # Project Data File keys relative to every TrackMap object _PROJECT_DATA_FILE_KEY_TRACK_NAME = 'trackName' _PROJECT_DATA_FILE_KEY_TRACK_SHORT_LABEL = 'trackShortLabel' _PROJECT_DATA_FILE_KEY_TRACK_LONG_LABEL = 'trackLongLabel' _PROJECT_DATA_FILE_KEY_TRACK_SPECIES = 'trackSpecies' _PROJECT_DATA_FILE_KEY_TRACK_POGO_FILE_PATH = 'pogoFile' class ProjectTrackhubDescriptor: """ This class models the trackhub as described by the given project description data, see sample project description information at the top of this module """ # Project Data File keys _PROJECT_DATA_FILE_KEY_TRACKHUB_NAME = 'trackHubName' _PROJECT_DATA_FILE_KEY_TRACKHUB_SHORT_LABEL = 'trackHubShortLabel' _PROJECT_DATA_FILE_KEY_TRACKHUB_LONG_LABEL = 'trackHubLongLabel' _PROJECT_DATA_FILE_KEY_TRACKHUB_HUB_TYPE = 'trackHubType' _PROJECT_DATA_FILE_KEY_TRACKHUB_EMAIL = 'trackHubEmail' _PROJECT_DATA_FILE_KEY_TRACKHUB_INTERNAL_ABSOLUTE_PATH = 'trackHubInternalAbsolutePath' _PROJECT_DATA_FILE_KEY_TRACKHUB_REPORT_FILE = 'trackhubCreationReportFilePath' _PROJECT_DATA_FILE_KEY_TRACKHUB_SECTION_TRACKMAPS = 'trackMaps' class PipelineResult: """ This class models the pipeline report that will be made available at the end of the pipeline execution """ _VALUE_STATUS_SUCCESS = 'SUCCESS' _VALUE_STATUS_ERROR = 'ERROR' _VALUE_STATUS_WARNING = 'WARNING' def add_error_message(self, error_message): """ Adds an error message to the pipeline report. As this report is the final word on how the pipeline performed, the first error message that is set will set the status of the pipeline as 'failed' :param error_message: error message :return: no return value """ # This is the report on the final result from running the pipeline self.set_status_error() self.error_messages.append(error_message) def add_success_message(self, success_message): """ This will add messages to the pipeline report, but it doesn't change its status. :param success_message: message to add :return: no return value """ self.success_messages.append(success_message) def add_warning_message(self, warning_message): """ This will add warning messages to the pipeline report, setting the status to 'WARNING' if it wasn't in 'ERROR' status. :param warning_message: warning message to add :return: no return value """ self.warning_messages.append(warning_message) if self.status != self._VALUE_STATUS_ERROR: self.status = self._VALUE_STATUS_WARNING def add_log_files(self, log_files): """ Add all the log files produce by the pipeline to its final report :param log_files: a list of log files to add :return: no return value """ self.file_path_log_files.extend(log_files) class TrackhubCreatorForProject(TrackhubCreationPogoBasedDirector): """ Given a project description file that contains the information specified at the beginning of this module, this pipeline creates a trackhub for all the project defined tracks """ def __get_valid_project_tracks(self): """ This helper creates a list of valid trackhub tracks from the given project, i.e. tracks that meet this cirteria: - Its taxonomy ID is available on Ensembl The list of valid tracks is cached, so it won't change between multiple calls :return: a list of valid trackhub tracks for the given project """ if not self.__valid_project_tracks: self.__valid_project_tracks = [] ensembl_service = ensembl.service.get_service() for project_track_descriptor in self.__project_trackhub_descriptor.get_trackhub_project_defined_tracks(): if ensembl_service.get_species_data_service().get_species_entry_for_taxonomy_id( project_track_descriptor.get_track_species()): self.__valid_project_tracks.append(project_track_descriptor) else: self.__pipeline_result_object \ .add_warning_message("MISSING Taxonomy #{} on Ensembl" .format(project_track_descriptor.get_track_species())) return self.__valid_project_tracks def __get_index_project_track_for_taxonomy_id(self): """ Get the project tracks indexed by taxonomy id :return: map (taxonomy_id, project_track) """ if not self.__indexed_project_tracks_by_taxonomy_id: self.__indexed_project_tracks_by_taxonomy_id = {} self._get_logger().debug("Indexing #{} valid project tracks".format(len(self.__get_valid_project_tracks()))) for project_track in self.__get_valid_project_tracks(): if project_track.get_track_species() in self.__indexed_project_tracks_by_taxonomy_id: self._get_logger() \ .error("ERROR DUPLICATED TAXONOMY indexing project track '{}', " "another project track, '{}' is in the index - SKIP -" .format(project_track.get_track_name(), self.__indexed_project_tracks_by_taxonomy_id[ project_track.get_track_species()].get_track_name())) continue self.__indexed_project_tracks_by_taxonomy_id[project_track.get_track_species()] = project_track self._get_logger().debug("Project track '{}' indexed with taxonomy ID '{}'" .format(project_track.get_track_name(), project_track.get_track_species())) return self.__indexed_project_tracks_by_taxonomy_id # Helpers # Override # Override # Override # Override # Override def _after(self): """ Dump to a file the pipeline report :return: no return value """ if not self.is_pipeline_status_ok(): self._get_logger().warning("This Pipeline is finishing with NON-OK status.") report_files = [self.__config_manager.get_file_path_trackhub_creation_report()] if self.__project_trackhub_descriptor \ and self.__project_trackhub_descriptor.get_trackhub_report_file_path(): report_files.append(self.__project_trackhub_descriptor.get_trackhub_report_file_path()) for report_file in report_files: self._get_logger().info("Dumping Pipeline Report to '{}'".format(report_file)) with open(report_file, 'w') as f: f.write(str(self.__pipeline_result_object)) return True if __name__ == '__main__': print("ERROR: This script is part of a pipeline collection and it is not meant to be run in stand alone mode")
[ 2, 220, 198, 2, 6434, 33477, 1849, 25, 25995, 6206, 282, 18315, 1437, 411, 198, 2, 4935, 4603, 1849, 25, 2610, 40140, 12, 45382, 198, 2, 5045, 27823, 1058, 8753, 12, 2931, 12, 5539, 1367, 25, 1731, 198, 2, 11420, 198, 2, 10673, 2177, 25995, 6206, 282, 18315, 1437, 411, 1279, 2022, 24689, 31, 14816, 13, 785, 29, 198, 2, 1439, 2489, 10395, 13, 198, 2, 220, 198, 198, 37811, 198, 1212, 11523, 8075, 257, 2610, 40140, 329, 257, 4810, 14114, 1628, 11, 1912, 319, 262, 1321, 2810, 2884, 257, 19449, 39559, 2393, 11, 355, 340, 198, 5171, 307, 1775, 319, 428, 6291, 25, 198, 90, 198, 220, 366, 11659, 16066, 5376, 1, 1058, 366, 47, 55, 35, 830, 26704, 1600, 198, 220, 366, 11659, 16066, 16438, 33986, 1, 1058, 33490, 64, 13291, 17553, 4023, 1378, 2503, 13, 1765, 72, 13, 330, 13, 2724, 14, 1050, 485, 14, 17474, 14, 42068, 14, 47, 55, 35, 830, 26704, 38214, 47, 55, 35, 830, 26704, 3556, 64, 29, 532, 32308, 265, 420, 9313, 11, 198, 220, 366, 11659, 16066, 14617, 33986, 1, 1058, 366, 20468, 9134, 1486, 1114, 262, 6167, 12, 5787, 35713, 11, 198, 220, 366, 11659, 16066, 6030, 1, 1058, 366, 4805, 23051, 2662, 19505, 1600, 198, 220, 366, 11659, 16066, 15333, 1, 1058, 366, 1050, 485, 12, 11284, 31, 1765, 72, 13, 330, 13, 2724, 1600, 198, 220, 366, 11659, 16066, 37693, 24849, 3552, 15235, 1, 1058, 366, 9313, 11, 198, 220, 366, 11659, 40140, 12443, 341, 19100, 8979, 15235, 1298, 366, 9313, 11, 198, 220, 366, 11659, 47010, 1, 1058, 685, 1391, 198, 220, 220, 220, 366, 11659, 5376, 1, 1058, 366, 47, 55, 35, 830, 26704, 62, 3064, 3829, 62, 20556, 1600, 198, 220, 220, 220, 366, 11659, 16438, 33986, 1, 1058, 33490, 64, 13291, 17553, 4023, 1378, 2503, 13, 1765, 72, 13, 330, 13, 2724, 14, 1050, 485, 14, 17474, 14, 42068, 14, 47, 55, 35, 830, 26704, 38214, 47, 55, 35, 830, 26704, 3556, 64, 29, 532, 2629, 1928, 66, 9313, 11, 198, 220, 220, 220, 366, 11659, 14617, 33986, 1, 1058, 366, 20468, 9134, 1486, 1114, 262, 6167, 12, 5787, 5915, 462, 3781, 1596, 10693, 547, 973, 13160, 286, 642, 35713, 11, 198, 220, 220, 220, 366, 11659, 5248, 3171, 1, 1058, 366, 3064, 3829, 1600, 198, 220, 220, 220, 366, 79, 24076, 8979, 1, 1058, 366, 9313, 198, 220, 1782, 2361, 198, 92, 198, 37811, 198, 198, 11748, 28686, 198, 11748, 33918, 198, 11748, 640, 198, 2, 2034, 17944, 198, 11748, 4566, 62, 37153, 198, 11748, 551, 4428, 75, 13, 15271, 198, 11748, 551, 4428, 75, 13, 7890, 62, 15002, 263, 198, 11748, 2610, 40140, 13, 27530, 355, 2610, 71, 23161, 198, 11748, 2891, 3524, 13, 24622, 355, 2276, 62, 25981, 3524, 198, 6738, 10730, 13, 27530, 1330, 42945, 49493, 13511, 22810, 198, 6738, 10730, 13, 1069, 11755, 1330, 1400, 5167, 2348, 425, 10987, 2741, 16922, 198, 6738, 279, 24076, 13, 27530, 1330, 350, 24076, 49493, 22810, 198, 6738, 31108, 13, 28243, 62, 79, 541, 4470, 1330, 17762, 40140, 12443, 341, 47, 24076, 15001, 28702, 11, 5890, 38149, 13511, 198, 198, 2, 40713, 874, 198, 834, 11250, 3924, 62, 7753, 796, 6045, 198, 834, 79, 541, 4470, 62, 853, 2886, 796, 6045, 198, 834, 79, 541, 4470, 62, 35248, 796, 6045, 628, 198, 2, 37709, 6608, 1895, 628, 628, 198, 198, 2, 32329, 329, 7219, 351, 262, 1366, 2393, 326, 8477, 262, 1628, 198, 4871, 4935, 24802, 24564, 1968, 273, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 770, 1398, 4981, 262, 8339, 326, 389, 5447, 287, 262, 1813, 1628, 739, 262, 366, 11659, 47010, 1, 2665, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1303, 4935, 6060, 9220, 8251, 3585, 284, 790, 17762, 13912, 2134, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 62, 20608, 796, 705, 11659, 5376, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 62, 9693, 9863, 62, 48780, 3698, 796, 705, 11659, 16438, 33986, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 62, 43, 18494, 62, 48780, 3698, 796, 705, 11659, 14617, 33986, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 62, 48451, 11015, 796, 705, 11659, 5248, 3171, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 62, 47, 7730, 46, 62, 25664, 62, 34219, 796, 705, 79, 24076, 8979, 6, 628, 198, 4871, 4935, 24802, 40140, 24564, 1968, 273, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 770, 1398, 4981, 262, 2610, 40140, 355, 3417, 416, 262, 1813, 1628, 6764, 1366, 11, 766, 6291, 1628, 6764, 198, 220, 220, 220, 1321, 379, 262, 1353, 286, 428, 8265, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1303, 4935, 6060, 9220, 8251, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 20608, 796, 705, 11659, 16066, 5376, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 9693, 9863, 62, 48780, 3698, 796, 705, 11659, 16066, 16438, 33986, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 43, 18494, 62, 48780, 3698, 796, 705, 11659, 16066, 14617, 33986, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 39, 10526, 62, 25216, 796, 705, 11659, 16066, 6030, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 27630, 4146, 796, 705, 11659, 16066, 15333, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 1268, 31800, 1847, 62, 32, 4462, 3535, 37780, 62, 34219, 796, 705, 11659, 16066, 37693, 24849, 3552, 15235, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 2200, 15490, 62, 25664, 796, 705, 11659, 40140, 12443, 341, 19100, 8979, 15235, 6, 198, 220, 220, 220, 4808, 31190, 23680, 62, 26947, 62, 25664, 62, 20373, 62, 5446, 8120, 39, 10526, 62, 50, 24565, 62, 5446, 8120, 33767, 50, 796, 705, 11659, 47010, 6, 628, 198, 4871, 37709, 23004, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 770, 1398, 4981, 262, 11523, 989, 326, 481, 307, 925, 1695, 379, 262, 886, 286, 262, 11523, 9706, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 4808, 39488, 62, 35744, 2937, 62, 12564, 4093, 7597, 796, 705, 12564, 4093, 7597, 6, 198, 220, 220, 220, 4808, 39488, 62, 35744, 2937, 62, 24908, 796, 705, 24908, 6, 198, 220, 220, 220, 4808, 39488, 62, 35744, 2937, 62, 31502, 796, 705, 31502, 6, 628, 220, 220, 220, 825, 751, 62, 18224, 62, 20500, 7, 944, 11, 4049, 62, 20500, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 34333, 281, 4049, 3275, 284, 262, 11523, 989, 13, 1081, 428, 989, 318, 262, 2457, 1573, 319, 703, 262, 11523, 6157, 11, 198, 220, 220, 220, 220, 220, 220, 220, 262, 717, 4049, 3275, 326, 318, 900, 481, 900, 262, 3722, 286, 262, 11523, 355, 705, 47904, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 4049, 62, 20500, 25, 4049, 3275, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 645, 1441, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 770, 318, 262, 989, 319, 262, 2457, 1255, 422, 2491, 262, 11523, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2617, 62, 13376, 62, 18224, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 18224, 62, 37348, 1095, 13, 33295, 7, 18224, 62, 20500, 8, 628, 220, 220, 220, 825, 751, 62, 13138, 62, 20500, 7, 944, 11, 1943, 62, 20500, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 770, 481, 751, 6218, 284, 262, 11523, 989, 11, 475, 340, 1595, 470, 1487, 663, 3722, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1943, 62, 20500, 25, 3275, 284, 751, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 645, 1441, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 13138, 62, 37348, 1095, 13, 33295, 7, 13138, 62, 20500, 8, 628, 220, 220, 220, 825, 751, 62, 43917, 62, 20500, 7, 944, 11, 6509, 62, 20500, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 770, 481, 751, 6509, 6218, 284, 262, 11523, 989, 11, 4634, 262, 3722, 284, 705, 31502, 6, 611, 340, 2492, 470, 287, 705, 24908, 6, 198, 220, 220, 220, 220, 220, 220, 220, 3722, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 6509, 62, 20500, 25, 6509, 3275, 284, 751, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 645, 1441, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 43917, 62, 37348, 1095, 13, 33295, 7, 43917, 62, 20500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 13376, 14512, 2116, 13557, 39488, 62, 35744, 2937, 62, 24908, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 13376, 796, 2116, 13557, 39488, 62, 35744, 2937, 62, 31502, 628, 220, 220, 220, 825, 751, 62, 6404, 62, 16624, 7, 944, 11, 2604, 62, 16624, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3060, 477, 262, 2604, 3696, 4439, 416, 262, 11523, 284, 663, 2457, 989, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 2604, 62, 16624, 25, 257, 1351, 286, 2604, 3696, 284, 751, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 645, 1441, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 7753, 62, 6978, 62, 6404, 62, 16624, 13, 2302, 437, 7, 6404, 62, 16624, 8, 628, 198, 4871, 17762, 40140, 16719, 273, 1890, 16775, 7, 24802, 40140, 12443, 341, 47, 24076, 15001, 28702, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 11259, 257, 1628, 6764, 2393, 326, 4909, 262, 1321, 7368, 379, 262, 3726, 286, 428, 8265, 11, 428, 198, 220, 220, 220, 11523, 8075, 257, 2610, 40140, 329, 477, 262, 1628, 5447, 8339, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 11593, 1136, 62, 12102, 62, 16302, 62, 46074, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 770, 31904, 8075, 257, 1351, 286, 4938, 2610, 40140, 8339, 422, 262, 1813, 1628, 11, 1312, 13, 68, 13, 8339, 326, 1826, 428, 10774, 353, 544, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 6363, 1687, 30565, 4522, 318, 1695, 319, 2039, 4428, 75, 198, 220, 220, 220, 220, 220, 220, 220, 383, 1351, 286, 4938, 8339, 318, 39986, 11, 523, 340, 1839, 470, 1487, 1022, 3294, 3848, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 257, 1351, 286, 4938, 2610, 40140, 8339, 329, 262, 1813, 1628, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 2116, 13, 834, 12102, 62, 16302, 62, 46074, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 12102, 62, 16302, 62, 46074, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 551, 4428, 75, 62, 15271, 796, 551, 4428, 75, 13, 15271, 13, 1136, 62, 15271, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1628, 62, 11659, 62, 20147, 1968, 273, 287, 2116, 13, 834, 16302, 62, 11659, 40140, 62, 20147, 1968, 273, 13, 1136, 62, 11659, 40140, 62, 16302, 62, 23211, 62, 46074, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 551, 4428, 75, 62, 15271, 13, 1136, 62, 35448, 62, 7890, 62, 15271, 22446, 1136, 62, 35448, 62, 13000, 62, 1640, 62, 19290, 30565, 62, 312, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1628, 62, 11659, 62, 20147, 1968, 273, 13, 1136, 62, 11659, 62, 35448, 3419, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 12102, 62, 16302, 62, 46074, 13, 33295, 7, 16302, 62, 11659, 62, 20147, 1968, 273, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 79, 541, 4470, 62, 20274, 62, 15252, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 2860, 62, 43917, 62, 20500, 7203, 44, 16744, 2751, 9241, 30565, 1303, 90, 92, 319, 2039, 4428, 75, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 18982, 7, 16302, 62, 11659, 62, 20147, 1968, 273, 13, 1136, 62, 11659, 62, 35448, 3419, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 834, 12102, 62, 16302, 62, 46074, 628, 220, 220, 220, 825, 11593, 1136, 62, 9630, 62, 16302, 62, 11659, 62, 1640, 62, 19290, 30565, 62, 312, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 3497, 262, 1628, 8339, 41497, 416, 1687, 30565, 4686, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 3975, 357, 19290, 30565, 62, 312, 11, 1628, 62, 11659, 8, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 1136, 62, 6404, 1362, 22446, 24442, 7203, 15732, 278, 1303, 90, 92, 4938, 1628, 8339, 1911, 18982, 7, 11925, 7, 944, 13, 834, 1136, 62, 12102, 62, 16302, 62, 46074, 3419, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1628, 62, 11659, 287, 2116, 13, 834, 1136, 62, 12102, 62, 16302, 62, 46074, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1628, 62, 11659, 13, 1136, 62, 11659, 62, 35448, 3419, 287, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 1136, 62, 6404, 1362, 3419, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 18224, 7203, 24908, 35480, 31484, 11617, 21664, 55, 1340, 2662, 56, 6376, 278, 1628, 2610, 705, 90, 92, 3256, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 29214, 1628, 2610, 11, 705, 90, 92, 6, 318, 287, 262, 6376, 532, 14277, 4061, 532, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 18982, 7, 16302, 62, 11659, 13, 1136, 62, 11659, 62, 3672, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 58, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1628, 62, 11659, 13, 1136, 62, 11659, 62, 35448, 3419, 4083, 1136, 62, 11659, 62, 3672, 3419, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 58, 16302, 62, 11659, 13, 1136, 62, 11659, 62, 35448, 3419, 60, 796, 1628, 62, 11659, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 1136, 62, 6404, 1362, 22446, 24442, 7203, 16775, 2610, 705, 90, 92, 6, 41497, 351, 1687, 30565, 4522, 705, 90, 92, 29653, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 18982, 7, 16302, 62, 11659, 13, 1136, 62, 11659, 62, 3672, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1628, 62, 11659, 13, 1136, 62, 11659, 62, 35448, 3419, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 834, 9630, 276, 62, 16302, 62, 46074, 62, 1525, 62, 19290, 30565, 62, 312, 628, 220, 220, 220, 1303, 10478, 364, 198, 220, 220, 220, 1303, 3827, 13154, 628, 220, 220, 220, 1303, 3827, 13154, 628, 220, 220, 220, 1303, 3827, 13154, 628, 220, 220, 220, 1303, 3827, 13154, 628, 220, 220, 220, 1303, 3827, 13154, 628, 220, 220, 220, 825, 4808, 8499, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 360, 931, 284, 257, 2393, 262, 11523, 989, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7783, 25, 645, 1441, 1988, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 2116, 13, 271, 62, 79, 541, 4470, 62, 13376, 62, 482, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 1136, 62, 6404, 1362, 22446, 43917, 7203, 1212, 37709, 318, 12848, 351, 44521, 12, 11380, 3722, 19570, 198, 220, 220, 220, 220, 220, 220, 220, 989, 62, 16624, 796, 685, 944, 13, 834, 11250, 62, 37153, 13, 1136, 62, 7753, 62, 6978, 62, 11659, 40140, 62, 38793, 62, 13116, 3419, 60, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2116, 13, 834, 16302, 62, 11659, 40140, 62, 20147, 1968, 273, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 2116, 13, 834, 16302, 62, 11659, 40140, 62, 20147, 1968, 273, 13, 1136, 62, 11659, 40140, 62, 13116, 62, 7753, 62, 6978, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 989, 62, 16624, 13, 33295, 7, 944, 13, 834, 16302, 62, 11659, 40140, 62, 20147, 1968, 273, 13, 1136, 62, 11659, 40140, 62, 13116, 62, 7753, 62, 6978, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 329, 989, 62, 7753, 287, 989, 62, 16624, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 1136, 62, 6404, 1362, 22446, 10951, 7203, 35, 25218, 37709, 6358, 284, 705, 90, 92, 6, 1911, 18982, 7, 13116, 62, 7753, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 13116, 62, 7753, 11, 705, 86, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7, 2536, 7, 944, 13, 834, 79, 541, 4470, 62, 20274, 62, 15252, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 6407, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 3601, 7203, 24908, 25, 770, 4226, 318, 636, 286, 257, 11523, 4947, 290, 340, 318, 407, 4001, 284, 307, 1057, 287, 1302, 3436, 4235, 4943, 198 ]
2.497216
3,592
import pytest from pytest_mock import mocker import pandas as pd from kipoiseq.transforms.functional import translate, rc_dna from kipoiseq.dataclasses import Interval, Variant from kipoiseq.extractors.protein import cut_transcript_seq, gtf_row2interval, \ CDSFetcher, TranscriptSeqExtractor, ProteinSeqExtractor, \ ProteinVCFSeqExtractor, SingleSeqProteinVCFSeqExtractor, \ SingleVariantProteinVCFSeqExtractor gtf_file = 'tests/data/sample_1_protein.gtf' fasta_file = 'tests/data/demo_dna_seq.fa' transcript_id = 'enst_test1' vcf_file = 'tests/data/singleVar_vcf_enst_test2.vcf.gz' intervals = [ Interval('22', 580, 596, strand='+', attrs={'tag': 'cds_end_NF'}), Interval('22', 597, 610, strand='+', attrs={'tag': 'cds_end_NF'}) ] @pytest.fixture @pytest.fixture @pytest.fixture # TODO: write test for with sample_id @pytest.fixture @pytest.fixture @pytest.fixture # TODO: add for all proteins.pep.all.fa
[ 11748, 12972, 9288, 198, 6738, 12972, 9288, 62, 76, 735, 1330, 285, 12721, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 479, 541, 25678, 80, 13, 7645, 23914, 13, 45124, 1330, 15772, 11, 48321, 62, 67, 2616, 198, 6738, 479, 541, 25678, 80, 13, 19608, 330, 28958, 1330, 4225, 2100, 11, 38215, 198, 6738, 479, 541, 25678, 80, 13, 2302, 974, 669, 13, 48693, 1330, 2005, 62, 7645, 6519, 62, 41068, 11, 308, 27110, 62, 808, 17, 3849, 2100, 11, 3467, 198, 220, 220, 220, 327, 5258, 37, 316, 2044, 11, 42978, 4653, 80, 11627, 40450, 11, 31702, 4653, 80, 11627, 40450, 11, 3467, 198, 220, 220, 220, 31702, 15922, 37, 4653, 80, 11627, 40450, 11, 14206, 4653, 80, 47, 35574, 15922, 37, 4653, 80, 11627, 40450, 11, 3467, 198, 220, 220, 220, 14206, 23907, 415, 47, 35574, 15922, 37, 4653, 80, 11627, 40450, 198, 198, 13655, 69, 62, 7753, 796, 705, 41989, 14, 7890, 14, 39873, 62, 16, 62, 48693, 13, 13655, 69, 6, 198, 7217, 64, 62, 7753, 796, 705, 41989, 14, 7890, 14, 9536, 78, 62, 67, 2616, 62, 41068, 13, 13331, 6, 198, 7645, 6519, 62, 312, 796, 705, 268, 301, 62, 9288, 16, 6, 198, 85, 12993, 62, 7753, 796, 705, 41989, 14, 7890, 14, 29762, 19852, 62, 85, 12993, 62, 268, 301, 62, 9288, 17, 13, 85, 12993, 13, 34586, 6, 628, 198, 3849, 12786, 796, 685, 198, 220, 220, 220, 4225, 2100, 10786, 1828, 3256, 41234, 11, 642, 4846, 11, 37923, 11639, 10, 3256, 708, 3808, 34758, 6, 12985, 10354, 705, 66, 9310, 62, 437, 62, 21870, 6, 92, 828, 198, 220, 220, 220, 4225, 2100, 10786, 1828, 3256, 642, 5607, 11, 44300, 11, 37923, 11639, 10, 3256, 708, 3808, 34758, 6, 12985, 10354, 705, 66, 9310, 62, 437, 62, 21870, 6, 30072, 198, 60, 628, 628, 198, 198, 31, 9078, 9288, 13, 69, 9602, 628, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 628, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 198, 198, 2, 16926, 46, 25, 3551, 1332, 329, 351, 6291, 62, 312, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 220, 220, 220, 220, 198, 220, 220, 220, 220, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 198, 198, 2, 16926, 46, 25, 751, 329, 477, 15568, 13, 431, 79, 13, 439, 13, 13331, 198 ]
2.4225
400
from PIL import Image import numpy as np # Works when launched from terminal # noinspection PyUnresolvedReferences from k_means import k_means input_image_file = 'lena.jpg' output_image_prefix = 'out_lena' n_clusters = [2, 3, 5] max_iterations = 100 launch_count = 3 main()
[ 6738, 350, 4146, 1330, 7412, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 10933, 618, 5611, 422, 12094, 198, 2, 645, 1040, 14978, 9485, 3118, 411, 5634, 19927, 198, 6738, 479, 62, 1326, 504, 1330, 479, 62, 1326, 504, 198, 198, 15414, 62, 9060, 62, 7753, 796, 705, 75, 8107, 13, 9479, 6, 198, 22915, 62, 9060, 62, 40290, 796, 705, 448, 62, 75, 8107, 6, 198, 77, 62, 565, 13654, 796, 685, 17, 11, 513, 11, 642, 60, 198, 9806, 62, 2676, 602, 796, 1802, 198, 35681, 62, 9127, 796, 513, 628, 198, 198, 12417, 3419, 198 ]
2.818182
99
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Find expression by Monte Carlo Tree Search guided by neural networks.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from neural_guided_symbolic_regression.mcts import policies from neural_guided_symbolic_regression.mcts import rewards from neural_guided_symbolic_regression.mcts import states from neural_guided_symbolic_regression.models import metrics from neural_guided_symbolic_regression.models import partial_sequence_model_generator class NeuralProductionRuleAppendPolicy(policies.PolicyBase): """Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model. """ def __init__(self, sess, grammar, max_length, symbolic_properties_dict): """Initializer. Args: sess: tf.Session, the session contains the trained model to predict next production rule from input partial sequence. If None, each step will be selected randomly. grammar: arithmetic_grammar.Grammar object. max_length: Integer, the max length of production rule sequence. symbolic_properties_dict: Dict, the keys are the symbolic properties used as conditions. Values are the corresponding desired values of the symbolic properties. """ self._sess = sess self._grammar = grammar self._max_length = max_length conditions = {} if symbolic_properties_dict is not None: conditions.update({ key: np.array([value], dtype=np.float32) for key, value in symbolic_properties_dict.iteritems() }) self._conditions = conditions def get_new_states_probs(self, state): """Gets new state from current state by appending a valid production rule. Args: state: A mcts.states.ProductionRulesState object. Contains a list of nltk.grammar.Production objects in attribute production_rules_sequence. Returns: new_states: A list of next states. Each state is a result from apply an action in the instance attribute actions to the input state. action_probs: A float numpy array with shape [num_actions,]. The probability of each action in the class attribute actions. Raises: TypeError: If input state is not states.ProductionRulesState object. """ if not isinstance(state, states.ProductionRulesState): raise TypeError('Input state shoud be an instance of ' 'states.ProductionRulesState but got %s' % type(state)) production_rules_sequence = state.production_rules_sequence if len(production_rules_sequence) > self._max_length: # Do not allow the length of production rules sequence exceed _max_length. # All nan probabilities will stop the rollout in MCTS. masked_probabilities = [np.nan] * self._grammar.num_production_rules else: masked_probabilities = ( partial_sequence_model_generator.get_masked_probabilities_from_model( sess=self._sess, max_length=self._max_length, partial_sequence=[self._grammar.prod_rule_to_index[str(prod_rule)] for prod_rule in production_rules_sequence], next_production_rule_mask=self._grammar.masks[ self._grammar.lhs_to_index[state.stack_peek()]], conditions=self._conditions)) new_states = [] action_probs = [] for probability, production_rule in zip( masked_probabilities, self._grammar.prod_rules): if state.is_valid_to_append(production_rule): new_state = state.copy() new_state.append_production_rule(production_rule) new_states.append(new_state) action_probs.append(probability) else: new_states.append(None) action_probs.append(np.nan) action_probs = np.asarray(action_probs) action_probs /= np.nansum(action_probs) return new_states, action_probs class LeadingPowers(rewards.RewardBase): """Computes reward for univariate expression only on leading powers. This reward measures a univariate expression by whether this expression satisfies the desired leading powers at 0 and infinity. reward = -abs(leading power difference at 0) - abs(leading power difference at infinity)) """ def __init__( self, leading_at_0, leading_at_inf, variable_symbol='x', post_transformer=None, allow_nonterminal=False, default_value=None): """Initializer. Args: leading_at_0: Float, desired leading power at 0. leading_at_inf: Float, desired leading power at inf. variable_symbol: String, the symbol of variable in function expression. post_transformer: Callable. This function takes one float number and output a float number as the transformed value of input. It is used to post-transformation the reward evaluated on a state. Default None, no post-transformation will be applied. allow_nonterminal: Boolean, if False, ValueError will be raised when list of symbols to evaluate contains non-terminal symbol and default_value is None. Default False. default_value: Float, if allow_nonterminal is False and non-terminal symbol exists, instead of raising a ValueError, return default_value as the reward value. """ super(LeadingPowers, self).__init__( post_transformer=post_transformer, allow_nonterminal=allow_nonterminal, default_value=default_value) self._leading_at_0 = leading_at_0 self._leading_at_inf = leading_at_inf self._variable_symbol = variable_symbol def get_leading_power_error(self, state): """Gets the leading power error. The leading power error is defined as abs(leading power difference at 0) + abs(leading power difference at inf). Args: state: mcts.states.StateBase object. Records all the information of expression. Returns: Float. """ true_leading_at_0, true_leading_at_inf = ( metrics.evaluate_leading_powers_at_0_inf( expression_string=state.get_expression(), symbol=self._variable_symbol)) return (abs(true_leading_at_0 - self._leading_at_0) + abs(true_leading_at_inf - self._leading_at_inf)) def _evaluate(self, state): """Evaluates the reward from input state. Args: state: mcts.states.StateBase object. Records all the information of expression. Returns: Float, the reward of the current state. """ leading_power_error = self.get_leading_power_error(state) if np.isfinite(leading_power_error): return -float(leading_power_error) else: return self._default_value class NumericalPointsAndLeadingPowers(LeadingPowers): """Computes reward for univariate expression with leading powers and values. This reward measures an univariate expression in two aspects: 1. The mean square error of numerical values defined by input_values and output_values. 2. Whether this expression satisfies the desired leading powers at 0 and infinity. hard_penalty_default_value decides whether to use soft or hard penalty when the expression does not match the desired leading powers. Soft penalty reward = ( -(root mean square error) - abs(leading power difference at 0) - abs(leading power difference at infinity)) Hard penalty If leading power at 0 and infinity are both correct reward = -(root mean square error) Otherwise reward = hard_penalty_default_value If include_leading_powers is False, the reward is just -(root mean square error). """ def __init__( self, input_values, output_values, leading_at_0, leading_at_inf, hard_penalty_default_value=None, variable_symbol='x', include_leading_powers=True, post_transformer=None, allow_nonterminal=False, default_value=None): """Initializer. Args: input_values: Numpy array with shape [num_input_values]. List of input values to univariate function. output_values: Numpy array with shape [num_output_values]. List of output values from the univariate function. leading_at_0: Float, desired leading power at 0. leading_at_inf: Float, desired leading power at inf. hard_penalty_default_value: Float, the default value for hard penalty. Default None, the reward will be computed by soft penalty instead of hard penalty. variable_symbol: String, the symbol of variable in function expression. include_leading_powers: Boolean, whether to include leading powers in reward. post_transformer: Callable. This function takes one float number and output a float number as the transformed value of input. It is used to post-transformation the reward evaluated on a state. Default None, no post-transformation will be applied. allow_nonterminal: Boolean, if False, ValueError will be raised when list of symbols to evaluate contains non-terminal symbol and default_value is None. Default False. default_value: Float, if allow_nonterminal is False and non-terminal symbol exists, instead of raising a ValueError, return default_value as the reward value. """ super(NumericalPointsAndLeadingPowers, self).__init__( leading_at_0=leading_at_0, leading_at_inf=leading_at_inf, variable_symbol=variable_symbol, post_transformer=post_transformer, allow_nonterminal=allow_nonterminal, default_value=default_value) self._input_values = input_values self._output_values = output_values self._include_leading_powers = include_leading_powers self._hard_penalty_default_value = hard_penalty_default_value def get_input_values_rmse(self, state): """Evaluates root mean square error on input_values. Args: state: mcts.states.StateBase object. Records all the information of expression. Returns: Float. """ expression_output_values = metrics.evaluate_expression( expression_string=state.get_expression(), grids=self._input_values, symbol=self._variable_symbol) return np.sqrt( np.mean((expression_output_values - self._output_values) ** 2)) def _evaluate(self, state): """Evaluates the reward from input state. Args: state: mcts.states.StateBase object. Records all the information of expression. Returns: Float, the reward of the current state. """ input_values_rmse = self.get_input_values_rmse(state) if not self._include_leading_powers: if np.isfinite(input_values_rmse): return -input_values_rmse else: return self._default_value # NOTE(leeley): If computing the leading power fails # (timeout or sympy ValueError) or functions in symbolic_properties return # nan (for example, 1 / (x - x)). leading_power_error = self.get_leading_power_error(state) if self._hard_penalty_default_value is None: # Soft penalty. if np.isfinite(leading_power_error): return -input_values_rmse - leading_power_error else: return self._default_value else: # Hard penalty. if (np.isfinite(leading_power_error) and np.isclose(leading_power_error, 0)): return -input_values_rmse else: return self._hard_penalty_default_value
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 15069, 12131, 383, 3012, 4992, 46665, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 198, 198, 37811, 16742, 5408, 416, 22489, 40089, 12200, 11140, 17455, 416, 17019, 7686, 526, 15931, 198, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 17019, 62, 23657, 62, 1837, 2022, 4160, 62, 2301, 2234, 13, 76, 310, 82, 1330, 4788, 198, 6738, 17019, 62, 23657, 62, 1837, 2022, 4160, 62, 2301, 2234, 13, 76, 310, 82, 1330, 11530, 198, 6738, 17019, 62, 23657, 62, 1837, 2022, 4160, 62, 2301, 2234, 13, 76, 310, 82, 1330, 2585, 198, 6738, 17019, 62, 23657, 62, 1837, 2022, 4160, 62, 2301, 2234, 13, 27530, 1330, 20731, 198, 6738, 17019, 62, 23657, 62, 1837, 2022, 4160, 62, 2301, 2234, 13, 27530, 1330, 13027, 62, 43167, 62, 19849, 62, 8612, 1352, 628, 198, 4871, 47986, 35027, 31929, 4677, 437, 36727, 7, 79, 4160, 444, 13, 36727, 14881, 2599, 198, 220, 37227, 4677, 2412, 257, 4938, 3227, 3896, 319, 4683, 1351, 286, 3227, 3173, 13, 628, 220, 383, 39522, 286, 262, 4028, 481, 307, 5295, 416, 262, 13027, 8379, 198, 220, 2746, 13, 198, 220, 37227, 628, 220, 825, 11593, 15003, 834, 7, 944, 11, 264, 408, 11, 23491, 11, 3509, 62, 13664, 11, 18975, 62, 48310, 62, 11600, 2599, 198, 220, 220, 220, 37227, 24243, 7509, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 264, 408, 25, 48700, 13, 36044, 11, 262, 6246, 4909, 262, 8776, 2746, 284, 4331, 1306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3227, 3896, 422, 5128, 13027, 8379, 13, 1002, 6045, 11, 1123, 2239, 481, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 307, 6163, 15456, 13, 198, 220, 220, 220, 220, 220, 23491, 25, 34768, 62, 4546, 3876, 13, 38, 859, 3876, 2134, 13, 198, 220, 220, 220, 220, 220, 3509, 62, 13664, 25, 34142, 11, 262, 3509, 4129, 286, 3227, 3896, 8379, 13, 198, 220, 220, 220, 220, 220, 18975, 62, 48310, 62, 11600, 25, 360, 713, 11, 262, 8251, 389, 262, 18975, 6608, 973, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 355, 3403, 13, 27068, 389, 262, 11188, 10348, 3815, 286, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 18975, 6608, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 2116, 13557, 82, 408, 796, 264, 408, 198, 220, 220, 220, 2116, 13557, 4546, 3876, 796, 23491, 198, 220, 220, 220, 2116, 13557, 9806, 62, 13664, 796, 3509, 62, 13664, 628, 220, 220, 220, 3403, 796, 23884, 198, 220, 220, 220, 611, 18975, 62, 48310, 62, 11600, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 3403, 13, 19119, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1994, 25, 45941, 13, 18747, 26933, 8367, 4357, 288, 4906, 28, 37659, 13, 22468, 2624, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1994, 11, 1988, 287, 18975, 62, 48310, 62, 11600, 13, 2676, 23814, 3419, 198, 220, 220, 220, 220, 220, 32092, 198, 220, 220, 220, 2116, 13557, 17561, 1756, 796, 3403, 628, 220, 825, 651, 62, 3605, 62, 27219, 62, 1676, 1443, 7, 944, 11, 1181, 2599, 198, 220, 220, 220, 37227, 38, 1039, 649, 1181, 422, 1459, 1181, 416, 598, 1571, 257, 4938, 3227, 3896, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1181, 25, 317, 285, 310, 82, 13, 27219, 13, 35027, 37766, 9012, 2134, 13, 49850, 257, 1351, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 299, 2528, 74, 13, 4546, 3876, 13, 35027, 5563, 287, 11688, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3227, 62, 38785, 62, 43167, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 649, 62, 27219, 25, 317, 1351, 286, 1306, 2585, 13, 5501, 1181, 318, 257, 1255, 422, 4174, 281, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2223, 287, 262, 4554, 11688, 4028, 284, 262, 5128, 1181, 13, 198, 220, 220, 220, 220, 220, 2223, 62, 1676, 1443, 25, 317, 12178, 299, 32152, 7177, 351, 5485, 685, 22510, 62, 4658, 11, 4083, 383, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12867, 286, 1123, 2223, 287, 262, 1398, 11688, 4028, 13, 628, 220, 220, 220, 7567, 2696, 25, 198, 220, 220, 220, 220, 220, 5994, 12331, 25, 1002, 5128, 1181, 318, 407, 2585, 13, 35027, 37766, 9012, 2134, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 611, 407, 318, 39098, 7, 5219, 11, 2585, 13, 35027, 37766, 9012, 2599, 198, 220, 220, 220, 220, 220, 5298, 5994, 12331, 10786, 20560, 1181, 427, 2778, 307, 281, 4554, 286, 705, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 27219, 13, 35027, 37766, 9012, 475, 1392, 4064, 82, 6, 4064, 2099, 7, 5219, 4008, 628, 220, 220, 220, 3227, 62, 38785, 62, 43167, 796, 1181, 13, 25493, 62, 38785, 62, 43167, 198, 220, 220, 220, 611, 18896, 7, 25493, 62, 38785, 62, 43167, 8, 1875, 2116, 13557, 9806, 62, 13664, 25, 198, 220, 220, 220, 220, 220, 1303, 2141, 407, 1249, 262, 4129, 286, 3227, 3173, 8379, 7074, 4808, 9806, 62, 13664, 13, 198, 220, 220, 220, 220, 220, 1303, 1439, 15709, 39522, 481, 2245, 262, 38180, 287, 337, 4177, 50, 13, 198, 220, 220, 220, 220, 220, 29229, 62, 1676, 65, 5738, 796, 685, 37659, 13, 12647, 60, 1635, 2116, 13557, 4546, 3876, 13, 22510, 62, 25493, 62, 38785, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 29229, 62, 1676, 65, 5738, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13027, 62, 43167, 62, 19849, 62, 8612, 1352, 13, 1136, 62, 27932, 276, 62, 1676, 65, 5738, 62, 6738, 62, 19849, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 408, 28, 944, 13557, 82, 408, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 13664, 28, 944, 13557, 9806, 62, 13664, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13027, 62, 43167, 41888, 944, 13557, 4546, 3876, 13, 1676, 67, 62, 25135, 62, 1462, 62, 9630, 58, 2536, 7, 1676, 67, 62, 25135, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 40426, 62, 25135, 287, 3227, 62, 38785, 62, 43167, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1306, 62, 25493, 62, 25135, 62, 27932, 28, 944, 13557, 4546, 3876, 13, 5356, 591, 58, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 4546, 3876, 13, 75, 11994, 62, 1462, 62, 9630, 58, 5219, 13, 25558, 62, 431, 988, 3419, 60, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3403, 28, 944, 13557, 17561, 1756, 4008, 628, 220, 220, 220, 649, 62, 27219, 796, 17635, 198, 220, 220, 220, 2223, 62, 1676, 1443, 796, 17635, 198, 220, 220, 220, 329, 12867, 11, 3227, 62, 25135, 287, 19974, 7, 198, 220, 220, 220, 220, 220, 220, 220, 29229, 62, 1676, 65, 5738, 11, 2116, 13557, 4546, 3876, 13, 1676, 67, 62, 38785, 2599, 198, 220, 220, 220, 220, 220, 611, 1181, 13, 271, 62, 12102, 62, 1462, 62, 33295, 7, 25493, 62, 25135, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 5219, 796, 1181, 13, 30073, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 5219, 13, 33295, 62, 25493, 62, 25135, 7, 25493, 62, 25135, 8, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 27219, 13, 33295, 7, 3605, 62, 5219, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2223, 62, 1676, 1443, 13, 33295, 7, 1676, 65, 1799, 8, 198, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 27219, 13, 33295, 7, 14202, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2223, 62, 1676, 1443, 13, 33295, 7, 37659, 13, 12647, 8, 198, 220, 220, 220, 2223, 62, 1676, 1443, 796, 45941, 13, 292, 18747, 7, 2673, 62, 1676, 1443, 8, 198, 220, 220, 220, 2223, 62, 1676, 1443, 1220, 28, 45941, 13, 77, 504, 388, 7, 2673, 62, 1676, 1443, 8, 198, 220, 220, 220, 1441, 649, 62, 27219, 11, 2223, 62, 1676, 1443, 628, 198, 4871, 43225, 47, 3618, 7, 260, 2017, 13, 48123, 14881, 2599, 198, 220, 37227, 7293, 1769, 6721, 329, 555, 42524, 5408, 691, 319, 3756, 5635, 13, 628, 220, 770, 6721, 5260, 257, 555, 42524, 5408, 416, 1771, 428, 5408, 198, 220, 45104, 262, 10348, 3756, 5635, 379, 657, 290, 37174, 13, 628, 220, 6721, 796, 532, 8937, 7, 12294, 1176, 3580, 379, 657, 8, 198, 220, 220, 220, 220, 220, 532, 2352, 7, 12294, 1176, 3580, 379, 37174, 4008, 198, 220, 37227, 628, 220, 825, 11593, 15003, 834, 7, 198, 220, 220, 220, 220, 220, 2116, 11, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 15, 11, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 10745, 11, 198, 220, 220, 220, 220, 220, 7885, 62, 1837, 23650, 11639, 87, 3256, 198, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 4277, 62, 8367, 28, 14202, 2599, 198, 220, 220, 220, 37227, 24243, 7509, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 15, 25, 48436, 11, 10348, 3756, 1176, 379, 657, 13, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 10745, 25, 48436, 11, 10348, 3756, 1176, 379, 1167, 13, 198, 220, 220, 220, 220, 220, 7885, 62, 1837, 23650, 25, 10903, 11, 262, 6194, 286, 7885, 287, 2163, 5408, 13, 198, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 25, 4889, 540, 13, 770, 2163, 2753, 530, 12178, 1271, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5072, 257, 12178, 1271, 355, 262, 14434, 1988, 286, 5128, 13, 632, 318, 973, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 284, 1281, 12, 7645, 1161, 262, 6721, 16726, 319, 257, 1181, 13, 15161, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 645, 1281, 12, 7645, 1161, 481, 307, 5625, 13, 198, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 25, 41146, 11, 611, 10352, 11, 11052, 12331, 481, 307, 4376, 618, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1351, 286, 14354, 284, 13446, 4909, 1729, 12, 23705, 282, 6194, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 62, 8367, 318, 6045, 13, 15161, 10352, 13, 198, 220, 220, 220, 220, 220, 4277, 62, 8367, 25, 48436, 11, 611, 1249, 62, 13159, 23705, 282, 318, 10352, 290, 1729, 12, 23705, 282, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6194, 7160, 11, 2427, 286, 8620, 257, 11052, 12331, 11, 1441, 4277, 62, 8367, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 355, 262, 6721, 1988, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 2208, 7, 20451, 278, 47, 3618, 11, 2116, 737, 834, 15003, 834, 7, 198, 220, 220, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 28, 7353, 62, 7645, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 28, 12154, 62, 13159, 23705, 282, 11, 198, 220, 220, 220, 220, 220, 220, 220, 4277, 62, 8367, 28, 12286, 62, 8367, 8, 198, 220, 220, 220, 2116, 13557, 12294, 62, 265, 62, 15, 796, 3756, 62, 265, 62, 15, 198, 220, 220, 220, 2116, 13557, 12294, 62, 265, 62, 10745, 796, 3756, 62, 265, 62, 10745, 198, 220, 220, 220, 2116, 13557, 45286, 62, 1837, 23650, 796, 7885, 62, 1837, 23650, 628, 220, 825, 651, 62, 12294, 62, 6477, 62, 18224, 7, 944, 11, 1181, 2599, 198, 220, 220, 220, 37227, 38, 1039, 262, 3756, 1176, 4049, 13, 628, 220, 220, 220, 383, 3756, 1176, 4049, 318, 5447, 355, 198, 220, 220, 220, 2352, 7, 12294, 1176, 3580, 379, 657, 8, 1343, 2352, 7, 12294, 1176, 3580, 379, 1167, 737, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1181, 25, 285, 310, 82, 13, 27219, 13, 9012, 14881, 2134, 13, 13407, 477, 262, 1321, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5408, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 48436, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 2081, 62, 12294, 62, 265, 62, 15, 11, 2081, 62, 12294, 62, 265, 62, 10745, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 20731, 13, 49786, 62, 12294, 62, 30132, 62, 265, 62, 15, 62, 10745, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5408, 62, 8841, 28, 5219, 13, 1136, 62, 38011, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6194, 28, 944, 13557, 45286, 62, 1837, 23650, 4008, 628, 220, 220, 220, 1441, 357, 8937, 7, 7942, 62, 12294, 62, 265, 62, 15, 532, 2116, 13557, 12294, 62, 265, 62, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 2352, 7, 7942, 62, 12294, 62, 265, 62, 10745, 532, 2116, 13557, 12294, 62, 265, 62, 10745, 4008, 628, 220, 825, 4808, 49786, 7, 944, 11, 1181, 2599, 198, 220, 220, 220, 37227, 36, 2100, 12632, 262, 6721, 422, 5128, 1181, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1181, 25, 285, 310, 82, 13, 27219, 13, 9012, 14881, 2134, 13, 13407, 477, 262, 1321, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5408, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 48436, 11, 262, 6721, 286, 262, 1459, 1181, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 3756, 62, 6477, 62, 18224, 796, 2116, 13, 1136, 62, 12294, 62, 6477, 62, 18224, 7, 5219, 8, 198, 220, 220, 220, 611, 45941, 13, 4468, 9504, 7, 12294, 62, 6477, 62, 18224, 2599, 198, 220, 220, 220, 220, 220, 1441, 532, 22468, 7, 12294, 62, 6477, 62, 18224, 8, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 1441, 2116, 13557, 12286, 62, 8367, 628, 198, 4871, 399, 6975, 605, 40710, 1870, 20451, 278, 47, 3618, 7, 20451, 278, 47, 3618, 2599, 198, 220, 37227, 7293, 1769, 6721, 329, 555, 42524, 5408, 351, 3756, 5635, 290, 3815, 13, 628, 220, 770, 6721, 5260, 281, 555, 42524, 5408, 287, 734, 7612, 25, 198, 220, 352, 13, 383, 1612, 6616, 4049, 286, 29052, 3815, 5447, 416, 5128, 62, 27160, 290, 198, 220, 220, 220, 220, 5072, 62, 27160, 13, 198, 220, 362, 13, 10127, 428, 5408, 45104, 262, 10348, 3756, 5635, 379, 657, 290, 198, 220, 220, 220, 220, 37174, 13, 628, 220, 1327, 62, 3617, 6017, 62, 12286, 62, 8367, 13267, 1771, 284, 779, 2705, 393, 1327, 7389, 618, 198, 220, 262, 5408, 857, 407, 2872, 262, 10348, 3756, 5635, 13, 628, 220, 8297, 7389, 198, 220, 220, 220, 6721, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 532, 7, 15763, 1612, 6616, 4049, 8, 198, 220, 220, 220, 220, 220, 220, 220, 532, 2352, 7, 12294, 1176, 3580, 379, 657, 8, 198, 220, 220, 220, 220, 220, 220, 220, 532, 2352, 7, 12294, 1176, 3580, 379, 37174, 4008, 628, 220, 6912, 7389, 198, 220, 220, 220, 1002, 3756, 1176, 379, 657, 290, 37174, 389, 1111, 3376, 198, 220, 220, 220, 220, 220, 6721, 796, 532, 7, 15763, 1612, 6616, 4049, 8, 198, 220, 220, 220, 15323, 6721, 796, 1327, 62, 3617, 6017, 62, 12286, 62, 8367, 628, 220, 1002, 2291, 62, 12294, 62, 30132, 318, 10352, 11, 262, 6721, 318, 655, 198, 220, 532, 7, 15763, 1612, 6616, 4049, 737, 198, 220, 37227, 628, 220, 825, 11593, 15003, 834, 7, 198, 220, 220, 220, 220, 220, 2116, 11, 198, 220, 220, 220, 220, 220, 5128, 62, 27160, 11, 198, 220, 220, 220, 220, 220, 5072, 62, 27160, 11, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 15, 11, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 10745, 11, 198, 220, 220, 220, 220, 220, 1327, 62, 3617, 6017, 62, 12286, 62, 8367, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 7885, 62, 1837, 23650, 11639, 87, 3256, 198, 220, 220, 220, 220, 220, 2291, 62, 12294, 62, 30132, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 4277, 62, 8367, 28, 14202, 2599, 198, 220, 220, 220, 37227, 24243, 7509, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 5128, 62, 27160, 25, 399, 32152, 7177, 351, 5485, 685, 22510, 62, 15414, 62, 27160, 4083, 7343, 286, 5128, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 284, 555, 42524, 2163, 13, 198, 220, 220, 220, 220, 220, 5072, 62, 27160, 25, 399, 32152, 7177, 351, 5485, 685, 22510, 62, 22915, 62, 27160, 4083, 7343, 286, 5072, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 422, 262, 555, 42524, 2163, 13, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 15, 25, 48436, 11, 10348, 3756, 1176, 379, 657, 13, 198, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 10745, 25, 48436, 11, 10348, 3756, 1176, 379, 1167, 13, 198, 220, 220, 220, 220, 220, 1327, 62, 3617, 6017, 62, 12286, 62, 8367, 25, 48436, 11, 262, 4277, 1988, 329, 1327, 7389, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15161, 6045, 11, 262, 6721, 481, 307, 29231, 416, 2705, 7389, 2427, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1327, 7389, 13, 198, 220, 220, 220, 220, 220, 7885, 62, 1837, 23650, 25, 10903, 11, 262, 6194, 286, 7885, 287, 2163, 5408, 13, 198, 220, 220, 220, 220, 220, 2291, 62, 12294, 62, 30132, 25, 41146, 11, 1771, 284, 2291, 3756, 5635, 287, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6721, 13, 198, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 25, 4889, 540, 13, 770, 2163, 2753, 530, 12178, 1271, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5072, 257, 12178, 1271, 355, 262, 14434, 1988, 286, 5128, 13, 632, 318, 973, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 284, 1281, 12, 7645, 1161, 262, 6721, 16726, 319, 257, 1181, 13, 15161, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 645, 1281, 12, 7645, 1161, 481, 307, 5625, 13, 198, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 25, 41146, 11, 611, 10352, 11, 11052, 12331, 481, 307, 4376, 618, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1351, 286, 14354, 284, 13446, 4909, 1729, 12, 23705, 282, 6194, 290, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4277, 62, 8367, 318, 6045, 13, 15161, 10352, 13, 198, 220, 220, 220, 220, 220, 4277, 62, 8367, 25, 48436, 11, 611, 1249, 62, 13159, 23705, 282, 318, 10352, 290, 1729, 12, 23705, 282, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6194, 7160, 11, 2427, 286, 8620, 257, 11052, 12331, 11, 1441, 4277, 62, 8367, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 355, 262, 6721, 1988, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 2208, 7, 45, 6975, 605, 40710, 1870, 20451, 278, 47, 3618, 11, 2116, 737, 834, 15003, 834, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 15, 28, 12294, 62, 265, 62, 15, 11, 198, 220, 220, 220, 220, 220, 220, 220, 3756, 62, 265, 62, 10745, 28, 12294, 62, 265, 62, 10745, 11, 198, 220, 220, 220, 220, 220, 220, 220, 7885, 62, 1837, 23650, 28, 45286, 62, 1837, 23650, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1281, 62, 7645, 16354, 28, 7353, 62, 7645, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1249, 62, 13159, 23705, 282, 28, 12154, 62, 13159, 23705, 282, 11, 198, 220, 220, 220, 220, 220, 220, 220, 4277, 62, 8367, 28, 12286, 62, 8367, 8, 198, 220, 220, 220, 2116, 13557, 15414, 62, 27160, 796, 5128, 62, 27160, 198, 220, 220, 220, 2116, 13557, 22915, 62, 27160, 796, 5072, 62, 27160, 198, 220, 220, 220, 2116, 13557, 17256, 62, 12294, 62, 30132, 796, 2291, 62, 12294, 62, 30132, 198, 220, 220, 220, 2116, 13557, 10424, 62, 3617, 6017, 62, 12286, 62, 8367, 796, 1327, 62, 3617, 6017, 62, 12286, 62, 8367, 628, 220, 825, 651, 62, 15414, 62, 27160, 62, 26224, 325, 7, 944, 11, 1181, 2599, 198, 220, 220, 220, 37227, 36, 2100, 12632, 6808, 1612, 6616, 4049, 319, 5128, 62, 27160, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1181, 25, 285, 310, 82, 13, 27219, 13, 9012, 14881, 2134, 13, 13407, 477, 262, 1321, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5408, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 48436, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5408, 62, 22915, 62, 27160, 796, 20731, 13, 49786, 62, 38011, 7, 198, 220, 220, 220, 220, 220, 220, 220, 5408, 62, 8841, 28, 5219, 13, 1136, 62, 38011, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 50000, 28, 944, 13557, 15414, 62, 27160, 11, 198, 220, 220, 220, 220, 220, 220, 220, 6194, 28, 944, 13557, 45286, 62, 1837, 23650, 8, 628, 220, 220, 220, 1441, 45941, 13, 31166, 17034, 7, 198, 220, 220, 220, 220, 220, 220, 220, 45941, 13, 32604, 19510, 38011, 62, 22915, 62, 27160, 532, 2116, 13557, 22915, 62, 27160, 8, 12429, 362, 4008, 628, 220, 825, 4808, 49786, 7, 944, 11, 1181, 2599, 198, 220, 220, 220, 37227, 36, 2100, 12632, 262, 6721, 422, 5128, 1181, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 1181, 25, 285, 310, 82, 13, 27219, 13, 9012, 14881, 2134, 13, 13407, 477, 262, 1321, 286, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5408, 13, 628, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 48436, 11, 262, 6721, 286, 262, 1459, 1181, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5128, 62, 27160, 62, 26224, 325, 796, 2116, 13, 1136, 62, 15414, 62, 27160, 62, 26224, 325, 7, 5219, 8, 198, 220, 220, 220, 611, 407, 2116, 13557, 17256, 62, 12294, 62, 30132, 25, 198, 220, 220, 220, 220, 220, 611, 45941, 13, 4468, 9504, 7, 15414, 62, 27160, 62, 26224, 325, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 532, 15414, 62, 27160, 62, 26224, 325, 198, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 12286, 62, 8367, 198, 220, 220, 220, 1303, 24550, 7, 7197, 1636, 2599, 1002, 14492, 262, 3756, 1176, 10143, 198, 220, 220, 220, 1303, 357, 48678, 393, 10558, 88, 11052, 12331, 8, 393, 5499, 287, 18975, 62, 48310, 1441, 198, 220, 220, 220, 1303, 15709, 357, 1640, 1672, 11, 352, 1220, 357, 87, 532, 2124, 29720, 198, 220, 220, 220, 3756, 62, 6477, 62, 18224, 796, 2116, 13, 1136, 62, 12294, 62, 6477, 62, 18224, 7, 5219, 8, 628, 220, 220, 220, 611, 2116, 13557, 10424, 62, 3617, 6017, 62, 12286, 62, 8367, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 1303, 8297, 7389, 13, 198, 220, 220, 220, 220, 220, 611, 45941, 13, 4468, 9504, 7, 12294, 62, 6477, 62, 18224, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 532, 15414, 62, 27160, 62, 26224, 325, 532, 3756, 62, 6477, 62, 18224, 198, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 12286, 62, 8367, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 1303, 6912, 7389, 13, 198, 220, 220, 220, 220, 220, 611, 357, 37659, 13, 4468, 9504, 7, 12294, 62, 6477, 62, 18224, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 45941, 13, 271, 19836, 7, 12294, 62, 6477, 62, 18224, 11, 657, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 532, 15414, 62, 27160, 62, 26224, 325, 198, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13557, 10424, 62, 3617, 6017, 62, 12286, 62, 8367, 198 ]
2.817932
4,361
from .pytransform import pyarmor_runtime pyarmor_runtime() __pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x09\x00\x61\x0d\x0d\x0a\x08\x2d\xa0\x01\x00\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x18\x3d\x71\xc5\x03\x9e\x68\x9a\xa0\x37\x72\x21\xef\xad\x8a\xf4\x10\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x8c\x82\x42\x16\x77\xe5\x90\x93\xcb\xad\x1f\x2f\x25\x62\x6c\xf5\x02\xd8\xd5\xa2\x5e\x70\x77\xac\xd7\x78\x2f\xbe\x60\x40\x8f\x2b\x57\x02\x4f\xa0\x4f\xb9\x5f\x3f\x67\x56\x7c\x8c\x15\x95\x26\xdf\xaf\x5d\x30\xf2\xbc\x4b\x06\x6d\x66\x77\x1d\xf1\xd6\x67\x18\x5f\xe5\x7f\x4a\x8d\x4e\x82\x97\x42\x19\xfa\xff\x42\xe3\x1b\xe7\xa1\x36\x46\x2b\x63\x0b\x2b\x4a\x53\x6e\x1b\x06\xf1\x8d\xc9\xf5\x16\x5c\xcd\xd0\xc8\xd3\xaf\x08\x86\x5e\x20\xc7\xad\x33\x4a\x8c\x06\x71\x4d\x9a\x1e\xbe\xa7\xe8\x08\x3f\xf1\x6b\x6e\x54\x4e\x6f\x4b\xe3\x3b\x98\x9a\x2a\x3a\x01\xfa\x52\xc3\xf6\x64\x3c\xeb\xa6\xbf\x4c\xb6\x5e\xf4\x59\x40\xd3\xb9\x02\x01\x63\x0f\xa8\x5a\x9f\x60\x26\xc4\xdc\xa6\xb6\xe6\xf8\xac\xea\xaa\x04\xa4\x23\x1a\x50\xb2\x67\x91\xf9\xee\xed\xbc\x35\x18\xff\x1f\x5a\xab\x0b\xbe\x95\xc6\x72\x12\x2d\x31\xf9\x4a\x52\x60\x1f\x42\x0f\x5d\xcc\xf1\x4c\xa0\xed\xc5\x2b\x49\x68\x71\xa4\x0f\x7b\x76\x16\x50\xe6\xdb\x83\xd7\x2f\xc4\x57\xc7\x12\x02\x30\xc8\xef\xe8\x38\xf6', 2)
[ 6738, 764, 9078, 35636, 1330, 12972, 40456, 62, 43282, 198, 9078, 40456, 62, 43282, 3419, 198, 834, 9078, 40456, 834, 7, 834, 3672, 834, 11, 11593, 7753, 834, 11, 275, 6, 59, 87, 1120, 59, 87, 3270, 59, 87, 3901, 59, 87, 4309, 59, 87, 19, 67, 59, 87, 19, 69, 59, 87, 4309, 59, 87, 405, 59, 87, 405, 59, 87, 3070, 59, 87, 2931, 59, 87, 405, 59, 87, 5333, 59, 87, 15, 67, 59, 87, 15, 67, 59, 87, 15, 64, 59, 87, 2919, 59, 87, 17, 67, 59, 27865, 15, 59, 87, 486, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 486, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 1821, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 276, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 1507, 59, 87, 18, 67, 59, 87, 4869, 59, 25306, 20, 59, 87, 3070, 59, 87, 24, 68, 59, 87, 3104, 59, 87, 24, 64, 59, 27865, 15, 59, 87, 2718, 59, 87, 4761, 59, 87, 2481, 59, 87, 891, 59, 87, 324, 59, 87, 23, 64, 59, 26152, 19, 59, 87, 940, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 87, 405, 59, 30894, 19, 59, 87, 23, 66, 59, 87, 6469, 59, 87, 3682, 59, 87, 1433, 59, 87, 3324, 59, 27705, 20, 59, 87, 3829, 59, 87, 6052, 59, 87, 21101, 59, 87, 324, 59, 87, 16, 69, 59, 87, 17, 69, 59, 87, 1495, 59, 87, 5237, 59, 87, 21, 66, 59, 26152, 20, 59, 87, 2999, 59, 24954, 23, 59, 24954, 20, 59, 27865, 17, 59, 87, 20, 68, 59, 87, 2154, 59, 87, 3324, 59, 87, 330, 59, 24954, 22, 59, 87, 3695, 59, 87, 17, 69, 59, 87, 1350, 59, 87, 1899, 59, 87, 1821, 59, 87, 23, 69, 59, 87, 17, 65, 59, 87, 3553, 59, 87, 2999, 59, 87, 19, 69, 59, 27865, 15, 59, 87, 19, 69, 59, 30894, 24, 59, 87, 20, 69, 59, 87, 18, 69, 59, 87, 3134, 59, 87, 3980, 59, 87, 22, 66, 59, 87, 23, 66, 59, 87, 1314, 59, 87, 3865, 59, 87, 2075, 59, 87, 7568, 59, 87, 1878, 59, 87, 20, 67, 59, 87, 1270, 59, 26152, 17, 59, 87, 15630, 59, 87, 19, 65, 59, 87, 3312, 59, 87, 21, 67, 59, 87, 2791, 59, 87, 3324, 59, 87, 16, 67, 59, 26152, 16, 59, 24954, 21, 59, 87, 3134, 59, 87, 1507, 59, 87, 20, 69, 59, 27705, 20, 59, 87, 22, 69, 59, 87, 19, 64, 59, 87, 23, 67, 59, 87, 19, 68, 59, 87, 6469, 59, 87, 5607, 59, 87, 3682, 59, 87, 1129, 59, 87, 13331, 59, 47596, 59, 87, 3682, 59, 27705, 18, 59, 87, 16, 65, 59, 27705, 22, 59, 27865, 16, 59, 87, 2623, 59, 87, 3510, 59, 87, 17, 65, 59, 87, 5066, 59, 87, 15, 65, 59, 87, 17, 65, 59, 87, 19, 64, 59, 87, 4310, 59, 87, 21, 68, 59, 87, 16, 65, 59, 87, 3312, 59, 26152, 16, 59, 87, 23, 67, 59, 25306, 24, 59, 26152, 20, 59, 87, 1433, 59, 87, 20, 66, 59, 87, 10210, 59, 24954, 15, 59, 25306, 23, 59, 24954, 18, 59, 87, 1878, 59, 87, 2919, 59, 87, 4521, 59, 87, 20, 68, 59, 87, 1238, 59, 25306, 22, 59, 87, 324, 59, 87, 2091, 59, 87, 19, 64, 59, 87, 23, 66, 59, 87, 3312, 59, 87, 4869, 59, 87, 19, 67, 59, 87, 24, 64, 59, 87, 16, 68, 59, 87, 1350, 59, 27865, 22, 59, 27705, 23, 59, 87, 2919, 59, 87, 18, 69, 59, 26152, 16, 59, 87, 21, 65, 59, 87, 21, 68, 59, 87, 4051, 59, 87, 19, 68, 59, 87, 21, 69, 59, 87, 19, 65, 59, 27705, 18, 59, 87, 18, 65, 59, 87, 4089, 59, 87, 24, 64, 59, 87, 17, 64, 59, 87, 18, 64, 59, 87, 486, 59, 87, 13331, 59, 87, 4309, 59, 25306, 18, 59, 26152, 21, 59, 87, 2414, 59, 87, 18, 66, 59, 87, 1765, 59, 27865, 21, 59, 87, 19881, 59, 87, 19, 66, 59, 30894, 21, 59, 87, 20, 68, 59, 26152, 19, 59, 87, 3270, 59, 87, 1821, 59, 24954, 18, 59, 30894, 24, 59, 87, 2999, 59, 87, 486, 59, 87, 5066, 59, 87, 15, 69, 59, 27865, 23, 59, 87, 20, 64, 59, 87, 24, 69, 59, 87, 1899, 59, 87, 2075, 59, 25306, 19, 59, 87, 17896, 59, 27865, 21, 59, 30894, 21, 59, 27705, 21, 59, 26152, 23, 59, 87, 330, 59, 87, 18213, 59, 87, 7252, 59, 87, 3023, 59, 27865, 19, 59, 87, 1954, 59, 87, 16, 64, 59, 87, 1120, 59, 30894, 17, 59, 87, 3134, 59, 87, 6420, 59, 26152, 24, 59, 87, 1453, 59, 87, 276, 59, 87, 15630, 59, 87, 2327, 59, 87, 1507, 59, 47596, 59, 87, 16, 69, 59, 87, 20, 64, 59, 87, 397, 59, 87, 15, 65, 59, 87, 1350, 59, 87, 3865, 59, 25306, 21, 59, 87, 4761, 59, 87, 1065, 59, 87, 17, 67, 59, 87, 3132, 59, 26152, 24, 59, 87, 19, 64, 59, 87, 4309, 59, 87, 1899, 59, 87, 16, 69, 59, 87, 3682, 59, 87, 15, 69, 59, 87, 20, 67, 59, 87, 535, 59, 26152, 16, 59, 87, 19, 66, 59, 27865, 15, 59, 87, 276, 59, 25306, 20, 59, 87, 17, 65, 59, 87, 2920, 59, 87, 3104, 59, 87, 4869, 59, 27865, 19, 59, 87, 15, 69, 59, 87, 22, 65, 59, 87, 4304, 59, 87, 1433, 59, 87, 1120, 59, 27705, 21, 59, 87, 9945, 59, 87, 5999, 59, 24954, 22, 59, 87, 17, 69, 59, 25306, 19, 59, 87, 3553, 59, 25306, 22, 59, 87, 1065, 59, 87, 2999, 59, 87, 1270, 59, 25306, 23, 59, 87, 891, 59, 27705, 23, 59, 87, 2548, 59, 26152, 21, 3256, 362, 8 ]
1.285291
1,013
# -*- coding: utf-8 -*- ''' :codeauthor: Rupesh Tare <[email protected]> ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipIf from tests.support.mock import ( patch, NO_MOCK, NO_MOCK_REASON ) # Import Salt Libs import salt.modules.mine as mine @skipIf(NO_MOCK, NO_MOCK_REASON) class MineTestCase(TestCase, LoaderModuleMockMixin): ''' Test cases for salt.modules.mine ''' def test_get_docker(self): ''' Test for Get all mine data for 'docker.ps' and run an aggregation. ''' ps_response = { 'localhost': { 'host': { 'interfaces': { 'docker0': { 'hwaddr': '88:99:00:00:99:99', 'inet': [{'address': '172.17.42.1', 'broadcast': None, 'label': 'docker0', 'netmask': '255.255.0.0'}], 'inet6': [{'address': 'ffff::eeee:aaaa:bbbb:8888', 'prefixlen': '64'}], 'up': True}, 'eth0': {'hwaddr': '88:99:00:99:99:99', 'inet': [{'address': '192.168.0.1', 'broadcast': '192.168.0.255', 'label': 'eth0', 'netmask': '255.255.255.0'}], 'inet6': [{'address': 'ffff::aaaa:aaaa:bbbb:8888', 'prefixlen': '64'}], 'up': True}, }}, 'abcdefhjhi1234567899': { # container Id 'Ports': [{'IP': '0.0.0.0', # we bind on every interfaces 'PrivatePort': 80, 'PublicPort': 80, 'Type': 'tcp'}], 'Image': 'image:latest', 'Info': {'Id': 'abcdefhjhi1234567899'}, }, }} with patch.object(mine, 'get', return_value=ps_response): ret = mine.get_docker() # Sort ifaces since that will change between py2 and py3 ret['image:latest']['ipv4'][80] = sorted(ret['image:latest']['ipv4'][80]) self.assertEqual(ret, {'image:latest': { 'ipv4': {80: sorted([ '172.17.42.1:80', '192.168.0.1:80', ])}}}) def test_get_docker_with_container_id(self): ''' Test for Get all mine data for 'docker.ps' and run an aggregation. ''' ps_response = { 'localhost': { 'host': { 'interfaces': { 'docker0': { 'hwaddr': '88:99:00:00:99:99', 'inet': [{'address': '172.17.42.1', 'broadcast': None, 'label': 'docker0', 'netmask': '255.255.0.0'}], 'inet6': [{'address': 'ffff::eeee:aaaa:bbbb:8888', 'prefixlen': '64'}], 'up': True}, 'eth0': {'hwaddr': '88:99:00:99:99:99', 'inet': [{'address': '192.168.0.1', 'broadcast': '192.168.0.255', 'label': 'eth0', 'netmask': '255.255.255.0'}], 'inet6': [{'address': 'ffff::aaaa:aaaa:bbbb:8888', 'prefixlen': '64'}], 'up': True}, }}, 'abcdefhjhi1234567899': { # container Id 'Ports': [{'IP': '0.0.0.0', # we bind on every interfaces 'PrivatePort': 80, 'PublicPort': 80, 'Type': 'tcp'}], 'Image': 'image:latest', 'Info': {'Id': 'abcdefhjhi1234567899'}, }, }} with patch.object(mine, 'get', return_value=ps_response): ret = mine.get_docker(with_container_id=True) # Sort ifaces since that will change between py2 and py3 ret['image:latest']['ipv4'][80] = sorted(ret['image:latest']['ipv4'][80]) self.assertEqual(ret, {'image:latest': { 'ipv4': {80: sorted([ ('172.17.42.1:80', 'abcdefhjhi1234567899'), ('192.168.0.1:80', 'abcdefhjhi1234567899'), ])}}})
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 7061, 6, 198, 220, 220, 220, 1058, 8189, 9800, 25, 371, 929, 5069, 309, 533, 1279, 622, 12272, 4352, 31, 82, 2501, 25558, 13, 785, 29, 198, 7061, 6, 198, 198, 2, 17267, 11361, 7980, 82, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 198, 2, 17267, 13754, 23983, 7980, 82, 198, 6738, 5254, 13, 11284, 13, 19816, 1040, 1330, 8778, 263, 26796, 44, 735, 35608, 259, 198, 6738, 5254, 13, 11284, 13, 20850, 1330, 6208, 20448, 11, 14267, 1532, 198, 6738, 5254, 13, 11284, 13, 76, 735, 1330, 357, 198, 220, 220, 220, 8529, 11, 198, 220, 220, 220, 8005, 62, 44, 11290, 11, 198, 220, 220, 220, 8005, 62, 44, 11290, 62, 2200, 36033, 198, 8, 198, 198, 2, 17267, 13754, 7980, 82, 198, 11748, 8268, 13, 18170, 13, 3810, 355, 6164, 628, 198, 31, 48267, 1532, 7, 15285, 62, 44, 11290, 11, 8005, 62, 44, 11290, 62, 2200, 36033, 8, 198, 4871, 11517, 14402, 20448, 7, 14402, 20448, 11, 8778, 263, 26796, 44, 735, 35608, 259, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 6208, 2663, 329, 8268, 13, 18170, 13, 3810, 198, 220, 220, 220, 705, 7061, 628, 220, 220, 220, 825, 1332, 62, 1136, 62, 45986, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 6208, 329, 3497, 477, 6164, 1366, 329, 705, 45986, 13, 862, 6, 290, 1057, 281, 198, 220, 220, 220, 220, 220, 220, 220, 46500, 13, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 26692, 62, 26209, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36750, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 4774, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3849, 32186, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 45986, 15, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36599, 29851, 10354, 705, 3459, 25, 2079, 25, 405, 25, 405, 25, 2079, 25, 2079, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 10354, 685, 90, 6, 21975, 10354, 705, 23628, 13, 1558, 13, 3682, 13, 16, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36654, 2701, 10354, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18242, 10354, 705, 45986, 15, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3262, 27932, 10354, 705, 13381, 13, 13381, 13, 15, 13, 15, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 21, 10354, 685, 90, 6, 21975, 10354, 705, 12927, 3712, 41591, 25, 24794, 25, 11848, 11848, 25, 3459, 3459, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 40290, 11925, 10354, 705, 2414, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 929, 10354, 6407, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 2788, 15, 10354, 1391, 6, 36599, 29851, 10354, 705, 3459, 25, 2079, 25, 405, 25, 2079, 25, 2079, 25, 2079, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 10354, 685, 90, 6, 21975, 10354, 705, 17477, 13, 14656, 13, 15, 13, 16, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36654, 2701, 10354, 705, 17477, 13, 14656, 13, 15, 13, 13381, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18242, 10354, 705, 2788, 15, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3262, 27932, 10354, 705, 13381, 13, 13381, 13, 13381, 13, 15, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 21, 10354, 685, 90, 6, 21975, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 12927, 3712, 24794, 25, 24794, 25, 11848, 11848, 25, 3459, 3459, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 40290, 11925, 10354, 705, 2414, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 929, 10354, 6407, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1782, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 10354, 1391, 220, 1303, 9290, 5121, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 47, 2096, 10354, 685, 90, 6, 4061, 10354, 705, 15, 13, 15, 13, 15, 13, 15, 3256, 220, 1303, 356, 11007, 319, 790, 20314, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 29067, 13924, 10354, 4019, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 15202, 13924, 10354, 4019, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 6030, 10354, 705, 83, 13155, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 5159, 10354, 705, 9060, 25, 42861, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 12360, 10354, 1391, 6, 7390, 10354, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 6, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34949, 198, 220, 220, 220, 220, 220, 220, 220, 351, 8529, 13, 15252, 7, 3810, 11, 705, 1136, 3256, 1441, 62, 8367, 28, 862, 62, 26209, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1005, 796, 6164, 13, 1136, 62, 45986, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 33947, 611, 2114, 1201, 326, 481, 1487, 1022, 12972, 17, 290, 12972, 18, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1005, 17816, 9060, 25, 42861, 6, 7131, 6, 541, 85, 19, 6, 7131, 1795, 60, 796, 23243, 7, 1186, 17816, 9060, 25, 42861, 6, 7131, 6, 541, 85, 19, 6, 7131, 1795, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 1186, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1391, 6, 9060, 25, 42861, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 541, 85, 19, 10354, 1391, 1795, 25, 23243, 26933, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 23628, 13, 1558, 13, 3682, 13, 16, 25, 1795, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 17477, 13, 14656, 13, 15, 13, 16, 25, 1795, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 33761, 11709, 30072, 628, 220, 220, 220, 825, 1332, 62, 1136, 62, 45986, 62, 4480, 62, 34924, 62, 312, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 6208, 329, 3497, 477, 6164, 1366, 329, 705, 45986, 13, 862, 6, 290, 1057, 281, 198, 220, 220, 220, 220, 220, 220, 220, 46500, 13, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 26692, 62, 26209, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36750, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 4774, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3849, 32186, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 45986, 15, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36599, 29851, 10354, 705, 3459, 25, 2079, 25, 405, 25, 405, 25, 2079, 25, 2079, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 10354, 685, 90, 6, 21975, 10354, 705, 23628, 13, 1558, 13, 3682, 13, 16, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36654, 2701, 10354, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18242, 10354, 705, 45986, 15, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3262, 27932, 10354, 705, 13381, 13, 13381, 13, 15, 13, 15, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 21, 10354, 685, 90, 6, 21975, 10354, 705, 12927, 3712, 41591, 25, 24794, 25, 11848, 11848, 25, 3459, 3459, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 40290, 11925, 10354, 705, 2414, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 929, 10354, 6407, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 2788, 15, 10354, 1391, 6, 36599, 29851, 10354, 705, 3459, 25, 2079, 25, 405, 25, 2079, 25, 2079, 25, 2079, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 10354, 685, 90, 6, 21975, 10354, 705, 17477, 13, 14656, 13, 15, 13, 16, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 36654, 2701, 10354, 705, 17477, 13, 14656, 13, 15, 13, 13381, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 18242, 10354, 705, 2788, 15, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3262, 27932, 10354, 705, 13381, 13, 13381, 13, 13381, 13, 15, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 42504, 21, 10354, 685, 90, 6, 21975, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 12927, 3712, 24794, 25, 24794, 25, 11848, 11848, 25, 3459, 3459, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 40290, 11925, 10354, 705, 2414, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 929, 10354, 6407, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1782, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 10354, 1391, 220, 1303, 9290, 5121, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 47, 2096, 10354, 685, 90, 6, 4061, 10354, 705, 15, 13, 15, 13, 15, 13, 15, 3256, 220, 1303, 356, 11007, 319, 790, 20314, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 29067, 13924, 10354, 4019, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 15202, 13924, 10354, 4019, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 6030, 10354, 705, 83, 13155, 6, 92, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 5159, 10354, 705, 9060, 25, 42861, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 12360, 10354, 1391, 6, 7390, 10354, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 6, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34949, 198, 220, 220, 220, 220, 220, 220, 220, 351, 8529, 13, 15252, 7, 3810, 11, 705, 1136, 3256, 1441, 62, 8367, 28, 862, 62, 26209, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1005, 796, 6164, 13, 1136, 62, 45986, 7, 4480, 62, 34924, 62, 312, 28, 17821, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 33947, 611, 2114, 1201, 326, 481, 1487, 1022, 12972, 17, 290, 12972, 18, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1005, 17816, 9060, 25, 42861, 6, 7131, 6, 541, 85, 19, 6, 7131, 1795, 60, 796, 23243, 7, 1186, 17816, 9060, 25, 42861, 6, 7131, 6, 541, 85, 19, 6, 7131, 1795, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 30493, 36, 13255, 7, 1186, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1391, 6, 9060, 25, 42861, 10354, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 541, 85, 19, 10354, 1391, 1795, 25, 23243, 26933, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19203, 23628, 13, 1558, 13, 3682, 13, 16, 25, 1795, 3256, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19203, 17477, 13, 14656, 13, 15, 13, 16, 25, 1795, 3256, 705, 39305, 4299, 71, 73, 5303, 10163, 2231, 30924, 2079, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 33761, 11709, 30072, 198 ]
1.489651
3,672
import torch from torch import nn import torch.nn.functional as F from metrics.ssim import ssim from metrics.tv_loss import TVLoss #import models.networks as networks from metrics.my_ssim import ssim_loss # class CSSIM(nn.Module): # Complementary SSIM # def __init__(self, default_range=1, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, reduction='mean'): # super().__init__() # self.max_val = default_range # self.filter_size = filter_size # self.k1 = k1 # self.k2 = k2 # self.sigma = sigma # self.reduction = reduction # def forward(self, input, target, max_val=None): # max_val = self.max_val if max_val is None else max_val # return 1 - ssim(input, target, max_val=max_val, filter_size=self.filter_size, # sigma=self.sigma, reduction=self.reduction) # class CSSIM(nn.Module): # Replace this with a system of summing losses in Model Trainer later on. # def __init__(self, default_range=1, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, reduction='mean'): # super().__init__() # self.max_val = default_range # self.filter_size = filter_size # self.k1 = k1 # self.k2 = k2 # self.sigma = sigma # self.reduction = reduction # def forward(self, input, target, max_val=None): # max_val = self.max_val if max_val is None else max_val # input = input.unsqueeze(1) # target = target.unsqueeze(1) # ssim_value = ssim(input, target, max_val=max_val, filter_size=self.filter_size, sigma=self.sigma, reduction=self.reduction) # return ssim_value #+ self.l1_weight * l1_loss ## Combination loss for SRRaGAN class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" # Define GAN loss: [vanilla | lsgan | wgan-gp]
[ 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 198, 6738, 20731, 13, 824, 320, 1330, 264, 14323, 198, 6738, 20731, 13, 14981, 62, 22462, 1330, 3195, 43, 793, 198, 2, 11748, 4981, 13, 3262, 5225, 355, 7686, 198, 6738, 20731, 13, 1820, 62, 824, 320, 1330, 264, 14323, 62, 22462, 628, 198, 2, 1398, 17391, 3955, 7, 20471, 13, 26796, 2599, 220, 1303, 955, 26908, 560, 6723, 3955, 198, 2, 220, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 4277, 62, 9521, 28, 16, 11, 8106, 62, 7857, 28, 1157, 11, 479, 16, 28, 15, 13, 486, 11, 479, 17, 28, 15, 13, 3070, 11, 264, 13495, 28, 16, 13, 20, 11, 7741, 11639, 32604, 6, 2599, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 3419, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9806, 62, 2100, 796, 4277, 62, 9521, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 24455, 62, 7857, 796, 8106, 62, 7857, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 74, 16, 796, 479, 16, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 74, 17, 796, 479, 17, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 82, 13495, 796, 264, 13495, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 445, 8110, 796, 7741, 198, 198, 2, 220, 220, 220, 220, 825, 2651, 7, 944, 11, 5128, 11, 2496, 11, 3509, 62, 2100, 28, 14202, 2599, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 2100, 796, 2116, 13, 9806, 62, 2100, 611, 3509, 62, 2100, 318, 6045, 2073, 3509, 62, 2100, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 352, 532, 264, 14323, 7, 15414, 11, 2496, 11, 3509, 62, 2100, 28, 9806, 62, 2100, 11, 8106, 62, 7857, 28, 944, 13, 24455, 62, 7857, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 13495, 28, 944, 13, 82, 13495, 11, 7741, 28, 944, 13, 445, 8110, 8, 628, 198, 2, 1398, 17391, 3955, 7, 20471, 13, 26796, 2599, 220, 1303, 40177, 428, 351, 257, 1080, 286, 2160, 2229, 9089, 287, 9104, 31924, 1568, 319, 13, 198, 2, 220, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 4277, 62, 9521, 28, 16, 11, 8106, 62, 7857, 28, 1157, 11, 479, 16, 28, 15, 13, 486, 11, 479, 17, 28, 15, 13, 3070, 11, 264, 13495, 28, 16, 13, 20, 11, 7741, 11639, 32604, 6, 2599, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 3419, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9806, 62, 2100, 796, 4277, 62, 9521, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 24455, 62, 7857, 796, 8106, 62, 7857, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 74, 16, 796, 479, 16, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 74, 17, 796, 479, 17, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 82, 13495, 796, 264, 13495, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 445, 8110, 796, 7741, 198, 198, 2, 220, 220, 220, 220, 825, 2651, 7, 944, 11, 5128, 11, 2496, 11, 3509, 62, 2100, 28, 14202, 2599, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 2100, 796, 2116, 13, 9806, 62, 2100, 611, 3509, 62, 2100, 318, 6045, 2073, 3509, 62, 2100, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 5128, 796, 5128, 13, 13271, 421, 1453, 2736, 7, 16, 8, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2496, 796, 2496, 13, 13271, 421, 1453, 2736, 7, 16, 8, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 264, 14323, 62, 8367, 796, 264, 14323, 7, 15414, 11, 2496, 11, 3509, 62, 2100, 28, 9806, 62, 2100, 11, 8106, 62, 7857, 28, 944, 13, 24455, 62, 7857, 11, 264, 13495, 28, 944, 13, 82, 13495, 11, 7741, 28, 944, 13, 445, 8110, 8, 628, 220, 220, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 264, 14323, 62, 8367, 1303, 10, 2116, 13, 75, 16, 62, 6551, 1635, 300, 16, 62, 22462, 628, 198, 198, 2235, 14336, 1883, 2994, 329, 16808, 21762, 45028, 220, 628, 198, 198, 4871, 3178, 4189, 77, 959, 43, 793, 7, 20471, 13, 26796, 2599, 198, 220, 220, 220, 37227, 12441, 4189, 77, 959, 22014, 357, 43, 16, 8, 37811, 198, 198, 2, 2896, 500, 402, 1565, 2994, 25, 685, 10438, 5049, 930, 43979, 1030, 930, 266, 1030, 12, 31197, 60, 628, 198, 220, 220, 220, 220, 198 ]
2.207637
838
""" Test the Google Cloud Storage Client and associated helper functions """ # Python stl imports import os import unittest # Project imports from gcloud.gcs import StorageClient # Third-party imports
[ 37811, 198, 14402, 262, 3012, 10130, 20514, 20985, 290, 3917, 31904, 5499, 198, 37811, 198, 2, 11361, 336, 75, 17944, 198, 11748, 28686, 198, 11748, 555, 715, 395, 198, 198, 2, 4935, 17944, 198, 6738, 308, 17721, 13, 70, 6359, 1330, 20514, 11792, 198, 198, 2, 10467, 12, 10608, 17944, 628 ]
4
51