content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2021/2/26 12:07 @Author : hcai @Email : hua.cai@unidt.com """ import textembedding.get_embedding import textembedding.load_model name = "textbedding" # wv model # # #
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 31, 7575, 220, 220, 220, 1058, 33448, 14, 17, 14, 2075, 1105, 25, 2998, 220, 198, 31, 13838, 220, ...
2.104348
115
# Import matplotlib.pyplot import matplotlib.pyplot as plt # Set start and end dates start = date(2016, 1, 1) end = date(2016, 12, 31) # Set the ticker and data_source ticker = 'FB' data_source = 'google' # Import the data using DataReader stock_prices = DataReader(ticker, data_source, start, end) # Plot Close stock_prices['Close'].plot(title=ticker) # Show the plot plt.show()
[ 2, 17267, 2603, 29487, 8019, 13, 9078, 29487, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 198, 2, 5345, 923, 290, 886, 9667, 198, 9688, 796, 3128, 7, 5304, 11, 352, 11, 352, 8, 198, 437, 796, 3128, 7, 5304, ...
2.789855
138
# !/usr/bin/env python # coding=utf8 import json import traceback from tornado.web import RequestHandler from pfrock.cli import logger from pfrock.core.constants import PFROCK_CONFIG_SERVER, PFROCK_CONFIG_ROUTER, PFROCK_CONFIG_PORT, ROUTER_METHOD, \ ROUTER_PATH, ROUTER_OPTIONS, ROUTER_HANDLER from pfrock.core.lib import auto_str class PfrockConfigParser(object):
[ 2, 5145, 14, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 19617, 28, 40477, 23, 198, 11748, 33918, 198, 11748, 12854, 1891, 198, 198, 6738, 33718, 13, 12384, 1330, 19390, 25060, 198, 198, 6738, 279, 69, 10823, 13, 44506, 1330, 49706, 19...
2.697842
139
from typing import List, Union import torch from torch import nn from torch.nn import functional as F from src.modules.max_mahalanobis import MaxMahalanobis, GaussianResult from src.modules.normalize import Normalize from src.resnet.bottleneck_block_v2s3 import create_bottleneck_stage_v2s3 from src.resnet.shared import GaussianMode, ResNet_Gaussian
[ 6738, 19720, 1330, 7343, 11, 4479, 198, 198, 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 6738, 28034, 13, 20471, 1330, 10345, 355, 376, 198, 198, 6738, 12351, 13, 18170, 13, 9806, 62, 76, 993, 25786, 672, 271, 1330, 5436, 4093...
3.284404
109
systemMenu = {"": 35, "": 45, "": 55, "": 20} menuList = [] while True: menuName = input("Please Enter Menu :") if(menuName.lower() == "exit"): break else: menuList.append([menuName, systemMenu[menuName]]) showBill()
[ 10057, 23381, 796, 19779, 1298, 3439, 11, 366, 1298, 4153, 11, 366, 1298, 5996, 11, 366, 1298, 1160, 92, 198, 26272, 8053, 796, 17635, 198, 198, 4514, 6407, 25, 198, 220, 6859, 5376, 796, 5128, 7203, 5492, 6062, 21860, 1058, 4943, 198...
2.617978
89
# -*- coding: utf-8 -*- import requests import os # 6000 is a large number to make sure we get all the components of a collection. Please do note that RISE also has a pagination feature, # which can be implemented by clients if they wish. per_page = 6000 # getting the list of collections that the user has access to: collections_response = requests.get(f'https://rise.mpiwg-berlin.mpg.de/api/collections?per_page={per_page}') collections = collections_response.json() # each accessible collections has a name, a uuid, and a number of resources. # print(collections) idx = 1 for collection in collections: print(f'collection at index: {idx}') idx += 1 print(collection) # picking a collection by its index # collection_index = 1 # collection = collections[collection_index] results = list(filter(lambda collection: collection['name'] == 'MPIWG - ', collections)) collection = results[0] print(collection['uuid']) collection_uuid = collection['uuid'] # we grab all resources for this collection resources_response = requests.get(f'https://rise.mpiwg-berlin.mpg.de/api/collections/{collection_uuid}/resources?per_page={per_page}') corpus_path = './corpus' if not os.path.exists(corpus_path): os.makedirs(corpus_path) for resource in resources_response.json(): uuid = resource['uuid'] resource_name = resource['name'] print(resource_name) if not os.path.exists(corpus_path + "/" + resource_name): os.makedirs(corpus_path + "/" + resource_name) sections = requests.get("https://rise.mpiwg-berlin.mpg.de/api/resources/"+ resource['uuid'] +"/sections") for section in sections.json(): print(section) print(section['uuid']) section_name = section['name'] section_path = corpus_path + "/" + resource_name + "/" + section_name file = open(section_path +".txt", "w") content_units = requests.get("https://rise.mpiwg-berlin.mpg.de/api/sections/"+ section['uuid'] +"/content_units?per_page=6000") for content_unit in content_units.json(): print(content_unit) file.write(content_unit['content']) file.close()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 7007, 198, 11748, 28686, 198, 198, 2, 39064, 318, 257, 1588, 1271, 284, 787, 1654, 356, 651, 477, 262, 6805, 286, 257, 4947, 13, 4222, 466, 3465, 326, 371, 2435...
2.636147
841
# ___ ___ ___ _ _ # |_ _| _ \___| __(_)_ _ __| |___ _ _ # | || _/___| _|| | ' \/ _` / -_) '_| # |___|_| |_| |_|_||_\__,_\___|_| # Made by Robertas64 #Importing the module import os from time import * banner = """ ___ ___ ___ _ _ |_ _| _ \___| __(_)_ _ __| |___ _ _ | || _/___| _|| | ' \/ _` / -_) '_| |___|_| |_| |_|_||_\__,_\___|_| Find GrowtopiaServer Real IP Author : Robertas64 Make sure you're connected To GrowtopiaServer hosts """ #Main print(banner) os.system("ping growtopia1.com")
[ 2, 220, 220, 46444, 46444, 220, 220, 220, 220, 46444, 4808, 220, 220, 220, 220, 220, 220, 220, 220, 4808, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 2, 930, 62, 4808, 91, 4808, 3467, 17569, 91, 11593, 28264, 8, 62, 4808, ...
1.832335
334
import pandas as pd import matplotlib.pyplot as plt
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 628, 198 ]
2.842105
19
import argparse import os import torch import torch.nn as nn import torch.optim as optim import argparse from torch.utils.data import DataLoader from torchvision import transforms from dataset.main import Flickr8kDataset from dataset.caps_collate import CapsCollate from dataset.download import DownloadDataset from model.main import ImageCaptioningModel,ViTImageCaptioningModel from train import train, split_subsets from transformers import ViTFeatureExtractor device = torch.device("cuda" if torch.cuda.is_available() else "cpu") use_ViT_Enc = True if __name__ == "__main__": parser = argparse.ArgumentParser(description='Image captioning model setup') parser.add_argument('-bsz','--batch-size',type=int, required=False, choices=[4,8,16,32,64], default=64, help='Number of images to process on each batch') parser.add_argument('-vocab','--vocabulary-size',type=int, required=False, default=5000, help='Number of words that our model will use to generate the captions of the images') parser.add_argument('-image-feature','--image-features-dimension',type=int, choices=[256,512,1024], required=False, default=512, help='Number of features that the model will take for each image') parser.add_argument('-attn-dim','--attention-dimension',type=int, choices=[256,512,1024], required=False, default=256, help='Dimension of the attention tensor') parser.add_argument('-embed-dim','--embedding-dimension',type=int, choices=[256,512,1024], required=False, default=256, help='Dimension of the word embedding tensor') parser.add_argument('-epochs','--epochs',type=int, required=False, default=100, help='Number of epochs that our model will run') parser.add_argument('-captions-length','--captions-max-length',type=int, required=False, default=28, help='Max size of the predicted captions') parser.add_argument('-lr','--learning-rate',type=float, required=False, choices=[1e-1,1e-2,1e-3,1e-4],default=1e-3, help='Max size of the predicted captions') parser.add_argument('-img-size','--image-size',type=int, required=False, choices=[224,256,320], default=224, help='Size of the input image that our model will process') parser.add_argument('-log','--log-interval',type=int, required=False, default=5, help='During training, every X epochs, we log the results') args = parser.parse_args() variables = vars(args) if not os.path.exists('data'): print('Downloading Flickr8k dataset...') filepath = os.path.join(os.getcwd(),'data') DownloadDataset.download(filepath) main(variables)
[ 11748, 1822, 29572, 198, 11748, 28686, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 28034, 13, 40085, 355, 6436, 198, 11748, 1822, 29572, 198, 6738, 28034, 13, 26791, 13, 7890, 1330, 6060, 17401, 198, 6738, ...
3.230272
773
import unittest from unittest import TestCase from Implementations.FastIntegersFromGit import FastIntegersFromGit from Implementations.helpers.Helper import ListToPolynomial, toNumbers from Implementations.FasterSubsetSum.RandomizedBase import NearLinearBase from benchmarks.test_distributions import Distributions as dist
[ 11748, 555, 715, 395, 198, 6738, 555, 715, 395, 1330, 6208, 20448, 198, 198, 6738, 48282, 602, 13, 22968, 34500, 364, 4863, 38, 270, 1330, 12549, 34500, 364, 4863, 38, 270, 198, 6738, 48282, 602, 13, 16794, 364, 13, 47429, 1330, 7343,...
3.915663
83
# (set)------------------------ #------------------------------------------ # temp_set = {1,2,3} print(type(temp_set), temp_set) temp_list = [1,2,1,2,2,3,4,12,32] temp_set = set(temp_list) print(type(temp_set), temp_set) # print(100 in temp_set) for element in temp_set: print(element) # #---------- # # my_set_1 = set([1, 2, 3, 4, 5]) my_set_2 = set([5, 6, 7, 8, 9]) my_set_3 = my_set_1.union(my_set_2) print(my_set_3) my_set_4 = my_set_1.difference(my_set_2) print(my_set_4)
[ 2, 220, 220, 220, 357, 2617, 8, 22369, 198, 2, 3880, 35937, 198, 220, 220, 220, 220, 1303, 220, 198, 29510, 62, 2617, 796, 1391, 16, 11, 17, 11, 18, 92, 198, 4798, 7, 4906, 7, 29510, 62, 2617, 828, 20218, 62, 2617, 8, 198, 295...
2.02682
261
from fabric.api import cd, run, settings, sudo configurations = { 'daily': { 'branch': 'master', 'ssl': False, }, 'dev': { 'branch': 'master', 'ssl': False, }, 'prod': { 'branch': 'prod', 'ssl': False, }, 'staging': { 'branch': 'prod', 'ssl': False, }, }
[ 6738, 9664, 13, 15042, 1330, 22927, 11, 1057, 11, 6460, 11, 21061, 201, 198, 201, 198, 11250, 20074, 796, 1391, 201, 198, 220, 220, 220, 705, 29468, 10354, 1391, 201, 198, 220, 220, 220, 220, 220, 220, 220, 705, 1671, 3702, 10354, 7...
1.724444
225
""" Tree Sort . Binary Search Tree . Binary Search Tree . Root . . . Binary Search Tree . """ from __future__ import print_function """ Binary Search Tree inorder inorder . """ if __name__ == '__main__': try: raw_input # Python 2 except NameError: raw_input = input # Python 3 for i in range(3): user_input = raw_input('Enter numbers separated by a comma:\n').strip() unsorted = [int(item) for item in user_input.split(',')] print(treesort(unsorted))
[ 37811, 198, 12200, 33947, 220, 764, 198, 220, 45755, 11140, 12200, 764, 198, 33, 3219, 11140, 12200, 220, 198, 220, 220, 220, 220, 220, 220, 764, 198, 220, 220, 220, 20410, 220, 764, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220,...
2.19697
264
# coding: utf-8 from __future__ import unicode_literals, absolute_import _NOTSET = type( b"NotSet", (object,), {"__repr__": lambda self: "<ValueNotSet>"} )()
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 11, 4112, 62, 11748, 198, 198, 62, 11929, 28480, 796, 2099, 7, 198, 220, 220, 220, 275, 1, 3673, 7248, 1600, 198, 220, 220, 220, 357,...
2.442857
70
from typing import List import json import e2e.Libs.Ristretto.Ristretto as Ristretto from e2e.Libs.BLS import PrivateKey from e2e.Classes.Transactions.Transactions import Claim, Send, Transactions from e2e.Classes.Consensus.Verification import SignedVerification from e2e.Classes.Consensus.VerificationPacket import VerificationPacket from e2e.Classes.Consensus.SpamFilter import SpamFilter from e2e.Classes.Merit.Merit import Block, Merit from e2e.Vectors.Generation.PrototypeChain import PrototypeBlock, PrototypeChain edPrivKey: Ristretto.SigningKey = Ristretto.SigningKey(b'\0' * 32) edPubKey: bytes = edPrivKey.get_verifying_key() transactions: Transactions = Transactions() sendFilter: SpamFilter = SpamFilter(3) proto: PrototypeChain = PrototypeChain(40, keepUnlocked=True) proto.add(1) merit: Merit = Merit.fromJSON(proto.toJSON()) #Create a Claim. claim: Claim = Claim([(merit.mints[-1], 0)], edPubKey) claim.sign(PrivateKey(0)) transactions.add(claim) merit.add( PrototypeBlock( merit.blockchain.blocks[-1].header.time + 1200, packets=[VerificationPacket(claim.hash, list(range(2)))] ).finish(0, merit) ) sends: List[Send] = [ #Transaction which will win. Send([(claim.hash, 0)], [(bytes(32), claim.amount)]), #Transaction which will be beaten. Send([(claim.hash, 0)], [(edPubKey, claim.amount // 2), (edPubKey, claim.amount // 2)]) ] #Children. One which will have a Verification, one which won't. sends += [ Send([(sends[1].hash, 0)], [(edPubKey, claim.amount // 2)]), Send([(sends[1].hash, 1)], [(edPubKey, claim.amount // 2)]) ] #Send which spend the remaining descendant of the beaten Transaction. sends.append(Send([(sends[2].hash, 0)], [(bytes(32), claim.amount // 2)])) for s in range(len(sends)): sends[s].sign(edPrivKey) sends[s].beat(sendFilter) if s < 3: transactions.add(sends[s]) verif: SignedVerification = SignedVerification(sends[2].hash, 1) verif.sign(1, PrivateKey(1)) merit.add( PrototypeBlock( merit.blockchain.blocks[-1].header.time + 1200, packets=[ VerificationPacket(sends[0].hash, [0]), VerificationPacket(sends[1].hash, [1]) ] ).finish(0, merit) ) merit.add( PrototypeBlock( merit.blockchain.blocks[-1].header.time + 1200, packets=[VerificationPacket(sends[2].hash, [0])] ).finish(0, merit) ) for _ in range(4): merit.add( PrototypeBlock(merit.blockchain.blocks[-1].header.time + 1200).finish(0, merit) ) blockWBeatenVerif: Block = PrototypeBlock( merit.blockchain.blocks[-1].header.time + 1200, packets=[VerificationPacket(sends[2].hash, [1])] ).finish(0, merit) merit.add( PrototypeBlock(merit.blockchain.blocks[-1].header.time + 1200).finish(0, merit) ) with open("e2e/Vectors/Consensus/Beaten.json", "w") as vectors: vectors.write(json.dumps({ "blockchain": merit.toJSON(), "transactions": transactions.toJSON(), "sends": [send.toJSON() for send in sends], "verification": verif.toSignedJSON(), "blockWithBeatenVerification": blockWBeatenVerif.toJSON() }))
[ 6738, 19720, 1330, 7343, 198, 11748, 33918, 198, 198, 11748, 304, 17, 68, 13, 25835, 82, 13, 49, 396, 11489, 78, 13, 49, 396, 11489, 78, 355, 371, 396, 11489, 78, 198, 6738, 304, 17, 68, 13, 25835, 82, 13, 33, 6561, 1330, 15348, ...
2.662566
1,138
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This is an EXUDYN example # # Details: Simulate Chain with 3D rigid bodies and SphericalJoint; # Also test MarkerNodePosition # # Author: Johannes Gerstmayr # Date: 2020-04-09 # # Copyright:This file is part of Exudyn. Exudyn is free software. You can redistribute it and/or modify it under the terms of the Exudyn license. See 'LICENSE.txt' for more details. # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import sys sys.path.append('../TestModels') #for modelUnitTest as this example may be used also as a unit test import exudyn as exu from exudyn.itemInterface import * from exudyn.utilities import * from exudyn.graphicsDataUtilities import * from modelUnitTests import ExudynTestStructure, exudynTestGlobals SC = exu.SystemContainer() mbs = SC.AddSystem() nBodies = 4 color = [0.1,0.1,0.8,1] s = 0.1 #width of cube sx = 3*s #lengt of cube/body cPosZ = 0.1 #offset of constraint in z-direction zz = sx * (nBodies+1)*2 #max size of background background0 = GraphicsDataRectangle(-zz,-zz,zz,sx,color) oGround=mbs.AddObject(ObjectGround(referencePosition= [0,0,0], visualization=VObjectGround(graphicsData= [background0]))) mPosLast = mbs.AddMarker(MarkerBodyPosition(bodyNumber = oGround, localPosition=[-sx,0,cPosZ*0])) #create a chain of bodies: for i in range(nBodies): f = 0 #factor for initial velocities omega0 = [0,50.*f,20*f] #arbitrary initial angular velocity ep0 = eulerParameters0 #no rotation ep_t0 = AngularVelocity2EulerParameters_t(omega0, ep0) p0 = [-sx+i*2*sx,0.,0] #reference position v0 = [0.2*f,0.,0.] #initial translational velocity nRB = mbs.AddNode(NodeRigidBodyEP(referenceCoordinates=p0+ep0, initialVelocities=v0+list(ep_t0))) #nRB = mbs.AddNode(NodeRigidBodyEP(referenceCoordinates=[0,0,0,1,0,0,0], initialVelocities=[0,0,0,0,0,0,0])) oGraphics = GraphicsDataOrthoCubeLines(-sx,-s,-s, sx,s,s, [0.8,0.1,0.1,1]) oRB = mbs.AddObject(ObjectRigidBody(physicsMass=2, physicsInertia=[6,1,6,0,0,0], nodeNumber=nRB, visualization=VObjectRigidBody(graphicsData=[oGraphics]))) mMassRB = mbs.AddMarker(MarkerBodyMass(bodyNumber = oRB)) mbs.AddLoad(Gravity(markerNumber = mMassRB, loadVector=[0.,-9.81,0.])) #gravity in negative z-direction if i==0: #mPos = mbs.AddMarker(MarkerBodyPosition(bodyNumber = oRB, localPosition = [-sx*0,0.,cPosZ*0])) mPos = mbs.AddMarker(MarkerNodePosition(nodeNumber=nRB)) else: mPos = mbs.AddMarker(MarkerBodyPosition(bodyNumber = oRB, localPosition = [-sx,0.,cPosZ])) #alternative with spring-damper: #mbs.AddObject(ObjectConnectorCartesianSpringDamper(markerNumbers = [mPosLast, mPos], # stiffness=[k,k,k], damping=[d,d,d])) #gravity in negative z-direction axes = [1,1,1] if (i==0): axes = [0,1,1] mbs.AddObject(SphericalJoint(markerNumbers = [mPosLast, mPos], constrainedAxes=axes)) #marker for next chain body mPosLast = mbs.AddMarker(MarkerBodyPosition(bodyNumber = oRB, localPosition = [sx,0.,cPosZ])) mbs.Assemble() #exu.Print(mbs) simulationSettings = exu.SimulationSettings() #takes currently set values or default values fact = 1000 simulationSettings.timeIntegration.numberOfSteps = 1*fact simulationSettings.timeIntegration.endTime = 0.001*fact simulationSettings.solutionSettings.solutionWritePeriod = simulationSettings.timeIntegration.endTime/fact*10 simulationSettings.timeIntegration.verboseMode = 1 simulationSettings.timeIntegration.newton.useModifiedNewton = True simulationSettings.timeIntegration.generalizedAlpha.useIndex2Constraints = False simulationSettings.timeIntegration.generalizedAlpha.useNewmark = False simulationSettings.timeIntegration.generalizedAlpha.spectralRadius = 0.6 #0.6 works well simulationSettings.solutionSettings.solutionInformation = "rigid body tests" SC.visualizationSettings.nodes.defaultSize = 0.05 #simulationSettings.displayComputationTime = True #simulationSettings.displayStatistics = True if exudynTestGlobals.useGraphics: exu.StartRenderer() mbs.WaitForUserToContinue() SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', simulationSettings) #+++++++++++++++++++++++++++++++++++++++++++++ sol = mbs.systemData.GetODE2Coordinates(); solref = mbs.systemData.GetODE2Coordinates(configuration=exu.ConfigurationType.Reference); #exu.Print('sol=',sol) u = 0 for i in range(14): #take coordinates of first two bodies u += abs(sol[i]+solref[i]) exu.Print('solution of sphericalJointTest=',u) exudynTestGlobals.testError = u - (4.409004179180698) #2020-04-04: 4.409004179180698 if exudynTestGlobals.useGraphics: #SC.WaitForRenderEngineStopFlag() exu.StopRenderer() #safely close rendering window!
[ 2, 44627, 44627, 44627, 44627, 25128, 14030, 10, 198, 2, 770, 318, 281, 7788, 8322, 40760, 1672, 198, 2, 198, 2, 14890, 25, 220, 3184, 5039, 21853, 351, 513, 35, 20831, 5920, 290, 1338, 37910, 41, 1563, 26, 198, 2, 220, 220, 220, ...
2.485394
2,054
import logging import sys import time from typing import List, Optional import uvicorn from fastapi import FastAPI from fastapi.exceptions import RequestValidationError from fastapi.responses import PlainTextResponse from sklearn.pipeline import Pipeline from src.entities import ( read_app_params, HeartDiseaseModelRequest, HeartDiseaseModelResponse, ) from src.models import make_predict, load_model logger = logging.getLogger(__name__) handler = logging.StreamHandler(sys.stdout) logger.setLevel(logging.INFO) logger.addHandler(handler) DEFAULT_CONFIG_PATH = "configs/app_config.yaml" model: Optional[Pipeline] = None app = FastAPI() def setup_app(): app_params = read_app_params(DEFAULT_CONFIG_PATH) logger.info(f"Running app on {app_params.host} with port {app_params.port}") uvicorn.run(app, host=app_params.host, port=app_params.port) if __name__ == "__main__": setup_app()
[ 11748, 18931, 198, 11748, 25064, 198, 11748, 640, 198, 6738, 19720, 1330, 7343, 11, 32233, 198, 198, 11748, 334, 25531, 1211, 198, 6738, 3049, 15042, 1330, 12549, 17614, 198, 6738, 3049, 15042, 13, 1069, 11755, 1330, 19390, 7762, 24765, 1...
2.920886
316
import hashlib import hmac import json import datetime from abc import ABCMeta, abstractmethod from twisted.internet import protocol from mod_config.models import Rule, Actions from mod_honeypot.models import PiPotReport, Deployment from pipot.encryption import Encryption from pipot.notifications import NotificationLoader from pipot.services import ServiceLoader
[ 11748, 12234, 8019, 198, 11748, 289, 20285, 198, 11748, 33918, 198, 198, 11748, 4818, 8079, 198, 6738, 450, 66, 1330, 9738, 48526, 11, 12531, 24396, 198, 198, 6738, 19074, 13, 37675, 1330, 8435, 198, 198, 6738, 953, 62, 11250, 13, 27530...
4.010753
93
from sys import modules from functools import wraps from jsonschema import validate from pyhttptest.constants import ( HTTP_METHOD_NAMES, JSON_FILE_EXTENSION, ) from pyhttptest.exceptions import ( FileExtensionError, HTTPMethodNotSupportedError ) from pyhttptest.http_schemas import ( # noqa get_schema, post_schema, put_schema, delete_schema ) def check_file_extension(func): """A decorator responsible for checking whether the file extension is supported. An inner :func:`_decorator` slices the last five characters of the passed ``file_path`` parameter and checking whether they are equal to JSON file extension(.json). If there is equality, decorated function business logic is performed otherwise, the exception for not supported file extension is raised. Usage: .. code-block:: python @check_file_extension def load_content_from_json_file(file_path): ... :raises FileExtensionError: If the file extension is not '.json'. """ return _decorator def validate_extract_json_properties_func_args(func): """A validation decorator, ensuring that arguments passed to the decorated function are with proper types. An inner :func:`_decorator` does checking of arguments types. If the types of the arguments are different than allowing ones, the exception is raised, otherwise decorated function is processed. Usage: .. code-block:: python @validate_extract_json_properties_func_args def extract_properties_values_from_json(data, keys): ... :raises TypeError: If the data is not a `dict`. :raises TypeError: If the keys is not a type of (`tuple`, `list`, `set`). """ return _decorator def validate_data_against_json_schema(func): """A validation decorator, ensuring that data is covering JSON Schema requirements. An inner :func:`_decorator` does checking of data type, HTTP Method support along with appropriate JSON Schema, that can validate passed data. If one of the checks doesn't match, the exception is raised, otherwise, data validation is run against JSON Schema and decorated function is processed. Usage: .. code-block:: python @validate_data_against_json_schema def extract_json_data(data): ... :raises TypeError: If the data is not a `dict`. :raises HTTPMethodNotSupportedError: If an HTTP Method is not supported. :raises TypeError: If lack of appropriate JSON Schema to validate data. """ return _decorator
[ 6738, 25064, 1330, 13103, 198, 6738, 1257, 310, 10141, 1330, 27521, 198, 198, 6738, 44804, 684, 2395, 2611, 1330, 26571, 198, 198, 6738, 12972, 2804, 457, 395, 13, 9979, 1187, 1330, 357, 198, 220, 220, 220, 14626, 62, 49273, 62, 45, 2...
2.988558
874
from datetime import datetime import arrow import pytest from django.conf import settings from resources.models import Day, Period, Reservation, Resource, ResourceType, Unit TEST_PERFORMANCE = bool(getattr(settings, "TEST_PERFORMANCE", False))
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 11748, 15452, 198, 11748, 12972, 9288, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 198, 6738, 4133, 13, 27530, 1330, 3596, 11, 18581, 11, 1874, 13208, 11, 20857, 11, 20857, 6030, 11...
3.458333
72
# Generated by Django 3.2.8 on 2021-10-12 22:34 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 17, 13, 23, 319, 33448, 12, 940, 12, 1065, 2534, 25, 2682, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628, 198 ]
2.787879
33
default_app_config = "wagtail_tag_manager.config.WagtailTagManagerConfig"
[ 12286, 62, 1324, 62, 11250, 796, 366, 86, 363, 13199, 62, 12985, 62, 37153, 13, 11250, 13, 54, 363, 13199, 24835, 13511, 16934, 1, 198 ]
2.96
25
# Copyright 2015 ETH Zurich # # 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. """ :mod:`cache_test` --- lib.zk.cache unit tests ====================================================== """ # Stdlib from unittest.mock import call, patch # External packages import nose import nose.tools as ntools from kazoo.exceptions import ( ConnectionLoss, NoNodeError, NodeExistsError, SessionExpiredError, ) # SCION from lib.zk.errors import ZkNoConnection, ZkNoNodeError from lib.zk.cache import ZkSharedCache from test.testcommon import assert_these_calls, create_mock def test_create_conn_loss(self): for excp in ConnectionLoss, SessionExpiredError: yield self._check_create_conn_loss, excp class TestZkSharedCacheProcess(object): """ Unit tests for lib.zk.cache.ZkSharedCache.process """ class TestZkSharedCacheListEntries(object): """ Unit tests for lib.zk.cache.ZkSharedCache._list_entries """ def test_children_exceptions(self): for excp, expected in ( (ConnectionLoss, ZkNoConnection), (SessionExpiredError, ZkNoConnection), ): yield self._check_children_exception, excp, expected class TestZkSharedCacheHandleEntries(object): """ Unit test for lib.zk.cache.ZkSharedCache._handle_entries """ if __name__ == "__main__": nose.run(defaultTest=__name__)
[ 2, 15069, 1853, 35920, 43412, 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, 733...
2.910632
649
# -*- coding: utf-8 -*- # # Copyright 2021 Shuoyang Ding <shuoyangd@gmail.com> # Created on 2021-02-11 # # Distributed under terms of the MIT license. import argparse import logging import math import sys logging.basicConfig( format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO) logging.getLogger().setLevel(logging.INFO) opt_parser = argparse.ArgumentParser(description="") opt_parser.add_argument("--tag-file", "-tf", required=True, help="file that holds system predictions, one label per line") opt_parser.add_argument("--ref-file", "-rf", required=True, help="file that holds reference ok/bad labels, one label per line") if __name__ == "__main__": ret = opt_parser.parse_known_args() options = ret[0] if ret[1]: logging.warning( "unknown arguments: {0}".format( opt_parser.parse_known_args()[1])) main(options)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 198, 2, 15069, 220, 33448, 32344, 726, 648, 46980, 1279, 1477, 84, 726, 648, 67, 31, 14816, 13, 785, 29, 198, 2, 15622, 319, 33448, 12, 2999, 12, 1157, 198, 2, ...
2.729483
329
import collections from typing import List input = [1, 4, 2, 5, 3] print(validSubarrays(input))
[ 11748, 17268, 198, 6738, 19720, 1330, 7343, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 15414, 796, 685, 16, 11, 604, 11, 362, 11, 642, 11, 513, 60, 198, 4798, 7, 12102, 7004, 3258, 592, 7, 15414, 4008, 198 ]
2.727273
44
#!/usr/bin/env python3 # # Stolen almost verbatim from: # https://gitlab.cern.ch/lhcb-rta/pidcalib2/-/blob/master/src/pidcalib2/pklhisto2root.py ############################################################################### # (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration # # # # This software is distributed under the terms of the GNU General Public # # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # # # # In applying this licence, CERN does not waive the privileges and immunities # # granted to it by virtue of its status as an Intergovernmental Organization # # or submit itself to any jurisdiction. # ############################################################################### """Convert pickled PIDCalib2 histograms to TH*D & save them in a ROOT file. Only 1D, 2D, and 3D histograms are supported by ROOT. Attempting to convert higher-dimensional histograms will result in an exception. """ import itertools import math import pathlib import pickle import sys import boost_histogram as bh import ROOT def convert_to_root_histo(name: str, bh_histo: bh.Histogram): """Convert boost_histogram histogram to a ROOT histogram. Only 1D, 2D, and 3D histograms are supported by ROOT. Attempting to convert higher-dimensional histograms will result in an exception. Furthermore, the boost histogram must have a storage type that stores variance, e.g., Weight. Args: name: Name of the new ROOT histogram. bh_histo: The histogram to convert. Returns: The converted ROOT histogram. Type depends on dimensionality. """ histo = None if len(bh_histo.axes) == 1: histo = ROOT.TH1D(name, name, 3, 0, 1) histo.SetBins(bh_histo.axes[0].size, bh_histo.axes[0].edges) histo.GetXaxis().SetTitle(bh_histo.axes[0].metadata["name"]) elif len(bh_histo.axes) == 2: histo = ROOT.TH2D(name, name, 3, 0, 1, 3, 0, 1) histo.SetBins( bh_histo.axes[0].size, bh_histo.axes[0].edges, bh_histo.axes[1].size, bh_histo.axes[1].edges, ) histo.GetXaxis().SetTitle(bh_histo.axes[0].metadata["name"]) histo.GetYaxis().SetTitle(bh_histo.axes[1].metadata["name"]) elif len(bh_histo.axes) == 3: histo = ROOT.TH3D(name, name, 3, 0, 1, 3, 0, 1, 3, 0, 1) histo.SetBins( bh_histo.axes[0].size, bh_histo.axes[0].edges, bh_histo.axes[1].size, bh_histo.axes[1].edges, bh_histo.axes[2].size, bh_histo.axes[2].edges, ) histo.GetXaxis().SetTitle(bh_histo.axes[0].metadata["name"]) histo.GetYaxis().SetTitle(bh_histo.axes[1].metadata["name"]) histo.GetZaxis().SetTitle(bh_histo.axes[2].metadata["name"]) else: raise Exception(f"{len(bh_histo.axes)}D histograms not supported by ROOT") indices_ranges = [list(range(n)) for n in bh_histo.axes.size] for indices_tuple in itertools.product(*indices_ranges): root_indices = [index + 1 for index in indices_tuple] histo.SetBinContent( histo.GetBin(*root_indices), bh_histo[indices_tuple].value # type: ignore ) histo.SetBinError( histo.GetBin(*root_indices), math.sqrt(bh_histo[indices_tuple].variance) # type: ignore # noqa ) return histo if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 198, 2, 520, 8622, 2048, 3326, 8664, 320, 422, 25, 198, 2, 220, 220, 3740, 1378, 18300, 23912, 13, 30903, 13, 354, 14, 75, 71, 21101, 12, 81, 8326, 14, 35317, 9948, 571, 1...
2.162515
1,686
d1 = {"koe":4,"slang":0,"konijn":4,"zebra":4} d1["koe"] d2 = {"vis":0,"beer":4,"kip":2} d1.update(d2) print (d1)
[ 67, 16, 796, 19779, 74, 2577, 1298, 19, 553, 6649, 648, 1298, 15, 553, 74, 261, 48848, 1298, 19, 553, 89, 37052, 1298, 19, 92, 198, 67, 16, 14692, 74, 2577, 8973, 198, 67, 17, 796, 19779, 4703, 1298, 15, 553, 42428, 1298, 19, 55...
1.723077
65
from app.database import crud from fastapi import HTTPException, status
[ 6738, 598, 13, 48806, 1330, 1067, 463, 198, 6738, 3049, 15042, 1330, 14626, 16922, 11, 3722, 628, 628, 198 ]
4
19
""" This module represents the Consumer. Computer Systems Architecture Course Assignment 1 March 2020 """ from threading import Thread from time import sleep
[ 37811, 198, 1212, 8265, 6870, 262, 18110, 13, 198, 198, 34556, 11998, 29778, 20537, 198, 8021, 16747, 352, 198, 16192, 12131, 198, 37811, 198, 198, 6738, 4704, 278, 1330, 14122, 198, 6738, 640, 1330, 3993, 198 ]
4.444444
36
import torch.nn as nn import torch import numpy as np from torch.autograd import Variable
[ 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 28034, 13, 2306, 519, 6335, 1330, 35748, 628 ]
3.407407
27
""" transaction_set.py Defines the Enrollment 834 005010X220A1 transaction set model. """ from typing import List, Optional from linuxforhealth.x12.models import X12SegmentGroup from .loops import Footer, Header, Loop1000A, Loop1000B, Loop1000C, Loop2000 from pydantic import root_validator, Field from linuxforhealth.x12.validators import validate_segment_count
[ 37811, 198, 7645, 2673, 62, 2617, 13, 9078, 198, 198, 7469, 1127, 262, 2039, 48108, 807, 2682, 3571, 20, 20943, 55, 17572, 32, 16, 8611, 900, 2746, 13, 198, 37811, 198, 198, 6738, 19720, 1330, 7343, 11, 32233, 198, 198, 6738, 32639, ...
3.285714
112
from utilities.getStore import getStore filePath = "./entities/bill/store.json" productFilePath = "./entities/product/store.json"
[ 6738, 20081, 13, 1136, 22658, 1330, 651, 22658, 198, 198, 7753, 15235, 796, 366, 19571, 298, 871, 14, 35546, 14, 8095, 13, 17752, 1, 198, 11167, 8979, 15235, 796, 366, 19571, 298, 871, 14, 11167, 14, 8095, 13, 17752, 1, 628 ]
3.219512
41
#discord.py from asyncio import sleep import discord client = discord.Client() #BOT # BOT client.run("***")
[ 2, 15410, 585, 13, 9078, 198, 6738, 30351, 952, 1330, 3993, 198, 11748, 36446, 198, 16366, 796, 36446, 13, 11792, 3419, 198, 2, 33, 2394, 198, 2, 347, 2394, 198, 16366, 13, 5143, 7203, 8162, 4943, 198 ]
2.918919
37
# Generated by Django 3.2.11 on 2022-01-08 03:50 from django.db import migrations, models import django.db.models.deletion
[ 2, 2980, 515, 416, 37770, 513, 13, 17, 13, 1157, 319, 33160, 12, 486, 12, 2919, 7643, 25, 1120, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 198, 11748, 42625, 14208, 13, 9945, 13, 27530, 13, 2934, 1616, 295, ...
2.840909
44
#!/usr/bin/python ########################################################################### # # Copyright 2019 Dell, Inc. # # 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. # ########################################################################### import sys import time import json import ast import cli_client as cc from rpipe_utils import pipestr from scripts.render_cli import show_cli_output import urllib3 urllib3.disable_warnings() if __name__ == '__main__': pipestr().write(sys.argv) run(sys.argv[1], sys.argv[2:])
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 29113, 29113, 7804, 21017, 198, 2, 198, 2, 15069, 13130, 23617, 11, 3457, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, ...
3.661972
284
import os import time exec_count = 100 cmds = [] cmds.append("tar -cPzf /opt/web.tar.gz /opt/web/ /opt/soft") cmds.append("rm -f /opt/web.tar.gz") for i in range(exec_count): for cmd in cmds: if os.system(cmd) != 0: break time.sleep(1)
[ 11748, 28686, 198, 11748, 640, 198, 18558, 62, 9127, 796, 1802, 198, 28758, 82, 796, 17635, 220, 198, 28758, 82, 13, 33295, 7203, 18870, 532, 66, 47, 89, 69, 1220, 8738, 14, 12384, 13, 18870, 13, 34586, 1220, 8738, 14, 12384, 14, 12...
2.061538
130
from .help import help_handler from .pre import pre_handler from .now import now_handler from .filter import filter_handler
[ 6738, 764, 16794, 1330, 1037, 62, 30281, 198, 6738, 764, 3866, 1330, 662, 62, 30281, 198, 6738, 764, 2197, 1330, 783, 62, 30281, 198, 6738, 764, 24455, 1330, 8106, 62, 30281 ]
3.967742
31
import utils.fileutils as futils inp = futils.read_list("../data/day6.txt") nums_dict = dict() group_size, res_count = 0, 0 for line in inp: if line == "": # res_count += len(nums_set) for k, v in nums_dict.items(): if v == group_size: res_count += 1 nums_dict = dict() group_size = 0 continue group_size += 1 for ch in line: nums_dict[ch] = 1 + nums_dict.get(ch, 0) for k, v in nums_dict.items(): if v == group_size: res_count += 1 print("Sum of counts: {0}".format(res_count))
[ 11748, 3384, 4487, 13, 7753, 26791, 355, 13294, 4487, 198, 198, 259, 79, 796, 13294, 4487, 13, 961, 62, 4868, 7203, 40720, 7890, 14, 820, 21, 13, 14116, 4943, 198, 77, 5700, 62, 11600, 796, 8633, 3419, 198, 8094, 62, 7857, 11, 581, ...
2.038596
285
from . import types from . import dep from . import RuntimeModel from . import Metadata def get_property(mod, property_name): """ Get a property model object by searching for property name :param mod: module on which to look for the property :param property_name: name of the property :return: ExporterModel.Property (or superclass) if found, None else. """ if mod is None: return None prop = mod.get_property(property_name) return prop def override_module(module_list, old, new): """ Override a module in the module_list with another instance :param old: :param new: :return: """ if old.name != new.name: print("ERROR: Not replacing module with same module") return for k,v in enumerate(module_list): if v == old: module_list[k] = new
[ 6738, 764, 1330, 3858, 198, 6738, 764, 1330, 1207, 198, 6738, 764, 1330, 43160, 17633, 198, 6738, 764, 1330, 3395, 14706, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198, 198, 4299, 651, 62, 26745, 7, 4666, 11, 3119, 62, 3672, 2599...
2.745283
318
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/schematics_proto3_tests.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='tests/schematics_proto3_tests.proto', package='schematics_proto3.tests', syntax='proto3', serialized_options=None, serialized_pb=_b('\n#tests/schematics_proto3_tests.proto\x12\x17schematics_proto3.tests\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"e\n\x06Nested\x12\x34\n\x05inner\x18\x01 \x01(\x0b\x32%.schematics_proto3.tests.Nested.Inner\x12\r\n\x05other\x18\x02 \x01(\t\x1a\x16\n\x05Inner\x12\r\n\x05value\x18\x01 \x01(\t\">\n\rWrappedDouble\x12-\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\"<\n\x0cWrappedFloat\x12,\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.FloatValue\"<\n\x0cWrappedInt64\x12,\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\">\n\rWrappedUInt64\x12-\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt64Value\"<\n\x0cWrappedInt32\x12,\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\">\n\rWrappedUInt32\x12-\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\":\n\x0bWrappedBool\x12+\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\">\n\rWrappedString\x12-\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.StringValue\"<\n\x0cWrappedBytes\x12,\n\x07wrapped\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.BytesValue\"6\n\tTimestamp\x12)\n\x05value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\">\n\x11RepeatedTimestamp\x12)\n\x05value\x18\x01 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\"w\n\x0eOneOfTimestamp\x12.\n\x06value1\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x00\x12,\n\x06value2\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x07\n\x05inner\"\x17\n\x06\x44ouble\x12\r\n\x05value\x18\x01 \x01(\x01\"\x16\n\x05\x46loat\x12\r\n\x05value\x18\x01 \x01(\x02\"\x16\n\x05Int64\x12\r\n\x05value\x18\x01 \x01(\x03\"\x17\n\x06UInt64\x12\r\n\x05value\x18\x01 \x01(\x04\"\x16\n\x05Int32\x12\r\n\x05value\x18\x01 \x01(\x05\"\x17\n\x06UInt32\x12\r\n\x05value\x18\x01 \x01(\r\"\x15\n\x04\x42ool\x12\r\n\x05value\x18\x01 \x01(\x08\"\x17\n\x06String\x12\r\n\x05value\x18\x01 \x01(\t\"\x16\n\x05\x42ytes\x12\r\n\x05value\x18\x01 \x01(\x0c\"\"\n\x11RepeatedPrimitive\x12\r\n\x05value\x18\x01 \x03(\t\"f\n\x0eRepeatedNested\x12<\n\x05inner\x18\x01 \x03(\x0b\x32-.schematics_proto3.tests.RepeatedNested.Inner\x1a\x16\n\x05Inner\x12\r\n\x05value\x18\x01 \x01(\t\"=\n\x0fRepeatedWrapped\x12*\n\x05value\x18\x01 \x03(\x0b\x32\x1b.google.protobuf.Int32Value\"=\n\x0eOneOfPrimitive\x12\x10\n\x06value1\x18\x01 \x01(\x04H\x00\x12\x10\n\x06value2\x18\x02 \x01(\tH\x00\x42\x07\n\x05inner\"\x9c\x01\n\x0bOneOfNested\x12<\n\x06value1\x18\x01 \x01(\x0b\x32*.schematics_proto3.tests.OneOfNested.InnerH\x00\x12.\n\x06value2\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x00\x1a\x16\n\x05Inner\x12\r\n\x05value\x18\x01 \x01(\tB\x07\n\x05inner\":\n\nSimpleEnum\x12,\n\x05value\x18\x01 \x01(\x0e\x32\x1d.schematics_proto3.tests.Enum\"<\n\x0cRepeatedEnum\x12,\n\x05value\x18\x01 \x03(\x0e\x32\x1d.schematics_proto3.tests.Enum\"u\n\tOneOfEnum\x12.\n\x06value1\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x00\x12/\n\x06value2\x18\x02 \x01(\x0e\x32\x1d.schematics_proto3.tests.EnumH\x00\x42\x07\n\x05inner**\n\x04\x45num\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05\x46IRST\x10\x01\x12\n\n\x06SECOND\x10\x02\x62\x06proto3') , dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR,]) _ENUM = _descriptor.EnumDescriptor( name='Enum', full_name='schematics_proto3.tests.Enum', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='UNKNOWN', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='FIRST', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='SECOND', index=2, number=2, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=1922, serialized_end=1964, ) _sym_db.RegisterEnumDescriptor(_ENUM) Enum = enum_type_wrapper.EnumTypeWrapper(_ENUM) UNKNOWN = 0 FIRST = 1 SECOND = 2 _NESTED_INNER = _descriptor.Descriptor( name='Inner', full_name='schematics_proto3.tests.Nested.Inner', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Nested.Inner.value', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=208, serialized_end=230, ) _NESTED = _descriptor.Descriptor( name='Nested', full_name='schematics_proto3.tests.Nested', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='inner', full_name='schematics_proto3.tests.Nested.inner', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='other', full_name='schematics_proto3.tests.Nested.other', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_NESTED_INNER, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=129, serialized_end=230, ) _WRAPPEDDOUBLE = _descriptor.Descriptor( name='WrappedDouble', full_name='schematics_proto3.tests.WrappedDouble', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedDouble.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=232, serialized_end=294, ) _WRAPPEDFLOAT = _descriptor.Descriptor( name='WrappedFloat', full_name='schematics_proto3.tests.WrappedFloat', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedFloat.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=296, serialized_end=356, ) _WRAPPEDINT64 = _descriptor.Descriptor( name='WrappedInt64', full_name='schematics_proto3.tests.WrappedInt64', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedInt64.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=358, serialized_end=418, ) _WRAPPEDUINT64 = _descriptor.Descriptor( name='WrappedUInt64', full_name='schematics_proto3.tests.WrappedUInt64', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedUInt64.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=420, serialized_end=482, ) _WRAPPEDINT32 = _descriptor.Descriptor( name='WrappedInt32', full_name='schematics_proto3.tests.WrappedInt32', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedInt32.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=484, serialized_end=544, ) _WRAPPEDUINT32 = _descriptor.Descriptor( name='WrappedUInt32', full_name='schematics_proto3.tests.WrappedUInt32', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedUInt32.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=546, serialized_end=608, ) _WRAPPEDBOOL = _descriptor.Descriptor( name='WrappedBool', full_name='schematics_proto3.tests.WrappedBool', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedBool.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=610, serialized_end=668, ) _WRAPPEDSTRING = _descriptor.Descriptor( name='WrappedString', full_name='schematics_proto3.tests.WrappedString', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedString.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=670, serialized_end=732, ) _WRAPPEDBYTES = _descriptor.Descriptor( name='WrappedBytes', full_name='schematics_proto3.tests.WrappedBytes', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='wrapped', full_name='schematics_proto3.tests.WrappedBytes.wrapped', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=734, serialized_end=794, ) _TIMESTAMP = _descriptor.Descriptor( name='Timestamp', full_name='schematics_proto3.tests.Timestamp', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Timestamp.value', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=796, serialized_end=850, ) _REPEATEDTIMESTAMP = _descriptor.Descriptor( name='RepeatedTimestamp', full_name='schematics_proto3.tests.RepeatedTimestamp', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.RepeatedTimestamp.value', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=852, serialized_end=914, ) _ONEOFTIMESTAMP = _descriptor.Descriptor( name='OneOfTimestamp', full_name='schematics_proto3.tests.OneOfTimestamp', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value1', full_name='schematics_proto3.tests.OneOfTimestamp.value1', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value2', full_name='schematics_proto3.tests.OneOfTimestamp.value2', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( name='inner', full_name='schematics_proto3.tests.OneOfTimestamp.inner', index=0, containing_type=None, fields=[]), ], serialized_start=916, serialized_end=1035, ) _DOUBLE = _descriptor.Descriptor( name='Double', full_name='schematics_proto3.tests.Double', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Double.value', index=0, number=1, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1037, serialized_end=1060, ) _FLOAT = _descriptor.Descriptor( name='Float', full_name='schematics_proto3.tests.Float', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Float.value', index=0, number=1, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1062, serialized_end=1084, ) _INT64 = _descriptor.Descriptor( name='Int64', full_name='schematics_proto3.tests.Int64', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Int64.value', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1086, serialized_end=1108, ) _UINT64 = _descriptor.Descriptor( name='UInt64', full_name='schematics_proto3.tests.UInt64', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.UInt64.value', index=0, number=1, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1110, serialized_end=1133, ) _INT32 = _descriptor.Descriptor( name='Int32', full_name='schematics_proto3.tests.Int32', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Int32.value', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1135, serialized_end=1157, ) _UINT32 = _descriptor.Descriptor( name='UInt32', full_name='schematics_proto3.tests.UInt32', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.UInt32.value', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1159, serialized_end=1182, ) _BOOL = _descriptor.Descriptor( name='Bool', full_name='schematics_proto3.tests.Bool', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Bool.value', index=0, number=1, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1184, serialized_end=1205, ) _STRING = _descriptor.Descriptor( name='String', full_name='schematics_proto3.tests.String', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.String.value', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1207, serialized_end=1230, ) _BYTES = _descriptor.Descriptor( name='Bytes', full_name='schematics_proto3.tests.Bytes', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.Bytes.value', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1232, serialized_end=1254, ) _REPEATEDPRIMITIVE = _descriptor.Descriptor( name='RepeatedPrimitive', full_name='schematics_proto3.tests.RepeatedPrimitive', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.RepeatedPrimitive.value', index=0, number=1, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1256, serialized_end=1290, ) _REPEATEDNESTED_INNER = _descriptor.Descriptor( name='Inner', full_name='schematics_proto3.tests.RepeatedNested.Inner', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.RepeatedNested.Inner.value', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=208, serialized_end=230, ) _REPEATEDNESTED = _descriptor.Descriptor( name='RepeatedNested', full_name='schematics_proto3.tests.RepeatedNested', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='inner', full_name='schematics_proto3.tests.RepeatedNested.inner', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_REPEATEDNESTED_INNER, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1292, serialized_end=1394, ) _REPEATEDWRAPPED = _descriptor.Descriptor( name='RepeatedWrapped', full_name='schematics_proto3.tests.RepeatedWrapped', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.RepeatedWrapped.value', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1396, serialized_end=1457, ) _ONEOFPRIMITIVE = _descriptor.Descriptor( name='OneOfPrimitive', full_name='schematics_proto3.tests.OneOfPrimitive', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value1', full_name='schematics_proto3.tests.OneOfPrimitive.value1', index=0, number=1, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value2', full_name='schematics_proto3.tests.OneOfPrimitive.value2', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( name='inner', full_name='schematics_proto3.tests.OneOfPrimitive.inner', index=0, containing_type=None, fields=[]), ], serialized_start=1459, serialized_end=1520, ) _ONEOFNESTED_INNER = _descriptor.Descriptor( name='Inner', full_name='schematics_proto3.tests.OneOfNested.Inner', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.OneOfNested.Inner.value', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=208, serialized_end=230, ) _ONEOFNESTED = _descriptor.Descriptor( name='OneOfNested', full_name='schematics_proto3.tests.OneOfNested', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value1', full_name='schematics_proto3.tests.OneOfNested.value1', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value2', full_name='schematics_proto3.tests.OneOfNested.value2', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_ONEOFNESTED_INNER, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( name='inner', full_name='schematics_proto3.tests.OneOfNested.inner', index=0, containing_type=None, fields=[]), ], serialized_start=1523, serialized_end=1679, ) _SIMPLEENUM = _descriptor.Descriptor( name='SimpleEnum', full_name='schematics_proto3.tests.SimpleEnum', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.SimpleEnum.value', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1681, serialized_end=1739, ) _REPEATEDENUM = _descriptor.Descriptor( name='RepeatedEnum', full_name='schematics_proto3.tests.RepeatedEnum', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value', full_name='schematics_proto3.tests.RepeatedEnum.value', index=0, number=1, type=14, cpp_type=8, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=1741, serialized_end=1801, ) _ONEOFENUM = _descriptor.Descriptor( name='OneOfEnum', full_name='schematics_proto3.tests.OneOfEnum', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='value1', full_name='schematics_proto3.tests.OneOfEnum.value1', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value2', full_name='schematics_proto3.tests.OneOfEnum.value2', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( name='inner', full_name='schematics_proto3.tests.OneOfEnum.inner', index=0, containing_type=None, fields=[]), ], serialized_start=1803, serialized_end=1920, ) _NESTED_INNER.containing_type = _NESTED _NESTED.fields_by_name['inner'].message_type = _NESTED_INNER _WRAPPEDDOUBLE.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _WRAPPEDFLOAT.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._FLOATVALUE _WRAPPEDINT64.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _WRAPPEDUINT64.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._UINT64VALUE _WRAPPEDINT32.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT32VALUE _WRAPPEDUINT32.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._UINT32VALUE _WRAPPEDBOOL.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE _WRAPPEDSTRING.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _WRAPPEDBYTES.fields_by_name['wrapped'].message_type = google_dot_protobuf_dot_wrappers__pb2._BYTESVALUE _TIMESTAMP.fields_by_name['value'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _REPEATEDTIMESTAMP.fields_by_name['value'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _ONEOFTIMESTAMP.fields_by_name['value1'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _ONEOFTIMESTAMP.fields_by_name['value2'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _ONEOFTIMESTAMP.oneofs_by_name['inner'].fields.append( _ONEOFTIMESTAMP.fields_by_name['value1']) _ONEOFTIMESTAMP.fields_by_name['value1'].containing_oneof = _ONEOFTIMESTAMP.oneofs_by_name['inner'] _ONEOFTIMESTAMP.oneofs_by_name['inner'].fields.append( _ONEOFTIMESTAMP.fields_by_name['value2']) _ONEOFTIMESTAMP.fields_by_name['value2'].containing_oneof = _ONEOFTIMESTAMP.oneofs_by_name['inner'] _REPEATEDNESTED_INNER.containing_type = _REPEATEDNESTED _REPEATEDNESTED.fields_by_name['inner'].message_type = _REPEATEDNESTED_INNER _REPEATEDWRAPPED.fields_by_name['value'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT32VALUE _ONEOFPRIMITIVE.oneofs_by_name['inner'].fields.append( _ONEOFPRIMITIVE.fields_by_name['value1']) _ONEOFPRIMITIVE.fields_by_name['value1'].containing_oneof = _ONEOFPRIMITIVE.oneofs_by_name['inner'] _ONEOFPRIMITIVE.oneofs_by_name['inner'].fields.append( _ONEOFPRIMITIVE.fields_by_name['value2']) _ONEOFPRIMITIVE.fields_by_name['value2'].containing_oneof = _ONEOFPRIMITIVE.oneofs_by_name['inner'] _ONEOFNESTED_INNER.containing_type = _ONEOFNESTED _ONEOFNESTED.fields_by_name['value1'].message_type = _ONEOFNESTED_INNER _ONEOFNESTED.fields_by_name['value2'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _ONEOFNESTED.oneofs_by_name['inner'].fields.append( _ONEOFNESTED.fields_by_name['value1']) _ONEOFNESTED.fields_by_name['value1'].containing_oneof = _ONEOFNESTED.oneofs_by_name['inner'] _ONEOFNESTED.oneofs_by_name['inner'].fields.append( _ONEOFNESTED.fields_by_name['value2']) _ONEOFNESTED.fields_by_name['value2'].containing_oneof = _ONEOFNESTED.oneofs_by_name['inner'] _SIMPLEENUM.fields_by_name['value'].enum_type = _ENUM _REPEATEDENUM.fields_by_name['value'].enum_type = _ENUM _ONEOFENUM.fields_by_name['value1'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _ONEOFENUM.fields_by_name['value2'].enum_type = _ENUM _ONEOFENUM.oneofs_by_name['inner'].fields.append( _ONEOFENUM.fields_by_name['value1']) _ONEOFENUM.fields_by_name['value1'].containing_oneof = _ONEOFENUM.oneofs_by_name['inner'] _ONEOFENUM.oneofs_by_name['inner'].fields.append( _ONEOFENUM.fields_by_name['value2']) _ONEOFENUM.fields_by_name['value2'].containing_oneof = _ONEOFENUM.oneofs_by_name['inner'] DESCRIPTOR.message_types_by_name['Nested'] = _NESTED DESCRIPTOR.message_types_by_name['WrappedDouble'] = _WRAPPEDDOUBLE DESCRIPTOR.message_types_by_name['WrappedFloat'] = _WRAPPEDFLOAT DESCRIPTOR.message_types_by_name['WrappedInt64'] = _WRAPPEDINT64 DESCRIPTOR.message_types_by_name['WrappedUInt64'] = _WRAPPEDUINT64 DESCRIPTOR.message_types_by_name['WrappedInt32'] = _WRAPPEDINT32 DESCRIPTOR.message_types_by_name['WrappedUInt32'] = _WRAPPEDUINT32 DESCRIPTOR.message_types_by_name['WrappedBool'] = _WRAPPEDBOOL DESCRIPTOR.message_types_by_name['WrappedString'] = _WRAPPEDSTRING DESCRIPTOR.message_types_by_name['WrappedBytes'] = _WRAPPEDBYTES DESCRIPTOR.message_types_by_name['Timestamp'] = _TIMESTAMP DESCRIPTOR.message_types_by_name['RepeatedTimestamp'] = _REPEATEDTIMESTAMP DESCRIPTOR.message_types_by_name['OneOfTimestamp'] = _ONEOFTIMESTAMP DESCRIPTOR.message_types_by_name['Double'] = _DOUBLE DESCRIPTOR.message_types_by_name['Float'] = _FLOAT DESCRIPTOR.message_types_by_name['Int64'] = _INT64 DESCRIPTOR.message_types_by_name['UInt64'] = _UINT64 DESCRIPTOR.message_types_by_name['Int32'] = _INT32 DESCRIPTOR.message_types_by_name['UInt32'] = _UINT32 DESCRIPTOR.message_types_by_name['Bool'] = _BOOL DESCRIPTOR.message_types_by_name['String'] = _STRING DESCRIPTOR.message_types_by_name['Bytes'] = _BYTES DESCRIPTOR.message_types_by_name['RepeatedPrimitive'] = _REPEATEDPRIMITIVE DESCRIPTOR.message_types_by_name['RepeatedNested'] = _REPEATEDNESTED DESCRIPTOR.message_types_by_name['RepeatedWrapped'] = _REPEATEDWRAPPED DESCRIPTOR.message_types_by_name['OneOfPrimitive'] = _ONEOFPRIMITIVE DESCRIPTOR.message_types_by_name['OneOfNested'] = _ONEOFNESTED DESCRIPTOR.message_types_by_name['SimpleEnum'] = _SIMPLEENUM DESCRIPTOR.message_types_by_name['RepeatedEnum'] = _REPEATEDENUM DESCRIPTOR.message_types_by_name['OneOfEnum'] = _ONEOFENUM DESCRIPTOR.enum_types_by_name['Enum'] = _ENUM _sym_db.RegisterFileDescriptor(DESCRIPTOR) Nested = _reflection.GeneratedProtocolMessageType('Nested', (_message.Message,), dict( Inner = _reflection.GeneratedProtocolMessageType('Inner', (_message.Message,), dict( DESCRIPTOR = _NESTED_INNER, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Nested.Inner) )) , DESCRIPTOR = _NESTED, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Nested) )) _sym_db.RegisterMessage(Nested) _sym_db.RegisterMessage(Nested.Inner) WrappedDouble = _reflection.GeneratedProtocolMessageType('WrappedDouble', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDDOUBLE, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedDouble) )) _sym_db.RegisterMessage(WrappedDouble) WrappedFloat = _reflection.GeneratedProtocolMessageType('WrappedFloat', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDFLOAT, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedFloat) )) _sym_db.RegisterMessage(WrappedFloat) WrappedInt64 = _reflection.GeneratedProtocolMessageType('WrappedInt64', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDINT64, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedInt64) )) _sym_db.RegisterMessage(WrappedInt64) WrappedUInt64 = _reflection.GeneratedProtocolMessageType('WrappedUInt64', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDUINT64, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedUInt64) )) _sym_db.RegisterMessage(WrappedUInt64) WrappedInt32 = _reflection.GeneratedProtocolMessageType('WrappedInt32', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDINT32, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedInt32) )) _sym_db.RegisterMessage(WrappedInt32) WrappedUInt32 = _reflection.GeneratedProtocolMessageType('WrappedUInt32', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDUINT32, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedUInt32) )) _sym_db.RegisterMessage(WrappedUInt32) WrappedBool = _reflection.GeneratedProtocolMessageType('WrappedBool', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDBOOL, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedBool) )) _sym_db.RegisterMessage(WrappedBool) WrappedString = _reflection.GeneratedProtocolMessageType('WrappedString', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDSTRING, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedString) )) _sym_db.RegisterMessage(WrappedString) WrappedBytes = _reflection.GeneratedProtocolMessageType('WrappedBytes', (_message.Message,), dict( DESCRIPTOR = _WRAPPEDBYTES, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.WrappedBytes) )) _sym_db.RegisterMessage(WrappedBytes) Timestamp = _reflection.GeneratedProtocolMessageType('Timestamp', (_message.Message,), dict( DESCRIPTOR = _TIMESTAMP, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Timestamp) )) _sym_db.RegisterMessage(Timestamp) RepeatedTimestamp = _reflection.GeneratedProtocolMessageType('RepeatedTimestamp', (_message.Message,), dict( DESCRIPTOR = _REPEATEDTIMESTAMP, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedTimestamp) )) _sym_db.RegisterMessage(RepeatedTimestamp) OneOfTimestamp = _reflection.GeneratedProtocolMessageType('OneOfTimestamp', (_message.Message,), dict( DESCRIPTOR = _ONEOFTIMESTAMP, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.OneOfTimestamp) )) _sym_db.RegisterMessage(OneOfTimestamp) Double = _reflection.GeneratedProtocolMessageType('Double', (_message.Message,), dict( DESCRIPTOR = _DOUBLE, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Double) )) _sym_db.RegisterMessage(Double) Float = _reflection.GeneratedProtocolMessageType('Float', (_message.Message,), dict( DESCRIPTOR = _FLOAT, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Float) )) _sym_db.RegisterMessage(Float) Int64 = _reflection.GeneratedProtocolMessageType('Int64', (_message.Message,), dict( DESCRIPTOR = _INT64, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Int64) )) _sym_db.RegisterMessage(Int64) UInt64 = _reflection.GeneratedProtocolMessageType('UInt64', (_message.Message,), dict( DESCRIPTOR = _UINT64, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.UInt64) )) _sym_db.RegisterMessage(UInt64) Int32 = _reflection.GeneratedProtocolMessageType('Int32', (_message.Message,), dict( DESCRIPTOR = _INT32, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Int32) )) _sym_db.RegisterMessage(Int32) UInt32 = _reflection.GeneratedProtocolMessageType('UInt32', (_message.Message,), dict( DESCRIPTOR = _UINT32, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.UInt32) )) _sym_db.RegisterMessage(UInt32) Bool = _reflection.GeneratedProtocolMessageType('Bool', (_message.Message,), dict( DESCRIPTOR = _BOOL, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Bool) )) _sym_db.RegisterMessage(Bool) String = _reflection.GeneratedProtocolMessageType('String', (_message.Message,), dict( DESCRIPTOR = _STRING, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.String) )) _sym_db.RegisterMessage(String) Bytes = _reflection.GeneratedProtocolMessageType('Bytes', (_message.Message,), dict( DESCRIPTOR = _BYTES, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.Bytes) )) _sym_db.RegisterMessage(Bytes) RepeatedPrimitive = _reflection.GeneratedProtocolMessageType('RepeatedPrimitive', (_message.Message,), dict( DESCRIPTOR = _REPEATEDPRIMITIVE, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedPrimitive) )) _sym_db.RegisterMessage(RepeatedPrimitive) RepeatedNested = _reflection.GeneratedProtocolMessageType('RepeatedNested', (_message.Message,), dict( Inner = _reflection.GeneratedProtocolMessageType('Inner', (_message.Message,), dict( DESCRIPTOR = _REPEATEDNESTED_INNER, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedNested.Inner) )) , DESCRIPTOR = _REPEATEDNESTED, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedNested) )) _sym_db.RegisterMessage(RepeatedNested) _sym_db.RegisterMessage(RepeatedNested.Inner) RepeatedWrapped = _reflection.GeneratedProtocolMessageType('RepeatedWrapped', (_message.Message,), dict( DESCRIPTOR = _REPEATEDWRAPPED, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedWrapped) )) _sym_db.RegisterMessage(RepeatedWrapped) OneOfPrimitive = _reflection.GeneratedProtocolMessageType('OneOfPrimitive', (_message.Message,), dict( DESCRIPTOR = _ONEOFPRIMITIVE, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.OneOfPrimitive) )) _sym_db.RegisterMessage(OneOfPrimitive) OneOfNested = _reflection.GeneratedProtocolMessageType('OneOfNested', (_message.Message,), dict( Inner = _reflection.GeneratedProtocolMessageType('Inner', (_message.Message,), dict( DESCRIPTOR = _ONEOFNESTED_INNER, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.OneOfNested.Inner) )) , DESCRIPTOR = _ONEOFNESTED, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.OneOfNested) )) _sym_db.RegisterMessage(OneOfNested) _sym_db.RegisterMessage(OneOfNested.Inner) SimpleEnum = _reflection.GeneratedProtocolMessageType('SimpleEnum', (_message.Message,), dict( DESCRIPTOR = _SIMPLEENUM, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.SimpleEnum) )) _sym_db.RegisterMessage(SimpleEnum) RepeatedEnum = _reflection.GeneratedProtocolMessageType('RepeatedEnum', (_message.Message,), dict( DESCRIPTOR = _REPEATEDENUM, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.RepeatedEnum) )) _sym_db.RegisterMessage(RepeatedEnum) OneOfEnum = _reflection.GeneratedProtocolMessageType('OneOfEnum', (_message.Message,), dict( DESCRIPTOR = _ONEOFENUM, __module__ = 'tests.schematics_proto3_tests_pb2' # @@protoc_insertion_point(class_scope:schematics_proto3.tests.OneOfEnum) )) _sym_db.RegisterMessage(OneOfEnum) # @@protoc_insertion_point(module_scope)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 262, 8435, 11876, 17050, 13, 220, 8410, 5626, 48483, 0, 198, 2, 2723, 25, 5254, 14, 1416, 10024, 873, 62, 1676, 1462, 18, 62, 41989, 13, 1676, 146...
2.408849
20,274
from rest_framework.serializers import ModelSerializer from accounts.models import Account
[ 6738, 1334, 62, 30604, 13, 46911, 11341, 1330, 9104, 32634, 7509, 198, 6738, 5504, 13, 27530, 1330, 10781, 198, 220, 198 ]
4.428571
21
# coding: utf-8 from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import os import logging import datetime import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from config import SAVING_DIR from config import SEED from visual import set_plot_config set_plot_config() from utils.log import set_logger from utils.log import flush from utils.log import print_line from utils.evaluation import evaluate_minuit from problem.higgs import HiggsConfigTesOnly as Config from problem.higgs import get_minimizer from problem.higgs import get_minimizer_no_nuisance from problem.higgs import get_generators_torch from problem.higgs import HiggsNLL as NLLComputer from ..common import N_BINS
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17...
3.324
250
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-09-21 17:17 from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import migrations, models import django.db.models.deletion
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 1157, 319, 2864, 12, 2931, 12, 2481, 1596, 25, 1558, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 1174...
2.848101
79
from .private.HMC804x import _RohdeSchwarzHMC804x from qcodes.utils.deprecate import deprecate_moved_to_qcd
[ 6738, 764, 19734, 13, 39, 9655, 36088, 87, 1330, 4808, 49, 1219, 2934, 14874, 5767, 89, 39, 9655, 36088, 87, 198, 6738, 10662, 40148, 13, 26791, 13, 10378, 8344, 378, 1330, 1207, 8344, 378, 62, 76, 2668, 62, 1462, 62, 80, 10210, 628...
2.534884
43
# Multiples -- Part I - Write code that prints all the odd numbers from 1 to 1000. Use the for loop and don't use a list to do this exercise for i in range(1, 1000, 2): print(i) # Multiples -- Part II - Create another program that prints all the multiples of 5 from 5 to 1,000,000 for m in range(5, 1000000, 5): print(m) # Sum List -- Create a program that prints the sum of all the values in the list: a = [1, 2, 5, 10, 255, 3] a = [1, 2, 5, 10, 255, 3] b = sum(a) print(b) # Average List -- Create a program that prints the average of the values in the list: c = [1, 2, 5, 10, 255, 3] c = [1, 2, 5, 10, 255, 3] dSum = sum(c) eLen = len(c) fAvg = (dSum / eLen) print(fAvg)
[ 2, 15237, 2374, 1377, 2142, 314, 532, 19430, 2438, 326, 20842, 477, 262, 5629, 3146, 422, 352, 284, 8576, 13, 5765, 262, 329, 9052, 290, 836, 470, 779, 257, 1351, 284, 466, 428, 5517, 198, 1640, 1312, 287, 2837, 7, 16, 11, 8576, 1...
2.738956
249
#!/usr/bin/env python3 """ Demo example to test CFG-VALSET ublox message - generation 9 @author: mgesteiro """ import sys import time from serial import Serial, SerialException, SerialTimeoutException from pyubx2 import ( UBXMessage, GET, SET, VALSET_RAM, UBXMessageError, UBXTypeError, UBXParseError, ) def message_valsetuart1baudrate_set(baudrate): """ Function to generate a CFG-VALSET CFG-UART1-BAUDRATE set UBX message """ # https://www.u-blox.com/en/docs/UBX-18010854#page=86&zoom=auto,-74,499 # CFG-UART1-BAUDRATE Key = 0x40520001 return UBXMessage( "CFG", "CFG-VALSET", SET, payload=b"\x00" + VALSET_RAM # version + int(0).to_bytes(2, byteorder="little", signed=False) # layers + 0x40520001 .to_bytes(4, byteorder="little", signed=False) # reserved0 + baudrate.to_bytes(4, byteorder="little", signed=False), # key # value ) def message_valsetuart1baudrate_response(): """ Function to generate a ACK-ACK-ACK UBX message """ # https://www.u-blox.com/en/docs/UBX-18010854#page=52&zoom=auto,-74,379 return UBXMessage("ACK", "ACK-ACK", GET, clsID=0x06, msgID=0x8A) if __name__ == "__main__": PORTNAME = "/dev/tty.usbserial-A50285BI" BAUDRATE = 230400 try: print("\nBuilding CFG-UART1-BAUDRATE VALSET message:") msg = message_valsetuart1baudrate_set(BAUDRATE) print(f" GENERATED: {msg.serialize().hex()}") print( " EXPECTED: b562068a0c00000100000100524000840300b7ef" + " (Note: valid for 230400 baudrate)" ) print(f" {msg}\n") print(f"This demo will now set your module's UART1 to {BAUDRATE} (only in RAM)") try: input("press <ENTER> to continue, CTRL-C to abort!\n") except KeyboardInterrupt: print("\nExecution aborted.\n") sys.exit(0) sport = Serial(PORTNAME, BAUDRATE, timeout=2) time.sleep(0.250) # stabilize print( f"Sending set message to {PORTNAME} at {BAUDRATE} " + "(edit the code to change these values)\n" ) sport.flushInput() sport.write(msg.serialize()) print("Receiving response ...") raw = sport.read(512) START = raw.find(b"\xB5\x62") data = raw[START : START + 10] # expected ACK msg = message_valsetuart1baudrate_response() print(f" RECEIVED: {data.hex()}") print(f" EXPECTED: {msg.serialize().hex()}") print(f" {UBXMessage.parse(data)}\n") except ( UBXMessageError, UBXTypeError, UBXParseError, SerialException, SerialTimeoutException, ) as err: print(f"Something broke : {err}\n")
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 198, 11522, 78, 1672, 284, 1332, 18551, 38, 12, 53, 23333, 2767, 334, 2436, 1140, 3275, 532, 5270, 860, 198, 198, 31, 9800, 25, 285, 3495, 68, 7058, 198, 37811, 198, 11748...
2.082963
1,350
import pygame import time import sys, random pygame.init() yellow = (255, 255, 102) green = (0, 255, 0) black = (0,0,0) width = 1280 height = 720 gameDisplay = pygame.display.set_mode((width, height)) pygame.display.set_caption('Snake Game By Saswat Samal') clock = pygame.time.Clock() snake_block = 10 snake_speed = 15 font_style = pygame.font.SysFont("ubuntu", 25) score_font = pygame.font.SysFont("ubuntu", 20) main_menu()
[ 11748, 12972, 6057, 198, 11748, 640, 198, 11748, 25064, 11, 4738, 198, 220, 198, 9078, 6057, 13, 15003, 3419, 198, 220, 198, 198, 36022, 796, 357, 13381, 11, 14280, 11, 15143, 8, 198, 14809, 796, 357, 15, 11, 14280, 11, 657, 8, 198,...
2.548571
175
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot = True) sess = tf.InteractiveSession() x = tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x, W) + b) y_ = tf.placeholder(tf.float32, [None, 10]) # cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices = [1])) train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) tf.global_variables_initializer().run() for i in range(10000): batch_xs, batch_ys = mnist.train.next_batch(100) train_step.run({x: batch_xs, y_: batch_ys}) correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) print(accuracy.eval({x: mnist.test.images, y_: mnist.test.labels}))
[ 11748, 11192, 273, 11125, 355, 48700, 198, 6738, 11192, 273, 11125, 13, 1069, 12629, 13, 83, 44917, 82, 13, 10295, 396, 1330, 5128, 62, 7890, 198, 10295, 396, 796, 5128, 62, 7890, 13, 961, 62, 7890, 62, 28709, 7203, 39764, 8808, 62, ...
2.374026
385
# Generated by Django 2.2.20 on 2021-05-27 14:53 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 1238, 319, 33448, 12, 2713, 12, 1983, 1478, 25, 4310, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.875
32
# -*- coding: utf-8 -*- """ Solution to Project Euler problem X Author: Jaime Liew https://github.com/jaimeliew1/Project_Euler_Solutions """ import math isPoly = [isTri, isSqr, isPent, isHex,isHept,isOct] if __name__ == "__main__": print(run())
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 46344, 284, 4935, 412, 18173, 1917, 1395, 198, 198, 13838, 25, 38028, 406, 769, 198, 5450, 1378, 12567, 13, 785, 14, 73, 1385, 417, 769, 16, 14, 16775, 62,...
2.40566
106
from shop.models import Product from django.shortcuts import render_to_response from django.template import RequestContext
[ 6738, 6128, 13, 27530, 1330, 8721, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 62, 1462, 62, 26209, 198, 6738, 42625, 14208, 13, 28243, 1330, 19390, 21947, 628, 628, 628, 628 ]
4.0625
32
import numpy as np from qrogue.game.logic.actors import StateVector stv = StateVector([1 / np.sqrt(2), 0 + 0j, 0 + 0j, 1 / np.sqrt(2)]) #stv.extend(1) print(stv)
[ 11748, 299, 32152, 355, 45941, 198, 198, 6738, 10662, 3828, 518, 13, 6057, 13, 6404, 291, 13, 529, 669, 1330, 1812, 38469, 198, 198, 301, 85, 796, 1812, 38469, 26933, 16, 1220, 45941, 13, 31166, 17034, 7, 17, 828, 657, 1343, 657, 73...
2.173333
75
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from .models import Image, Comment, Like from .serializers import ImageSerializer, CommentSerializer, LikeSerializer
[ 6738, 1334, 62, 30604, 13, 33571, 1330, 3486, 3824, 769, 198, 6738, 1334, 62, 30604, 13, 26209, 1330, 18261, 198, 6738, 1334, 62, 30604, 1330, 3722, 198, 6738, 764, 27530, 1330, 7412, 11, 18957, 11, 4525, 198, 6738, 764, 46911, 11341, ...
3.833333
66
#!/usr/bin/env python """ Compute the comparison of the analytic and experimental PSD matrices. This will generate Figure 1. This is probably the only example that will run in a reasonable time without a GPU. For more details on the method see https://arxiv.org/abs/2106.13785. """ import numpy as np import matplotlib.pyplot as plt from bilby.core.utils import create_white_noise, create_frequency_series from scipy.signal.windows import tukey from scipy.interpolate import interp1d from tqdm.auto import trange from coarse_psd_matrix.utils import ( compute_psd_matrix, create_parser, fetch_psd_data, ) from coarse_psd_matrix.plotting import plot_psd_matrix from matplotlib import rcParams rcParams["font.family"] = "serif" rcParams["font.serif"] = "Computer Modern Roman" rcParams["font.size"] = 20 rcParams["text.usetex"] = True rcParams["grid.alpha"] = 0 if __name__ == "__main__": parser = create_parser() args = parser.parse_args() interferometer = args.interferometer outdir = args.outdir duration = args.duration medium_duration = args.medium_duration sampling_frequency = args.sampling_frequency low_frequency = args.low_frequency tukey_alpha = args.tukey_alpha minimum_frequency = 480 maximum_frequency = 530 event = args.event data = fetch_psd_data( interferometer_name=interferometer, event=event, duration=duration, sampling_frequency=sampling_frequency, low_frequency=low_frequency, tukey_alpha=tukey_alpha, medium_duration=medium_duration, outdir=outdir, ) svd = compute_psd_matrix( interferometer_name=interferometer, event=event, duration=duration, sampling_frequency=sampling_frequency, low_frequency=low_frequency, tukey_alpha=tukey_alpha, minimum_frequency=minimum_frequency, maximum_frequency=maximum_frequency, medium_duration=medium_duration, outdir=outdir, ) psd = data["medium_psd"][: sampling_frequency // 2 * medium_duration + 1] original_frequencies = create_frequency_series( duration=medium_duration, sampling_frequency=sampling_frequency ) new_frequencies = create_frequency_series( duration=256, sampling_frequency=sampling_frequency ) psd = interp1d(original_frequencies, psd)(new_frequencies) short_window = tukey(duration * sampling_frequency, tukey_alpha) short_window /= np.mean(short_window ** 2) ** 0.5 analytic_psd_matrix = (svd[0] * svd[1]) @ svd[2] estimated_psd_matrix = np.zeros_like(analytic_psd_matrix) nfft = duration * sampling_frequency start_idx = minimum_frequency * duration stop_idx = maximum_frequency * duration n_average = 1024 * 1024 // 64 for _ in trange(n_average): white_noise, frequencies = create_white_noise( sampling_frequency=2048, duration=256 ) coloured_noise = white_noise * psd ** 0.5 td_noise = np.fft.irfft(coloured_noise).reshape((-1, nfft)) fd_noise = np.fft.rfft(td_noise * short_window) reduced_noise = fd_noise[:, start_idx : stop_idx + 1] estimated_psd_matrix += np.einsum( "ki,kj->ij", reduced_noise, reduced_noise.conjugate() ) / 2 total_averages = n_average * len(reduced_noise) estimated_psd_matrix /= total_averages rcParams["font.family"] = "serif" rcParams["font.serif"] = "Computer Modern Roman" rcParams["font.size"] = 20 rcParams["text.usetex"] = True rcParams["grid.alpha"] = 0 fig, axes = plt.subplots(nrows=2, figsize=(10, 16)) kwargs = dict( minimum_frequency=minimum_frequency, maximum_frequency=maximum_frequency, duration=duration, vmin=-53, vmax=-41.8, tick_step=10, ) plot_psd_matrix(estimated_psd_matrix, axes[0], **kwargs) plot_psd_matrix(analytic_psd_matrix, axes[1], **kwargs) axes[0].text(-25, 190, "(a)") axes[1].text(-25, 190, "(b)") plt.tight_layout() plt.savefig(f"{outdir}/zoom_{tukey_alpha}.pdf") if tukey_alpha == 0.1: plt.savefig("figure_1.pdf") plt.close()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 198, 7293, 1133, 262, 7208, 286, 262, 49166, 290, 11992, 6599, 35, 2603, 45977, 13, 198, 198, 1212, 481, 7716, 11291, 352, 13, 198, 1212, 318, 2192, 262, 691, 1672, 326, 481, ...
2.41092
1,740
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 2896, 500, 534, 2378, 31108, 994, 198, 2, 198, 2, 2094, 470, 6044, 284, 751, 534, 11523, 284, 262, 7283, 3620, 62, 47, 4061, 3698, 1268, 1546, 4634, 198, 2, ...
2.621951
82
"""mixin to add destinations to config attributes"""
[ 37811, 19816, 259, 284, 751, 23982, 284, 4566, 12608, 37811, 198 ]
4.818182
11
#!/usr/bin/env python3 """ Description: ------------ This Python script (assumes Python3) downloads boundary conditions files from AWS S3 to a target directory for the requested date range. Remarks: -------- (1) Jiawei Zhuang found that it is much faster to issue aws s3 cp commands from a bash script than a Python script. Therefore, in this routine we create a bash script with all of the download commands that will be executed by the main routine. """ # Imports import os import sys import subprocess # Exit with error if we are not using Python3 assert sys.version_info.major >= 3, "ERROR: Python 3 is required to run download_bc.py!" # Define global variables DATA_DOWNLOAD_SCRIPT = "./auto_generated_download_script.sh" def list_missing_files(start_date, end_date, destination): """ Creates list of BC files in date range that do not already exist at destination. Args: ----- start_date : str Initial date of simulation. end_date : str Final date of simulation. destination : str Target directory for downloaded files """ missing_files = [] start_str = str(start_date) start_year = start_str[:4] start_month = start_str[4:6] start_day = start_str[6:8] end_str = str(end_date) end_year = end_str[:4] end_month = end_str[4:6] end_day = end_str[6:8] month_days = [31, [28, 29], 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] file_prefix = "GEOSChem.BoundaryConditions." file_suffix = "_0000z.nc4" for year in range(int(start_year), int(end_year) + 1): # skip years with definite no data if year < 2018: print( "Skipping BC data download for ", str(year), ": no data from this year" ) continue init_month = 1 final_month = 12 if year == int(start_year): # only get desired months from incomplete years init_month = int(start_month) if year == int(end_year): final_month = int(end_month) for month in range(init_month, final_month + 1): # skip months with definite no data if year == 2018 and month < 4: print( "Skipping BC data download for ", str(year), "/0", str(month), ": no data from this month", ) continue # add 0 to month string if necessary month_prefix = "0" if month < 10 else "" init_day = 1 final_day = month_days[month - 1] # leap day if month == 2: if year % 4 == 0: final_day = final_day[1] else: final_day = final_day[0] if month == int(start_month) and year == int(start_year): # only get desired days from incomplete months init_day = int(start_day) if month == int(end_month) and year == int(end_year): final_day = int(end_day) for day in range(init_day, final_day + 1): # add 0 to day string if necessary day_prefix = "0" if day < 10 else "" # check if file for this day already exists file_name = ( file_prefix + str(year) + month_prefix + str(month) + day_prefix + str(day) + file_suffix ) # add file to download list if needed if not os.path.exists(destination + "/" + file_name): missing_files.append(file_name) return missing_files def create_download_script(paths, destination): """ Creates a data download script to obtain missing files Args: ----- paths : dict Output of function list_missing_files. """ # Create the data download script with open(DATA_DOWNLOAD_SCRIPT, "w") as f: # Write shebang line to script print("#!/bin/bash\n", file=f) print("# This script was generated by download_bc.py\n", file=f) cmd_prefix = "aws s3 cp --only-show-errors --request-payer=requester " remote_root = "s3://imi-boundary-conditions/" # make destination if needed if not os.path.exists(destination): os.mkdir(destination) # Write download commands for only the missing data files for path in paths: cmd = cmd_prefix + remote_root + path + " " + destination print(cmd, file=f) print(file=f) # Close file and make it executable f.close() os.chmod(DATA_DOWNLOAD_SCRIPT, 0o755) def download_the_data(start_date, end_date, destination): """ Downloads required boundary conditions files from AWS. Args: ----- start_date : str Initial date of simulation. end_date : str Final date of simulation. destination : str Target directory for downloaded files """ # Get a list of missing data paths paths = list_missing_files(start_date, end_date, destination) # Create script to download missing files from AWS S3 create_download_script(paths, destination) # Run the data download script and return the status # Remove the file afterwards status = subprocess.call(DATA_DOWNLOAD_SCRIPT) os.remove(DATA_DOWNLOAD_SCRIPT) # Raise an exception if the data was not successfully downloaded if status != 0: err_msg = "Error downloading data from AWS!" raise Exception(err_msg) def main(): """ Main program. Gets command-line arguments and calls function download_the_data to initiate a data-downloading process. Calling sequence: ----------------- ./download_data.py start_date end_date destination Example call: ------------- ./download_data.py 20200501 20200531 /home/ubuntu/ExtData/BoundaryConditions """ download_the_data(sys.argv[1], sys.argv[2], sys.argv[3]) if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 37811, 198, 11828, 25, 198, 10541, 198, 1212, 11361, 4226, 357, 562, 8139, 11361, 18, 8, 21333, 18645, 3403, 198, 16624, 422, 30865, 311, 18, 284, 257, 2496, 8619, 329, 262, ...
2.270368
2,774
from __future__ import absolute_import, unicode_literals # This will make sure the app is always imported when # Django starts so that shared_task will use this app. # import pymysql # # pymysql.install_as_MySQLdb()
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 11, 28000, 1098, 62, 17201, 874, 198, 2, 770, 481, 787, 1654, 262, 598, 318, 1464, 17392, 618, 198, 2, 37770, 4940, 523, 326, 4888, 62, 35943, 481, 779, 428, 598, 13, 198, 2, 1330, 2...
3.323077
65
____notmain: BeginFunc 0 ; EndFunc ;
[ 1427, 1662, 12417, 25, 198, 197, 44140, 37, 19524, 657, 2162, 198, 197, 12915, 37, 19524, 2162, 198 ]
2.166667
18
""" Ejercicio para operacin entre currencies """ """ Representacin del currency""" # No me queda muy claro el uso de esta funcin, sirve para mostrar puntualmente qu? # def __repr__(self): # info = self.name # info2 = self.symbol # return info, info2 euro = Curency("Euro","EU","3.2") print(euro)
[ 37811, 198, 198, 36, 73, 2798, 46441, 31215, 1515, 330, 259, 920, 260, 19247, 198, 198, 37811, 628, 198, 37811, 10858, 330, 259, 1619, 7395, 37811, 628, 198, 2, 1400, 502, 627, 18082, 285, 4669, 10212, 78, 1288, 514, 78, 390, 1556, ...
2.385714
140
import os from IPython import get_ipython # need this fix first os.environ["LD_PRELOAD"] = "" os.system("apt remove libtcmalloc-minimal4") os.system("apt install libtcmalloc-minimal4") os.environ["LD_PRELOAD"] = "/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4.3.0" os.system("dpkg -L libtcmalloc-minimal4") # then install blender url = "https://download.blender.org/release/Blender2.83/blender-2.83.0-linux64.tar.xz" os.system(f"curl {url} | tar xJ") os.system("ln -s /content/blender-2.83.0-linux64/blender /usr/local/bin/blender") # show result get_ipython().system("blender -v")
[ 11748, 28686, 198, 6738, 6101, 7535, 1330, 651, 62, 541, 7535, 198, 198, 2, 761, 428, 4259, 717, 198, 418, 13, 268, 2268, 14692, 11163, 62, 47, 16448, 41048, 8973, 796, 13538, 198, 418, 13, 10057, 7203, 2373, 4781, 9195, 83, 11215, ...
2.466387
238
from django.db import models from django_countries.fields import CountryField from localflavor.us.models import USStateField from base.models import EONBaseModel
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 42625, 14208, 62, 9127, 1678, 13, 25747, 1330, 12946, 15878, 198, 6738, 1179, 1604, 75, 5570, 13, 385, 13, 27530, 1330, 1294, 9012, 15878, 198, 198, 6738, 2779, 13, 27530, 1330, 412, ...
3.553191
47
#!/usr/bin/env python2.7 import sys reload(sys) sys.setdefaultencoding("utf-8") from flask import Flask, render_template, request, jsonify import argparse import datetime import os, sys import requests from socket import error as SocketError import errno import json import pika import uuid app = Flask(__name__) def on_response(ch, method, props, body): global corr_id global response if corr_id == props.correlation_id: response = body if __name__ == '__main__': from argparse import ArgumentParser parser = ArgumentParser("Room Finder Dispo Service") parser.add_argument("-r","--rabbitmq", help="IP or hostname for rabbitmq server, e.g. 'rabbit.domain.com'.") parser.add_argument("-p","--port", help="tcp port for rabitmq server, e.g. '2765'.") args = parser.parse_args() rabbitmq = args.rabbitmq if (rabbitmq == None): rabbitmq = os.getenv("roomfinder_rabbitmq_server") if (rabbitmq == None): get_rabbitmq_server = raw_input("What is the rabbitmq server IP or hostname? ") rabbitmq = get_rabbitmq_server rabbitmq_port = args.port if (rabbitmq_port == None): rabbitmq_port = os.getenv("roomfinder_rabbitmq_port") if (rabbitmq_port == None): get_rabbitmq_port = raw_input("What is the rabbitmq TCP port? ") rabbitmq_port = get_rabbitmq_port try: app.run(host='0.0.0.0', port=int("5000")) except: try: app.run(host='0.0.0.0', port=int("5000")) except: print "Dispo web services error"
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 17, 13, 22, 198, 198, 11748, 25064, 198, 260, 2220, 7, 17597, 8, 198, 17597, 13, 2617, 12286, 12685, 7656, 7203, 40477, 12, 23, 4943, 198, 6738, 42903, 1330, 46947, 11, 8543, 62, 28243, 1...
2.389058
658
import numpy as np from ComponentStructural import ComponentStructural from ..subsystems import SubsystemStructural
[ 198, 11748, 299, 32152, 355, 45941, 198, 6738, 35100, 44909, 1523, 1330, 35100, 44909, 1523, 198, 6738, 11485, 7266, 10057, 82, 1330, 3834, 10057, 44909, 1523, 198 ]
4.333333
27
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler import logging from utils import TELEGRAM_TOKEN from handlers import start, ask_new_url, get_url, get_description, cancel from handlers import URL_URL, URL_DESCRIPTION logging.basicConfig(format='%(levelname)s - %(message)s', level=logging.DEBUG) logger = logging.getLogger(__name__) updater = None start_bot()
[ 6738, 573, 30536, 13, 2302, 1330, 3205, 67, 729, 11, 9455, 25060, 11, 16000, 25060, 11, 7066, 1010, 11, 42427, 25060, 198, 11748, 18931, 198, 198, 6738, 3384, 4487, 1330, 13368, 2538, 10761, 2390, 62, 10468, 43959, 198, 6738, 32847, 133...
3.210938
128
#!/usr/bin/env python """ Simple surface plot example """ from gr import * from math import * x = [-2 + i * 0.5 for i in range(0, 29)] y = [-7 + i * 0.5 for i in range(0, 29)] z = list(range(0, 841)) for i in range(0, 29): for j in range(0, 29): r1 = sqrt((x[j] - 5)**2 + y[i]**2) r2 = sqrt((x[j] + 5)**2 + y[i]**2) z[i * 29 - 1 + j] = (exp(cos(r1)) + exp(cos(r2)) - 0.9) * 25 setcharheight(24.0/500) settextalign(TEXT_HALIGN_CENTER, TEXT_VALIGN_TOP) textext(0.5, 0.9, "Surface Example") (tbx, tby) = inqtextext(0.5, 0.9, "Surface Example") fillarea(tbx, tby) setwindow(-2, 12, -7, 7) setspace(-80, 200, 45, 70) setcharheight(14.0/500) axes3d(1, 0, 20, -2, -7, -80, 2, 0, 2, -0.01) axes3d(0, 1, 0, 12, -7, -80, 0, 2, 0, 0.01) titles3d("X-Axis", "Y-Axis", "Z-Axis") surface(x, y, z, 3) surface(x, y, z, 1) updatews()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 198, 26437, 4417, 7110, 1672, 198, 37811, 198, 198, 6738, 1036, 1330, 1635, 220, 198, 6738, 10688, 1330, 1635, 198, 198, 87, 796, 25915, 17, 1343, 1312, 1635, 657, 13, 20, 329, ...
1.915718
439
# function that will be distributed # wrapper function, uses the dask client object
[ 2, 2163, 326, 481, 307, 9387, 628, 198, 2, 29908, 2163, 11, 3544, 262, 288, 2093, 5456, 2134, 198 ]
4.526316
19
"""Main functionalities.""" from .image.image import (Image, RawDataContainer) from .image.color_format import AVAILABLE_FORMATS from .parser.factory import ParserFactory import cv2 as cv import os
[ 37811, 13383, 10345, 871, 526, 15931, 198, 198, 6738, 764, 9060, 13, 9060, 1330, 357, 5159, 11, 16089, 6601, 29869, 8, 198, 6738, 764, 9060, 13, 8043, 62, 18982, 1330, 317, 11731, 4146, 17534, 62, 21389, 33586, 198, 6738, 764, 48610, ...
3.274194
62
"""demo URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.conf import settings from django.contrib import admin from django.views.generic import TemplateView import debug_toolbar from rockband import rocking_urls # from movies import urls as movie_urls from async import async_urls urlpatterns = [ url(r'^$', TemplateView.as_view(template_name="index.html")), url(r'^admin/', admin.site.urls), # Rock band urls url(r'^bands/', include(rocking_urls)), # asynchronous demo app url(r'^async/', include(async_urls)), # url(r'$movies/', include(movie_urls)) # Django auth views url('^', include('django.contrib.auth.urls')), ] # For the debug toolbar if settings.DEBUG: urlpatterns += [ url(r'^__debug__/', include(debug_toolbar.urls)), ]
[ 37811, 9536, 78, 10289, 28373, 198, 198, 464, 4600, 6371, 33279, 82, 63, 1351, 11926, 32336, 284, 5009, 13, 1114, 517, 1321, 3387, 766, 25, 198, 220, 220, 220, 3740, 1378, 31628, 13, 28241, 648, 404, 305, 752, 13, 785, 14, 268, 14, ...
2.715649
524
from django.urls import path from .views import teacherregister,studentregister,login_view,logout from . import views from .views import ( ClassroomCreateView,ClassroomListView,ClassroomDetailView,ClassroomUpdateView,ClassroomDeleteView, SubjectCreateView,SubjectListView,SubjectDetailView,SubjectUpdateView,SubjectDeleteView, ClassMemberCreateView,ClassMemberListView,ClassMemberDetailView,ClassMemberUpdateView,ClassMemberDeleteView, TimetableCreateView,TimetableListView,TimetableDetailView,TimetableUpdateView,TimetableDeleteView,CrudView,chatroom ) urlpatterns = [ path('', views.index, name='index'), path('health', views.health, name='health'), path('404', views.handler404, name='404'), path('500', views.handler500, name='500'), path('signup/teacher', teacherregister,name='register-teacher'), path('signup/student', studentregister,name='register-student'), path('accounts/login/', login_view, name='login'), path('logout/', logout,name='logout'), #Classroom path('classroom/new', ClassroomCreateView.as_view(),name='classroom-create'), path('classroom_list', ClassroomListView.as_view(),name='classroom-list'), path('classroom/<str:pk>/', ClassroomDetailView.as_view(),name='classroom-detail'), path('classroom/<str:pk>/update', ClassroomUpdateView.as_view(),name='classroom-update'), path('classroom/<str:pk>/delete', ClassroomDeleteView.as_view(),name='classroom-delete'), #path('Classroom/<int:pk>/image',ChildImageUpdateView.as_view(),name='Classroom-image'), #Subject path('subject/new', SubjectCreateView.as_view(),name='subject-create'), path('subject_list', SubjectListView.as_view(),name='subject-list'), path('subject/<int:pk>/', SubjectDetailView.as_view(),name='subject-detail'), path('subject/<int:pk>/update', SubjectUpdateView.as_view(),name='subject-update'), path('subject/<int:pk>/delete', SubjectDeleteView.as_view(),name='subject-delete'), # Class Members path('classmember/new', ClassMemberCreateView.as_view(),name='classmember-create'), path('classmember_list', ClassMemberListView.as_view(),name='classmember-list'), path('classmember/<str:pk>/', ClassMemberDetailView.as_view(),name='classmember-detail'), path('classmember/<str:pk>/update', ClassMemberUpdateView.as_view(),name='classmember-update'), path('classmember/<str:pk>/delete', ClassMemberDeleteView.as_view(),name='classmember-delete'), # TimeTable path('timetable/new', TimetableCreateView.as_view(),name='timetable-create'), path('timetable_list', TimetableListView.as_view(),name='timetable-list'), path('timetable/<int:pk>/', TimetableDetailView.as_view(),name='timetable-detail'), path('timetable/<int:pk>/update', TimetableUpdateView.as_view(),name='timetable-update'), path('timetable/<int:pk>/delete', TimetableDeleteView.as_view(),name='timetable-delete'), # chatroom path('chat/new',chatroom,name='chatroom'), path('crud/',CrudView.as_view(), name='crud_ajax'), ]
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 6738, 764, 33571, 1330, 4701, 30238, 11, 50139, 30238, 11, 38235, 62, 1177, 11, 6404, 448, 198, 6738, 764, 1330, 5009, 198, 6738, 764, 33571, 1330, 357, 198, 9487, 3823, 16447, 7680, ...
2.310963
1,505
#!/usr/bin/env python """ CLI tool to runs various tasks related to QA. """ import os import time from pathlib import Path import sys import traceback import json import yaml import uuid import datetime import click from .run import RunContext from .runners import runners, Job, JobGroup from .runners.lsf import LsfPriority from .conventions import batch_dir, batch_dir, make_batch_dir, make_batch_conf_dir, make_hash from .conventions import serialize_config, deserialize_config, get_settings from .utils import PathType, entrypoint_module, load_tuning_search from .utils import save_outputs_manifest, total_storage from .utils import redirect_std_streams from .utils import getenvs from .api import url_to_dir, print_url from .api import get_outputs, notify_qa_database, serialize_paths from .iterators import iter_inputs, iter_parameters from .config import config_has_error, ignore_config_errors from .config import project, project_root, subproject, config from .config import default_batches_files, get_default_database, default_batch_label, default_platform from .config import get_default_configuration, default_input_type from .config import commit_id, outputs_commit, artifacts_commit, root_qatools, artifacts_commit_root, outputs_commit_root from .config import user, is_ci, on_windows def postprocess_(runtime_metrics, run_context, skip=False, save_manifests_in_database=False): """Computes computes various success metrics and outputs.""" from .utils import file_info try: if not skip: try: entrypoint_postprocess = entrypoint_module(config).postprocess except: metrics = runtime_metrics else: metrics = entrypoint_postprocess(runtime_metrics, run_context) else: metrics = runtime_metrics except: exc_type, exc_value, exc_traceback = sys.exc_info() # TODO: in case of import error because postprocess was not defined, just ignore it...? # TODO: we should provide a default postprocess function, that reads metrics.json and returns {**previous, **runtime_metrics} exc_type, exc_value, exc_traceback = sys.exc_info() click.secho(f'[ERROR] Your `postprocess` function raised an exception:', fg='red', bold=True) click.secho(''.join(traceback.format_exception(exc_type, exc_value, exc_traceback)), fg='red') metrics = {**runtime_metrics, 'is_failed': True} if 'is_failed' not in metrics: click.secho("[Warning] The result of the `postprocess` function misses a key `is_failed` (bool)", fg='yellow') metrics['is_failed'] = False if (run_context.output_dir / 'metrics.json').exists(): with (run_context.output_dir / 'metrics.json').open('r') as f: previous_metrics = json.load(f) metrics = { **previous_metrics, **metrics, } with (run_context.output_dir / 'metrics.json').open('w') as f: json.dump(metrics, f, sort_keys=True, indent=2, separators=(',', ': ')) # To help identify if input files change, we compute and save some metadata. if is_ci or save_manifests_in_database: manifest_inputs = run_context.obj.get('manifest-inputs', [run_context.input_path]) input_files = {} for manifest_input in manifest_inputs: manifest_input = Path(manifest_input) if manifest_input.is_dir(): for idx, path in enumerate(manifest_input.rglob('*')): if idx >= 200: break if not path.is_file(): continue input_files[path.as_posix()] = file_info(path, config=config) elif manifest_input.is_file(): input_files.update({manifest_input.as_posix(): file_info(manifest_input, config=config)}) with (run_context.output_dir / 'manifest.inputs.json').open('w') as f: json.dump(input_files, f, indent=2) outputs_manifest = save_outputs_manifest(run_context.output_dir, config=config) output_data = { 'storage': total_storage(outputs_manifest), } if save_manifests_in_database: if run_context.input_path.is_file(): click.secho('WARNING: saving the manifests in the database is only implemented for inputs that are *folders*.', fg='yellow', err=True) else: from .utils import copy copy(run_context.output_dir / 'manifest.inputs.json', run_context.input_path / 'manifest.inputs.json') copy(run_context.output_dir / 'manifest.outputs.json', run_context.input_path / 'manifest.outputs.json') if not run_context.obj.get('offline') and not run_context.obj.get('dryrun'): notify_qa_database(**run_context.obj, metrics=metrics, data=output_data, is_pending=False, is_running=False) return metrics runners_config = config.get('runners', {}) if 'default' in runners_config: default_runner = runners_config['default'] else: task_runners = [r for r in runners_config if r not in ['default', 'local']] default_runner = task_runners[0] if task_runners else 'local' lsf_config = config['lsf'] if 'lsf' in config else config.get('runners', {}).get('lsf', {}) if 'lsf' in config: default_runner = 'lsf' if default_runner == 'lsf' and os.name=='nt': default_runner = 'local' local_config = config.get('runners', {}).get('local', {}) from .optimize import optimize qa.add_command(optimize) # TODO: split more... # from .bit_accuracy import check_bit_accuracy, check_bit_accuracy_manifest # qa.add_command(check_bit_accuracy) # qa.add_command(check_bit_accuracy_manifest) if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 198, 5097, 40, 2891, 284, 4539, 2972, 8861, 3519, 284, 1195, 32, 13, 198, 37811, 198, 11748, 28686, 198, 11748, 640, 198, 6738, 3108, 8019, 1330, 10644, 198, 11748, 25064, 198, ...
2.830817
1,921
# -*- coding: utf-8 -*- import threading import time import global_def as gd from db_reader import DbReaderDef, DbReaer from queue import Queue, Empty
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 4704, 278, 198, 11748, 640, 198, 11748, 3298, 62, 4299, 355, 308, 67, 198, 6738, 20613, 62, 46862, 1330, 360, 65, 33634, 7469, 11, 360, 65, 3041, 25534, 198, 67...
2.923077
52
import logging from rest_framework import mixins, generics, permissions, exceptions from django.conf import settings from django.utils import timezone from .serializers import CategorySerializer, TagSerializer, TodoSerializer from .models import Category, Tag, Todo logger = logging.getLogger(__name__)
[ 11748, 18931, 198, 198, 6738, 1334, 62, 30604, 1330, 5022, 1040, 11, 1152, 873, 11, 21627, 11, 13269, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 26791, 1330, 640, 11340, 198, 198, 6738, 764, 46911, 1134...
3.738095
84
# coding=utf-8 # # This file is part of Hypothesis (https://github.com/DRMacIver/hypothesis) # # Most of this work is copyright (C) 2013-2015 David R. MacIver # (david@drmaciver.com), but it contains contributions by others. See # https://github.com/DRMacIver/hypothesis/blob/master/CONTRIBUTING.rst for a # full list of people who may hold copyright, and consult the git log if you # need to determine who owns an individual contribution. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # END HEADER """A module controlling settings for Hypothesis to use in falsification. Either an explicit settings object can be used or the default object on this module can be modified. """ from __future__ import division, print_function, absolute_import import os import inspect import warnings import threading from collections import namedtuple from hypothesis.errors import InvalidArgument, HypothesisDeprecationWarning from hypothesis.configuration import hypothesis_home_dir from hypothesis.utils.conventions import not_set from hypothesis.utils.dynamicvariables import DynamicVariable __all__ = [ 'settings', ] all_settings = {} _db_cache = {} default_variable = DynamicVariable(None) class settings(SettingsMeta('settings', (object,), {})): """A settings object controls a variety of parameters that are used in falsification. These may control both the falsification strategy and the details of the data that is generated. Default values are picked up from the settings.default object and changes made there will be picked up in newly created settings. """ _WHITELISTED_REAL_PROPERTIES = [ '_database', '_construction_complete', 'storage' ] __definitions_are_locked = False _profiles = {} def __setattr__(self, name, value): if name in settings._WHITELISTED_REAL_PROPERTIES: return object.__setattr__(self, name, value) elif name == 'database': if self._construction_complete: raise AttributeError( 'Settings objects are immutable and may not be assigned to' ' after construction.' ) else: return object.__setattr__(self, '_database', value) elif name in all_settings: if self._construction_complete: raise AttributeError( 'Settings objects are immutable and may not be assigned to' ' after construction.' ) else: setting = all_settings[name] if ( setting.options is not None and value not in setting.options ): raise InvalidArgument( 'Invalid %s, %r. Valid options: %r' % ( name, value, setting.options ) ) return object.__setattr__(self, name, value) else: raise AttributeError('No such setting %s' % (name,)) Setting = namedtuple( 'Setting', ( 'name', 'description', 'default', 'options', 'deprecation')) settings.define_setting( 'min_satisfying_examples', default=5, description=""" Raise Unsatisfiable for any tests which do not produce at least this many values that pass all assume() calls and which have not exhaustively covered the search space. """ ) settings.define_setting( 'max_examples', default=200, description=""" Once this many satisfying examples have been considered without finding any counter-example, falsification will terminate. """ ) settings.define_setting( 'max_iterations', default=1000, description=""" Once this many iterations of the example loop have run, including ones which failed to satisfy assumptions and ones which produced duplicates, falsification will terminate. """ ) settings.define_setting( 'max_shrinks', default=500, description=""" Once this many successful shrinks have been performed, Hypothesis will assume something has gone a bit wrong and give up rather than continuing to try to shrink the example. """ ) settings.define_setting( 'timeout', default=60, description=""" Once this many seconds have passed, falsify will terminate even if it has not found many examples. This is a soft rather than a hard limit - Hypothesis won't e.g. interrupt execution of the called function to stop it. If this value is <= 0 then no timeout will be applied. """ ) settings.define_setting( 'derandomize', default=False, description=""" If this is True then hypothesis will run in deterministic mode where each falsification uses a random number generator that is seeded based on the hypothesis to falsify, which will be consistent across multiple runs. This has the advantage that it will eliminate any randomness from your tests, which may be preferable for some situations . It does have the disadvantage of making your tests less likely to find novel breakages. """ ) settings.define_setting( 'strict', default=os.getenv('HYPOTHESIS_STRICT_MODE') == 'true', description=""" If set to True, anything that would cause Hypothesis to issue a warning will instead raise an error. Note that new warnings may be added at any time, so running with strict set to True means that new Hypothesis releases may validly break your code. You can enable this setting temporarily by setting the HYPOTHESIS_STRICT_MODE environment variable to the string 'true'. """ ) settings.define_setting( 'database_file', default=lambda: ( os.getenv('HYPOTHESIS_DATABASE_FILE') or os.path.join(hypothesis_home_dir(), 'examples.db') ), description=""" database: An instance of hypothesis.database.ExampleDatabase that will be used to save examples to and load previous examples from. May be None in which case no storage will be used. """ ) Verbosity.quiet = Verbosity('quiet', 0) Verbosity.normal = Verbosity('normal', 1) Verbosity.verbose = Verbosity('verbose', 2) Verbosity.debug = Verbosity('debug', 3) Verbosity.all = [ Verbosity.quiet, Verbosity.normal, Verbosity.verbose, Verbosity.debug ] ENVIRONMENT_VERBOSITY_OVERRIDE = os.getenv('HYPOTHESIS_VERBOSITY_LEVEL') if ENVIRONMENT_VERBOSITY_OVERRIDE: DEFAULT_VERBOSITY = Verbosity.by_name(ENVIRONMENT_VERBOSITY_OVERRIDE) else: DEFAULT_VERBOSITY = Verbosity.normal settings.define_setting( 'verbosity', options=Verbosity.all, default=DEFAULT_VERBOSITY, description='Control the verbosity level of Hypothesis messages', ) settings.define_setting( name='stateful_step_count', default=50, description=""" Number of steps to run a stateful program for before giving up on it breaking. """ ) settings.define_setting( 'perform_health_check', default=True, description=u""" If set to True, Hypothesis will run a preliminary health check before attempting to actually execute your test. """ ) settings.lock_further_definitions() settings.register_profile('default', settings()) settings.load_profile('default') assert settings.default is not None
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 21209, 313, 8497, 357, 5450, 1378, 12567, 13, 785, 14, 7707, 14155, 40, 332, 14, 36362, 313, 8497, 8, 198, 2, 198, 2, 4042, 286, 428, 670, 318, 6634, 357, ...
2.902497
2,523
""" Script to generate a security pipeline for PDF files. It does the following: - Adds specified meta-data - Encrypts file Run: python3 pipeline.py """ from PyPDF2 import PdfFileWriter, PdfFileReader from PyPDF2.generic import NameObject, createStringObject if __name__ == '__main__': # path for the file to process filepath = "/Users/victor/Desktop/Apex.AI_Threat_Model_AliasRobotics.pdf" # meta-data-value meta_value = u'HitachiVentures' meta(input_pdf=filepath, output_pdf=filepath+"underNDA.pdf", value=meta_value) encrypt(input_pdf=filepath+"underNDA.pdf", output_pdf=filepath+"underNDA_encrypted.pdf", password='4l14srobotics')
[ 37811, 198, 7391, 284, 7716, 257, 2324, 11523, 329, 12960, 3696, 13, 198, 1026, 857, 262, 1708, 25, 198, 12, 34333, 7368, 13634, 12, 7890, 198, 12, 14711, 6012, 82, 2393, 198, 198, 10987, 25, 198, 220, 220, 220, 21015, 18, 11523, 13...
2.491349
289
import glob from numpy.linalg import norm import numpy as np from copy import deepcopy as copy from MergeTrack.merge_functions import read_ann,read_props from MergeTrack.ReID_net_functions import ReID_net_init, add_ReID input_images = "DAVIS/val17/" input_proposals = "DAVIS/ReID_props/" first_frame_anns = "DAVIS/val17-ff/" output_images = "DAVIS/final_results/" output_proposals = "DAVIS/final_props/" ReID_net = ReID_net_init() dataset_max_distances = [] for video_fn in sorted(glob.glob(input_images+"*/")): video_proposals = [] templates = [] for image_fn in sorted(glob.glob(video_fn+"*")): ann_fn = image_fn.replace(input_images,first_frame_anns).replace('.jpg','.png') if glob.glob(ann_fn): new_templates = read_ann(ann_fn) new_templates = add_ReID(new_templates, image_fn, ReID_net) # import json # ff_fn = image_fn.replace(input_images, "DAVIS/ff_test/").replace('.jpg', '.json') # with open(ff_fn, "r") as f: # new_templates = json.load(f) # for id, templ in enumerate(new_templates): # templ['ReID'] = np.array(templ['ReID']) # templ['id'] = id templates = templates + new_templates prop_fn = image_fn.replace(input_images,input_proposals).replace('.jpg','.json') proposals = read_props(prop_fn) video_proposals.append(proposals) ReIDs = [[prop['ReID'] for prop in props] for props in video_proposals] template_ReIDs = [templ['ReID'] for templ in templates] all_reid_distances = [np.array([[norm(c_reid - gt_reid) for c_reid in curr] for gt_reid in template_ReIDs]) for curr in ReIDs] all_reid_distances_no_inf = copy(all_reid_distances) for mat in all_reid_distances_no_inf: mat[np.isinf(mat)] = 0 max_distances = np.array([mat.max(axis=1) if mat.shape[1]>0 else np.zeros((mat.shape[0])) for mat in all_reid_distances_no_inf]).max(axis=0) print(max_distances) dataset_max_distances.append(max_distances.max()) print(np.array(dataset_max_distances).max())
[ 11748, 15095, 198, 6738, 299, 32152, 13, 75, 1292, 70, 1330, 2593, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 4866, 1330, 2769, 30073, 355, 4866, 198, 198, 6738, 39407, 24802, 13, 647, 469, 62, 12543, 2733, 1330, 1100, 62, 1236, 1...
2.422655
821
import unittest import string_matching if __name__ == '__main__': unittest.main()
[ 11748, 555, 715, 395, 198, 11748, 4731, 62, 15699, 278, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419, 628 ]
2.666667
33
import numpy as np import pytest import molecool_test
[ 11748, 299, 32152, 355, 45941, 198, 11748, 12972, 9288, 198, 198, 11748, 9411, 24494, 62, 9288, 628, 628, 628, 198 ]
3.05
20
from unittest import TestCase from unittest.mock import patch, MagicMock, PropertyMock from basketball_reference_web_scraper.html import SearchPage, PlayerSearchResult
[ 6738, 555, 715, 395, 1330, 6208, 20448, 198, 6738, 555, 715, 395, 13, 76, 735, 1330, 8529, 11, 6139, 44, 735, 11, 14161, 44, 735, 198, 198, 6738, 9669, 62, 35790, 62, 12384, 62, 1416, 38545, 13, 6494, 1330, 11140, 9876, 11, 7853, ...
3.695652
46
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to non-U.S. persons whether in the United States or abroad requires # an export license or other authorization. # # Contractor Name: Raytheon Company # Contractor Address: 6825 Pine Street, Suite 340 # Mail Stop B8 # Omaha, NE 68106 # 402.291.0100 # # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## # ---------------------------------------------------------------------------- # This software is in the public domain, furnished "as is", without technical # support, and with no warranty, express or implied, as to its usefulness for # any purpose. # # New_WindGust_Tool # # Authors: Tom Mazza NWS Charleston, WV Created: 04/25/03 # Matthew H. Belk NWS Taunton, MA Last Modified: 06/16/03 # Mathewson FSL Modified: 3/30/04 # -change in model names to OB3 names #---------------------------------------------------------------------------- # # SOFTWARE HISTORY # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 02/10/2016 5283 nabowle Remove NGM support. # ---------------------------------------------------------------------------- ## # This is an absolute override file, indicating that a higher priority version # of the file will completely replace a lower priority version of the file. ## ToolType = "numeric" WeatherElementEdited = "WindGust" from numpy import * # without this, the builtin max() is used from numpy import max import LogStream # You can screen the elements for which your tool will appear by using # a ScreenList. For example: #ScreenList = ["MixHgt","WindGust", "TransWind"] # Set up variables to be solicited from the user: VariableList = [ ("Momentum algorithm:", "RUC", "radio", ["RUC", "Power"]), ("Use BL Winds:", "No", "radio", ["Yes", "No"]), ("Model:", "NAM12", "radio", ["GFS80", "NAM12", "gfsLR", "RAP40"]) ] #Set up Class import SmartScript ## For available commands, see SmartScript toolName = 'WindGustFromAlgorithm'
[ 2235, 198, 2, 770, 3788, 373, 4166, 290, 1220, 393, 9518, 416, 7760, 1169, 261, 5834, 11, 198, 2, 12997, 284, 17453, 46133, 16945, 54, 12, 2713, 12, 34, 48, 12, 940, 3134, 351, 262, 1294, 5070, 13, 201, 198, 2, 220, 201, 198, 2,...
2.818975
917
from abc import ABC from typing import List from zeep import CachingClient, Client, Settings from .exceptions import APIError
[ 6738, 450, 66, 1330, 9738, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 41271, 538, 1330, 327, 8103, 11792, 11, 20985, 11, 16163, 198, 198, 6738, 764, 1069, 11755, 1330, 7824, 12331, 628, 628 ]
3.852941
34
# @Time: 2022/4/12 20:50 # @Author: chang liu # @Email: chang_liu_tamu@gmail.com # @File:4.4.Implementing_the_iterator_protocol.py ################ clean version ######################### # class Node: # def __init__(self, val): # self._value = val # self._children = [] # # def __repr__(self): # return "Node({!r})".format(self._value) # # def add_child(self, node): # self._children.append(node) # # def __iter__(self): # return iter(self._children) # # def depth_first(self): # yield self # for c in self: # yield from c.depth_first() ############# some messy version #################### root = Node(0) left = Node(1) right = Node(2) left.add_child(Node(3)) left.add_child(Node(4)) right.add_child(Node(5)) right.add_child(Node(6)) root.add_child(left) root.add_child(right) for i in root.depth_first(): print(i) # for i in root: # print(i)
[ 2, 2488, 7575, 25, 33160, 14, 19, 14, 1065, 1160, 25, 1120, 198, 2, 2488, 13838, 25, 1488, 7649, 84, 198, 2, 2488, 15333, 25, 1488, 62, 4528, 84, 62, 83, 321, 84, 31, 14816, 13, 785, 198, 2, 2488, 8979, 25, 19, 13, 19, 13, 3...
2.260143
419
import tensorflow as tf import tensorflow_probability as tfp import numpy as np import pickle import random from utils import gauss_cross_entropy tfk = tfp.math.psd_kernels def forward_pass_FGPVAE_rotated_mnist(data_batch, beta, vae, GP, N_t, clipping_qs, bayes_reg_view, omit_C_tilde, C_ma, lagrange_mult, alpha, kappa, GECO=False): """ :param data_batch: :param beta: :param vae: :param GP: :param N_t: :param clipping_qs: :param bayes_reg_view: whether or not to use Bayesian regresion view for linear kernel in global channels :param omit_C_tilde: omit C_tilde from derivation and modify cross-entropy term instead :param C_ma: average constraint from t-1 step (GECO) :param lagrange_mult: lambda from t-1 step (GECO) :param kappa: reconstruction level parameter for GECO :param alpha: moving average parameter for GECO :param GECO: whether or not to use GECO algorithm for training :return: """ images, aux_data = data_batch aux_data = tf.reshape(aux_data, (-1, N_t, 10)) L = vae.L L_w = GP.L_w w = tf.shape(images)[1] h = tf.shape(images)[2] K = tf.cast(w, dtype=tf.float64) * tf.cast(h, dtype=tf.float64) b = tf.cast(tf.shape(images)[0], dtype=tf.float64) # batch_size # ENCODER NETWORK qnet_mu, qnet_var = vae.encode(images) qnet_mu = tf.reshape(qnet_mu, (-1, N_t, L)) qnet_var = tf.reshape(qnet_var, (-1, N_t, L)) # clipping of VAE posterior variance if clipping_qs: qnet_var = tf.clip_by_value(qnet_var, 1e-3, 100) # GP p_m, p_v, lhoods_local, lhoods_global = [], [], [], [] for i in range(L_w): # fit local GPs p_m_i, p_v_i, lhood_i, K_local = GP.build_1d_gp_local(X=aux_data[:, :, 1], Y=qnet_mu[:, :, i], varY=qnet_var[:, :, i], X_test=aux_data[:, :, 1]) p_m.append(p_m_i) p_v.append(p_v_i) lhoods_local.append(lhood_i) ce_global_arr = [] for i in range(L_w, L): # fit global GPs if GP.object_prior_corr: object_aux_data_filtered = tf.transpose(aux_data[:, ::N_t, :], perm=[1, 0, 2]) bar_means, bar_vars, C_tilde = GP.preprocess_1d_gp_global_correlated_object_priors(qnet_mu[:, :, i], qnet_var[:, :, i]) p_m_i, p_v_i, lhood_i = GP.build_1d_gp_global_correlated_object_priors(object_aux_data_filtered, bar_means, bar_vars, object_aux_data_filtered, C_tilde, bayesian_reg_view=bayes_reg_view, omit_C_tilde=omit_C_tilde) if omit_C_tilde: ce_global_i = gauss_cross_entropy(p_m_i, p_v_i, bar_means, bar_vars) ce_global_arr.append(ce_global_i) else: p_m_i, p_v_i, lhood_i = GP.build_1d_gp_global(means=qnet_mu[:, :, i], vars=qnet_var[:, :, i]) # repeat p_m_i and p_v_i N_t times, since those are shared across all images within one object dataset D_t p_m_i = tf.tile(tf.expand_dims(p_m_i, 1), [1, N_t]) p_v_i = tf.tile(tf.expand_dims(p_v_i, 1), [1, N_t]) p_m.append(p_m_i) p_v.append(p_v_i) lhoods_global.append(lhood_i) p_m = tf.stack(p_m, axis=2) p_v = tf.stack(p_v, axis=2) if GP.object_prior_corr: # for local channels sum over latent channels and over digits' datasets # for global channels we only sum over latent channels (as there is only one global GP per channel) lhoods = tf.reduce_sum(lhoods_local, axis=(0, 1)) + tf.reduce_sum(lhoods_global, axis=0) # CE (cross-entropy) if omit_C_tilde: ce_global = tf.reduce_sum(ce_global_arr) ce_local = gauss_cross_entropy(p_m[:, :, :L_w], p_v[:, :, :L_w], qnet_mu[:, :, :L_w], qnet_var[:, :, :L_w]) ce_local = tf.reduce_sum(ce_local, (0, 1, 2)) # sum also over digits' datasets ce_term = ce_global + ce_local else: ce_term = gauss_cross_entropy(p_m, p_v, qnet_mu, qnet_var) ce_term = tf.reduce_sum(ce_term, (0, 1, 2)) # sum also over digits' datasets # KL part elbo_kl_part = lhoods - ce_term else: lhoods = lhoods_global + lhoods_local lhoods = tf.reduce_sum(lhoods, axis=0) # CE (cross-entropy) ce_term = gauss_cross_entropy(p_m, p_v, qnet_mu, qnet_var) ce_term = tf.reduce_sum(ce_term, (1, 2)) # KL part elbo_kl_part = lhoods - ce_term # SAMPLE epsilon = tf.random.normal(shape=tf.shape(p_m), dtype=tf.float64) latent_samples = p_m + epsilon * tf.sqrt(p_v) # DECODER NETWORK (Gaussian observational likelihood, MSE) recon_images = vae.decode(tf.reshape(latent_samples, (-1, L))) if GP.object_prior_corr: if GECO: recon_loss = tf.reduce_sum((tf.reshape(images, (-1, N_t, w, h)) - tf.reshape(recon_images, (-1, N_t, w, h))) ** 2, axis=[2, 3]) recon_loss = tf.reduce_sum(recon_loss/K - kappa**2) C_ma = alpha * C_ma + (1 - alpha) * recon_loss / b # elbo = - (1/L) * KL_term + lagrange_mult * C_ma # elbo = - (1/b) * KL_term + lagrange_mult * C_ma # elbo = - KL_term + lagrange_mult * C_ma elbo = - elbo_kl_part + lagrange_mult * (recon_loss / b + tf.stop_gradient(C_ma - recon_loss / b)) lagrange_mult = lagrange_mult * tf.exp(C_ma) else: recon_loss = tf.reduce_sum((tf.reshape(images, (-1, N_t, w, h)) - tf.reshape(recon_images, (-1, N_t, w, h))) ** 2, axis=[1, 2, 3]) recon_loss = tf.reduce_sum(recon_loss) / K elbo = -recon_loss + (beta / L) * elbo_kl_part else: if GECO: recon_loss = tf.reduce_mean((tf.reshape(images, (-1, N_t, w, h)) - tf.reshape(recon_images, (-1, N_t, w, h))) ** 2, axis=[2, 3]) N_t = tf.cast(N_t, dtype=tf.float64) C_ma = alpha * C_ma + (1 - alpha) * tf.reduce_mean(recon_loss - kappa ** 2) recon_loss = tf.reduce_sum(recon_loss - kappa ** 2) # elbo = - (1/L) * elbo_kl_part + lagrange_mult * C_ma # elbo = - (1/b) * elbo_kl_part + lagrange_mult * C_ma # elbo = - elbo_kl_part + lagrange_mult * C_ma elbo = - elbo_kl_part + lagrange_mult * (recon_loss / N_t + tf.stop_gradient(C_ma - recon_loss / N_t)) lagrange_mult = lagrange_mult * tf.exp(C_ma) else: recon_loss = tf.reduce_sum((tf.reshape(images, (-1, N_t, w, h)) - tf.reshape(recon_images, (-1, N_t, w, h))) ** 2, axis=[1, 2, 3]) # ELBO # beta plays role of sigma_gaussian_decoder here (\lambda(\sigma_y) in Casale paper) # K and L are not part of ELBO. They are used in loss objective to account for the fact that magnitudes of # reconstruction and KL terms depend on number of pixels (K) and number of latent GPs used (L), respectively recon_loss = recon_loss / K elbo = -recon_loss + (beta/L) * elbo_kl_part # average across object datasets elbo = tf.reduce_sum(elbo) elbo_kl_part = tf.reduce_sum(elbo_kl_part) recon_loss = tf.reduce_sum(recon_loss) return elbo, recon_loss, elbo_kl_part, p_m, p_v, qnet_mu, qnet_var, recon_images, latent_samples, C_ma, lagrange_mult def predict_FGPVAE_rotated_mnist(test_images, test_aux_data, train_images, train_aux_data, vae, GP, bayes_reg_view, omit_C_tilde, N_t=15, clipping_qs=False): """ Get FGPVAE predictions for rotated MNIST test data. :param test_data_batch: :param train_images: :param train_aux_data: :param vae: :param GP: :param N_t: :param clipping_qs: :return: """ L = vae.L L_w = GP.L_w w = tf.shape(train_images)[1] h = tf.shape(train_images)[2] train_aux_data = tf.reshape(train_aux_data, (-1, N_t, 10)) test_aux_data = tf.expand_dims(test_aux_data, 1) # encode train images qnet_mu, qnet_var = vae.encode(train_images) qnet_mu = tf.reshape(qnet_mu, (-1, N_t, L)) qnet_var = tf.reshape(qnet_var, (-1, N_t, L)) # clipping of VAE posterior variance if clipping_qs: qnet_var = tf.clip_by_value(qnet_var, 1e-3, 100) # GP, get latent embeddings for test images p_m, p_v = [], [] for i in range(L_w): # fit local GPs p_m_i, p_v_i, _ , _= GP.build_1d_gp_local(X=train_aux_data[:, :, 1], Y=qnet_mu[:, :, i], varY=qnet_var[:, :, i], X_test=test_aux_data[:, :, 1]) p_m.append(p_m_i) p_v.append(p_v_i) for i in range(L_w, L): # fit global GPs if GP.object_prior_corr: object_aux_data_filtered = tf.transpose(train_aux_data[:, ::N_t, :], perm=[1, 0, 2]) bar_means, bar_vars, C_tilde = GP.preprocess_1d_gp_global_correlated_object_priors(qnet_mu[:, :, i], qnet_var[:, :, i]) p_m_i, p_v_i, _ = GP.build_1d_gp_global_correlated_object_priors(object_aux_data_filtered, bar_means, bar_vars, object_aux_data_filtered, C_tilde, omit_C_tilde=omit_C_tilde, bayesian_reg_view=bayes_reg_view) else: p_m_i, p_v_i, _ = GP.build_1d_gp_global(means=qnet_mu[:, :, i], vars=qnet_var[:, :, i]) p_m.append(tf.expand_dims(p_m_i, 1)) p_v.append(tf.expand_dims(p_v_i, 1)) p_m = tf.stack(p_m, axis=2) p_v = tf.stack(p_v, axis=2) # SAMPLE epsilon = tf.random.normal(shape=tf.shape(p_m), dtype=tf.float64) latent_samples = p_m + epsilon * tf.sqrt(p_v) # decode, calculate error (Gaussian observational likelihood, MSE) recon_images = vae.decode(tf.reshape(latent_samples, (-1, L))) recon_loss = tf.reduce_mean((test_images - recon_images) ** 2) return recon_images, recon_loss def extrapolate_experiment_eval_data(mnist_path, digit, N_t, pred_angle_id=7, nr_angles=16): """ Prepare validation dataset for the extrapolate experiment. :param mnist_path: :param digit: :param N_t: how many angles do we observe for each image in test set :param pred_angle_id: which angle to leave out for prediction :param nr_angles: size of object dataset :return: """ eval_data_dict = pickle.load(open(mnist_path + 'eval_data{}_not_shuffled.p'.format(digit), 'rb')) eval_images, eval_aux_data = eval_data_dict["images"], eval_data_dict["aux_data"] pred_angle_mask = [pred_angle_id + i * nr_angles for i in range(int(len(eval_aux_data) / nr_angles))] not_pred_angle_mask = [i for i in range(len(eval_images)) if i not in pred_angle_mask] observed_images = eval_images[not_pred_angle_mask] observed_aux_data = eval_aux_data[not_pred_angle_mask] # randomly drop some observed angles if N_t < 15: digit_mask = [True]*N_t + [False]*(15-N_t) mask = [random.sample(digit_mask, len(digit_mask)) for _ in range(int(len(eval_aux_data)/nr_angles))] flatten = lambda l: [item for sublist in l for item in sublist] mask = flatten(mask) observed_images = observed_images[mask] observed_aux_data = observed_aux_data[mask] test_images = eval_images[pred_angle_mask] test_aux_data = eval_aux_data[pred_angle_mask] return observed_images, observed_aux_data, test_images, test_aux_data def latent_samples_FGPVAE(train_images, train_aux_data, vae, GP, N_t, clipping_qs=False): """ Get latent samples for training data. For t-SNE plots :) :param train_images: :param train_aux_data: :param vae: :param GP: :param clipping_qs: :return: """ train_aux_data = tf.reshape(train_aux_data, (-1, N_t, 10)) L = vae.L L_w = GP.L_w # ENCODER NETWORK qnet_mu, qnet_var = vae.encode(train_images) qnet_mu = tf.reshape(qnet_mu, (-1, N_t, L)) qnet_var = tf.reshape(qnet_var, (-1, N_t, L)) # clipping of VAE posterior variance if clipping_qs: qnet_var = tf.clip_by_value(qnet_var, 1e-3, 100) # GP p_m, p_v = [], [] for i in range(L_w): # fit local GPs p_m_i, p_v_i, _, _ = GP.build_1d_gp_local(X=train_aux_data[:, :, 1], Y=qnet_mu[:, :, i], varY=qnet_var[:, :, i], X_test=train_aux_data[:, :, 1]) p_m.append(p_m_i) p_v.append(p_v_i) for i in range(L_w, L): # fit global GPs p_m_i, p_v_i, lhood_i = GP.build_1d_gp_global(means=qnet_mu[:, :, i], vars=qnet_var[:, :, i]) # repeat p_m_i and p_v_i N_t times, since those are shared across all images within one object dataset D_t p_m_i = tf.tile(tf.expand_dims(p_m_i, 1), [1, N_t]) p_v_i = tf.tile(tf.expand_dims(p_v_i, 1), [1, N_t]) p_m.append(p_m_i) p_v.append(p_v_i) p_m = tf.stack(p_m, axis=2) p_v = tf.stack(p_v, axis=2) # SAMPLE epsilon = tf.random.normal(shape=tf.shape(p_m), dtype=tf.float64) latent_samples = p_m + epsilon * tf.sqrt(p_v) return latent_samples
[ 11748, 11192, 273, 11125, 355, 48700, 201, 198, 11748, 11192, 273, 11125, 62, 1676, 65, 1799, 355, 256, 46428, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 11748, 2298, 293, 201, 198, 11748, 4738, 201, 198, 201, 198, 6738, 3384, ...
1.760689
8,537
from abc import ABC, abstractmethod from argparse import Namespace, ArgumentParser from spotty.commands.writers.abstract_output_writrer import AbstractOutputWriter
[ 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 1822, 29572, 1330, 28531, 10223, 11, 45751, 46677, 198, 6738, 4136, 774, 13, 9503, 1746, 13, 34422, 13, 397, 8709, 62, 22915, 62, 8933, 11751, 1330, 27741, 26410, 34379, 628 ]
4.125
40
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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. # # ------------------------------------------------------------------------------ """This module contains the tests for the protocol generator.""" import inspect import os import shutil import tempfile import yaml from aea.configurations.base import ProtocolSpecification from aea.configurations.loader import ConfigLoader from aea.protocols.generator import ProtocolGenerator CUR_PATH = os.path.dirname(inspect.getfile(inspect.currentframe())) # type: ignore # class TestCases(TestCase): # """Test class for the light protocol generator.""" # # def test_all_custom_data_types(self): # """Test all custom data types.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "all_custom.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # test_protocol_template.load() # test_protocol_generator = ProtocolGenerator(test_protocol_template, 'tests') # test_protocol_generator.generate() # # from two_party_negotiation_protocol.message import TwoPartyNegotiationMessage # from two_party_negotiation_protocol.serialization import TwoPartyNegotiationSerializer # from two_party_negotiation_protocol.message import DataModel # from two_party_negotiation_protocol.message import Signature # # data_model = DataModel() # signature = Signature() # content_list = [data_model, signature] # # message = TwoPartyNegotiationMessage(message_id=5, target=4, performative="propose", contents=content_list) # print(str.format("message is {}", message)) # message.check_consistency() # serialized_message = TwoPartyNegotiationSerializer().encode(msg=message) # print(str.format("serialized message is {}", serialized_message)) # deserialised_message = TwoPartyNegotiationSerializer().decode(obj=serialized_message) # print(str.format("deserialized message is {}", deserialised_message)) # # assert message == deserialised_message, "Failure" # # def test_correct_functionality(self): # """End to end test of functionality.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "correct_spec.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # test_protocol_template.load() # test_protocol_generator = ProtocolGenerator(test_protocol_template, 'tests') # test_protocol_generator.generate() # # from two_party_negotiation_protocol.message import TwoPartyNegotiationMessage # from two_party_negotiation_protocol.serialization import TwoPartyNegotiationSerializer # from two_party_negotiation_protocol.message import DataModel # # data_model = DataModel() # content_list = [data_model, 10.5] # # message = TwoPartyNegotiationMessage(message_id=5, target=4, performative="propose", contents=content_list) # print(str.format("message is {}", message)) # message.check_consistency() # serialized_message = TwoPartyNegotiationSerializer().encode(msg=message) # print(str.format("serialized message is {}", serialized_message)) # deserialised_message = TwoPartyNegotiationSerializer().decode(obj=serialized_message) # print(str.format("deserialized message is {}", deserialised_message)) # # assert message == deserialised_message, "Failure" # # def test_missing_name(self): # """Test missing name handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "missing_name.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # self.assertRaises(ProtocolSpecificationParseError, test_protocol_template.load) # # def test_missing_description(self): # """Test missing description handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "missing_description.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # assert test_protocol_template.load(), "Failure" # # def test_missing_speech_acts(self): # """Test missing speech acts handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "missing_speech_acts.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # self.assertRaises(ProtocolSpecificationParseError, test_protocol_template.load) # # def test_extra_fields(self): # """Test extra fields handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "extra_fields.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # assert test_protocol_template.load(), "Failure" # # def test_one_document(self): # """Test one document handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "one_document.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # self.assertRaises(ProtocolSpecificationParseError, test_protocol_template.load) # # def test_wrong_speech_act_type_sequence_performatives(self): # """Test wrong speech act handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "wrong_speech_act_type_sequence_performatives.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # self.assertRaises(ProtocolSpecificationParseError, test_protocol_template.load) # # def test_wrong_speech_act_type_dictionary_contents(self): # """Test wrong speech act dictionary contents handling.""" # test_protocol_specification_path = os.path.join(CUR_PATH, "data", "wrong_speech_act_type_dictionary_contents.yaml") # test_protocol_template = ProtocolTemplate(test_protocol_specification_path) # # self.assertRaises(ProtocolSpecificationParseError, test_protocol_template.load)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 16529, 26171, 198, 2, 198, 2, 220, 220, 15069, 2864, 12, 23344, 376, 7569, 13, 20185, 15302, 198, 2, 198, 2, 220, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 3...
2.769482
2,451
import os.path import os 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 from datetime import datetime # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/drive'] def main(): """Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to. """ 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: print("Refresh Creds") creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'client_secrets.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('drive', 'v3', credentials=creds) # Call the Drive v3 API results = service.files().list( q="mimeType = 'application/vnd.google-apps.folder' and '0ALNhV0hP-QYDUk9PVA' in parents", pageSize=100, fields="nextPageToken, files(id, name, parents)").execute() items = results.get('files', []) pic_id = '' if not items: print('No files found.') else: print('1st Files:') for item in items: if item['name']=='KIOSK Picture': pic_id = item['id'] print(u'{0} ({1}) - {2}'.format(item['name'], item['id'], item['parents'])) #print(pic_id) # Check Machine ID q_str = "mimeType = 'application/vnd.google-apps.folder' and '" + str(pic_id) +"' in parents" #print(q_str) results = service.files().list( q=q_str, #"mimeType = 'application/vnd.google-apps.folder' and '" + str(pic_id) +"' in parents", pageSize=10, fields="nextPageToken, files(id, name, parents)").execute() items = results.get('files', []) bHasBaseFolder = False sMachineID = 'Test_MachineID' sMachineID_ID = '' if not items: print('No files found.') else: print('2nd Files:') for item in items: if item['name']==sMachineID: bHasBaseFolder = True sMachineID_ID = item['id'] print(u'{0} ({1}) - {2}'.format(item['name'], item['id'], item['parents'])) if bHasBaseFolder == False: file_metadata = { 'name': sMachineID, 'mimeType': 'application/vnd.google-apps.folder', 'parents': [str(pic_id)] } file = service.files().create(body=file_metadata, fields='id').execute() sMachineID_ID = str(file.get('id')) print('Folder ID: %s' % file.get('id')) #print(sMachineID_ID) # Check Date Folder sTodayDateString = datetime.now().strftime("%Y%m%d") sTodayDate_ID = '' bHasBaseFolder = False q_str = "mimeType = 'application/vnd.google-apps.folder' and '" + str(sMachineID_ID) +"' in parents" results = service.files().list( q=q_str, pageSize=10, fields="nextPageToken, files(id, name, parents)").execute() items = results.get('files', []) if not items: print('No files found.') else: print('3nd Files:') for item in items: if item['name']==sTodayDateString: bHasBaseFolder = True sTodayDate_ID = item['id'] print(u'{0} ({1}) - {2}'.format(item['name'], item['id'], item['parents'])) if bHasBaseFolder == False: file_metadata = { 'name': sTodayDateString, 'mimeType': 'application/vnd.google-apps.folder', 'parents': [str(sMachineID_ID)] } file = service.files().create(body=file_metadata, fields='id').execute() sTodayDate_ID = str(file.get('id')) print('Folder ID: %s' % file.get('id')) #Check Test Location sTestLocation='()' sTestLocation_ID = '' bHasBaseFolder = False q_str = "mimeType = 'application/vnd.google-apps.folder' and '" + str(sTodayDate_ID) +"' in parents" results = service.files().list( q=q_str, pageSize=10, fields="nextPageToken, files(id, name, parents)").execute() items = results.get('files', []) if not items: print('No files found.') else: print('4nd Files:') for item in items: if item['name']==sTestLocation: bHasBaseFolder = True sTestLocation_ID = item['id'] print(u'{0} ({1}) - {2}'.format(item['name'], item['id'], item['parents'])) if bHasBaseFolder == False: file_metadata = { 'name': sTestLocation, 'mimeType': 'application/vnd.google-apps.folder', 'parents': [str(sTodayDate_ID)] } file = service.files().create(body=file_metadata, fields='id').execute() sTestLocation_ID = str(file.get('id')) print('Folder ID: %s' % file.get('id')) sTestLocation_ID = CreateGoogleDriveFolder(service, sTestLocation, sTodayDate_ID) print('Check Function') print(sTestLocation_ID) if __name__ == '__main__': main()
[ 11748, 28686, 13, 6978, 198, 11748, 28686, 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, ...
2.224971
2,587
from .QArithmetic import * from .qft import *
[ 6738, 764, 48, 3163, 29848, 1330, 1635, 198, 6738, 764, 80, 701, 1330, 1635, 198 ]
3.066667
15
"""Calculate conditional probability of a short interevent time being followed by another short interevent time, compared with the unconditional probability. This is used to test whether fault records have memory """ import os, sys from glob import glob import numpy as np import matplotlib.pyplot as plt from QuakeRates.dataman.parse_params import parse_param_file, \ get_event_sets # Define parameter files filepath = '../params' param_file_list = glob(os.path.join(filepath, '*.txt')) n_samples = 500 # Number of Monte Carlo samples of the eq chronologies half_n = int(n_samples/2) plot_dir = './plots_conditional_probs' if not os.path.exists(plot_dir): os.makedirs(plot_dir) # Define subset to take #faulting_styles = ['Reverse'] #faulting_styles = ['Normal'] #faulting_styles = ['Strike_slip'] faulting_styles = ['all'] tectonic_regions = ['all'] #tectonic_regions = ['Plate_boundary_master', 'Plate_boundary_network'] min_number_events = 10 names, event_sets, event_certainties, num_events = \ get_event_sets(param_file_list, tectonic_regions, faulting_styles, min_number_events) # Now loop over paleo-earthquake records for i, event_set in enumerate(event_sets): # Generate some chronologies event_set.gen_chronologies(n_samples, observation_end=2019, min_separation=1) print(num_events[i]) event_set.calculate_cov() # Calculate interevent times and mean as part of this # Lists to store results uncond_probs = [] cond_probs = [] for j, sample in enumerate(event_set.interevent_times.T): num_less_mean = len(np.argwhere(sample < event_set.means[j])) uncond_prob_less_mean = num_less_mean/event_set.num_events count_short = 0 for k, ie_time in enumerate(sample): if k==0: ie_time_0 = ie_time else: if ie_time < event_set.means[i] and \ ie_time_0 < event_set.means[i]: count_short += 1 ie_time_0 = ie_time cond_prob_less_mean = count_short/num_less_mean uncond_probs.append(uncond_prob_less_mean) cond_probs.append(cond_prob_less_mean) print(uncond_probs) print(cond_probs) uncond_probs = np.array(uncond_probs) cond_probs = np.array(cond_probs) probs_ratio = cond_probs/uncond_probs print(probs_ratio) plt.clf() plt.hist(probs_ratio, bins = 10, facecolor='0.6', edgecolor='0.2', density=True) figname = 'conditional_prob_ratio_histogram_%s.png' % names[i] fig_filename = os.path.join(plot_dir, figname) plt.savefig(fig_filename)
[ 37811, 9771, 3129, 378, 26340, 12867, 286, 257, 1790, 493, 567, 1151, 220, 198, 2435, 852, 3940, 416, 1194, 1790, 493, 567, 1151, 640, 11, 3688, 198, 4480, 262, 42423, 12867, 13, 198, 1212, 318, 973, 284, 1332, 1771, 8046, 4406, 423, ...
2.355416
1,117
import time #Controls functions for the delta sleep_time = 0.5
[ 11748, 640, 198, 2, 15988, 82, 5499, 329, 262, 25979, 198, 42832, 62, 2435, 796, 657, 13, 20, 198, 220, 220, 220, 220, 198 ]
2.833333
24
# From The School of AI's Move 37 Course https://www.theschool.ai/courses/move-37-course/ # Coding demo by Colin Skow # Forked from https://github.com/lazyprogrammer/machine_learning_examples/tree/master/rl # Credit goes to LazyProgrammer from __future__ import print_function, division from builtins import range # Note: you may need to update your version of future # sudo pip install -U future import numpy as np from grid_world import standard_grid from utils import print_values, print_policy # SMALL_ENOUGH is referred to by the mathematical symbol theta in equations SMALL_ENOUGH = 1e-3 GAMMA = 0.9 ALL_POSSIBLE_ACTIONS = ('U', 'D', 'L', 'R') if __name__ == '__main__': # this grid gives you a reward of -0.1 for every non-terminal state # we want to see if this will encourage finding a shorter path to the goal grid = standard_grid(obey_prob=0.8, step_cost=-0.5) # print rewards print("rewards:") print_values(grid.rewards, grid) # calculate accurate values for each square V = calculate_values(grid) # calculate the optimum policy based on our values policy = calculate_greedy_policy(grid, V) # our goal here is to verify that we get the same answer as with policy iteration print("values:") print_values(V, grid) print("policy:") print_policy(policy, grid)
[ 2, 3574, 383, 3961, 286, 9552, 338, 10028, 5214, 20537, 3740, 1378, 2503, 13, 83, 956, 1251, 13, 1872, 14, 66, 39975, 14, 21084, 12, 2718, 12, 17319, 14, 198, 2, 327, 7656, 13605, 416, 18373, 3661, 322, 198, 2, 39812, 276, 422, 37...
3.243176
403
#!/usr/bin/env python # -*- coding: utf-8 -*- # # GTKcsvimport.py # # Copyright 2010-2015 Jose Riguera Lopez <jriguera@gmail.com> # # 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. # """ Parse a CSV to add variables or geolocate photos. GTK User Interface. """ __program__ = "photoplace.csvimport" __author__ = "Jose Riguera Lopez <jriguera@gmail.com>" __version__ = "0.1.2" __date__ = "Dec 2014" __license__ = "Apache 2.0" __copyright__ ="(c) Jose Riguera" import os.path import csv import sys import codecs import warnings import gettext import locale warnings.filterwarnings('ignore', module='gtk') try: import pygtk pygtk.require("2.0") import gtk import gobject except Exception as e: warnings.resetwarnings() print("Warning: %s" % str(e)) print("You don't have the PyGTK 2.0 module installed") raise warnings.resetwarnings() from csvimport import * # I18N gettext support __GETTEXT_DOMAIN__ = __program__ __PACKAGE_DIR__ = os.path.abspath(os.path.dirname(__file__)) __LOCALE_DIR__ = os.path.join(__PACKAGE_DIR__, u"locale") try: if not os.path.isdir(__LOCALE_DIR__): print ("Error: Cannot locate default locale dir: '%s'." % (__LOCALE_DIR__)) __LOCALE_DIR__ = None locale.setlocale(locale.LC_ALL,"") #gettext.bindtextdomain(__GETTEXT_DOMAIN__, __LOCALE_DIR__) t = gettext.translation(__GETTEXT_DOMAIN__, __LOCALE_DIR__, fallback=False) _ = t.ugettext except Exception as e: print ("Error setting up the translations: %s" % (str(e))) _ = lambda s: unicode(s) #EOF
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 198, 2, 220, 220, 220, 220, 220, 220, 7963, 42, 40664, 11748, 13, 9078, 198, 2, 198, 2, 220, 220, 15069, 3050, ...
2.711488
766
# -*- coding: utf-8 -*- # Max-Planck-Gesellschaft zur Frderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # You can only use this computer program if you have closed # a license agreement with MPG or you get the right to use the computer # program from someone who is authorized to grant you that right. # Any use of the computer program without a valid license is prohibited and # liable to prosecution. # # Copyright2020 Max-Planck-Gesellschaft zur Frderung # der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute # for Intelligent Systems. All rights reserved. # # Contact: ps-license@tuebingen.mpg.de import torch import torch.nn.functional as F import numpy as np import torchgeometry as tgm from src import misc_utils, eulerangles from tqdm import tqdm
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 5436, 12, 20854, 694, 12, 38, 274, 19187, 11693, 701, 1976, 333, 1305, 1082, 2150, 4587, 370, 747, 641, 11693, 14785, 304, 13, 53, 13, 357, 44, 6968, 8, 318,...
3.392713
247
from tensorflow.contrib.slim.python.slim.data import data_provider from tensorflow.contrib.slim.python.slim.data import parallel_reader
[ 6738, 11192, 273, 11125, 13, 3642, 822, 13, 82, 2475, 13, 29412, 13, 82, 2475, 13, 7890, 1330, 1366, 62, 15234, 1304, 198, 6738, 11192, 273, 11125, 13, 3642, 822, 13, 82, 2475, 13, 29412, 13, 82, 2475, 13, 7890, 1330, 10730, 62, 4...
3.044444
45
# -*- coding: UTF-8 -*- ####################################################################### # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # @tantrumdev wrote this file. As long as you retain this notice you # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return. - Muad'Dib # ---------------------------------------------------------------------------- ####################################################################### # Addon Name: Placenta # Addon id: plugin.video.placenta # Addon Provider: MuadDib import json from resources.lib.modules import client URL_PATTERN = 'http://thexem.de/map/single?id=%s&origin=tvdb&season=%s&episode=%s&destination=scene'
[ 2, 532, 9, 12, 19617, 25, 41002, 12, 23, 532, 9, 12, 198, 29113, 29113, 4242, 21017, 198, 1303, 16529, 10541, 198, 1303, 366, 10970, 9348, 1137, 12, 33746, 38559, 24290, 1, 357, 18009, 1166, 5433, 2599, 198, 1303, 2488, 83, 415, 658...
4.118812
202
# import colorgram # # colors = colorgram.extract('image.jpg', 30) # rgb_colors = [] # for color in colors: # rgb_colors.append((color.rgb.r, color.rgb.g, color.rgb.b)) # # print(rgb_colors) from turtle import Turtle, Screen import random color_list = [(238, 251, 245), (250, 228, 15), (213, 12, 8), (199, 11, 36), (10, 98, 61), (5, 39, 32), (232, 228, 5), (64, 221, 157), (198, 68, 19), (32, 91, 189), (43, 212, 71), (235, 148, 38), (32, 30, 153), (242, 247, 251), (15, 22, 54), (67, 9, 49), (245, 38, 148), (14, 206, 222), (65, 203, 230), (62, 20, 10), (229, 164, 7), (226, 19, 111), (14, 154, 22), (246, 58, 14), (98, 75, 8), (248, 11, 9), (223, 140, 205), (66, 241, 160), ] tim = Turtle() scr = Screen() scr.colormode(255) tim.penup() tim.hideturtle() tim.setposition(-300, -300) for i in range(10): tim.setposition(-300, tim.ycor() + 50) for j in range(10): tim.setx(tim.xcor() + 50) tim.dot(20, random.choice(color_list)) scr.exitonclick()
[ 2, 1330, 951, 2398, 859, 198, 2, 198, 2, 7577, 796, 951, 2398, 859, 13, 2302, 974, 10786, 9060, 13, 9479, 3256, 1542, 8, 198, 2, 46140, 62, 4033, 669, 796, 17635, 198, 2, 329, 3124, 287, 7577, 25, 198, 2, 220, 220, 220, 220, 4...
2.075248
505
from django import forms from .models import UserAccount, JobPost, JobPostActivity, UserProfile
[ 6738, 42625, 14208, 1330, 5107, 198, 6738, 764, 27530, 1330, 11787, 30116, 11, 15768, 6307, 11, 15768, 6307, 16516, 11, 11787, 37046, 628, 628, 628, 628 ]
3.961538
26
#!/usr/bin/env python #_MIT License #_ #_Copyright (c) 2017 Dan Persons (dpersonsdev@gmail.com) #_ #_Permission is hereby granted, free of charge, to any person obtaining a copy #_of this software and associated documentation files (the "Software"), to deal #_in the Software without restriction, including without limitation the rights #_to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #_copies of the Software, and to permit persons to whom the Software is #_furnished to do so, subject to the following conditions: #_ #_The above copyright notice and this permission notice shall be included in all #_copies or substantial portions of the Software. #_ #_THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #_IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #_FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #_AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #_LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #_OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #_SOFTWARE. import time from time import strftime from time import sleep from time import daylight from time import timezone from time import altzone from random import randrange from datetime import datetime import MySQLdb as mdb import json import threading import os from sys import exit import siemstress.manage #import signal def start_rule(db, rule, oneshot): """Initialize trigger object and start watching""" # Make sure the table exists: siemstress.manage.create_ruleevent_table(rule['out_table']) sentry = SiemTrigger(db, rule) if oneshot: sentry.check_rule() elif int(rule['time_int']) == 0: pass else: # Before starting, sleep randomly up to rule interval to stagger # database use: sleep(randrange(0, int(rule['time_int']) * 60)) sentry.watch_rule()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 62, 36393, 13789, 198, 2, 62, 198, 2, 62, 15269, 357, 66, 8, 2177, 6035, 32884, 357, 67, 19276, 684, 7959, 31, 14816, 13, 785, 8, 198, 2, 62, 198, 2, 62, 5990, 3411, 31...
3.164557
632
# Generated by Django 3.2.7 on 2021-09-12 01:29 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 17, 13, 22, 319, 33448, 12, 2931, 12, 1065, 5534, 25, 1959, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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. # # Struct Class # this is a auto generated file generated by Cheetah # Namespace: com.sun.star.util # Libre Office Version: 7.3 from ooo.oenv.env_const import UNO_NONE import typing from .time import Time as Time_604e0855 __all__ = ['TimeWithTimezone']
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 2, 198, 2, 15069, 33160, 1058, 33, 6532, 12, 22405, 12, 12041, 25, 19935, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 4943, 198, 2, 345, 743,...
3.428571
252
from pathlib import Path from unittest import mock import pytest from fab.build_config import AddFlags from fab.dep_tree import AnalysedFile from fab.steps.compile_fortran import CompileFortran # todo: we might have liked to reuse this from test_dep_tree from fab.util import CompiledFile
[ 6738, 3108, 8019, 1330, 10644, 198, 6738, 555, 715, 395, 1330, 15290, 198, 198, 11748, 12972, 9288, 198, 6738, 7843, 13, 11249, 62, 11250, 1330, 3060, 40053, 198, 198, 6738, 7843, 13, 10378, 62, 21048, 1330, 1052, 47557, 8979, 198, 6738...
3.488095
84