blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
bc994eebc5b04d3239183fd006857bffb91a1af8
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/171/usersdata/265/81901/submittedfiles/decimal2bin.py
877f170e5cf66f6b01ad797c8e446c197b5ab56d
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
201
py
# -*- coding: utf-8 -*- d=int(input('digite o valor de d: ')) contador=0 soma=0 while (d>=0): if d%10==0: soma = soma + (0*2*contador) else : soma = soma + (i*2*contador)
f40c73f9d512cabfc6000d3b2f2aba4bcf4280dc
210ecd63113ce90c5f09bc2b09db3e80ff98117a
/AbletonLive9_RemoteScripts/Oxygen8v2/__init__.py
31d05f0dde8d5b0ee169a7f5bebf6abf5dce0303
[]
no_license
ajasver/MidiScripts
86a765b8568657633305541c46ccc1fd1ea34501
f727a2e63c95a9c5e980a0738deb0049363ba536
refs/heads/master
2021-01-13T02:03:55.078132
2015-07-16T18:27:30
2015-07-16T18:27:30
38,516,112
4
1
null
null
null
null
UTF-8
Python
false
false
551
py
#Embedded file name: /Users/versonator/Jenkins/live/Binary/Core_Release_64_static/midi-remote-scripts/Oxygen8v2/__init__.py from _Generic.GenericScript import GenericScript import Live from config import * def create_instance(c_instance): """ The generic script can be customised by using parameters (see config.py). """ return GenericScript(c_instance, Live.MidiMap.MapMode.absolute, Live.MidiMap.MapMode.absolute, DEVICE_CONTROLS, TRANSPORT_CONTROLS, VOLUME_CONTROLS, TRACKARM_CONTROLS, BANK_CONTROLS, CONTROLLER_DESCRIPTION, MIXER_OPTIONS)
8b97c1e14adfcb09806e2d37e2f5c4f0b356c009
51885da54b320351bfea42c7dd629f41985454cd
/abc088/c.py
6f50226c2b81dbb528686b2a04839a3d3dee1e8c
[]
no_license
mskt4440/AtCoder
dd266247205faeda468f911bff279a792eef5113
f22702e3932e129a13f0683e91e5cc1a0a99c8d5
refs/heads/master
2021-12-15T10:21:31.036601
2021-12-14T08:19:11
2021-12-14T08:19:11
185,161,276
0
0
null
null
null
null
UTF-8
Python
false
false
1,389
py
# # abc088 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.read()[:-1] sys.stdout, sys.stdin = stdout, stdin self.assertEqual(out, output) def test_入力例_1(self): input = """1 0 1 2 1 2 1 0 1""" output = """Yes""" self.assertIO(input, output) def test_入力例_2(self): input = """2 2 2 2 1 2 2 2 2""" output = """No""" self.assertIO(input, output) def test_入力例_3(self): input = """0 8 8 0 8 8 0 8 8""" output = """Yes""" self.assertIO(input, output) def test_入力例_4(self): input = """1 8 6 2 9 7 0 7 7""" output = """No""" self.assertIO(input, output) def resolve(): c = [] for _ in range(3): c.append(list(map(int, input().split()))) a1 = 0 b1 = c[0][0] - a1 b2 = c[0][1] - a1 b3 = c[0][2] - a1 a2 = c[1][0] - b1 a3 = c[2][0] - b1 if a2+b2 == c[1][1] and a2+b3 == c[1][2] and a3+b2 == c[2][1] and a3+b3 == c[2][2]: print("Yes") else: print("No") if __name__ == "__main__": # unittest.main() resolve()
75ff5701bb8130bd4c6b3ed2171d396f007ef5bc
e8cf96d2c1cef71c0bcbe200a0a65dee59d21d65
/molotov/quickstart/loadtest.py
4df0a04ebc981811bb4bc1b6b11fb733a40ba6bf
[ "Apache-2.0" ]
permissive
ronnix/molotov
11ed38e699bf58ce469b7d96a617ffb98ab7f6f6
b2684ec13edb6d0ff901398467b16c885c5ff502
refs/heads/master
2020-06-20T05:41:36.070912
2017-06-09T10:02:01
2017-06-09T10:02:01
94,195,118
0
0
null
2017-06-13T09:25:58
2017-06-13T09:25:58
null
UTF-8
Python
false
false
2,000
py
""" Molotov-based test. """ import json from molotov import scenario, setup, global_setup, teardown, global_teardown # This is the service you want to load test _API = 'http://localhost:8080' @global_setup() def test_starts(args): """ This functions is called before anything starts. Notice that it's not a coroutine. """ pass @setup() async def worker_starts(worker_id, args): """ This function is called once per worker. If it returns a mapping, it will be used with all requests. You can add things like Authorization headers for instance, by setting a "headers" key. """ headers = {'SomeHeader': '1'} return {'headers': headers} @teardown() def worker_ends(worker_id): """ This functions is called when the worker is done. Notice that it's not a coroutine. """ pass @global_teardown() def test_ends(): """ This functions is called when everything is done. Notice that it's not a coroutine. """ pass # each scenario has a weight. Molotov uses it to determine # how often the scenario is picked. @scenario(40) async def scenario_one(session): async with session.get(_API) as resp: # if Molotov is called with --statsd # you will have a statsd client set into the session # you can use to add metrics if session.statsd: session.statsd.incr('BLEH') # when you read the body, don't forget to use await res = await resp.json() assert res['result'] == 'OK' assert resp.status == 200 # all scenarii are coroutines @scenario(30) async def scenario_two(session): # a call to one of the session method should be awaited # see aiohttp.Client docs for more info on this async with session.get(_API) as resp: assert resp.status == 200 @scenario(30) async def scenario_three(session): somedata = json.dumps({'OK': 1}) async with session.post(_API, data=somedata) as resp: assert resp.status == 200
2e847e8539a9fe4db57312c83a82af2b3d9222c8
0eec43ed5bee5be0d3e0bd952a697ba1d31eeabd
/python/Day14/scope.py
11f0564e9e5c093f4029a23aa4946eddd2ac6599
[]
no_license
ssinghaldev/30_days_of_code
ce167613eeeaa30fdfc6451da1d849cf6af0725e
8a48c89030dde50481298cea9c64b5dfded29df0
refs/heads/master
2020-04-04T09:18:11.485394
2018-11-28T05:06:00
2018-11-28T05:06:00
null
0
0
null
null
null
null
UTF-8
Python
false
false
121
py
# Add your code here def computeDifference(self): self.maximumDifference = max(self.__elements) - min(self.__elements)
673b277e8c1eb534425768123f79ddd2505204f1
925f2935b34042abc9161795413031ae68f45b9a
/multimodel_inference/fold_IMisc2sm.py
291a17afa018e415d33f158ff6cce511b0ce18fa
[]
no_license
Farhad63/AFS-analysis-with-moments
7e1d17f47c06ed97ebb7c9ec8245fe52a88622c3
7874b1085073e5f62d910ef2d79a22b29ff3be84
refs/heads/master
2022-04-09T22:11:12.341235
2020-03-11T21:15:42
2020-03-11T21:15:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,074
py
#!/usr/bin/env python # split into two diff sizes, then secondary contact with instantaneous size change followed by growth, with symmetric migration # "genomic islands" of two different migration regimes # n(para): 12 import matplotlib matplotlib.use('PDF') import moments import random import pylab import matplotlib.pyplot as plt import numpy as np from numpy import array from moments import Misc,Spectrum,Numerics,Manips,Integration,Demographics1D,Demographics2D import sys infile=sys.argv[1] pop_ids=[sys.argv[2],sys.argv[3]] projections=[int(sys.argv[4]),int(sys.argv[5])] #params=[float(sys.argv[6]),float(sys.argv[7]),float(sys.argv[8]),float(sys.argv[9]),float(sys.argv[10]),float(sys.argv[11]),float(sys.argv[12]),float(sys.argv[13])] params=array([1,1,1,1,1,1,1,1,1,1,0.5]) # mutation rate per sequenced portion of genome per generation: for A.millepora, 0.02 mu=float(sys.argv[6]) # generation time, in thousand years: 0.005 (5 years) gtime=float(sys.argv[7]) #infile="5kA3_dadi.data" #pop_ids=["W","K"] #projections=[32,38] dd = Misc.make_data_dict(infile) data = Spectrum.from_data_dict(dd, pop_ids,projections,polarized=False) ns=data.sample_sizes np.set_printoptions(precision=3) #------------------- # split with growth and asymmetrical migration; with genomic islands def IM2iSC(params, ns): """ Isolation-with-migration model with split into two arbtrary sizes p_misid: proportion of misidentified ancestral states """ nua,nub,nu1_0,nu2_0,nu1,nu2,T,T0,m,mi,P = params nu1_func = lambda t: nu1_0 * (nu1/nu1_0)**(t/T) nu2_func = lambda t: nu2_0 * (nu2/nu2_0)**(t/T) nu_func = lambda t: [nu1_func(t), nu2_func(t)] sts = moments.LinearSystem_1D.steady_state_1D(ns[0] + ns[1]) fs = moments.Spectrum(sts) fs = moments.Manips.split_1D_to_2D(fs, ns[0], ns[1]) fs.integrate([nua, nub], T0, m = np.array([[0, 0], [0, 0]])) fs.integrate(nu_func, T, dt_fac=0.01, m=np.array([[0, m], [m, 0]])) stsi = moments.LinearSystem_1D.steady_state_1D(ns[0] + ns[1]) fsi = moments.Spectrum(stsi) fsi = moments.Manips.split_1D_to_2D(fsi, ns[0], ns[1]) fsi.integrate([nua, nub], T0, m = np.array([[0, 0], [0, 0]])) fsi.integrate(nu_func, T, dt_fac=0.01, m=np.array([[0, mi], [mi, 0]])) fs2=P*fsi+(1-P)*fs return fs2 func=IM2iSC upper_bound = [100,100,100,100,100, 100, 10,10, 200,200,0.9999] lower_bound = [1e-3,1e-3,1e-3,1e-3,1e-3,1e-3, 1e-3,1e-3,1e-5,1e-5,1e-4] params = moments.Misc.perturb_params(params, fold=2, upper_bound=upper_bound, lower_bound=lower_bound) # fitting (poptg = optimal parameters): poptg = moments.Inference.optimize_log(params, data, func, lower_bound=lower_bound, upper_bound=upper_bound, verbose=False, maxiter=30) # extracting model predictions, likelihood and theta model = func(poptg, ns) ll_model = moments.Inference.ll_multinom(model, data) theta = moments.Inference.optimal_sfs_scaling(model, data) # random index for this replicate ind=str(random.randint(0,999999)) # plotting demographic model plot_mod = moments.ModelPlot.generate_model(func, poptg, ns) moments.ModelPlot.plot_model(plot_mod, save_file="IMisc2sm_"+ind+"_"+sys.argv[1]+".png",pop_labels=pop_ids, nref=theta/(4*mu), draw_scale=False, gen_time=gtime, gen_time_units="KY", reverse_timeline=True) # bootstrapping for SDs of params and theta all_boot=moments.Misc.bootstrap(dd,pop_ids,projections) uncert=moments.Godambe.GIM_uncert(func,all_boot,poptg,data) # printing parameters and their SDs print "RESULT","IMisc2sm",ind,len(params),ll_model,sys.argv[1],sys.argv[2],sys.argv[3],poptg,theta,uncert # plotting quad-panel figure witt AFS, model, residuals: moments.Plotting.plot_2d_comp_multinom(model, data, vmin=1, resid_range=3, pop_ids =pop_ids) plt.savefig("IMisc2sm_"+ind+"_"+sys.argv[1]+"_"+sys.argv[2]+"_"+sys.argv[3]+"_"+sys.argv[4]+"_"+sys.argv[5]+'.pdf')
494b730cf575803022fd0cfcf7c6a4255f7c81f4
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5706278382862336_1/Python/urupica/a.py
bacd3f027517e16fe04dada1b43ada1bbcbbb703
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Python
false
false
2,570
py
#!/usr/bin/python import sys, datetime # https://code.google.com/p/gmpy/ from gmpy import sqrt from fractions import Fraction as frac def solve(pq): start = (frac(pq[0], pq[1]), 0) n = 0 y = start[0].denominator while y % 2 == 0: n += 1 y /= 2 if y != 1: return 'impossible' q = [start] v = set([start]) while q: t,g = q.pop() if g >= 40: return 'impossible' anc = set() x = t.numerator y = t.denominator n = 0 while y % 2 == 0: n += 1 y /= 2 i = 0 n2 = n/2 xx = 2*x while i <= n2: b = 2**i d = 2**(n-i) a = 0 ad = a*d while ad <= xx: if (xx-ad) % b == 0: c = (xx-ad)/b t1 = frac(a,b) t2 = frac(c,d) if t1 == 1 or t2 == 1: return g+1 anc.add((t1, g+1)) anc.add((t2, g+1)) a += 1 ad = a*d i += 1 for u in anc: if u not in v: v.add(u) q.insert(0,u) def main(): if len(sys.argv) < 2: print 'Please provide input file' print 'Usage: %s inputfile [outputfile]' % sys.argv[0] return timestart = datetime.datetime.now() try: inputFile = open(sys.argv[1]) except: print 'Failed to read input file %s' % sys.argv[1] return try: outputFile = open(sys.argv[2], 'w') if len(sys.argv) >= 3 else None except: print 'Failed to create output file %s' % sys.argv[2] return testCases = int(inputFile.readline().strip()) print '-----------------' print 'Test cases: %d ' % testCases print 'No output file' if len(sys.argv) < 3 else 'Writing to %s' % sys.argv[2] print '-----------------' for testCaseNumber in range(1, testCases+1): pq = map(int, inputFile.readline().strip().split('/')) string = 'Case #%d: %s' % (testCaseNumber, solve(pq)) print string if outputFile: outputFile.write(string + '\n') print '-----------------' print 'Written to %s' % sys.argv[2] if outputFile else 'No output file' print 'Elapsed time: %s' % (datetime.datetime.now() - timestart) print '-----------------' inputFile.close() if outputFile: outputFile.close() if __name__=='__main__': main()
49f198411001677c7891235ff88a61cf81bd18d4
d921253b98a922975709693c411218746af2f017
/bgx/families/smart_stuff/setup.py
ca54e6e51fa7a6642a979686b71f4d14c11621d2
[ "Zlib", "MIT", "Apache-2.0" ]
permissive
bestonly125/DGT-Kawartha
223f88e224c1464fa22a4512e4567ac7ce1bc78f
edfbc18f2c70e813805ec23c28fbc35bf7866ffc
refs/heads/master
2022-11-22T13:18:21.204906
2020-07-24T09:03:57
2020-07-24T09:03:57
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,699
py
# Copyright 2020 NTRLab # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ------------------------------------------------------------------------------ from __future__ import print_function import os import subprocess from setuptools import setup, find_packages data_files = [] if os.path.exists("/etc/default"): data_files.append( ('/etc/default', ['packaging/systemd/sawtooth-bgt-tp-python'])) if os.path.exists("/lib/systemd/system"): data_files.append( ('/lib/systemd/system', ['packaging/systemd/sawtooth-bgt-tp-python.service'])) setup( name='dgt-stuff', version=subprocess.check_output( ['../../../bin/get_version']).decode('utf-8').strip(), description='DGT stuff Python ', author='NTRLab', url='https://github.com/hyperledger/sawtooth-core', packages=find_packages(), install_requires=[ "cbor", "colorlog", "sawtooth-sdk", "sawtooth-signing", "secp256k1" ], data_files=data_files, entry_points={ 'console_scripts': [ 'stuff = dgt_stuff.client_cli.bgt_cli:main_wrapper', 'stuff-tp = dgt_stuff.processor.main:main' ] })
357363e824323766d3fcb3eb32e7192e1d62999e
a65de6ebf74a0ea70fdb4d85a28cc11e641554e0
/py-scripts/det_keychain_type2.py
929368c14258f7c70ec8f74e612c98827e8e58aa
[ "MIT" ]
permissive
VB6Hobbyst7/bbt
e4f63cdd0bb9ef9550edc40b0ee1def7148fe91a
7b35e4fe9041af9b73bcfb192aeeeb873d730c72
refs/heads/master
2023-01-22T03:44:04.506182
2020-11-23T23:12:56
2020-11-23T23:12:56
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,640
py
#!/usr/bin/env python3 # Copyright (C) 2017-2020 The btclib developers # # This file is part of btclib. It is subject to the license terms in the # LICENSE file found in the top-level directory of this distribution. # # No part of btclib including this file, may be copied, modified, propagated, # or distributed except according to the terms contained in the LICENSE file. """ Deterministic Key Sequence (Type-1)""" import secrets from hashlib import sha256 as hf from btclib.curve import mult from btclib.curve import secp256k1 as ec from btclib.utils import int_from_bits # master prvkey in [1, n-1] mprvkey = 1 + secrets.randbelow(ec.n - 1) print(f"\nmaster prvkey: {hex(mprvkey).upper()}") # Master Pubkey: mpubkey = mult(mprvkey, ec.G) print(f"Master Pubkey: {hex(mpubkey[0]).upper()}") print(f" {hex(mpubkey[1]).upper()}") r = secrets.randbits(ec.nlen) print(f"\npublic random number: {hex(r).upper()}") rbytes = r.to_bytes(ec.nsize, "big") nKeys = 3 for i in range(nKeys): ibytes = i.to_bytes(ec.nsize, "big") hd = hf(ibytes + rbytes).digest() offset = int_from_bits(hd, ec.nlen) % ec.n q = (mprvkey + offset) % ec.n Q = mult(q, ec.G, ec) print(f"\nprvkey #{i}: {hex(q).upper()}") print(f"Pubkey #{i}: {hex(Q[0]).upper()}") print(f" {hex(Q[1]).upper()}") # Pubkeys could also be calculated without using prvkeys for i in range(nKeys): ibytes = i.to_bytes(ec.nsize, "big") hd = hf(ibytes + rbytes).digest() offset = int_from_bits(hd, ec.nlen) % ec.n Q = ec.add(mpubkey, mult(offset, ec.G, ec)) assert Q == mult((mprvkey + offset) % ec.n, ec.G, ec)
6087bac61affd929686678fae8bc6328f0d68c6c
93c3abdedc8d5571dc2a5241b20a5806d1da59d8
/dcgan/.ipynb_checkpoints/main-checkpoint.py
000c110d3963eb3527631a1963b62db4a083e3a3
[]
no_license
Trccc/5242Project-GAN
bf33b33501b332d9716e2884d821016f5bbfd5aa
3cd3a7734ae42fb0d3b5efb5bd6839621a9e1b0c
refs/heads/master
2023-03-18T03:33:23.304285
2020-01-14T20:01:18
2020-01-14T20:01:18
222,341,507
4
1
null
null
null
null
UTF-8
Python
false
false
6,983
py
import matplotlib matplotlib.use('Agg') import tensorflow as tf import glob import imageio import matplotlib.pyplot as plt import numpy as np import pandas as pd import os import PIL from tensorflow.keras import layers import time from IPython import display import IPython import tensorflow_datasets as tfds from pytz import timezone from datetime import datetime from config import cfg from model import * from utils import * from loss import * from Inception_score import * @tf.function def train_step(images, showloss = False): noise = tf.random.normal([cfg.BATCH_SIZE, cfg.NOISE_DIM]) g_loss = generator_loss d_loss = discriminator_loss with tf.GradientTape() as gen_tape, tf.GradientTape() as disc_tape: generated_images = generator(noise, training=True) real_output = discriminator(images, training=True) fake_output = discriminator(generated_images, training=True) gen_loss = g_loss(fake_output) disc_loss = d_loss(real_output, fake_output) #if showloss: #print('gen_loss = %.4f|disc_loss = %.4f'%(gen_loss.numpy(),disc_loss.numpy())) gradients_of_generator = gen_tape.gradient(gen_loss, generator.trainable_variables) gradients_of_discriminator = disc_tape.gradient(disc_loss, discriminator.trainable_variables) generator_optimizer.apply_gradients(zip(gradients_of_generator, generator.trainable_variables)) discriminator_optimizer.apply_gradients(zip(gradients_of_discriminator, discriminator.trainable_variables)) return gen_loss, disc_loss def train(dataset, epochs, savedir): IS_mean = [] IS_std = [] G_loss = [] D_loss = [] for epoch in range(epochs): start = time.time() i = 0 g_loss = 0 d_loss = 0 for image_batch in dataset: i += 1 if (i+1) % cfg.SHOW_LOSS ==0: g_tensor, d_tensor = train_step(image_batch, showloss = True) else: g_tensor, d_tensor = train_step(image_batch) g_loss += float(g_tensor.numpy()) d_loss += float(d_tensor.numpy()) G_loss.append(g_loss / i) D_loss.append(d_loss / i) # Produce images for the GIF display.clear_output(wait=True) generate_and_save_images(generator, epoch + 1, seed,savedir) # Save the model every 15 epochs if (epoch + 1) % 5 == 0: mean, std = IS(generator, 1000, 100) IS_mean.append(mean) IS_std.append(std) checkpoint.save(file_prefix = checkpoint_prefix) with train_summary_writer.as_default(): tf.summary.scalar('loss', G_loss[-1], step=epoch) with test_summary_writer.as_default(): tf.summary.scalar('loss', D_loss[-1], step=epoch) print ('Time for epoch {} is {} sec'.format(epoch + 1, time.time()-start)) # clear outputs display.clear_output(wait=True) # save IS score and Loss plot IS_mean = np.array(IS_mean) IS_std = np.array(IS_std) IS_df = pd.DataFrame({'mean':IS_mean, 'mean+std':IS_mean+IS_std, 'mean-std':IS_mean-IS_std, 'std':IS_std}) IS_df.index = [5 * (x + 1) for x in range(IS_df.shape[0])] Loss_df = pd.DataFrame({'Generator':G_loss, 'Discriminator':D_loss}) df_path = os.path.join(savedir, 'IS_score.csv') IS_df.to_csv(path_or_buf=df_path, index=False) df_path2 = os.path.join(savedir, 'Loss.csv') Loss_df.to_csv(path_or_buf=df_path2, index=False) print('Inception score and loss save complete') path = os.path.join(savedir, 'IS_score_trend.png') fig = plt.figure(figsize=(6, 6)) plt.plot(IS_df[['mean','mean+std','mean-std']]) plt.title('Inception Score') plt.legend(IS_df[['mean','mean+std','mean-std']].columns, loc='best') plt.savefig(path) #plt.close('all') path2 = os.path.join(savedir, 'Loss_trend.png') fig2 = plt.figure(figsize=(6, 6)) plt.plot(Loss_df) plt.title('Validation Losses') plt.legend(Loss_df.columns, loc='best') plt.savefig(path2) # Generate after the final epoch generate_and_save_images(generator, epochs, seed,savedir) if __name__ == '__main__': if cfg.DATA.lower() == 'mnist': train_data = get_train_data('mnist') generator = make_generator_model_mnist() discriminator = make_discriminator_model_mnist() elif cfg.DATA.lower() == 'svhn': train_data = get_train_data('svhn') generator = make_generator_model_svhn() discriminator = make_discriminator_model_svhn() noise = tf.random.normal([1, 100]) generator_optimizer = tf.keras.optimizers.Adam(learning_rate=1e-4, beta_1=0.5) discriminator_optimizer = tf.keras.optimizers.Adam(learning_rate=1e-4, beta_1=0.5) EPOCHS = cfg.EPOCHS noise_dim = cfg.NOISE_DIM num_examples_to_generate = cfg.NUM_EXAMPLES_TO_GENERATE seed = tf.random.normal([num_examples_to_generate, noise_dim]) now = datetime.now(timezone('US/Eastern')) subfile = now.strftime("%m_%d_%H_%M") filedir = os.path.join(cfg.IMAGE_PATH,subfile) checkpoint_dir = filedir checkpoint_prefix = os.path.join(checkpoint_dir, "ckpt") checkpoint = tf.train.Checkpoint(generator_optimizer=generator_optimizer, discriminator_optimizer=discriminator_optimizer, generator=generator, discriminator=discriminator) if not os.path.exists(cfg.IMAGE_PATH): os.mkdir(cfg.IMAGE_PATH) if not os.path.isfile(filedir): os.mkdir(filedir) savedir = filedir current_time = datetime.now().strftime("%Y%m%d-%H%M%S") gen_log_dir = 'logs/gradient_tape/' + current_time + '/gen' disc_log_dir = 'logs/gradient_tape/' + current_time + '/disc' train_summary_writer = tf.summary.create_file_writer(gen_log_dir) test_summary_writer = tf.summary.create_file_writer(disc_log_dir) train(train_data, EPOCHS,savedir) if cfg.GIF: anim_file = subfile+'gan.gif' with imageio.get_writer(anim_file, mode='I') as writer: filenames = glob.glob(filedir+'/image*.png') filenames = sorted(filenames) last = -1 for i,filename in enumerate(filenames): frame = 2*(i**0.5) if round(frame) > round(last): last = frame else: continue image = imageio.imread(filename) writer.append_data(image) image = imageio.imread(filename) writer.append_data(image) print('finish')
17d947a28fb71d6e50670c6f6e7d2ed854795429
e7c70a02e61f6d4a97c5933f3550bca22afa6acb
/ros_ws/build/original learning_ros/learning_ros/Part_5/arm7dof/arm7dof_traj_as/cmake/arm7dof_traj_as-genmsg-context.py
a4b933642a0c8e90b62feb7114bcb33e3fd069d0
[]
no_license
amitf82/Final_Proj_Mobile_Robotics
14cfe7b182df1294a873283c91688c8ca9526fee
435a6c1562df030fc462fe1b0a84f968a27a2b85
refs/heads/master
2021-01-20T03:22:51.387095
2017-04-30T08:25:33
2017-04-30T08:25:33
89,532,221
0
0
null
null
null
null
UTF-8
Python
false
false
1,399
py
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajAction.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajActionGoal.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajActionResult.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajActionFeedback.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajGoal.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajResult.msg;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg/trajFeedback.msg" services_str = "" pkg_name = "arm7dof_traj_as" dependencies_str = "roscpp;sensor_msgs;trajectory_msgs;actionlib_msgs;actionlib;std_srvs" langs = "gencpp;genlisp;genpy" dep_include_paths_str = "arm7dof_traj_as;/home/user/ros_ws/devel/share/arm7dof_traj_as/msg;roscpp;/opt/ros/indigo/share/roscpp/cmake/../msg;sensor_msgs;/opt/ros/indigo/share/sensor_msgs/cmake/../msg;trajectory_msgs;/opt/ros/indigo/share/trajectory_msgs/cmake/../msg;actionlib_msgs;/opt/ros/indigo/share/actionlib_msgs/cmake/../msg;actionlib;/opt/ros/indigo/share/actionlib/cmake/../msg;geometry_msgs;/opt/ros/indigo/share/geometry_msgs/cmake/../msg;std_msgs;/opt/ros/indigo/share/std_msgs/cmake/../msg" PYTHON_EXECUTABLE = "/usr/bin/python" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/indigo/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
0d6b1608e13599f03b3bc14f985dd604ca4101c4
d7016f69993570a1c55974582cda899ff70907ec
/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode.py
9fca87c06715de4be793721ff9f2021becd6a493
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
kurtzeborn/azure-sdk-for-python
51ca636ad26ca51bc0c9e6865332781787e6f882
b23e71b289c71f179b9cf9b8c75b1922833a542a
refs/heads/main
2023-03-21T14:19:50.299852
2023-02-15T13:30:47
2023-02-15T13:30:47
157,927,277
0
0
MIT
2022-07-19T08:05:23
2018-11-16T22:15:30
Python
UTF-8
Python
false
false
1,935
py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential from azure.mgmt.sql import SqlManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-sql # USAGE python create_database_default_mode.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.databases.begin_create_or_update( resource_group_name="Default-SQL-SouthEastAsia", server_name="testsvr", database_name="testdb", parameters={ "location": "southeastasia", "properties": { "collation": "SQL_Latin1_General_CP1_CI_AS", "createMode": "Default", "maxSizeBytes": 1073741824, }, "sku": {"name": "S0", "tier": "Standard"}, }, ).result() print(response) # x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultMode.json if __name__ == "__main__": main()
907ff0c5531274923b2904bb253a1409a2028b8b
b87402fa3729a2bee6e8c527dad8f2c09e84c115
/geemap/__init__.py
02d54e0f59c9c6c51b062296d246a2b813816863
[ "MIT" ]
permissive
tchigher/geemap
26e3214a7f4e604faf892276d9aad400faffcf67
66b2618f31d673230f6ec739fc88da33c50af5a3
refs/heads/master
2022-04-13T16:57:47.873576
2020-04-08T03:02:18
2020-04-08T03:02:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
177
py
"""Top-level package for geemap.""" __author__ = """Qiusheng Wu""" __email__ = '[email protected]' __version__ = '0.6.1' from .geemap import * from .basemaps import ee_basemaps
5d4ffcdcd29c97edfea7392308fd529f0a15b9aa
4ae178e2f872acba3acdcb06cb145b82e48908f8
/trial_test_ws/devel/lib/python2.7/dist-packages/moveit_msgs/srv/_GetRobotStateFromWarehouse.py
61fe624eac24509110f6559ad55373ac79e83dd6
[]
no_license
ZhikaiZhang1/ros-lbr-repo
51279a0c1e00f1e1d5f0f3be2e3feb2dc04600df
8fce59c6145481a0ec58d345cb3caa641c59f78e
refs/heads/master
2023-06-04T15:55:18.769023
2021-06-22T12:34:00
2021-06-22T12:34:00
380,094,172
0
0
null
null
null
null
UTF-8
Python
false
false
127
py
/home/logan/trial_test_ws/devel/.private/moveit_msgs/lib/python2.7/dist-packages/moveit_msgs/srv/_GetRobotStateFromWarehouse.py
b86d96ebe13f417ecffb1d27aed00b6a10b9031d
6c58da2c54a3d35273e7984313d181f1da9981fc
/DB_Connection/venv/bin/easy_install-2.7
785646a1d64db62a32e5e767203f0d9d853dd016
[ "MIT-0" ]
permissive
py1-10-2017/rgero215_PY1-10-2017
e582cb12cc63f84b1c0c14d09a922cb6cb228016
f455b335ec9c8c850571f3a75dcd95759b4cfdad
refs/heads/master
2021-09-04T03:23:48.062326
2018-01-14T21:07:26
2018-01-14T21:07:26
105,612,652
1
0
null
null
null
null
UTF-8
Python
false
false
469
7
#!/Users/RGero13/Desktop/rgero215_PY1-10-2017/DB_Connection/venv/bin/python # EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==36.6.0','console_scripts','easy_install-2.7' __requires__ = 'setuptools==36.6.0' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('setuptools==36.6.0', 'console_scripts', 'easy_install-2.7')() )
c6707e047dcc8912e3cf72853d8928d25a06a1ee
8525a60b10c133706fe8303d10b1d272387e62ab
/frites/conn/conn_utils.py
89375434dc316ba7eb695326c55e67c1840c7405
[ "BSD-3-Clause" ]
permissive
brainets/frites
f620b3450aa544484aa941c4cafc4f21020b2a25
420421382c6e9c9b411ee458317f5aba7472c4a9
refs/heads/master
2023-08-29T06:10:46.775963
2023-07-24T08:20:55
2023-07-24T08:20:55
213,869,364
66
22
BSD-3-Clause
2023-09-05T08:41:55
2019-10-09T08:56:55
Python
UTF-8
Python
false
false
28,339
py
"""Utility functions for connectivity.""" import numpy as np import xarray as xr import pandas as pd from frites.utils import nonsorted_unique from frites.io import set_log_level, logger from frites.core import ent_nd_g, mi_nd_gg, mi_model_nd_gd ############################################################################### ############################################################################### # CONN PAIRS ############################################################################### ############################################################################### def conn_get_pairs(roi, directed=False, nb_min_suj=-np.inf, verbose=None): """Get possible connectivity pairs for multiple subjects. This function returns a DataFrame that contains all of the necessary informations for managing pairs of brain regions across many subjects. Parameters ---------- roi : list List where each item in this list is an array descriving the brain region names of a single subject. directed : bool | False Specify whether the the returned pairs should be for directed (True) or undirected (default : False) connectivity. nb_min_suj : int | -np.inf Specify whether the pairs should be represented by a minimum number of subjects. Returns ------- df_conn : pd.DataFrame A Pandas DataFrame that describes the connectivity informations at the group level. The table contains the following entries : * 'sources' / 'targets' : respectively, the source and target names * 'subjects' : list of subjects per pair of brain regions * '#subjects' : number of subjects per pair of brain regions * 'names' : name of each pair. If undirected, the names are going to be like 'roi_0-roi_1' or 'roi_0->roi_1' if directed * 'keep' : booleans indicating whether the number of subjects per pair of brain regions is over nb_min_suj df_suj : pd.DataFrame A Pandas DataFrame that describes the connectivity information per subject. The table contains the following entries : * 'subjects' : subject number * 'keep_roi' / 'drop_roi' : the brain regions respectively to keep and to remove to fit the input parameters nb_min_suj * 'keep_suj' : boolean describing if the subject should be dropped or conserved * 'conn' : the 2D boolean connectivity array per subject """ set_log_level(verbose) assert isinstance(roi, list) n_subjects = len(roi) roi = [np.asarray(k) for k in roi] # =========================== Conn info per pair ========================== s_ss, t_ss, ss = [], [], [] for k in range(n_subjects): # get the unique list of unsorted list of brain regions u_roi = nonsorted_unique(roi[k], assert_unique=True) n_u_roi = len(u_roi) # get all possible pairs if directed: pairs = np.where(~np.eye(n_u_roi, dtype=bool)) else: pairs = np.triu_indices(n_u_roi, k=1) s_names, t_names = u_roi[pairs[0]], u_roi[pairs[1]] # if not directed, merge '0-1' and '1-0' if not directed: st_names = np.c_[s_names, t_names] s_names, t_names = np.unique(np.sort(st_names, axis=1), axis=0).T # keep single-subject source and target names s_ss += [s_names] t_ss += [t_names] ss += [k] * len(s_names) # fill info in a dataframe df_ss = pd.DataFrame({ 'subjects': ss, 'sources': np.concatenate(s_ss), 'targets': np.concatenate(t_ss) }) # get the number of subjects per pair pattern = '->' if directed else '-' gp = df_ss.groupby(['sources', 'targets']) df_conn = gp.subjects.aggregate([list]).reset_index() df_conn = df_conn.rename(columns={'list': 'subjects'}) df_conn['#subjects'] = [len(k) for k in df_conn['subjects']] df_conn['names'] = [f"{k}{pattern}{i}" for k, i in zip( df_conn['sources'], df_conn['targets'])] df_conn['keep'] = df_conn['#subjects'] >= nb_min_suj # print the info n_remain = np.sum(list(df_conn['keep'])) n_drop = np.sum(list(~df_conn['keep'])) logger.info(f" {n_remain} remaining pairs of brain regions " f"(nb_min_suj={nb_min_suj}), {n_drop} dropped") # ========================= Conn info per subject ========================= # build 2d connectivity array per subject conn = {} for n_s in range(n_subjects): n_roi_s = len(roi[n_s]) _conn = xr.DataArray( ~np.eye(n_roi_s, dtype=bool), dims=('sources', 'targets'), coords=(roi[n_s], roi[n_s])) conn[n_s] = _conn # fill the information for k in range(len(df_conn)): _df = df_conn.iloc[k, :] for s in _df['subjects']: _s, _t, _k = _df['sources'], _df['targets'], bool(_df['keep']) conn[s].loc[dict(sources=_s, targets=_t)] = _k if not directed: conn[s].loc[dict(sources=_t, targets=_s)] = _k # get the brain regions to keep / drop per subject suj, roi_keep, roi_drop, conn_tot = [], [], [], [] for s in range(n_subjects): _keep = roi[s][np.union1d(*np.where(conn[s]))] _drop = np.setdiff1d(roi[s], _keep) suj += [s] roi_keep += [_keep.tolist()] roi_drop += [_drop.tolist()] conn_tot += [conn[s].data] # create the final dataframe df_suj = pd.DataFrame({'subjects': suj, 'keep_roi': roi_keep, 'drop_roi': roi_drop}) # , 'conn': conn_tot df_suj['keep_suj'] = [len(k) > 1 for k in df_suj['keep_roi']] return df_conn, df_suj def conn_links(roi, directed=False, net=False, roi_relation='both', sep='auto', nb_min_links=None, pairs=None, sort=True, triu_k=1, hemisphere=None, hemi_links='both', categories=None, source_seed=None, target_seed=None, verbose=None): """Construct pairwise links for functional connectivity. This function can be used for defining the pairwise links for computing either undirected or directed FC on M/EEG or intracranial EEG. Parameters ---------- roi : array_like List of roi (or contacts) names. directed : bool | False Specify whether the links should be for undirected (False) or directed (True) FC net : bool | False Specify whether it is for net directed FC (True) or not (False) roi_relation : {'both', 'inter', 'intra'} Specify the roi relation between pairs of brain regions. Use either : * 'intra' : to select only links within a brain region (e.g. V1-V1) * 'inter' : to select only links across brain region (e.g. V1-V2) * 'both' : to select links both within and across brain regions sep : string | 'auto' If 'auto', '-' are used to linked brain region names for undirected FC or '->' for directed FC. Alternatively, you can provide a custom separator (e.g. sep='/') nb_min_links : int | None Threshold for defining a minimum number of links between two brain regions (e.g. iEEG) pairs : array_like | None Force to use certain pairs of brain regions. Should be an array of shape (n_pairs, 2) where the first column refer to sources and the second to targets sort : bool | True For undirected and net directed FC, sort the names of the brain regions (e.g. 'V1-M1' -> 'M1-V1') triu_k : int | 1 Diagonal offset when estimating the undirected links to use. By default, triu_k=1 means that we skip auto-connections hemisphere : array_like | None List of hemisphere names hemi_links : {'both', 'intra', 'inter'} Specify whether connectivity links should be : * 'both': intra-hemispheric and inter-hemispheric (default) * 'intra': intra-hemispheric * 'inter': inter-hemispheric In order to work, you should provide the hemisphere name using the input `hemisphere` categories : array_like | list | None Specify categorical information associated to each region to then get links only across categories. source_seed : str, list | None Brain region name(s) to use as source seed. Can either be the name of a single brain region or a list of brain regions. target_seed : str, list | None Brain region name(s) to use as target seed. Can either be the name of a single brain region or a list of brain regions. Returns ------- indices : tuple Remaining indices for (sources, targets) roi_st : list Name of the pairs of brain regions """ set_log_level(verbose) assert isinstance(roi, (np.ndarray, list, tuple)) if not directed: assert not net, ("Net computations not supported for undirected " "connectivity") roi = np.asarray(roi).astype(str) n_roi = len(roi) if isinstance(source_seed, str): source_seed = [source_seed] # noqa if isinstance(target_seed, str): target_seed = [target_seed] # noqa logger.info(f"Defining links (n_roi={n_roi}; directed={directed}; " f"net={net}, nb_min_links={nb_min_links})") # build separator name if sep == 'auto': sep = '->' if directed and not net else '-' else: assert isinstance(sep, str) # get (un)directed pairs if isinstance(pairs, np.ndarray) and (pairs.shape[1] == 2): x_s, x_t = pairs[:, 0], pairs[:, 1] else: if directed and not net: x_s, x_t = np.where(~np.eye(n_roi, dtype=bool)) elif (not directed) or (directed and net): x_s, x_t = np.triu_indices(n_roi, k=triu_k) # manage roi relation if roi_relation in ['inter', 'intra']: logger.info(f" Keeping only {roi_relation}-roi links") roi_s, roi_t = roi[x_s], roi[x_t] if roi_relation == 'intra': keep = [s == t for s, t in zip(roi_s, roi_t)] elif roi_relation == 'inter': keep = [s != t for s, t in zip(roi_s, roi_t)] keep = np.asarray(keep) logger.info(f" ROI relation selection (dropped={(~keep).sum()} " "links)") x_s, x_t = x_s[keep], x_t[keep] # change roi order for undirected and net directed if sort and (not directed) or (directed and net): logger.info(" Sorting roi names") roi_low = np.asarray([np.char.lower(r.astype(str)) for r in roi]) _xs, _xt = x_s.copy(), x_t.copy() x_s, x_t = [], [] for s, t in zip(_xs, _xt): _pair = np.array([roi_low[s], roi_low[t]]) if np.all(_pair == np.sort(_pair)): x_s.append(s) x_t.append(t) else: x_s.append(t) x_t.append(s) x_s, x_t = np.asarray(x_s), np.asarray(x_t) # keep pairs with a minimum number of links inside if isinstance(nb_min_links, int): logger.info(" Thresholding number of links") roi_st = [f"{s}{sep}{t}" for s, t in zip(roi[x_s], roi[x_t])] df = pd.DataFrame({'pairs': roi_st}) df = df.groupby('pairs').size() keep = [df.loc[r] >= nb_min_links for r in roi_st] x_s, x_t = x_s[keep], x_t[keep] # hemisphere selection if isinstance(hemisphere, (list, np.ndarray)): assert hemi_links in ['both', 'intra', 'inter'] hemisphere = np.asarray(hemisphere) h_s, h_t = hemisphere[x_s], hemisphere[x_t] if hemi_links in ['intra', 'inter']: keep = h_s == h_t if hemi_links == 'intra' else h_s != h_t x_s, x_t = x_s[keep], x_t[keep] else: keep = np.array([True] * len(x_s)) logger.info(f" Hemispheric selection (hemi_links={hemi_links}, " f"dropped={(~keep).sum()} links)") # categorical selection if isinstance(categories, (list, np.ndarray, tuple)): # reshape categories categories = np.asarray(categories) if categories.ndim == 1: categories = categories[:, np.newaxis] assert categories.shape[0] == n_roi # categorical selection keep = [] for s, t in zip(x_s, x_t): keep.append(np.all(categories[s, :] != categories[t, :])) keep = np.asarray(keep) x_s, x_t = x_s[keep], x_t[keep] logger.info(f" Categorical selection (dropped={(~keep).sum()} " "links)") # seed / target selection if isinstance(source_seed, (list, tuple, np.ndarray)): keep = _seed_selection(source_seed, roi, x_s, x_t, directed, 'source') x_s, x_t = x_s[keep], x_t[keep] if isinstance(target_seed, (list, tuple, np.ndarray)): keep = _seed_selection(target_seed, roi, x_s, x_t, directed, 'target') x_s, x_t = x_s[keep], x_t[keep] # build pairs of brain region names roi_st = np.asarray([f"{s}{sep}{t}" for s, t in zip(roi[x_s], roi[x_t])]) return (x_s, x_t), roi_st def _seed_selection(seed, roi, x_s, x_t, directed, origin): if directed: if origin == 'source': keep = [s in seed for s in roi[x_s]] elif origin == 'target': keep = [s in seed for s in roi[x_t]] else: keep_s = [s in seed for s in roi[x_s]] keep_t = [t in seed for t in roi[x_t]] keep = np.c_[keep_s, keep_t].any(1) return keep ############################################################################### ############################################################################### # CONN RESHAPING ############################################################################### ############################################################################### def conn_reshape_undirected( da, sep='-', order=None, axis='roi', rm_missing=False, fill_value=np.nan, fill_diagonal=None, to_dataframe=False, inplace=False, verbose=None): """Reshape a raveled undirected array of connectivity. This function reshapes a DataArray of connectivity values into a symmetric matrix. For example, a DataArray of shape (n_pairs,) where n_pairs reflects pairs of roi (e.g 'roi_1-roi_2') is going to be reshaped into a symmetric DataArray of shape (n_roi, n_roi). Similarly, a DataArray of shape (n_pairs, n_times) is going to be reshaped into a symmetric DataArray of shape (n_roi, n_roi, n_times). Parameters ---------- da : xarray.DataArray Flatten DataArray of connectivity values to be reshaped sep : string | '-' Separator used to separate the pairs of roi names. order : list | None List of roi names to reorder the output. axis : string | 'roi' Name of the spatial dimension to use for reshaping rm_missing : bool | False When reordering the connectivity array, choose if you prefer to reindex even if there's missing regions (rm_missing=False) or if missing regions should be removed (rm_missing=True) fill_value : float | np.nan Value to use for filling missing pairs fill_diagonal : float | None Value to use in order to fill the diagonal. If None, the diagonal is untouched to_dataframe : bool | False Dataframe conversion. Only possible if the da input does not contains a time axis. Returns ------- da_out : xarray.DataArray DataArray of shape (n_roi, n_roi, n_times) See also -------- conn_dfc """ set_log_level(verbose) assert isinstance(da, xr.DataArray) if not inplace: da = da.copy() assert axis in list(da.dims) # get sources, targets names and sorted full list sources, targets, roi_tot = _get_roi_names(da, sep, axis) # duplicates to make it symmetrical da = xr.concat((da, da), axis) s_, t_ = sources + targets, targets + sources # build the multiindex and unstack it da, order = _dataarray_unstack( da, s_, t_, roi_tot, fill_value, order, rm_missing, fill_diagonal, axis ) # dataframe conversion if to_dataframe: da = _dataframe_conversion(da, order, rm_missing) return da def conn_reshape_directed( da, net=False, sep='-', order=None, axis='roi', rm_missing=False, fill_value=np.nan, fill_diagonal=None, to_dataframe=False, inplace=False, verbose=None): """Reshape a raveled directed array of connectivity. This function takes a DataArray of shape (n_pairs, n_directions) or where n_pairs reflects pairs of roi (e.g 'roi_1-roi_2') and n_direction usually contains bidirected 'x->y' and 'y->x'. At the end, this function reshape the input array so that rows contains the sources and columns the targets leading to a non-symmetric DataArray of shape (n_roi, n_roi). A typical use case for this function would be after computing the covariance based granger causality. Parameters ---------- da : xarray.DataArray Xarray DataArray of shape (n_pairs, n_directions) where actually the roi dimension contains the pairs (roi_1-roi_2, roi_1-roi_3 etc.). The dimension n_directions should contains the dimensions 'x->y' and 'y->x' sep : string | '-' Separator used to separate the pairs of roi names. order : list | None List of roi names to reorder the output. axis : string | 'roi' Name of the spatial dimension to use for reshaping rm_missing : bool | False When reordering the connectivity array, choose if you prefer to reindex even if there's missing regions (rm_missing=False) or if missing regions should be removed (rm_missing=True) fill_value : float | np.nan Value to use for filling missing pairs (e.g diagonal) fill_diagonal : float | None Value to use in order to fill the diagonal. If None, the diagonal is untouched to_dataframe : bool | False Dataframe conversion. Only possible if the da input does not contains a time axis. Returns ------- da_out : xarray.DataArray DataArray of shape (n_roi, n_roi) See also -------- conn_covgc """ set_log_level(verbose) assert isinstance(da, xr.DataArray) if not inplace: da = da.copy() assert axis in list(da.dims) # get sources, targets names and sorted full list sources, targets, roi_tot = _get_roi_names(da, sep, axis) # transpose, reindex and reorder (if needed) if 'direction' in list(da.dims): da_xy, da_yx = da.sel(direction='x->y'), da.sel(direction='y->x') if net: da = xr.concat((da_xy - da_yx, da_xy - da_yx), axis) else: da = xr.concat((da_xy, da_yx), axis) s_, t_ = sources + targets, targets + sources else: s_, t_ = sources, targets da, order = _dataarray_unstack( da, s_, t_, roi_tot, fill_value, order, rm_missing, fill_diagonal, axis ) # dataframe conversion if to_dataframe: da = _dataframe_conversion(da, order, rm_missing) return da def _get_roi_names(da, sep, axis): """Get the roi names from a DataArray.""" # start by extrating sources / targets names sources, targets = [], [] for k in da[axis].data: sources += [k.split(sep)[0]] targets += [k.split(sep)[1]] # merge sources and targets to force square matrix roi_tot = nonsorted_unique(sources + targets) return sources, targets, roi_tot def _dataarray_unstack( da, sources, targets, roi_tot, fill_value, order, rm_missing, fill_diagonal, axis): """Unstack a 1d to 2d DataArray.""" # replace axis by sources and targets dim_names = list(da.dims) cut_at = dim_names.index(axis) dim_names = dim_names[:cut_at] + ['sources', 'targets'] + dim_names[ cut_at + 1:] # build the multi-index da[axis] = pd.MultiIndex.from_arrays( [sources, targets], names=['sources', 'targets']) # test for duplicated entries st_names = pd.Series([f"{s}-{t}" for s, t in zip(sources, targets)]) duplicates = np.array(list(st_names.duplicated(keep='first'))) if duplicates.any(): logger.warning(f"Duplicated entries found and removed : " f"{da[axis].data[duplicates]}") da = da.sel(roi=~duplicates) # unstack to be 2D/3D da = da.unstack(fill_value=fill_value) # transpose, reindex and reorder (if needed) da = da.transpose(*tuple(dim_names)) da = da.reindex(dict(sources=roi_tot, targets=roi_tot), fill_value=fill_value) # change order if isinstance(order, (list, np.ndarray)): if rm_missing: order = [k for k in order.copy() if k in roi_tot.tolist()] da = da.reindex(dict(sources=order, targets=order)) # fill diagonal (if needed) if fill_diagonal is not None: di = np.diag_indices(da.shape[0]) da.data[di[0], di[1], :] = fill_diagonal return da, order def _dataframe_conversion(da, order, rm_missing): """Convert a DataArray to a DataFrame and be sure its sorted correctly.""" assert da.data.squeeze().ndim == 2, ( "Dataframe conversion only possible for connectivity arrays when " "time dimension is missing") da = da.squeeze().to_dataframe('mi').reset_index() da = da.pivot(index='sources', columns='targets', values='mi') if isinstance(order, (list, np.ndarray)): da = da.reindex(order, axis='index').reindex(order, axis='columns') # drop empty lines if rm_missing: da = da.dropna(axis=0, how='all').dropna(axis=1, how='all') return da def conn_ravel_directed(da, sep='-', drop_within=False): """Ravel a directed array. This function reorganize a directed array that contains the coordinates x->y and y->x to a single coordinate 'x->y'. Parameters ---------- da : xarray.DataArray Xarray DataArray that should at least contains the dimensions 'roi' and 'direction'. The dimension 'direction' should also contains the coordinates 'x->y' and 'y->x' sep : string | '-' Separator used to separate the pairs of roi names. drop_within : bool | False Drop within node connections Returns ------- da_r : xarray.DataArray Raveled array of directed connectivity """ # inputs testing assert isinstance(da, xr.DataArray) and isinstance(sep, str) assert 'direction' in da.dims, "Should be a directed array" assert 'roi' in da.dims, "Missing roi dimension" directions = da['direction'].data assert ('x->y' in directions) and ('y->x' in directions) # build bidirected roi roi_xy, roi_yx = [], [] for r in da['roi'].data: r_s, r_t = r.split(sep) roi_xy.append(f"{r_s}->{r_t}") roi_yx.append(f"{r_t}->{r_s}") # select bidirected arrays da_xy = da.sel(direction='x->y').drop_vars('direction') da_yx = da.sel(direction='y->x').drop_vars('direction') # replace roi names da_xy['roi'] = roi_xy da_yx['roi'] = roi_yx # finally, concat both da_ravel = xr.concat((da_xy, da_yx), 'roi') # drop within node connections if drop_within: to_keep = [] for r in da_ravel['roi'].data: r_s, r_t = r.split('->') to_keep.append(r_s != r_t) da_ravel = da_ravel.sel(roi=to_keep) return da_ravel def conn_net(da, roi='roi', order=None, sep='-', invert=False, verbose=None): """Compute the net on directed connectivity. This function can be used to compute the net difference on directed connectivity (i.e. A - B = A->B - B->A). Parameters ---------- da : xr.DataArray Xarray DataArray containing the connectivity array roi : 'roi' Name of the spatial dimension order : list | None List of names for specifying the final order sep : string | '-' Separator between brain region names (e.g. if 'Insula->Thalamus' then sep is '->') invert : bool | False Specify whether the difference should be computed with A - B or B - A Returns ------- out : xr.DataArray DataArray, with the same dimension names as the input, representing the net difference of directed connexions. """ set_log_level(verbose) assert roi in da.dims roi_names = da[roi].data # get roi order from sources if order is None: roi_s, roi_t = [], [] for r in roi_names: _rs, _rt = r.split(sep) roi_s.append(_rs) roi_t.append(_rt) order = nonsorted_unique(roi_s + roi_t) order = np.asarray(order) # build names of the difference x_s, x_t = np.triu_indices(len(order), k=1) roi_s, roi_t = order[x_s], order[x_t] if invert: _roi_st = roi_s.copy() roi_s = roi_t roi_t = _roi_st # build pairs names roi_st, p_s, p_t, ignored = [], [], [], [] for s, t in zip(roi_s, roi_t): name_s, name_t = f"{s}{sep}{t}", f"{t}{sep}{s}" if (name_s in da[roi]) and (name_t in da[roi]): roi_st.append(f"{s}-{t}") p_s.append(name_s) p_t.append(name_t) else: ignored.append(f"{s}-{t}") # ignored.append(name_s) if len(ignored): logger.warning("The following pairs have been ignored in the " f"subtraction : {ignored}") # prepare the output out = da.isel(**{roi: slice(0, len(roi_st))}).copy() out[roi] = roi_st out.data = da.sel(**{roi: p_s}).data - da.sel(**{roi: p_t}).data # update attributes to track operations out.attrs['net_source'] = p_s out.attrs['net_target'] = p_t out.name = da.name + '_net' if da.name else 'Net conn' return out ############################################################################### ############################################################################### # CONN MUTUAL INFORMATION ############################################################################### ############################################################################### def _conn_mi(x, y, mi_type, minorm=False, **kw_mi): """Compute the mutual information for connectivity-related functions. This function compute the mutual information I(x, y) between a continuous x and a continuous or discret y variable. In addition, we assume here that the two last axes are multivariate and trials. Parameters ---------- x : array_like Array of shape (n_vars, n_mvaxis, n_trials) y : array_like Array of shape (n_trials) or (n_vars, n_mvaxis, n_trials) mi_type : {'cc', 'cd'} Mutual information type minorm : bool | False Normalize the mutual information kw_mi : dict Additional arguments are sent to the MI function Returns ------- mi : array_like Array of mutual information of shape (n_vars,) """ assert isinstance(x, np.ndarray) and isinstance(y, np.ndarray) assert (x.ndim == 3) and (1 <= y.ndim <= 3) assert mi_type in ['cc', 'cd'] kw_mi['traxis'] = -1 kw_mi['mvaxis'] = -2 kw_mi['shape_checking'] = False # compute mutual information if mi_type == 'cc': # reshape y, only if needed if y.ndim in (1, 2): y = np.atleast_2d(y)[np.newaxis, ...] y = np.tile(y, (x.shape[0], 1, 1)) _mi = mi_nd_gg(x, y, **kw_mi) elif mi_type == 'cd': _mi = mi_model_nd_gd(x, y, **kw_mi) # normalize the mi if minorm: kw_ent = dict(mvaxis=-2, traxis=-1, biascorrect=kw_mi["biascorrect"], shape_checking=False) _ent_x = ent_nd_g(x, **kw_ent) _ent_y = ent_nd_g(np.atleast_2d(y).astype(float), **kw_ent) _ent_xy = np.minimum(_ent_x, _ent_y) _mi /= _ent_xy return _mi
4b00204bf1744504a90b22619170f254e3f4633d
f0d713996eb095bcdc701f3fab0a8110b8541cbb
/9ED9zbHHhaPaBz2xi_1.py
55607ddaf041a60b190183711eb7aeff9bf882d2
[]
no_license
daniel-reich/turbo-robot
feda6c0523bb83ab8954b6d06302bfec5b16ebdf
a7a25c63097674c0a81675eed7e6b763785f1c41
refs/heads/main
2023-03-26T01:55:14.210264
2021-03-23T16:08:01
2021-03-23T16:08:01
350,773,815
0
0
null
null
null
null
UTF-8
Python
false
false
552
py
""" Consider a sequence where the first two numbers are `0` and `1` and the next number of the sequence is the sum of the previous two numbers modulo three. Create a function that finds the `n`th element of the sequence. ### Examples normal_sequence(1) ➞ 0 normal_sequence(2) ➞ 1 normal_sequence(3) ➞ 1 # (0+1)%3 = 1 normal_sequence(20) ➞ 2 ### Notes * 1 ≤ N ≤ 10^19 * A hint in comments section. """ def normal_sequence(n): dict = {1:0,2:1,3:1,4:2,5:0,6:2,7:2,0:1} return dict[n%8]
4056ce7d0c7d7aa37339d8d6f107d2fc1ba5f3ee
35e41dab4a3e8eebe17872f5414cf3efb86be54c
/supervised_learning/0x08-deep_cnns/3-projection_block.py
8cf99029892ce07e6fa99b4b6ec1db75920eeb35
[]
no_license
yasheymateen/holbertonschool-machine_learning
52eaf217e924404e8833e75e8b48e80807d784dc
1329ba88bf9ae50693188e1c85383d9b76c2b1f4
refs/heads/master
2022-12-24T13:51:02.743526
2020-10-08T06:59:04
2020-10-08T06:59:04
255,277,037
0
0
null
null
null
null
UTF-8
Python
false
false
956
py
#!/usr/bin/env python3 """identity block maker""" import tensorflow.keras as K def projection_block(A_prev, filters, s=2): """Return an identity block""" out = K.layers.Conv2D(filters[0], 1, s, kernel_initializer='he_normal')(A_prev) out = K.layers.BatchNormalization()(out) out = K.layers.Activation('relu')(out) out = K.layers.Conv2D(filters[1], 3, padding='same', kernel_initializer='he_normal')(out) out = K.layers.BatchNormalization()(out) out = K.layers.Activation('relu')(out) out = K.layers.Conv2D(filters[2], 1, kernel_initializer='he_normal')(out) out = K.layers.BatchNormalization()(out) out2 = K.layers.Conv2D(filters[2], 1, s, kernel_initializer='he_normal')(A_prev) out2 = K.layers.BatchNormalization()(out2) out = K.layers.add([out, out2]) return K.layers.Activation('relu')(out)
0b6fa605bb49d021790aa6ee7cb6c301ac938c7d
fe9b1fcf9f44092037a8c14b4c5cbfefa6ad6982
/shoppingsite.py
923848ec55b2472541fe4bc960484ee1da3d1163
[]
no_license
elaineyoung702/shopping-site
702abd1536b8e805dc719377de23f456773039c2
e2dbd14569203c6d4be4119ab075f2210c88b61d
refs/heads/master
2021-06-20T05:48:32.217285
2019-07-26T00:51:48
2019-07-26T00:51:48
198,886,591
0
0
null
2021-03-20T01:19:46
2019-07-25T19:00:51
Python
UTF-8
Python
false
false
4,873
py
"""Ubermelon shopping application Flask server. Provides web interface for browsing melons, seeing detail about a melon, and put melons in a shopping cart. Authors: Joel Burton, Christian Fernandez, Meggie Mahnken, Katie Byers. """ from flask import Flask, render_template, redirect, flash, session import jinja2 import melons app = Flask(__name__) # A secret key is needed to use Flask sessioning features app.secret_key = 'this-should-be-something-unguessable' # Normally, if you refer to an undefined variable in a Jinja template, # Jinja silently ignores this. This makes debugging difficult, so we'll # set an attribute of the Jinja environment that says to make this an # error. app.jinja_env.undefined = jinja2.StrictUndefined @app.route("/") def index(): """Return homepage.""" return render_template("homepage.html") @app.route("/melons") def list_melons(): """Return page showing all the melons ubermelon has to offer""" melon_list = melons.get_all() return render_template("all_melons.html", melon_list=melon_list) @app.route("/melon/<melon_id>") def show_melon(melon_id): """Return page showing the details of a given melon. Show all info about a melon. Also, provide a button to buy that melon. """ melon = melons.get_by_id(melon_id) # print(melon) return render_template("melon_details.html", display_melon=melon) @app.route("/cart") def show_shopping_cart(): """Display content of shopping cart.""" # TODO: Display the contents of the shopping cart. # The logic here will be something like: # # - get the cart dictionary from the session # - create a list to hold melon objects and a variable to hold the total # cost of the order # - loop over the cart dictionary, and for each melon id: # - get the corresponding Melon object # - compute the total cost for that type of melon # - add this to the order total # - add quantity and total cost as attributes on the Melon object # - add the Melon object to the list created above # - pass the total order cost and the list of Melon objects to the template # # Make sure your function can also handle the case wherein no cart has # been added to the session cart = session["cart"] print(cart) # melons = [] # total_order_cost = 0 # for melon in cart: # melons.append[melon] return render_template("cart.html") @app.route("/add_to_cart/<melon_id>") def add_to_cart(melon_id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Melon successfully added to cart'.""" # TODO: Finish shopping cart functionality # The logic here should be something like: # # - check if a "cart" exists in the session, and create one (an empty # dictionary keyed to the string "cart") if not # - check if the desired melon id is the cart, and if not, put it in # - increment the count for that melon id by 1 # - flash a success message # - redirect the user to the cart page if "cart" not in session: session["cart"] = {} cart = session["cart"] cart[melon_id] = cart.get(melon_id, 0) + 1 # print(cart) flash("Melon successfully added!") return redirect("/cart") @app.route("/login", methods=["GET"]) def show_login(): """Show login form.""" return render_template("login.html") @app.route("/login", methods=["POST"]) def process_login(): """Log user into site. Find the user's login credentials located in the 'request.form' dictionary, look up the user, and store them in the session. """ # TODO: Need to implement this! # The logic here should be something like: # # - get user-provided name and password from request.form # - use customers.get_by_email() to retrieve corresponding Customer # object (if any) # - if a Customer with that email was found, check the provided password # against the stored one # - if they match, store the user's email in the session, flash a success # message and redirect the user to the "/melons" route # - if they don't, flash a failure message and redirect back to "/login" # - do the same if a Customer with that email doesn't exist return "Oops! This needs to be implemented" @app.route("/checkout") def checkout(): """Checkout customer, process payment, and ship melons.""" # For now, we'll just provide a warning. Completing this is beyond the # scope of this exercise. flash("Sorry! Checkout will be implemented in a future version.") return redirect("/melons") if __name__ == "__main__": app.run(debug=True)
7b67cdaa927798bb7bcd21bf3a652fc430e7d02c
a11d83fced34854664fac72e18d48fde6aa967e4
/0x11-python-network_1/2-post_email.py
9a6be815e066d3d6642c328bd74da639a6b63b2d
[]
no_license
afarizap/holbertonschool-higher_level_programming
ffe0bf1440726c952f4dd28b908eabc4ccb5225b
ad39e58f9cb20cba4b9e2c14075f216097588f47
refs/heads/master
2023-03-30T15:39:35.184484
2021-03-22T22:55:24
2021-03-22T22:55:24
259,437,040
0
0
null
null
null
null
UTF-8
Python
false
false
458
py
#!/usr/bin/python3 """ takes in a URL and an email, sends a POST request with the email as a parameter, and displays the body of the response decoded in utf-8 """ from urllib import request, parse from sys import argv if __name__ == '__main__': data = parse.urlencode({'email': argv[2]}) data = data.encode('ascii') req = request.Request(argv[1], data) with request.urlopen(req) as response: print(response.read().decode('utf-8'))
8ab9ca2c71dcf5dd124863ea0ac9caad6daa108a
01245df7d402532d9729ff933f5ade8c2965760b
/fias/admin.py
8f9ffe8cfa5ca10b536c6a856b7b8b8a5df040b2
[ "BSD-2-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
aldev12/django-fias
c653edbef22d7f3fb42e4ebc0a8729fa488e3799
53980ada222f1f4f56c268c0489ab9a50a87d9f6
refs/heads/master
2020-06-02T18:39:30.285925
2020-04-14T02:26:19
2020-04-14T02:26:19
191,269,395
0
1
NOASSERTION
2019-07-17T00:51:28
2019-06-11T01:15:19
Python
UTF-8
Python
false
false
3,549
py
# coding: utf-8 from __future__ import unicode_literals, absolute_import from django.contrib import admin from fias.models import ( AddrObj, House, HouseInt, LandMark, Room, Stead, NormDoc, SocrBase, NDocType, ActStat, CenterSt, CurentSt, EstStat, HSTStat, IntvStat, OperStat, StrStat, ) class ViewAdmin(admin.ModelAdmin): """ Класс админки только для просмотра данных модели """ change_form_template = 'admin/view_form.html' save_on_top = False actions = None def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): return False def save_model(self, request, obj, form, change): pass @admin.register(SocrBase) class SocrBaseAdmin(admin.ModelAdmin): list_display = ['level', 'scname', 'socrname', 'item_weight'] list_display_links = ('scname', 'socrname') readonly_fields = ['level', 'scname', 'socrname', 'kod_t_st'] list_editable = ['item_weight'] ordering = ['-item_weight', 'level'] actions = None def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): return False @admin.register(AddrObj) class AddrObjAdmin(ViewAdmin): list_display = ('offname', 'shortname', 'aolevel', 'code', 'aoguid') @admin.register(House) class HouseAdmin(ViewAdmin): list_display = ('aoguid', 'housenum', 'buildnum', 'strucnum', 'houseguid') raw_id_fields = ('aoguid',) @admin.register(HouseInt) class HouseIntAdmin(ViewAdmin): list_display = ('aoguid', 'intguid', 'houseintid', 'intstart', 'intend') raw_id_fields = ('aoguid',) @admin.register(LandMark) class LandMarkAdmin(ViewAdmin): list_display = ('aoguid', 'landguid', 'landid') raw_id_fields = ('aoguid',) @admin.register(Room) class RoomAdmin(ViewAdmin): list_display = ('houseguid', 'flatnumber', 'flattype', 'roomguid', 'roomid') raw_id_fields = ('houseguid',) @admin.register(Stead) class SteadAdmin(ViewAdmin): list_display = ('steadguid', 'number', 'regioncode') @admin.register(NDocType) class NDocTypeAdmin(ViewAdmin): list_display = ('ndtypeid', 'name') list_display_links = ('name',) @admin.register(NormDoc) class NormDocAdmin(ViewAdmin): list_display = ('normdocid', 'docdate', 'docnum') list_display_links = ('normdocid',) @admin.register(ActStat) class ActStatAdmin(ViewAdmin): list_display = ('actstatid', 'name') list_display_links = ('name',) @admin.register(CenterSt) class CenterStatAdmin(ViewAdmin): list_display = ('centerstid', 'name') list_display_links = ('name',) @admin.register(CurentSt) class CurentStatAdmin(ViewAdmin): list_display = ('curentstid', 'name') list_display_links = ('name',) @admin.register(EstStat) class EstStatAdmin(ViewAdmin): list_display = ('eststatid', 'name', 'shortname') list_display_links = ('name',) @admin.register(HSTStat) class HSTStatAdmin(ViewAdmin): list_display = ('housestid', 'name') list_display_links = ('name',) @admin.register(IntvStat) class IntvStatAdmin(ViewAdmin): list_display = ('intvstatid', 'name') list_display_links = ('name',) @admin.register(OperStat) class OperStatAdmin(ViewAdmin): list_display = ('operstatid', 'name') list_display_links = ('name',) @admin.register(StrStat) class StrStatAdmin(ViewAdmin): list_display = ('strstatid', 'name', 'shortname') list_display_links = ('name',)
1699d746364a1a9d683eea8ae286e3c4946fedfd
b9d54c64d4a280703b459b346e42518896e20e0a
/lingvo/core/steps/rnn_steps.py
6cc1e6b2a8abd40ef87b889efccab03a49964c07
[ "Apache-2.0" ]
permissive
zh794390558/lingvo
55a27a4e241414389f0c7b40f381a672bb164372
ecdf678179018ca07f4f52d065b9bf3fe2dc7c5a
refs/heads/master
2020-09-26T18:32:31.631402
2019-12-06T04:01:22
2019-12-06T04:02:05
177,497,272
0
0
Apache-2.0
2019-03-25T02:05:42
2019-03-25T02:05:42
null
UTF-8
Python
false
false
10,097
py
# Lint as: python2, python3 # Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # 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. """Step APIs for RNN layers.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from lingvo import compat as tf from lingvo.core import base_layer from lingvo.core import py_utils from lingvo.core import rnn_cell from lingvo.core import step class RnnStep(step.Step): """A step containing an RNNCell.""" @classmethod def Params(cls): p = super(RnnStep, cls).Params() p.Define('cell', rnn_cell.LSTMCellSimple.Params(), 'Params for the RNN cell.') return p @base_layer.initializer def __init__(self, params): super(RnnStep, self).__init__(params) p = params with tf.variable_scope(p.name): self.CreateChild('cell', p.cell) def PrepareExternalInputs(self, theta, external_inputs): """Does not modify the external_inputs parameter. This parameter, if provided, is assumed to be a vector that should be concatenated with the other vectors in step_inputs.inputs. Args: theta: unused. external_inputs: Either a tensor or None. Returns: external_inputs, unmodified. """ return external_inputs def ZeroState(self, theta, prepared_inputs, batch_size): """Returns the zero_state for the RNN cell. Args: theta: Variables used by the RNNCell. prepared_inputs: unused. batch_size: An int scalar representing the batch size of per-step inputs. Returns: The zero state of the RNNCell. """ return self.cell.zero_state(theta.cell, batch_size) def FProp(self, theta, prepared_inputs, step_inputs, padding, state0): """Performs one inference step on the RNN cell. If external_inputs is not None, it is added as another act input to the RNNCell. Args: theta: Variables used by the RNNCell. prepared_inputs: If not None, concatenated with step_inputs.input. A tensor of shape [batch_size, external_input_dim]. step_inputs: A NestedMap containing an 'input' list of [batch_size, dim] where the sum of dim (including external_inputs) is p.cell.num_input_nodes. padding: A 0/1 float tensor of shape [batch_size]; 1.0 means that this batch element is empty in this step. state0: A NestedMap of state, either produced by ZeroState or a previous invocation of FProp. Returns: (output, state1), where output is the cell output (GetOutput(state1)) of shape [batch_size, p.cell.num_output_nodes], and state1 is the cell's recurrent state. """ cell_inputs = py_utils.NestedMap(act=step_inputs.inputs) # An empty NestedMap can act as a None value here. if prepared_inputs is not None and not isinstance(prepared_inputs, py_utils.NestedMap): cell_inputs.act.append(prepared_inputs) cell_inputs.padding = padding state1, extra = self.cell.FProp(theta.cell, state0, cell_inputs) return py_utils.NestedMap( output=self.cell.GetOutput(state1), extra=extra, padding=padding), state1 class RnnStackStep(step.Step): """A stack of RnnSteps. Three types of inputs are supported: step_inputs.input: This is the standard input. It is expected to change on every step of the sequence, and it is fed only to the first layer. step_inputs.context: This input changes for each step of the sequence, but is fed to every layer. external_inputs: This input is fixed at the beginning of the sequence. It is fed to every layer. Residual connections are also supported. When residual_start >= 0, the output of layer i (i >= residual_start) is added to the output of layer i - residual_stride. """ @classmethod def Params(cls): """Constructs Params for an RnnStackStep.""" p = super(RnnStackStep, cls).Params() p.Define( 'rnn_cell_tpl', rnn_cell.LSTMCellSimple.Params(), 'RNNCell params template. ' 'Can be a single param or ' 'a list of rnn_layers params, one for each layer.') p.Define( 'external_input_dim', 0, 'Size of the external input. ' 'The external input is given at the start of the sequence ' 'and is given to every layer at every step.') p.Define( 'step_input_dim', 0, 'Size of the step input. ' 'This input is only given to the first layer and is expected to ' 'be different for each step.') p.Define( 'context_input_dim', 0, 'Size of the context input. ' 'This input is given to every layer and is expected to be ' 'different for each step.') p.Define( 'rnn_cell_dim', 0, 'Size of the rnn cells. ' 'This may be overridden by parameters set in rnn_cell_tpl.') p.Define( 'rnn_cell_hidden_dim', 0, 'internal size of the rnn cells. When ' 'set to > 0 it enables a projection layer at the output of the ' 'rnn cell. This may be overridden by parameters set in rnn_cell_tpl.') p.Define('rnn_layers', 1, 'Number of rnn layers.') p.Define( 'residual_start', -1, 'Start residual connections from this layer. For this and higher ' 'layers, the layer output is the sum of the RNN cell output and ' 'input; if the layer also normalizes its output, then the ' 'normalization is done over this sum. Set to -1 to disable ' 'residual connections.') p.Define('residual_stride', 1, 'Number of lstm layers to skip per residual connection.') return p @base_layer.initializer def __init__(self, params): super(RnnStackStep, self).__init__(params) p = params sub = [] # Users can either provide a single rnn_cell_tpl or one per layer. # If only one is provided, we replicate it for each layer. rnn_cell_tpls = p.rnn_cell_tpl if not isinstance(rnn_cell_tpls, list): rnn_cell_tpls = [p.rnn_cell_tpl] * p.rnn_layers # We may provide up to three tensors as input to the RnnStep: # the normal input, the context input (from step_inputs.context), # and the external input (from external_inputs). arity = 1 if p.context_input_dim: arity += 1 if p.external_input_dim: arity += 1 extra_dim = p.context_input_dim + p.external_input_dim # The first layer's input comes from step_inputs.input. Later layers # will get their inputs from the previous layer's output. input_nodes = p.step_input_dim for i in range(p.rnn_layers): step_i = RnnStep.Params() step_i.name = 'rnn_%d' % (i) step_i.cell = rnn_cell_tpls[i].Copy() step_i.cell.num_input_nodes = input_nodes + extra_dim step_i.cell.inputs_arity = arity # The dimensions of each cell may be specified in the cell template # but most users will specify them in the stack params. if step_i.cell.num_output_nodes == 0: step_i.cell.num_output_nodes = p.rnn_cell_dim if step_i.cell.num_hidden_nodes == 0: step_i.cell.num_hidden_nodes = p.rnn_cell_hidden_dim input_nodes = step_i.cell.num_output_nodes sub.append(step_i) stack_params = step.StackStep.Params() stack_params.name = p.name stack_params.sub = sub stack_params.residual_start = p.residual_start stack_params.residual_stride = p.residual_stride self.CreateChild('stack', stack_params) def PrepareExternalInputs(self, theta, external_inputs): """Delegates external inputs preparation to sub-layers. Args: theta: A `.NestedMap` object containing weight values of this layer and its children layers. external_inputs: A `.NestedMap` object. The structure of the internal fields is defined by the sub-steps. Returns: A `.NestedMap` containing a pre-processed version of the external_inputs, one per sub-step. """ return self.stack.PrepareExternalInputs(theta.stack, external_inputs) def ZeroState(self, theta, prepared_inputs, batch_size): """Computes a zero state for each sub-step. Args: theta: A `.NestedMap` object containing weight values of this layer and its children layers. prepared_inputs: An output from PrepareExternalInputs. batch_size: The number of items in the batch that FProp will process. Returns: A `.NestedMap` containing a state0 object for each sub-step. """ return self.stack.ZeroState(theta.stack, prepared_inputs, batch_size) def FProp(self, theta, prepared_inputs, step_inputs, padding, state0): """Performs inference on the stack of sub-steps. See the documentation for StackStep for the particulars of passing context information to layers. Args: theta: A `.NestedMap` object containing weight values of this layer and its children layers. prepared_inputs: An output from PrepareExternalInputs. step_inputs: A `.NestedMap` containing a list called 'inputs', an optionally a tensor called 'context'. padding: A 0/1 float tensor of shape [batch_size]; 1.0 means that this batch element is empty in this step. state0: The previous recurrent state. Returns: (output, state1): - output: A `.NestedMap` containing the output of the top-most step. - state1: The recurrent state to feed to next invocation of this graph. """ return self.stack.FProp(theta.stack, prepared_inputs, step_inputs, padding, state0)
60d4fed93ac6cca6c2002acc9ab54c8781e1beb1
a4a540187b93a177331885caee59c3253e91ea7f
/pymcversion/java_version_manifest.py
340eb9a94fddb23da1d9f3eea8de3417385e38a9
[ "Unlicense" ]
permissive
aoirint/pymcversion
ae97123457594ad7741b8f8b69a8deff515eb09c
a3af1d06c9b1ce54530fc9af04b3cb48a0ba1340
refs/heads/main
2023-08-25T19:50:52.011370
2021-10-22T15:58:48
2021-10-22T15:58:48
null
0
0
null
null
null
null
UTF-8
Python
false
false
768
py
import requests from typing import List from pydantic import BaseModel class VersionManifestLatest(BaseModel): release: str snapshot: str class VersionManifestVersion(BaseModel): id: str type: str url: str time: str releaseTime: str class VersionManifest(BaseModel): latest: VersionManifestLatest versions: List[VersionManifestVersion] def get_java_version_manifest() -> VersionManifest: timeout = 3 useragent = 'aoirint/pymcversion' headers = { 'User-Agent': useragent, } res = requests.get('https://launchermeta.mojang.com/mc/game/version_manifest.json', headers=headers, timeout=timeout) manifest_dict = res.json() manifest = VersionManifest.parse_obj(manifest_dict) return manifest
a8d7306647943a80193bed286000c317c065f4a4
78546bb00bae18dda6f728da61cf91db93715048
/generate_directory_index_caddystyle.py
f595a133b6734189f84b5dc2719ff0fc99bf3f7d
[]
no_license
scienceacademy/spooky_stories2020
32e219f1ab177f6b4e4351c506d3c9fcbf59dc01
50a44cb517a318124b00aab2eaa6ef9befba3620
refs/heads/main
2023-01-02T16:59:46.885943
2020-11-02T03:09:54
2020-11-02T03:09:54
308,461,571
0
0
null
null
null
null
UTF-8
Python
false
false
17,614
py
#!/usr/bin/env python3 # --- # Copyright 2020 glowinthedark # # 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. # --- # # Generate index.html files for # all subdirectories in a directory tree. # -handle symlinked files and folders: displayed with custom icons # By default only the current folder is processed. # Use -r or --recursive to process nested folders. import argparse import datetime import os import sys from pathlib import Path index_file_name = 'index.html' def process_dir(top_dir, opts): glob_patt = opts.filter or '*' path_top_dir: Path path_top_dir = Path(top_dir) index_file = None index_path = Path(path_top_dir, index_file_name) if opts.verbose: print(f'Traversing dir {path_top_dir.absolute()}') try: index_file = open(index_path, "w") except Exception as e: print('cannot create file %s %s' % (index_path, e)) return index_file.write("""<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> * { padding: 0; margin: 0; } body { font-family: sans-serif; text-rendering: optimizespeed; background-color: #ffffff; } a { color: #006ed3; text-decoration: none; } a:hover, h1 a:hover { color: #319cff; } header, #summary { padding-left: 5%; padding-right: 5%; } th:first-child, td:first-child { width: 5%; } th:last-child, td:last-child { width: 5%; } header { padding-top: 25px; padding-bottom: 15px; background-color: #f2f2f2; } h1 { font-size: 20px; font-weight: normal; white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; color: #999; } h1 a { color: #000; margin: 0 4px; } h1 a:hover { text-decoration: underline; } h1 a:first-child { margin: 0; } main { display: block; } .meta { font-size: 12px; font-family: Verdana, sans-serif; border-bottom: 1px solid #9C9C9C; padding-top: 10px; padding-bottom: 10px; } .meta-item { margin-right: 1em; } #filter { padding: 4px; border: 1px solid #CCC; } table { width: 100%; border-collapse: collapse; } tr { border-bottom: 1px dashed #dadada; } tbody tr:hover { background-color: #ffffec; } th, td { text-align: left; padding: 10px 0; } th { padding-top: 15px; padding-bottom: 15px; font-size: 16px; white-space: nowrap; } th a { color: black; } th svg { vertical-align: middle; } td { white-space: nowrap; font-size: 14px; } td:nth-child(2) { width: 80%; } td:nth-child(3) { padding: 0 20px 0 20px; } th:nth-child(4), td:nth-child(4) { text-align: right; } td:nth-child(2) svg { position: absolute; } td .name { margin-left: 1.75em; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; } td .goup { margin-left: 1.75em; padding: 0; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; } .icon { margin-right: 5px; } tr.clickable { cursor: pointer; } tr.clickable a { display: block; } @media (max-width: 600px) { * { font-size: 1.06rem; } .hideable { display: none; } td:nth-child(2) { width: auto; } th:nth-child(3), td:nth-child(3) { padding-right: 5%; text-align: right; } h1 { color: #000; } h1 a { margin: 0; } #filter { max-width: 100px; } } </style> </head> <body> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="0" width="0" style="position: absolute;"> <defs> <!-- Go-up --> <g id="go-up"> <path d="M10,9V5L3,12L10,19V14.9C15,14.9 18.5,16.5 21,20C20,15 17,10 10,9Z" fill="#696969"/> </g> <!-- Folder --> <g id="folder" fill-rule="nonzero" fill="none"> <path d="M285.22 37.55h-142.6L110.9 0H31.7C14.25 0 0 16.9 0 37.55v75.1h316.92V75.1c0-20.65-14.26-37.55-31.7-37.55z" fill="#FFA000"/> <path d="M285.22 36H31.7C14.25 36 0 50.28 0 67.74v158.7c0 17.47 14.26 31.75 31.7 31.75H285.2c17.44 0 31.7-14.3 31.7-31.75V67.75c0-17.47-14.26-31.75-31.7-31.75z" fill="#FFCA28"/> </g> <g id="folder-shortcut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="folder-shortcut-group" fill-rule="nonzero"> <g id="folder-shortcut-shape"> <path d="M285.224876,37.5486902 L142.612438,37.5486902 L110.920785,0 L31.6916529,0 C14.2612438,0 0,16.8969106 0,37.5486902 L0,112.646071 L316.916529,112.646071 L316.916529,75.0973805 C316.916529,54.4456008 302.655285,37.5486902 285.224876,37.5486902 Z" id="Shape" fill="#FFA000"></path> <path d="M285.224876,36 L31.6916529,36 C14.2612438,36 0,50.2838568 0,67.7419039 L0,226.451424 C0,243.909471 14.2612438,258.193328 31.6916529,258.193328 L285.224876,258.193328 C302.655285,258.193328 316.916529,243.909471 316.916529,226.451424 L316.916529,67.7419039 C316.916529,50.2838568 302.655285,36 285.224876,36 Z" id="Shape" fill="#FFCA28"></path> </g> <path d="M126.154134,250.559184 C126.850974,251.883673 127.300549,253.006122 127.772602,254.106122 C128.469442,255.206122 128.919016,256.104082 129.638335,257.002041 C130.559962,258.326531 131.728855,259 133.100057,259 C134.493737,259 135.415364,258.55102 136.112204,257.67551 C136.809044,257.002041 137.258619,255.902041 137.258619,254.577551 C137.258619,253.904082 137.258619,252.804082 137.033832,251.457143 C136.786566,249.908163 136.561779,249.032653 136.561779,248.583673 C136.089726,242.814286 135.864939,237.920408 135.864939,233.273469 C135.864939,225.057143 136.786566,217.514286 138.180246,210.846939 C139.798713,204.202041 141.889234,198.634694 144.429328,193.763265 C147.216689,188.869388 150.678411,184.873469 154.836973,181.326531 C158.995535,177.779592 163.626149,174.883673 168.481552,172.661224 C173.336954,170.438776 179.113983,168.665306 185.587852,167.340816 C192.061722,166.218367 198.760378,165.342857 205.481514,164.669388 C212.18017,164.220408 219.598146,163.995918 228.162535,163.995918 L246.055591,163.995918 L246.055591,195.514286 C246.055591,197.736735 246.752431,199.510204 248.370899,201.059184 C250.214153,202.608163 252.079886,203.506122 254.372715,203.506122 C256.463236,203.506122 258.531277,202.608163 260.172223,201.059184 L326.102289,137.797959 C327.720757,136.24898 328.642384,134.47551 328.642384,132.253061 C328.642384,130.030612 327.720757,128.257143 326.102289,126.708163 L260.172223,63.4469388 C258.553756,61.8979592 256.463236,61 254.395194,61 C252.079886,61 250.236632,61.8979592 248.393377,63.4469388 C246.77491,64.9959184 246.07807,66.7693878 246.07807,68.9918367 L246.07807,100.510204 L228.162535,100.510204 C166.863084,100.510204 129.166282,117.167347 115.274437,150.459184 C110.666301,161.54898 108.350993,175.310204 108.350993,191.742857 C108.350993,205.279592 113.903236,223.912245 124.760454,247.438776 C125.00772,248.112245 125.457294,249.010204 126.154134,250.559184 Z" id="Shape" fill="#FFFFFF" transform="translate(218.496689, 160.000000) scale(-1, 1) translate(-218.496689, -160.000000) "></path> </g> </g> <!-- File --> <g id="file" stroke="#000" stroke-width="25" fill="#FFF" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <path d="M13 24.12v274.76c0 6.16 5.87 11.12 13.17 11.12H239c7.3 0 13.17-4.96 13.17-11.12V136.15S132.6 13 128.37 13H26.17C18.87 13 13 17.96 13 24.12z"/> <path d="M129.37 13L129 113.9c0 10.58 7.26 19.1 16.27 19.1H249L129.37 13z"/> </g> <g id="file-shortcut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="file-shortcut-group" transform="translate(13.000000, 13.000000)"> <g id="file-shortcut-shape" stroke="#000000" stroke-width="25" fill="#FFFFFF" stroke-linecap="round" stroke-linejoin="round"> <path d="M0,11.1214886 L0,285.878477 C0,292.039924 5.87498876,296.999983 13.1728373,296.999983 L225.997983,296.999983 C233.295974,296.999983 239.17082,292.039942 239.17082,285.878477 L239.17082,123.145388 C239.17082,123.145388 119.58541,2.84217094e-14 115.369423,2.84217094e-14 L13.1728576,2.84217094e-14 C5.87500907,-1.71479982e-05 0,4.96022995 0,11.1214886 Z" id="rect1171"></path> <path d="M116.37005,0 L116,100.904964 C116,111.483663 123.258008,120 132.273377,120 L236,120 L116.37005,0 L116.37005,0 Z" id="rect1794"></path> </g> <path d="M47.803141,294.093878 C48.4999811,295.177551 48.9495553,296.095918 49.4216083,296.995918 C50.1184484,297.895918 50.5680227,298.630612 51.2873415,299.365306 C52.2089688,300.44898 53.3778619,301 54.7490634,301 C56.1427436,301 57.0643709,300.632653 57.761211,299.916327 C58.4580511,299.365306 58.9076254,298.465306 58.9076254,297.381633 C58.9076254,296.830612 58.9076254,295.930612 58.6828382,294.828571 C58.4355724,293.561224 58.2107852,292.844898 58.2107852,292.477551 C57.7387323,287.757143 57.5139451,283.753061 57.5139451,279.95102 C57.5139451,273.228571 58.4355724,267.057143 59.8292526,261.602041 C61.44772,256.165306 63.5382403,251.610204 66.0783349,247.62449 C68.8656954,243.620408 72.3274172,240.35102 76.4859792,237.44898 C80.6445412,234.546939 85.2751561,232.177551 90.1305582,230.359184 C94.9859603,228.540816 100.76299,227.089796 107.236859,226.006122 C113.710728,225.087755 120.409385,224.371429 127.13052,223.820408 C133.829177,223.453061 141.247152,223.269388 149.811542,223.269388 L167.704598,223.269388 L167.704598,249.057143 C167.704598,250.87551 168.401438,252.326531 170.019905,253.593878 C171.86316,254.861224 173.728893,255.595918 176.021722,255.595918 C178.112242,255.595918 180.180284,254.861224 181.82123,253.593878 L247.751296,201.834694 C249.369763,200.567347 250.291391,199.116327 250.291391,197.297959 C250.291391,195.479592 249.369763,194.028571 247.751296,192.761224 L181.82123,141.002041 C180.202763,139.734694 178.112242,139 176.044201,139 C173.728893,139 171.885639,139.734694 170.042384,141.002041 C168.423917,142.269388 167.727077,143.720408 167.727077,145.538776 L167.727077,171.326531 L149.811542,171.326531 C88.5120908,171.326531 50.8152886,184.955102 36.9234437,212.193878 C32.3153075,221.267347 30,232.526531 30,245.971429 C30,257.046939 35.5522422,272.291837 46.4094607,291.540816 C46.6567266,292.091837 47.1063009,292.826531 47.803141,294.093878 Z" id="Shape-Copy" fill="#000000" fill-rule="nonzero" transform="translate(140.145695, 220.000000) scale(-1, 1) translate(-140.145695, -220.000000) "></path> </g> </g> </defs> </svg> <header> <h1>""" f'{path_top_dir.name}' """</h1> </header> <main> <div class="listing"> <table aria-describedby="summary"> <thead> <tr> <th></th> <th>Name</th> <th>Size</th> <th class="hideable"> Modified </th> <th class="hideable"></th> </tr> </thead> <tbody> <tr class="clickable"> <td></td> <td><a href=".."><svg width="1.5em" height="1em" version="1.1" viewBox="0 0 24 24"><use xlink:href="#go-up"></use></svg> <span class="goup">..</span></a></td> <td>&mdash;</td> <td class="hideable">&mdash;</td> <td class="hideable"></td> </tr> """) # sort dirs first sorted_entries = sorted(path_top_dir.glob(glob_patt), key= lambda p: (p.is_file(), p.name)) entry: Path for entry in sorted_entries: # don't include index.html in the file listing if entry.name.lower() == index_file_name.lower(): continue if entry.is_dir() and opts.recursive: process_dir(entry, opts) # From Python 3.6, os.access() accepts path-like objects if (not entry.is_symlink()) and not os.access(str(entry), os.W_OK): print(f"*** WARNING *** entry {entry.absolute()} is not writable! SKIPPING!") continue if opts.verbose: print(f'{entry.absolute()}') size_bytes = -1 ## is a folder size_pretty = '&mdash;' last_modified = '-' last_modified_human_readable = '-' last_modified_iso = '' try: if entry.is_file(): size_bytes = entry.stat().st_size size_pretty = pretty_size(size_bytes) if entry.is_dir() or entry.is_file(): last_modified = datetime.datetime.fromtimestamp(entry.stat().st_mtime).replace(microsecond=0) last_modified_iso = last_modified.isoformat() last_modified_human_readable = last_modified.strftime("%c") except Exception as e: print('ERROR accessing file name:', e, entry) continue entry_path = str(entry.name) if entry.is_dir() and not entry.is_symlink(): entry_type = 'folder' entry_path = os.path.join(entry.name, '') elif entry.is_dir() and entry.is_symlink(): entry_type = 'folder-shortcut' print('dir-symlink', entry.absolute()) elif entry.is_file() and entry.is_symlink(): entry_type = 'file-shortcut' print('file-symlink', entry.absolute()) else: entry_type = 'file' index_file.write(f""" <tr class="file"> <td></td> <td> <a href="{entry_path}"> <svg width="1.5em" height="1em" version="1.1" viewBox="0 0 265 323"><use xlink:href="#{entry_type}"></use></svg> <span class="name">{entry.name}</span> </a> </td> <td data-order="{size_bytes}">{size_pretty}</td> <td class="hideable"><time datetime="{last_modified_iso}">{last_modified_human_readable}</time></td> <td class="hideable"></td> </tr> """) index_file.write(""" </tbody> </table> </div> </main> </body> </html>""") if index_file: index_file.close() # bytes pretty-printing UNITS_MAPPING = [ (1024 ** 5, ' PB'), (1024 ** 4, ' TB'), (1024 ** 3, ' GB'), (1024 ** 2, ' MB'), (1024 ** 1, ' KB'), (1024 ** 0, (' byte', ' bytes')), ] def pretty_size(bytes, units=UNITS_MAPPING): """Human-readable file sizes. ripped from https://pypi.python.org/pypi/hurry.filesize/ """ for factor, suffix in units: if bytes >= factor: break amount = int(bytes / factor) if isinstance(suffix, tuple): singular, multiple = suffix if amount == 1: suffix = singular else: suffix = multiple return str(amount) + suffix if __name__ == "__main__": parser = argparse.ArgumentParser(description='''DESCRIPTION: Generate directory index files (recursive is OFF by default). Start from current dir or from folder passed as first positional argument. Optionally filter by file types with --filter "*.py". ''') parser.add_argument('top_dir', nargs='?', action='store', help='top folder from which to start generating indexes, ' 'use current folder if not specified', default=os.getcwd()) parser.add_argument('--filter', '-f', help='only include files matching glob', required=False) parser.add_argument('--recursive', '-r', action='store_true', help="recursively process nested dirs (FALSE by default)", required=False) parser.add_argument('--verbose', '-v', action='store_true', help='***WARNING: this can take a very long time with complex file tree structures***' ' verbosely list every processed file', required=False) config = parser.parse_args(sys.argv[1:]) process_dir(config.top_dir, config)
67ecd1716036514223b44bda3eada5013e806d32
1fcf52f71e4b08b9f6973dcb0a7acf1fe41b9c5f
/setup.py
fc0025b4f83392ce591bf27cf3013ce54c98453b
[]
no_license
svetlyak40wt/colorize
0a2c65059d4832b88ffbe62864328810f47f0750
1e1fd8eff1d2c820105d0655a8df36efac12600a
refs/heads/master
2020-05-20T08:14:22.598684
2014-01-16T12:57:29
2014-01-16T12:57:29
1,140,039
0
1
null
2014-01-16T12:57:29
2010-12-05T09:34:27
Python
UTF-8
Python
false
false
812
py
from setuptools import setup, find_packages setup( name = 'colorizer', version = '0.1.7', description = 'Console colorizer, which acts like grep but paint each match in it\'s own color.', author = 'Alexander Artemenko', author_email = '[email protected]', url = 'http://github.com/svetlyak40wt/colorizer/', license = 'New BSD License', install_requires = ['termcolor'], classifiers = [ 'Environment :: Console', 'Operating System :: POSIX', 'Operating System :: MacOS :: MacOS X', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', ], packages = find_packages(), entry_points = """ [console_scripts] colorize = colorizer:main """, )
a1c1382419540480fb893cf3aba8e6f46c76eddc
f8cff1f2c00f000aba61cdf728d8a2b254647f09
/OpenSpider-master/concurrents/manager.py
b1c32985d3a928292464adbd637ee346c6da18c8
[]
no_license
vieyahn2017/crawlers
76097ec9ca71edd128addf341ae02ef26ef383dc
fa584094b026cbf0451e78303c56f614fa5fedde
refs/heads/master
2021-09-12T21:23:33.265856
2018-04-21T03:06:50
2018-04-21T03:06:50
102,854,533
0
0
null
null
null
null
UTF-8
Python
false
false
363
py
__author__ = 'zhangxa' ''' A concurrentManager should apply a class func who has a run method. ''' class ConcurrentManger: def __init__(self,concurrents,runner,*args,**kwargs): self._concurrents = concurrents self._runner = runner self._args = args self._kwargs = kwargs def run(self): raise NotImplementedError
8b4c344db6561557d19ae3f883fde6d05ab179a4
d2c80cd70f3220165c7add7ed9a103c0ed1ab871
/python/9th_session/13dict_popitem+values.py
8dc5f6d5d6e7468e614605c26b7fad83cfdeaefa
[]
no_license
nervaishere/DashTeam
2a786af8a871200d7facfa3701a07f97230b706e
a57b34a601f74b06a7be59f2bfe503cbd2a6c15f
refs/heads/master
2023-08-24T12:24:18.081164
2021-10-09T21:10:54
2021-10-09T21:10:54
393,689,874
0
0
null
null
null
null
UTF-8
Python
false
false
116
py
car = { "brand" : "Ford", "model" : "Mustang", "year" : 1964 } car.popitem() print(car) x = car.values() print(x)
6eac61a01f8b8fcef649ff9f214998ce0fa0545d
91d1a6968b90d9d461e9a2ece12b465486e3ccc2
/connect_write_f/contact-recording_resume.py
934dbeb6b552f992ed8bf1aedd0a3c53fb46b289
[]
no_license
lxtxl/aws_cli
c31fc994c9a4296d6bac851e680d5adbf7e93481
aaf35df1b7509abf5601d3f09ff1fece482facda
refs/heads/master
2023-02-06T09:00:33.088379
2020-12-27T13:38:45
2020-12-27T13:38:45
318,686,394
0
0
null
null
null
null
UTF-8
Python
false
false
793
py
#!/usr/bin/python # -*- codding: utf-8 -*- import os import sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from common.execute_command import write_parameter # url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html if __name__ == '__main__': """ start-contact-recording : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/connect/start-contact-recording.html stop-contact-recording : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/connect/stop-contact-recording.html suspend-contact-recording : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/connect/suspend-contact-recording.html """ write_parameter("connect", "resume-contact-recording")
5e92613605ba6c825cd80bd28a7df6b88eb61d85
e27333261b8e579564016c71d2061cc33972a8b8
/development_codes/Backend/.history/PairwiseLTR_20210811104234.py
2e691d294d6f1595f1741245b7760b35bf29cf1e
[]
no_license
Dustyik/NewsTweet_InformationRetrieval
882e63dd20bc9101cbf48afa6c3302febf1989b1
d9a6d92b51c288f5bcd21ea1cc54772910fa58f7
refs/heads/master
2023-07-01T09:12:53.215563
2021-08-12T08:28:33
2021-08-12T08:28:33
382,780,359
0
0
null
null
null
null
UTF-8
Python
false
false
10,089
py
import pandas as pd import torchtext import torch import random from torchtext.data.utils import get_tokenizer from collections import Counter from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader from torch import nn from gensim.models import KeyedVectors import gensim.downloader as api from IPython.display import display from tfidfImplementation import CosineSimilarity K = 100 class Ranking_model(nn.Module): def __init__(self, vocab): super(Ranking_model, self).__init__() self.embedding = nn.Embedding(num_embeddings=len(vocab), embedding_dim=50, padding_idx=vocab.stoi['<pad>']) self.encoder = nn.LSTM(50, 50, batch_first=True) self.nn_layer1 = nn.Linear(in_features=50*2, out_features=1) def forward(self, qry_tokens, pos_doc_tokens, neg_doc_tokens): qry_embedded = self.embedding(qry_tokens) pos_doc_embedded = self.embedding(pos_doc_tokens) neg_doc_embedded = self.embedding(neg_doc_tokens) out_qry = torch.mean(self.encoder(qry_embedded)[0],1) out_pos = torch.mean(self.encoder(pos_doc_embedded)[0],1) out_neg = torch.mean(self.encoder(neg_doc_embedded)[0],1) concat_q_pos_doc = torch.cat((out_qry, out_pos),1) concat_q_neg_doc = torch.cat((out_qry, out_neg),1) pos_score = torch.relu(self.nn_layer1(concat_q_pos_doc)) neg_score = torch.relu(self.nn_layer1(concat_q_neg_doc)) diff = pos_score - neg_score return diff class PairwiseLTR: def __init__(self, tweets_data, titles_data, max_doc_len=50, max_query_len=50, batch_size=128, method="trim"): self.data = tweets_data self.data = self.data.replace({"relevance_score":2}, 1) self.titles = titles_data self.articles_id = list(self.data.article_id.unique()) self.get_pos_neg(method) self.cosineSimilarity = CosineSimilarity(tweets_data) self.init_model_parameters(max_doc_len, max_query_len) #cretes a train_test_split for the article titles self.batch_size = batch_size self.train_dataloader = DataLoader(self.train_dataset, batch_size=self.batch_size, shuffle=True, collate_fn=self.collate_batch) self.valid_dataloader = DataLoader(self.valid_dataset, batch_size=self.batch_size, shuffle=False, collate_fn=self.collate_batch) try: self.model = torch.load("PairwiseLTRModel.pt") self.model.eval() except: self.model = Ranking_model(self.vocab) self.model.to(self.device) self.init_glove() self.train() def return_test_articles(self): return_df = pd.DataFrame() for article_id in self.train_articles: return_df = return_df.append(self.titles.loc[(self.titles['id'] == article_id)]) return return_df def get_pos_neg(self, method): self.pos_ = {} self.neg_ = {} self.articles_id = list(self.data.article_id.unique()) to_remove = [] for i in self.articles_id: temp = self.data[self.data["article_id"]==i] temp["relevance_score"].sum() num_pos = temp["relevance_score"].sum() num_neg = temp.shape[0] - num_pos if method=="trim": num_keep = min(num_pos, num_neg) pos_list = list(temp[temp["relevance_score"]==1].clean_text[:num_keep]) neg_list = list(temp[temp["relevance_score"]==0].clean_text[:num_keep]) elif method=="pad": pos_list = list(temp[temp["relevance_score"]==1].clean_text) neg_list = list(temp[temp["relevance_score"]==0].clean_text) if num_pos==0 or num_neg==0: to_remove.append(i) continue if num_pos<num_neg: for j in range(num_neg-num_pos): pos_list.append(pos_list[-1]) elif num_neg<num_pos: for j in range(num_pos-num_neg): neg_list.append(neg_list[-1]) self.pos_[i] = pos_list self.neg_[i] = neg_list for i in to_remove: self.articles_id.remove(i) def init_model_parameters(self, max_doc_len, max_query_len): self.device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') self.tokenizer = get_tokenizer("basic_english") self.train_articles, self.test_articles = train_test_split(self.articles_id, test_size=1.5/10, random_state=179) dataset = [] for i in self.train_articles: for j in range(len(self.pos_[i])): dataset.append([self.titles[self.titles["id"]==i].title.to_list()[0], self.pos_[i][j], self.neg_[i][j]]) self.train_dataset, self.valid_dataset = train_test_split(dataset, test_size=1/9, random_state=179) self.counter = Counter() for (qry, pos, neg) in self.train_dataset: self.counter.update(self.tokenizer(pos)) self.counter.update(self.tokenizer(neg)) self.vocab = torchtext.vocab.Vocab(self.counter, max_size=10000, specials=('<pad>', '<unk>'), specials_first=True) self.text_pipeline = lambda x: [self.vocab[token] for token in self.tokenizer(x)] self.query_padding_pipeline = lambda tokens: [self.vocab.stoi['<pad>'] for p in range(max_query_len - len(tokens))] + tokens[-max_query_len:] self.doc_padding_pipeline = lambda tokens: [self.vocab.stoi['<pad>'] for p in range(max_doc_len - len(tokens))] + tokens[:max_doc_len] def collate_batch(self, batch): query_list, pos_doc_list, neg_doc_list = [], [], [] for (qry, pos, neg) in batch: qry_ = self.query_padding_pipeline(self.text_pipeline(qry)) pos_ = self.doc_padding_pipeline(self.text_pipeline(pos)) neg_ = self.doc_padding_pipeline(self.text_pipeline(neg)) query_list += [qry_] pos_doc_list += [pos_] neg_doc_list += [neg_] temp = list(zip(query_list, pos_doc_list, neg_doc_list)) random.shuffle(temp) query_list, pos_doc_list, neg_doc_list = zip(*temp) query_list = torch.tensor(query_list, dtype=torch.int64) pos_doc_list = torch.tensor(pos_doc_list, dtype=torch.int64) neg_doc_list = torch.tensor(neg_doc_list, dtype=torch.int64) return query_list.to(self.device), pos_doc_list.to(self.device), neg_doc_list.to(self.device) def init_glove(self): try: print("Loading saved word vectors...") glove_50dim = KeyedVectors.load("./glove_50dim.w2v") except: print("Downloading word vectors...") glove_50dim = api.load("glove-wiki-gigaword-50") glove_50dim.save('glove_50dim.w2v') print("Number of word vectors:", glove_50dim.vectors.shape) #Initialise model embedding with glove for word in self.vocab.stoi.keys(): if word in glove_50dim.key_to_index.keys(): word_vec = glove_50dim[word] self.model.embedding.weight.data[self.vocab.stoi[word]] = torch.tensor(word_vec)\ def train(self, num_epochs=10): optimizer=torch.optim.AdamW(self.model.parameters(), lr=1e-5) for epoch in range(num_epochs): print("-->Epoch:{}".format(epoch)) epoch_train_loss = 0.0 self.model.train() for idx, (qry_tokens, pos_doc_tokens, neg_doc_tokens) in enumerate(self.train_dataloader): optimizer.zero_grad() diff = self.model(qry_tokens, pos_doc_tokens, neg_doc_tokens) loss = torch.log(1 + torch.exp(-1*diff)).mean() loss.backward() optimizer.step() epoch_train_loss += loss.cpu().item()*self.batch_size print("Batch {}/{}, avg. train loss is {}".format(idx, len(self.train_dataloader), epoch_train_loss/(idx+1)), end='\r') epoch_val_loss = 0.0 self.model.eval() with torch.no_grad(): #weights should not update for idx, (qry_tokens, pos_doc_tokens, neg_doc_tokens) in enumerate(self.valid_dataloader): diff = self.model(qry_tokens, pos_doc_tokens, neg_doc_tokens) epoch_val_loss += torch.log(1 + torch.exp(-1*diff)).mean() #same loss as in training print("\nval loss:{}".format(epoch_val_loss)) torch.save(self.model, "PairwiseLTRModel.pt") def tfidf_retrieve_K_tweets(self, article_id, article_title): topKResults = self.cosineSimilarity.query(query_id=article_id, query_text=article_title)[:K] return topKResults def rank_docs(self, article_id, qry): article_title = qry topKResults = self.tfidf_retrieve_K_tweets(article_id, article_title) doc_list = topKResults.tweet.tolist() scores = [] for doc in doc_list: self.model.eval() with torch.no_grad(): qry_ = torch.tensor([self.query_padding_pipeline(self.text_pipeline(qry))], dtype=torch.int64).to(self.device) doc_ = torch.tensor([self.doc_padding_pipeline(self.text_pipeline(doc))], dtype=torch.int64).to(self.device) score = self.model(qry_, doc_, doc_*0) scores.append((doc, score.detach().item())) scores = sorted(scores, key = lambda x: x[1]) results = pd.DataFrame(columns=['article_id', 'tweet_id', 'relevance_score', 'tweet', 'clean_text']) for doc, score in scores: doc_filt = self.data[self.data["tweet"]==doc] if doc not in results["tweet"].to_list(): try: results = results.append(doc_filt.iloc[0]) except: pass return results
2d770c24fe0c6044d3dc2542a21f7bcb180d892e
842e3cd1266d18752a3baf2b90232ed4ce41eb4f
/grako/test/grammar/semantics_test.py
9d520aaa87c70fb7d87067f9de6cfda85bd29469
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
apalala/grako
2786d85eef9799bf614c46c92f19ff183a435d46
efb373d89e6805930e661758c2cff2b26da4658a
refs/heads/master
2020-12-25T17:37:05.353167
2017-05-02T02:53:11
2017-05-02T02:53:11
65,163,853
16
6
null
null
null
null
UTF-8
Python
false
false
1,120
py
# -*- coding: utf-8 -*- # Copyright (C) 2017 by Juancarlo Añez # Copyright (C) 2012-2016 by Juancarlo Añez and Thomas Bragg from __future__ import absolute_import, division, print_function, unicode_literals import unittest from grako.tool import compile from grako.semantics import ModelBuilderSemantics class SemanticsTests(unittest.TestCase): def test_builder_semantics(self): grammar = ''' start::sum = {number}+ $ ; number::int = /\d+/ ; ''' text = '5 4 3 2 1' semantics = ModelBuilderSemantics() model = compile(grammar, 'test') ast = model.parse(text, semantics=semantics) self.assertEqual(15, ast) import functools dotted = functools.partial(type('').join, '.') dotted.__name__ = 'dotted' grammar = ''' start::dotted = {number}+ $ ; number = /\d+/ ; ''' semantics = ModelBuilderSemantics(types=[dotted]) model = compile(grammar, 'test') ast = model.parse(text, semantics=semantics) self.assertEqual('5.4.3.2.1', ast)
b81db8a245a81834aad2e44681142b1dee1f761d
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
/eXe/rev2735-2877/base-trunk-2735/exe/engine/mathidevice.py
d7c9a57ae1108ccbb969998567d54ab61700910a
[]
no_license
joliebig/featurehouse_fstmerge_examples
af1b963537839d13e834f829cf51f8ad5e6ffe76
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
refs/heads/master
2016-09-05T10:24:50.974902
2013-03-28T16:28:47
2013-03-28T16:28:47
9,080,611
3
2
null
null
null
null
UTF-8
Python
false
false
1,261
py
""" MathIdevice: just has a block of text """ import logging from exe.engine.idevice import Idevice from exe.engine.field import MathField log = logging.getLogger(__name__) class MathIdevice(Idevice): """ MathIdevice: just has a block of text """ def __init__(self, instruc="", latex=""): Idevice.__init__(self, x_(u"Maths"), x_(u"University of Auckland"), x_("""The mathematical language LATEX has been used to enable your to insert mathematical formula into your content. It does this by translating LATEX into an image which is then displayed within your eXe content. We would recommend that you use the Free Text iDevice to provide explanatory notes and learning instruction around this graphic."""), "", "") self.emphasis = Idevice.NoEmphasis self.content = MathField(x_(u"Maths"), x_(u"""You can use the toolbar or enter latex manually into the textarea. """)) self.content.idevice = self
4f66d4ae6728ef58845bb197375e2267313d0135
275a96a33ae1f89e7b2ee0ecdbac7d78abe6d6cc
/test/test_ad_view.py
ea1ebb582cd5d6c22cdaaacd01a964bee35afdb7
[]
no_license
cascadiarc/cyclos-python-client
8029ce07174f2fe92350a92dda9a60976b2bb6c2
a2e22a30e22944587293d51be2b8268bce808d70
refs/heads/main
2023-04-03T16:52:01.618444
2021-04-04T00:00:52
2021-04-04T00:00:52
354,419,532
0
0
null
null
null
null
UTF-8
Python
false
false
805
py
# coding: utf-8 """ Cyclos 4.11.5 API The REST API for Cyclos 4.11.5 # noqa: E501 OpenAPI spec version: 4.11.5 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.models.ad_view import AdView # noqa: E501 from swagger_client.rest import ApiException class TestAdView(unittest.TestCase): """AdView unit test stubs""" def setUp(self): pass def tearDown(self): pass def testAdView(self): """Test AdView""" # FIXME: construct object with mandatory attributes with example values # model = swagger_client.models.ad_view.AdView() # noqa: E501 pass if __name__ == '__main__': unittest.main()
42d4548e0211060ef8143593198856e9ef130dfd
578db86c51d44ebddd0dc7b1738985b3dc69eb74
/corehq/apps/api/resources/serializers.py
f57a8fc1b707903d74990c7085001cd6ca31691d
[ "BSD-3-Clause" ]
permissive
dimagi/commcare-hq
a43c7dd32b5f89c89fd5aa1b1359ab7301f4ff6b
e7391ddae1af1dbf118211ecb52c83fc508aa656
refs/heads/master
2023-08-16T22:38:27.853437
2023-08-16T19:07:19
2023-08-16T19:07:19
247,278
499
203
BSD-3-Clause
2023-09-14T19:03:24
2009-07-09T17:00:07
Python
UTF-8
Python
false
false
489
py
import json from tastypie.serializers import Serializer class ListToSingleObjectSerializer(Serializer): """ Serializer class that takes a list of one object and removes the other metadata around the list view so that just the object is returned. See IdentityResource for an example. """ def to_json(self, data, options=None): # note: this is not valid if there is ever not exactly one object returned return json.dumps(data['objects'][0].data)
350ac6d5f55c221b5552b1ff7e6b0a3063604641
6eb318399cea68bc998fc635d7d519e187a24f15
/leetcode/39_combination_sum/39_combination_sum.py
3efee07c21fc16d136b49c82665b494a4d2096d8
[ "Apache-2.0" ]
permissive
ryangillard/misc
e8eb4813a54bc59babc263087f2d71bdc6af6b7a
d1f9919400636e6b988fa933493b94829a73331e
refs/heads/master
2021-11-24T17:26:52.740997
2021-11-16T06:27:42
2021-11-16T06:27:42
192,038,898
0
0
null
null
null
null
UTF-8
Python
false
false
658
py
class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ paths = [] self.recursive(candidates, target, 0, [], paths) return paths def recursive(self, candidates, target, start_index, path, paths): if target == 0: paths.append(path) return None for i in range(start_index, len(candidates)): if candidates[i] <= target: self.recursive(candidates, target - candidates[i], i, path + [candidates[i]], paths) return None
8602f6a64d2286cd253d640ee4063c095b9f289a
ca507259c36a4299666f4c064f25832f5c3f45c1
/symbol_openapi_client/models/transaction_status_dto.py
f51ff88a06df1f8858bcf03ab41ae5ee63116815
[]
no_license
fullcircle23/symbol-openapi-python-client
ae38a2537d1f2eebca115733119c444b79ec4962
3728d30eb1b5085a5a5e991402d180fac8ead68b
refs/heads/master
2022-04-15T06:20:47.821281
2020-04-16T02:39:14
2020-04-16T02:39:14
254,701,919
0
0
null
null
null
null
UTF-8
Python
false
false
7,790
py
# coding: utf-8 """ **************************************************************************** Copyright (c) 2016-present, Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. This file is part of Catapult. Catapult is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Catapult is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Catapult. If not, see <http://www.gnu.org/licenses/>. **************************************************************************** Catapult REST Endpoints OpenAPI Specification of catapult-rest 1.0.20.22 # noqa: E501 The version of the OpenAPI document: 0.8.9 Contact: [email protected] NOTE: This file is auto generated by Symbol OpenAPI Generator: https://github.com/nemtech/symbol-openapi-generator Do not edit this file manually. """ import pprint import re # noqa: F401 import six from symbol_openapi_client.configuration import Configuration class TransactionStatusDTO(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = { 'group': 'TransactionStateTypeEnum', 'code': 'TransactionStatusTypeEnum', 'hash': 'str', 'deadline': 'int', 'height': 'int' } attribute_map = { 'group': 'group', 'code': 'code', 'hash': 'hash', 'deadline': 'deadline', 'height': 'height' } def __init__(self, group=None, code=None, hash=None, deadline=None, height=None, local_vars_configuration=None): # noqa: E501 """TransactionStatusDTO - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._group = None self._code = None self._hash = None self._deadline = None self._height = None self.discriminator = None self.group = group if code is not None: self.code = code self.hash = hash self.deadline = deadline if height is not None: self.height = height @property def group(self): """Gets the group of this TransactionStatusDTO. # noqa: E501 :return: The group of this TransactionStatusDTO. # noqa: E501 :rtype: TransactionStateTypeEnum """ return self._group @group.setter def group(self, group): """Sets the group of this TransactionStatusDTO. :param group: The group of this TransactionStatusDTO. # noqa: E501 :type: TransactionStateTypeEnum """ if self.local_vars_configuration.client_side_validation and group is None: # noqa: E501 raise ValueError("Invalid value for `group`, must not be `None`") # noqa: E501 self._group = group @property def code(self): """Gets the code of this TransactionStatusDTO. # noqa: E501 :return: The code of this TransactionStatusDTO. # noqa: E501 :rtype: TransactionStatusTypeEnum """ return self._code @code.setter def code(self, code): """Sets the code of this TransactionStatusDTO. :param code: The code of this TransactionStatusDTO. # noqa: E501 :type: TransactionStatusTypeEnum """ self._code = code @property def hash(self): """Gets the hash of this TransactionStatusDTO. # noqa: E501 :return: The hash of this TransactionStatusDTO. # noqa: E501 :rtype: str """ return self._hash @hash.setter def hash(self, hash): """Sets the hash of this TransactionStatusDTO. :param hash: The hash of this TransactionStatusDTO. # noqa: E501 :type: str """ if self.local_vars_configuration.client_side_validation and hash is None: # noqa: E501 raise ValueError("Invalid value for `hash`, must not be `None`") # noqa: E501 self._hash = hash @property def deadline(self): """Gets the deadline of this TransactionStatusDTO. # noqa: E501 Duration expressed in number of blocks. # noqa: E501 :return: The deadline of this TransactionStatusDTO. # noqa: E501 :rtype: int """ return self._deadline @deadline.setter def deadline(self, deadline): """Sets the deadline of this TransactionStatusDTO. Duration expressed in number of blocks. # noqa: E501 :param deadline: The deadline of this TransactionStatusDTO. # noqa: E501 :type: int """ if self.local_vars_configuration.client_side_validation and deadline is None: # noqa: E501 raise ValueError("Invalid value for `deadline`, must not be `None`") # noqa: E501 self._deadline = deadline @property def height(self): """Gets the height of this TransactionStatusDTO. # noqa: E501 Height of the blockchain. # noqa: E501 :return: The height of this TransactionStatusDTO. # noqa: E501 :rtype: int """ return self._height @height.setter def height(self, height): """Sets the height of this TransactionStatusDTO. Height of the blockchain. # noqa: E501 :param height: The height of this TransactionStatusDTO. # noqa: E501 :type: int """ self._height = height def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, TransactionStatusDTO): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, TransactionStatusDTO): return True return self.to_dict() != other.to_dict()
86afd01855c9b1316420a1200b906414ffe65f9a
f4b60f5e49baf60976987946c20a8ebca4880602
/lib64/python2.7/site-packages/acimodel-1.3_2j-py2.7.egg/cobra/modelimpl/sts/rtfabinextinatt.py
7f424a661e3a25b233005511ac9a1699fa0c1b58
[]
no_license
cqbomb/qytang_aci
12e508d54d9f774b537c33563762e694783d6ba8
a7fab9d6cda7fadcc995672e55c0ef7e7187696e
refs/heads/master
2022-12-21T13:30:05.240231
2018-12-04T01:46:53
2018-12-04T01:46:53
159,911,666
0
0
null
2022-12-07T23:53:02
2018-12-01T05:17:50
Python
UTF-8
Python
false
false
4,416
py
# coding=UTF-8 # ********************************************************************** # Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved # written by zen warriors, do not modify! # ********************************************************************** from cobra.mit.meta import ClassMeta from cobra.mit.meta import StatsClassMeta from cobra.mit.meta import CounterMeta from cobra.mit.meta import PropMeta from cobra.mit.meta import Category from cobra.mit.meta import SourceRelationMeta from cobra.mit.meta import NamedSourceRelationMeta from cobra.mit.meta import TargetRelationMeta from cobra.mit.meta import DeploymentPathMeta, DeploymentCategory from cobra.model.category import MoCategory, PropCategory, CounterCategory from cobra.mit.mo import Mo # ################################################## class RtFabInExtInAtt(Mo): """ """ meta = TargetRelationMeta("cobra.model.sts.RtFabInExtInAtt", "cobra.model.sts.AFabIn") meta.moClassName = "stsRtFabInExtInAtt" meta.rnFormat = "rtfabInExtInAtt" meta.category = MoCategory.RELATIONSHIP_FROM_LOCAL meta.label = "Fabric Input" meta.writeAccessMask = 0x1 meta.readAccessMask = 0x1 meta.isDomainable = False meta.isReadOnly = True meta.isConfigurable = False meta.isDeletable = False meta.isContextRoot = False meta.parentClasses.add("cobra.model.sts.ExtIn") meta.superClasses.add("cobra.model.reln.From") meta.superClasses.add("cobra.model.reln.Inst") meta.rnPrefixes = [ ('rtfabInExtInAtt', False), ] prop = PropMeta("str", "childAction", "childAction", 4, PropCategory.CHILD_ACTION) prop.label = "None" prop.isImplicit = True prop.isAdmin = True prop._addConstant("deleteAll", "deleteall", 16384) prop._addConstant("deleteNonPresent", "deletenonpresent", 8192) prop._addConstant("ignore", "ignore", 4096) meta.props.add("childAction", prop) prop = PropMeta("str", "dn", "dn", 1, PropCategory.DN) prop.label = "None" prop.isDn = True prop.isImplicit = True prop.isAdmin = True prop.isCreateOnly = True meta.props.add("dn", prop) prop = PropMeta("str", "lcOwn", "lcOwn", 9, PropCategory.REGULAR) prop.label = "None" prop.isImplicit = True prop.isAdmin = True prop.defaultValue = 0 prop.defaultValueStr = "local" prop._addConstant("implicit", "implicit", 4) prop._addConstant("local", "local", 0) prop._addConstant("policy", "policy", 1) prop._addConstant("replica", "replica", 2) prop._addConstant("resolveOnBehalf", "resolvedonbehalf", 3) meta.props.add("lcOwn", prop) prop = PropMeta("str", "modTs", "modTs", 7, PropCategory.REGULAR) prop.label = "None" prop.isImplicit = True prop.isAdmin = True prop.defaultValue = 0 prop.defaultValueStr = "never" prop._addConstant("never", "never", 0) meta.props.add("modTs", prop) prop = PropMeta("str", "rn", "rn", 2, PropCategory.RN) prop.label = "None" prop.isRn = True prop.isImplicit = True prop.isAdmin = True prop.isCreateOnly = True meta.props.add("rn", prop) prop = PropMeta("str", "status", "status", 3, PropCategory.STATUS) prop.label = "None" prop.isImplicit = True prop.isAdmin = True prop._addConstant("created", "created", 2) prop._addConstant("deleted", "deleted", 8) prop._addConstant("modified", "modified", 4) meta.props.add("status", prop) prop = PropMeta("str", "tCl", "tCl", 12584, PropCategory.REGULAR) prop.label = "Target-class" prop.isImplicit = True prop.isAdmin = True prop.defaultValue = 2276 prop.defaultValueStr = "stsAFabIn" prop._addConstant("stsAFabIn", None, 2276) prop._addConstant("stsFabIn", None, 2279) prop._addConstant("stsFabInDef", None, 2280) prop._addConstant("stsFabInRevDef", None, 2285) prop._addConstant("unspecified", "unspecified", 0) meta.props.add("tCl", prop) prop = PropMeta("str", "tDn", "tDn", 100, PropCategory.REGULAR) prop.label = "Target-dn" prop.isImplicit = True prop.isAdmin = True meta.props.add("tDn", prop) def __init__(self, parentMoOrDn, markDirty=True, **creationProps): namingVals = [] Mo.__init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps) # End of package file # ##################################################
1621cd025aba6ae82b0151c94d67dbcc0918af22
32cb0be487895629ad1184ea25e0076a43abba0a
/LifePictorial/top/api/rest/FenxiaoGradesGetRequest.py
b11baf371f16e5abe3b7f6e328da2e7a1297435a
[]
no_license
poorevil/LifePictorial
6814e447ec93ee6c4d5b0f1737335601899a6a56
b3cac4aa7bb5166608f4c56e5564b33249f5abef
refs/heads/master
2021-01-25T08:48:21.918663
2014-03-19T08:55:47
2014-03-19T08:55:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
289
py
''' Created by auto_sdk on 2014-02-10 16:59:30 ''' from top.api.base import RestApi class FenxiaoGradesGetRequest(RestApi): def __init__(self,domain='gw.api.taobao.com',port=80): RestApi.__init__(self,domain, port) def getapiname(self): return 'taobao.fenxiao.grades.get'
ddd78fe9da9398ec8fd58bfc448d03b175f789e7
c1261b9181d86c418df612dc809af933cfbb2c0d
/blog1/models.py
72e8cea72ffc9af34805e080119fd81054f69afd
[]
no_license
gitlGl/myblog
122a598407d12a7397420ce50f9c1ca68a3107d2
b3d7d1130e81ca625cb9d2b7204e19da6efe7d07
refs/heads/master
2023-09-01T14:06:04.720407
2022-10-22T08:47:02
2022-10-22T08:47:02
198,171,669
0
0
null
null
null
null
UTF-8
Python
false
false
4,075
py
from django.db import models from django.urls import reverse # Create your models here. #hjflghjglkhd # Create your models here. from django.shortcuts import render, get_object_or_404 #from .models import Post from django.db import models from django.contrib.auth.models import User from tinymce.models import HTMLField class Category(models.Model): """ Django 要求模型必须继承 models.Model 类。 Category 只需要一个简单的分类名 name 就可以了。 CharField 指定了分类名 name 的数据类型,CharField 是字符型, CharField 的 max_length 参数指定其最大长度,超过这个长度的分类名就不能被存入数据库。 当然 Django 还为我们提供了多种其它的数据类型,如日期时间类型 DateTimeField、整数类型 IntegerField 等等。 Django 内置的全部类型可查看文档: https://docs.djangoproject.com/en/1.10/ref/models/fields/#field-types """ name = models.CharField(max_length=100) def get_absolute_url(self): #print(self.pk) return reverse('blog1:Category_page', kwargs={'category1': self.pk}) ''' class Tag(models.Model): """ 标签 Tag 也比较简单,和 Category 一样。 再次强调一定要继承 models.Model 类! """ name = models.CharField(max_length=100) ''' class Post(models.Model): """ 文章的数据库表稍微复杂一点,主要是涉及的字段更多。 """ # 文章标题 title = models.CharField(max_length=70) # 文章正文,我们使用了 TextField。 # 存储比较短的字符串可以使用 CharField,但对于文章的正文来说可能会是一大段文本,因此使用 TextField 来存储大段文本。 body = HTMLField() # 这两个列分别表示文章的创建时间和最后一次修改时间,存储时间的字段用 DateTimeField 类型。 created_time = models.DateTimeField() modified_time = models.DateTimeField() # 文章摘要,可以没有文章摘要,但默认情况下 CharField 要求我们必须存入数据,否则就会报错。 # 指定 CharField 的 blank=True 参数值后就可以允许空值了。 excerpt = HTMLField( blank=True) # 这是分类与标签,分类与标签的模型我们已经定义在上面。 # 我们在这里把文章对应的数据库表和分类、标签对应的数据库表关联了起来,但是关联形式稍微有点不同。 # 我们规定一篇文章只能对应一个分类,但是一个分类下可以有多篇文章,所以我们使用的是 ForeignKey,即一对多的关联关系。 # 而对于标签来说,一篇文章可以有多个标签,同一个标签下也可能有多篇文章,所以我们使用 ManyToManyField,表明这是多对多的关联关系。 # 同时我们规定文章可以没有标签,因此为标签 tags 指定了 blank=True。 # 如果你对 ForeignKey、ManyToManyField 不了解,请看教程中的解释,亦可参考官方文档: # https://docs.djangoproject.com/en/1.10/topics/db/models/#relationships category = models.ForeignKey('Category',on_delete=models.CASCADE) #tags = models.ManyToManyField('Tag' ,blank=True) # 文章作者,这里 User 是从 django.contrib.auth.models 导入的。 # django.contrib.auth 是 Django 内置的应用,专门用于处理网站用户的注册、登录等流程,User 是 Django 为我们已经写好的用户模型。 # 这里我们通过 ForeignKey 把文章和 User 关联了起来。 # 因为我们规定一篇文章只能有一个作者,而一个作者可能会写多篇文章,因此这是一对多的关联关系,和 Category 类似。 author = models.ForeignKey(User,on_delete=models.CASCADE) def __str__(self): return self.title # 自定义 get_absolute_url 方法 # 记得从 django.urls 中导入 reverse 函数 def get_absolute_url(self): return reverse('blog1:detail', kwargs={'pk': self.pk}) #Category.get_absolute_url()
099a47f37b2f69649665afc8b56a49ed9d42362d
c2ae65792af1fab2e7843303ef90790819f872e8
/Algorithm/Math/Power-Function.py
f0b6d0d8a9288824dc87f7ac62ccb797cc247d80
[]
no_license
behappyyoung/PythonSampleCodes
47c224ca76ce509a03c8b75ef6b4bf7f49ebdd7f
f7640467273fa8ea3c7e443e798737ca5bcea6f9
refs/heads/master
2023-03-15T00:53:21.034605
2023-02-13T17:12:32
2023-02-13T17:12:32
26,919,763
3
3
null
2023-03-07T12:45:21
2014-11-20T15:57:16
Python
UTF-8
Python
false
false
1,804
py
""" Implement pow(x, n) """ from datetime import datetime def power_function(x, y): if y == 0: return 1 else: for i in range(y): x *= x return x def power_function_s(x, y): if y == 0: return 1 elif int(y % 2) == 0: return power_function_s(x, int(y / 2)) * power_function_s(x, int(y / 2)) else: return x * power_function_s(x, int(y / 2)) * power_function_s(x, int(y / 2)) def power_function_s_s(x, y): if y == 0: return 1 else: temp = power_function_s_s(x, y // 2) if int(y % 2) == 0: return temp * temp else: return x * temp * temp # print(power_function_s(-1, 2)) # print(power_function_s(-1, 3)) # print(power_function_s(-2, 2)) # start_time = datetime.now() # print(str(power_function_s(7100, 4150))[:50]) # end_time = datetime.now() # print(end_time - start_time) # start_time = datetime.now() # print(str(power_function_s_s(7100, 4150))[:50]) # end_time = datetime.now() # print(end_time - start_time) def power_function_f(x, y): print(y) if y == 0: return 1 elif y > 0: temp = power_function_f(x, y // 2) print(y, temp) if int(y % 2) == 0: return temp * temp else: return x * temp * temp else: next_y = -(-y // 2) temp = power_function_f(x, next_y) print(y, next_y, temp) if int(-y % 2) == 0: return 1 / (temp * temp) if temp >1 else (temp * temp) else: return 1/(x * temp * temp) if temp >1 else x* (temp * temp) print(str(power_function_f(2.00000, 2))) print(str(power_function_f(2.00000, -2))) print(str(power_function_f(8.84372, -5)))
5bb0e557dd728812cf61315606915473308c1769
c4a33b613ffc77dccf96d33c3a5cc127405c0e95
/products/models.py
a07d41df737ce764165d547ebee4f370ea33ad54
[]
no_license
tsokac2/new-irish-life
25f49bd0b74dfa7c0a449772249f6cb51925b643
d09934b60a1fd4fbd4540d412dc5dab726f5b502
refs/heads/main
2023-07-02T09:54:55.082587
2021-07-30T04:42:57
2021-07-30T04:42:57
379,245,725
0
0
null
null
null
null
UTF-8
Python
false
false
1,115
py
from django.db import models class Category(models.Model): class Meta: verbose_name_plural = 'Categories' name = models.CharField(max_length=254) friendly_name = models.CharField(max_length=254, null=True, blank=True) def __str__(self): return self.name def get_friendly_name(self): return self.friendly_name class Product(models.Model): category = models.ForeignKey( 'Category', null=True, blank=True, on_delete=models.SET_NULL) sku = models.CharField(max_length=254, null=True, blank=True) name = models.CharField(max_length=254) description = models.TextField() price = models.DecimalField(max_digits=6, decimal_places=2) sale_price = models.DecimalField( max_digits=6, decimal_places=2, null=True, blank=True) rating = models.DecimalField( max_digits=2, decimal_places=1, null=True, blank=True) image_1 = models.ImageField(null=True, blank=True) image_2 = models.ImageField(null=True, blank=True) image_3 = models.ImageField(null=True, blank=True) def __str__(self): return self.name
822b4360a54f56d2fbbdea34fed6eb34287dcaa8
f9ed608c620093b9f6b5058bcedf7ae610c09c8d
/298-Binary_Tree_Longest_Consecutive_Sequence.py
da80a4acedcbf4c90c5005102e1c5612e3ed7da4
[]
no_license
chanyoonzhu/leetcode-python
9b88d7f2749e1ae3ed597759b1bf9f7fa4912c35
085d868ba0458fc8e6b5549aa00fa151c335fa7f
refs/heads/master
2022-05-24T11:20:35.927915
2022-04-16T06:02:33
2022-04-16T06:02:33
166,224,197
0
1
null
null
null
null
UTF-8
Python
false
false
1,998
py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right """ Questions: - validity of number (floats, negative integer and 0) """ """ - top-down solution (pre-order traversal) - O(n): every node is visited once - The time complexity is the same as an in-order traversal of a binary tree with n nodes. - O(n): The extra space comes from implicit stack space due to recursion. For a skewed binary tree, the recursion could go up to nn levels deep. """ class Solution(object): def longestConsecutive(self, root): """ :type root: TreeNode :rtype: int """ return self.dfs(root, -100, 0) # provided that node values are all positive def dfs(self, node, prev_val, _max): if node is None: return _max if node.val != prev_val + 1: return max(_max, self.dfs(node.left, node.val, 1), self.dfs(node.right, node.val, 1)) if node.val == prev_val + 1: return max(self.dfs(node.left, node.val, _max+1), self.dfs(node.right, node.val, _max+1)) """ - bottom-up solution - O(n), O(n) """ class Solution: def longestConsecutive(self, root: Optional[TreeNode]) -> int: self.maximum_length = 0 def helper(root): if not root: return 0 length = 1 # easy to miss: need to call helper even if node doesn't connect downwards l = helper(root.left) r = helper(root.right) if root.left and root.left.val == root.val + 1: length = max(length, 1 + l) if root.right and root.right.val == root.val + 1: length = max(length, 1 + r) self.maximum_length = max(self.maximum_length, length) return length helper(root) return self.maximum_length
c1a76f770a4973d3e1450afc83bc808df1007e5b
b7174170d50b867050c80129dbde239a948f6f85
/tools/sapp/sapp/tests/sharded_files/sharded_files_test.py
1e1903098d02d2e0eba4cf7b97bb287f1d108f76
[ "MIT" ]
permissive
GreyElaina/pyre-check
c1a2b7a6ee050f606322eaa588f9bd95cd1b3dbc
abcb5daa64c38a25aed9ab238bb61290444ab06c
refs/heads/master
2022-12-19T21:35:09.582761
2020-09-12T05:54:32
2020-09-12T05:58:24
295,080,507
0
0
MIT
2020-09-13T04:52:19
2020-09-13T04:52:18
null
UTF-8
Python
false
false
3,086
py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import unittest from ...sharded_files import ShardedFile test_path = "tools/sapp/sapp//tests/sharded_files" class TestShardedFiles(unittest.TestCase): def test_fails_for_no_sharding(self): pattern = os.path.join(test_path, "foo.bar") with self.assertRaisesRegex(ValueError, "Not a sharded file"): ShardedFile(pattern) def test_returns_two_shards_for_star(self): pattern = os.path.join(test_path, "foo@*.bar") sf = ShardedFile(pattern) self.assertEqual( sf.get_filenames(), [ os.path.join(test_path, "[email protected]"), os.path.join(test_path, "[email protected]"), ], ) def test_returns_two_shards_for_two(self): pattern = os.path.join(test_path, "[email protected]") sf = ShardedFile(pattern) self.assertEqual( sf.get_filenames(), [ os.path.join(test_path, "[email protected]"), os.path.join(test_path, "[email protected]"), ], ) def test_returns_two_shards_for_two_ambiguous(self): pattern = os.path.join(test_path, "[email protected]") sf = ShardedFile(pattern) self.assertEqual( sf.get_filenames(), [ os.path.join(test_path, "[email protected]"), os.path.join(test_path, "[email protected]"), ], ) def test_returns_two_shards_for_one_ambiguous(self): pattern = os.path.join(test_path, "[email protected]") sf = ShardedFile(pattern) self.assertEqual( sf.get_filenames(), [os.path.join(test_path, "[email protected]")], ) def test_fails_for_bad_sharding_pattern(self): pattern = os.path.join(test_path, "[email protected]") with self.assertRaisesRegex(ValueError, "Invalid shard specification: baz"): ShardedFile(pattern) def test_fails_for_ambiguous_star_pattern(self): pattern = os.path.join(test_path, "ambiguous@*.ext") with self.assertRaisesRegex( ValueError, "@* matches ambiguous shard sets: @1 and @2" ): ShardedFile(pattern) def test_fails_for_inconsistent_set(self): pattern = os.path.join(test_path, "[email protected]") with self.assertRaisesRegex( ValueError, f"Shard {test_path}/[email protected] does not exist.", ): ShardedFile(pattern) def test_fails_for_inconsistent_set_star(self): pattern = os.path.join(test_path, "inconsistent@*.baz") with self.assertRaisesRegex( ValueError, f"Shard {test_path}/[email protected] does not exist.", ): ShardedFile(pattern)
5cb566dab6aec3a2b049d1b835307cf705e2542d
bae75bf1de75fb1b76e19b0d32c778e566de570a
/smodels-database/13TeV/ATLAS/ATLAS-SUSY-2018-32/validation/TChiWW_2EqMassAx_EqMassBy.py
5ee4f161cc9f5a413fc31f4010ad41cf0b4a88bb
[]
no_license
andlessa/RDM
78ae5cbadda1875c24e1bb726096b05c61627249
ac6b242871894fee492e089d378806c2c2e7aad8
refs/heads/master
2023-08-16T00:47:14.415434
2021-09-21T20:54:25
2021-09-21T20:54:25
228,639,778
0
0
null
null
null
null
UTF-8
Python
false
false
101,810
py
validationData = [{'slhafile': 'TChiWW_100_16_100_16.slha', 'error': 'no results', 'axes': {'x': 100.0, 'y': 16.0}}, {'slhafile': 'TChiWW_100_9_100_9.slha', 'error': 'no results', 'axes': {'x': 100.0, 'y': 9.0}}, {'slhafile': 'TChiWW_101_3_101_3.slha', 'error': 'no results', 'axes': {'x': 101.0, 'y': 3.0}}, {'slhafile': 'TChiWW_101_4_101_4.slha', 'error': 'no results', 'axes': {'x': 101.0, 'y': 4.0}}, {'slhafile': 'TChiWW_103_19_103_19.slha', 'error': 'no results', 'axes': {'x': 103.0, 'y': 19.0}}, {'slhafile': 'TChiWW_103_20_103_20.slha', 'error': 'no results', 'axes': {'x': 103.0, 'y': 20.0}}, {'slhafile': 'TChiWW_104_0_104_0.slha', 'error': 'no results', 'axes': {'x': 104.0, 'y': 0.0}}, {'slhafile': 'TChiWW_104_13_104_13.slha', 'error': 'no results', 'axes': {'x': 104.0, 'y': 13.0}}, {'slhafile': 'TChiWW_104_7_104_7.slha', 'error': 'no results', 'axes': {'x': 104.0, 'y': 7.0}}, {'slhafile': 'TChiWW_107_10_107_10.slha', 'error': 'no results', 'axes': {'x': 107.0, 'y': 10.0}}, {'slhafile': 'TChiWW_107_17_107_17.slha', 'error': 'no results', 'axes': {'x': 107.0, 'y': 17.0}}, {'slhafile': 'TChiWW_107_24_107_24.slha', 'error': 'no results', 'axes': {'x': 107.0, 'y': 24.0}}, {'slhafile': 'TChiWW_107_4_107_4.slha', 'error': 'no results', 'axes': {'x': 107.0, 'y': 4.0}}, {'slhafile': 'TChiWW_109_14_109_14.slha', 'error': 'no results', 'axes': {'x': 109.0, 'y': 14.0}}, {'slhafile': 'TChiWW_110_14_110_14.slha', 'error': 'no results', 'axes': {'x': 110.0, 'y': 14.0}}, {'slhafile': 'TChiWW_110_21_110_21.slha', 'error': 'no results', 'axes': {'x': 110.0, 'y': 21.0}}, {'slhafile': 'TChiWW_110_27_110_27.slha', 'error': 'no results', 'axes': {'x': 110.0, 'y': 27.0}}, {'slhafile': 'TChiWW_110_7_110_7.slha', 'error': 'no results', 'axes': {'x': 110.0, 'y': 7.0}}, {'slhafile': 'TChiWW_111_1_111_1.slha', 'error': 'no results', 'axes': {'x': 111.0, 'y': 1.0}}, {'slhafile': 'TChiWW_112_30_112_30.slha', 'error': 'no results', 'axes': {'x': 112.0, 'y': 30.0}}, {'slhafile': 'TChiWW_113_18_113_18.slha', 'error': 'no results', 'axes': {'x': 113.0, 'y': 18.0}}, {'slhafile': 'TChiWW_113_24_113_24.slha', 'error': 'no results', 'axes': {'x': 113.0, 'y': 24.0}}, {'slhafile': 'TChiWW_113_31_113_31.slha', 'error': 'no results', 'axes': {'x': 113.0, 'y': 31.0}}, {'slhafile': 'TChiWW_114_11_114_11.slha', 'error': 'no results', 'axes': {'x': 114.0, 'y': 11.0}}, {'slhafile': 'TChiWW_114_5_114_5.slha', 'error': 'no results', 'axes': {'x': 114.0, 'y': 5.0}}, {'slhafile': 'TChiWW_115_9_115_9.slha', 'error': 'no results', 'axes': {'x': 115.0, 'y': 9.0}}, {'slhafile': 'TChiWW_116_28_116_28.slha', 'error': 'no results', 'axes': {'x': 116.0, 'y': 28.0}}, {'slhafile': 'TChiWW_116_35_116_35.slha', 'error': 'no results', 'axes': {'x': 116.0, 'y': 35.0}}, {'slhafile': 'TChiWW_117_15_117_15.slha', 'error': 'no results', 'axes': {'x': 117.0, 'y': 15.0}}, {'slhafile': 'TChiWW_117_22_117_22.slha', 'error': 'no results', 'axes': {'x': 117.0, 'y': 22.0}}, {'slhafile': 'TChiWW_117_2_117_2.slha', 'error': 'no results', 'axes': {'x': 117.0, 'y': 2.0}}, {'slhafile': 'TChiWW_117_8_117_8.slha', 'error': 'no results', 'axes': {'x': 117.0, 'y': 8.0}}, {'slhafile': 'TChiWW_118_25_118_25.slha', 'error': 'no results', 'axes': {'x': 118.0, 'y': 25.0}}, {'slhafile': 'TChiWW_119_32_119_32.slha', 'error': 'no results', 'axes': {'x': 119.0, 'y': 32.0}}, {'slhafile': 'TChiWW_119_39_119_39.slha', 'error': 'no results', 'axes': {'x': 119.0, 'y': 39.0}}, {'slhafile': 'TChiWW_120_12_120_12.slha', 'error': 'no results', 'axes': {'x': 120.0, 'y': 12.0}}, {'slhafile': 'TChiWW_120_19_120_19.slha', 'error': 'no results', 'axes': {'x': 120.0, 'y': 19.0}}, {'slhafile': 'TChiWW_120_25_120_25.slha', 'error': 'no results', 'axes': {'x': 120.0, 'y': 25.0}}, {'slhafile': 'TChiWW_120_5_120_5.slha', 'error': 'no results', 'axes': {'x': 120.0, 'y': 5.0}}, {'slhafile': 'TChiWW_121_40_121_40.slha', 'error': 'no results', 'axes': {'x': 121.0, 'y': 40.0}}, {'slhafile': 'TChiWW_121_4_121_4.slha', 'error': 'no results', 'axes': {'x': 121.0, 'y': 4.0}}, {'slhafile': 'TChiWW_122_42_122_42.slha', 'error': 'no results', 'axes': {'x': 122.0, 'y': 42.0}}, {'slhafile': 'TChiWW_123_16_123_16.slha', 'error': 'no results', 'axes': {'x': 123.0, 'y': 16.0}}, {'slhafile': 'TChiWW_123_22_123_22.slha', 'error': 'no results', 'axes': {'x': 123.0, 'y': 22.0}}, {'slhafile': 'TChiWW_123_29_123_29.slha', 'error': 'no results', 'axes': {'x': 123.0, 'y': 29.0}}, {'slhafile': 'TChiWW_123_36_123_36.slha', 'error': 'no results', 'axes': {'x': 123.0, 'y': 36.0}}, {'slhafile': 'TChiWW_124_20_124_20.slha', 'error': 'no results', 'axes': {'x': 124.0, 'y': 20.0}}, {'slhafile': 'TChiWW_124_3_124_3.slha', 'error': 'no results', 'axes': {'x': 124.0, 'y': 3.0}}, {'slhafile': 'TChiWW_124_9_124_9.slha', 'error': 'no results', 'axes': {'x': 124.0, 'y': 9.0}}, {'slhafile': 'TChiWW_126_26_126_26.slha', 'axes': {'x': 126.762409906, 'y': 26.6384369926}, 't': 0.021504439200673783, 'signal': 4991.39, 'UL': 13682.330399999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_126_33_126_33.slha', 'error': 'no results', 'axes': {'x': 126.0, 'y': 33.0}}, {'slhafile': 'TChiWW_126_39_126_39.slha', 'error': 'no results', 'axes': {'x': 126.0, 'y': 39.0}}, {'slhafile': 'TChiWW_127_0_127_0.slha', 'error': 'no results', 'axes': {'x': 127.0, 'y': 0.0}}, {'slhafile': 'TChiWW_127_13_127_13.slha', 'axes': {'x': 127.264056888, 'y': 13.4055103119}, 't': 0.021504439200673783, 'signal': 4892.26, 'UL': 9881.0064, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_127_20_127_20.slha', 'axes': {'x': 127.013233397, 'y': 20.0219736523}, 't': 0.021504439200673783, 'signal': 4892.26, 'UL': 12216.860999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_127_35_127_35.slha', 'error': 'no results', 'axes': {'x': 127.0, 'y': 35.0}}, {'slhafile': 'TChiWW_127_6_127_6.slha', 'axes': {'x': 127.514880379, 'y': 6.78904697156}, 't': 0.021504439200673783, 'signal': 4892.26, 'UL': 7563.064999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_129_30_129_30.slha', 'error': 'no results', 'axes': {'x': 129.0, 'y': 30.0}}, {'slhafile': 'TChiWW_129_36_129_36.slha', 'error': 'no results', 'axes': {'x': 129.0, 'y': 36.0}}, {'slhafile': 'TChiWW_129_43_129_43.slha', 'error': 'no results', 'axes': {'x': 129.0, 'y': 43.0}}, {'slhafile': 'TChiWW_130_10_130_10.slha', 'axes': {'x': 130.672543664, 'y': 10.5233575505}, 't': 0.021504439200673783, 'signal': 4594.88, 'UL': 8269.2101, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_130_15_130_15.slha', 'axes': {'x': 130.352701631, 'y': 15.2208363342}, 't': 0.021504439200673783, 'signal': 4594.88, 'UL': 9948.0922, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_130_17_130_17.slha', 'axes': {'x': 130.421720173, 'y': 17.1398208909}, 't': 0.021504439200673783, 'signal': 4594.88, 'UL': 10605.064699999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_130_23_130_23.slha', 'axes': {'x': 130.170896682, 'y': 23.7562842313}, 't': 0.021504439200673783, 'signal': 4594.88, 'UL': 11746.545200000013, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_130_3_130_3.slha', 'axes': {'x': 130.923367155, 'y': 3.90689421019}, 't': 0.021504439200673783, 'signal': 4594.88, 'UL': 5951.2687000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_132_40_132_40.slha', 'error': 'no results', 'axes': {'x': 132.0, 'y': 40.0}}, {'slhafile': 'TChiWW_132_47_132_47.slha', 'error': 'no results', 'axes': {'x': 132.0, 'y': 47.0}}, {'slhafile': 'TChiWW_133_14_133_14.slha', 'axes': {'x': 133.830206948, 'y': 14.2576681295}, 't': 0.021504439200673783, 'signal': 4297.49, 'UL': 9027.845899999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_133_20_133_20.slha', 'axes': {'x': 133.579383457, 'y': 20.8741314699}, 't': 0.021504439200673783, 'signal': 4297.49, 'UL': 10018.499433333329, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_133_27_133_27.slha', 'axes': {'x': 133.328559966, 'y': 27.4905948102}, 't': 0.021504439200673783, 'signal': 4297.49, 'UL': 10667.230799999983, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_133_30_133_30.slha', 'axes': {'x': 133.187046783, 'y': 30.5616066043}, 't': 0.021504439200673783, 'signal': 4297.49, 'UL': 11205.280799999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_133_34_133_34.slha', 'error': 'no results', 'axes': {'x': 133.0, 'y': 34.0}}, {'slhafile': 'TChiWW_134_1_134_1.slha', 'axes': {'x': 134.331853931, 'y': 1.02474144881}, 't': 0.021504439200673783, 'signal': 4198.36, 'UL': 4339.472399999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_134_7_134_7.slha', 'axes': {'x': 134.081030439, 'y': 7.64120478917}, 't': 0.021504439200673783, 'signal': 4198.36, 'UL': 6657.413800000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_135_44_135_44.slha', 'error': 'no results', 'axes': {'x': 135.0, 'y': 44.0}}, {'slhafile': 'TChiWW_135_51_135_51.slha', 'error': 'no results', 'axes': {'x': 135.0, 'y': 51.0}}, {'slhafile': 'TChiWW_136_10_136_10.slha', 'axes': {'x': 136.263767359, 'y': 10.222549548}, 't': 0.021504439200673783, 'signal': 4000.11, 'UL': 7162.338399999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_136_17_136_17.slha', 'axes': {'x': 136.987870233, 'y': 17.9919787085}, 't': 0.021504439200673783, 'signal': 4000.11, 'UL': 8290.453666666648, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_136_24_136_24.slha', 'axes': {'x': 136.737046742, 'y': 24.6084420489}, 't': 0.021504439200673783, 'signal': 4000.11, 'UL': 8610.46586666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_136_31_136_31.slha', 'axes': {'x': 136.486223251, 'y': 31.2249053892}, 't': 0.021504439200673783, 'signal': 4000.11, 'UL': 9697.129199999985, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_136_37_136_37.slha', 'error': 'no results', 'axes': {'x': 136.0, 'y': 37.0}}, {'slhafile': 'TChiWW_136_45_136_45.slha', 'error': 'no results', 'axes': {'x': 136.0, 'y': 45.0}}, {'slhafile': 'TChiWW_137_11_137_11.slha', 'axes': {'x': 137.238693724, 'y': 11.3755153681}, 't': 0.021504439200673783, 'signal': 3900.98, 'UL': 7416.049600000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_137_4_137_4.slha', 'axes': {'x': 137.489517215, 'y': 4.75905202779}, 't': 0.021504439200673783, 'signal': 3900.98, 'UL': 5080.194999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_138_54_138_54.slha', 'error': 'no results', 'axes': {'x': 138.0, 'y': 54.0}}, {'slhafile': 'TChiWW_138_61_138_61.slha', 'error': 'no results', 'axes': {'x': 138.0, 'y': 61.0}}, {'slhafile': 'TChiWW_139_25_139_25.slha', 'axes': {'x': 139.098112511, 'y': 25.5633198182}, 't': 0.021504439200673783, 'signal': 3702.72, 'UL': 7550.0291999999945, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_139_28_139_28.slha', 'axes': {'x': 139.894710026, 'y': 28.3427526278}, 't': 0.021504439200673783, 'signal': 3702.72, 'UL': 7587.7692000000025, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_139_34_139_34.slha', 'axes': {'x': 139.643886535, 'y': 34.9592159682}, 't': 0.021504439200673783, 'signal': 3702.72, 'UL': 8791.389599999991, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_139_41_139_41.slha', 'error': 'no results', 'axes': {'x': 139.0, 'y': 41.0}}, {'slhafile': 'TChiWW_139_48_139_48.slha', 'error': 'no results', 'axes': {'x': 139.0, 'y': 48.0}}, {'slhafile': 'TChiWW_140_15_140_15.slha', 'axes': {'x': 140.396357008, 'y': 15.1098259471}, 't': 0.021504439200673783, 'signal': 3603.59, 'UL': 6562.407899999984, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_140_1_140_1.slha', 'axes': {'x': 140.898003991, 'y': 1.87689926641}, 't': 0.021504439200673783, 'signal': 3603.59, 'UL': 3468.3986999999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_140_21_140_21.slha', 'axes': {'x': 140.145533517, 'y': 21.7262892875}, 't': 0.021504439200673783, 'signal': 3603.59, 'UL': 6882.420099999986, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_140_8_140_8.slha', 'axes': {'x': 140.6471805, 'y': 8.49336260677}, 't': 0.021504439200673783, 'signal': 3603.59, 'UL': 5804.253299999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_141_40_141_40.slha', 'axes': {'x': 141.932457663, 'y': 40.9040900883}, 't': 0.021504439200673783, 'signal': 3504.47, 'UL': 8605.8108, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_142_38_142_38.slha', 'axes': {'x': 142.80154982, 'y': 38.6935265472}, 't': 0.021504439200673783, 'signal': 3405.3399999999997, 'UL': 7821.287999999991, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_142_45_142_45.slha', 'error': 'no results', 'axes': {'x': 142.0, 'y': 45.0}}, {'slhafile': 'TChiWW_142_51_142_51.slha', 'error': 'no results', 'axes': {'x': 142.0, 'y': 51.0}}, {'slhafile': 'TChiWW_142_58_142_58.slha', 'error': 'no results', 'axes': {'x': 142.0, 'y': 58.0}}, {'slhafile': 'TChiWW_142_5_142_5.slha', 'axes': {'x': 142.174833087, 'y': 5.22426276185}, 't': 0.021504439200673783, 'signal': 3405.3399999999997, 'UL': 4376.584600000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_143_12_143_12.slha', 'axes': {'x': 143.804843784, 'y': 12.2276731858}, 't': 0.021504439200673783, 'signal': 3306.21, 'UL': 4834.362133333319, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_143_18_143_18.slha', 'axes': {'x': 143.554020293, 'y': 18.8441365261}, 't': 0.021504439200673783, 'signal': 3306.21, 'UL': 5105.801933333337, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_143_25_143_25.slha', 'axes': {'x': 143.303196802, 'y': 25.4605998665}, 't': 0.021504439200673783, 'signal': 3306.21, 'UL': 5494.198799999988, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_143_32_143_32.slha', 'axes': {'x': 143.052373311, 'y': 32.0770632068}, 't': 0.021504439200673783, 'signal': 3306.21, 'UL': 6633.457199999989, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_144_56_144_56.slha', 'error': 'no results', 'axes': {'x': 144.0, 'y': 56.0}}, {'slhafile': 'TChiWW_144_5_144_5.slha', 'axes': {'x': 144.055667275, 'y': 5.61120984539}, 't': 0.021504439200673783, 'signal': 3207.08, 'UL': 4174.543800000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_145_20_145_20.slha', 'axes': {'x': 145.009178239, 'y': 20.565033032}, 't': 0.021504439200673783, 'signal': 3107.9500000000003, 'UL': 4473.323333333326, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_145_42_145_42.slha', 'axes': {'x': 145.959213104, 'y': 42.4278371262}, 't': 0.021504439200673783, 'signal': 3107.9500000000003, 'UL': 6851.186399999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_145_49_145_49.slha', 'error': 'no results', 'axes': {'x': 145.0, 'y': 49.0}}, {'slhafile': 'TChiWW_145_55_145_55.slha', 'error': 'no results', 'axes': {'x': 145.0, 'y': 55.0}}, {'slhafile': 'TChiWW_145_62_145_62.slha', 'error': 'no results', 'axes': {'x': 145.0, 'y': 62.0}}, {'slhafile': 'TChiWW_146_15_146_15.slha', 'axes': {'x': 146.962507069, 'y': 15.9619837647}, 't': 0.021504439200673783, 'signal': 3008.82, 'UL': 3380.3969999999854, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_146_22_146_22.slha', 'axes': {'x': 146.711683577, 'y': 22.5784471051}, 't': 0.021504439200673783, 'signal': 3008.82, 'UL': 3700.4092000000082, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_146_29_146_29.slha', 'axes': {'x': 146.460860086, 'y': 29.1949104455}, 't': 0.021504439200673783, 'signal': 3008.82, 'UL': 4524.09719999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_146_35_146_35.slha', 'axes': {'x': 146.210036595, 'y': 35.8113737858}, 't': 0.021504439200673783, 'signal': 3008.82, 'UL': 5711.927999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_147_2_147_2.slha', 'axes': {'x': 147.464154051, 'y': 2.72905708402}, 't': 0.021504439200673783, 'signal': 2909.7, 'UL': 2562.747500000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_147_35_147_35.slha', 'axes': {'x': 147.843523391, 'y': 35.9058033022}, 't': 0.021504439200673783, 'signal': 2909.7, 'UL': 4950.5591999999815, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_147_9_147_9.slha', 'axes': {'x': 147.21333056, 'y': 9.34552042437}, 't': 0.021504439200673783, 'signal': 2909.7, 'UL': 3106.316366666672, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_148_0_148_0.slha', 'error': 'no results', 'axes': {'x': 148.0, 'y': 0.0}}, {'slhafile': 'TChiWW_148_52_148_52.slha', 'error': 'no results', 'axes': {'x': 148.0, 'y': 52.0}}, {'slhafile': 'TChiWW_148_59_148_59.slha', 'error': 'no results', 'axes': {'x': 148.0, 'y': 59.0}}, {'slhafile': 'TChiWW_148_66_148_66.slha', 'error': 'no results', 'axes': {'x': 148.0, 'y': 66.0}}, {'slhafile': 'TChiWW_149_26_149_26.slha', 'axes': {'x': 149.869346862, 'y': 26.3127576841}, 't': 0.021504439200673783, 'signal': 2711.44, 'UL': 2414.73719999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_149_32_149_32.slha', 'axes': {'x': 149.618523371, 'y': 32.9292210244}, 't': 0.021504439200673783, 'signal': 2711.44, 'UL': 3602.5679999999948, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_149_39_149_39.slha', 'axes': {'x': 149.36769988, 'y': 39.5456843648}, 't': 0.021504439200673783, 'signal': 2711.44, 'UL': 4741.8263999999945, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_149_46_149_46.slha', 'axes': {'x': 149.116876389, 'y': 46.1621477052}, 't': 0.021504439200673783, 'signal': 2711.44, 'UL': 5945.4468, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_150_13_150_13.slha', 'axes': {'x': 150.370993844, 'y': 13.0798310034}, 't': 0.021504439200673783, 'signal': 2612.31, 'UL': 1823.0381133333324, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_150_15_150_15.slha', 'axes': {'x': 150.920243968, 'y': 15.5667462458}, 't': 0.021504439200673783, 'signal': 2612.31, 'UL': 1859.555546666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_150_19_150_19.slha', 'axes': {'x': 150.120170353, 'y': 19.6962943437}, 't': 0.021504439200673783, 'signal': 2612.31, 'UL': 2015.0351533333326, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_150_51_150_51.slha', 'error': 'no results', 'axes': {'x': 150.0, 'y': 51.0}}, {'slhafile': 'TChiWW_150_6_150_6.slha', 'axes': {'x': 150.621817335, 'y': 6.463367663}, 't': 0.021504439200673783, 'signal': 2612.31, 'UL': 1636.9417533333324, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_151_63_151_63.slha', 'error': 'no results', 'axes': {'x': 151.0, 'y': 63.0}}, {'slhafile': 'TChiWW_151_69_151_69.slha', 'error': 'no results', 'axes': {'x': 151.0, 'y': 69.0}}, {'slhafile': 'TChiWW_152_36_152_36.slha', 'axes': {'x': 152.776186655, 'y': 36.6635316034}, 't': 0.021504439200673783, 'signal': 2521.92, 'UL': 3474.457599999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_152_43_152_43.slha', 'axes': {'x': 152.525363164, 'y': 43.2799949438}, 't': 0.021504439200673783, 'signal': 2521.92, 'UL': 4573.7668, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_152_49_152_49.slha', 'axes': {'x': 152.274539673, 'y': 49.8964582841}, 't': 0.021504439200673783, 'signal': 2521.92, 'UL': 5654.010799999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_152_56_152_56.slha', 'error': 'no results', 'axes': {'x': 152.0, 'y': 56.0}}, {'slhafile': 'TChiWW_153_10_153_10.slha', 'axes': {'x': 153.77948062, 'y': 10.197678242}, 't': 0.021504439200673783, 'signal': 2476.72, 'UL': 1545.8308266666656, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_153_16_153_16.slha', 'axes': {'x': 153.528657129, 'y': 16.8141415823}, 't': 0.021504439200673783, 'signal': 2476.72, 'UL': 1737.827866666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_153_23_153_23.slha', 'axes': {'x': 153.277833638, 'y': 23.4306049227}, 't': 0.021504439200673783, 'signal': 2476.72, 'UL': 1923.924226666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_153_30_153_30.slha', 'axes': {'x': 153.75458912, 'y': 30.907516516}, 't': 0.021504439200673783, 'signal': 2476.72, 'UL': 2368.0087999999964, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_153_66_153_66.slha', 'error': 'no results', 'axes': {'x': 153.0, 'y': 66.0}}, {'slhafile': 'TChiWW_154_3_154_3.slha', 'axes': {'x': 154.030304111, 'y': 3.58121490162}, 't': 0.021504439200673783, 'signal': 2431.5299999999997, 'UL': 1391.9036833333328, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_154_66_154_66.slha', 'error': 'no results', 'axes': {'x': 154.0, 'y': 66.0}}, {'slhafile': 'TChiWW_154_73_154_73.slha', 'error': 'no results', 'axes': {'x': 154.0, 'y': 73.0}}, {'slhafile': 'TChiWW_155_40_155_40.slha', 'axes': {'x': 155.93384994, 'y': 40.3978421824}, 't': 0.021504439200673783, 'signal': 2386.33, 'UL': 3467.6515999999983, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_155_47_155_47.slha', 'axes': {'x': 155.683026449, 'y': 47.0143055228}, 't': 0.021504439200673783, 'signal': 2386.33, 'UL': 4547.895600000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_155_53_155_53.slha', 'axes': {'x': 155.432202958, 'y': 53.6307688631}, 't': 0.021504439200673783, 'signal': 2386.33, 'UL': 5520.952799999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_155_60_155_60.slha', 'error': 'no results', 'axes': {'x': 155.0, 'y': 60.0}}, {'slhafile': 'TChiWW_156_10_156_10.slha', 'axes': {'x': 156.831309696, 'y': 10.5684594597}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 1379.3737599999988, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_156_13_156_13.slha', 'axes': {'x': 156.937143904, 'y': 13.931988821}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 1460.6205799999987, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_156_20_156_20.slha', 'axes': {'x': 156.686320413, 'y': 20.5484521613}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 1646.7169399999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_156_27_156_27.slha', 'axes': {'x': 156.435496922, 'y': 27.1649155017}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 1841.0082400000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_156_33_156_33.slha', 'axes': {'x': 156.184673431, 'y': 33.781378842}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 2368.342400000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_156_46_156_46.slha', 'axes': {'x': 156.588934272, 'y': 46.2482867862}, 't': 0.021504439200673783, 'signal': 2341.1400000000003, 'UL': 4249.992, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_157_0_157_0.slha', 'error': 'no results', 'axes': {'x': 157.0, 'y': 0.0}}, {'slhafile': 'TChiWW_157_77_157_77.slha', 'error': 'no results', 'axes': {'x': 157.0, 'y': 77.0}}, {'slhafile': 'TChiWW_157_7_157_7.slha', 'axes': {'x': 157.187967395, 'y': 7.3155254806}, 't': 0.021504439200673783, 'signal': 2295.9399999999996, 'UL': 1284.5006049999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_158_50_158_50.slha', 'axes': {'x': 158.840689733, 'y': 50.7486161017}, 't': 0.021504439200673783, 'signal': 2250.75, 'UL': 4516.5406, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_158_57_158_57.slha', 'axes': {'x': 158.589866242, 'y': 57.3650794421}, 't': 0.021504439200673783, 'signal': 2250.75, 'UL': 5377.605200000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_158_63_158_63.slha', 'error': 'no results', 'axes': {'x': 158.0, 'y': 63.0}}, {'slhafile': 'TChiWW_158_70_158_70.slha', 'error': 'no results', 'axes': {'x': 158.0, 'y': 70.0}}, {'slhafile': 'TChiWW_159_24_159_24.slha', 'axes': {'x': 159.843983698, 'y': 24.2827627403}, 't': 0.021504439200673783, 'signal': 2205.55, 'UL': 1564.1475266666646, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_159_25_159_25.slha', 'axes': {'x': 159.665654848, 'y': 25.9092297298}, 't': 0.021504439200673783, 'signal': 2205.55, 'UL': 1612.15976, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_159_30_159_30.slha', 'axes': {'x': 159.593160207, 'y': 30.8992260807}, 't': 0.021504439200673783, 'signal': 2205.55, 'UL': 1749.3144399999992, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_159_37_159_37.slha', 'axes': {'x': 159.342336715, 'y': 37.515689421}, 't': 0.021504439200673783, 'signal': 2205.55, 'UL': 2361.5363999999954, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_159_44_159_44.slha', 'axes': {'x': 159.091513224, 'y': 44.1321527614}, 't': 0.021504439200673783, 'signal': 2205.55, 'UL': 3441.7804, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_159_61_159_61.slha', 'error': 'no results', 'axes': {'x': 159.0, 'y': 61.0}}, {'slhafile': 'TChiWW_160_11_160_11.slha', 'axes': {'x': 160.34563068, 'y': 11.0498360596}, 't': 0.021504439200673783, 'signal': 2160.3500000000004, 'UL': 1183.4132933333324, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_160_17_160_17.slha', 'axes': {'x': 160.094807189, 'y': 17.6662993999}, 't': 0.021504439200673783, 'signal': 2160.3500000000004, 'UL': 1372.150486666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_160_4_160_4.slha', 'axes': {'x': 160.596454171, 'y': 4.43337271922}, 't': 0.021504439200673783, 'signal': 2160.3500000000004, 'UL': 1167.2054566666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_161_54_161_54.slha', 'axes': {'x': 161.998353018, 'y': 54.4829266807}, 't': 0.021504439200673783, 'signal': 2115.16, 'UL': 4373.193, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_161_61_161_61.slha', 'axes': {'x': 161.747529527, 'y': 61.0993900211}, 't': 0.021504439200673783, 'signal': 2115.16, 'UL': 5241.0402, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_161_67_161_67.slha', 'error': 'no results', 'axes': {'x': 161.0, 'y': 67.0}}, {'slhafile': 'TChiWW_161_74_161_74.slha', 'error': 'no results', 'axes': {'x': 161.0, 'y': 74.0}}, {'slhafile': 'TChiWW_162_34_162_34.slha', 'axes': {'x': 162.750823491, 'y': 34.6335366596}, 't': 0.021504439200673783, 'signal': 2069.96, 'UL': 1657.6206399999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_162_41_162_41.slha', 'axes': {'x': 162.5, 'y': 41.25}, 't': 0.021504439200673783, 'signal': 2069.96, 'UL': 2335.6652000000013, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_162_47_162_47.slha', 'axes': {'x': 162.249176509, 'y': 47.8664633404}, 't': 0.021504439200673783, 'signal': 2069.96, 'UL': 3450.764000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_162_5_162_5.slha', 'axes': {'x': 162.742375424, 'y': 5.57017267352}, 't': 0.021504439200673783, 'signal': 2069.96, 'UL': 1096.1505966666662, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_162_76_162_76.slha', 'error': 'no results', 'axes': {'x': 162.0, 'y': 76.0}}, {'slhafile': 'TChiWW_163_14_163_14.slha', 'axes': {'x': 163.503293964, 'y': 14.7841466386}, 't': 0.021504439200673783, 'signal': 2024.7700000000002, 'UL': 1094.9431999999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_163_21_163_21.slha', 'axes': {'x': 163.252470473, 'y': 21.4006099789}, 't': 0.021504439200673783, 'signal': 2024.7700000000002, 'UL': 1281.0395599999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_163_28_163_28.slha', 'axes': {'x': 163.001646982, 'y': 28.0170733193}, 't': 0.021504439200673783, 'signal': 2024.7700000000002, 'UL': 1472.5639999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_163_8_163_8.slha', 'axes': {'x': 163.754117456, 'y': 8.1676832982}, 't': 0.021504439200673783, 'signal': 2024.7700000000002, 'UL': 1059.8489199999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_164_1_164_1.slha', 'axes': {'x': 164.004940947, 'y': 1.55121995785}, 't': 0.021504439200673783, 'signal': 1979.57, 'UL': 1049.9568500000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_164_64_164_64.slha', 'axes': {'x': 164.905192811, 'y': 64.8337006001}, 't': 0.021504439200673783, 'signal': 1979.57, 'UL': 5085.409999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_164_71_164_71.slha', 'error': 'no results', 'axes': {'x': 164.0, 'y': 71.0}}, {'slhafile': 'TChiWW_165_20_165_20.slha', 'axes': {'x': 165.576720576, 'y': 20.9109429437}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 1132.1197533333336, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_165_38_165_38.slha', 'axes': {'x': 165.908486776, 'y': 38.3678472386}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 1574.4526, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_165_44_165_44.slha', 'axes': {'x': 165.657663285, 'y': 44.984310579}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 2325.5836000000045, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_165_51_165_51.slha', 'axes': {'x': 165.406839793, 'y': 51.6007739193}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 3368.780799999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_165_56_165_56.slha', 'axes': {'x': 165.334345152, 'y': 56.5907702702}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 4001.9759999999987, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_165_58_165_58.slha', 'axes': {'x': 165.156016302, 'y': 58.2172372597}, 't': 0.021504439200673783, 'signal': 1934.3799999999999, 'UL': 4217.562800000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_166_11_166_11.slha', 'axes': {'x': 166.91178074, 'y': 11.9019938772}, 't': 0.021504439200673783, 'signal': 1889.18, 'UL': 955.8560016666659, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_166_18_166_18.slha', 'axes': {'x': 166.660957249, 'y': 18.5184572175}, 't': 0.021504439200673783, 'signal': 1889.18, 'UL': 1003.8322733333342, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_166_25_166_25.slha', 'axes': {'x': 166.410133758, 'y': 25.1349205579}, 't': 0.021504439200673783, 'signal': 1889.18, 'UL': 1195.81356, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_166_31_166_31.slha', 'axes': {'x': 166.159310267, 'y': 31.7513838983}, 't': 0.021504439200673783, 'signal': 1889.18, 'UL': 1383.495280000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_167_5_167_5.slha', 'axes': {'x': 167.162604231, 'y': 5.28553053683}, 't': 0.021504439200673783, 'signal': 1843.98, 'UL': 942.5537716666664, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_168_0_168_0.slha', 'error': 'no results', 'axes': {'x': 168.0, 'y': 0.0}}, {'slhafile': 'TChiWW_168_36_168_36.slha', 'axes': {'x': 168.411065728, 'y': 36.2517132138}, 't': 0.021504439200673783, 'signal': 1798.79, 'UL': 1371.8089200000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_168_48_168_48.slha', 'axes': {'x': 168.815326569, 'y': 48.718621158}, 't': 0.021504439200673783, 'signal': 1798.79, 'UL': 2318.7776000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_168_55_168_55.slha', 'axes': {'x': 168.564503078, 'y': 55.3350844983}, 't': 0.021504439200673783, 'signal': 1798.79, 'UL': 3213.150600000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_168_61_168_61.slha', 'axes': {'x': 168.313679587, 'y': 61.9515478387}, 't': 0.021504439200673783, 'signal': 1798.79, 'UL': 4093.2803999999974, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_168_68_168_68.slha', 'error': 'no results', 'axes': {'x': 168.0, 'y': 68.0}}, {'slhafile': 'TChiWW_168_71_168_71.slha', 'error': 'no results', 'axes': {'x': 168.0, 'y': 71.0}}, {'slhafile': 'TChiWW_169_22_169_22.slha', 'axes': {'x': 169.818620533, 'y': 22.2527677965}, 't': 0.021504439200673783, 'signal': 1753.59, 'UL': 921.262859999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_169_28_169_28.slha', 'axes': {'x': 169.567797042, 'y': 28.8692311369}, 't': 0.021504439200673783, 'signal': 1753.59, 'UL': 1106.74484, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_169_35_169_35.slha', 'axes': {'x': 169.316973551, 'y': 35.4856944772}, 't': 0.021504439200673783, 'signal': 1753.59, 'UL': 1297.7021599999985, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_169_42_169_42.slha', 'axes': {'x': 169.06615006, 'y': 42.1021578176}, 't': 0.021504439200673783, 'signal': 1753.59, 'UL': 1482.7588000000007, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_170_15_170_15.slha', 'axes': {'x': 170.069444025, 'y': 15.6363044562}, 't': 0.021504439200673783, 'signal': 1708.3999999999999, 'UL': 848.4529233333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_170_2_170_2.slha', 'axes': {'x': 170.571091007, 'y': 2.40337777545}, 't': 0.021504439200673783, 'signal': 1708.3999999999999, 'UL': 825.2586233333335, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_170_9_170_9.slha', 'axes': {'x': 170.320267516, 'y': 9.01984111581}, 't': 0.021504439200673783, 'signal': 1708.3999999999999, 'UL': 838.560853333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_15_171_15.slha', 'axes': {'x': 171.487786304, 'y': 15.9126561575}, 't': 0.021504439200673783, 'signal': 1663.2, 'UL': 800.8503083333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_51_171_51.slha', 'axes': {'x': 171.24541088, 'y': 51.592483484}, 't': 0.021504439200673783, 'signal': 1663.2, 'UL': 2262.999200000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_52_171_52.slha', 'axes': {'x': 171.972989854, 'y': 52.4529317369}, 't': 0.021504439200673783, 'signal': 1663.2, 'UL': 2221.021000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_59_171_59.slha', 'axes': {'x': 171.722166362, 'y': 59.0693950773}, 't': 0.021504439200673783, 'signal': 1663.2, 'UL': 3088.868200000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_65_171_65.slha', 'axes': {'x': 171.471342871, 'y': 65.6858584177}, 't': 0.021504439200673783, 'signal': 1663.2, 'UL': 3937.6502000000028, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_171_87_171_87.slha', 'error': 'no results', 'axes': {'x': 171.0, 'y': 87.0}}, {'slhafile': 'TChiWW_172_25_172_25.slha', 'axes': {'x': 172.976283818, 'y': 25.9870783755}, 't': 0.021504439200673783, 'signal': 1618.01, 'UL': 829.9943999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_172_32_172_32.slha', 'axes': {'x': 172.725460327, 'y': 32.6035417159}, 't': 0.021504439200673783, 'signal': 1618.01, 'UL': 1020.951720000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_172_39_172_39.slha', 'axes': {'x': 172.474636836, 'y': 39.2200050562}, 't': 0.021504439200673783, 'signal': 1618.01, 'UL': 1206.0083599999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_172_45_172_45.slha', 'axes': {'x': 172.223813345, 'y': 45.8364683966}, 't': 0.021504439200673783, 'signal': 1618.01, 'UL': 1396.96568, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_173_12_173_12.slha', 'axes': {'x': 173.4779308, 'y': 12.7541516948}, 't': 0.021504439200673783, 'signal': 1572.81, 'UL': 731.2043166666672, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_173_19_173_19.slha', 'axes': {'x': 173.227107309, 'y': 19.3706150351}, 't': 0.021504439200673783, 'signal': 1572.81, 'UL': 744.5065466666672, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_173_6_173_6.slha', 'axes': {'x': 173.728754291, 'y': 6.13768835443}, 't': 0.021504439200673783, 'signal': 1572.81, 'UL': 721.2657050000007, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_174_31_174_31.slha', 'axes': {'x': 174.322131456, 'y': 31.2534264277}, 't': 0.021504439200673783, 'signal': 1527.62, 'UL': 892.414799999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_174_62_174_62.slha', 'axes': {'x': 174.879829647, 'y': 62.8037056563}, 't': 0.021504439200673783, 'signal': 1527.62, 'UL': 2933.237999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_174_66_174_66.slha', 'axes': {'x': 174.079756032, 'y': 66.9332537542}, 't': 0.021504439200673783, 'signal': 1527.62, 'UL': 3589.3462000000027, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_175_36_175_36.slha', 'axes': {'x': 175.883123611, 'y': 36.3378522948}, 't': 0.021504439200673783, 'signal': 1482.42, 'UL': 972.5958, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_175_42_175_42.slha', 'axes': {'x': 175.63230012, 'y': 42.9543156352}, 't': 0.021504439200673783, 'signal': 1482.42, 'UL': 1151.7322400000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_175_49_175_49.slha', 'axes': {'x': 175.381476629, 'y': 49.5707789756}, 't': 0.021504439200673783, 'signal': 1482.42, 'UL': 1327.1582400000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_175_56_175_56.slha', 'axes': {'x': 175.130653138, 'y': 56.1872423159}, 't': 0.021504439200673783, 'signal': 1482.42, 'UL': 2084.456000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_176_16_176_16.slha', 'axes': {'x': 176.635594085, 'y': 16.4884622738}, 't': 0.021504439200673783, 'signal': 1459.23, 'UL': 662.2001983333337, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_176_23_176_23.slha', 'axes': {'x': 176.384770594, 'y': 23.1049256141}, 't': 0.021504439200673783, 'signal': 1459.23, 'UL': 667.7186683333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_176_29_176_29.slha', 'axes': {'x': 176.133947102, 'y': 29.7213889545}, 't': 0.021504439200673783, 'signal': 1459.23, 'UL': 797.1698000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_176_82_176_82.slha', 'error': 'no results', 'axes': {'x': 176.0, 'y': 82.0}}, {'slhafile': 'TChiWW_176_9_176_9.slha', 'axes': {'x': 176.886417576, 'y': 9.87199893341}, 't': 0.021504439200673783, 'signal': 1459.23, 'UL': 655.458368333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_177_10_177_10.slha', 'axes': {'x': 177.398852033, 'y': 10.9143693713}, 't': 0.021504439200673783, 'signal': 1436.03, 'UL': 649.8069850000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_177_3_177_3.slha', 'axes': {'x': 177.137241067, 'y': 3.25553559305}, 't': 0.021504439200673783, 'signal': 1436.03, 'UL': 649.9398983333335, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_177_46_177_46.slha', 'axes': {'x': 177.156476609, 'y': 46.5941966978}, 't': 0.021504439200673783, 'signal': 1436.03, 'UL': 1228.8693600000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_178_46_178_46.slha', 'axes': {'x': 178.789963405, 'y': 46.6886262142}, 't': 0.021504439200673783, 'signal': 1412.8400000000001, 'UL': 1202.1892799999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_178_53_178_53.slha', 'axes': {'x': 178.539139914, 'y': 53.3050895545}, 't': 0.021504439200673783, 'signal': 1412.8400000000001, 'UL': 1368.4950600000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_178_59_178_59.slha', 'axes': {'x': 178.288316423, 'y': 59.9215528949}, 't': 0.021504439200673783, 'signal': 1412.8400000000001, 'UL': 1928.825799999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_20_179_20.slha', 'axes': {'x': 179.793257369, 'y': 20.2227728528}, 't': 0.021504439200673783, 'signal': 1389.6399999999999, 'UL': 624.7747199999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_26_179_26.slha', 'axes': {'x': 179.542433878, 'y': 26.8392361931}, 't': 0.021504439200673783, 'signal': 1389.6399999999999, 'UL': 684.14024, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_33_179_33.slha', 'axes': {'x': 179.291610387, 'y': 33.4556995335}, 't': 0.021504439200673783, 'signal': 1389.6399999999999, 'UL': 862.19132, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_40_179_40.slha', 'axes': {'x': 179.040786896, 'y': 40.0721628738}, 't': 0.021504439200673783, 'signal': 1389.6399999999999, 'UL': 1038.7026800000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_61_179_61.slha', 'axes': {'x': 179.990821761, 'y': 61.934966968}, 't': 0.021504439200673783, 'signal': 1389.6399999999999, 'UL': 1850.369400000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_179_97_179_97.slha', 'error': 'no results', 'axes': {'x': 179.0, 'y': 97.0}}, {'slhafile': 'TChiWW_180_0_180_0.slha', 'error': 'no results', 'axes': {'x': 180.0, 'y': 0.0}}, {'slhafile': 'TChiWW_180_13_180_13.slha', 'axes': {'x': 180.04408086, 'y': 13.6063095124}, 't': 0.021504439200673783, 'signal': 1366.4499999999998, 'UL': 619.2562499999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_180_26_180_26.slha', 'axes': {'x': 180.233197185, 'y': 26.2551396415}, 't': 0.021504439200673783, 'signal': 1366.4499999999998, 'UL': 663.4173200000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_180_6_180_6.slha', 'axes': {'x': 180.294904351, 'y': 6.98984617203}, 't': 0.021504439200673783, 'signal': 1366.4499999999998, 'UL': 612.5144199999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_181_50_181_50.slha', 'axes': {'x': 181.947626689, 'y': 50.4229367932}, 't': 0.021504439200673783, 'signal': 1343.2599999999998, 'UL': 1120.2929199999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_181_57_181_57.slha', 'axes': {'x': 181.696803198, 'y': 57.0394001335}, 't': 0.021504439200673783, 'signal': 1343.2599999999998, 'UL': 1423.3563200000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_182_23_182_23.slha', 'axes': {'x': 182.950920654, 'y': 23.9570834317}, 't': 0.021504439200673783, 'signal': 1320.06, 'UL': 596.9982833333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_182_30_182_30.slha', 'axes': {'x': 182.700097163, 'y': 30.5735467721}, 't': 0.021504439200673783, 'signal': 1320.06, 'UL': 749.1617600000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_182_37_182_37.slha', 'axes': {'x': 182.449273671, 'y': 37.1900101125}, 't': 0.021504439200673783, 'signal': 1320.06, 'UL': 925.6731200000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_182_43_182_43.slha', 'axes': {'x': 182.19845018, 'y': 43.8064734528}, 't': 0.021504439200673783, 'signal': 1320.06, 'UL': 1077.2203200000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_182_77_182_77.slha', 'axes': {'x': 182.825166913, 'y': 77.2757372381}, 't': 0.021504439200673783, 'signal': 1320.06, 'UL': 3208.0641999999953, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_183_10_183_10.slha', 'axes': {'x': 183.452567636, 'y': 10.724156751}, 't': 0.021504439200673783, 'signal': 1296.87, 'UL': 575.0889416666669, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_183_17_183_17.slha', 'axes': {'x': 183.201744145, 'y': 17.3406200914}, 't': 0.021504439200673783, 'signal': 1296.87, 'UL': 582.0780216666669, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_183_41_183_41.slha', 'axes': {'x': 183.067542337, 'y': 41.5959099117}, 't': 0.021504439200673783, 'signal': 1296.87, 'UL': 1033.57912, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_183_4_183_4.slha', 'axes': {'x': 183.703391127, 'y': 4.10769341066}, 't': 0.021504439200673783, 'signal': 1296.87, 'UL': 569.5704716666669, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_183_5_183_5.slha', 'axes': {'x': 183.309917761, 'y': 5.91608258519}, 't': 0.021504439200673783, 'signal': 1296.87, 'UL': 575.3016616666665, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_34_185_34.slha', 'axes': {'x': 185.857760447, 'y': 34.3078573511}, 't': 0.021504439200673783, 'signal': 1250.48, 'UL': 811.5581999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_40_185_40.slha', 'axes': {'x': 185.606936956, 'y': 40.9243206914}, 't': 0.021504439200673783, 'signal': 1250.48, 'UL': 952.25136, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_47_185_47.slha', 'axes': {'x': 185.356113465, 'y': 47.5407840318}, 't': 0.021504439200673783, 'signal': 1250.48, 'UL': 974.85304, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_54_185_54.slha', 'axes': {'x': 185.105289974, 'y': 54.1572473722}, 't': 0.021504439200673783, 'signal': 1250.48, 'UL': 1179.6408000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_56_185_56.slha', 'axes': {'x': 185.901887489, 'y': 56.9366801818}, 't': 0.021504439200673783, 'signal': 1250.48, 'UL': 1272.99362, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_185_92_185_92.slha', 'error': 'no results', 'axes': {'x': 185.0, 'y': 92.0}}, {'slhafile': 'TChiWW_186_14_186_14.slha', 'axes': {'x': 186.61023092, 'y': 14.45846733}, 't': 0.021504439200673783, 'signal': 1227.29, 'UL': 539.8476150000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_186_21_186_21.slha', 'axes': {'x': 186.359407429, 'y': 21.0749306704}, 't': 0.021504439200673783, 'signal': 1227.29, 'UL': 554.5775849999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_186_27_186_27.slha', 'axes': {'x': 186.108583938, 'y': 27.6913940107}, 't': 0.021504439200673783, 'signal': 1227.29, 'UL': 636.1322000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_186_7_186_7.slha', 'axes': {'x': 186.861054412, 'y': 7.84200398964}, 't': 0.021504439200673783, 'signal': 1227.29, 'UL': 532.1449933333336, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_187_1_187_1.slha', 'axes': {'x': 187.111877903, 'y': 1.22554064928}, 't': 0.021504439200673783, 'signal': 1204.0900000000001, 'UL': 526.6265233333334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_188_107_188_107.slha', 'error': 'no results', 'axes': {'x': 188.0, 'y': 107.0}}, {'slhafile': 'TChiWW_188_36_188_36.slha', 'axes': {'x': 188.978608065, 'y': 36.5976231255}, 't': 0.021504439200673783, 'signal': 1180.9, 'UL': 823.9615999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_188_44_188_44.slha', 'axes': {'x': 188.76460024, 'y': 44.6586312704}, 't': 0.021504439200673783, 'signal': 1180.9, 'UL': 850.1212800000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_188_51_188_51.slha', 'axes': {'x': 188.513776749, 'y': 51.2750946108}, 't': 0.021504439200673783, 'signal': 1180.9, 'UL': 931.4386599999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_188_72_188_72.slha', 'axes': {'x': 188.736232641, 'y': 72.277450452}, 't': 0.021504439200673783, 'signal': 1180.9, 'UL': 1866.6823800000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_189_0_189_0.slha', 'error': 'no results', 'axes': {'x': 189.0, 'y': 0.0}}, {'slhafile': 'TChiWW_189_18_189_18.slha', 'axes': {'x': 189.767894205, 'y': 18.192777909}, 't': 0.021504439200673783, 'signal': 1157.6999999999998, 'UL': 512.1568866666665, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_189_24_189_24.slha', 'axes': {'x': 189.517070714, 'y': 24.8092412493}, 't': 0.021504439200673783, 'signal': 1157.6999999999998, 'UL': 527.9722166666663, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_189_31_189_31.slha', 'axes': {'x': 189.266247223, 'y': 31.4257045897}, 't': 0.021504439200673783, 'signal': 1157.6999999999998, 'UL': 698.52864, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_189_38_189_38.slha', 'axes': {'x': 189.015423732, 'y': 38.0421679301}, 't': 0.021504439200673783, 'signal': 1157.6999999999998, 'UL': 827.2824, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_190_11_190_11.slha', 'axes': {'x': 190.018717696, 'y': 11.5763145686}, 't': 0.021504439200673783, 'signal': 1134.51, 'UL': 497.4269166666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_190_4_190_4.slha', 'axes': {'x': 190.269541187, 'y': 4.95985122826}, 't': 0.021504439200673783, 'signal': 1134.51, 'UL': 489.2475866666664, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_191_48_191_48.slha', 'axes': {'x': 191.922263525, 'y': 48.3929418494}, 't': 0.021504439200673783, 'signal': 1111.3200000000002, 'UL': 751.2272399999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_191_51_191_51.slha', 'axes': {'x': 191.812953217, 'y': 51.9383933957}, 't': 0.021504439200673783, 'signal': 1111.3200000000002, 'UL': 843.7414599999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_191_87_191_87.slha', 'axes': {'x': 191.570577793, 'y': 87.6182207221}, 't': 0.021504439200673783, 'signal': 1111.3200000000002, 'UL': 2795.4344000000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_192_16_192_16.slha', 'axes': {'x': 192.055328641, 'y': 16.2585660692}, 't': 0.021504439200673783, 'signal': 1088.12, 'UL': 483.5780649999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_192_21_192_21.slha', 'axes': {'x': 192.925557489, 'y': 21.927088488}, 't': 0.021504439200673783, 'signal': 1088.12, 'UL': 485.55151833333315, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_192_28_192_28.slha', 'axes': {'x': 192.674733998, 'y': 28.5435518283}, 't': 0.021504439200673783, 'signal': 1088.12, 'UL': 585.49908, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_192_35_192_35.slha', 'axes': {'x': 192.423910507, 'y': 35.1600151687}, 't': 0.021504439200673783, 'signal': 1088.12, 'UL': 702.5506399999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_192_41_192_41.slha', 'axes': {'x': 192.173087016, 'y': 41.776478509}, 't': 0.021504439200673783, 'signal': 1088.12, 'UL': 725.1523200000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_193_15_193_15.slha', 'axes': {'x': 193.176380981, 'y': 15.3106251476}, 't': 0.021504439200673783, 'signal': 1064.9299999999998, 'UL': 469.7361883333334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_193_2_193_2.slha', 'axes': {'x': 193.678027963, 'y': 2.07769846688}, 't': 0.021504439200673783, 'signal': 1064.9299999999998, 'UL': 446.3036383333334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_193_8_193_8.slha', 'axes': {'x': 193.427204472, 'y': 8.69416180724}, 't': 0.021504439200673783, 'signal': 1064.9299999999998, 'UL': 455.0062183333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_194_102_194_102.slha', 'error': 'no results', 'axes': {'x': 194.0, 'y': 102.0}}, {'slhafile': 'TChiWW_194_31_194_31.slha', 'axes': {'x': 194.889673793, 'y': 31.5993363393}, 't': 0.021504439200673783, 'signal': 1041.73, 'UL': 607.1804399999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_194_67_194_67.slha', 'axes': {'x': 194.647298369, 'y': 67.2791636658}, 't': 0.021504439200673783, 'signal': 1041.73, 'UL': 1437.4302199999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_195_32_195_32.slha', 'axes': {'x': 195.832397283, 'y': 32.2778624073}, 't': 0.021504439200673783, 'signal': 1018.54, 'UL': 577.5816799999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_195_38_195_38.slha', 'axes': {'x': 195.581573792, 'y': 38.8943257477}, 't': 0.021504439200673783, 'signal': 1018.54, 'UL': 600.1833600000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_195_45_195_45.slha', 'axes': {'x': 195.330750301, 'y': 45.510789088}, 't': 0.021504439200673783, 'signal': 1018.54, 'UL': 626.2582799999992, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_196_12_196_12.slha', 'axes': {'x': 196.584867756, 'y': 12.4284723862}, 't': 0.021504439200673783, 'signal': 995.345, 'UL': 427.31549000000007, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_196_19_196_19.slha', 'axes': {'x': 196.334044265, 'y': 19.0449357266}, 't': 0.021504439200673783, 'signal': 995.345, 'UL': 443.13081999999986, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_196_25_196_25.slha', 'axes': {'x': 196.083220774, 'y': 25.6613990669}, 't': 0.021504439200673783, 'signal': 995.345, 'UL': 475.09460000000024, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_196_5_196_5.slha', 'axes': {'x': 196.835691247, 'y': 5.81200904587}, 't': 0.021504439200673783, 'signal': 995.345, 'UL': 412.58552000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_197_11_197_11.slha', 'axes': {'x': 197.966394369, 'y': 11.260279283}, 't': 0.021504439200673783, 'signal': 972.151, 'UL': 410.02724166666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_197_46_197_46.slha', 'axes': {'x': 197.724018945, 'y': 46.9401066095}, 't': 0.021504439200673783, 'signal': 972.151, 'UL': 546.2213200000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_197_82_197_82.slha', 'axes': {'x': 197.481643521, 'y': 82.619933936}, 't': 0.021504439200673783, 'signal': 972.151, 'UL': 2023.1591199999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_198_36_198_36.slha', 'axes': {'x': 198.990060567, 'y': 36.0121729863}, 't': 0.021504439200673783, 'signal': 948.957, 'UL': 475.2143999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_198_42_198_42.slha', 'axes': {'x': 198.739237076, 'y': 42.6286363266}, 't': 0.021504439200673783, 'signal': 948.957, 'UL': 501.28932000000066, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_199_16_199_16.slha', 'axes': {'x': 199.742531041, 'y': 16.1627829652}, 't': 0.021504439200673783, 'signal': 925.763, 'UL': 400.90041333333335, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_199_22_199_22.slha', 'axes': {'x': 199.49170755, 'y': 22.7792463056}, 't': 0.021504439200673783, 'signal': 925.763, 'UL': 415.6303833333332, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_199_29_199_29.slha', 'axes': {'x': 199.240884058, 'y': 29.3957096459}, 't': 0.021504439200673783, 'signal': 925.763, 'UL': 452.6127200000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_199_9_199_9.slha', 'axes': {'x': 199.993354532, 'y': 9.54631962485}, 't': 0.021504439200673783, 'signal': 925.763, 'UL': 384.8947916666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_0_200_0.slha', 'error': 'no results', 'axes': {'x': 200.0, 'y': 0.0}}, {'slhafile': 'TChiWW_200_100_200_100.slha', 'axes': {'x': 200.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 2717.0, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_10_200_10.slha', 'axes': {'x': 200.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 385.84624999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_110_200_110.slha', 'error': 'no results', 'axes': {'x': 200.0, 'y': 110.0}}, {'slhafile': 'TChiWW_200_120_200_120.slha', 'error': 'no results', 'axes': {'x': 200.0, 'y': 120.0}}, {'slhafile': 'TChiWW_200_130_200_130.slha', 'error': 'no results', 'axes': {'x': 200.0, 'y': 130.0}}, {'slhafile': 'TChiWW_200_140_200_140.slha', 'error': 'no results', 'axes': {'x': 200.0, 'y': 140.0}}, {'slhafile': 'TChiWW_200_20_200_20.slha', 'axes': {'x': 200.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 404.8754166666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_30_200_30.slha', 'axes': {'x': 200.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 426.25, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_40_200_40.slha', 'axes': {'x': 200.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 449.9700000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_50_200_50.slha', 'axes': {'x': 200.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 473.69, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_60_200_60.slha', 'axes': {'x': 200.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 922.3519999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_70_200_70.slha', 'axes': {'x': 200.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 1371.0139999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_80_200_80.slha', 'axes': {'x': 200.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 1819.6759999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_200_90_200_90.slha', 'axes': {'x': 200.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 902.569, 'UL': 2268.3379999999993, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_203_6_203_6.slha', 'axes': {'x': 203.877460098, 'y': 6.26199249685}, 't': 0.021504439200673783, 'signal': 863.808, 'UL': 342.90829833333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_0_220_0.slha', 'error': 'no results', 'axes': {'x': 220.0, 'y': 0.0}}, {'slhafile': 'TChiWW_220_100_220_100.slha', 'axes': {'x': 220.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 928.5440000000007, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_10_220_10.slha', 'axes': {'x': 220.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 216.20824999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_110_220_110.slha', 'axes': {'x': 220.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 1876.6999999999987, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_120_220_120.slha', 'axes': {'x': 220.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 2666.4133333333307, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_130_220_130.slha', 'error': 'no results', 'axes': {'x': 220.0, 'y': 130.0}}, {'slhafile': 'TChiWW_220_140_220_140.slha', 'error': 'no results', 'axes': {'x': 220.0, 'y': 140.0}}, {'slhafile': 'TChiWW_220_20_220_20.slha', 'axes': {'x': 220.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 221.07074999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_30_220_30.slha', 'axes': {'x': 220.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 242.16200000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_40_220_40.slha', 'axes': {'x': 220.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 254.6420000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_50_220_50.slha', 'axes': {'x': 220.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 267.12200000000024, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_60_220_60.slha', 'axes': {'x': 220.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 715.7840000000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_70_220_70.slha', 'axes': {'x': 220.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 768.9740000000008, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_80_220_80.slha', 'axes': {'x': 220.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 822.1639999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_220_90_220_90.slha', 'axes': {'x': 220.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 644.165, 'UL': 875.3539999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_0_240_0.slha', 'error': 'no results', 'axes': {'x': 240.0, 'y': 0.0}}, {'slhafile': 'TChiWW_240_100_240_100.slha', 'axes': {'x': 240.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 402.9440000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_10_240_10.slha', 'axes': {'x': 240.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 197.32849999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_110_240_110.slha', 'axes': {'x': 240.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 509.1960000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_120_240_120.slha', 'axes': {'x': 240.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 1036.4, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_130_240_130.slha', 'axes': {'x': 240.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 1826.1133333333337, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_140_240_140.slha', 'axes': {'x': 240.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 2615.8266666666664, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_20_240_20.slha', 'axes': {'x': 240.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 203.71875, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_30_240_30.slha', 'axes': {'x': 240.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 212.38999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_40_240_40.slha', 'axes': {'x': 240.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 215.694, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_50_240_50.slha', 'axes': {'x': 240.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 209.822, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_60_240_60.slha', 'axes': {'x': 240.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 235.07, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_70_240_70.slha', 'axes': {'x': 240.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 274.28900000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_80_240_80.slha', 'axes': {'x': 240.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 327.4790000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_240_90_240_90.slha', 'axes': {'x': 240.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 464.34599999999995, 'UL': 370.36400000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_0_260_0.slha', 'error': 'no results', 'axes': {'x': 260.0, 'y': 0.0}}, {'slhafile': 'TChiWW_260_100_260_100.slha', 'axes': {'x': 260.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 269.7200000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_10_260_10.slha', 'axes': {'x': 260.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 165.87816666666671, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_110_260_110.slha', 'axes': {'x': 260.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 375.9720000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_120_260_120.slha', 'axes': {'x': 260.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 459.692, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_130_260_130.slha', 'axes': {'x': 260.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 712.8820000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_140_260_140.slha', 'axes': {'x': 260.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 1158.0740000000003, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_20_260_20.slha', 'axes': {'x': 260.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 171.6681666666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_30_260_30.slha', 'axes': {'x': 260.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 176.70800000000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_40_260_40.slha', 'axes': {'x': 260.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 174.966, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_50_260_50.slha', 'axes': {'x': 260.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 169.09400000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_60_260_60.slha', 'axes': {'x': 260.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 194.342, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_70_260_70.slha', 'axes': {'x': 260.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 212.10400000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_80_260_80.slha', 'axes': {'x': 260.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 219.04600000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_260_90_260_90.slha', 'axes': {'x': 260.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 339.635, 'UL': 237.1400000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_0_280_0.slha', 'error': 'no results', 'axes': {'x': 280.0, 'y': 0.0}}, {'slhafile': 'TChiWW_280_100_280_100.slha', 'axes': {'x': 280.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 153.97, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_10_280_10.slha', 'axes': {'x': 280.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 136.29950000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_110_280_110.slha', 'axes': {'x': 280.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 189.442, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_120_280_120.slha', 'axes': {'x': 280.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 250.62999999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_130_280_130.slha', 'axes': {'x': 280.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 296.75199999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_140_280_140.slha', 'axes': {'x': 280.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 741.944, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_20_280_20.slha', 'axes': {'x': 280.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 112.29672222222224, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_30_280_30.slha', 'axes': {'x': 280.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 110.978, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_40_280_40.slha', 'axes': {'x': 280.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 113.36599999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_50_280_50.slha', 'axes': {'x': 280.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 115.75399999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_60_280_60.slha', 'axes': {'x': 280.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 126.462, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_70_280_70.slha', 'axes': {'x': 280.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 136.738, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_80_280_80.slha', 'axes': {'x': 280.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 143.68, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_280_90_280_90.slha', 'axes': {'x': 280.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 252.261, 'UL': 147.288, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_0_300_0.slha', 'error': 'no results', 'axes': {'x': 300.0, 'y': 0.0}}, {'slhafile': 'TChiWW_300_100_300_100.slha', 'axes': {'x': 300.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 176.37, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_10_300_10.slha', 'axes': {'x': 300.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 106.72083333333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_110_300_110.slha', 'axes': {'x': 300.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 186.126, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_120_300_120.slha', 'axes': {'x': 300.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 195.88199999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_130_300_130.slha', 'axes': {'x': 300.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 216.28799999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_140_300_140.slha', 'axes': {'x': 300.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 247.34399999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_20_300_20.slha', 'axes': {'x': 300.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 118.05250000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_30_300_30.slha', 'axes': {'x': 300.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 129.85799999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_40_300_40.slha', 'axes': {'x': 300.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 126.99399999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_50_300_50.slha', 'axes': {'x': 300.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 124.12999999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_60_300_60.slha', 'axes': {'x': 300.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 135.26999999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_70_300_70.slha', 'axes': {'x': 300.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 146.41, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_80_300_80.slha', 'axes': {'x': 300.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 156.85799999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_300_90_300_90.slha', 'axes': {'x': 300.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 190.159, 'UL': 166.61399999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_0_320_0.slha', 'error': 'no results', 'axes': {'x': 320.0, 'y': 0.0}}, {'slhafile': 'TChiWW_320_100_320_100.slha', 'axes': {'x': 320.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 127.69000000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_10_320_10.slha', 'axes': {'x': 320.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 100.13425000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_110_320_110.slha', 'axes': {'x': 320.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 141.786, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_120_320_120.slha', 'axes': {'x': 320.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 160.222, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_130_320_130.slha', 'axes': {'x': 320.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 184.96800000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_140_320_140.slha', 'axes': {'x': 320.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 205.982, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_20_320_20.slha', 'axes': {'x': 320.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 102.03008333333332, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_30_320_30.slha', 'axes': {'x': 320.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 102.22800000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_40_320_40.slha', 'axes': {'x': 320.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 100.72800000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_50_320_50.slha', 'axes': {'x': 320.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 98.546, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_60_320_60.slha', 'axes': {'x': 320.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 106.453, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_70_320_70.slha', 'axes': {'x': 320.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 111.12700000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_80_320_80.slha', 'axes': {'x': 320.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 115.80100000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_320_90_320_90.slha', 'axes': {'x': 320.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 148.501, 'UL': 120.475, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_0_340_0.slha', 'error': 'no results', 'axes': {'x': 340.0, 'y': 0.0}}, {'slhafile': 'TChiWW_340_100_340_100.slha', 'axes': {'x': 340.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 100.43599999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_10_340_10.slha', 'axes': {'x': 340.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 86.98425, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_110_340_110.slha', 'axes': {'x': 340.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 118.87200000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_120_340_120.slha', 'axes': {'x': 340.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 124.264, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_130_340_130.slha', 'axes': {'x': 340.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 136.166, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_140_340_140.slha', 'axes': {'x': 340.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 154.57799999999997, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_20_340_20.slha', 'axes': {'x': 340.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 86.25983333333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_30_340_30.slha', 'axes': {'x': 340.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 86.468, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_40_340_40.slha', 'axes': {'x': 340.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 87.776, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_50_340_50.slha', 'axes': {'x': 340.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 86.27600000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_60_340_60.slha', 'axes': {'x': 340.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 82.42, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_70_340_70.slha', 'axes': {'x': 340.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 82.829, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_80_340_80.slha', 'axes': {'x': 340.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 87.503, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_340_90_340_90.slha', 'axes': {'x': 340.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 116.554, 'UL': 93.372, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_0_360_0.slha', 'error': 'no results', 'axes': {'x': 360.0, 'y': 0.0}}, {'slhafile': 'TChiWW_360_100_360_100.slha', 'axes': {'x': 360.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 84.14, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_10_360_10.slha', 'axes': {'x': 360.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 75.06025, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_110_360_110.slha', 'axes': {'x': 360.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 90.82000000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_120_360_120.slha', 'axes': {'x': 360.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 96.212, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_130_360_130.slha', 'axes': {'x': 360.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 100.84, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_140_360_140.slha', 'axes': {'x': 360.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 111.978, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_20_360_20.slha', 'axes': {'x': 360.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 74.35983333333334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_30_360_30.slha', 'axes': {'x': 360.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 74.56800000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_40_360_40.slha', 'axes': {'x': 360.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 75.876, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_50_360_50.slha', 'axes': {'x': 360.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 76.872, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_60_360_60.slha', 'axes': {'x': 360.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 77.868, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_70_360_70.slha', 'axes': {'x': 360.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 74.012, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_80_360_80.slha', 'axes': {'x': 360.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 75.616, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_360_90_360_90.slha', 'axes': {'x': 360.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 92.0531, 'UL': 82.67999999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_0_380_0.slha', 'error': 'no results', 'axes': {'x': 380.0, 'y': 0.0}}, {'slhafile': 'TChiWW_380_100_380_100.slha', 'axes': {'x': 380.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 73.274, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_10_380_10.slha', 'axes': {'x': 380.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 61.05825, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_110_380_110.slha', 'axes': {'x': 380.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 75.98800000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_120_380_120.slha', 'axes': {'x': 380.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 82.668, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_130_380_130.slha', 'axes': {'x': 380.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 87.94, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_140_380_140.slha', 'axes': {'x': 380.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 91.80399999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_20_380_20.slha', 'axes': {'x': 380.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 63.35408333333334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_30_380_30.slha', 'axes': {'x': 380.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 62.84, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_40_380_40.slha', 'axes': {'x': 380.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 63.836000000000006, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_50_380_50.slha', 'axes': {'x': 380.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 64.832, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_60_380_60.slha', 'axes': {'x': 380.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 65.828, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_70_380_70.slha', 'axes': {'x': 380.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 66.82399999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_80_380_80.slha', 'axes': {'x': 380.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 70.35399999999998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_380_90_380_90.slha', 'axes': {'x': 380.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 73.19359999999999, 'UL': 71.81400000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_0_400_0.slha', 'error': 'no results', 'axes': {'x': 400.0, 'y': 0.0}}, {'slhafile': 'TChiWW_400_100_400_100.slha', 'axes': {'x': 400.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 67.25, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_10_400_10.slha', 'axes': {'x': 400.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 52.872499999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_110_400_110.slha', 'axes': {'x': 400.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 65.998, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_120_400_120.slha', 'axes': {'x': 400.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 64.74600000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_130_400_130.slha', 'axes': {'x': 400.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 67.53200000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_140_400_140.slha', 'axes': {'x': 400.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 74.356, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_20_400_20.slha', 'axes': {'x': 400.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 53.3975, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_30_400_30.slha', 'axes': {'x': 400.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 52.848, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_40_400_40.slha', 'axes': {'x': 400.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 51.224000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_50_400_50.slha', 'axes': {'x': 400.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 49.6, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_60_400_60.slha', 'axes': {'x': 400.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 53.418, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_70_400_70.slha', 'axes': {'x': 400.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 57.23599999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_80_400_80.slha', 'axes': {'x': 400.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 60.76599999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_400_90_400_90.slha', 'axes': {'x': 400.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 58.631099999999996, 'UL': 64.008, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_0_420_0.slha', 'error': 'no results', 'axes': {'x': 420.0, 'y': 0.0}}, {'slhafile': 'TChiWW_420_100_420_100.slha', 'axes': {'x': 420.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 53.082, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_10_420_10.slha', 'axes': {'x': 420.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 49.265, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_110_420_110.slha', 'axes': {'x': 420.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 53.903333333333336, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_120_420_120.slha', 'axes': {'x': 420.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 56.798, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_130_420_130.slha', 'axes': {'x': 420.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 59.69266666666667, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_140_420_140.slha', 'axes': {'x': 420.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 64.55200000000002, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_20_420_20.slha', 'axes': {'x': 420.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 49.781666666666666, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_30_420_30.slha', 'axes': {'x': 420.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 51.052, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_40_420_40.slha', 'axes': {'x': 420.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 53.068, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_50_420_50.slha', 'axes': {'x': 420.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 53.264, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_60_420_60.slha', 'axes': {'x': 420.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 50.456, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_70_420_70.slha', 'axes': {'x': 420.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 47.647999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_80_420_80.slha', 'axes': {'x': 420.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 51.178, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_420_90_420_90.slha', 'axes': {'x': 420.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 47.9013, 'UL': 52.13, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_0_440_0.slha', 'error': 'no results', 'axes': {'x': 440.0, 'y': 0.0}}, {'slhafile': 'TChiWW_440_100_440_100.slha', 'axes': {'x': 440.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 46.036, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_10_440_10.slha', 'axes': {'x': 440.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 45.719, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_110_440_110.slha', 'axes': {'x': 440.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 48.629999999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_120_440_120.slha', 'axes': {'x': 440.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 51.224000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_130_440_130.slha', 'axes': {'x': 440.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 53.818, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_140_440_140.slha', 'axes': {'x': 440.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 56.712666666666664, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_20_440_20.slha', 'axes': {'x': 440.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 46.4329387755102, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_30_440_30.slha', 'axes': {'x': 440.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 47.1594693877551, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_40_440_40.slha', 'axes': {'x': 440.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 47.886, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_50_440_50.slha', 'axes': {'x': 440.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 49.902, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_60_440_60.slha', 'axes': {'x': 440.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 47.093999999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_70_440_70.slha', 'axes': {'x': 440.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 45.763999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_80_440_80.slha', 'axes': {'x': 440.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 45.093999999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_440_90_440_90.slha', 'axes': {'x': 440.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 39.2761, 'UL': 45.084, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_0_460_0.slha', 'error': 'no results', 'axes': {'x': 460.0, 'y': 0.0}}, {'slhafile': 'TChiWW_460_100_460_100.slha', 'axes': {'x': 460.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 43.442, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_10_460_10.slha', 'axes': {'x': 460.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 41.223375, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_110_460_110.slha', 'axes': {'x': 460.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 44.54800000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_120_460_120.slha', 'axes': {'x': 460.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 47.141999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_130_460_130.slha', 'axes': {'x': 460.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 49.736000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_140_460_140.slha', 'axes': {'x': 460.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 52.330000000000005, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_20_460_20.slha', 'axes': {'x': 460.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 41.8809387755102, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_30_460_30.slha', 'axes': {'x': 460.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 42.6074693877551, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_40_460_40.slha', 'axes': {'x': 460.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 43.333999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_50_460_50.slha', 'axes': {'x': 460.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 43.83999999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_60_460_60.slha', 'axes': {'x': 460.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 44.346000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_70_460_70.slha', 'axes': {'x': 460.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 43.016, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_80_460_80.slha', 'axes': {'x': 460.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 42.34599999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_460_90_460_90.slha', 'axes': {'x': 460.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 32.3223, 'UL': 42.336, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_0_480_0.slha', 'error': 'no results', 'axes': {'x': 480.0, 'y': 0.0}}, {'slhafile': 'TChiWW_480_100_480_100.slha', 'axes': {'x': 480.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 42.07200000000001, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_10_480_10.slha', 'axes': {'x': 480.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 37.451375, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_110_480_110.slha', 'axes': {'x': 480.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 43.178000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_120_480_120.slha', 'axes': {'x': 480.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 44.284, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_130_480_130.slha', 'axes': {'x': 480.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 44.422000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_140_480_140.slha', 'axes': {'x': 480.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 45.194, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_20_480_20.slha', 'axes': {'x': 480.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 37.02845833333333, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_30_480_30.slha', 'axes': {'x': 480.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 36.827999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_40_480_40.slha', 'axes': {'x': 480.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 37.334, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_50_480_50.slha', 'axes': {'x': 480.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 37.839999999999996, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_60_480_60.slha', 'axes': {'x': 480.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 38.346, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_70_480_70.slha', 'axes': {'x': 480.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 38.852000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_80_480_80.slha', 'axes': {'x': 480.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 39.86, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_480_90_480_90.slha', 'axes': {'x': 480.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 26.6927, 'UL': 40.965999999999994, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_0_500_0.slha', 'error': 'no results', 'axes': {'x': 500.0, 'y': 0.0}}, {'slhafile': 'TChiWW_500_100_500_100.slha', 'axes': {'x': 500.0, 'y': 100.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 38.14, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_10_500_10.slha', 'axes': {'x': 500.0, 'y': 10.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 33.88367346938776, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_110_500_110.slha', 'axes': {'x': 500.0, 'y': 110.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 38.278, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_120_500_120.slha', 'axes': {'x': 500.0, 'y': 120.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 38.416, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_130_500_130.slha', 'axes': {'x': 500.0, 'y': 130.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 38.553999999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_140_500_140.slha', 'axes': {'x': 500.0, 'y': 140.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 38.69199999999999, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_20_500_20.slha', 'axes': {'x': 500.0, 'y': 20.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 33.68775510204081, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_30_500_30.slha', 'axes': {'x': 500.0, 'y': 30.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 33.491836734693884, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_40_500_40.slha', 'axes': {'x': 500.0, 'y': 40.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 33.29591836734694, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_50_500_50.slha', 'axes': {'x': 500.0, 'y': 50.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 33.1, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_60_500_60.slha', 'axes': {'x': 500.0, 'y': 60.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 34.108000000000004, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_70_500_70.slha', 'axes': {'x': 500.0, 'y': 70.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 35.116, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_80_500_80.slha', 'axes': {'x': 500.0, 'y': 80.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 36.123999999999995, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}, {'slhafile': 'TChiWW_500_90_500_90.slha', 'axes': {'x': 500.0, 'y': 90.0}, 't': 0.021504439200673783, 'signal': 22.1265, 'UL': 37.132, 'condition': 0.0, 'dataset': None, 'kfactor': 1.0}]
66581eb8de97d6811abf4de898df3bae802abcf5
ba2636f6a21d02015eb3ab806aeeef63a4cd708d
/Python/pyqt5/qt.py
eb6f9f53d288ed674f87405d5f8f8528846850d9
[]
no_license
ghdic/marinelifeirony
ac317fcd32032e701d5793bdeb5c06bd0f52ca41
559ad5618eb99368b4da140cb78609bce2d5da71
refs/heads/master
2023-07-21T17:18:16.332222
2023-07-08T09:20:15
2023-07-08T09:20:15
199,758,561
6
4
null
2023-07-08T09:20:16
2019-07-31T01:58:32
Go
UTF-8
Python
false
false
27,376
py
# pyinstaller로 라이브러리 path 오류가 날때 # 환경 변수 추가를 해주거나 # 그래도 안되면 pyinstaller --path C:\Users\ghdic\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\PyQt5\Qt\bin --onefile --noconsole test.py # 이렇게 직접 path를 설정해준다 # # 1.pyqt5 기본창 실행 + 아이콘 적용 # from PyQt5.QtWidgets import QMainWindow, QApplication # from PyQt5 import QtGui # import sys # # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 Window" # self.top = 100 # self.left = 100 # self.width = 400 # self.height = 300 # self.InitWindow() # # def InitWindow(self): # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.png")) # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 2.pyqt5 시간을 얻는 여러 방법 # from PyQt5.QtCore import QDateTime, QDate, QTime, Qt # # datetime = QDateTime.currentDateTime() # # print(datetime.toString()) # print(datetime.toString(Qt.ISODate)) # print(datetime.toString(Qt.DefaultLocaleLongDate)) # # date = QDate.currentDate() # print(date.toString()) # print(date.toString(Qt.ISODate)) # print(date.toString(Qt.DefaultLocaleLongDate)) # # date = QTime.currentTime() # # 3.local time to UTC # from PyQt5.QtCore import QDateTime, Qt # # datetime = QDateTime.currentDateTime() # # print("Local Date And Time Is " + datetime.toString(Qt.DefaultLocaleLongDate)) # print("Universal Date And Time Is " + datetime.toUTC().toString()) # # print("The Offset From UTC Is {0} : Seconds ".format(datetime.offsetFromUtc())) # # 4.해당 월, 년에 따라 몇일 있는지 값 얻기 # from PyQt5.QtCore import QDate # # date = QDate.currentDate() # # d = QDate(2017, 10, 23) # # print("Days In A Month: {0}: ".format(d.daysInMonth())) # print("Days In A Year: {0}: ".format(d.daysInYear())) # # 5.날짜 데이터 조작하기 # from PyQt5.QtCore import QDateTime, Qt # # datetime = QDateTime.currentDateTime() # # print("Today Date And Time Is: " + datetime.toString((Qt.ISODate))) # print("Adding 12 Days To The Date: {0}".format(datetime.addDays(12).toString(Qt.ISODate))) # print("Subtracting 25 Days: {0}".format(datetime.addDays(-25).toString(Qt.ISODate))) # print("Adding 50 Seconds: {0}".format(datetime.addSecs(50).toString(Qt.ISODate))) # print("Adding 3 Months: {0}".format(datetime.addMonths(3).toString(Qt.ISODate))) # print("Adding 12 Years: {0}".format(datetime.addYears(12).toString(Qt.ISODate))) # # 6.QButton 사용법, 7.클릭했을때 함수실행 8.QMessage를 이용하여 question물어보는거 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QToolTip, QMessageBox # from PyQt5.QtCore import QCoreApplication # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "PyQt5 Push Button" # self.left = 100 # self.top = 100 # self.width = 680 # self.height = 540 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # button = QPushButton("Close", self) # button.move(200, 200) # button.setToolTip("<h3>This is Clock Button</h3>") # button.clicked.connect(self.Close) # # button2 = QPushButton("Close QMessage", self) # button2.setGeometry(400, 400, 150, 100) # button2.clicked.connect(self.Close_QMessage) # self.InitUi() # # def InitUi(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # def Close(self): # QCoreApplication.instance().quit() # # def Close_QMessage(self): # reply = QMessageBox.question(self, "닫는지확인하는창","닫을꺼임?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) # # if reply == QMessageBox.Yes: # self.close() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 9.QMessage를 통해 About box 띄우기 및 question응용 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QMessageBox # from PyQt5.QtCore import QCoreApplication # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "PyQt5 Push Button" # self.left = 100 # self.top = 100 # self.width = 680 # self.height = 540 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # button = QPushButton("AboutBox", self) # button.move(200, 200) # button.clicked.connect(self.AboutMessage) # # button2 = QPushButton("QuestionMessage", self) # button2.move(100, 100) # button2.clicked.connect(self.QuestionMessage) # # self.InitUi() # # def InitUi(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # def AboutMessage(self): # QMessageBox.about(self, "About Message", "This is About MessageBox") # # def QuestionMessage(self): # message = QMessageBox.question(self, "Question Message", "Have you Subscribeed My Channel?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) # # if message == QMessageBox.Yes: # print("Yes I Have Subscribed") # else: # print("No I Have not Subtscribed") # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 10. status bus 출력 맨 왼쪽아래에 출력되는 로그나 정보 같은거 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QStatusBar # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "QStatus Bar" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # self.InitUI() # # # def InitUI(self): # # self.statusBar().showMessage("This is simple status bar") # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 11. QMenu Bar 사용 위에 메뉴와 메뉴 선택지(QAction) 사용법 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QAction # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "QMenuBar" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # self.InitUI() # # # def InitUI(self): # # mainMenu = self.menuBar() # fileMenu = mainMenu.addMenu("File") # viewMenu = mainMenu.addMenu("View") # editMenu = mainMenu.addMenu("Edit") # searchMenu = mainMenu.addMenu("Search") # toolMenu = mainMenu.addMenu("Tool") # helpMenu = mainMenu.addMenu("Help") # # exitButton = QAction(QtGui.QIcon("button_icon.png"), "Exit", self) # exitButton.setShortcut("Ctrl+E") # exitButton.setStatusTip("Exit Application") # exitButton.triggered.connect(self.close) # fileMenu.addAction(exitButton) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 12. 메뉴 체크하여 statusBar 보여줬다 숨겼다 하기 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QMenu, QMenuBar, QAction, QStatusBar # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "QMenuBar" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # self.InitUI() # def InitUI(self): # self.statusbar = self.statusBar() # self.statusbar.showMessage("Message is Ready") # menubar = self.menuBar() # viewMenu = menubar.addMenu("View") # viewAction = QAction("View Status", self, checkable = True) # viewAction.setStatusTip("View StatusBar") # viewAction.setChecked(True) # viewAction.triggered.connect(self.toggleMenu) # viewMenu.addAction(viewAction) # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # def toggleMenu(self, state): # if state: # self.statusbar.show() # else: # self.statusbar.hide() # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 13. ContextMenu, 창 아무데서나 오른쪽 마우스 클릭할때 뜨는 메뉴 만들기 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QMenu # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "PyQt5 Context Menu" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # self.InitUI() # # # def InitUI(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # # def contextMenuEvent(self, event): # contextMenuEvent라는걸 재정의 함.. 오른쪽 클릭할때 뜨는 메뉴 # contextMenu = QMenu(self) # newAct = contextMenu.addAction("New") # openAct = contextMenu.addAction("Open") # quitAct = contextMenu.addAction("Quit") # # action = contextMenu.exec_(self.mapToGlobal(event.pos())) # 창 전체에서 pos(위치)에 대해 이벤트를 받아옴 # # if action == quitAct: # self.close() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # #14 Toolbars 이거 툴바 떼어서 움직일 수도 있음.. ㄷㄷ # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QAction # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "PyQt5 Toolbars" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # self.InitUI() # # # def InitUI(self): # # exitAct = QAction(QtGui.QIcon('exit.png'), 'Exit', self) # exitAct.setShortcut('Ctrl+Q') # exitAct.triggered.connect(self.CloseApp) # # copyAct = QAction(QtGui.QIcon('copy.png'), 'Copy', self) # copyAct.setShortcut('Ctrl+C') # # pasteAct = QAction(QtGui.QIcon('paste.png'), 'Paste', self) # pasteAct.setShortcut('Ctrl+V') # # deleteAct = QAction(QtGui.QIcon('delete.png'), 'Delete', self) # deleteAct.setShortcut('Ctrl+D') # # saveAct = QAction(QtGui.QIcon('save.png'), 'Save', self) # saveAct.setShortcut('Ctrl+S') # # self.toolbar = self.addToolBar('Toolbar') # # self.toolbar.addAction(exitAct) # self.toolbar.addAction(copyAct) # self.toolbar.addAction(pasteAct) # self.toolbar.addAction(deleteAct) # self.toolbar.addAction(saveAct) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # def CloseApp(self): # self.close() # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 15. LineEdit 한줄로 텍스트 입력 받을때 쓰는것 # import sys # from PyQt5 import QtGui # from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QMessageBox, QPushButton, QLineEdit # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # # self.title = "PyQt5 Toolbars" # self.top = 200 # self.left = 200 # self.width = 600 # self.height = 500 # # self.setWindowIcon(QtGui.QIcon("LeetCode_logo.ico")) # # self.InitUI() # # # def InitUI(self): # # self.linedit = QLineEdit(self) # self.linedit.move(200, 200) # self.linedit.resize(280, 40) # # self.button = QPushButton("Show Text", self) # self.button.move(270, 250) # self.button.clicked.connect(self.onClick) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.show() # # def onClick(self): # textValue = self.linedit.text() # QMessageBox.question(self, "Line Edit", "You Have Typed" + textValue, # QMessageBox.Ok, QMessageBox.Ok) # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 16 Positioning Widgets Move함수를 이용해 위젯움직이는거 # from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel # from PyQt5 import QtGui # import sys # # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 Positioning" # self.top = 100 # self.left = 100 # self.width = 600 # self.height = 500 # self.InitWindow() # # def InitWindow(self): # self.label1 = QLabel("Please", self) # self.label1.move(50, 50) # # self.label2 = QLabel("Studing", self) # self.label2.move(100, 100) # # self.label3 = QLabel("English", self) # self.label3.move(150, 150) # # self.label4 = QLabel("Please", self) # self.label4.move(200, 200) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 17. HBoxLayout, VBoxLayout, GroupBox # from PyQt5.QtWidgets import QMainWindow, QApplication, QDialog, QPushButton, QMessageBox, QVBoxLayout, QHBoxLayout, QGroupBox # from PyQt5 import QtGui # import sys # # class Window(QDialog): # def __init__(self): # super().__init__() # self.title = "PyQt 5 Layouts" # self.top = 100 # self.left = 100 # self.width = 300 # self.height = 100 # self.InitWindow() # # def InitWindow(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.HorizontalLayout() # # vBox = QVBoxLayout() # vBox.addWidget(self.groupBox) # self.setLayout(vBox) # self.show() # # def HorizontalLayout(self): # self.groupBox = QGroupBox("What is your favorite sport?") # hBoxlayout = QHBoxLayout() # # button1 = QPushButton("Football", self) # button1.clicked.connect(self.button1Clicked) # hBoxlayout.addWidget(button1) # # button2 = QPushButton("Cricket", self) # button2.clicked.connect(self.button2Clicked) # hBoxlayout.addWidget(button2) # # button3 = QPushButton("Tennis", self) # button3.clicked.connect(self.button3Clicked) # hBoxlayout.addWidget(button3) # # self.groupBox.setLayout(hBoxlayout) # # def button1Clicked(self): # QMessageBox.information(self, "Football", "Yes I Like Football") # # def button2Clicked(self): # QMessageBox.information(self, "Cricket", "Yes I Like Cricket") # # def button3Clicked(self): # QMessageBox.information(self, "Tennis", "Yes I Like Tennis") # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 18. GridLayout # from PyQt5.QtWidgets import QMainWindow, QApplication, QDialog, QGridLayout, QGroupBox, QPushButton, QVBoxLayout # from PyQt5 import QtGui # import sys # # class Window(QDialog): # def __init__(self): # super().__init__() # self.title = "PyQt 5 GridLayOut" # self.top = 100 # self.left = 100 # self.width = 300 # self.height = 100 # self.InitWindow() # # def InitWindow(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # self.gridLayoutCreation() # vboxLayout = QVBoxLayout() # vboxLayout.addWidget(self.groupBox) # self.setLayout(vboxLayout) # self.show() # # def gridLayoutCreation(self): # self.groupBox = QGroupBox("Grid Layout Example") # # gridLayout = QGridLayout() # # 위치 줄 수 있네 # gridLayout.addWidget(QPushButton('1'), 0, 0) # gridLayout.addWidget(QPushButton('2'), 0, 1) # gridLayout.addWidget(QPushButton('3'), 0, 2) # # gridLayout.addWidget(QPushButton('4'), 2, 0) # gridLayout.addWidget(QPushButton('5'), 1, 1) # gridLayout.addWidget(QPushButton('6'), 1, 2) # # self.groupBox.setLayout(gridLayout) # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # 19. QCheckbox # from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QCheckBox # from PyQt5.QtCore import Qt # import sys # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 CheckBoxes" # self.top = 100 # self.left = 100 # self.width = 300 # self.height = 100 # self.InitWindow() # # def InitWindow(self): # # checkBox = QCheckBox("Do you like Football ?", self) # checkBox.move(20, 20) # checkBox.toggle() # # checkBox.stateChanged.connect(self.checBoxChanged) # # self.label = QLabel("Hello", self) # self.label.resize(1000, 20) # self.label.move(20, 40) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # # def checBoxChanged(self, state): # if state == Qt.Checked: # self.label.setText("Yes I like Football") # else: # self.label.setText("No I Dont Like FootBall") # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 20. QSPinkbox + - 마우스로 클릭해서 숫자 조정하는거 # from PyQt5.QtWidgets import QApplication, QMainWindow, QSpinBox, QVBoxLayout, QLabel, QDoubleSpinBox, QPushButton # import sys # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 SPinBoxes" # self.top = 100 # self.left = 100 # self.width = 300 # self.height = 100 # #self.InitWindow() # self.btn = QPushButton("안녕", self) # self.btn.move(150, 0) # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # #self.setLayout(vBoxLayout) # self.show() # def InitWindow(self): # vBoxLayout = QVBoxLayout() # self.label = QLabel("Current Value", self) # self.label.move(20, 20) # self.label.resize(200, 40) # vBoxLayout.addWidget(self.label) # self.spinBox = QSpinBox(self) # self.spinBox.move(20, 0) # self.spinBox.valueChanged.connect(self.valueChanged) # self.spinBox.setMaximum(500) # self.doubleSpinBox = QDoubleSpinBox() # #self.doubleSpinBox.move(150, 0) # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # #self.setLayout(vBoxLayout) # self.show() # def valueChanged(self): # self.label.setText("Current Value " + str(self.spinBox.text())) # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 21. QPixmap image add # from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel # from PyQt5.QtGui import QPixmap # import sys # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 Image" # self.top = 100 # self.left = 100 # self.width = 600 # self.height = 500 # self.InitWindow() # # def InitWindow(self): # self.label = QLabel(self) # self.label.setPixmap(QPixmap('image.jpg')) # self.label.setGeometry(60, 50, 1000, 700) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 22. QSlider1 # from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QLineEdit, QSlider, QVBoxLayout # from PyQt5.QtCore import Qt # import sys # # # class Window(QWidget): # def __init__(self): # super().__init__() # self.title = "PyQt 5 QSlider" # self.top = 100 # self.left = 100 # self.width = 600 # self.height = 500 # self.InitWindow() # # def InitWindow(self): # # vboxLayout = QVBoxLayout() # self.lineEdit = QLineEdit(self) # self.lineEdit.move(100, 50) # vboxLayout.addWidget(self.lineEdit) # # self.slider = QSlider(Qt.Horizontal, self) # self.slider.move(100, 20) # self.slider.setMinimum(1) # self.slider.setMaximum(99) # self.slider.setValue(20) # self.slider.setTickPosition(QSlider.TicksBelow) # self.slider.setTickInterval(10) # self.slider.valueChanged.connect(self.changedValude) # vboxLayout.addWidget(self.slider) # # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # def changedValude(self): # size = str(self.slider.value()) # self.lineEdit.setText(size) # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 23. # from PyQt5.QtWidgets import QApplication, QMainWindow # import sys # # # class Window(QMainWindow): # def __init__(self): # super().__init__() # self.title = "PyQt 5 " # self.top = 100 # self.left = 100 # self.width = 600 # self.height = 500 # self.InitWindow() # # def InitWindow(self): # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # # self.show() # # # # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # QListWidget # from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QListWidget, QLabel # import sys # from PyQt5 import QtGui # class Window(QWidget): # def __init__(self): # super().__init__() # self.title = "PyQt5 QListWidget" # self.left = 500 # self.top = 200 # self.width = 300 # self.height = 500 # self.iconName = 'temp.png' # self.InitUI() # def InitUI(self): # self.setWindowTitle(self.title) # self.setWindowIcon(QtGui.QIcon(self.iconName)) # self.setGeometry(self.left, self.top, self.width, self.height) # vbox = QVBoxLayout() # self.list = QListWidget() # self.list.insertItem(0, "Python") # self.list.insertItem(1, "Java") # self.list.insertItem(1, "C++") # self.list.insertItem(1, "C#") # self.list.insertItem(1, "Ruby") # self.list.insertItem(1, "Kotlin") # self.list.clicked.connect(self.listview_clicked) # self.label = QLabel() # self.label.setFont(QtGui.QFont("Sanserif", 15)) # vbox.addWidget(self.label) # vbox.addWidget(self.list) # self.setLayout(vbox) # self.show() # def listview_clicked(self): # item = self.list.currentItem() # self.label.setText(str(item.text())) # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # from PyQt5 import QtGui # from PyQt5.QtWidgets import QApplication, QWidget, QPlainTextEdit, QVBoxLayout # import sys # class Window(QWidget): # def __init__(self): # super().__init__() # self.title = "PyQt5 Plain TextEdit" # self.top = 200 # self.left = 500 # self.width = 400 # self.height = 300 # self.InitWindow() # def InitWindow(self): # self.setWindowIcon(QtGui.QIcon("icon.png")) # self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # vbox = QVBoxLayout() # plainText = QPlainTextEdit() # plainText.setPlaceholderText("This is some text for our plaintextedit") # #plainText.setReadOnly(True) # text = "Please subscribe the channel and like the videos" # plainText.appendPlainText(text) # plainText.setPlaceholderText(text) # plainText.setUndoRedoEnabled(True) # vbox.addWidget(plainText) # self.setLayout(vbox) # self.show() # App = QApplication(sys.argv) # window = Window() # sys.exit(App.exec()) # # 콘솔 입력 가능 예제 # import platform # import sys # from PyQt5 import QtCore, QtGui, QtWidgets # class NativeMessenger(QtCore.QObject): # messageChanged = QtCore.pyqtSignal(str) # def __init__(self, parent=None): # super().__init__(parent) # self.m_qin = QtCore.QFile() # self.m_qin.open( # sys.stdin.fileno(), QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Unbuffered # ) # if platform.system() == "Windows": # import win32api # if sys.platform == "win32": # import os # import msvcrt # if platform.python_implementation() == "PyPy": # os.fdopen(fh.fileno(), "wb", 0) # else: # msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) # self.m_notifier = QtCore.QWinEventNotifier( # win32api.GetStdHandle(win32api.STD_INPUT_HANDLE) # ) # else: # self.m_notifier = QtCore.QSocketNotifier( # sys.stdin.fileno(), QtCore.QSocketNotifier.Read, self # ) # self.m_notifier.activated.connect(self.readyRead) # @QtCore.pyqtSlot() # def readyRead(self): # line = self.m_qin.readLine().data().decode().strip() # self.messageChanged.emit(line) # if __name__ == "__main__": # app = QtWidgets.QApplication(sys.argv) # w = QtWidgets.QLabel(alignment=QtCore.Qt.AlignCenter) # w.resize(640, 480) # w.show() # messenger = NativeMessenger() # messenger.messageChanged.connect(w.setText) # sys.exit(app.exec_())
cd28d35b22be1c515cd2b2d8c6067d3bec20ebf5
131cf803a1f7b9638ab0a604d61ab2de22906014
/tests/system/web/api_1_0/resources/test_action_template.py
cb67c0780e6d1e4638116518724615052eadf8a7
[ "Apache-2.0" ]
permissive
dimensigon/dimensigon
757be1e61e57f7ce0a610a9531317761393eaad0
079d7c91a66e10f13510d89844fbadb27e005b40
refs/heads/master
2023-03-09T06:50:55.994738
2021-02-21T11:45:01
2021-02-21T11:45:01
209,486,736
2
0
Apache-2.0
2021-02-26T02:59:18
2019-09-19T07:11:35
Python
UTF-8
Python
false
false
2,167
py
from flask import url_for from dimensigon import defaults from dimensigon.domain.entities import bypass_datamark_update, ActionType, ActionTemplate from dimensigon.web import db from tests.base import TestDimensigonBase class TestActionTemplate(TestDimensigonBase): def setUp(self) -> None: self.initials = dict(self.initials) self.initials.update(action_template=False) super().setUp() def fill_database(self): self.at1 = ActionTemplate(id="aaaaaaaa-1234-5678-1234-56781234aaa1", action_type=ActionType.SHELL, code="mkdir {dir}", last_modified_at=defaults.INITIAL_DATEMARK, name="mkdir", version=1) self.at2 = ActionTemplate(id="aaaaaaaa-1234-5678-1234-56781234aaa2", action_type=ActionType.SHELL, code="rmdir {dir}", last_modified_at=defaults.INITIAL_DATEMARK, expected_stdout='output', expected_stderr='err', expected_rc=0, name="rmdir", system_kwargs={'kwarg1': 1}, pre_process='pre_process', post_process='post_process', version=1 ) with bypass_datamark_update(): db.session.add_all([self.at1, self.at2]) db.session.commit() def test_action_template_list(self): response = self.client.get(url_for('api_1_0.actiontemplatelist'), headers=self.auth.header) self.assertListEqual([self.at1.to_json(), self.at2.to_json()], response.get_json()) def test_action_template(self): response = self.client.get( url_for('api_1_0.actiontemplateresource', action_template_id="aaaaaaaa-1234-5678-1234-56781234aaa1"), headers=self.auth.header) self.assertDictEqual( self.at1.to_json(), response.get_json())
173bef981b78afc909cfcef7137f104224d65eba
f7c07caa1210d2a08e8433cdd854b1232efa88e3
/Basic-Python-Examples/Reading-Input.py
6a2261758bee80620c94908b12e5dff8ba5e9431
[]
no_license
rchicoli/ispycode-python
c2fbecc28bf32933150986d24f77b7297f50b78e
fa27f2377943ac2e4d983065406578151091e3f5
refs/heads/master
2020-03-20T11:34:59.698618
2018-06-14T21:14:02
2018-06-14T21:14:02
137,407,150
0
0
null
null
null
null
UTF-8
Python
false
false
70
py
var = raw_input("Enter something: ") print "You entered: ", var
e7a482ab473236d6774c1f06998aecde86703dd1
e78154abbb8bacf5afccda9da371684cbeabad36
/popego/popserver/popserver/db/.svn/text-base/migration_004.py.svn-base
b03ff10669d839bab29b9c43a3f116206f18bf1f
[ "BSD-3-Clause" ]
permissive
enterstudio/popego
1a196fabc374c0f45764e5c74bd7752236424040
2d09e793d9d2f297139edb325b8a70ddda9b2705
refs/heads/master
2021-04-09T16:39:40.781634
2016-10-14T16:53:47
2016-10-14T16:53:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
385
""" agregar columna para grupo distinguido en itemgroups """ __docformat__ = "restructuredtext" # I'm using a creative whitespace style that makes it readable both here # and when printed. migration = [ ("""\ ALTER TABLE itemgroups ADD COLUMN is_null_group BOOLEAN NOT NULL; """, """\ ALTER TABLE itemgroups DROP COLUMN is_null_group; """), ]
4aaf0372ce3ad85fcd307858db488117364e0b63
cb405bbb673711585ec36b9c9cf9e1c255579e83
/web/service/github/api/v3/users/SshKeys.py
67d609fd1471f4658286030e24db636d05bb71a7
[ "BSD-3-Clause", "CC0-1.0", "MIT", "Unlicense", "Apache-2.0" ]
permissive
ytyaru/Python.OTP.tools.201704200841
c5b265a6458d007ad9b1ad032b42a4eacb5944a3
120239f96e40467203939492fd7ad9c5967fac0f
refs/heads/master
2021-01-25T06:23:56.998622
2017-06-06T20:26:59
2017-06-06T20:26:59
93,560,782
1
0
null
null
null
null
UTF-8
Python
false
false
3,363
py
#!python3 #encoding:utf-8 import requests import datetime import time import json import web.service.github.api.v3.Response class SshKeys(object): def __init__(self, reqp, response): # def __init__(self): # self.__response = web.service.github.api.v3.Response.Response() self.__reqp = reqp self.__response = response """ SSH鍵の生成。 @params {string} public_keyはSSH公開鍵。 @params {string} titleはSSH公開鍵。 """ def Create(self, public_key, title=None): # def Create(self, mailaddress, public_key): # def Create(self, token, mailaddress, public_key): method = 'POST' endpoint = 'users/:username/keys' params = self.__reqp.Get(method, endpoint) # headers=self.__GetHeaders(token) # data=json.dumps({'title': mailaddress, 'key': public_key}) # params['data'] = json.dumps({'title': mailaddress, 'key': public_key}) params['data'] = json.dumps({'title': title, 'key': public_key}) url = 'https://api.github.com/user/keys' print(url) print(data) r = requests.post(url, **params) # r = requests.post(url, headers=headers, data=data) return self.__response.Get(r) def Gets(self, username): # def Gets(self, username, token): method = 'GET' endpoint = 'users/:username/keys' params = self.__reqp.Get(method, endpoint) keys = [] url = 'https://api.github.com/users/{username}/keys'.format(username=username) # headers=self.__GetHeaders(token) while None is not url: print(url) # r = requests.get(url, headers=headers) r = requests.get(url, **params) keys += self.__response.Get(r) url = self.__response.Headers.Link.Next(r) params = self.__reqp.Get(method, endpoint) return keys def Get(self, key_id): # def Get(self, token, key_id): method = 'GET' endpoint = 'user/keys/:id' params = self.__reqp.Get(method, endpoint) url = 'https://api.github.com/user/keys/{key_id}'.format(key_id=key_id) # headers=self.__GetHeaders(token) print(url) r = requests.get(url, **params) # r = requests.get(url, headers=headers) return self.__response.Get(r) """ GitHubに設定したSSH公開鍵を削除する。 BASIC認証でしか使えない。 """ def Delete(self, key_id): # def Delete(self, key_id, username, password, otp=None): method = 'DELETE' endpoint = 'user/keys/:id' params = self.__reqp.Get(method, endpoint) url = 'https://api.github.com/user/keys/{key_id}'.format(key_id=key_id) # headers=self.__GetHeaders(otp) print(url) r = requests.delete(url, **params) # r = requests.delete(url, headers=headers, auth=(username, password)) return self.__response.Get(r) def __GetHeaders(self, token=None, otp=None): headers = { 'Time-Zone': 'Asia/Tokyo', 'Accept': 'application/vnd.github.v3+json' } if None is not token: headers.update({'Authorization': 'token ' + token}) if None is not otp: headers.update({'X-GitHub-OTP': otp}) print(headers) return headers
b65865ec1ef0c354e6434848517d607c33532700
fb23ef7cffab7c23081d026e4bf6e642746ba5fa
/pytext/models/r3f_models.py
ccae7e70cb022880311ad97ec658d450bc65251a
[ "BSD-3-Clause" ]
permissive
thomascherickal/pytext
2558d597f4355e728cd9982dc29f2b857caed77d
da680540176436163ffd34136dd35a22f98dbb3c
refs/heads/master
2023-02-27T07:20:30.079053
2021-02-04T04:56:57
2021-02-04T04:58:44
336,046,191
1
0
NOASSERTION
2021-02-04T18:28:05
2021-02-04T18:28:04
null
UTF-8
Python
false
false
7,228
py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from contextlib import AbstractContextManager from enum import Enum from typing import Dict import torch import torch.nn.functional as F from pytext.common.constants import Stage from pytext.config import ConfigBase from pytext.utils.precision import maybe_float class R3FNoiseType(Enum): UNIFORM = "uniform" NORMAL = "normal" def build_noise_sampler(noise_type: R3FNoiseType, eps: float): """ Given a `noise_type` (`R3FNoiseType`): builds a `torch.distribution` capable of generating noise within the passed in `eps` (`float`). """ if noise_type == R3FNoiseType.UNIFORM: return torch.distributions.uniform.Uniform(low=-eps, high=eps) elif noise_type == R3FNoiseType.NORMAL: return torch.distributions.normal.Normal(loc=0.0, scale=eps) else: raise Exception(f"Unknown noise type: {noise_type}") def compute_symmetric_kl(noised_logits, input_logits): """ Computes symmetric KL loss by taking the KL for both the input logits and the noised logits and comparing the two """ return F.kl_div( F.log_softmax(noised_logits, dim=-1, dtype=torch.float32), F.softmax(input_logits, dim=-1, dtype=torch.float32), None, None, "sum", ) + F.kl_div( F.log_softmax(input_logits, dim=-1, dtype=torch.float32), F.softmax(noised_logits, dim=-1, dtype=torch.float32), None, None, "sum", ) # / noised_logits.size(0) class R3FConfigOptions(ConfigBase): """ Configuration options for models using R3F """ # for MTL purposes different lambda per loss r3f_lambda_by_loss: Dict[str, float] = {} r3f_default_lambda: float = 0.5 eps: float = 1e-5 noise_type: R3FNoiseType = R3FNoiseType.UNIFORM class R3FNoiseContextManager(AbstractContextManager): """ Context manager that adds a forward hook to the embedding module, to insert noise into the model and detatch embedding when doing this pass """ def __init__(self, context): self.encoder_hook = None self.decoder_hook = None self.context = context self.hook = self.context.get_embedding_module().register_forward_hook( self._hook_implementation ) def __enter__(self): return self.context def __exit__(self, type, value, traceback): self.hook.remove() self.hook = None def _hook_implementation(self, module, input, output): noise = self.context.noise_sampler.sample(sample_shape=output.shape).to(output) return output.clone().detach() + noise class R3FPyTextMixin(object): """ Mixin class for applying the R3F method, to apply R3F with any model inherit the class and implement the abstract functions. For more details: https://arxiv.org/abs/2008.03156 """ def __init__(self, config: R3FConfigOptions): self.r3f_lambda_by_loss = config.r3f_lambda_by_loss self.r3f_default_lambda = config.r3f_default_lambda self.r3f_eps = config.eps self.noise_sampler = build_noise_sampler(config.noise_type, self.r3f_eps) def get_embedding_module(self, *args, **kwargs): """ Given the core model outputs, this returns the embedding module that is used for the R3F loss, in particular noise will be injected to this module. """ raise NotImplementedError() def forward_with_noise(self, *args, **kwargs): with R3FNoiseContextManager(self): return self.original_forward(*args, **kwargs) def original_forward(self, *args, **kwargs): """ Runs the traditional forward of this model """ raise NotImplementedError() def get_sample_size(self, model_inputs, targets): """ Gets the sample size of the model that is used as a regularization factor to the model itself """ raise NotImplementedError() def get_r3f_model_output(self, model_output): """ Extracts the output from the model.forward() call that is used for the r3f loss term """ return model_output def forward(self, *args, use_r3f: bool = False, **kwargs): if use_r3f: # forward with the normal model model_output = self.original_forward( *args, **kwargs, ) # compute noised model outputs noise_model_outputs = self.forward_with_noise( *args, **kwargs, ) return model_output, noise_model_outputs else: return self.original_forward(*args, **kwargs) def get_r3f_loss_terms( self, model_outputs, noise_model_outputs, sample_size: int ) -> torch.Tensor: """ Computes the auxillary loss for R3F, in particular computes a symmetric KL divergence between the result from the input embedding and the noise input embedding. """ label_symm_kl = compute_symmetric_kl( self.get_r3f_model_output(noise_model_outputs), self.get_r3f_model_output(model_outputs), ) label_symm_kl = label_symm_kl # * sample_size return ( self.r3f_lambda_by_loss.get("label", self.r3f_default_lambda) * label_symm_kl ) @classmethod def train_batch(cls, model, batch, state=None): """ Runs training over a batch with the R3F method, training will use R3F while eval and test do not. """ # Forward pass through the network. model_inputs = model.arrange_model_inputs(batch) model_context = model.arrange_model_context(batch) targets = model.arrange_targets(batch) sample_size = model.get_sample_size(model_inputs=model_inputs, targets=targets) # get embedding r3f_loss_term = torch.tensor(0) if state and state.stage == Stage.TRAIN: # during training run R3F forward calls model_outputs, noise_model_outputs = model(*model_inputs, use_r3f=True) r3f_loss_term = model.get_r3f_loss_terms( model_outputs, noise_model_outputs, sample_size=sample_size ) else: # during eval and test don't run R3F forward model_outputs = model(*model_inputs, use_r3f=False) # Add stage to context. if state: if model_context is None: model_context = {"stage": state.stage, "epoch": state.epoch} else: model_context["stage"] = state.stage model_context["epoch"] = state.epoch # Compute loss and predictions. loss = maybe_float(model.get_loss(model_outputs, targets, model_context)) # add R3F loss term loss = loss + r3f_loss_term.to(loss.device) predictions, scores = model.get_pred(model_outputs, context=model_context) # Pack results and return them. metric_data = (predictions, targets, scores, loss, model_inputs) return loss, metric_data
d590ce824a5cb5b72f17a9cab92fbb89c815aae1
9743d5fd24822f79c156ad112229e25adb9ed6f6
/xai/brain/wordbase/otherforms/_brains.py
f3368e44fd4ab511605eb85187d524295c0a1b9c
[ "MIT" ]
permissive
cash2one/xai
de7adad1758f50dd6786bf0111e71a903f039b64
e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6
refs/heads/master
2021-01-19T12:33:54.964379
2017-01-28T02:00:50
2017-01-28T02:00:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
218
py
#calss header class _BRAINS(): def __init__(self,): self.name = "BRAINS" self.definitions = brain self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['brain']
59eac1215433b62efec457f6593d5623cc29ab49
933fc538fa7f1b304467b5e1a0ba7e155abbb535
/setup.py
9cc53f678f6035c91fc9ed565426d676a71e6390
[ "MIT" ]
permissive
PCKK123/geemap
f2f8d3ab59127b4399ecf005b2eca3cd91832791
ce65675ca4935076793e667f342e7be79a0ef6c5
refs/heads/master
2023-07-19T05:47:16.950807
2021-09-03T12:55:36
2021-09-03T12:55:36
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,024
py
#!/usr/bin/env python """The setup script.""" import platform from os import path as op import io from setuptools import setup, find_packages with open("README.rst") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() here = op.abspath(op.dirname(__file__)) # get the dependencies and installs with io.open(op.join(here, "requirements.txt"), encoding="utf-8") as f: all_reqs = f.read().split("\n") if platform.system() == "Windows": all_reqs.append("pywin32") install_requires = [x.strip() for x in all_reqs if "git+" not in x] dependency_links = [x.strip().replace("git+", "") for x in all_reqs if "git+" not in x] requirements = [ "Click>=7.0", ] setup_requirements = [] test_requirements = [] setup( author="Qiusheng Wu", author_email="[email protected]", python_requires=">=3.5", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", ], description="A Python package for interactive mapping using Google Earth Engine and ipyleaflet", entry_points={ "console_scripts": [ "geemap=geemap.cli:main", ], }, install_requires=install_requires, dependency_links=dependency_links, license="MIT license", long_description=readme + "\n\n" + history, include_package_data=True, keywords="geemap", name="geemap", packages=find_packages(include=["geemap", "geemap.*"]), setup_requires=setup_requirements, test_suite="tests", tests_require=test_requirements, url="https://github.com/giswqs/geemap", version="0.8.18", zip_safe=False, )
45b6c019f9d4399a36f8f1ceb7bd52afae6238cf
86a017dd4c8d4d77c511cc598190aaa9dc0ae3e8
/study_class.py
4441fdb2079687168ed046dbee0f5dd42d538569
[]
no_license
sungguenja/studying
fd7459eb9faa6488d7b63bf3884a92513daf3c54
719f4dfbda211c34de2a0c8cf3b9d3001f29fcec
refs/heads/master
2023-08-17T13:46:44.343780
2023-08-10T11:55:15
2023-08-10T11:55:15
232,306,053
0
0
null
2022-12-16T10:53:26
2020-01-07T11:00:28
Python
UTF-8
Python
false
false
756
py
class Shape: def __init__(self, length): self.__length = length def ar(self): return self.__length * self.__length def length(self): return self.__length class Squre(Shape): def __init__(self, length, area): super(Squre, self).__init__(length) self.__area=area def area(self): return self.__area def __repr__(self): return "{0}".format(super(Squre, self).ar()) N1=Squre(3, 9) print(N1) class Person: def __init__(self, gender): self.__gender = gender def gender(self): return self.__gender def __repr__(self): return "{0}".format(self.__gender) class Son(Person): def __init__(self, gender): super(Son, self).__init__(gender) def __repr__(self): return "{0}".format(super(Son, self).gender()) J1=Son("Male") J2=Son("Female") print(J1) print(J2)
b070add0a3c79d07ec513e5fb177ced969dc9b3b
7e41fd7f107a771b9bb52f9c58cd4afda6308044
/tool/modules/ip_misc.py
097f6e8f3e0122de2126eac3e6ed632e7dd051fc
[]
no_license
gisazae/SpoofingDetector
e6043bef4b8c28af63fd905963abbc89c954f4a8
0ba2d6dd7e91f629f8b83dc851faa4f301f53db7
refs/heads/master
2021-01-24T08:41:53.820723
2018-02-26T15:35:56
2018-02-26T15:35:56
122,988,293
0
0
null
null
null
null
UTF-8
Python
false
false
1,321
py
import re, os from scapy.all import * ''' Check if ip address is correctly formed ''' def check_IP(ip): pattern = re.compile("^(([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3})$") return pattern.match(ip) ''' Check if port number is between range 1-65535 ''' def check_port(port): return int(port) in range(1, 65536) ''' Enables IPv4 forwarding for routing purposes ''' def enable_forward(): os.system("echo 1 > /proc/sys/net/ipv4/ip_forward") ''' Disables IPv4 forwarding ''' def disable_forward(): os.system("echo 0 > /proc/sys/net/ipv4/ip_forward") ''' Redirects http traffic to this machine's proxy (sslstrip) ''' def start_http_redirect(port): os.system("iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port " + str(port)) ''' Stops http redirect to sslstrip proxy ''' def stop_http_redirect(port): os.system("iptables -t nat -D PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port " + str(port)) ''' Redirects DNS queries to this machine's DNS ''' def start_dns_redirect(): os.system("iptables -t nat -A PREROUTING -p udp --destination-port 53 -j REDIRECT --to-port 53") ''' Stops DNS query redirect ''' def stop_dns_redirect(): os.system("iptables -t nat -D PREROUTING -p udp --destination-port 53 -j REDIRECT --to-port 53")
bd672e59d39f51800c208d1f7209a8897e8f0889
c9ddbdb5678ba6e1c5c7e64adf2802ca16df778c
/cases/synthetic/class_def_attr-big-134.py
466ed590182cc1782fc6ea8ba942f3b937d480e4
[]
no_license
Virtlink/ccbench-chocopy
c3f7f6af6349aff6503196f727ef89f210a1eac8
c7efae43bf32696ee2b2ee781bdfe4f7730dec3f
refs/heads/main
2023-04-07T15:07:12.464038
2022-02-03T15:42:39
2022-02-03T15:42:39
451,969,776
0
0
null
null
null
null
UTF-8
Python
false
false
1,300
py
class A(object): x:int = 1 class A2(object): x:int = 1 x2:int = 1 class A3(object): x:int = 1 x2:int = 1 x3:int = 1 class A4(object): x:int = 1 x2:int = 1 x3:int = 1 x4:int = 1 class A5(object): x:int = 1 x2:int = 1 x3:int = $Literal x4:int = 1 x5:int = 1 class B(A): def __init__(self: "B"): pass class B2(A): def __init__(self: "B2"): pass class B3(A): def __init__(self: "B3"): pass class B4(A): def __init__(self: "B4"): pass class B5(A): def __init__(self: "B5"): pass class C(B): z:bool = True class C2(B): z:bool = True z2:bool = True class C3(B): z:bool = True z2:bool = True z3:bool = True class C4(B): z:bool = True z2:bool = True z3:bool = True z4:bool = True class C5(B): z:bool = True z2:bool = True z3:bool = True z4:bool = True z5:bool = True a:A = None a2:A = None a3:A = None a4:A = None a5:A = None b:B = None b2:B = None b3:B = None b4:B = None b5:B = None c:C = None c2:C = None c3:C = None c4:C = None c5:C = None a = A() a2 = A() a3 = A() a4 = A() a5 = A() b = B() b2 = B() b3 = B() b4 = B() b5 = B() c = C() c2 = C() c3 = C() c4 = C() c5 = C() a.x = 1 b.x = a.x c.z = a.x == b.x
13385c1bac21e9f6d94674d6956396df3909b0ad
dd3f5a712dbab0d3c4f4526c64c08ba710f78b81
/Basic/pachong/t04proxy.py
ff16307fbb87fb20b693ba29b62a7d190f6c04e9
[]
no_license
nameusea/pyGreat
3988ebcce3f80a7e458a20f9b2e3ccba368efcf8
dde8b6a1348620ffd3b2d65db3d5b4331e5c78be
refs/heads/master
2023-04-25T09:02:32.831423
2021-05-17T11:31:22
2021-05-17T11:31:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,590
py
import requests from bs4 import BeautifulSoup import json # https://wanakiki.github.io/2020/spider-with-proxy/ class GetIp(object): """抓取代理IP""" def __init__(self): """初始化变量""" self.url = 'http://www.xicidaili.com/nt/' self.check_url = 'https://www.ip.cn/' self.ip_list = [] @staticmethod def get_html(url): """请求html页面信息""" header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' } try: request = requests.get(url=url, headers=header) request.encoding = 'utf-8' html = request.text return html except Exception as e: return '' def get_available_ip(self, ip_address, ip_port): """检测IP地址是否可用""" header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' } ip_url_next = '://' + ip_address + ':' + ip_port proxies = {'http': 'http' + ip_url_next, 'https': 'https' + ip_url_next} try: r = requests.get(self.check_url, headers=header, proxies=proxies, timeout=2) html = r.text except: print('fail-%s' % ip_address) else: print('success-%s' % ip_address) soup = BeautifulSoup(html, 'lxml') div = soup.find(class_='well') if div: print(div.text) ip_info = {'address': ip_address, 'port': ip_port} self.ip_list.append(ip_info) # 可以用的ip保存到self.ip_list def main(self): """主方法""" for i in range(1, 10): # 从这个网站上检测n页的ip web_html = self.get_html(self.url+str(i)) soup = BeautifulSoup(web_html, 'lxml') ip_list = soup.find(id='ip_list').find_all('tr') for ip_info in ip_list: td_list = ip_info.find_all('td') if len(td_list) > 0: ip_address = td_list[1].text ip_port = td_list[2].text # 检测IP地址是否有效 self.get_available_ip(ip_address, ip_port) # 写入有效文件 with open('data/ip.txt', 'w') as file: json.dump(self.ip_list, file) print(self.ip_list) # 程序主入口 if __name__ == '__main__': get_ip = GetIp() get_ip.main()
2ce825ca6f6f248267a0b77f24692ef69ed28d5c
f07a42f652f46106dee4749277d41c302e2b7406
/Data Set/bug-fixing-5/de4a8b83df05373c8295f9771315d9a23bc2b591-<convert_mongo_result_to_valid_json>-fix.py
9e4aeda3cd4e73fb96be34588cc02ac29c6a781b
[]
no_license
wsgan001/PyFPattern
e0fe06341cc5d51b3ad0fe29b84098d140ed54d1
cc347e32745f99c0cd95e79a18ddacc4574d7faa
refs/heads/main
2023-08-25T23:48:26.112133
2021-10-23T14:11:22
2021-10-23T14:11:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
838
py
def convert_mongo_result_to_valid_json(self, result): if (result is None): return result if isinstance(result, (integer_types + (float, bool))): return result if isinstance(result, string_types): return result elif isinstance(result, list): new_list = [] for elem in result: new_list.append(self.convert_mongo_result_to_valid_json(elem)) return new_list elif isinstance(result, dict): new_dict = { } for key in result.keys(): value = result[key] new_dict[key] = self.convert_mongo_result_to_valid_json(value) return new_dict elif isinstance(result, datetime.datetime): return (result - datetime.datetime(1970, 1, 1)).total_seconds() else: return '{}'.format(result)
4a0d71573f39fb6949ac84ec04eeedf104afda83
17bdba01253b57e0b74b20a44dae067a643c8b86
/ingenico/connect/sdk/domain/mandates/definitions/mandate_customer.py
e2fca0a6b17e66a4039b901f4e2e929a2e8f319f
[ "MIT" ]
permissive
BEAM-ZILLOW/connect-sdk-python3
04b18733216d1e8b5e5c724e315ed02de6b83aca
0355389ddb096edc19d770c8b8499bd3351d2b3d
refs/heads/master
2020-04-12T17:50:03.259747
2018-11-08T09:59:43
2018-11-08T09:59:43
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,861
py
# -*- coding: utf-8 -*- # # This class was auto-generated from the API references found at # https://epayments-api.developer-ingenico.com/s2sapi/v1/ # from ingenico.connect.sdk.data_object import DataObject from ingenico.connect.sdk.domain.definitions.bank_account_iban import BankAccountIban from ingenico.connect.sdk.domain.mandates.definitions.mandate_address import MandateAddress from ingenico.connect.sdk.domain.mandates.definitions.mandate_contact_details import MandateContactDetails from ingenico.connect.sdk.domain.mandates.definitions.mandate_personal_information import MandatePersonalInformation class MandateCustomer(DataObject): __bank_account_iban = None __company_name = None __contact_details = None __mandate_address = None __personal_information = None @property def bank_account_iban(self): """ | Object containing IBAN information Type: :class:`ingenico.connect.sdk.domain.definitions.bank_account_iban.BankAccountIban` """ return self.__bank_account_iban @bank_account_iban.setter def bank_account_iban(self, value): self.__bank_account_iban = value @property def company_name(self): """ | Name of company, as a consumer Type: str """ return self.__company_name @company_name.setter def company_name(self, value): self.__company_name = value @property def contact_details(self): """ | Object containing contact details like email address and phone number Type: :class:`ingenico.connect.sdk.domain.mandates.definitions.mandate_contact_details.MandateContactDetails` """ return self.__contact_details @contact_details.setter def contact_details(self, value): self.__contact_details = value @property def mandate_address(self): """ | Object containing billing address details Type: :class:`ingenico.connect.sdk.domain.mandates.definitions.mandate_address.MandateAddress` """ return self.__mandate_address @mandate_address.setter def mandate_address(self, value): self.__mandate_address = value @property def personal_information(self): """ | Object containing personal information of the consumer Type: :class:`ingenico.connect.sdk.domain.mandates.definitions.mandate_personal_information.MandatePersonalInformation` """ return self.__personal_information @personal_information.setter def personal_information(self, value): self.__personal_information = value def to_dictionary(self): dictionary = super(MandateCustomer, self).to_dictionary() self._add_to_dictionary(dictionary, 'bankAccountIban', self.bank_account_iban) self._add_to_dictionary(dictionary, 'companyName', self.company_name) self._add_to_dictionary(dictionary, 'contactDetails', self.contact_details) self._add_to_dictionary(dictionary, 'mandateAddress', self.mandate_address) self._add_to_dictionary(dictionary, 'personalInformation', self.personal_information) return dictionary def from_dictionary(self, dictionary): super(MandateCustomer, self).from_dictionary(dictionary) if 'bankAccountIban' in dictionary: if not isinstance(dictionary['bankAccountIban'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['bankAccountIban'])) value = BankAccountIban() self.bank_account_iban = value.from_dictionary(dictionary['bankAccountIban']) if 'companyName' in dictionary: self.company_name = dictionary['companyName'] if 'contactDetails' in dictionary: if not isinstance(dictionary['contactDetails'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['contactDetails'])) value = MandateContactDetails() self.contact_details = value.from_dictionary(dictionary['contactDetails']) if 'mandateAddress' in dictionary: if not isinstance(dictionary['mandateAddress'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['mandateAddress'])) value = MandateAddress() self.mandate_address = value.from_dictionary(dictionary['mandateAddress']) if 'personalInformation' in dictionary: if not isinstance(dictionary['personalInformation'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['personalInformation'])) value = MandatePersonalInformation() self.personal_information = value.from_dictionary(dictionary['personalInformation']) return self
769ee646685638845b9b0dbcf4b77df4a9ac8a52
8b124607a1227013b05b9af9c6a6888200d8f67d
/spider/bookinfo/middlewares.py
18e1e908f8c17208c57e16c7afd0f1051ebc48b9
[ "Apache-2.0" ]
permissive
zzzz123321/Broadview-analysing-sales-figures
f32fcd4b41f00af59a44a09e744523199a17a9f6
bdff4239fd71b5077bc05703757d9f5d2610c536
refs/heads/master
2020-04-27T18:06:22.240431
2018-03-05T09:17:29
2018-03-05T09:17:29
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,319
py
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # http://doc.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals import random from bookinfo.settings import IPPOOL from scrapy.downloadermiddlewares.httpproxy import HttpProxyMiddleware class IPPOOLS(HttpProxyMiddleware): def __init__(self, ip=''): self.ip = ip def process_request(self, request, spider): thisip = random.choice(IPPOOL) # print('当前的IP是:'+thisip['ipaddr']) request.meta['proxy']="http://"+thisip['ipaddr'] class BookinfoSpiderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrapy acts as if the spider middleware does not modify the # passed objects. @classmethod def from_crawler(cls, crawler): # This method is used by Scrapy to create your spiders. s = cls() crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) return s def process_spider_input(self, response, spider): # Called for each response that goes through the spider # middleware and into the spider. # Should return None or raise an exception. return None def process_spider_output(self, response, result, spider): # Called with the results returned from the Spider, after # it has processed the response. # Must return an iterable of Request, dict or Item objects. for i in result: yield i def process_spider_exception(self, response, exception, spider): # Called when a spider or process_spider_input() method # (from other spider middleware) raises an exception. # Should return either None or an iterable of Response, dict # or Item objects. pass def process_start_requests(self, start_requests, spider): # Called with the start requests of the spider, and works # similarly to the process_spider_output() method, except # that it doesn’t have a response associated. # Must return only requests (not items). for r in start_requests: yield r def spider_opened(self, spider): spider.logger.info('Spider opened: %s' % spider.name)
ef7ace55198ec861fcb052180a141fca5b563670
f1961c86e6da14f35c21d7235f4fc8a89fabdcad
/DailyProgrammer/DP20160527C.py
5e886c195faa15637218b42b98ecb6636fdaec9c
[ "MIT" ]
permissive
DayGitH/Python-Challenges
d4930bdd85cd1a977d8f6192775ca956a375fcde
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
refs/heads/master
2021-01-17T13:01:03.784523
2018-06-29T23:49:04
2018-06-29T23:49:04
58,497,683
2
0
null
null
null
null
UTF-8
Python
false
false
3,641
py
""" [2016-05-27] Challenge #268 [Hard] Network and Cards: Part 3, The cheaters https://www.reddit.com/r/dailyprogrammer/comments/4lavv6/20160527_challenge_268_hard_network_and_cards/ #Description This week we are creating a game playable over network. This will be a 3-parter. The third part is going to be even more interaction, and some cheating, card players love to cheat. We are going to play a modified version of Blackjack: Each player is dealt 1 covered card at the start of the game. When a player decides to take a card het recieves that card covered and then has to decide which one to play and which one to hold. Player send the card open over the network back to the server. Starting stays the same: When all connected clients send a `START` command, the game will begin, you don't have to look for other connections then. The communication goes as followed: CLIENT A -> SERVER: START CLIENT B -> SERVER: START SERVER -> CLIENT A: Ace of spades SERVER -> CLIENT B: 4 of clubs SERVER -> CLIENT A: TAKE or PASS CLIENT A -> SERVER: TAKE SERVER -> CLIENT A: Queen of hearts CLIENT A -> SERVER: PLAY Ace of spades SERVER -> CLIENT B: TAKE or PASS CLIENT B -> SERVER: PASS The client has the option to either respond with a `TAKE` command, folowed by a `PLAY` or `PASS` command, the server then go to the next client till everyone is done (all passed or everyone has 21 or more in score) The cards have the following values: 2 -> 2 3 -> 3 4 -> 4 5 -> 5 6 -> 6 7 -> 7 8 -> 8 9 -> 9 Jack -> 10 Queen -> 10 King -> 10 Ace -> 1 or 11 (11 if not over 21 and 1 if over) #Formal Inputs & Outputs ##Input description - Server Server has to accept at least 4 commands: `START`, `TAKE`, `PLAY` and `PASS` - Client Clients must be able to recieve the choice for `TAKE` and `PASS` and must be able to recieve cards, format of that is up to you ##Output description - Server No Output required, but I can imagen that some loggin will be handy. - Client A decent output for humans to read the cards and see their current score. Also must know when to type in the option to `TAKE` and `PASS` #Notes/Hints ## TCP Socket approach The server needs to able to handle multiple clients in the end, so a multithreaded approach is advised. It is advised to think of some command like pattern, so you can send messages to the server and back. For the server and client, just pick some random ports that you can use. [Here](https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers) you have a list off all "reserved" ports. For the connection, TCP connections are the easiest way to do this in most languages. But you are not limited to that if you want to use something more high-level if your language of choice supports that. ## REST api approach Some off you pointed out that this could be done with a webserver. If this is more in the line of what you are used to, no problem then, as long as it stays in the line of a multiplayer game. #Bonus Examine the game logic from a other submissions (or your own) and try to create a cheating bot. If a programmer forgets to add checks or some sort, you can exploit these. **HOWEVER**: **If you are not up for that, put it in your submission. I don't want to see any bragging, I want this to be fun. Please be respectfull to other people at all time.** **I will monitor this closely and any hurtful comment will be deleted** #Finally Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas """ def main(): pass if __name__ == "__main__": main()
ada2bcb6a2c7f0e34aad00da2a1dec1042a2ce24
0be5c80361a12ef7b56d3da8ce64cc1ab80a5ada
/todo_app/forms.py
807cfe1aa1b023703185a0585df2b8d10847d0f3
[]
no_license
swaraj70/TaskTodo
a73492afdd0c0920dea315681b400ac61a8ceb1f
652ef2a096055b2d96aa8122bb9825e5de79da8c
refs/heads/master
2023-04-29T02:46:11.406996
2020-02-14T05:47:41
2020-02-14T05:47:41
224,838,456
0
0
null
2023-04-21T20:41:35
2019-11-29T11:10:18
Python
UTF-8
Python
false
false
154
py
from django import forms from .models import Task class TaskForm(forms.ModelForm): class Meta: model = Task fields = ['task', 'done']
fa5d2b4c4e8ebff5883ae88aca6ee894eab5a525
e21599d08d2df9dac2dee21643001c0f7c73b24f
/practice/ai/pic/simular/pil_sample2.py
c5c9cc3432ed46ccad315b22eff21bde3567adb1
[]
no_license
herolibra/PyCodeComplete
c7bf2fb4ce395737f8c67749148de98a36a71035
4ef7d2c3aec6d28a53eed0e649cdeb74df3d783b
refs/heads/master
2022-07-17T05:39:03.554760
2020-05-03T07:00:14
2020-05-03T07:00:14
null
0
0
null
null
null
null
UTF-8
Python
false
false
571
py
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian from PIL import Image import math import operator from functools import reduce def image_contrast(img1, img2): image1 = Image.open(img1) image2 = Image.open(img2) h1 = image1.histogram() h2 = image2.histogram() result = math.sqrt(reduce(operator.add, list(map(lambda a, b: (a - b) ** 2, h1, h2))) / len(h1)) return result if __name__ == '__main__': img1 = "1.png" # 指定图片路径 img2 = "2.png" result = image_contrast(img1, img2) print((100 - result), "%")
58250e8bea0428c8b376e7e5f633cdc6431591e3
65f8211fc33eb5f9ac1ff0d68902226ca9a58692
/sorting_algorithms/quick_sort_cormen.py
9fdd4284ab2ac365d12a921a94e243eead478568
[]
no_license
szarbartosz/asd-python
46869f5699a1ef661e2df02e523af0adcddbbbda
0130cc3dcbba6ad62e1516c98b5cbab85848d619
refs/heads/master
2022-12-13T19:02:53.699381
2020-09-11T13:29:31
2020-09-11T13:29:31
242,975,318
0
0
null
null
null
null
UTF-8
Python
false
false
602
py
def partition(arr, left, right): i = left - 1 pivot = arr[right] for j in range(left, right): if arr[j] <= pivot: i += 1 arr[i], arr[j] = arr[j], arr[i] arr[i+1], arr[right] = arr[right], arr[i+1] return i + 1 def quick_sort(arr, left, right): if right > left: mid = partition(arr, left, right) quick_sort(arr, left, mid - 1) quick_sort(arr, mid + 1, right) if __name__ == '__main__': arr = [54,3234,32,54,54376,4,3,52,34,1,43,5,26,37,45,23,432,52,36] print(arr) quick_sort(arr,0,len(arr)-1) print(arr)
8a6ca59bb06502011b10a473553ad89562b21f6f
deb246d7cb1ce4ea57bba7e1b3c9964c503a0852
/khmer/khmerEnv/lib/python2.7/site-packages/screed/screedRecord.py
92eeb4728973624c2c3790803d7968f153a2c4dc
[]
no_license
chelseaju/TahcoRoll
89fec5e7d3f8658b3647cb01fb5d3dba90dc74a4
3a5978cd48d728c3ee36afcf95dec82cec58d7e1
refs/heads/master
2021-04-25T15:40:53.545677
2019-09-25T14:09:17
2019-09-25T14:09:17
109,560,971
2
0
null
null
null
null
UTF-8
Python
false
false
6,955
py
# Copyright (c) 2016, The Regents of the University of California. from __future__ import absolute_import from functools import total_ordering import types from . import DBConstants import gzip import bz2 from io import BytesIO try: from collections import MutableMapping except ImportError: import UserDict MutableMapping = UserDict.DictMixin class Record(MutableMapping): """ Simple dict-like record interface with bag behavior. """ def __init__(self, name=None, sequence=None, **kwargs): d = dict() if name is not None: d['name'] = name if sequence is not None: d['sequence'] = sequence d.update(kwargs) if 'quality' in d and d['quality'] is None: del d['quality'] self.d = d def __setitem__(self, name, value): self.d[name] = value def __getattr__(self, name): try: return self.d[name] except KeyError: raise AttributeError(name) def __len__(self): return len(self.sequence) def keys(self): return self.d.keys() def __getitem__(self, idx): if isinstance(idx, slice): trimmed = dict(self.d) trimmed['sequence'] = trimmed['sequence'][idx] if 'quality' in trimmed: trimmed['quality'] = trimmed['quality'][idx] return Record(**trimmed) return self.d[idx] def __delitem__(self, key): del self.d[key] def __iter__(self): return iter(self.d) def __repr__(self): return repr(self.d) @total_ordering class _screed_attr(object): """ Sliceable database object that supports lazy retrieval """ def __init__(self, dbObj, attrName, rowName, queryBy): """ Initializes database object with specific record retrieval information dbOjb = database handle attrName = name of attr in db rowName = index/name of row queryBy = by name or index """ self._dbObj = dbObj self._attrName = attrName self._rowName = rowName self._queryBy = queryBy def __getitem__(self, sliceObj): """ Slicing interface. Returns the slice range given. *.start + 1 to be compatible with sqlite's 1 not 0 scheme """ if not isinstance(sliceObj, slice): raise TypeError('__getitem__ argument must be of slice type') if not sliceObj.start <= sliceObj.stop: # String reverse in future? raise ValueError('start must be less than stop in slice object') length = sliceObj.stop - sliceObj.start query = 'SELECT substr(%s, %d, %d) FROM %s WHERE %s = ?' \ % (self._attrName, sliceObj.start + 1, length, DBConstants._DICT_TABLE, self._queryBy) cur = self._dbObj.cursor() result = cur.execute(query, (str(self._rowName),)) try: subStr, = result.fetchone() except TypeError: raise KeyError("Key %s not found" % self._rowName) return str(subStr) def __len__(self): """ Returns the length of the string """ return len(self.__str__()) def __repr__(self): """ Prints out the name of the class and the name of the sliceable attr """ return "<%s '%s'>" % (self.__class__.__name__, self._attrName) def __eq__(self, given): """ Compares attribute to given object in string form """ if isinstance(given, bytes): return given == self.__str__() else: return str(given) == self.__str__() def __lt__(self, given): if isinstance(given, bytes): return self.__str__() < given else: return self.__str__() < str(given) def __str__(self): """ Returns the full attribute as a string """ query = 'SELECT %s FROM %s WHERE %s = ?' \ % (self._attrName, DBConstants._DICT_TABLE, self._queryBy) cur = self._dbObj.cursor() result = cur.execute(query, (str(self._rowName),)) try: record, = result.fetchone() except TypeError: raise KeyError("Key %s not found" % self._rowName) return str(record) def _buildRecord(fieldTuple, dbObj, rowName, queryBy): """ Constructs a dict-like object with record attribute names as keys and _screed_attr objects as values """ # Separate the lazy and full retrieval objects kvResult = [] fullRetrievals = [] for fieldname, role in fieldTuple: if role == DBConstants._SLICEABLE_TEXT: kvResult.append((fieldname, _screed_attr(dbObj, fieldname, rowName, queryBy))) else: fullRetrievals.append(fieldname) # Retrieve the full text fields from the db subs = ','.join(fullRetrievals) query = 'SELECT %s FROM %s WHERE %s=?' % \ (subs, DBConstants._DICT_TABLE, queryBy) cur = dbObj.cursor() res = cur.execute(query, (rowName,)) # Add the full text fields to the result tuple list data = tuple([str(r) for r in res.fetchone()]) kvResult.extend(zip(fullRetrievals, data)) # Hack to make indexing start at 0 hackedResult = [] for key, value in kvResult: if key == DBConstants._PRIMARY_KEY: hackedResult.append((key, int(value) - 1)) else: hackedResult.append((key, value)) return Record(**dict(hackedResult)) def write_fastx(record, fileobj): """Write sequence record to 'fileobj' in FASTA/FASTQ format.""" isbytesio = isinstance(fileobj, BytesIO) iswb = hasattr(fileobj, 'mode') and fileobj.mode == 'wb' outputvalid = isbytesio or iswb if not outputvalid: message = ('cannot call "write_fastx" on object, must be of a file ' 'handle with mode "wb" or an instance of "BytesIO"') raise AttributeError(message) defline = record.name if hasattr(record, 'description'): defline += ' ' + record.description if hasattr(record, 'quality'): recstr = '@{defline}\n{sequence}\n+\n{quality}\n'.format( defline=defline, sequence=record.sequence, quality=record.quality) else: recstr = '>{defline}\n{sequence}\n'.format( defline=defline, sequence=record.sequence) fileobj.write(recstr.encode('utf-8')) def write_fastx_pair(read1, read2, fileobj): """Write a pair of sequence records to 'fileobj' in FASTA/FASTQ format.""" if hasattr(read1, 'quality'): assert hasattr(read2, 'quality') write_record(read1, fileobj) write_record(read2, fileobj)
1833fec4a3f82304da532eae0b5d78201329410c
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p02639/s177403462.py
63231992385318309a365b6c65bf958be32e4f02
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
81
py
n = input().split(" ") for i,j in enumerate(n,1): if 0 == int(j): print(i)
aa01639593c0e01a1ab90ad30ead31133d9cf437
5ff8cefa68d52d2427bb3d35320cd8bd0d072968
/JSONExamples/json_example4.py
be53a2d1703a54c3dd3e258d42f84b2c9021dfef
[]
no_license
gsudarshan1990/PythonSampleProjects
a65a111454f8dc551f1cd29901cead0798ad6dc3
3c1a5174c5f966b0eed2828221add76ec0d019d5
refs/heads/master
2020-05-09T16:02:37.743568
2019-07-14T06:22:55
2019-07-14T06:22:55
181,255,262
1
0
null
null
null
null
UTF-8
Python
false
false
110
py
import json data={ 'a':True, 'b':'Hello', 'c':None } print(json.dumps(data))
99a3675e71c362c414c8ea7f39d3da678a6336ac
45614a944ffbdb75a0bef955582a722da5ce7492
/python/app.py
e7011353a8b938a296f146d092cafebdb5a08972
[]
no_license
wccgoog/pass
1c8ab5393547634a27c7543556a75dec771a9e3d
0ec01536ae10b3d99707002c0e726072acb50231
refs/heads/2
2023-01-15T13:27:26.312648
2019-10-23T09:30:45
2019-10-23T09:30:45
122,595,075
0
2
null
2023-01-07T10:42:38
2018-02-23T08:38:36
JavaScript
UTF-8
Python
false
false
639
py
from flask import Flask,request,render_template app=Flask(__name__) @app.route('/',methods=['GET','POST']) def home(): return render_template('home.html') @app.route('/signin',methods=['GET']) def signin_form(): return render_template('form.html') @app.route('/signin',methods=['POST']) def signin(): username=request.form['username'] password=request.form['password'] if username=='admin' and password=='password': return render_template('signin-ok.html',username=username) return render_template('form.html',message='Bad username or password',username=username) if __name__=='__main__': app.run()
351e42f616d21721a870b7c8092d090c713bcead
2a603f33f109df24e55d392b124dad3f51922075
/0x11-python-network_1/5-hbtn_header.py
e67a32a20f51e94d671ba94a4ce7735bbdc91470
[]
no_license
michellegsld/holbertonschool-higher_level_programming
bc010270904ec2638953afea8fcfd650159e38ac
c6a3a4b2eb80b45708becfa3b08249c3e86294e8
refs/heads/master
2023-06-08T21:06:34.401385
2023-06-06T02:25:03
2023-06-06T02:25:03
226,925,789
0
0
null
null
null
null
UTF-8
Python
false
false
282
py
#!/usr/bin/python3 """ Task 5: Sends a request and displays the value of X-Request-Id 5-hbtn_header.py """ import requests from sys import argv if __name__ == "__main__": req = requests.get(argv[1]) try: print(req.headers["X-Request-Id"]) except: pass
04c96bdf8c7d21cf82ad54365d7d445b04fd42ef
71e2ff113d8b0de6708c7b6165d01a7bbb199b41
/main.py
c273fb85ebc326ecbd9eb80415a83e91f7653d41
[]
no_license
MJB90/timeSeries
3b506b4659121fb58984c358d3ef50a66909df21
0b54fe1f06df5e12f26b5b3a0d210b4f86492414
refs/heads/master
2020-04-20T15:05:22.759585
2019-02-03T12:00:36
2019-02-03T12:00:36
168,918,799
0
0
null
null
null
null
UTF-8
Python
false
false
2,761
py
import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime from pandas import Series import barplot as bp import warnings warnings.filterwarnings("ignore") train = pd.read_csv("data/Train_SU63ISt.csv") test = pd.read_csv("data/Test_0qrQsBZ.csv") train_original = train.copy() test_original = test.copy() ########################################################################## # Exploratory Analysis train['Datetime'] = pd.to_datetime(train.Datetime, format='%d-%m-%Y %H:%M') test['Datetime'] = pd.to_datetime(test.Datetime, format='%d-%m-%Y %H:%M') test_original['Datetime'] = pd.to_datetime(test_original.Datetime, format='%d-%m-%Y %H:%M') train_original['Datetime'] = pd.to_datetime(train_original.Datetime, format='%d-%m-%Y %H:%M') for i in (train, test, test_original, train_original): i['year'] = i.Datetime.dt.year i['month'] = i.Datetime.dt.month i['day'] = i.Datetime.dt.day i['Hour'] = i.Datetime.dt.hour train['day of week'] = train['Datetime'].dt.dayofweek temp = train['Datetime'] # This functions adds a boolean value 1 if the current day is a weekend def is_weekend(row): if row.dayofweek == 5 or row.dayofweek == 6: return 1 else: return 0 temp2 = train['Datetime'].apply(is_weekend) train['weekend'] = temp2 # train.index = train['Datetime'] # indexing the Datetime to get the time period on the x-axis. # df = train.drop('ID', 1) # drop ID variable to get only the Datetime on x-axis. # ts = df['Count'] # # plt.figure(figsize=(16, 8)) # # plt.plot(ts, label='Passenger Count') # # plt.title('Time Series') # # plt.xlabel("Time(year-month)") # # plt.ylabel("Passenger count") # # plt.legend(loc='best') # # plt.show() # # temp_data = train.groupby('month')['Count'].mean() # x_axis_data = temp_data.index # y_axis_data = temp_data[:] # bp.plot_bar_x(x_axis_data, y_axis_data, 'Month', 'Count', 'Monthly Count') ####################################################################################### # Splitting and forecasting train=train.drop('ID', 1) test.Timestamp = pd.to_datetime(test.Datetime, format='%d-%m-%Y %H:%M') test.index = test.Timestamp # Converting to daily mean test = test.resample('D').mean() train.Timestamp = pd.to_datetime(train.Datetime, format='%d-%m-%Y %H:%M') train.index = train.Timestamp # Converting to daily mean train = train.resample('D').mean() Train = train.ix['2012-08-25':'2014-06-24'] valid = train.ix['2014-06-25':'2014-09-25'] Train.Count.plot(figsize=(15,8), title= 'Daily Ridership', fontsize=14, label='train') valid.Count.plot(figsize=(15,8), title= 'Daily Ridership', fontsize=14, label='valid') plt.xlabel("Datetime") plt.ylabel("Passenger count") plt.legend(loc='best') plt.show()
505673351e030e7d2af76e424060f7004776000d
0178e6a705ee8aa6bb0b0a8512bf5184a9d00ded
/Sungjin/Test/20200913/no5.py
f3ff5d569814fd515de2f7def1d85af6ec47365a
[]
no_license
comojin1994/Algorithm_Study
0379d513abf30e3f55d6a013e90329bfdfa5adcc
965c97a9b858565c68ac029f852a1c2218369e0b
refs/heads/master
2021-08-08T14:55:15.220412
2021-07-06T11:54:33
2021-07-06T11:54:33
206,978,984
0
1
null
2020-05-14T14:06:46
2019-09-07T14:23:31
Python
UTF-8
Python
false
false
68
py
def solution(): pass if __name__ == '__main__': solution()
fdbf80ce6ac0265975d02e5efdc5009f07131870
ecf2511642e0e8fb11616249b062a7c8a130d137
/src/python_files/GenOpSpace.py
ef84cc5eff5f24db805665ab5b9ae3245e96df93
[]
no_license
zaddan/apx_tool_chain
61abc9d6958ce17d9823ac7bf71ae3097f76decf
ef81dd6515f110d3c8a4b62a642d44d9a4327a79
refs/heads/master
2021-01-24T06:37:12.248020
2017-04-08T20:39:08
2017-04-08T20:39:08
40,195,826
0
0
null
null
null
null
UTF-8
Python
false
false
3,515
py
import itertools import sys # Copyright (C) # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ## # @file GenOpSpace.py # @brief this file contains the class for generating all the possible apx version of an operation that is defined as a class # @author Behzad Boroujerdian # @date 2015-06-30 ## # @brief this class generates all the possible versions of a specific operator. it ueses the name to figure out the type of input. for example, in the case of multipliation, it generates all the multipliactions possible such as accurate and apx version (apx versions can have different kinds) #some of the inputs are just names and some of the inputs are ranges and need to be first generated and then permutated. #for example the name passed to this class, is just one element and doesn't need to be expanded, but the rest of the inputs acquire a low bound and high bound #the way to use this class is the following way: #set the numberOfInputs. For example in the case of Eta1 the number of inputs equal 8. These inputs include the low bound and high bound of the followi ## class GenOpSpace(): def __init__(self, name, numberOfInputs, lInput): self.name = [name] self.inputList = [] #this list containg the input that user provided (this can vary from Op to Op. for example in the case of GenEta1Input, this list contains #NtLB, NtHB, NiaLB, NiaHB, msbLB, msbHB, lsbLB, lsbHB): self.eachCategoryAllValues = [] #this list stores all the values possible for each input catgory. for example in the case of Eta1 the categories are: #Nia, msb, lsb, Nt self.numberOfInputs = numberOfInputs for i in range(0, self.numberOfInputs): self.inputList.append(lInput[i]) self.combineList = [] #putting all the values of different categories in one list self.permutedTuples= [] #using itertool to generate all the permutations of the combineList self.permutedList= [] #converting the permutedTuples from tuple form to listForm def sweepInput(self): self.combineList.append(self.name); for i in range(0, self.numberOfInputs, 2): self.eachCategoryAllValues.append(range(self.inputList[i], self.inputList[i+1])) self.combineList.append(self.eachCategoryAllValues[i/2]) self.permutedTuples= list(itertools.product(*(self.combineList))) for element in self.permutedTuples: self.permutedList.append(list(element)); #print self.permutedList def printPermutations(self): print self.permutedList #testing framework #GenOps = [GenOpSpace("Eta", 8,[1,4, 2,6, 3,5, 4, 6]), GenOpSpace("btm", 4,[10, 11, 100, 110])] #for element in GenOps: # element.sweepInput() # element.printPermutations() #
49bf830762b81466bff733629a5327e18941cf7f
e48704e1529fe6dcfed8328b0195e3869e90241b
/main.py
170b3e26c8c7effdfbf03d812353ecc4a1256bfb
[]
no_license
samuelitwaru/bar_and_restaurant
0401191856f29204174bb3259fdf320319344291
fb07bc128030bbb630b725871fea4454178fd1e6
refs/heads/master
2022-04-11T18:20:59.302667
2020-02-18T04:09:46
2020-02-18T04:09:46
241,265,070
0
0
null
null
null
null
UTF-8
Python
false
false
37
py
from Application import app app.run()
dd8773b77d7fa2bcd6b31071a9e5977a94c1c361
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p04012/s423711812.py
60a1ba317ede087b3ef712ef71d15a4b45103d18
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
116
py
w = input() for i in range(26): if w.count(chr(97+i)) % 2 == 1: print('No') exit() print('Yes')
e18d24a68f51f405a4f8e4d13943f2abec5d6f23
6bf995003dfe009129f7d93b63ec2478927324e0
/backends/ubpf/tests/ptf/tunneling_test.py
cbc00770d83b8bdcef665d28aa9a236075469f62
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
p4lang/p4c
e9fd8acfa25a6e1e42adffd136cbf6cd5e94018a
4a393c951e1f4fdbdc3894a1f8d2929e700adeb7
refs/heads/main
2023-09-04T16:30:20.238093
2023-09-04T06:55:44
2023-09-04T06:55:44
55,433,859
621
555
Apache-2.0
2023-09-14T14:22:46
2016-04-04T18:12:32
C++
UTF-8
Python
false
false
2,190
py
#!/usr/bin/env python # Copyright 2019 Orange # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from base_test import P4rtOVSBaseTest from ptf.packet import MPLS, Ether from ptf.testutils import send_packet, simple_ip_only_packet, verify_packets class TunnelingTest(P4rtOVSBaseTest): def setUp(self): P4rtOVSBaseTest.setUp(self) self.del_flows() self.unload_bpf_program() self.load_bpf_program(path_to_program="build/test-tunneling.o") self.add_bpf_prog_flow(1, 2) self.add_bpf_prog_flow(2, 1) class MplsDownstreamTest(TunnelingTest): def setUp(self): TunnelingTest.setUp(self) self.update_bpf_map(map_id=1, key="1 1 168 192", value="0 0 0 0") def runTest(self): pkt = Ether(dst="11:11:11:11:11:11") / simple_ip_only_packet(ip_dst="192.168.1.1") exp_pkt = ( Ether(dst="11:11:11:11:11:11") / MPLS(label=20, cos=5, s=1, ttl=64) / simple_ip_only_packet(ip_dst="192.168.1.1") ) send_packet(self, (0, 1), pkt) verify_packets(self, exp_pkt, device_number=0, ports=[2]) class MplsUpstreamTest(TunnelingTest): def setUp(self): TunnelingTest.setUp(self) self.update_bpf_map(map_id=0, key="20 0 0 0", value="0 0 0 0") def runTest(self): pkt = ( Ether(dst="11:11:11:11:11:11") / MPLS(label=20, cos=5, s=1, ttl=64) / simple_ip_only_packet(ip_dst="192.168.1.1") ) exp_pkt = Ether(dst="11:11:11:11:11:11") / simple_ip_only_packet(ip_dst="192.168.1.1") send_packet(self, (0, 1), pkt) verify_packets(self, exp_pkt, device_number=0, ports=[2])
601e2fd0c5ec8bd6a1589b74e3fe3c62cc00a0d1
c6ee7be1479797788dd9f9d3a29c0e76ea020db8
/apscheduler_yqt/rabbitmq_selenium/__init__.py
6aeef9ff6c2d7a54fa444b5060b547c6b8ca913f
[]
no_license
hikekang/apscheduler_yqt
2966e7231fff1f81c4fa4a75459cf638592aae6a
0d30c2ef721b8ffeba98dca6b2441613b4ed608d
refs/heads/master
2023-08-17T05:19:34.345553
2021-09-26T03:21:11
2021-09-26T03:21:11
406,217,786
0
0
null
null
null
null
UTF-8
Python
false
false
201
py
#!/usr/bin/python3.x # -*- coding=utf-8 -*- """ Time : 2021/8/6 16:27 Author : hike Email : [email protected] File Name : __init__.py.py Description: Software : PyCharm """
868f1a271bf1e90f4384544b6b79bb9e791ab6b9
8d47af9482444b07b52cf44cebcaf4b992df4d09
/agents/17_DoubleSampling/17.py
67cf990ddcfc9a4ff45dc4790a458cd55d3247c2
[]
no_license
w0lv3r1nix/retro-agents
f4dbce2db558c880b161062796e5397be65bdd10
c7f93a737dc6c6fc5d8343c099e14bd2bc97aaf1
refs/heads/master
2020-08-01T01:19:41.660018
2018-06-13T04:28:09
2018-06-13T04:28:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,854
py
#!/usr/bin/env python """ Train an agent on Sonic using an open source Rainbow DQN implementation. """ import tensorflow as tf from anyrl.algos import DQN from anyrl.envs import BatchedGymEnv from anyrl.envs.wrappers import BatchedFrameStack from anyrl.models import rainbow_models from anyrl.rollouts import BatchedPlayer, PrioritizedReplayBuffer, NStepPlayer from anyrl.spaces import gym_space_vectorizer import gym_remote.exceptions as gre from sonic_util import AllowBacktracking, make_env from DoubleSampling import DoubleSampling def main(): """Run DQN until the environment throws an exception.""" env = AllowBacktracking(make_env(stack=False, scale_rew=False)) env = BatchedFrameStack(BatchedGymEnv([[env]]), num_images=4, concat=False) config = tf.ConfigProto() config.gpu_options.allow_growth = True # pylint: disable=E1101 with tf.Session(config=config) as sess: dqn = DQN(*rainbow_models(sess, env.action_space.n, gym_space_vectorizer(env.observation_space), min_val=-200, max_val=200)) player = NStepPlayer(BatchedPlayer(env, dqn.online_net), 3) optimize = dqn.optimize(learning_rate=1e-4) sess.run(tf.global_variables_initializer()) dqn.train(num_steps=2000000, # Make sure an exception arrives before we stop. player=player, replay_buffer=DoubleSampling(500000, 0.5, 0.4, epsilon=0.1), optimize_op=optimize, train_interval=1, target_interval=8192, batch_size=32, min_buffer_size=20000) if __name__ == '__main__': try: main() except gre.GymRemoteError as exc: print('exception', exc)
ea8568e4d91e2982982e1baec28f8eafed53cab4
55d5430e266d331320eef97653bca303c775184b
/GAN/lib/dataset/alignDataSet.py
06f700b5543cbfd0abd70a7eea77b42820ee75d1
[]
no_license
arn1992/CCX-rayNet_and_CCX-rayGAN
57059bc8c02e01f2d03ad5047bf93e2cc0ae4e3a
b219ca9e19ee0a87cfd9895d11d6709429bb9f52
refs/heads/main
2023-05-09T03:00:21.496350
2021-06-03T02:12:24
2021-06-03T02:12:24
373,348,224
3
1
null
null
null
null
UTF-8
Python
false
false
6,619
py
# ------------------------------------------------------------------------------ # Copyright (c) Tencent # Licensed under the GPLv3 License. # Created by Kai Ma ([email protected]) # ------------------------------------------------------------------------------ from __future__ import print_function from __future__ import absolute_import from __future__ import division from X2CT.GAN.lib.dataset.baseDataSet import Base_DataSet from X2CT.GAN.lib.dataset.utils import * import h5py import numpy as np import os import torch import cv2 # # class AlignDataSet(Base_DataSet): # ''' # DataSet For unaligned data # ''' # def __init__(self, opt): # super(AlignDataSet, self).__init__() # self.opt = opt # self.ext = '.h5' # self.dataset_paths = get_dataset_from_txt_file(self.opt.datasetfile) # self.dataset_paths = sorted(self.dataset_paths) # self.dataset_size = len(self.dataset_paths) # self.dir_root = self.get_data_path # self.data_augmentation = self.opt.data_augmentation(opt) # # @property # def name(self): # return 'AlignDataSet' # # @property # def get_data_path(self): # path = os.path.join(self.opt.dataroot) # return path # # @property # def num_samples(self): # return self.dataset_size # # def get_image_path(self, root, index_name): # img_path = os.path.join(root, index_name, 'ct_xray_data'+self.ext) # assert os.path.exists(img_path), 'Path do not exist: {}'.format(img_path) # return img_path # # # def load_file(self, file_path): # # hdf5 = h5py.File(file_path, 'r') # # ct_data = np.asarray(hdf5['ct']) # # x_ray1 = np.asarray(hdf5['xray1']) # # x_ray1 = np.expand_dims(x_ray1, 0) # # hdf5.close() # # return ct_data, x_ray1 # # # # ''' # # generate batch # # ''' # # def pull_item(self, item): # # file_path = self.get_image_path(self.dir_root, self.dataset_paths[item]) # # ct_data, x_ray1 = self.load_file(file_path) # # # # # Data Augmentation # # ct, xray1 = self.data_augmentation([ct_data, x_ray1]) # # # # return ct, xray1, file_path # # # # def load_file(self, file_path): # ''' # # :param file_path: dir_root/dataset_paths/file.npy ---> CT # :return: # ''' # ct_name = os.path.join(file_path) # xray_name = os.path.join(file_path.replace('3d_numpy_array', 'xray_image').replace('.npy','.png').replace('CT_3D_', 'normal_')) # ct_data = np.load(ct_name) # xray_data = cv2.imread(xray_name, 0) # x_ray1 = np.expand_dims(xray_data, 0) # # return ct_data, x_ray1 # # # # ''' # generate batch # ''' # def pull_item(self, item): # file_path = self.dataset_paths[item] #self.get_image_path(self.dir_root, self.dataset_paths[item]) # ct_data, x_ray1 = self.load_file(file_path) # # assert ct_data.shape[0] == x_ray1.shape[1] and ct_data.shape[1] == x_ray1.shape[2] # # Data Augmentation # ct, xray1 = self.data_augmentation([ct_data, x_ray1]) # # return ct, xray1, file_path # # # from torch.utils.data import Dataset # class My_Align_DataSet(Dataset): # ''' # Base DataSet # ''' # @property # def name(self): # return 'AlignDataSet' # # def __init__(self, opt): # self.opt = opt # self.dataset_paths = get_dataset_from_txt_file(self.opt.datasetfile) # self.dataset_paths = sorted(self.dataset_paths) # self.dataset_size = len(self.dataset_paths) # self.dir_root = self.get_data_path # self.data_augmentation = self.opt.data_augmentation(opt) # # def get_data_path(self): # path = os.path.join(self.opt.dataroot) # return path # # def get_image_path(self, root, index_name): # img_path = os.path.join(root, index_name, 'ct_xray_data'+self.ext) # assert os.path.exists(img_path), 'Path do not exist: {}'.format(img_path) # return img_path # # def load_file(self, file_path): # ''' # # :param file_path: dir_root/dataset_paths/file.npy ---> CT # :return: # ''' # ct_name = os.path.join(file_path) # xray_name = os.path.join(file_path.replace('3d_numpy_array', 'xray_image').replace('.npy','.png').replace('CT_3D_', 'normal_')) # seg_name = os.path.join(file_path.replace('3d_numpy_array', 'seg_image').replace('CT_3D_Patient', '')) # ct_data = np.load(ct_name) # xray_data = cv2.imread(xray_name, 0) # x_ray1 = np.expand_dims(xray_data, 0) # seg_data = np.expand_dims(np.load(seg_name), 0) # seg_data[seg_data<0.8] = 0 # seg_data[seg_data>=0.8] = 1 # # return ct_data, x_ray1, seg_data # # # def __getitem__(self, item): # file_path = self.dataset_paths[item] #self.get_image_path(self.dir_root, self.dataset_paths[item]) # ct_data, x_ray1, seg_data = self.load_file(file_path) # # print(file_path, ct_data.shape, x_ray1.shape) # # assert ct_data.shape[0] == x_ray1.shape[1] and ct_data.shape[1] == x_ray1.shape[2] # # Data Augmentation # ct, xray1 = self.data_augmentation([ct_data, x_ray1]) # # segmentation_map # seg = torch.Tensor(seg_data) # return ct, xray1, seg, file_path # # def __len__(self): # return self.dataset_size # class AlignDataSet(Base_DataSet): ''' DataSet For unaligned data ''' def __init__(self, opt): super(AlignDataSet, self).__init__() self.opt = opt self.ext = '.h5' self.dataset_paths = get_dataset_from_txt_file(self.opt.datasetfile) self.dataset_paths = sorted(self.dataset_paths) self.dataset_size = len(self.dataset_paths) self.dir_root = self.get_data_path self.data_augmentation = self.opt.data_augmentation(opt) @property def name(self): return 'AlignDataSet' @property def get_data_path(self): path = os.path.join(self.opt.dataroot) return path @property def num_samples(self): return self.dataset_size def get_image_path(self, root, index_name): img_path = os.path.join(root, index_name, 'ct_xray_data'+self.ext) assert os.path.exists(img_path), 'Path do not exist: {}'.format(img_path) return img_path def load_file(self, file_path): hdf5 = h5py.File(file_path, 'r') ct_data = np.asarray(hdf5['ct']) x_ray1 = np.asarray(hdf5['xray1']) x_ray1 = np.expand_dims(x_ray1, 0) hdf5.close() return ct_data, x_ray1 ''' generate batch ''' def pull_item(self, item): file_path = self.get_image_path(self.dir_root, self.dataset_paths[item]) ct_data, x_ray1 = self.load_file(file_path) # Data Augmentation ct, xray1 = self.data_augmentation([ct_data, x_ray1]) return ct, xray1, file_path
9a55f6475c0faa28d1d4f188a408cd6edb3b8c7b
8d472f9facb895dda9e1df81f3bb6c2f81b9c357
/master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/NotificationMessageModule_updateProductionNotificationId.py
c500db8c5f0f5a55eeea84950922136ec276be23
[]
no_license
SlapOS/slapos.core
852485eed9382685f3df6ba8532f8192bb1389c4
369e8d56636e1c59a745e68dc68154abfc5b7840
refs/heads/master
2023-08-31T04:42:34.722241
2023-08-30T15:13:08
2023-08-30T15:13:08
1,825,920
11
4
null
null
null
null
UTF-8
Python
false
false
614
py
if context.getPortalType() != "Notification Message Module": raise ValueError("This folder is not a Notification Message Module") for notification_message in context.searchFolder(id="201%", validation_state="validated"): if notification_message.getValidationState() != 'validated': continue new_id = "master_prod_%s_%s_%s" % (notification_message.getReference().replace("-", "_").replace(".", "_"), notification_message.getLanguage("en"), notification_message.getVersion("001")) notification_message.getObject().setId(new_id)
e9800083acfaca576ffae8cac4c26355760c9560
7233716fbf9fff94240d14770b3fc3f3ada10d9b
/devel/.private/gazebo_msgs/lib/python2.7/dist-packages/gazebo_msgs/srv/_SetLinkProperties.py
6800b54ace209d309c7e834bf37f50f0b9856e68
[]
no_license
shashankseth01/E-yantra
58d42dce90667ca37f31f2cf111ee98c39468617
23432e058fce7733bd1a8399fd6edc20967fa6a3
refs/heads/main
2023-02-04T00:36:57.230996
2020-12-21T09:55:23
2020-12-21T09:55:23
316,716,460
2
1
null
null
null
null
UTF-8
Python
false
false
13,337
py
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from gazebo_msgs/SetLinkPropertiesRequest.msg. Do not edit.""" import codecs import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import geometry_msgs.msg class SetLinkPropertiesRequest(genpy.Message): _md5sum = "68ac74a4be01b165bc305b5ccdc45e91" _type = "gazebo_msgs/SetLinkPropertiesRequest" _has_header = False # flag to mark the presence of a Header object _full_text = """string link_name # name of link # link names are prefixed by model name, e.g. pr2::base_link geometry_msgs/Pose com # center of mass location in link frame # and orientation of the moment of inertias # relative to the link frame bool gravity_mode # set gravity mode on/off float64 mass # linear mass of link float64 ixx # moment of inertia float64 ixy # moment of inertia float64 ixz # moment of inertia float64 iyy # moment of inertia float64 iyz # moment of inertia float64 izz # moment of inertia ================================================================================ MSG: geometry_msgs/Pose # A representation of pose in free space, composed of position and orientation. Point position Quaternion orientation ================================================================================ MSG: geometry_msgs/Point # This contains the position of a point in free space float64 x float64 y float64 z ================================================================================ MSG: geometry_msgs/Quaternion # This represents an orientation in free space in quaternion form. float64 x float64 y float64 z float64 w """ __slots__ = ['link_name','com','gravity_mode','mass','ixx','ixy','ixz','iyy','iyz','izz'] _slot_types = ['string','geometry_msgs/Pose','bool','float64','float64','float64','float64','float64','float64','float64'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: link_name,com,gravity_mode,mass,ixx,ixy,ixz,iyy,iyz,izz :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(SetLinkPropertiesRequest, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.link_name is None: self.link_name = '' if self.com is None: self.com = geometry_msgs.msg.Pose() if self.gravity_mode is None: self.gravity_mode = False if self.mass is None: self.mass = 0. if self.ixx is None: self.ixx = 0. if self.ixy is None: self.ixy = 0. if self.ixz is None: self.ixz = 0. if self.iyy is None: self.iyy = 0. if self.iyz is None: self.iyz = 0. if self.izz is None: self.izz = 0. else: self.link_name = '' self.com = geometry_msgs.msg.Pose() self.gravity_mode = False self.mass = 0. self.ixx = 0. self.ixy = 0. self.ixz = 0. self.iyy = 0. self.iyz = 0. self.izz = 0. def _get_types(self): """ internal API method """ return self._slot_types def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: _x = self.link_name length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) _x = self buff.write(_get_struct_7dB7d().pack(_x.com.position.x, _x.com.position.y, _x.com.position.z, _x.com.orientation.x, _x.com.orientation.y, _x.com.orientation.z, _x.com.orientation.w, _x.gravity_mode, _x.mass, _x.ixx, _x.ixy, _x.ixz, _x.iyy, _x.iyz, _x.izz)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ codecs.lookup_error("rosmsg").msg_type = self._type try: if self.com is None: self.com = geometry_msgs.msg.Pose() end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.link_name = str[start:end].decode('utf-8', 'rosmsg') else: self.link_name = str[start:end] _x = self start = end end += 113 (_x.com.position.x, _x.com.position.y, _x.com.position.z, _x.com.orientation.x, _x.com.orientation.y, _x.com.orientation.z, _x.com.orientation.w, _x.gravity_mode, _x.mass, _x.ixx, _x.ixy, _x.ixz, _x.iyy, _x.iyz, _x.izz,) = _get_struct_7dB7d().unpack(str[start:end]) self.gravity_mode = bool(self.gravity_mode) return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: _x = self.link_name length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) _x = self buff.write(_get_struct_7dB7d().pack(_x.com.position.x, _x.com.position.y, _x.com.position.z, _x.com.orientation.x, _x.com.orientation.y, _x.com.orientation.z, _x.com.orientation.w, _x.gravity_mode, _x.mass, _x.ixx, _x.ixy, _x.ixz, _x.iyy, _x.iyz, _x.izz)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ codecs.lookup_error("rosmsg").msg_type = self._type try: if self.com is None: self.com = geometry_msgs.msg.Pose() end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.link_name = str[start:end].decode('utf-8', 'rosmsg') else: self.link_name = str[start:end] _x = self start = end end += 113 (_x.com.position.x, _x.com.position.y, _x.com.position.z, _x.com.orientation.x, _x.com.orientation.y, _x.com.orientation.z, _x.com.orientation.w, _x.gravity_mode, _x.mass, _x.ixx, _x.ixy, _x.ixz, _x.iyy, _x.iyz, _x.izz,) = _get_struct_7dB7d().unpack(str[start:end]) self.gravity_mode = bool(self.gravity_mode) return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill _struct_I = genpy.struct_I def _get_struct_I(): global _struct_I return _struct_I _struct_7dB7d = None def _get_struct_7dB7d(): global _struct_7dB7d if _struct_7dB7d is None: _struct_7dB7d = struct.Struct("<7dB7d") return _struct_7dB7d # This Python file uses the following encoding: utf-8 """autogenerated by genpy from gazebo_msgs/SetLinkPropertiesResponse.msg. Do not edit.""" import codecs import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class SetLinkPropertiesResponse(genpy.Message): _md5sum = "2ec6f3eff0161f4257b808b12bc830c2" _type = "gazebo_msgs/SetLinkPropertiesResponse" _has_header = False # flag to mark the presence of a Header object _full_text = """bool success # return true if get info is successful string status_message # comments if available """ __slots__ = ['success','status_message'] _slot_types = ['bool','string'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: success,status_message :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(SetLinkPropertiesResponse, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.success is None: self.success = False if self.status_message is None: self.status_message = '' else: self.success = False self.status_message = '' def _get_types(self): """ internal API method """ return self._slot_types def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: _x = self.success buff.write(_get_struct_B().pack(_x)) _x = self.status_message length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 1 (self.success,) = _get_struct_B().unpack(str[start:end]) self.success = bool(self.success) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.status_message = str[start:end].decode('utf-8', 'rosmsg') else: self.status_message = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: _x = self.success buff.write(_get_struct_B().pack(_x)) _x = self.status_message length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 1 (self.success,) = _get_struct_B().unpack(str[start:end]) self.success = bool(self.success) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.status_message = str[start:end].decode('utf-8', 'rosmsg') else: self.status_message = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill _struct_I = genpy.struct_I def _get_struct_I(): global _struct_I return _struct_I _struct_B = None def _get_struct_B(): global _struct_B if _struct_B is None: _struct_B = struct.Struct("<B") return _struct_B class SetLinkProperties(object): _type = 'gazebo_msgs/SetLinkProperties' _md5sum = 'd534ce1b36ee99de0ffa806c3a6348f0' _request_class = SetLinkPropertiesRequest _response_class = SetLinkPropertiesResponse
48ddd44b06ec6eca0612ca841b1a3c4c4285e8ef
09e57dd1374713f06b70d7b37a580130d9bbab0d
/benchmark/startQiskit_QC1758.py
9251f4bd17de4e61517b4875032d7ca930e91402
[ "BSD-3-Clause" ]
permissive
UCLA-SEAL/QDiff
ad53650034897abb5941e74539e3aee8edb600ab
d968cbc47fe926b7f88b4adf10490f1edd6f8819
refs/heads/main
2023-08-05T04:52:24.961998
2021-09-19T02:56:16
2021-09-19T02:56:16
405,159,939
2
0
null
null
null
null
UTF-8
Python
false
false
4,787
py
# qubit number=5 # total number=60 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2,floor, sqrt, pi import numpy as np import networkx as nx def build_oracle(n: int, f) -> QuantumCircuit: # implement the oracle O_f^\pm # NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate # or multi_control_Z_gate (issue #127) controls = QuantumRegister(n, "ofc") oracle = QuantumCircuit(controls, name="Zf") for i in range(2 ** n): rep = np.binary_repr(i, n) if f(rep) == "1": for j in range(n): if rep[j] == "0": oracle.x(controls[j]) # oracle.h(controls[n]) if n >= 2: oracle.mcu1(pi, controls[1:], controls[0]) for j in range(n): if rep[j] == "0": oracle.x(controls[j]) # oracle.barrier() return oracle def make_circuit(n:int,f) -> QuantumCircuit: # circuit begin input_qubit = QuantumRegister(n,"qc") classical = ClassicalRegister(n, "qm") prog = QuantumCircuit(input_qubit, classical) prog.h(input_qubit[0]) # number=3 prog.x(input_qubit[4]) # number=53 prog.h(input_qubit[0]) # number=57 prog.cz(input_qubit[2],input_qubit[0]) # number=58 prog.h(input_qubit[0]) # number=59 prog.z(input_qubit[2]) # number=46 prog.h(input_qubit[0]) # number=54 prog.cz(input_qubit[2],input_qubit[0]) # number=55 prog.h(input_qubit[0]) # number=56 prog.h(input_qubit[1]) # number=4 prog.rx(2.664070570244145,input_qubit[1]) # number=39 prog.h(input_qubit[2]) # number=5 prog.h(input_qubit[3]) # number=6 prog.h(input_qubit[2]) # number=49 prog.cz(input_qubit[3],input_qubit[2]) # number=50 prog.h(input_qubit[2]) # number=51 prog.h(input_qubit[4]) # number=21 Zf = build_oracle(n, f) repeat = floor(sqrt(2 ** n) * pi / 4) for i in range(repeat): prog.append(Zf.to_gate(), [input_qubit[i] for i in range(n)]) prog.h(input_qubit[0]) # number=1 prog.h(input_qubit[3]) # number=40 prog.y(input_qubit[4]) # number=35 prog.h(input_qubit[1]) # number=2 prog.h(input_qubit[2]) # number=7 prog.h(input_qubit[3]) # number=8 prog.h(input_qubit[0]) # number=25 prog.cz(input_qubit[1],input_qubit[0]) # number=26 prog.h(input_qubit[0]) # number=27 prog.h(input_qubit[0]) # number=36 prog.cz(input_qubit[1],input_qubit[0]) # number=37 prog.h(input_qubit[0]) # number=38 prog.cx(input_qubit[1],input_qubit[0]) # number=41 prog.x(input_qubit[0]) # number=42 prog.cx(input_qubit[1],input_qubit[0]) # number=43 prog.cx(input_qubit[1],input_qubit[0]) # number=34 prog.cx(input_qubit[1],input_qubit[0]) # number=24 prog.cx(input_qubit[0],input_qubit[1]) # number=29 prog.cx(input_qubit[2],input_qubit[3]) # number=44 prog.x(input_qubit[1]) # number=30 prog.cx(input_qubit[0],input_qubit[1]) # number=31 prog.x(input_qubit[2]) # number=11 prog.x(input_qubit[3]) # number=12 if n>=2: prog.mcu1(pi,input_qubit[1:],input_qubit[0]) prog.x(input_qubit[0]) # number=13 prog.x(input_qubit[1]) # number=14 prog.x(input_qubit[2]) # number=15 prog.x(input_qubit[3]) # number=16 prog.h(input_qubit[0]) # number=17 prog.h(input_qubit[1]) # number=18 prog.h(input_qubit[2]) # number=19 prog.h(input_qubit[3]) # number=20 prog.z(input_qubit[1]) # number=52 # circuit end for i in range(n): prog.measure(input_qubit[i], classical[i]) return prog if __name__ == '__main__': key = "00000" f = lambda rep: str(int(rep == key)) prog = make_circuit(5,f) IBMQ.load_account() provider = IBMQ.get_provider(hub='ibm-q') provider.backends() backend = least_busy(provider.backends(filters=lambda x: x.configuration().n_qubits >= 2 and not x.configuration().simulator and x.status().operational == True)) sample_shot =7924 info = execute(prog, backend=backend, shots=sample_shot).result().get_counts() backend = FakeVigo() circuit1 = transpile(prog,backend,optimization_level=2) writefile = open("../data/startQiskit_QC1758.csv","w") print(info,file=writefile) print("results end", file=writefile) print(circuit1.depth(),file=writefile) print(circuit1,file=writefile) writefile.close()
c5de003f1e74c18d0f8f566bab3c1c6638eb1c13
725abfa74e3800622837e60615dc15c6e91442c0
/venv/Lib/site-packages/django/contrib/sites/managers.py
12f8e555d1819f45ba12459ff1e8dedf2b4a4201
[]
no_license
Malak-Abdallah/TODOlist
4840e2e0a27e6499ae6b37524bb3e58455d08bfb
fd35754e8eac9b262fae17ec16ad9fb510a12f5d
refs/heads/master
2023-07-16T11:38:48.759232
2021-08-31T09:43:11
2021-08-31T09:43:11
401,600,246
0
0
null
null
null
null
UTF-8
Python
false
false
1,973
py
from django.conf import settings from django.core import checks from django.core.exceptions import FieldDoesNotExist from django.db import models class CurrentSiteManager(models.Manager): "Use this to limit objects to those associated with the current site." use_in_migrations = True def __init__(self, field_name=None): super().__init__() self.__field_name = field_name def check(self, **kwargs): errors = super().check(**kwargs) errors.extend(self._check_field_name()) return errors def _check_field_name(self): field_name = self._get_field_name() try: field = self.model._meta.get_field(field_name) except FieldDoesNotExist: return [ checks.Error( "CurrentSiteManager could not find a field named '%s'." % field_name, obj=self, id="sites.E001", ) ] if not field.many_to_many and not isinstance(field, (models.ForeignKey)): return [ checks.Error( "CurrentSiteManager cannot use '%s.%s' as it is not a foreign key or a many-to-many field." % (self.model._meta.object_name, field_name), obj=self, id="sites.E002", ) ] return [] def _get_field_name(self): """ Return self.__field_name or 'site' or 'sites'. """ if not self.__field_name: try: self.model._meta.get_field("site") except FieldDoesNotExist: self.__field_name = "sites" else: self.__field_name = "site" return self.__field_name def get_queryset(self): return ( super() .get_queryset() .filter(**{self._get_field_name() + "__id": settings.SITE_ID}) )
1f0ac06c86ccc934a38d76d04471bc0b6512f58e
d36ac2218dd70e9d1f26f0e82bc32cd2d0166e17
/tests/test_e_policy.py
e6cad3826d533caa3cf6f6ad7ea876072d51aec9
[ "MIT" ]
permissive
dre2004/reinforcement
b8b1524fb81ec2e540b0d8e64e5a77f6fff2ded8
50d59a49106ffecc26c0fd97fa240bddfff1384a
refs/heads/master
2020-05-20T04:38:22.524054
2018-10-28T18:59:55
2018-10-28T18:59:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,064
py
import random import pytest from reinforcement.policies.e_greedy_policies import EpsilonGreedyPolicy from tests.common_doubles import MockFilter, Call from tests.q_doubles import QFunctionWrapper def make_policy(epsilon, filter=None): return EpsilonGreedyPolicy(epsilon, filter) STATE_A = [0] STATE_B = [1] @pytest.fixture def q_function(): return QFunctionWrapper([0, 1]) @pytest.fixture def zero_policy(): """Returns a normal e greedy policy with epsilon 0""" return make_policy(0) @pytest.fixture def epsilon_policy(): """Returns a normal e greedy policy with epsilon 0.2""" return make_policy(0.2) @pytest.fixture def function_policy(): """Returns a normal e greedy policy with epsilon 0.2 provided by a function""" return make_policy(lambda: 0.2) def test_epsilon_zero(zero_policy, q_function): q_function.set_state_action_values(STATE_A, -1, 1) assert zero_policy.select(STATE_A, q_function) == 1 def test_multiple_states(zero_policy, q_function): q_function.set_state_action_values(STATE_A, -1, 1) q_function.set_state_action_values(STATE_B, 10, -5) assert zero_policy.select(STATE_A, q_function) == 1 assert zero_policy.select(STATE_B, q_function) == 0 def test_non_zero_epsilon(epsilon_policy, q_function): random.seed(1) q_function.set_state_action_values(STATE_A, -1, 1) assert epsilon_policy.select(STATE_A, q_function) == 0 def test_epsilon_as_function(function_policy, q_function): random.seed(1) q_function.set_state_action_values(STATE_A, -1, 1) assert function_policy.select(STATE_A, q_function) == 0 def test_incomplete_state(zero_policy, q_function): q_function[STATE_A, 0] = -1 assert zero_policy.select(STATE_A, q_function) == 1 def test_invalid_actions_are_ignored(q_function): q_function[STATE_A, 0] = 10 q_function[STATE_A, 1] = -1 filter = MockFilter(Call((STATE_A, 0), returns=False), Call((STATE_A, 1), returns=True)) policy = make_policy(0, filter) assert policy.select(STATE_A, q_function) == 1
58c87bd862dce94dac7a79671928118b0d26a780
b01f25b447d5ec3d6bc08380ae2601d5badb6af3
/Graph Theory/find_town_judge_graph.py
a65dc5f13d930fed2aa087d3129ce35ebbcebc07
[]
no_license
SurajPatil314/Leetcode-problems
0b05faab17214437a599d846dd1c9a7ea82b9c4c
9201a87246842855281c90a9705f83fce24d1137
refs/heads/master
2021-09-05T02:20:05.274438
2021-08-09T21:24:05
2021-08-09T21:24:05
203,467,630
0
0
null
null
null
null
UTF-8
Python
false
false
1,107
py
""" In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge. There is exactly one person that satisfies properties 1 and 2. You are given trust, an array of pairs trust[i] = [a, b] representing that the person labelled a trusts the person labelled b. If the town judge exists and can be identified, return the label of the town judge. Otherwise, return -1. """ from collections import defaultdict class Solution: def findJudge(self, N: int, trust: List[List[int]]) -> int: qw = defaultdict(list) qw1 = defaultdict(list) if N == 1 and len(trust) == 0: return 1 for i in trust: qw[i[1]].append(i[0]) qw1[i[0]].append(i[1]) ans = [] for i, j in qw.items(): if len(j) == N - 1: ans.append(i) for i in ans: if len(qw1[i]) == 0: return i return -1
19d37369afbab32c4d2c09847ce2d0f8ce1afa84
2f98aa7e5bfc2fc5ef25e4d5cfa1d7802e3a7fae
/python/python_12663.py
6031a1a7cbb9dc2a4982856ada1abfbb19ec911f
[]
no_license
AK-1121/code_extraction
cc812b6832b112e3ffcc2bb7eb4237fd85c88c01
5297a4a3aab3bb37efa24a89636935da04a1f8b6
refs/heads/master
2020-05-23T08:04:11.789141
2015-10-22T19:19:40
2015-10-22T19:19:40
null
0
0
null
null
null
null
UTF-8
Python
false
false
143
py
# Getting SQLAlchemy to issue CREATE SCHEMA on create_all from sqlalchemy.schema import CreateSchema engine.execute(CreateSchema('my_schema'))
2eb4684ce29859ebac9b20e4a8d5a10fb93344dc
dfc827bf144be6edf735a8b59b000d8216e4bb00
/CODE/postprocessing/readplot/db/SWRF/uhsuperimposedDB.py
b249e02f36921c7b8a559bd41b5ad15ff0e335fa
[]
no_license
jordanpitt3141/ALL
c5f55e2642d4c18b63b4226ddf7c8ca492c8163c
3f35c9d8e422e9088fe096a267efda2031ba0123
refs/heads/master
2020-07-12T16:26:59.684440
2019-05-08T04:12:26
2019-05-08T04:12:26
94,275,573
0
1
null
null
null
null
UTF-8
Python
false
false
12,403
py
# -*- coding: utf-8 -*- """ Created on Wed Sep 23 16:53:37 2015 @author: jordan """ import csv from numpy.linalg import norm from scipy import * from pylab import plot, show, legend,xlim,ylim,savefig,title,xlabel,ylabel,clf, loglog, xticks,yticks from matplotlib2tikz import save as tikz_save import os from subprocess import call diffs = [10.0] wdirbase = "../../../../../data/raw/DBSWanew100s/o3/10/" sdirbase = "../../../../../data/postprocessing/uhcomp300s/DB/o3/10/" cwdirbase = "../../../../../data/raw/trackleadsola10new/o3/" for diff in diffs: #full crop front front back middez middle zz #ylims = [[1.0,1.8],[1.0,1.8],[1,1.8],[1.0,1.8],[1.32,1.42],[1.32,1.42]] xlims = [[0-1,1000+1],[200-1,1000+1],[200-1,1000+1],[200-1,1000+1],[550-1,650+1],[590-1,620+1]] gaps = [10,10,10,10,2,2] #read the DBSW file for l in range(len(ylims)): #for l in range(1): cylim = ylims[l] cxlim = xlims[l] sdir = sdirbase +str(diff)+ "/" if not os.path.exists(sdir): os.makedirs(sdir) sdirf = sdir +str(l) + "/" if not os.path.exists(sdirf): os.makedirs(sdirf) gap = gaps[l] wdir = wdirbase +str(diff)+ "/" s = cwdirbase + "outlast.txt" with open(s,'r') as file1: readfile = csv.reader(file1, delimiter = ',', quotechar='|', quoting=csv.QUOTE_MINIMAL) h = [] u = [] x = [] j = -1 for row in readfile: if (j >= 0): dx = float(row[0]) dt = float(row[1]) t = float(row[2]) x.append(float(row[4])) h.append(float(row[5])) u.append(float(row[7])) j = j + 1 igap = int(gap) xbeg = int((cxlim[0])/dx) xend = int((cxlim[1])/dx) if(xbeg < 0): xbeg = 0 if(xend > len(x)): xend = len(x) xt = x[xbeg:xend:igap] ht = h[xbeg:xend:igap] ut = u[xbeg:xend:igap] xDB = array(xt) hDB = array(ht) uDB = array(ut) + 0.294 m = len(x) s = str(dx) plot(xDB,hDB,label=s) plot(xDB,uDB,label=s) ylim(cylim) xlim(cxlim) #eyticks = [h2] #yticks(list(yticks()[0]) + eyticks) xlabel("$x$ ($m$)") ylabel("$h$ ($m$)") n = len(xDB) s = sdirf + "hDBSW.dat" with open(s,'w') as file1: for i in range(n): s ="%3.8f%5s%1.15f\n" %(xDB[i]," ",hDB[i]) file1.write(s) n = len(xDB) s = sdirf + "hDB.dat" with open(s,'w') as file1: for i in range(n): s ="%3.8f%5s%1.15f\n" %(xDB[i]," ",uDB[i]) file1.write(s) s = "Dam Break: diff = " + str(beta) title(s) s = sdir +str(l)+".png" savefig(s, bbox_inches='tight') legend() s = sdir +str(l)+ "leg.png" savefig(s, bbox_inches='tight') clf() """ #legend() if(l==0): s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize,color=white}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "extra y tick style={yticklabel style={font=\scriptsize,color=black}}, \n" \ + "xtick={0,200,400,600,800,1000}, \n"\ + "ytick={0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2}, \n"\ + "extra y ticks = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.36898,1.5,1.7,1.9,2.1}, \n"\ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=200, \n xmax=1000, \n ymin = 0.1, \n ymax = 2.1,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " #print(s) elif(l==1): s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "xtick={0,200,400,600,800,1000}, \n"\ + "ytick={1.0,1.1,1.2,1.3,1.36898,1.4,1.5,1.6,1.7,1.8}, \n"\ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=200, \n xmax=1000, \n ymin = 1.0, \n ymax = 1.8,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " #print(s) elif(l==2): s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize,color=white}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "extra y tick style={yticklabel style={font=\scriptsize,color=black}}, \n" \ + "xtick={200,250,300,350,400,450,500,550}, \n"\ + "ytick={1.31,1.33,1.35,1.37,1.39,1.41,1.43,1.45}, \n"\ + "extra y ticks = {1.3,1.32,1.34,1.36,1.36898,1.38,1.4,1.42,1.44,1.46}, \n" \ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=200, \n xmax=550, \n ymin = 1.3, \n ymax = 1.46,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " #print(s) elif(l==3): s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize,color=white}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "extra y tick style={yticklabel style={font=\scriptsize,color=black}}, \n" \ + "xtick={650,700,750,800,850,900,950}, \n"\ + "ytick={0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2}, \n"\ + "extra y ticks = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.36898,1.5,1.7,1.9,2.1}, \n"\ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=650, \n xmax=950, \n ymin = 0.1, \n ymax = 2.1,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " elif(l==4): s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize,color=white}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "extra y tick style={yticklabel style={font=\scriptsize,color=black}}, \n" \ + "xtick={550,560,570,580,590,600,610,620,630,640,650}, \n"\ + "ytick={1.31,1.33,1.35,1.37,1.39,1.41,1.43,1.45}, \n"\ + "extra y ticks = {1.3,1.32,1.34,1.36,1.36898,1.38,1.4,1.42,1.44,1.46}, \n" \ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=550, \n xmax=650, \n ymin = 1.3, \n ymax = 1.46,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " else: s = "\\documentclass[]{article} \n\\usepackage{pgfplots} \n\\usepgfplotslibrary{external} \n\\tikzexternalize \n" \ + "\\usepackage{tikz} \n \\usepackage{amsmath} \n \\usepackage{pgfplots} \n \\usetikzlibrary{calc} \n" \ + "\\pgfplotsset{compat = newest,every x tick label/.append style={font=\scriptsize},every y tick label/.append style={font=\\scriptsize,color=white}, every axis plot post/.style={line join=round}} \n" \ + "\\begin{document} \n \\begin{tikzpicture} \n \\begin{axis}[ \n ylabel near ticks,\n xlabel near ticks, \n" \ + "yticklabel style={/pgf/number format/fixed,/pgf/number format/precision=5,}, \n"\ + "extra y tick style={yticklabel style={font=\scriptsize,color=black}}, \n" \ + "xtick={590,595,600,605,610,615,620}, \n"\ + "ytick={1.31,1.33,1.35,1.37,1.39,1.41,1.43,1.45}, \n"\ + "extra y ticks = {1.3,1.32,1.34,1.36,1.36898,1.38,1.4,1.42,1.44,1.46}, \n" \ + "scaled y ticks=false, \n clip mode=individual,\n "\ + "xmin=590, \n xmax=620, \n ymin = 1.3, \n ymax = 1.46,\n"\ + "xlabel=$x$ ($m$), \n ylabel=value]"\ + "\\addplot [blue] table {hDBSW.dat}; \n"\ + "\\addplot [green!80!black] table {hDB.dat}; \n"\ + "\\end{axis} \n \\end{tikzpicture} \n \\end{document} \n " #print(s) filen = sdirf +str(l)+ ".tex" file1 = open(filen, 'w') file1.write(s) file1.close() #make makefile s = "LAT = pdflatex \nLATFLAGS = -shell-escape\n\n" newl = str(l) +":\n\t $(LAT) $(LATFLAGS) " +str(l)+".tex\n\n" s = s + newl newl = "clean:\n\t rm -f *~ ./*.log ./*.aux ./*.auxlock ./*.dep ./*.dpth ./*.pdf ./*.gz\n\n" s = s + newl newl = "all: " +str(l) s = s + newl filen =sdirf + "Makefile" file1 = open(filen, 'w') file1.write(s) file1.close() call(['make','-C',sdirf,'all']) """
6e2c03b6b255c05b1a83bfd12d7a9abac813bc85
7ddc47adf330d48bf0b5c602a04c45fa4dc64590
/Multidimensional Lists/Exercises/Exercise multidimentional lists 04.py
5209364a7b2049de153e9e53b71c367116c85170
[]
no_license
Beshkov/Python_Advanced
634786e5f2de6f19ba74ab2fcf6489f751a774e8
e1bf1385a03b773b697bc65771193ebd9ef5d226
refs/heads/main
2023-03-03T16:19:35.271919
2021-02-18T20:45:37
2021-02-18T20:45:37
329,417,000
0
0
null
null
null
null
UTF-8
Python
false
false
2,503
py
r, c = tuple(int(el) for el in input().split()) matrix = [[el for el in input().split()] for _ in range(r)] def is_valid(command, matrix): if not command.split()[0] == 'swap' or not len(command.split()) == 5: print('Invalid input!') return row_one, col_one, row_two, col_two = [int(x) for x in command.split()[1:]] if not (row_one < len(matrix) and row_two < len(matrix)) or not ( col_one < len(matrix[0]) and col_two < len(matrix[0])): print('Invalid input!') return return (row_one, col_one, row_two, col_two) def swap(command, matrix): if is_valid(command, matrix): r_1, c_1, r_2, c_2 = is_valid(command, matrix) matrix[r_1][c_1], matrix[r_2][c_2] = matrix[r_2][c_2], matrix[r_1][c_1] [print(" ".join(map(str, num))) for num in [submatrix for submatrix in matrix]] command = input() while not command == "END": swap(command, matrix) command = input() # def check_if_index_is_valid(index_row,index_col, rows, cols): # if 0 <= index_row < rows and 0<= index_col < cols: # return True # return False # # def check_if_command_is_valid(command,coordinates, rows, cols): # if len(coordinates) == 4 and command == "swap": # for index in range(0,len(coordinates), 2): # if not check_if_index_is_valid(coordinates[index], coordinates[index+1], rows,cols): # print('Invalid input!') # return False # return True # # def print_matrix(matrix): # for row_index in range(len(matrix)): # for col_index in range(0,len(matrix[row_index])): # print(matrix[row_index][col_index], end=' ') # print() # # # def init_matrix(rows): # # matrix = [] # for _ in range(rows): # matrix.append([el for el in input().split()]) # return matrix # # rows, cols = [int(el) for el in input().split()] # matrix = init_matrix(rows) # data = input() # # while not data == "END": # # splitted_data = data.split() # try: # command = splitted_data[0] # coordinates = [int(el) for el in splitted_data[1:]] # except: # print("Invalid input") # if check_if_command_is_valid(command,coordinates, rows, cols): # temp = matrix[coordinates[0]][coordinates[1]] # matrix[coordinates[0]][coordinates[1]] = matrix[coordinates[2]][coordinates[3]] # matrix[coordinates[2]][coordinates[3]] = temp # print_matrix(matrix) # # data = input()
966bee64272b1e61f7a41d8aa904ff20763d2f3c
79e1b7919f34ec0425bb98cc4888e092e94e0273
/readMotionZone3.py
d3e197bc34d632b274850cb613793b6b3042dd07
[]
no_license
hamhochoi/K59_training
099e0c193b94677045bd3622f04440d49a3765fb
845ab3ac64035bf25a72c8dd380cc133092f2e42
refs/heads/master
2021-01-19T08:59:34.938053
2018-10-24T17:46:29
2018-10-24T17:46:29
87,705,721
0
0
null
2018-01-13T16:49:23
2017-04-09T12:09:21
null
UTF-8
Python
false
false
870
py
import paho.mqtt.client as mqtt import time from datetime import datetime #f = open("time_pin.txt", "a") def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe("zone_3/box_1/motion/id_1") # The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): print(msg.topic+" "+str(msg.payload) + " " + str(datetime.now())) f = open("time_pin_zone3.txt", "a") f.write(str(msg.payload) + " " + str(datetime.now())) f.write("\n") f.close() time.sleep(5*60) client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message client.connect("broker.hivemq.com", 1883, 60) client.loop_forever()
764a01fab0d7c00916075b5b3e9e39d50334c0ab
31c7a5fb038c094abd9d25aa6eb30901aa255e5f
/planner/progression/utils.py
5352e96dab2b17174f42a3f797b21b240dbfbd26
[ "MIT" ]
permissive
hxdaze/pyplanners
0711d8d7065ea347925bd4395cc22460f8989299
ef1ae33e233f20cd93ce03cba363b0f14fd078bc
refs/heads/master
2023-05-13T03:40:21.480863
2021-06-02T02:45:24
2021-06-02T02:45:24
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,018
py
from random import random, randint, choice # TODO: Monte-Carlo Tree Search DEFAULT_GOAL_PROBABILITY = 0.1 def pop_random(queue): queue.rotate(randint(0, len(queue) - 1)) return queue.popleft() def sample_target(sample, goal_sample=None, goal_probability=DEFAULT_GOAL_PROBABILITY): if (goal_sample is not None) and (random() < goal_probability): return goal_sample() return sample() def pop_min(queue, distance): minimum, indices = None, [] for i, v in enumerate(queue): score = distance(v) if minimum is None or score < minimum: minimum, indices = score, [i] elif score == minimum: indices.append(i) queue.rotate(choice(indices)) return queue.popleft() def pop_rrt(distance, sample, goal_sample=None, goal_probability=DEFAULT_GOAL_PROBABILITY): return lambda queue: pop_min( queue, lambda sv: distance(sv.state, sample_target( sample, goal_sample=goal_sample, goal_probability=goal_probability)))
2a060797c6f0596efb85781e96e662b62b25a605
e20ed90b9be7a0bcdc1603929d65b2375a224bf6
/generated-libraries/python/netapp/volume/volume_qos_attributes.py
d9b68e9559d1de7eb232b2af87826e82481b4776
[ "MIT" ]
permissive
radekg/netapp-ontap-lib-gen
530ec3248cff5ead37dc2aa47ced300b7585361b
6445ebb071ec147ea82a486fbe9f094c56c5c40d
refs/heads/master
2016-09-06T17:41:23.263133
2015-01-14T17:40:46
2015-01-14T17:40:46
29,256,898
2
0
null
null
null
null
UTF-8
Python
false
false
1,405
py
from netapp.netapp_object import NetAppObject class VolumeQosAttributes(NetAppObject): """ QoS policy group attached with a volume. """ _policy_group_name = None @property def policy_group_name(self): """ The QoS policy group associated with this volume. <p> This optionally specifies which QoS policy group to apply to the volume. This policy group defines measurable service level objectives (SLOs) that apply to the storage objects with which the policy group is associated. If you do not assign a policy group to a volume, the system will not monitor and control the traffic to it. This parameter is not supported on Infinite Volumes. <p> Attributes: optional-for-create, modifiable """ return self._policy_group_name @policy_group_name.setter def policy_group_name(self, val): if val != None: self.validate('policy_group_name', val) self._policy_group_name = val @staticmethod def get_api_name(): return "volume-qos-attributes" @staticmethod def get_desired_attrs(): return [ 'policy-group-name', ] def describe_properties(self): return { 'policy_group_name': { 'class': basestring, 'is_list': False, 'required': 'optional' }, }
ed29596b420bf723cd8950b86899310a5b4c08c5
8ad9ad16582ad302b121ce9f6cd743dff5187454
/dataset/dataset_loader.py
4cb35ca8619a1e7fa17cd3c92077eadf218d5962
[]
no_license
wolf943134497/3D-Aware-Ellipses-for-Visual-Localization
0d7d55b2b0997ffdd97f27b31e09de7725790dda
9caddecd4e175d7528ea6b8d74bb79954c74efef
refs/heads/master
2023-05-05T07:45:54.831338
2021-05-23T19:33:08
2021-05-24T21:35:41
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,818
py
import json import numpy as np class Dataset_loader: """ Interace with our own dataset file format. """ def __init__(self, filename): with open(filename, "r") as fin: self.dataset = json.load(fin) self.nb_images = len(self.dataset) def __len__(self): return len(self.dataset) def get_image_size(self, idx): """ Get the image size. """ if idx < 0 or idx >= self.nb_images: print("Invalid index") return None return self.dataset[idx]["width"], self.dataset[idx]["height"] def get_K(self, idx): """ Get the K matrix. """ if idx < 0 or idx >= self.nb_images: print("Invalid index") return None return np.asarray(self.dataset[idx]["K"]) def get_Rt(self, idx): """ Get the extrinsic parameters. """ if idx < 0 or idx >= self.nb_images: print("Invalid index") return None R = np.asarray(self.dataset[idx]["R"]) t = np.asarray(self.dataset[idx]["t"]) return np.hstack((R, t.reshape((3, 1)))) def get_rgb_filename(self, idx): """ Get the rgb image filename. """ if idx < 0 or idx >= self.nb_images: print("Invalid index") return None return self.dataset[idx]["file_name"] def get_annotations(self, idx): """ Get objects annotations. """ if idx < 0 or idx >= self.nb_images: print("Invalid index") return None if "annotations" not in self.dataset[idx].keys(): print("No annotations available") return None return self.dataset[idx]["annotations"]
e34da30e0fb3817fcdbb7cc9a440c0a0a2569f19
ec388ce4de7e9268bf65501c0f549632a9b4f448
/eden/integration/lib/systemd.py
6f6f83322b20739833d709ce812c6dd76a9815c9
[ "BSD-3-Clause" ]
permissive
ExpLife0011/eden
fc789faefd7b6a6a37c34063ffe4faec83c8a9cf
239a4ae8c4e707a61207ed6a2c41a43838961b46
refs/heads/master
2020-04-08T19:39:58.975823
2018-11-29T01:31:38
2018-11-29T01:33:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
17,508
py
#!/usr/bin/env python3 # # Copyright (c) 2016-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. import abc import contextlib import errno import logging import os import os.path import pathlib import re import subprocess import sys import tempfile import threading import types import typing from .find_executables import FindExe from .linux import LinuxCgroup, ProcessID from .temporary_directory import create_tmp_dir logger = logging.getLogger(__name__) SystemdUnitName = str class SystemdUserServiceManager: """A running 'systemd --user' process manageable using 'systemctl --user'.""" def __init__(self, xdg_runtime_dir: pathlib.Path) -> None: super().__init__() self.__xdg_runtime_dir = xdg_runtime_dir @property def xdg_runtime_dir(self) -> pathlib.Path: return self.__xdg_runtime_dir def is_alive(self) -> bool: result = self._systemctl.run( ["--user", "show-environment"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) if result.returncode == 0: return True if result.returncode == 1: logger.warning(f'{self} is not alive: {result.stdout.decode("utf-8")}') return False result.check_returncode() return False def enable_runtime_unit_from_file(self, unit_file: pathlib.Path) -> None: self._systemctl.check_call(["enable", "--runtime", "--", unit_file]) self._systemctl.check_call(["daemon-reload"]) self.sanity_check_enabled_unit(unit_file=unit_file) def sanity_check_enabled_unit(self, unit_file: pathlib.Path) -> None: unit_name = unit_file.name if "@" in unit_name: unit_name = unit_name.replace("@", "@testinstance") self.sanity_check_enabled_unit_fragment( unit_name=unit_name, expected_unit_file=unit_file ) self.sanity_check_enabled_unit_sources( unit_name=unit_name, expected_unit_file=unit_file ) def sanity_check_enabled_unit_fragment( self, unit_name: SystemdUnitName, expected_unit_file: pathlib.Path ) -> None: service = SystemdService(unit_name=unit_name, systemd=self) actual_unit_file = service.query_fragment_path() if actual_unit_file != expected_unit_file: raise Exception( "Enabled unit's FragmentPath does not match unit file\n" "Expected: {repr(expected_unit_file)}\n" "Actual: {repr(actual_unit_file)}" ) def sanity_check_enabled_unit_sources( self, unit_name: SystemdUnitName, expected_unit_file: pathlib.Path ) -> None: actual_unit_sources = self._systemctl.check_output(["cat", "--", unit_name]) expected_unit_sources = b"" for file in [expected_unit_file]: expected_unit_sources += b"# " + bytes(file) + b"\n" expected_unit_sources += file.read_bytes() if actual_unit_sources != expected_unit_sources: raise Exception( "Enabled unit does not match unit file\n" "Expected: {repr(expected_unit_sources)}\n" "Actual: {repr(actual_unit_sources)}" ) def systemd_run( self, command: typing.Sequence[str], properties: typing.Mapping[str, str], extra_env: typing.Mapping[str, str], unit_name: typing.Optional[SystemdUnitName] = None, ) -> "SystemdService": systemd_run_command = ["systemd-run", "--user"] for name, value in properties.items(): systemd_run_command.extend(("--property", f"{name}={value}")) for name, value in extra_env.items(): systemd_run_command.extend(("--setenv", f"{name}={value}")) if unit_name is not None: systemd_run_command.extend(("--unit", unit_name)) systemd_run_command.append("--") systemd_run_command.extend(command) output = subprocess.check_output( systemd_run_command, env=self.env, stderr=subprocess.STDOUT ) match = re.match( r"^Running as unit: (?P<unit>.*)$", output.decode("utf-8"), flags=re.MULTILINE, ) if match is None: raise Exception("Failed to parse unit from command output") return self.get_service(match.group("unit")) def get_active_unit_names(self) -> typing.List[SystemdUnitName]: def parse_line(line: str) -> SystemdUnitName: parts = re.split(r" +", line) return parts[0] stdout = self._systemctl.check_output( [ "list-units", "--all", "--full", "--no-legend", "--no-pager", "--plain", "--state=active", ] ) return [parse_line(line) for line in stdout.decode("utf-8").splitlines()] def get_unit_paths(self) -> typing.List[pathlib.Path]: stdout = subprocess.check_output( ["systemd-analyze", "--user", "unit-paths"], env=self.env ) return [pathlib.Path(line) for line in stdout.decode("utf-8").splitlines()] def get_service(self, unit_name: SystemdUnitName) -> "SystemdService": return SystemdService(unit_name=unit_name, systemd=self) @property def env(self) -> typing.Dict[str, str]: env = dict(os.environ) env.update(self.extra_env) return env @property def extra_env(self) -> typing.Dict[str, str]: return { "DBUS_SESSION_BUS_ADDRESS": "", "XDG_RUNTIME_DIR": str(self.xdg_runtime_dir), } @property def _systemctl(self) -> "_SystemctlCLI": return _SystemctlCLI(env=self.env) def __str__(self) -> str: return f"systemd ({self.xdg_runtime_dir})" def __repr__(self) -> str: return ( f"SystemdUserServiceManager(xdg_runtime_dir={repr(self.xdg_runtime_dir)})" ) class SystemdService: def __init__( self, unit_name: SystemdUnitName, systemd: SystemdUserServiceManager ) -> None: super().__init__() self.__systemd = systemd self.__unit_name = unit_name @property def unit_name(self) -> SystemdUnitName: return self.__unit_name def start(self) -> None: self.__systemctl.check_call(["start", "--", self.unit_name]) def stop(self) -> None: self.__systemctl.check_call(["stop", "--", self.unit_name]) def restart(self) -> None: self.__systemctl.check_call(["restart", "--", self.unit_name]) def query_active_state(self) -> str: return self.__query_property("ActiveState").decode("utf-8") def query_sub_state(self) -> str: return self.__query_property("SubState").decode("utf-8") def query_cgroup(self) -> LinuxCgroup: return LinuxCgroup(self.__query_property("ControlGroup")) def query_process_ids(self) -> typing.Sequence[ProcessID]: return self.query_cgroup().query_process_ids() def query_fragment_path(self) -> pathlib.Path: return pathlib.Path(os.fsdecode(self.__query_property("FragmentPath"))) def __query_property(self, property: str) -> bytes: stdout = self.__systemctl.check_output( ["show", f"--property={property}", "--", self.unit_name] ) prefix = property.encode("utf-8") + b"=" if not stdout.startswith(prefix): raise Exception(f"Failed to parse output of systemctl show: {stdout}") return stdout[len(prefix) :].rstrip(b"\n") @property def __systemctl(self) -> "_SystemctlCLI": return self.__systemd._systemctl def __str__(self) -> str: return f"{self.unit_name} (XDG_RUNTIME_DIR={self.__systemd.xdg_runtime_dir})" def __repr__(self) -> str: return ( f"SystemdService(unit_name={repr(self.unit_name)}, " f"systemd={repr(self.__systemd)})" ) class _SystemctlCLI: def __init__(self, env: typing.Dict[str, str]) -> None: super().__init__() self.__env = env def check_call( self, command_arguments: typing.Sequence[typing.Union[str, pathlib.Path]] ) -> None: """Run 'systemctl --user' with the given arguments. See also subprocess.check_call. """ subprocess.check_call(self.__command(command_arguments), env=self.__env) def check_output( self, command_arguments: typing.Sequence[typing.Union[str, pathlib.Path]] ) -> bytes: """Run 'systemctl --user' and return the command's output. See also subprocess.check_output. """ return subprocess.check_output( self.__command(command_arguments), env=self.__env ) def run( self, command_arguments: typing.Sequence[typing.Union[str, pathlib.Path]], stdout: "subprocess._FILE" = None, stderr: "subprocess._FILE" = None, ) -> subprocess.CompletedProcess: """Run 'systemctl --user' and return the command's output and exit status. See also subprocess.run. """ return subprocess.run( self.__command(command_arguments), env=self.__env, stdout=stdout, stderr=stderr, ) def __command( self, command_arguments: typing.Sequence[typing.Union[str, pathlib.Path]] ) -> typing.Sequence[str]: command = ["systemctl", "--user"] command.extend(str(arg) for arg in command_arguments) return command class SystemdUserServiceManagerMixin(metaclass=abc.ABCMeta): def make_temporary_systemd_user_service_manager(self) -> SystemdUserServiceManager: context_manager = temporary_systemd_user_service_manager() exit = context_manager.__exit__ systemd = context_manager.__enter__() self.addCleanup(lambda: exit(None, None, None)) # pyre-ignore (T36820067) return systemd def addCleanup( self, function: typing.Callable[..., typing.Any], *args: typing.Any, **kwargs: typing.Any, ) -> None: raise NotImplementedError() @contextlib.contextmanager def temporary_systemd_user_service_manager() -> typing.Iterator[ SystemdUserServiceManager ]: """Create an isolated systemd instance for tests.""" def should_create_managed() -> bool: forced_type_variable = "EDEN_TEST_FORCE_SYSTEMD_USER_SERVICE_MANAGER_TYPE" forced_type = os.getenv(forced_type_variable) if forced_type is not None and forced_type: if forced_type == "managed": return True if forced_type == "unmanaged": return False raise ValueError( f"Unsupported value for {forced_type_variable}: {forced_type!r}" ) if not _is_system_booted_with_systemd(): return False return True lifetime_duration = 30 with create_tmp_dir() as xdg_runtime_dir: if should_create_managed(): parent_systemd = SystemdUserServiceManager( xdg_runtime_dir=_get_current_xdg_runtime_dir() ) with _transient_managed_systemd_user_service_manager( xdg_runtime_dir=xdg_runtime_dir, parent_systemd=parent_systemd, lifetime_duration=lifetime_duration, ) as child_systemd: yield child_systemd else: with _TransientUnmanagedSystemdUserServiceManager( xdg_runtime_dir=xdg_runtime_dir, lifetime_duration=lifetime_duration ) as systemd: yield systemd def _is_system_booted_with_systemd() -> bool: """See the sd_booted(3) manual page.""" return pathlib.Path("/run/systemd/system/").exists() @contextlib.contextmanager def _transient_managed_systemd_user_service_manager( xdg_runtime_dir: pathlib.Path, parent_systemd: SystemdUserServiceManager, lifetime_duration: int, ) -> typing.Iterator[SystemdUserServiceManager]: """Create an isolated systemd instance using 'systemd-run systemd'.""" child_systemd_service = parent_systemd.systemd_run( command=["/usr/lib/systemd/systemd", "--user", "--unit=basic.target"], properties={ "Description": f"Eden test systemd user service manager " f"({xdg_runtime_dir})", "CollectMode": "inactive-or-failed", "Restart": "no", "RuntimeMaxSec": str(lifetime_duration), "TimeoutStartSec": str(lifetime_duration), "Type": "notify", }, extra_env={"XDG_RUNTIME_DIR": str(xdg_runtime_dir)}, ) child_systemd = SystemdUserServiceManager(xdg_runtime_dir=xdg_runtime_dir) try: yield child_systemd finally: try: child_systemd_service.stop() except Exception: logger.warning( f"Failed to stop systemd user service manager ({child_systemd})", exc_info=True, ) # Ignore the exception. class _TransientUnmanagedSystemdUserServiceManager: """Create an isolated systemd instance as child process. This class does not work if a user systemd instance is already running. """ __cleanups: contextlib.ExitStack __lifetime_duration: int __xdg_runtime_dir: pathlib.Path def __init__(self, xdg_runtime_dir: pathlib.Path, lifetime_duration: int) -> None: super().__init__() self.__xdg_runtime_dir = xdg_runtime_dir self.__lifetime_duration = lifetime_duration self.__cleanups = contextlib.ExitStack() def start_systemd_process(self) -> subprocess.Popen: cgroup = self.create_cgroup() env = dict(os.environ) env["XDG_RUNTIME_DIR"] = str(self.__xdg_runtime_dir) # HACK(strager): Work around 'systemd --user' refusing to start if the # system is not managed by systemd. env["LD_PRELOAD"] = str( pathlib.Path(FindExe.FORCE_SD_BOOTED).resolve(strict=True) ) process = subprocess.Popen( [ "timeout", f"{self.__lifetime_duration}s", "/usr/lib/systemd/systemd", "--user", "--unit=basic.target", "--log-target=console", ], stdin=subprocess.DEVNULL, env=env, preexec_fn=lambda: cgroup.add_current_process(), ) self.__cleanups.callback(lambda: self.stop_systemd_process(process)) return process def stop_systemd_process(self, systemd_process: subprocess.Popen) -> None: systemd_process.terminate() try: systemd_process.wait(timeout=15) return except subprocess.TimeoutExpired: pass logger.warning( "Failed to terminate systemd user service manager. Attempting to kill." ) systemd_process.kill() systemd_process.wait(timeout=3) def create_cgroup(self) -> LinuxCgroup: parent_cgroup = LinuxCgroup.from_current_process() path = tempfile.mkdtemp( prefix="edenfs_test.", dir=str(parent_cgroup.sys_fs_cgroup_path) ) cgroup = LinuxCgroup.from_sys_fs_cgroup_path(pathlib.PosixPath(path)) self.__cleanups.callback(lambda: cgroup.delete_recursive()) return cgroup def wait_until_systemd_is_alive( self, systemd_process: subprocess.Popen, child_systemd: SystemdUserServiceManager, ) -> None: while True: systemd_did_exit = systemd_process.poll() is not None if systemd_did_exit: raise Exception("systemd failed to start") if child_systemd.is_alive(): return def __enter__(self) -> SystemdUserServiceManager: systemd_process = self.start_systemd_process() child_systemd = SystemdUserServiceManager( xdg_runtime_dir=self.__xdg_runtime_dir ) self.wait_until_systemd_is_alive(systemd_process, child_systemd) return child_systemd def __exit__( self, exc_type: typing.Optional[typing.Type[BaseException]], exc_value: typing.Optional[BaseException], traceback: typing.Optional[types.TracebackType], ) -> typing.Optional[bool]: self.__cleanups.close() return None def _get_current_xdg_runtime_dir() -> pathlib.Path: problems = [] path = None if path is None: path_from_env = os.environ.get("XDG_RUNTIME_DIR") if path_from_env is None or path_from_env == "": problems.append("$XDG_RUNTIME_DIR is not set") else: path = pathlib.Path(path_from_env) if path is None: if os.getuid() == 0: path = pathlib.Path("/run") else: path = pathlib.Path("/run/user") / str(os.getuid()) assert path is not None if not path.exists(): problems.append(f"'{path}' does not exist") raise Exception( "Could not determine XDG_RUNTIME_DIR: " + ", and ".join(problems) ) return path
f412e114622a62333efacf8bd085912edb0d96e1
7eebbfaee45fdc57c4fc6ba32c87c35be1e62b14
/airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/report_streams/products_report.py
ea97bf690ae643e105877fc34e221bea461fb5e4
[ "MIT", "Elastic-2.0" ]
permissive
Velocity-Engineering/airbyte
b6e1fcead5b9fd7c74d50b9f27118654604dc8e0
802a8184cdd11c1eb905a54ed07c8732b0c0b807
refs/heads/master
2023-07-31T15:16:27.644737
2021-09-28T08:43:51
2021-09-28T08:43:51
370,730,633
0
1
MIT
2021-06-08T05:58:44
2021-05-25T14:55:43
Java
UTF-8
Python
false
false
8,127
py
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # from copy import copy from .report_streams import RecordType, ReportStream METRICS_MAP = { "campaigns": [ "bidPlus", "campaignName", "campaignId", "campaignStatus", "campaignBudget", "campaignRuleBasedBudget", "applicableBudgetRuleId", "applicableBudgetRuleName", "impressions", "clicks", "cost", "attributedConversions1d", "attributedConversions7d", "attributedConversions14d", "attributedConversions30d", "attributedConversions1dSameSKU", "attributedConversions7dSameSKU", "attributedConversions14dSameSKU", "attributedConversions30dSameSKU", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedSales1d", "attributedSales7d", "attributedSales14d", "attributedSales30d", "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU", "attributedUnitsOrdered1dSameSKU", "attributedUnitsOrdered7dSameSKU", "attributedUnitsOrdered14dSameSKU", "attributedUnitsOrdered30dSameSKU", ], "adGroups": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "impressions", "clicks", "cost", "attributedConversions1d", "attributedConversions7d", "attributedConversions14d", "attributedConversions30d", "attributedConversions1dSameSKU", "attributedConversions7dSameSKU", "attributedConversions14dSameSKU", "attributedConversions30dSameSKU", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedSales1d", "attributedSales7d", "attributedSales14d", "attributedSales30d", "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU", "attributedUnitsOrdered1dSameSKU", "attributedUnitsOrdered7dSameSKU", "attributedUnitsOrdered14dSameSKU", "attributedUnitsOrdered30dSameSKU", ], "keywords": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "keywordId", "keywordText", "matchType", "impressions", "clicks", "cost", "attributedConversions1d", "attributedConversions7d", "attributedConversions14d", "attributedConversions30d", "attributedConversions1dSameSKU", "attributedConversions7dSameSKU", "attributedConversions14dSameSKU", "attributedConversions30dSameSKU", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedSales1d", "attributedSales7d", "attributedSales14d", "attributedSales30d", "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU", "attributedUnitsOrdered1dSameSKU", "attributedUnitsOrdered7dSameSKU", "attributedUnitsOrdered14dSameSKU", "attributedUnitsOrdered30dSameSKU", ], "productAds": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "impressions", "clicks", "cost", "currency", "asin", "attributedConversions1d", "attributedConversions7d", "attributedConversions14d", "attributedConversions30d", "attributedConversions1dSameSKU", "attributedConversions7dSameSKU", "attributedConversions14dSameSKU", "attributedConversions30dSameSKU", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedSales1d", "attributedSales7d", "attributedSales14d", "attributedSales30d", "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU", "attributedUnitsOrdered1dSameSKU", "attributedUnitsOrdered7dSameSKU", "attributedUnitsOrdered14dSameSKU", "attributedUnitsOrdered30dSameSKU", ], "asins_keywords": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "keywordId", "keywordText", "asin", "otherAsin", "sku", "currency", "matchType", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedUnitsOrdered1dOtherSKU", "attributedUnitsOrdered7dOtherSKU", "attributedUnitsOrdered14dOtherSKU", "attributedUnitsOrdered30dOtherSKU", "attributedSales1dOtherSKU", "attributedSales7dOtherSKU", "attributedSales14dOtherSKU", "attributedSales30dOtherSKU", ], "asins_targets": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "asin", "otherAsin", "sku", "currency", "matchType", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedUnitsOrdered1dOtherSKU", "attributedUnitsOrdered7dOtherSKU", "attributedUnitsOrdered14dOtherSKU", "attributedUnitsOrdered30dOtherSKU", "attributedSales1dOtherSKU", "attributedSales7dOtherSKU", "attributedSales14dOtherSKU", "attributedSales30dOtherSKU", "targetId", "targetingText", "targetingType", ], "targets": [ "campaignName", "campaignId", "adGroupName", "adGroupId", "targetId", "targetingExpression", "targetingText", "targetingType", "impressions", "clicks", "cost", "attributedConversions1d", "attributedConversions7d", "attributedConversions14d", "attributedConversions30d", "attributedConversions1dSameSKU", "attributedConversions7dSameSKU", "attributedConversions14dSameSKU", "attributedConversions30dSameSKU", "attributedUnitsOrdered1d", "attributedUnitsOrdered7d", "attributedUnitsOrdered14d", "attributedUnitsOrdered30d", "attributedSales1d", "attributedSales7d", "attributedSales14d", "attributedSales30d", "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU", "attributedUnitsOrdered1dSameSKU", "attributedUnitsOrdered7dSameSKU", "attributedUnitsOrdered14dSameSKU", "attributedUnitsOrdered30dSameSKU", ], } class SponsoredProductsReportStream(ReportStream): """ https://advertising.amazon.com/API/docs/en-us/sponsored-products/2-0/openapi#/Reports """ def report_init_endpoint(self, record_type: str) -> str: return f"/v2/sp/{record_type}/report" metrics_map = METRICS_MAP def _get_init_report_body(self, report_date: str, record_type: str, profile): metrics_list = self.metrics_map[record_type] body = { "reportDate": report_date, } if RecordType.ASINS in record_type: body["campaignType"] = "sponsoredProducts" if profile.accountInfo.type == "vendor": metrics_list = copy(metrics_list) metrics_list.remove("sku") return {**body, "metrics": ",".join(metrics_list)}
a8d8af51088b85de2bc2918484ac156679217741
6a9f6e6527afb38611a5c695e5845e492d7676ff
/102.binary-tree-level-order-traversal.py
7eb77a9a8d81de928a9b97a1005e30cb9e67ae71
[]
no_license
Junyangz/leetcode
39913d48778d369f9f0a96070352d63b207e7df6
5de48fbdcb61ce8a437255a119a4a3ae242ede52
refs/heads/master
2020-06-09T08:57:26.361138
2019-11-14T08:38:07
2019-11-14T08:38:07
193,413,271
0
0
null
null
null
null
UTF-8
Python
false
false
635
py
# # @lc app=leetcode id=102 lang=python3 # # [102] Binary Tree Level Order Traversal # # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: res = [] def levelOrder(self, root: TreeNode, l=0) -> List[List[int]]: if not root: return None if l == 0: self.res = [] if len(self.res) < l + 1: self.res.append([]) self.res[l].append(root.val) left, right = self.levelOrder(root.left, l + 1), self.levelOrder(root.right, l + 1) return self.res
227324e4b93ca4b8bf74ffa2dd956e21cce31967
9743d5fd24822f79c156ad112229e25adb9ed6f6
/xai/brain/wordbase/adjectives/_primaries.py
e457d57cae006604c84eb17a3f6a03363e756bca
[ "MIT" ]
permissive
cash2one/xai
de7adad1758f50dd6786bf0111e71a903f039b64
e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6
refs/heads/master
2021-01-19T12:33:54.964379
2017-01-28T02:00:50
2017-01-28T02:00:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
257
py
from xai.brain.wordbase.adjectives._primary import _PRIMARY #calss header class _PRIMARIES(_PRIMARY, ): def __init__(self,): _PRIMARY.__init__(self) self.name = "PRIMARIES" self.specie = 'adjectives' self.basic = "primary" self.jsondata = {}
d2cb3437eb8ea8a93580f88ea57e3ac8d9291e75
30b97efb2f36f81aa684d16d19e0e2db17f2967d
/09. 기본수학2/3009.py
9717ea46cc12a0dece6c17b3d29096b76c42fd5b
[]
no_license
jmseb3/bakjoon
0a784a74c6476ef51864e2ada9d2551c7c7979eb
a38db54e851372059b0e45add92e43e556835e62
refs/heads/main
2023-08-25T08:43:04.579785
2021-10-01T08:40:37
2021-10-01T08:40:37
362,287,450
2
0
null
null
null
null
UTF-8
Python
false
false
259
py
x = [0,0,0] y = [0,0,0] ans = [0,0] for i in range(3): x[i], y[i] = map(int, input().split()) for i in range(3): if x[i%3] == x[(i+1) %3]: ans[0] = x[(i+2)%3] if y[i%3] == y[(i+1)%3]: ans[1] = y[(i+2)%3] print(ans[0],ans[1])
fb93d545c4c43801e2e58c194bc06d63dc13116b
8997a0bf1e3b6efe5dd9d5f307e1459f15501f5a
/tensorflow__deep_dream/main.py
ee4ed831937293c6cb4bb3cd528b1385333935bf
[ "CC-BY-4.0" ]
permissive
stepik/SimplePyScripts
01092eb1b2c1c33756427abb2debbd0c0abf533f
3259d88cb58b650549080d6f63b15910ae7e4779
refs/heads/master
2023-05-15T17:35:55.743164
2021-06-11T22:59:07
2021-06-11T22:59:07
null
0
0
null
null
null
null
UTF-8
Python
false
false
14,680
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # MOTE: То, что эта нейронная сеть делает называется "Инцепционизм" -- картины, «написанные» нейронными сетями. # SOURCE: https://github.com/llSourcell/deep_dream_challenge # OTHER: # https://github.com/llSourcell/deep_dream_challenge/blob/master/deep_dream.py # https://github.com/samkit-jain/Data-Science-by-Siraj-Raval/blob/a66b7791a4628f815dc683605dd224acad9bc277/deep_dream_challenge.py#L149 # https://medium.com/@mrubash1/deepdream-accelerating-deep-learning-with-hardware-5085ea415d8a # https://github.com/mrubash1/DeepDream_Streaming_Video/tree/master/src # https://github.com/mrubash1/DeepDream_Streaming_Video/blob/master/src/deep_dream.py # https://github.com/mrubash1/DeepDream_Streaming_Video/blob/master/src/app.py # Статьи на русском о DeepDream: # https://habrahabr.ru/company/io/blog/262267/ # https://meduza.io/shapito/2015/06/19/hudozhnik-ot-gugla-neyronnye-seti-nauchilis-pisat-kartiny # https://meduza.io/galleries/2015/06/19/intseptsionizm # LAYERS: # http://storage.googleapis.com/deepdream/visualz/tensorflow_inception/index.html # # import requests # rs = requests.get('http://storage.googleapis.com/deepdream/visualz/tensorflow_inception/index.html') # # from bs4 import BeautifulSoup # root = BeautifulSoup(rs.content, 'html.parser') # layers = [a.text for a in root.select('a')] # print(layers) # ['conv2d0_pre_relu', 'conv2d1_pre_relu', 'conv2d2_pre_relu', 'head0_bottleneck_pre_relu', ... # ABOUT CODE: # http://nbviewer.jupyter.org/github/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb # NOTE: "FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated" # pip3 install h5py==2.8.0rc1 import os import io from timeit import default_timer from typing import Union # pip install tensorflow==1.15 # pip install tensorflow-gpu==1.15 # pip install tensorflow import tensorflow as tf import numpy as np import PIL.Image # import matplotlib.pyplot as plt from common import download_tensorflow_model, IMG_NOISE, showarray, savearray # # Helper functions for TF Graph visualization # # pylint: disable=unused-variable # def strip_consts(graph_def, max_const_size=32): # """Strip large constant values from graph_def.""" # strip_def = tf.GraphDef() # for n0 in graph_def.node: # n = strip_def.node.add() # pylint: disable=maybe-no-member # n.MergeFrom(n0) # if n.op == 'Const': # tensor = n.attr['value'].tensor # size = len(tensor.tensor_content) # if size > max_const_size: # tensor.tensor_content = "<stripped %d bytes>" % size # return strip_def # def rename_nodes(graph_def, rename_func): # res_def = tf.GraphDef() # for n0 in graph_def.node: # n = res_def.node.add() # pylint: disable=maybe-no-member # n.MergeFrom(n0) # n.name = rename_func(n.name) # for i, s in enumerate(n.input): # n.input[i] = rename_func(s) if s[0] != '^' else '^' + rename_func(s[1:]) # return res_def # def showarray(a): # a = np.uint8(np.clip(a, 0, 1) * 255) # plt.imshow(a) # plt.show() # # def savearray(a, file_name): # print('save:', file_name) # # a = np.uint8(np.clip(a, 0, 1) * 255) # PIL.Image.fromarray(a).save(file_name) # # def visstd(a, s=0.1): # '''Normalize the image range for visualization''' # return (a - a.mean()) / max(a.std(), 1e-4) * s + 0.5 def T(layer): '''Helper for getting layer output tensor''' return graph.get_tensor_by_name("import/%s:0" % layer) # def render_naive(t_obj, img0=img_noise, iter_n=20, step=1.0): # t_score = tf.reduce_mean(t_obj) # defining the optimization objective # t_grad = tf.gradients(t_score, t_input)[0] # behold the power of automatic differentiation! # # img = img0.copy() # for _ in range(iter_n): # g, _ = sess.run([t_grad, t_score], {t_input: img}) # # normalizing the gradient, so the same step size should work # g /= g.std() + 1e-8 # for different layers and networks # img += g * step # showarray(visstd(img)) data_dir = 'data/' # Step 1 - download google's pre-trained neural network download_tensorflow_model(data_dir) model_fn = 'tensorflow_inception_graph.pb' # Step 2 - Creating Tensorflow session and loading the model graph = tf.Graph() sess = tf.compat.v1.InteractiveSession(graph=graph) with tf.io.gfile.GFile(os.path.join(data_dir, model_fn), 'rb') as f: graph_def = tf.compat.v1.GraphDef() graph_def.ParseFromString(f.read()) t_input = tf.compat.v1.placeholder(np.float32, name='input') # define the input tensor imagenet_mean = 117.0 t_preprocessed = tf.expand_dims(t_input - imagenet_mean, 0) tf.import_graph_def(graph_def, {'input': t_preprocessed}) layers = [op.name for op in graph.get_operations() if op.type == 'Conv2D' and 'import/' in op.name] feature_nums = [int(graph.get_tensor_by_name(name + ':0').get_shape()[-1]) for name in layers] print('Number of layers', len(layers)) print('Total number of feature units:', sum(feature_nums)) # import webbrowser # for layer in layers: # # "import/conv2d0_pre_relu/conv" -> "conv2d0_pre_relu" # name = layer.split('/')[1] # url = f'http://storage.googleapis.com/deepdream/visualz/tensorflow_inception/{name}.html' # webbrowser.open(url) # NOTE: Interesting layers # layer = 'mixed3b_3x3_bottleneck_pre_relu' # unit = 109 # Other # # layer = 'mixed5a_3x3_pre_relu' # unit = 174 # Fear # unit = 190 # Fear # unit = 299 # Fear # unit = 304 # Fear # unit = 316 # Fear # unit = 317 # Fear # # layer = 'mixed4d_3x3_bottleneck_pre_relu' # unit = 65 # Building # unit = 66 # Building # unit = 88 # Fear # unit = 114 # Building # unit = 139 # Flowers # # layer = 'mixed5b_3x3_bottleneck_pre_relu' # unit = 91 # Birds # unit = 119 # Fear # unit = 166 # Birds # unit = 167 # Birds # # layer = 'mixed4a_pool_reduce_pre_relu' # unit = 49 # Fear # # layer = 'mixed4b_3x3_bottleneck_pre_relu' # unit = 33 # Fear # # layer = 'mixed4b_3x3_pre_relu' # unit = 95 # Building # # layer = 'mixed4b_5x5_pre_relu' # unit = 55 # Dogs # # layer = 'mixed4c_3x3_pre_relu' # unit = 83 # Flowers # unit = 230 # Flowers # # layer = 'mixed4d_5x5_bottleneck_pre_relu' # unit = 13 # Building # # layer = 'mixed5a_5x5_pre_relu' # unit = 11 # Animals # unit = 44 # Village # # layer = 'mixed4d_5x5_pre_relu' # unit = 1 # Cats # # layer = 'mixed4e_pool_reduce_pre_relu' # unit = 26 # Building # unit = 27 # Animals # unit = 29 # Dogs # unit = 50 # Birds # unit = 57 # Birds # unit = 68 # Flowers # unit = 101 # Fear # unit = 105 # Cats # # layer = 'mixed5a_3x3_bottleneck_pre_relu' # unit = 100 # Dogs # # layer = 'mixed5a_pool_reduce_pre_relu' # unit = 16 # Birds # unit = 53 # Monkeys # # layer = 'mixed5a_1x1_pre_relu' # unit = 0 # Animals # unit = 1 # Animals # unit = 3 # Fear # unit = 9 # Other # unit = 47 # Dogs # unit = 57 # Snakes # unit = 63 # Butterflies # unit = 81 # Animals # unit = 93 # Other # unit = 97 # Animals # unit = 158 # Fishes # unit = 175 # Dogs # unit = 224 # Birds # # layer = 'mixed4d_3x3_pre_relu' # unit = 88 # Flowers # # layer = 'mixed4c_pool_reduce_pre_relu' # unit = 1 # Other # unit = 23 # Animals # unit = 29 # Building # unit = 41 # Flowers # unit = 61 # Building # # layer = 'mixed4c_5x5_pre_relu' # unit = 14 # Cars # unit = 63 # Cars output_dir = 'output' if not os.path.exists(output_dir): os.mkdir(output_dir) def tffunc(*argtypes): '''Helper that transforms TF-graph generating function into a regular one. See "resize" function below. ''' placeholders = list(map(tf.compat.v1.placeholder, argtypes)) def wrap(f): out = f(*placeholders) def wrapper(*args, **kw): return out.eval(dict(zip(placeholders, args)), session=kw.get('session')) return wrapper return wrap def resize(img, size): img = tf.expand_dims(img, 0) return tf.compat.v1.image.resize_bilinear(img, size)[0, :, :, :] resize = tffunc(np.float32, np.int32)(resize) def calc_grad_tiled(img, t_grad, sess, tile_size=512): '''Compute the value of tensor t_grad over the image in a tiled way. Random shifts are applied to the image to blur tile boundaries over multiple iterations.''' sz = tile_size h, w = img.shape[:2] sx, sy = np.random.randint(sz, size=2) img_shift = np.roll(np.roll(img, sx, 1), sy, 0) grad = np.zeros_like(img) for y in range(0, max(h - sz // 2, sz), sz): for x in range(0, max(w - sz // 2, sz), sz): sub = img_shift[y:y + sz, x:x + sz] g = sess.run(t_grad, {t_input: sub}) grad[y:y + sz, x:x + sz] = g return np.roll(np.roll(grad, -sx, 1), -sy, 0) # TODO: TEST THIS # SOURCE: https://github.com/samkit-jain/Data-Science-by-Siraj-Raval/blob/a66b7791a4628f815dc683605dd224acad9bc277/deep_dream_challenge.py#L149 def render_deepdreamvideo(sess): import imageio reader = imageio.get_reader('cockatoo.mp4') fps = reader.get_meta_data()['fps'] writer = imageio.get_writer('output.mp4', fps=fps) for i, image in enumerate(reader): image = np.float32(image) # Apply gradient ascent to that layer and append to video image = writer.append_data(render_deepdream(tf.square(T('mixed4c')), sess, image)) writer.append_data(image) writer.close() def render_deepdream(t_obj, sess, img0=IMG_NOISE, iter_n=10, step=1.5, octave_n=4, octave_scale=1.4): t_score = tf.reduce_mean(t_obj) # defining the optimization objective t_grad = tf.gradients(t_score, t_input)[0] # behold the power of automatic differentiation! # split the image into a number of octaves img = img0 octaves = [] for _ in range(octave_n - 1): hw = img.shape[:2] lo = resize(img, np.int32(np.float32(hw) / octave_scale)) hi = img - resize(lo, hw) img = lo octaves.append(hi) # generate details octave by octave for octave in range(octave_n): if octave > 0: hi = octaves[-octave] img = resize(img, hi.shape[:2]) + hi for _ in range(iter_n): g = calc_grad_tiled(img, t_grad, sess) img += g * (step / (np.abs(g).mean() + 1e-7)) # # this will usually be like 3 or 4 octaves # # Step 5 output deep dream image via matplotlib # showarray(img / 255.0) return img def render_deepdream_from_layer_by_unit(img0, name: Union[str, io.BytesIO], layer, unit=None) -> Union[str, io.BytesIO]: t = default_timer() # t_obj = tf.square(T(layer)[:, :, :, unit]) t_obj = T(layer) if unit: t_obj = t_obj[:, :, :, unit] # t_obj = tf.square(t_obj) img = render_deepdream(t_obj, sess, img0) if isinstance(name, str): if unit: name = f'{output_dir}/{name}__{layer}__{unit}.jpg' else: name = f'{output_dir}/{name}__{layer}.jpg' else: name = name savearray(img / 255.0, name) print(f'Elapsed {default_timer() - t:.2f} secs\n') return name def main(): # # # PRINT: layer by units # t_obj_layers = [x.split('/')[1] for x in layers] # for l in t_obj_layers: # print(l, int(T(l).get_shape()[-1])) # # Layer: mixed4d_5x5 # Url: http://storage.googleapis.com/deepdream/visualz/tensorflow_inception/mixed4d_5x5_pre_relu.html # Url: https://microscope.openai.com/models/inceptionv1/mixed4d_5x5_0/1 savearray(IMG_NOISE / 255.0, '{}/noise.png'.format(output_dir, 'noise')) print() # layer = 'mixed4c' # t_obj = tf.square(T(layer)) # FROM NOISE render_deepdream_from_layer_by_unit(IMG_NOISE, 'noise', 'mixed4d_5x5_pre_relu', 61) render_deepdream_from_layer_by_unit(IMG_NOISE, 'noise', 'head1_bottleneck_pre_relu', 1) # FROM FILENAME img0 = PIL.Image.open('pilatus800.jpg') img0 = np.float32(img0) render_deepdream_from_layer_by_unit(img0, 'pilatus800', 'mixed4d_1x1_pre_relu', 39) render_deepdream_from_layer_by_unit(img0, 'pilatus800', 'mixed4d_5x5_pre_relu', 61) render_deepdream_from_layer_by_unit(img0, 'pilatus800', 'mixed4c_3x3_bottleneck_pre_relu', 64) render_deepdream_from_layer_by_unit(img0, 'pilatus800', 'mixed4c_3x3_bottleneck_pre_relu', 104) # Save to memory bytes_io = io.BytesIO() render_deepdream_from_layer_by_unit(IMG_NOISE, bytes_io, 'mixed4d_5x5_pre_relu', 61) bytes_io.seek(0) print(bytes_io.read(10)) # b'\xff\xd8\xff\xe0\x00\x10JFIF' # # PROCESS FROM ALL LAYERS # # ['conv2d0_pre_relu', 'conv2d1_pre_relu', 'conv2d2_pre_relu', 'mixed3a_1x1_pre_relu', ... # t_obj_layers = [x.split('/')[1] for x in layers] # for name in t_obj_layers: # render_deepdream_from_layer_by_unit(img0, name) # # t_obj = tf.square(T(layer)) # # img = render_deepdream(t_obj, sess, img0) # # savearray(img / 255.0, '{}/{}_{}.png'.format(output_dir, 'pilatus800', layer)) # # FROM filters # layer = 'mixed4d_3x3_bottleneck_pre_relu' # filter_name = {'Tornado': 84, 'Flowers': 139, 'Fireworks': 50, 'Caves': 38, 'Mountains': 142, 'Van Gogh': 1} # for name, unit in filter_name.items(): # t_obj = tf.square(T(layer)[:, :, :, unit]) # img = render_deepdream(t_obj, sess, img0) # savearray(img / 255.0, '{}/{}_{}_{}.png'.format(output_dir, 'pilatus800', name, layer)) # TODO: test # render_deepdreamvideo(sess) # # # # Step 3 - Pick a layer to enhance our image # layer = 'mixed4d_3x3_bottleneck_pre_relu' # unit = 139 # picking some feature unit to visualize # # # img0 = img_noise # # # open image # img0 = PIL.Image.open('pilatus800.jpg') # img0 = np.float32(img0) # # # showarray(img0) # # # # # Step 4 - Apply gradient ascent to that layer # # # render_deepdream(tf.square(T('mixed4c')), img0) # # # t_obj = tf.square(T('mixed4c')) # # t_obj = tf.square(T(layer)[:, :, :, unit]) # # img = render_deepdream(t_obj, sess, img0) # # # img = render_deepdream(tf.square(T('mixed4c')), sess, img0) # # # showarray(img / 255.0) # # savearray(img / 255.0, 'output.png') # # print(T('mixed4d_3x3_bottleneck_pre_relu')) # print(T('mixed4c')) # # print(T('abc')) # quit() if __name__ == '__main__': main()
eabdc460c1970ab10e273e221fc427cb01c439ff
08db753c516c90538fbebe6570b62caa395c6860
/MRaswan_Assignment8/harry_potter.py
ad18f3ee2f9e8943ef7cfde23a4a6da5a90242f2
[]
no_license
meghnaraswan/PythonAssignments
4c717fb90e6a782db8789582408d8ad313bbd000
63d6afaa0a6f4086031eaa66b1fbb7a6a533cd8f
refs/heads/master
2021-07-11T10:39:14.403841
2021-04-04T19:40:49
2021-04-04T19:40:49
237,349,522
0
0
null
null
null
null
UTF-8
Python
false
false
2,546
py
#Meghna Raswan #2337415 #[email protected] #CPSC 230-10 (1515) #Assignment 8 #word count import operator def read_file(input_file_name): input_file_handle = open(input_file_name, 'r') ##opens the file and reads the file str_of_words = "" #initialize output string for line_str in input_file_handle: #iterate over every line in the file line_list = line_str.split() #split the lines into a list of individual words for word in line_list: #iterates over every word in the list of words word = word.lower().strip(',.!?"') #make lower case and removes punctuation from list if word != "": #if after stripping we are left with empty word then don't add str_of_words += word + " " #add to string input_file_handle.close() #closes file return str_of_words def build_dictionary(string_of_words): text_list = string_of_words.split() #split the list into a list of individual words word_dict = {} #initialize output dictionary for word in text_list: #iderates over every word in the list if word in word_dict: word_dict[word] += 1 #adds 1 count for every word repeated else: word_dict[word] = 1 #else, if the word is not repeated, it will have a word count of 1 return word_dict def write_file(word_dict): sorted_list = sorted(word_dict.items(), key=operator.itemgetter(1), reverse=True) #sorts dictionary in ascending order, and the reverse sorts in descending order output_file = open("counts.txt", "w") #writes the new text into a new file called counts.txt for (word, count) in sorted_list: #word is the key and count is the value in the dictionary print("{}, {}".format(word, count)) #formats the list as word, count output_file.write("{}, {}\n".format(word, count)) #writes this into the new file and adds new line for every new word and count output_file.close() #closes file return (word, count) if __name__ == '__main__': #script is being run as the main module input_file = 'harry_potter.txt' #the file we will be reading word_string = read_file(input_file) #calling the read_file function to read harry_potter.txt file, remove punctuation, and create a string word_dict = build_dictionary(word_string) #calling the build_dictionary function on word_string to create a dictionary using the string and counting the words write_file(word_dict) #calling the write_file function to create a new file with the words and word count sorted in descending order
751151aa43a65c2ae6631e2343285b05224fe7b3
b9d53e5506ee883d74614cf564e37de53e924b5c
/run.py
7b84858abcb14586b5bb52e0c378af1bf6e69ace
[]
no_license
Hodo7amShichiYA/VK_Img_V1
e5eb78d0374d24219183fb98da4b0e9018973611
307601cfa23bd150487eb14ecea43e3f0ab0aa0d
refs/heads/master
2020-06-05T09:00:25.851616
2019-06-17T16:50:43
2019-06-17T16:50:43
192,385,177
0
0
null
null
null
null
UTF-8
Python
false
false
2,102
py
from selenium import webdriver from lxml import etree import time from time import sleep def vkimg(userid): email = 'x' pwd = 'x' with open('./%s lasturl.txt'%userid, 'r+') as l: url = l.read() print('地址获取成功') chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') browser = webdriver.Chrome(chrome_options=chrome_options) browser.implicitly_wait(30) browser.get("https://vk.com/feed") print('LOGIN...') elem = browser.find_element_by_id('email') elem.send_keys(email) elem = browser.find_element_by_id('pass') elem.send_keys(pwd) elem = browser.find_element_by_id('login_button') elem.click() print('登录完成') browser.get(url) starttime = time.time() for i in range(1,40000): pst = time.time() sleep(3) response = browser.page_source html = etree.HTML(response) html_data = html.xpath('//*[@id="pv_photo"]/img/@src')[0] print('获取完成') pageurl = browser.current_url print('正在抓取第%s页的页面代码:%s' % (i,pageurl)) with open('./%s lasturl.txt'%userid, 'w') as tf: tf.write(pageurl) print('获取完成') with open('./%s url.txt'%userid, 'a') as f: f.write('%s\n'%html_data) print('第%s页图片地址抓取完成' % i) elem = browser.find_element_by_id('pv_photo') elem.click() pet = time.time() print('第%s张图片抓取用时%d秒'%(i,(pet-pst))) browser.quit() endtime = time.time() print('程序执行时长:%d 秒'%(endtime-starttime)) if __name__ == "__main__": userid = input('输入本次抓取的文件名:') print('尝试获取上次保存的地址') try: with open('./'+userid+' lasturl.txt', 'r+') as f: aa = f.read() print(aa) except: intro = input('初次抓取请填入第一张图片的地址:') with open('./%s lasturl.txt' % userid, 'w') as lu: lu.write(intro) vkimg(userid)
22f9942da36f5533775e4cecabe544164b90f9ba
000a4b227d970cdc6c8db192f4437698cb782721
/python/helpers/typeshed/stdlib/profile.pyi
982bcabad40111fe78d27e3f9ba69534cb546a7e
[ "MIT", "Apache-2.0" ]
permissive
trinhanhngoc/intellij-community
2eb2f66a2a3a9456e7a0c5e7be1eaba03c38815d
1d4a962cfda308a73e0a7ef75186aaa4b15d1e17
refs/heads/master
2022-11-03T21:50:47.859675
2022-10-19T16:39:57
2022-10-19T23:25:35
205,765,945
1
0
Apache-2.0
2019-09-02T02:55:15
2019-09-02T02:55:15
null
UTF-8
Python
false
false
1,364
pyi
from _typeshed import Self, StrOrBytesPath from typing import Any, Callable, TypeVar from typing_extensions import ParamSpec __all__ = ["run", "runctx", "Profile"] def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... _T = TypeVar("_T") _P = ParamSpec("_P") _Label = tuple[str, int, str] class Profile: bias: int stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented def __init__(self, timer: Callable[[], float] | None = ..., bias: int | None = ...) -> None: ... def set_cmd(self, cmd: str) -> None: ... def simulate_call(self, name: str) -> None: ... def simulate_cmd_complete(self) -> None: ... def print_stats(self, sort: str | int = ...) -> None: ... def dump_stats(self, file: StrOrBytesPath) -> None: ... def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... def calibrate(self, m: int, verbose: int = ...) -> float: ...
98cbfc244d6321a2b2564a9a471a7607c49aa45d
943e502b6e293c48564cf6c6d7dd7e39fc7dcf56
/unnecessary_math/unnecessary_math.py
8bf025b4cc2960f579adae219e7107e308fd6d53
[]
no_license
charsyam/unnecessary_math
e3a49f757dcf1a606a53c90fb8be5ba50e5dd412
fcd6fe4a87b89419bb05886388e9f6342079b5cb
refs/heads/master
2021-01-20T12:52:19.963717
2017-05-13T03:33:19
2017-05-13T03:33:19
90,422,244
0
0
null
2017-05-13T03:33:19
2017-05-05T22:44:48
Python
UTF-8
Python
false
false
443
py
''' Module showing how doctests can be included with source code Each '>>>' line is run as if in a python shell, and counts as a test. The next line, if not '>>>' is the expected output of the previous line. If anything doesn't match exactly (including trailing spaces), the test fails. ''' def multiply(a, b): """ >>> multiply(4, 3) 12 >>> multiply('a', 3) 'aaa' """ return a * b def add(a, b): return a + b
0fd3fb1d4912d8adc8ba824a5d0208ed3da11c1d
a28e1e659e4dd82be5e253443b0c7a808cdcee92
/DataStructure/tree.py
a5baa7fec37b604010a20f5f471ca8781ac1a306
[]
no_license
LeBron-Jian/BasicAlgorithmPractice
b2af112e8f1299fe17cf456111276fce874586cb
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
refs/heads/master
2023-06-07T19:12:16.362428
2023-05-27T06:58:12
2023-05-27T06:58:12
217,682,743
13
14
null
2020-09-12T01:50:35
2019-10-26T08:59:04
Python
UTF-8
Python
false
false
1,892
py
#_*_coding:utf-8_*_ class Node: def __init__(self, name, type='dir'): self.name = name self.type = type # 'dir' or ; 'file' self.children = [] self.parent = None # 链式存储 def __repr__(self): return self.name ''' 分析列表,假设hello目录下如何找到子目录world的目录呢? n = Node('hello') n2 = Node('world') n.children.append(n2) 那,如何通过world目录找到父亲目录 hello呢? n2.parent = n 那么这样做就相当于双链表 ''' class FileSystemTree: def __init__(self): self.root = Node("/") # 首先我们创建一个根目录 self.now = self.root def mkdir(self, name): # 创建一个文件目录,所以我们必须保证name是以 /结尾,如果没有,我们就加 if name[-1] != '/': name += '/' node = Node(name) # 创建一个文件目录 self.now.children.append(node) node.parent = self.now def ls(self): # 展示当前文件夹下的文件 return self.now.children def cd(self, name): # 切换到指定目录 注意:支持绝对路径和相对路径 # 相对路径是从now的路径下开始,而绝对路径是从root路径下开始找 if name[-1] != '/': name += '/' if name == '../': self.now = self.now.parent return for child in self.now.children: if child.name == name: # 如果传入的目录名等于孩子的目录名,我们直接切换 self.now = child return raise ValueError("invalid dir") tree = FileSystemTree() tree.mkdir('var/') tree.mkdir('bin/') tree.mkdir('usr/') print(tree.ls()) # [var/, bin/, usr/] tree.cd('bin/') print(tree.ls()) # [] print(tree.root.children) # [var/, bin/, usr/]