blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 616 | content_id stringlengths 40 40 | detected_licenses listlengths 0 69 | license_type stringclasses 2 values | repo_name stringlengths 5 118 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 63 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 2.91k 686M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 213 values | src_encoding stringclasses 30 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 2 10.3M | extension stringclasses 246 values | content stringlengths 2 10.3M | authors listlengths 1 1 | author_id stringlengths 0 212 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4d3dfee3068e5ec1f3472e4d861305cf8e397164 | 34b9b6938ca1ad3b5d48d6878a86b481b9b8b97c | /sympy/polys/domains/fractionfield.py | 3c54ad1175e7b9fc47b467f363df6b4ecac7ab90 | [
"BSD-3-Clause"
] | permissive | pernici/sympy | 2e787b12a37f7795afdbac20cca8a7791edb0e74 | 5e6e3b71da777f5b85b8ca2d16f33ed020cf8a41 | refs/heads/master | 2021-01-20T23:54:32.520295 | 2011-05-06T08:39:38 | 2011-05-06T08:39:38 | 1,681,450 | 2 | 0 | null | 2013-05-01T15:19:05 | 2011-04-29T16:26:24 | Python | UTF-8 | Python | false | false | 6,389 | py | """Implementation of :class:`FractionField` class. """
from sympy.polys.domains.field import Field
from sympy.polys.domains.compositedomain import CompositeDomain
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.polyclasses import DMF
from sympy.polys.polyerrors import GeneratorsNeeded, GeneratorsError
from sympy.polys.polyutils import dict_from_basic, basic_from_dict, _dict_reorder
class FractionField(Field, CharacteristicZero, CompositeDomain):
"""A class for representing rational function fields. """
dtype = DMF
is_Frac = True
has_assoc_Ring = True
has_assoc_Field = True
def __init__(self, dom, *gens):
if not gens:
raise GeneratorsNeeded("generators not specified")
lev = len(gens) - 1
self.zero = self.dtype.zero(lev, dom)
self.one = self.dtype.one(lev, dom)
self.dom = dom
self.gens = gens
def __str__(self):
return str(self.dom) + '(' + ','.join(map(str, self.gens)) + ')'
def __hash__(self):
return hash((self.__class__.__name__, self.dtype, self.dom, self.gens))
def __call__(self, a):
"""Construct an element of `self` domain from `a`. """
return DMF(a, self.dom, len(self.gens)-1)
def __eq__(self, other):
"""Returns `True` if two domains are equivalent. """
return self.dtype == other.dtype and self.dom == other.dom and self.gens == other.gens
def __ne__(self, other):
"""Returns `False` if two domains are equivalent. """
return not self.__eq__(other)
def to_sympy(self, a):
"""Convert `a` to a SymPy object. """
return (basic_from_dict(a.numer().to_sympy_dict(), *self.gens) /
basic_from_dict(a.denom().to_sympy_dict(), *self.gens))
def from_sympy(self, a):
"""Convert SymPy's expression to `dtype`. """
p, q = a.as_numer_denom()
num, _ = dict_from_basic(p, gens=self.gens)
den, _ = dict_from_basic(q, gens=self.gens)
for k, v in num.iteritems():
num[k] = self.dom.from_sympy(v)
for k, v in den.iteritems():
den[k] = self.dom.from_sympy(v)
return self((num, den)).cancel()
def from_ZZ_python(K1, a, K0):
"""Convert a Python `int` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_QQ_python(K1, a, K0):
"""Convert a Python `Fraction` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_ZZ_sympy(K1, a, K0):
"""Convert a SymPy `Integer` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_QQ_sympy(K1, a, K0):
"""Convert a SymPy `Rational` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_ZZ_gmpy(K1, a, K0):
"""Convert a GMPY `mpz` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_QQ_gmpy(K1, a, K0):
"""Convert a GMPY `mpq` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_RR_sympy(K1, a, K0):
"""Convert a SymPy `Real` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_RR_mpmath(K1, a, K0):
"""Convert a mpmath `mpf` object to `dtype`. """
return K1(K1.dom.convert(a, K0))
def from_PolynomialRing(K1, a, K0):
"""Convert a `DMF` object to `dtype`. """
if K1.gens == K0.gens:
if K1.dom == K0.dom:
return K1(a.rep)
else:
return K1(a.convert(K1.dom).rep)
else:
monoms, coeffs = _dict_reorder(a.to_dict(), K0.gens, K1.gens)
if K1.dom != K0.dom:
coeffs = [ K1.dom.convert(c, K0.dom) for c in coeffs ]
return K1(dict(zip(monoms, coeffs)))
def from_FractionField(K1, a, K0):
"""
Convert a fraction field element to another fraction field.
**Examples**
>>> from sympy.polys.polyclasses import DMF
>>> from sympy.polys.domains import ZZ, QQ
>>> from sympy.abc import x
>>> f = DMF(([ZZ(1), ZZ(2)], [ZZ(1), ZZ(1)]), ZZ)
>>> QQx = QQ.frac_field(x)
>>> ZZx = ZZ.frac_field(x)
>>> QQx.from_FractionField(f, ZZx)
DMF(([1/1, 2/1], [1/1, 1/1]), QQ)
"""
if K1.gens == K0.gens:
if K1.dom == K0.dom:
return a
else:
return K1((a.numer().convert(K1.dom).rep,
a.denom().convert(K1.dom).rep))
elif set(K0.gens).issubset(K1.gens):
nmonoms, ncoeffs = _dict_reorder(a.numer().to_dict(), K0.gens, K1.gens)
dmonoms, dcoeffs = _dict_reorder(a.denom().to_dict(), K0.gens, K1.gens)
if K1.dom != K0.dom:
ncoeffs = [ K1.dom.convert(c, K0.dom) for c in ncoeffs ]
dcoeffs = [ K1.dom.convert(c, K0.dom) for c in dcoeffs ]
return K1((dict(zip(nmonoms, ncoeffs)), dict(zip(dmonoms, dcoeffs))))
def get_ring(self):
"""Returns a ring associated with `self`. """
from sympy.polys.domains import PolynomialRing
return PolynomialRing(self.dom, *self.gens)
def poly_ring(self, *gens):
"""Returns a polynomial ring, i.e. `K[X]`. """
raise NotImplementedError('nested domains not allowed')
def frac_field(self, *gens):
"""Returns a fraction field, i.e. `K(X)`. """
raise NotImplementedError('nested domains not allowed')
def is_positive(self, a):
"""Returns True if `a` is positive. """
return self.dom.is_positive(a.numer().LC())
def is_negative(self, a):
"""Returns True if `a` is negative. """
return self.dom.is_negative(a.numer().LC())
def is_nonpositive(self, a):
"""Returns True if `a` is non-positive. """
return self.dom.is_nonpositive(a.numer().LC())
def is_nonnegative(self, a):
"""Returns True if `a` is non-negative. """
return self.dom.is_nonnegative(a.numer().LC())
def numer(self, a):
"""Returns numerator of `a`. """
return a.numer()
def denom(self, a):
"""Returns denominator of `a`. """
return a.denom()
def factorial(self, a):
"""Returns factorial of `a`. """
return self.dtype(self.dom.factorial(a))
| [
"Ronan.Lamy@normalesup.org"
] | Ronan.Lamy@normalesup.org |
86bc106a5f4842360725a423645b813d9e628780 | b5921afe6ea5cd8b3dcfc83147ab5893134a93d0 | /tl/db/__init__.py | 6d32330ad1bf49969a0c946143251cbf65be80b0 | [
"LicenseRef-scancode-other-permissive"
] | permissive | techdragon/tl | aaeb46e18849c04ad436e0e786401621a4be82ee | 6aba8aeafbc92cabdfd7bec11964f7c3f9cb835d | refs/heads/master | 2021-01-17T16:13:18.636457 | 2012-11-02T10:08:10 | 2012-11-02T10:08:10 | 9,296,808 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 858 | py | # tl/db/__init__.py
#
#
""" main db package """
## tl imports
from tl.utils.exception import handle_exception
## basic imports
import logging
## gotsqlite function
def gotsqlite():
try: import sqlite3 ; return True
except ImportError:
try: import _sqlite3 ; return True
except ImportError: return False
## getmaindb function
db = None
def getmaindb():
try:
from tl.lib.config import getmainconfig
cfg = getmainconfig()
if cfg.dbenable:
if "sqlite" in cfg.dbtype and not gotsqlite():
logging.error("sqlite is not found.")
return
global db
if db: return db
from .direct import Db
return Db()
else: raise Exception("db not enabled in %s" % cfg._cfile)
except Exception as ex: handle_exception()
| [
"feedbackflow@gmail.com"
] | feedbackflow@gmail.com |
d801619c615a81dc45fe6d90690ccfa418b2ee87 | 2837062f764f5bbc59f24d4e1a0a9a347d33a13b | /blog_mr/wsgi.py | 06831aebdfb29d1d3edfd35a28b0e4ce12761090 | [] | no_license | maheshrathnayaka/python-blog | cdbaf861a4beb851be99d0527c5f5fad75860ebc | edf804b4952b2e083f40a921cdc18cf1f04be739 | refs/heads/master | 2021-01-10T07:47:51.287406 | 2015-12-17T21:34:33 | 2015-12-17T21:34:33 | 48,199,286 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 389 | py | """
WSGI config for blog_mr project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blog_mr.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| [
"mintcrops@gmail.com"
] | mintcrops@gmail.com |
fdf3a0f5ab0f4dd4b4ca9772ca757c13bc142e32 | 3052e12cd492f3ffc3eedadc1bec6e6bb220e16b | /0x04-python-more_data_structures/2-uniq_add.py | 817b6f00440e9cabf302dfa4ad7ba6f3f02ecf85 | [] | no_license | JoseAVallejo12/holbertonschool-higher_level_programming | 2e9f79d495b664299a57c723e4be2ad8507abb4f | f2d9d456c854b52c932ec617ea3c40564b78bcdb | refs/heads/master | 2022-12-17T22:36:41.416213 | 2020-09-25T20:08:41 | 2020-09-25T20:08:41 | 259,383,382 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 130 | py | #!/usr/bin/python3
def uniq_add(my_list=[]):
new = set(my_list)
sum = 0
for n in new:
sum += n
return sum
| [
"josealfredovallejo25@gmail.com"
] | josealfredovallejo25@gmail.com |
77a7080472f1c78e1297eeb9cf3dfe840c562a3f | 17d306d7bb4802292a2e8c9eefcc87b19db46f0e | /main.py | 4bb0794333a5888e567bdbed642d22bf18506d62 | [] | no_license | brendonsanderson/Motion-CCTV | 3aa705e9c9c83a8d0881b218385d303c81941774 | ccf3be310aae1e6cf035c7f29e814fb46f7e3ef0 | refs/heads/main | 2023-03-08T18:29:03.204497 | 2021-02-25T20:42:34 | 2021-02-25T20:42:34 | 342,357,960 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,919 | py | ## imports ##
import cv2
from configparser import *
from ftplib import FTP
import smtplib
import mimetypes
import random
import os
import time
import datetime
import threading
from time import sleep
import pymysql
static_back = None
motion_list = [ None, None ]
### configs ###
dbConnect = False
ftpSetup = 0
dbSetup = 0
## user defined congifuration
## all configuration only happens once on launch
config = ConfigParser()
config.read("config.ini")
cameraval = str(config.get("user", "camera"))
#FTP LOGIN
host = config.get("ftp", "host")
usern = config.get("ftp", "user")
passw = config.get("ftp", "passwd")
ftp = FTP(str(host))
ftp.login(user= str(usern), passwd = str(passw))
#SQL LOGIN
hostname = config.get("sql", "host")
username = config.get("sql", "user")
password = config.get("sql", "password")
dbname = config.get("sql", "database")
connection = pymysql.connect(hostname, username, password, dbname)
cur = connection.cursor()
## main program ##
## switch to this to use a live feed
video = cv2.VideoCapture(2)
## switch to this to use a pre-recorded video
#video = cv2.VideoCapture("L:/CS/prerec.mp4")
# limits prerecorded video fps
#video.set(cv2.CAP_PROP_FPS, 30)
def SaveToFile(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval):
eventType = ('Motion')
ftp.cwd("/htdocs/files/images")
cv2.imwrite("./images/" + str(current) + ".jpg", frame)
path_file1 = "./images/" + str(current) + ".jpg"
base=os.path.basename(path_file1)
motionfile = open(path_file1,'rb')
ftp.storbinary('STOR ' + base, motionfile)
database(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval, eventType)
FaceDetect(path_file1, hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval)
def database(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval, eventType):
imgname = (str(current)+".jpg")
query = "INSERT INTO event (CamID,Time,Date,EventType,Image) VALUES ('"+str(cameraval)+"','"+str(timeVar)+"','"+str(dateVar)+"','"+str(eventType)+"','"+str(imgname)+"')"
cur.execute(query)
def fdatabase(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval, eventType):
imgname = ("F" + str(current)+".jpg")
query = "INSERT INTO event (CamID,Time,Date,EventType,Image) VALUES ('"+str(cameraval)+"','"+str(timeVar)+"','"+str(dateVar)+"','"+str(eventType)+"','"+str(imgname)+"')"
cur.execute(query)
def FaceDetect(path_file1, hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval):
CASCADE="./files/Face_cascade.xml"
FACE_CASCADE=cv2.CascadeClassifier(CASCADE)
path = path_file1
image=cv2.imread(path)
image_grey=cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = FACE_CASCADE.detectMultiScale(image_grey,scaleFactor=1.9,minNeighbors=5,minSize=(25,25),flags=0)
for x,y,w,h in faces:
eventType = ('Face')
sub_img=image[y-10:y+h+10,x-10:x+w+10]
fdatabase(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval, eventType)
os.chdir("images")
cv2.imwrite("F"+ str(current) + ".jpg",sub_img)
path_file2 = "./images/" +"F"+ str(current) + ".jpg"
os.chdir("../")
cv2.rectangle(image,(x,y),(x+w,y+h),(255, 255,0),2)
cv2.putText(image, 'Face', (x, y), cv2.FONT_HERSHEY_PLAIN, 1.5, (255, 255, 255), 2)
facefile = open(path_file2,'rb')
base2=os.path.basename(path_file2)
ftp.cwd("/htdocs/files/images")
ftp.storbinary('STOR ' + base2, facefile)
while True:
# the while loop is created so that when the video is split into a stack of images it can still be treated as a video
check, frame = video.read()
motion = 0
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (21, 21), 0)
if static_back is None:
static_back = gray
continue
diff_frame = cv2.absdiff(static_back, gray)
# changing the first diff_frame sets the sensetivity
thresh_frame = cv2.threshold(diff_frame, 25, 255, cv2.THRESH_BINARY)[1]
thresh_frame = cv2.dilate(thresh_frame, None, iterations = 2)
(_, cnts, _) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in cnts:
if cv2.contourArea(contour) < 10000: # default 10000
continue
motion = 1
# sets the identifier (green box)
(x, y, w, h) = cv2.boundingRect(contour)
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.putText(frame, 'Motion', (x, y), cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0), 2)
motion_list.append(motion)
motion_list = motion_list[-2:]
# debug views
#cv2.imshow("Gray Frame", gray)
#cv2.imshow("Difference Frame", diff_frame)
#cv2.imshow("Threshold Frame", thresh_frame)
# main motion view
cv2.startWindowThread()
cv2.namedWindow('Color Frame', cv2.WINDOW_NORMAL)
cv2.resizeWindow('Color Frame', 600,480)
cv2.imshow("Color Frame", frame)
# stops stuttering but causes video slowdown
key = cv2.waitKey(1) & 0xFF
#cv2.waitKey(7)
if motion == 1:
time.localtime()
seconds = time.localtime().tm_sec
if int(seconds) % 5 == 0:
now = datetime.datetime.now()
# change to an easier to search format
timeVar = now.strftime("%H:%M.%S")
dateVar = now.strftime("%d/%m/%Y")
current = now.strftime("%H.%M.%S-%d-%m-%Y")
print(current)
SaveToFile(hostname, username, password, dbname, timeVar, dateVar, dbConnect, cur, current, cameraval)
# closes all windows
if cv2.waitKey(10) & 0xFF == ord('q'):
break
ftp.close()
video.release()
cv2.destroyAllWindows()
| [
"noreply@github.com"
] | brendonsanderson.noreply@github.com |
10bb7fc1716814f33f2de19030e81f8a013e4861 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5744014401732608_0/Python/tmi/b.py | c8c2e1d24987ee554ec2bfc53dd1c4aecb9e83c1 | [] | 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,955 | py | """ LIMITS:
for i in xrange(100):
for j in xrange(100):
do_something(i, j)
Binary search
"""
import unittest
from collections import defaultdict
problem_name = 'B'
attempt = None
attempt = '0'
# attempt = 'L'
# attempt = 'p'
# attempt = 'P'
class TestSolveIt(unittest.TestCase):
def test(self):
print solve_it("2 1")
print solve_it("5 4")
# import ipdb; ipdb.set_trace()
print solve_it("4 20")
# self.assertEqual("19 20", solve_it("4 4"))
def walk(B, M):
remaining = M
matrix = [[0 for _ in xrange(B)] for __ in xrange(B)]
hole = B - 1
if remaining == 0:
return matrix
# len = 1
matrix[0][hole] = 1
remaining -= 1
if remaining == 0:
return matrix
# # len = 2
# for i in xrange(1, hole):
# matrix[0][i] = 1
# matrix[i][hole] = 1
# remaining -= 1
# if remaining == 0:
# return matrix
for i in xrange(0, hole):
for j in xrange(i + 1, hole):
matrix[i][j] = 1
matrix[j][hole] = 1
remaining -= 1
if remaining == 0:
return matrix
return None
def solve_it(_in):
print _in
b, m = _in.split(" ")
B = int(b)
M = int(m)
# if B == 2:
# if M == 1:
# out = "%s\n" % possible
# out += "01\n"
# out += "00"
# else:
# out = impossible
# return out
matrix = walk(B, M)
return matrix
# MAIN
if __name__ == '__main__':
if attempt is None:
unittest.main()
else:
if attempt == 'L':
file_name = '%s-large' % problem_name
elif attempt == 'p':
file_name = '%s-small-practice' % problem_name
elif attempt == 'P':
file_name = '%s-large-practice' % problem_name
else:
file_name = '%s-small-attempt%s' % (problem_name, attempt)
dir_path = __file__.rsplit('/', 1)[0]
with open('%s/%s.in' % (dir_path, file_name), 'r') as cases_in:
with open('%s/%s.out' % (dir_path, file_name), 'w') as cases_out:
total_cases = int(cases_in.next()[:-1])
# NEXT LINES ARE SPECIFIC
impossible = 'IMPOSSIBLE\n'
possible = 'POSSIBLE'
_out = ""
for case_number in xrange(total_cases):
_in = cases_in.next()[:-1]
out = solve_it(_in)
if out is None:
_out = impossible
else:
_out = "%s\n" % possible
for i in out:
_out += "%s\n" % ("".join([str(s) for s in i]))
case_output = 'Case #%s: %s' % (case_number + 1, _out[:-1])
print case_output
cases_out.write('%s\n' % case_output)
| [
"alexandra1.back@gmail.com"
] | alexandra1.back@gmail.com |
c05cdfd8500955dad644568ede04261af06f3d75 | a30362e51cb3291daf26d0c62e56c42caeec837f | /python/codeup/solved/_2001.py | 12e69252ee2ad312f9dc2039e84c0bbb2d17f514 | [] | no_license | TERADA-DANTE/algorithm | 03bf52764c6fcdb93d7c8a0ed7a672834f488412 | 20bdfa1a5a6b9c378e588b17073e77a0126f7339 | refs/heads/master | 2023-04-14T21:40:11.250022 | 2023-04-12T13:00:37 | 2023-04-12T13:00:37 | 288,335,057 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 141 | py | pastas = [int(input()) for _ in range(3)]
juices = [int(input()) for _ in range(2)]
print('%.1f' % float((min(pastas) + min(juices)) * 1.1))
| [
"terada.syun.kim@gmail.com"
] | terada.syun.kim@gmail.com |
e864f94d40ebeffde3a4d5b15dc6b036991ac3f4 | c8c612a1905208c6708295d68ab6ef6f635f62e2 | /test/producer_test.py | 6efb0274b40ba8c5ec31c075713060f8d2bafd59 | [] | no_license | comet-602/kafka-project | 7f8f58750ea6b0adea6fd6d1090e369bb2abb321 | f7bd9277e0635c1d59d07d10dd541e1ae14e03af | refs/heads/master | 2022-12-21T01:47:00.384395 | 2020-09-22T02:55:40 | 2020-09-22T02:55:40 | 288,181,020 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,882 | py | from confluent_kafka import Producer
import sys
import time
import datetime
import random
# 用來接收從Producer instance發出的error訊息
def error_cb(err):
print('Error: %s' % err)
# 主程式進入點
if __name__ == '__main__':
# 步驟1. 設定要連線到Kafka集群的相關設定
props = {
# Kafka集群在那裡?
'bootstrap.servers': '35.229.202.134:9092', # <-- 置換成要連接的Kafka集群
'error_cb': error_cb # 設定接收error訊息的callback函數
}
# 步驟2. 產生一個Kafka的Producer的實例
producer = Producer(props)
# 步驟3. 指定想要發佈訊息的topic名稱
topicName = 'test_stream'
msgCount = 100000 # 10萬筆
try:
num=10
while True:
dict_show=dict()
time_now=datetime.datetime.now()
#time_now=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
dict_show['time'] = time_now
dict_show['msg']='匯入數字為'+str(num)
dict_show['value'] = random.choice(['apple', 'pear', 'peach', 'orange', 'lemon','current','typical','also','explain','Vampires'])
print(type(time_now))
print(dict_show)
# produce(topic, [value], [key], [partition], [on_delivery], [timestamp], [headers])
producer.produce(topicName,value=bytes(str(dict_show),encoding="utf8"))
time.sleep(5)
num+=1
except BufferError as e:
# 錯誤處理
sys.stderr.write('%% Local producer queue is full ({} messages awaiting delivery): try again\n'
.format(len(producer)))
except Exception as e:
print('error:',e)
# 步驟5. 確認所有在Buffer裡的訊息都己經送出去給Kafka了
producer.flush(10)
print('Message sending completed!')
| [
"connecting941@gmail.com"
] | connecting941@gmail.com |
2899c8d7cef2cf8a8e5c133aca84de4ed93fd3dd | 3c97a06c8b220c435920374d5ddb3518fe54c37e | /shop/models.py | a765cde850783c1a902063648906fceb81c3e498 | [] | no_license | mikola-s/lesson_42_dj_09_module | e971dde498a7db95f038c07e6135528ceef4b9bd | 5b96bab21677b79e890bed2520ecec48dec80906 | refs/heads/master | 2020-12-21T16:52:33.659650 | 2020-01-27T21:12:51 | 2020-01-27T21:12:51 | 236,494,416 | 0 | 0 | null | 2020-01-27T13:51:07 | 2020-01-27T13:17:18 | HTML | UTF-8 | Python | false | false | 2,120 | py | from decimal import Decimal
from django.core.validators import MinValueValidator
from django.db import models
from django.contrib.auth.models import User
from django.utils.timezone import localtime
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(to=User, on_delete=models.CASCADE, related_name='profile')
cash = models.DecimalField(
decimal_places=2,
max_digits=12,
default=10000.00,
validators=[MinValueValidator(Decimal('0.00'))]
)
def __str__(self):
return self.user.username
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
@receiver(post_save, sender=User)
def save_user_profile(sender, instance, **kwargs):
instance.profile.save()
class Product(models.Model):
name = models.CharField(max_length=50)
description = models.CharField(max_length=256)
price = models.DecimalField(
decimal_places=2,
max_digits=12,
validators=[MinValueValidator(Decimal('0.00'))])
photo = models.FileField(upload_to='shop/product_image/')
count = models.PositiveIntegerField()
def __str__(self):
return f"{self.pk} {self.name}"
class Purchase(models.Model):
buyer = models.ForeignKey(User, on_delete=models.DO_NOTHING)
product = models.ForeignKey(
to=Product,
on_delete=models.DO_NOTHING,
related_name='product')
count = models.PositiveIntegerField()
time = models.DateTimeField(auto_now_add=True)
return_status = models.BooleanField(default=True)
def __str__(self):
time = localtime(self.time).strftime("%Y-%m-%d %H:%M:%S")
return f"{self.buyer.username} BUY {self.product.name} ({self.count}) IN {time}"
class Return(models.Model):
purchase = models.OneToOneField(
to=Purchase,
on_delete=models.CASCADE,
primary_key=True,
related_name='purchase')
post_time = models.DateTimeField(auto_now_add=True)
| [
"suharev.nv@gmail.com"
] | suharev.nv@gmail.com |
44f578525b910c332b5243f73a136fd86fef0945 | 65aa7a98496dac18afe6f1ef1d1ed7db6b9f1f3e | /awsmfa/_version.py | ad2f2c9a9973d6ccbac8e27e4bc0fa26a95917ad | [
"Apache-2.0"
] | permissive | coltaa/awsmfa | 777e48c458f240624d7deb927261079750065226 | c9799019c0d249b4bf2d7432a62faf10a3be994a | refs/heads/master | 2021-01-18T20:53:01.672625 | 2016-07-29T02:01:02 | 2016-07-29T02:01:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 30 | py | """0.2.7"""
VERSION = __doc__
| [
"dcoker@gmail.com"
] | dcoker@gmail.com |
d7dff1872666f8294edb1b33eb2d524b5974fe04 | 43cca8e219d0003e55e1b0e10dc061a941d31a81 | /dashboard/restAPIs.py | 2179fdc515f67255cf44210b75465f90eb0dbe9c | [
"MIT"
] | permissive | surajsjain/interactive-wbs-management-tool | ae70cfbcc081e6be554ab351d123881c35031fb7 | 10e039feb750bc8567d34e6186778102f650124a | refs/heads/master | 2022-12-13T08:01:03.004733 | 2020-09-18T07:00:47 | 2020-09-18T07:00:47 | 218,535,797 | 2 | 1 | MIT | 2022-04-22T22:36:11 | 2019-10-30T13:37:20 | Python | UTF-8 | Python | false | false | 840 | py | from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .models import *
@api_view(['GET', 'POST'])
def getPendingTransfersCount(request):
if request.method == 'GET':
transfers = Transfer.objects.filter(status=True)
resp = {}
resp['Pending Transfer Count'] = len(transfers)
return Response(resp)
elif request.method == 'POST':
pass
# print(type(request.data))
# serializer = PlantConditionsSerializer(data=request.data)
# if serializer.is_valid():
# # print(serializer.validated_data)
# serializer.save()
# return Response(serializer.data, status=status.HTTP_201_CREATED)
# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
| [
"surajsjain@hotmail.com"
] | surajsjain@hotmail.com |
30dcfba78544477402b5ff0748667ba8609537e9 | 5a547f76afc7dda9ad34fe47ea032ef90de3e170 | /Inputer.py | 2eb5b96b069468b2eabbb2f285c2dcc092d7316c | [] | no_license | smohammadfy/Sitado_Project | d53f30a5bf05c2fef8cca5077c56289cae7d15b2 | 9d6ca08870940363eae1e75a7db4de0002b467db | refs/heads/master | 2020-12-20T06:17:33.643361 | 2020-01-30T19:41:46 | 2020-01-30T19:41:46 | 235,986,208 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,696 | py | from DB_Connection import *
from colorama import Fore
def inputer():
cur, conn = connect()
print("what do you want to do?(insert,delete,update,end)")
job = input(" > ")
if (job == 'insert'):
sql = "INSERT INTO "
insert(sql, cur, conn)
elif (job == 'delete'):
sql = "DELETE FROM "
delete(sql, cur, conn)
elif (job == 'update'):
sql = "UPDATE "
update(sql, cur, conn)
elif (job == 'end'):
conn_closer(conn)
def conn_closer(conn):
conn.close()
def update(sql, cur, conn):
print("which table do you want to update?(Users,Menu,Shops,Transporter)")
table = input(" > ")
if (table not in ['Users', 'Menu', 'Shops', 'Transporter']):
print("Table name is Invalid !")
else:
sql = sql + '"' + table + '" '
print('Enter command :')
print('hint : SET "User_id" = 21295131 WHERE "User_id" = 21295132')
command = input(' > ')
sql = sql + command
try:
cur.execute(sql)
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
def delete(sql, cur, conn):
print("which table do you want to delete?(Users,Menu,Shops,Transporter)")
table = input(" > ")
if (table not in ['Users', 'Menu', 'Shops', 'Transporter']):
print("Table name is Invalid !")
return delete(sql, cur, conn)
else:
sql = sql + '"' + table + '" '
print('Enter condition :')
print('hint : Where "User_id" = 21295131')
condition = input(' > ')
sql = sql + condition
try:
cur.execute(sql)
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
def insert(sql, cur, conn):
user = '("Name","Last_Name","User_id","Phone_Number","Age")'
menu = '("Item_id","Item_Name","Item_Price")'
shop = '("Shop_id","Shop_Name","Shop_items","Shop_prices")'
transporter = '("Name","Last_Name","Transporter_id","phonenumber")'
print("which table do you want to insert?(Users,Menu,Shops,Transporter)")
table = input(" > ")
if (table not in ['Users', 'Menu', 'Shops', 'Transporter']):
print("Table name is Invalid !")
return insert(sql, cur, conn)
else:
if (table == 'Users'):
sql = sql + '"' + table + '"' + user + 'VALUES(%s,%s,%s,%s,%s)'
print('Enter Name :')
name = input(' > ')
print('Enter Last Name :')
lastname = input(' > ')
print('Enter User_id :')
userid = int(input(' > '))
print('Enter phone number :')
phonenumber = int(input(' > '))
print('Enter Age :')
age = int(input(' > '))
try:
cur.execute(sql, (name, lastname, userid, phonenumber, age))
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
elif (table == 'Menu'):
sql = sql + '"' + table + '"' + menu + 'VALUES(%s,%s,%s)'
print('Enter Item id :')
Item_id = input(' > ')
print('Enter Item Name :')
Item_Name = input(' > ')
print('Enter Item_Price :')
Item_Price = int(input(' > '))
try:
cur.execute(sql, (Item_id, Item_Name, Item_Price))
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
elif (table == 'Transporter'):
sql = sql + '"' + table + '"' + transporter + 'VALUES(%s,%s,%s,%s)'
print('Enter Name :')
Name = input(' > ')
print('Enter Last Name :')
Last_Name = input(' > ')
print('Enter Transporter id :')
Transporter_id = int(input(' > '))
print('Enter phone number :')
PhoneNumber = int(input(' > '))
try:
cur.execute(sql, (Name, Last_Name, Transporter_id, PhoneNumber))
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
elif (table == 'Shops'):
sql = sql + '"' + table + '"' + shop + 'VALUES(%s,%s,%s,%s)'
print('Enter Shop id :')
Shop_id = input(' > ')
print('Enter Shop Name :')
Shop_Name = input(' > ')
print('Enter Shop Items :')
print('( hint :input must be like this {"chicken","labster","meat"} )')
Shop_items = input(' > ')
print('Enter Item_Prices :')
print('( hint :input must be like this {20000,10000000,500} )')
Shop_prices = input(' > ')
try:
cur.execute(sql, (Shop_id, Shop_Name, Shop_items, Shop_prices))
conn.commit()
print(Fore.BLUE + "Successful!")
except (Exception,) as error:
print(Fore.RED + "ERROR : ")
print(error)
finally:
conn.close()
| [
"m.faniyazdi@gmail.com"
] | m.faniyazdi@gmail.com |
84a100451c0ec746b44e88beccc5c54d420ab13f | 4b7e69a263455ccc0af132c685f37bbf3e3c8e0c | /drawing_functions.py | e50d20307b6dd0c89b78c586c90754522b81cf96 | [] | no_license | Bala-Yarabikki/openccv | b9a565c25225f8303ea25da7fd6da1a1f42e678f | 44ad85896a215d080226e46146770dd7d31cd4af | refs/heads/main | 2023-02-28T12:49:22.687580 | 2021-02-02T10:35:37 | 2021-02-02T10:35:37 | 335,248,157 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 478 | py | import cv2
import numpy as np
#img = cv2.imread('lena.jpg',1)
img = np.zeros([512,512,3],np.uint8)
img = cv2.line(img,(0,0),(255,255),(0,255,0),3)
img = cv2.arrowedLine(img,(255,0),(255,255),(0,255,0),3)
img = cv2.rectangle(img,(384,0),(510,128),(255,0,0),-1)
img = cv2.circle(img,(447,63),63,(0,0,255),4)
font = cv2.FONT_HERSHEY_SIMPLEX
img = cv2.putText(img,'OpenCv',(10,500),font,4,(255,255,255),10,cv2.LINE_AA)
cv2.imshow('lena',img)
cv2.waitKey()
cv2.destroyAllWindows() | [
"balachowdary777@gmail.com"
] | balachowdary777@gmail.com |
802c9e24b03153f5649e989bc11f3538e16259e9 | eff6ca1e162caa7afb59e50b6b23528d097b8120 | /leetcode/1833.maximum-icecream-bars.py | 325c6e6a5c930874ebb420fee3b3d9d501974067 | [] | no_license | Muttakee31/solved-interview-problems | 9b93277c8d62c9db7130676cfc896d7cc9777812 | 88d1831dd0de2635ec8d2b296e112fe638b27fab | refs/heads/master | 2023-07-01T18:18:00.599636 | 2021-08-05T16:20:26 | 2021-08-05T16:20:26 | 384,706,870 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 346 | py | class Solution:
"""
https://leetcode.com/problems/maximum-ice-cream-bars/
"""
def maxIceCream(self, costs: List[int], coins: int) -> int:
costs.sort()
i=0
while(i<len(costs) and coins>0):
if costs[i] > coins:
break
coins -= costs[i]
i+=1
return i | [
"muttakee9@gmail.com"
] | muttakee9@gmail.com |
80545f88e2bc9e86b14993921d17a39bfd57d075 | 30172cf8c7eca2eb5a825b96ed276ba68c746e9f | /charts/make_plots.py | df2cd0dc8e2b95c0f4ea1a74f4c41e8cba8e1dc3 | [] | no_license | masseyr/deciduous | 272451928b0d0cf76aede4d4889a224e87a49c3d | 0d2cbb7381f856a7e720419e661b53e633da39b9 | refs/heads/master | 2021-05-26T05:16:30.208263 | 2019-12-11T00:25:40 | 2020-06-09T00:25:40 | 127,552,187 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,194 | py | from modules.plots import Plot
from modules import Handler, Samples
from modules.classification import RFRegressor, MRegressor
if __name__ == '__main__':
"""
# **************************************************
# plotting histogram plot - rmse, rsq
datafile = "D:/Shared/Dropbox/projects/NAU/landsat_deciduous/data/SAMPLES/results_summary_v13i_show.csv"
names, data = Handler(datafile).read_csv_as_array()
# rmse plot
plotfile_rmse = "D:/Shared/Dropbox/projects/NAU/landsat_deciduous/data/SAMPLES/rmse_plot_all_v13i.png"
plot_rmse = {
'type': 'histogram', # plot types: histogram, surface, relative, regression
'names': names,
'data': data, # list or 1d array
'nbins': 50,
'xvar': 'rmse',
'xtitle': 'Random Forest model RMSE', # title of x axis
'ytitle': 'Frequency', # title of y axis
'title': 'Model RMSE plot', # plot title
'plotfile': plotfile_rmse, # output file name
'xlim': [18, 23],
'ylim': [0, 2500]
}
rmse = Plot(plot_rmse)
rmse.draw()
# rsq plot
plotfile_rsq = "D:/Shared/Dropbox/projects/NAU/landsat_deciduous/data/SAMPLES/rsq_plot_all_v13i.png"
plot_rsq = {
'type': 'histogram', # plot types: histogram, surface, relative, regression
'names': names,
'data': data, # list or 1d array
'xvar': 'rsq',
'nbins': 50,
'xtitle': 'Random Forest model Pearson R-squared', # title of x axis
'ytitle': 'Frequency', # title of y axis
'title': 'Model R-squared plot', # plot title
'plotfile': plotfile_rsq, # output file name
'color': 'purple',
'xlim': [60, 75],
'ylim': [0, 2500]
}
rsq = Plot(plot_rsq)
rsq.draw()
# **************************************************
# plotting box whisker plot
datafile = "D:\\projects\\NAU\\landsat_deciduous\\data\\saved_samp_ak.csv"
plotfile = "D:\\projects\\NAU\\landsat_deciduous\\data\\fig1.png"
names, data = Handler(datafile).read_csv_as_array()
bins = Sublist.custom_list(0, 100, step=10)
group_names = list(str(bins[i]) + '-' + str(bins[i + 1]) for i in range(0, len(bins) - 1))
plot_boxwhisker = {
'type': 'boxwhisker',
'xvar': 'decid_fraction',
'yvar': 'uncertainty',
'data': data,
'bins': bins,
'names': names,
'xtitle': 'Deciduous Fraction',
'ytitle': 'Uncertainty',
'title': 'Deciduous fraction and uncertainty (n = 50,000)',
'datafile': datafile,
'plotfile': plotfile,
'color': 'orange',
'group_names': group_names
}
boxwhisker = Plot(plot_boxwhisker)
boxwhisker.draw()
# **************************************************
# plotting matrix heatmap
infile = "C:/Users/rm885/" \
"Dropbox/projects/NAU/landsat_deciduous/data/SAMPLES/" + \
"gee_data_cleaning_v27.csv"
plotfile = "C:/Users/rm885/" \
"Dropbox/projects/NAU/landsat_deciduous/data/SAMPLES/" + \
"gee_data_cleaning_v27_heatmap2.png"
trn_samp = Samples(csv_file=infile, label_colname='decid_frac')
corr_dict = trn_samp.correlation_matrix()
corr_mat = corr_dict['data']
xlabel = corr_dict['names']
plot_heatmap = {
'type': 'mheatmap',
'data': corr_mat,
'xlabel': xlabel,
'title': 'Correlation among variables',
'plotfile': plotfile,
'show_values': False,
'heat_range': [0.0, 1.0],
'color_str': "YlGnBu"
}
heatmap = Plot(plot_heatmap)
heatmap.draw()
# **************************************************
# plotting regression heatmap
yhb_arr = Handler("C:/users/rm885/Dropbox/projects/NAU/landsat_deciduous/data/RF_bootstrap_2000_y_hat_bar_v1.csv")\
.read_array_from_csv(array_1d=True, nodataval=-99.0)
vary_arr = Handler("C:/users/rm885/Dropbox/projects/NAU/landsat_deciduous/data/RF_bootstrap_2000_var_y_v1.csv") \
.read_array_from_csv(array_1d=True, nodataval=-99.0)
yf_arr = Handler("C:/users/rm885/Dropbox/projects/NAU/landsat_deciduous/data/RF_bootstrap_2000_y_v1.csv") \
.read_array_from_csv(array_1d=True, nodataval=-99.0)
y = (np.abs(yf_arr-yhb_arr))**2
x = vary_arr
print(np.mean(y))
print(np.mean(x))
pts = [(np.sqrt(x[i]), np.sqrt(y[i])) for i in range(0, len(x))]
# pts = [(x[i], y[i]) for i in range(0, len(x))]
plotfile = 'C:/users/rm885/Dropbox/projects/NAU/landsat_deciduous/data/test_plot12_.png'
plot_heatmap = {
'type': 'rheatmap',
'points': pts,
'xlabel': 'SD in tree predictors',
'ylabel': 'Abs. difference in observed and predicted',
'color_bar_label': 'Data-points per bin',
'plotfile': None,
'xlim': (0, 0.5),
'ylim': (0, 1),
'line': False,
'xbins': 100,
'ybins': 100,
}
heatmap = Plot(plot_heatmap)
heatmap.draw()
# **************************************************
"""
# plotting regression heatmap2
val_log = "C:/temp/tree_cover/out_tc_2010_samp_v1_RF_2.txt"
'''
pickle_file = "C:/temp/tree_cover/out_tc_2010_samp_v1_RF_2.pickle"
classifier = RFRegressor.load_from_pickle(pickle_file)
data_dict = classifier.sample_predictions(classifier.data)
x = data_dict['obs_y']
y = data_dict['pred_y']
'''
val_lines = Handler(val_log).read_text_by_line()
x = list(float(elem.strip()) for elem in val_lines[0].split(',')[1:])
y = list(float(elem.strip()) for elem in val_lines[1].split(',')[1:])
pts = [(x[i], y[i]) for i in range(0, len(x))]
print(pts[0:10])
plotfile = 'C:/temp/tree_cover/out_tc_2010_samp_v1_RF_2_val.png'
plot_heatmap = {
'type': 'rheatmap2',
'points': pts,
'xlabel': 'Observed Tree Cover',
'ylabel': 'Predicted Tree Cover',
'color_bar_label': 'Data-points per bin',
'plotfile': plotfile,
'xlim': (0, 100),
'ylim': (0, 100),
'line': True,
'legend': True
}
heatmap = Plot(plot_heatmap)
heatmap.draw()
| [
"rm885@nau.edu"
] | rm885@nau.edu |
9fe4c4142c2cb6d41ea5159ac4ce4111bd758e4d | b87f66b13293782321e20c39aebc05defd8d4b48 | /maps/laplaceFilter.py | f6c0275671b0c1253e44e5c3a0959d1fb296b677 | [] | no_license | m-elhussieny/code | 5eae020932d935e4d724c2f3d16126a0d42ebf04 | 5466f5858dbd2f1f082fa0d7417b57c8fb068fad | refs/heads/master | 2021-06-13T18:47:08.700053 | 2016-11-01T05:51:06 | 2016-11-01T05:51:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,400 | py | # -*- coding: utf-8 -*-
# Laplace filter a 2D field with mask
# ROMS type maske,
# M = 1 på grid-celler som brukes
# M = 0 på grid-celler som maskeres vekk
# Default er uten maske
import numpy as np
def laplace_X(F,M):
"""1D Laplace Filter in X-direction (axis=1)"""
jmax, imax = F.shape
# Add strips of land
F2 = np.zeros((jmax, imax+2), dtype=F.dtype)
F2[:, 1:-1] = F
M2 = np.zeros((jmax, imax+2), dtype=M.dtype)
M2[:, 1:-1] = M
MS = M2[:, 2:] + M2[:, :-2]
FS = F2[:, 2:]*M2[:, 2:] + F2[:, :-2]*M2[:, :-2]
return np.where(M > 0.5, (1-0.25*MS)*F + 0.25*FS, F)
def laplace_Y(F,M):
"""1D Laplace Filter in Y-direction (axis=1)"""
jmax, imax = F.shape
# Add strips of land
F2 = np.zeros((jmax+2, imax), dtype=F.dtype)
F2[1:-1, :] = F
M2 = np.zeros((jmax+2, imax), dtype=M.dtype)
M2[1:-1, :] = M
MS = M2[2:, :] + M2[:-2, :]
FS = F2[2:, :]*M2[2:, :] + F2[:-2, :]*M2[:-2, :]
return np.where(M > 0.5, (1-0.25*MS)*F + 0.25*FS, F)
# The mask may cause laplace_X and laplace_Y to not commute
# Take average of both directions
def laplace_filter(F, M=None):
if M == None:
M = np.ones_like(F)
return 0.5*(laplace_X(laplace_Y(F, M), M) +
laplace_Y(laplace_X(F, M), M))
| [
"fspaolo@gmail.com"
] | fspaolo@gmail.com |
f6ad498686944eb992da887910dbcdf0802b2de3 | 5ce4b969e0f9fb37710ca9c94b0213c927f7a22c | /TweepyDeck/views.py | 8e6fe498d9e958fb01cc8afe99401d609f3916ed | [] | no_license | vdeleon/TweepyDeck | 2a9a5c2985f108dc447453a07d5736ea84d57360 | e78ed4c036901aee7fa7f9f3bcd53b57697a1568 | refs/heads/master | 2021-01-16T18:44:55.289877 | 2010-01-31T00:41:55 | 2010-01-31T00:41:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 10,259 | py | #!/usr/bin/env python
# Standard library imports
import gettext
import logging
import math
# PyGTK imports
import cairo
import pygtk
pygtk.require('2.0')
import gobject
import gtk
import gtk.gdk
# TweepyDeck imports
from TweepyDeck import bases
from TweepyDeck import decorators
from TweepyDeck import signals
from TweepyDeck import util
views = []
util.set_global('views', views)
_ = gettext.gettext
class AbstractRow(bases.BaseChildWidget):
user = None
fullname = None
who = None
when = None
image = None
what = None
tweet_id = None
@classmethod
def matchForText(cls, text):
return False
@classmethod
def rowForText(cls, text):
user = text['user']
who = text['user']['screen_name']
fullname = text['user']['name']
when = text['created_at']
image = util.saveImageToFile(who, text['user']['profile_image_url'])
what = text['text']
tweet_id = text['id']
return cls(**locals())
def _renderContainer(self):
container = gtk.HBox()
container.set_size_request(350, -1)
container.set_homogeneous(False)
container.show()
return container
def _avatarTooltip(self):
return None
def _renderAvatar(self, container):
vbox = gtk.VBox()
vbox.set_size_request(70, -1)
vbox.set_homogeneous(False)
image = gtk.Image()
image.set_from_file(self.image)
image.set_size_request(50, 50)
who = gtk.Label()
who.set_markup('<b>%s</b>' % self.who)
vbox.pack_start(image)
vbox.pack_start(who)
who.show()
image.show()
tooltip = self._avatarTooltip()
if tooltip:
vbox.set_tooltip_markup(tooltip)
vbox.show()
container.pack_start(vbox, expand=False, fill=False, padding=3)
def renderTo(self, parent, start=False):
container = self._renderContainer()
## Setting this setting for our status action buttons
container.get_settings().set_long_property('gtk-button-images', 1, '')
self._render(container)
_method = parent.pack_start
if not start:
_method = parent.pack_end
_method(container)
class RoundedBox(gtk.EventBox):
color = 'white'
padding = 2 # Padding from edges of parent
rounded = 10 # How round to make the edges
def __init__(self, *args, **kwargs):
super(RoundedBox, self).__init__(*args, **kwargs)
self.connect('size-allocate', self._on_size_allocate)
self.modify_bg(gtk.STATE_NORMAL,
self.get_colormap().alloc_color(self.color))
def _on_size_allocate(self, win, allocation):
"""Shape the window into a rounded rectangle."""
w,h = allocation.width, allocation.height
bitmap = gtk.gdk.Pixmap(None, w, h, 1)
# Clear the bitmap
fg = gtk.gdk.Color(pixel=0)
bg = gtk.gdk.Color(pixel=-1)
fg_gc = bitmap.new_gc(foreground=fg, background=bg)
bitmap.draw_rectangle(fg_gc, True, 0, 0, w, h)
# Draw our shape into the pixmap using cairo
# Let's try drawing a rectangle with rounded edges.
padding = self.padding
rounded = self.rounded
cr = bitmap.cairo_create()
cr.set_source_rgb(0,0,0)
# Move to top corner
cr.move_to(0+padding+rounded, 0+padding)
# Top right corner and round the edge
cr.line_to(w-padding-rounded, 0+padding)
cr.arc(w-padding-rounded, 0+padding+rounded, rounded, math.pi/2, 0)
# Bottom right corner and round the edge
cr.line_to(w-padding, h-padding-rounded)
cr.arc(w-padding-rounded, h-padding-rounded, rounded, 0, math.pi/2)
# Bottom left corner and round the edge.
cr.line_to(0+padding+rounded, h-padding)
cr.arc(0+padding+rounded, h-padding-rounded, rounded, math.pi+math.pi/2, math.pi)
# Top left corner and round the edge
cr.line_to(0+padding, 0+padding+rounded)
cr.arc(0+padding+rounded, 0+padding+rounded, rounded, math.pi/2, 0)
# Fill in the shape.
cr.fill()
# Set the window shape
win.shape_combine_mask(bitmap, 0, 0)
class Status(object):
tweet_id = None
author = None
text = None
timestamp = None
def __init__(self, tweet_id, author, text, when, **kwargs):
self.tweet_id = tweet_id
self.author = author
self.text = text
self.timestamp = when
def _markup_generator(self, pieces):
for piece in pieces:
if not piece:
continue
if piece.startswith('@') and len(piece) >= 2:
yield '<b>%s</b>' % piece
elif piece.startswith('http://'):
yield '<a href="%s"><b>%s</b></a>' % (piece, piece)
elif piece.startswith('#') and len(piece) >= 3:
# If it's a two-character or larger hashtag, mark it up
yield '<a href="tweepy://search/%s">%s</a>' % (''.join(piece[1:]), piece)
elif len(piece) > 2:
if piece[0] == '_' and piece[-1] == '_':
# pieces that are _underlined_ should be emphasized
yield '<i>%s</i>' % piece[1:-1]
elif piece[0] == '*' and piece[-1] == '*':
# pieces that are *bolded* should be
yield '<b>%s</b>' % piece[1:-1]
else:
yield piece
else:
yield piece
def markup_text(self, text):
status = util.escape(text)
pieces = status.split(' ')
return ' '.join(self._markup_generator(pieces))
def on_reply_clicked(self, *args, **kwargs):
signals.emit(signals.TWEET_REPLY_TO, tweet_id=self.tweet_id,
author=self.author)
def on_retweet_clicked(self, *args, **kwargs):
app = util.get_global('app')
if not app:
return
app.api.retweet(self.tweet_id)
def clickedLink(self, label, uri, data, **kwargs):
if not uri.startswith('tweepy://'):
return False
command = uri[9:]
command, arg = command.split('/')
if command == 'search':
util.get_global('app')._spawnSearch('#%s' % arg)
return True
def _widget(self):
'''
+-------------------------VBox----------------+
|+-------------------------------RoundedBox--+|
||+--------------------EventBox-------------+||
||| |||
||| Label |||
||+-----------------------------------------+||
|+-------------------------------------------+|
|---------------------------------------------|
|+---------------------------HButtonBox------+|
|| [Button][Button]||
|+-------------------------------------------+|
+---------------------------------------------+
'''
vbox = gtk.VBox()
vbox.set_homogeneous(False)
vbox.show()
roundedbox = RoundedBox()
roundedbox.show()
buttonbox = gtk.HButtonBox()
buttonbox.set_layout(gtk.BUTTONBOX_END)
buttonbox.show()
def actionButton(tooltip):
button = gtk.Button(label='')
button.set_tooltip_text(tooltip)
button.set_size_request(8, 12)
button.show()
return button
reply = actionButton('Reply to Tweet')
re_image = gtk.Image()
re_image.set_from_stock(gtk.STOCK_UNDO, gtk.ICON_SIZE_BUTTON)
reply.set_image(re_image)
reply.connect('clicked', self.on_reply_clicked)
retweet = actionButton('Retweet')
rt_image = gtk.Image()
rt_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_BUTTON)
retweet.set_image(rt_image)
retweet.connect('clicked', self.on_retweet_clicked)
buttonbox.add(reply)
buttonbox.add(retweet)
vbox.add(roundedbox)
vbox.add(buttonbox)
labelbox = gtk.EventBox()
labelbox.set_border_width(5)
labelbox.modify_bg(gtk.STATE_NORMAL,
labelbox.get_colormap().alloc_color(roundedbox.color))
what = gtk.Label()
what.set_markup('%s\n<i><span size="x-small" weight="light">%s</span></i>' %
(self.markup_text(self.text), self.timestamp))
what.connect('activate-link', self.clickedLink, None)
what.set_size_request(280, -1)
what.set_line_wrap(True)
what.set_selectable(True)
what.set_alignment(0.0, 0.0)
labelbox.add(what)
roundedbox.add(labelbox)
labelbox.show()
what.show()
return vbox
widget = property(fget=_widget)
class BasicRow(AbstractRow):
@classmethod
def matchForText(cls, text):
return True
def _renderStatus(self, container):
self.status = Status(self.tweet_id, self.who, self.what, self.when)
container.pack_start(self.status.widget, expand=True, fill=True)
def _render(self, container):
self._renderAvatar(container)
self._renderStatus(container)
def _avatarTooltip(self):
tooltip = _('''<b>Name:</b> %(name)s
<b>About:</b> %(description)s
<b>Where:</b> %(time_zone)s
<b>Following back:</b> %(following)s''')
return tooltip % {
'name' : util.escape(self.fullname),
'description' : util.escape(self.user['description']),
'time_zone' : util.escape(self.user['time_zone']),
'following' : self.user['following'] and _('yes') or _('no')}
views.insert(0, BasicRow)
class SearchRow(BasicRow):
@classmethod
def matchForText(cls, text):
if text.get('from_user'):
return True
return False
@classmethod
def rowForText(cls, text):
who = text['from_user']
when = text['created_at']
image = util.saveImageToFile(who, text['profile_image_url'])
what = text['text']
return cls(**locals())
def _avatarTooltip(self):
return None
views.insert(0, SearchRow)
| [
"tyler@monkeypox.org"
] | tyler@monkeypox.org |
2cbe002fe9d8631b2181db14fcd9f483f5f3ae10 | 5ce8ade2c0a855119a00c10c6199ee3325ebcbd6 | /photo/views.py | 99e9f052fe9dd2f2a705c335e8e107b373b65291 | [] | no_license | nn243823163/blog | cab0fd6a9f6672d851de5521f27976d37b0a91fe | 2cbade64be2c9d5db5137cf83a148540e82c297c | refs/heads/master | 2020-04-15T12:47:41.419706 | 2016-09-13T14:10:01 | 2016-09-13T14:10:01 | 64,661,669 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,711 | py | #coding:utf-8
from django.shortcuts import render
from .models import Photo
from django.core.paginator import Paginator,InvalidPage,EmptyPage,PageNotAnInteger
# Create your views here.
def caoliu(request):
####直接返回图片#####
# photos = Photo.objects.values('link')[00:100]
# link = []
# for photo in photos:
# photo = photo['link']
# print photo
# link.append(photo)
# return render(request,'caoliu.html',locals())
#####返回标题########
photo_titles = Photo.objects.values('title').distinct()
#分页器
paginator = Paginator(photo_titles , 50)
try:
page = int(request.GET.get('page',1))
photo_titles = paginator.page(page)
except (InvalidPage,EmptyPage,PageNotAnInteger):
photo_titles = paginator.page(1)
titles = []
for photo_title in photo_titles:
photo_title = photo_title['title']
titles.append(photo_title)
# photos = Photo.objects.all()
# paginator = Paginator(photos,50)
# try:
# page = int(request.GET.get('page',1))
# photos = paginator.page(page)
# except (InvalidPage,EmptyPage,PageNotAnInteger):
# photos = paginator.page(1)
return render(request, 'caoliu.html', locals())
def list(request):
get_title = request.GET['title']
get_photos = Photo.objects.values('link').filter(title=get_title)
get_urls = Photo.objects.values('url').filter(title=get_title)
get_links = []
get_url = ''
for get_photo in get_photos:
get_photo = get_photo['link']
get_links.append(get_photo)
for url in get_urls:
get_url = url['url']
return render(request, 'list.html', locals())
| [
"doudou@NanNandeMacBook-Air.local"
] | doudou@NanNandeMacBook-Air.local |
fb765e5a0d31e8f3098448be9975086cd0e0efc3 | 7521cddb3210ef9797da6726d4aa5825acf4b9c2 | /reservations/migrations/0001_initial.py | de98f2daa3d0aeeac6cc984c3f86755bd5363e5e | [] | no_license | Gangyong92/airbnb-clone | b4e5ec05c655c9eeb7e13d7de74b0a003e8b1a89 | 2e672cd26f734348d72720b72fe7bae45eeb2fd2 | refs/heads/master | 2023-01-24T04:14:04.096761 | 2020-11-30T01:03:54 | 2020-11-30T01:03:54 | 297,016,050 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,146 | py | # Generated by Django 2.2.5 on 2020-09-23 10:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('rooms', '0004_auto_20200923_1806'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Reservation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('check_in', models.DateField()),
('check_out', models.DateField()),
('guest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rooms.Room')),
],
options={
'abstract': False,
},
),
]
| [
"hyeonggang@naver.com"
] | hyeonggang@naver.com |
e31f5636e88a1299c0ea38aad1445e3d09eafbbe | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p03739/s765713448.py | 5822883c62abf5e288d112b26404a87a8776ba40 | [] | 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 | 774 | py | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N = int(input())
A = list(map(int, input().split()))
p = A[0] if A[0] > 0 else 1
pc = 0 if A[0] > 0 else 1 - A[0]
m = A[0] if A[0] < 0 else -1
mc = 0 if A[0] < 0 else 1 + abs(A[0])
for i in range(1, N):
p += A[i]
m += A[i]
if i % 2 == 0:
if p <= 0:
pc += 1 - p
p = 1
if m >= 0:
mc += 1 + m
m = -1
else:
if p >= 0:
pc += 1 + p
p = -1
if m <= 0:
mc += 1 - m
m = 1
print(min(pc, mc))
| [
"66529651+Aastha2104@users.noreply.github.com"
] | 66529651+Aastha2104@users.noreply.github.com |
baae4856cb8124310e343f85ad3b4795b5d0f90e | 55f76a8ffb9062f6553e3019e1bd9898c6841ee8 | /qa/rpc-tests/decodescript.py | b6cf20b738fe7d15d55e0dfe3066d0e333c90b3c | [
"MIT"
] | permissive | mirzaei-ce/core-tabit | 1c966183d5e35ac5210a122dfabf3b1a6071def5 | f4ae2cb3a1026ce0670751f5d98e5eee91097468 | refs/heads/master | 2021-08-14T18:29:45.166649 | 2017-11-16T13:26:30 | 2017-11-16T13:26:30 | 110,974,552 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 13,643 | py | #!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import TabitTestFramework
from test_framework.util import *
from test_framework.mininode import *
from binascii import hexlify, unhexlify
from cStringIO import StringIO
class DecodeScriptTest(TabitTestFramework):
"""Tests decoding scripts via RPC command "decodescript"."""
def setup_chain(self):
print('Initializing test directory ' + self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 1)
def setup_network(self, split=False):
self.nodes = start_nodes(1, self.options.tmpdir)
self.is_network_split = False
def decodescript_script_sig(self):
signature = '304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
push_signature = '48' + signature
public_key = '03b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb2'
push_public_key = '21' + public_key
# below are test cases for all of the standard transaction types
# 1) P2PK scriptSig
# the scriptSig of a public key scriptPubKey simply pushes a signature onto the stack
rpc_result = self.nodes[0].decodescript(push_signature)
assert_equal(signature, rpc_result['asm'])
# 2) P2PKH scriptSig
rpc_result = self.nodes[0].decodescript(push_signature + push_public_key)
assert_equal(signature + ' ' + public_key, rpc_result['asm'])
# 3) multisig scriptSig
# this also tests the leading portion of a P2SH multisig scriptSig
# OP_0 <A sig> <B sig>
rpc_result = self.nodes[0].decodescript('00' + push_signature + push_signature)
assert_equal('0 ' + signature + ' ' + signature, rpc_result['asm'])
# 4) P2SH scriptSig
# an empty P2SH redeemScript is valid and makes for a very simple test case.
# thus, such a spending scriptSig would just need to pass the outer redeemScript
# hash test and leave true on the top of the stack.
rpc_result = self.nodes[0].decodescript('5100')
assert_equal('1 0', rpc_result['asm'])
# 5) null data scriptSig - no such thing because null data scripts can not be spent.
# thus, no test case for that standard transaction type is here.
def decodescript_script_pub_key(self):
public_key = '03b0da749730dc9b4b1f4a14d6902877a92541f5368778853d9c4a0cb7802dcfb2'
push_public_key = '21' + public_key
public_key_hash = '11695b6cd891484c2d49ec5aa738ec2b2f897777'
push_public_key_hash = '14' + public_key_hash
# below are test cases for all of the standard transaction types
# 1) P2PK scriptPubKey
# <pubkey> OP_CHECKSIG
rpc_result = self.nodes[0].decodescript(push_public_key + 'ac')
assert_equal(public_key + ' OP_CHECKSIG', rpc_result['asm'])
# 2) P2PKH scriptPubKey
# OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
rpc_result = self.nodes[0].decodescript('76a9' + push_public_key_hash + '88ac')
assert_equal('OP_DUP OP_HASH160 ' + public_key_hash + ' OP_EQUALVERIFY OP_CHECKSIG', rpc_result['asm'])
# 3) multisig scriptPubKey
# <m> <A pubkey> <B pubkey> <C pubkey> <n> OP_CHECKMULTISIG
# just imagine that the pub keys used below are different.
# for our purposes here it does not matter that they are the same even though it is unrealistic.
rpc_result = self.nodes[0].decodescript('52' + push_public_key + push_public_key + push_public_key + '53ae')
assert_equal('2 ' + public_key + ' ' + public_key + ' ' + public_key + ' 3 OP_CHECKMULTISIG', rpc_result['asm'])
# 4) P2SH scriptPubKey
# OP_HASH160 <Hash160(redeemScript)> OP_EQUAL.
# push_public_key_hash here should actually be the hash of a redeem script.
# but this works the same for purposes of this test.
rpc_result = self.nodes[0].decodescript('a9' + push_public_key_hash + '87')
assert_equal('OP_HASH160 ' + public_key_hash + ' OP_EQUAL', rpc_result['asm'])
# 5) null data scriptPubKey
# use a signature look-alike here to make sure that we do not decode random data as a signature.
# this matters if/when signature sighash decoding comes along.
# would want to make sure that no such decoding takes place in this case.
signature_imposter = '48304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
# OP_RETURN <data>
rpc_result = self.nodes[0].decodescript('6a' + signature_imposter)
assert_equal('OP_RETURN ' + signature_imposter[2:], rpc_result['asm'])
# 6) a CLTV redeem script. redeem scripts are in-effect scriptPubKey scripts, so adding a test here.
# OP_NOP2 is also known as OP_CHECKLOCKTIMEVERIFY.
# just imagine that the pub keys used below are different.
# for our purposes here it does not matter that they are the same even though it is unrealistic.
#
# OP_IF
# <receiver-pubkey> OP_CHECKSIGVERIFY
# OP_ELSE
# <lock-until> OP_CHECKLOCKTIMEVERIFY OP_DROP
# OP_ENDIF
# <sender-pubkey> OP_CHECKSIG
#
# lock until block 500,000
rpc_result = self.nodes[0].decodescript('63' + push_public_key + 'ad670320a107b17568' + push_public_key + 'ac')
assert_equal('OP_IF ' + public_key + ' OP_CHECKSIGVERIFY OP_ELSE 500000 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_ENDIF ' + public_key + ' OP_CHECKSIG', rpc_result['asm'])
def decoderawtransaction_asm_sighashtype(self):
"""Tests decoding scripts via RPC command "decoderawtransaction".
This test is in with the "decodescript" tests because they are testing the same "asm" script decodes.
"""
# this test case uses a random plain vanilla mainnet transaction with a single P2PKH input and output
tx = '0100000001696a20784a2c70143f634e95227dbdfdf0ecd51647052e70854512235f5986ca010000008a47304402207174775824bec6c2700023309a168231ec80b82c6069282f5133e6f11cbb04460220570edc55c7c5da2ca687ebd0372d3546ebc3f810516a002350cac72dfe192dfb014104d3f898e6487787910a690410b7a917ef198905c27fb9d3b0a42da12aceae0544fc7088d239d9a48f2828a15a09e84043001f27cc80d162cb95404e1210161536ffffffff0100e1f505000000001976a914eb6c6e0cdb2d256a32d97b8df1fc75d1920d9bca88ac00000000'
rpc_result = self.nodes[0].decoderawtransaction(tx)
assert_equal('304402207174775824bec6c2700023309a168231ec80b82c6069282f5133e6f11cbb04460220570edc55c7c5da2ca687ebd0372d3546ebc3f810516a002350cac72dfe192dfb[ALL] 04d3f898e6487787910a690410b7a917ef198905c27fb9d3b0a42da12aceae0544fc7088d239d9a48f2828a15a09e84043001f27cc80d162cb95404e1210161536', rpc_result['vin'][0]['scriptSig']['asm'])
# this test case uses a mainnet transaction that has a P2SH input and both P2PKH and P2SH outputs.
# it's from James D'Angelo's awesome introductory videos about multisig: https://www.youtube.com/watch?v=zIbUSaZBJgU and https://www.youtube.com/watch?v=OSA1pwlaypc
# verify that we have not altered scriptPubKey decoding.
tx = '01000000018d1f5635abd06e2c7e2ddf58dc85b3de111e4ad6e0ab51bb0dcf5e84126d927300000000fdfe0000483045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea01483045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75014c695221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53aeffffffff02611e0000000000001976a914dc863734a218bfe83ef770ee9d41a27f824a6e5688acee2a02000000000017a9142a5edea39971049a540474c6a99edf0aa4074c588700000000'
rpc_result = self.nodes[0].decoderawtransaction(tx)
assert_equal('8e3730608c3b0bb5df54f09076e196bc292a8e39a78e73b44b6ba08c78f5cbb0', rpc_result['txid'])
assert_equal('0 3045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea[ALL] 3045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75[ALL] 5221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53ae', rpc_result['vin'][0]['scriptSig']['asm'])
assert_equal('OP_DUP OP_HASH160 dc863734a218bfe83ef770ee9d41a27f824a6e56 OP_EQUALVERIFY OP_CHECKSIG', rpc_result['vout'][0]['scriptPubKey']['asm'])
assert_equal('OP_HASH160 2a5edea39971049a540474c6a99edf0aa4074c58 OP_EQUAL', rpc_result['vout'][1]['scriptPubKey']['asm'])
txSave = CTransaction()
txSave.deserialize(StringIO(unhexlify(tx)))
# make sure that a specifically crafted op_return value will not pass all the IsDERSignature checks and then get decoded as a sighash type
tx = '01000000015ded05872fdbda629c7d3d02b194763ce3b9b1535ea884e3c8e765d42e316724020000006b48304502204c10d4064885c42638cbff3585915b322de33762598321145ba033fc796971e2022100bb153ad3baa8b757e30a2175bd32852d2e1cb9080f84d7e32fcdfd667934ef1b012103163c0ff73511ea1743fb5b98384a2ff09dd06949488028fd819f4d83f56264efffffffff0200000000000000000b6a0930060201000201000180380100000000001976a9141cabd296e753837c086da7a45a6c2fe0d49d7b7b88ac00000000'
rpc_result = self.nodes[0].decoderawtransaction(tx)
assert_equal('OP_RETURN 300602010002010001', rpc_result['vout'][0]['scriptPubKey']['asm'])
# verify that we have not altered scriptPubKey processing even of a specially crafted P2PKH pubkeyhash and P2SH redeem script hash that is made to pass the der signature checks
tx = '01000000018d1f5635abd06e2c7e2ddf58dc85b3de111e4ad6e0ab51bb0dcf5e84126d927300000000fdfe0000483045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea01483045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75014c695221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53aeffffffff02611e0000000000001976a914301102070101010101010102060101010101010188acee2a02000000000017a91430110207010101010101010206010101010101018700000000'
rpc_result = self.nodes[0].decoderawtransaction(tx)
assert_equal('OP_DUP OP_HASH160 3011020701010101010101020601010101010101 OP_EQUALVERIFY OP_CHECKSIG', rpc_result['vout'][0]['scriptPubKey']['asm'])
assert_equal('OP_HASH160 3011020701010101010101020601010101010101 OP_EQUAL', rpc_result['vout'][1]['scriptPubKey']['asm'])
# some more full transaction tests of varying specific scriptSigs. used instead of
# tests in decodescript_script_sig because the decodescript RPC is specifically
# for working on scriptPubKeys (argh!).
push_signature = hexlify(txSave.vin[0].scriptSig)[2:(0x48*2+4)]
signature = push_signature[2:]
der_signature = signature[:-2]
signature_sighash_decoded = der_signature + '[ALL]'
signature_2 = der_signature + '82'
push_signature_2 = '48' + signature_2
signature_2_sighash_decoded = der_signature + '[NONE|ANYONECANPAY]'
# 1) P2PK scriptSig
txSave.vin[0].scriptSig = unhexlify(push_signature)
rpc_result = self.nodes[0].decoderawtransaction(hexlify(txSave.serialize()))
assert_equal(signature_sighash_decoded, rpc_result['vin'][0]['scriptSig']['asm'])
# make sure that the sighash decodes come out correctly for a more complex / lesser used case.
txSave.vin[0].scriptSig = unhexlify(push_signature_2)
rpc_result = self.nodes[0].decoderawtransaction(hexlify(txSave.serialize()))
assert_equal(signature_2_sighash_decoded, rpc_result['vin'][0]['scriptSig']['asm'])
# 2) multisig scriptSig
txSave.vin[0].scriptSig = unhexlify('00' + push_signature + push_signature_2)
rpc_result = self.nodes[0].decoderawtransaction(hexlify(txSave.serialize()))
assert_equal('0 ' + signature_sighash_decoded + ' ' + signature_2_sighash_decoded, rpc_result['vin'][0]['scriptSig']['asm'])
# 3) test a scriptSig that contains more than push operations.
# in fact, it contains an OP_RETURN with data specially crafted to cause improper decode if the code does not catch it.
txSave.vin[0].scriptSig = unhexlify('6a143011020701010101010101020601010101010101')
rpc_result = self.nodes[0].decoderawtransaction(hexlify(txSave.serialize()))
print(hexlify('636174'))
assert_equal('OP_RETURN 3011020701010101010101020601010101010101', rpc_result['vin'][0]['scriptSig']['asm'])
def run_test(self):
self.decodescript_script_sig()
self.decodescript_script_pub_key()
self.decoderawtransaction_asm_sighashtype()
if __name__ == '__main__':
DecodeScriptTest().main()
| [
"mirzaei@ce.sharif.edu"
] | mirzaei@ce.sharif.edu |
d93230d172007f9aaa9676cedb2752f3229b411f | a3b9e1736bee79b8b9ba0d6b21ab9a7a875db3a3 | /lab2/task2.py | effcdb88834209a6769c3141223553ce338c672a | [] | no_license | SorokinStanislav/machine_learning | 588346636097bb42125257338e3d91b4f51160c8 | 49260a4732c8a86448b12494d706bcd0f52690ee | refs/heads/master | 2021-08-30T14:05:31.635433 | 2017-12-18T08:14:40 | 2017-12-18T08:14:40 | 110,861,705 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,480 | py | import numpy as np
import matplotlib.pyplot as plt
import lab2.kernel_functions as kernel
from matplotlib.ticker import AutoMinorLocator
from lab2.task1 import silverman_bandwidth, general_naive_density_estimator
def task2(data):
sorted_data = sorted(data)
bandwidth = silverman_bandwidth(data)
val = 0.
ins = []
box_outs = []
gauss_outs = []
epanechnikov_outs = []
triangular_outs = []
for x in sorted_data:
ins.append(x)
box_outs.append(general_naive_density_estimator(x, data, bandwidth, kernel.box_kernel))
gauss_outs.append(general_naive_density_estimator(x, data, bandwidth, kernel.gaussian_kernel))
epanechnikov_outs.append(general_naive_density_estimator(x, data, bandwidth, kernel.epanechnikov_kernel))
triangular_outs.append(general_naive_density_estimator(x, data, bandwidth, kernel.triangular_kernel))
plt.figure(5)
ax = plt.axes()
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.plot(ins, box_outs)
plt.plot(sorted_data, np.zeros_like(sorted_data) + val, 'x', color='orange')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.show()
plt.figure(6)
ax = plt.axes()
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.plot(ins, gauss_outs)
plt.plot(sorted_data, np.zeros_like(sorted_data) + val, 'x', color='orange')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.show()
plt.figure(7)
ax = plt.axes()
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.plot(ins, epanechnikov_outs)
plt.plot(sorted_data, np.zeros_like(sorted_data) + val, 'x', color='orange')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.show()
plt.figure(8)
ax = plt.axes()
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.plot(ins, triangular_outs)
plt.plot(sorted_data, np.zeros_like(sorted_data) + val, 'x', color='orange')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.show()
| [
"ssss4-281094@yandex.ru"
] | ssss4-281094@yandex.ru |
cb6562a470baad7851fc37e21014202bc829e0d2 | b1838ed33088c3ea56de617039cccde9644f3b9f | /projects/capstone/Emotion Classification/Model/VGG16_regular_ninth_try2.py | 3df2ee1c548e9b3c64b9bf2e980802f740616a08 | [] | no_license | bartchr808/machine-learning | b4dee500a440da425736d4eef8d9e58789cdec1c | 8930166f9628b1f876d7e7a3addd8f1bf2fd462d | refs/heads/master | 2021-01-20T14:09:17.150818 | 2017-07-28T03:55:33 | 2017-07-28T03:55:33 | 90,566,672 | 0 | 0 | null | 2017-05-07T22:47:26 | 2017-05-07T22:47:25 | null | UTF-8 | Python | false | false | 3,537 | py | # All necessary imports
import numpy as np
import h5py
from APL import APLUnit
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Flatten, InputLayer
from keras.layers.convolutional import Conv2D, MaxPooling2D, ZeroPadding2D
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
from batch_fscore import fbeta_score
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
seed = 7
np.random.seed(seed)
training_size = 28273
validation_size = 3533 # size of either test set
#def frac_max_pool(x):
# return tf.nn.fractional_max_pool(x,p_ratio)[0]
def model(weights = None, S = 5, p_ratio = [1.0, 2.6, 2.6, 1.0]):
model = Sequential()
model.add(Dropout(0.0, input_shape=(48, 48, 1)))
model.add(ZeroPadding2D((1,1)))
model.add(Conv2D(64, (5, 5)))
model.add(APLUnit(S=S))
model.add(MaxPooling2D((3,3), strides=(2,2)))
model.add(ZeroPadding2D((1,1)))
model.add(Conv2D(64, (5, 5)))
model.add(APLUnit(S=S))
model.add(InputLayer(input_tensor = tf.nn.fractional_max_pool(model.layers[7].output, p_ratio, overlapping=True)[0]))
model.add(ZeroPadding2D((1,1)))
model.add(Conv2D(128, (4, 4)))
model.add(APLUnit(S=S))
model.add(Flatten())
model.add(Dropout(0.25))
model.add(Dense(4096))
model.add(APLUnit(S=S))
model.add(Dense(6, activation = 'softmax'))
model.compile(loss = 'categorical_crossentropy', optimizer = 'adam', metrics = ['accuracy', fbeta_score])
if weights:
model.load_weights(weights)
return model
# build the model
model = model('VGG16_regular_ninth_try2_PRIVATE_TEST.h5') # my weights
batch_size = 256
# Preprocess inputted data
train_datagen = ImageDataGenerator(
rescale=1./255,
rotation_range = 30,
shear_range=0.2,
width_shift_range=0.2,
height_shift_range=0.2,
zoom_range=0.2,
fill_mode='nearest',
horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale = 1./255)
# Fit the model
train_generator = train_datagen.flow_from_directory(
'../Training', # this is the target directory
target_size = (48, 48), # all images will be resized to 48x48
batch_size = batch_size,
color_mode = 'grayscale')
# this is a similar generator, for validation data
validation_generator = test_datagen.flow_from_directory(
'../PrivateTest',
target_size = (48, 48),
batch_size = batch_size,
color_mode = 'grayscale')
# ~~~~~~~~~~~~~~~~ Check accuracy & F-score ~~~~~~~~~~~~~~~
score = model.evaluate_generator(validation_generator, validation_size // batch_size)
print("TEST")
print(score)
print("Loss: {0:.3} \nAccuracy: {1:.3%} \nF-Score: {2:.3%}").format(score[0], score[1], score[2])
# ~~~~~~~~~~~~~~~~~~~~~~ Train model ~~~~~~~~~~~~~~~~~~~~~~
# callback functions
save_best = ModelCheckpoint('VGG16_regular_ninth_try2_PRIVATE_TEST2.h5', monitor='val_acc', verbose=2, save_best_only=True, mode='max')
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.2,
patience=5, min_lr=0.001, verbose=1)
model.fit_generator(
train_generator,
steps_per_epoch = training_size // batch_size,
epochs=30,
callbacks = [save_best, reduce_lr],
validation_data=validation_generator,
validation_steps= validation_size // batch_size)
#model.save_weights('VGG16_regular_second_try.h5') # always save your weights after training or during training
| [
"bart.chr@gmail.com"
] | bart.chr@gmail.com |
993e276184d5b6e7a95befb0a9d2ab45838164e3 | 33a07bdcd109b360956ffdd970cdc23121ad6c46 | /todo/urls.py | bd1ced5fa426b73b3e1ffedab2797ff89315e2f4 | [] | no_license | shv-b13/Todo-App-Django | 6d08a6c4b732811c16069e73a3799ebb67ef3e6b | 24c94013e190857376d5007586850147860bd087 | refs/heads/master | 2020-04-27T08:59:59.355271 | 2019-03-06T18:13:20 | 2019-03-06T18:13:20 | 174,195,473 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 108 | py | from django.conf.urls import url
from . import views
urlpatterns = [
url('', views.todo, name='todo')
] | [
"shakeev2000@gmail.com"
] | shakeev2000@gmail.com |
b824a8f8fcd6773e176284464b0a5d8e30ad27cc | 744d656d05a8ae2e527f05c1520440fff0e031ec | /reddit/tests/test_comments.py | 6d9fcbdbfe8224f80f6d09431ff2f83abedfbd74 | [
"Apache-2.0"
] | permissive | bzbikowski/django_reddit | af921c258aac4fbacf0306a829c0fabc8145bb51 | a1776c48f3c8582848aa81919cfd911c342d5b6d | refs/heads/master | 2020-03-18T13:08:45.354498 | 2018-06-09T08:40:55 | 2018-06-09T08:40:55 | 134,763,293 | 1 | 0 | null | 2018-05-24T20:05:22 | 2018-05-24T20:05:22 | null | UTF-8 | Python | false | false | 7,763 | py | import json
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from reddit.models import Submission, Comment, Vote
from users.models import RedditUser
from django.contrib.auth.models import User
from django.utils.crypto import get_random_string
from django.http import HttpResponseNotAllowed, HttpResponseBadRequest
class TestViewingThreadComments(TestCase):
def setUp(self):
self.c = Client()
self.credentials = {'username': 'username',
'password': 'password'}
author = RedditUser.objects.create(
user=User.objects.create_user(**self.credentials)
)
submission = Submission.objects.create(
id=1,
score=1,
title=get_random_string(length=12),
author=author
)
for _ in range(3):
Comment.objects.create(
author_name=author.user.username,
author=author,
submission=submission,
html_comment="root comment"
)
# Add some replies
parent = Comment.objects.get(id=1)
for _ in range(2):
Comment.objects.create(
author_name=author.user.username,
author=author,
submission=submission,
parent=parent,
html_comment="reply comment"
)
# add upvote to one root comment,
Vote.create(
user=author,
vote_object=Comment.objects.get(id=1),
vote_value=1
).save()
# and downvote to one reply comment
Vote.create(
user=author,
vote_object=Comment.objects.get(id=5),
vote_value=-1
).save()
# add upvote to the submission
Vote.create(
user=author,
vote_object=submission,
vote_value=1
).save()
def test_valid_public_comment_view(self):
self.c.logout()
r = self.c.get(reverse('thread', args=(1,)))
submission = Submission.objects.get(id=1)
self.assertEqual(r.status_code, 200)
self.assertEqual(r.context['submission'], submission)
self.assertEqual(len(r.context['comments']), 5)
self.assertContains(r, 'root comment', count=3)
self.assertContains(r, 'reply comment', count=2)
self.assertEqual(r.context['comment_votes'], {})
self.assertIsNone(r.context['sub_vote'])
def test_comment_votes(self):
self.c.login(**self.credentials)
r = self.c.get(reverse('thread', args=(1,)))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.context['sub_vote'], 1)
self.assertEqual(r.context['comment_votes'], {1: 1, 5: -1})
self.assertContains(r, 'root comment', count=3)
self.assertContains(r, 'reply comment', count=2)
def test_invalid_thread_id(self):
r = self.c.get(reverse('thread', args=(123,)))
self.assertEqual(r.status_code, 404)
class TestPostingComment(TestCase):
def setUp(self):
self.c = Client()
self.credentials = {'username': 'commentposttest',
'password': 'password'}
author = RedditUser.objects.create(
user=User.objects.create_user(**self.credentials)
)
Submission.objects.create(
id=99,
score=1,
title=get_random_string(length=12),
author=author
)
def test_post_only(self):
r = self.c.get(reverse('post_comment'))
self.assertIsInstance(r, HttpResponseNotAllowed)
def test_logged_out(self):
r = self.c.post(reverse('post_comment'))
self.assertEqual(r.status_code, 200)
json_response = json.loads(r.content.decode("utf-8"))
self.assertEqual(json_response['msg'], "You need to log in to post new comments.")
def test_missing_type_or_id(self):
self.c.login(**self.credentials)
for key in ['parentType', 'parentId']:
r = self.c.post(reverse('post_comment'),
data={key: 'comment'})
self.assertIsInstance(r, HttpResponseBadRequest)
r = self.c.post(reverse('post_comment'),
data={'parentType': 'InvalidType',
'parentId': 1})
self.assertIsInstance(r, HttpResponseBadRequest)
def test_no_comment_text(self):
self.c.login(**self.credentials)
test_data = {
'parentType': 'submission',
'parentId': 1,
'commentContent': ''
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertEqual(r.status_code, 200)
json_response = json.loads(r.content.decode("utf-8"))
self.assertEqual(json_response['msg'],
'You have to write something.')
def test_invalid_or_wrong_parent_id(self):
self.c.login(**self.credentials)
test_data = {
'parentType': 'submission',
'parentId': 'invalid',
'commentContent': 'content'
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertIsInstance(r, HttpResponseBadRequest)
test_data = {
'parentType': 'submission',
'parentId': 9999,
'commentContent': 'content'
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertIsInstance(r, HttpResponseBadRequest)
test_data = {
'parentType': 'comment',
'parentId': 9999,
'commentContent': 'content'
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertIsInstance(r, HttpResponseBadRequest)
def test_valid_comment_posting_thread(self):
self.c.login(**self.credentials)
test_data = {
'parentType': 'submission',
'parentId': 99,
'commentContent': 'thread root comment'
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertEqual(r.status_code, 200)
json_r = json.loads(r.content.decode("utf-8"))
self.assertEqual(json_r['msg'], 'Your comment has been posted.')
all_comments = Comment.objects.filter(
submission=Submission.objects.get(id=99)
)
self.assertEqual(all_comments.count(), 1)
comment = all_comments.first()
self.assertEqual(comment.html_comment, '<p>thread root comment</p>\n')
self.assertEqual(comment.author.user.username, self.credentials['username'])
def test_valid_comment_posting_reply(self):
self.c.login(**self.credentials)
thread = Submission.objects.get(id=99)
author = RedditUser.objects.get(user=User.objects.get(
username=self.credentials['username']
))
comment = Comment.create(author, 'root comment', thread)
comment.save()
self.assertEqual(Comment.objects.filter(submission=thread).count(), 1)
test_data = {
'parentType': 'comment',
'parentId': comment.id,
'commentContent': 'thread reply comment'
}
r = self.c.post(reverse('post_comment'), data=test_data)
self.assertEqual(r.status_code, 200)
json_r = json.loads(r.content.decode("utf-8"))
self.assertEqual(json_r['msg'], 'Your comment has been posted.')
self.assertEqual(Comment.objects.filter(submission=thread).count(), 2)
comment = Comment.objects.filter(submission=thread,
id=2).first()
self.assertEqual(comment.html_comment, '<p>thread reply comment</p>\n')
| [
"nikolak@outlook.com"
] | nikolak@outlook.com |
217dd659da02c34f6609e93d8f4af3b7938a591d | 2289207666b611b0a6c0f5154c249892ec839969 | /ban/tests/commands/test_commands.py | 07889f8206c5c918cac1240a4ace5eab4af9aa85 | [] | no_license | fb98/ban | a1f9e181b0479bc6f82b83e14ad459a466610683 | 909328625d85c4eb691ad033e05bbab25f6ec3f1 | refs/heads/master | 2021-01-16T21:24:53.288487 | 2016-09-09T14:39:44 | 2016-09-09T14:39:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,493 | py | import json
from pathlib import Path
from ban.auth import models as amodels
from ban.commands.auth import createuser, listusers, createclient, listclients
from ban.commands.db import truncate
from ban.commands.export import resources
from ban.commands.importer import municipalities
from ban.core import models
from ban.core.encoder import dumps
from ban.core.versioning import Diff
from ban.tests import factories
def test_import_municipalities(staff, config):
path = Path(__file__).parent / 'data/municipalities.csv'
municipalities(path)
assert len(models.Municipality.select()) == 4
assert not len(Diff.select())
def test_import_municipalities_can_be_filtered_by_departement(staff, config):
path = Path(__file__).parent / 'data/municipalities.csv'
municipalities(path, departement=33)
assert len(models.Municipality.select()) == 1
assert not len(Diff.select())
def test_create_user_is_not_staff_by_default(monkeypatch):
monkeypatch.setattr('ban.commands.helpers.prompt', lambda *x, **wk: 'pwd')
assert not amodels.User.select().count()
createuser(username='testuser', email='aaaa@bbbb.org')
assert amodels.User.select().count() == 1
user = amodels.User.first()
assert not user.is_staff
def test_create_user_should_accept_is_staff_kwarg(monkeypatch):
monkeypatch.setattr('ban.commands.helpers.prompt', lambda *x, **wk: 'pwd')
assert not amodels.User.select().count()
createuser(username='testuser', email='aaaa@bbbb.org', is_staff=True)
assert amodels.User.select().count() == 1
user = amodels.User.first()
assert user.is_staff
def test_listusers(capsys):
user = factories.UserFactory()
listusers()
out, err = capsys.readouterr()
assert user.username in out
def test_create_client_should_accept_username():
user = factories.UserFactory()
assert not amodels.Client.select().count()
createclient(name='test client', user=user.username)
assert amodels.Client.select().count() == 1
client = amodels.Client.first()
assert client.user == user
def test_create_client_should_accept_email():
user = factories.UserFactory()
assert not amodels.Client.select().count()
createclient(name='test client', user=user.email)
assert amodels.Client.select().count() == 1
client = amodels.Client.first()
assert client.user == user
def test_create_client_should_not_crash_on_non_existing_user(capsys):
assert not amodels.Client.select().count()
createclient(name='test client', user='doesnotexist')
assert not amodels.Client.select().count()
out, err = capsys.readouterr()
assert 'User not found' in out
def test_listclients(capsys):
client = factories.ClientFactory()
listclients()
out, err = capsys.readouterr()
assert client.name in out
assert str(client.client_id) in out
assert client.client_secret in out
def test_truncate_should_truncate_all_tables_by_default(monkeypatch):
factories.MunicipalityFactory()
factories.GroupFactory()
monkeypatch.setattr('ban.commands.helpers.confirm', lambda *x, **wk: True)
truncate()
assert not models.Municipality.select().count()
assert not models.Group.select().count()
def test_truncate_should_only_truncate_given_names(monkeypatch):
factories.MunicipalityFactory()
factories.GroupFactory()
monkeypatch.setattr('ban.commands.helpers.confirm', lambda *x, **wk: True)
truncate('group')
assert models.Municipality.select().count()
assert not models.Group.select().count()
def test_truncate_should_not_ask_for_confirm_in_force_mode(monkeypatch):
factories.MunicipalityFactory()
truncate(force=True)
assert not models.Municipality.select().count()
def test_export_resources():
mun = factories.MunicipalityFactory()
street = factories.GroupFactory(municipality=mun)
hn = factories.HouseNumberFactory(parent=street)
factories.PositionFactory(housenumber=hn)
path = Path(__file__).parent / 'data/export.sjson'
resources(path)
with path.open() as f:
lines = f.readlines()
assert len(lines) == 3
# loads/dumps to compare string dates to string dates.
assert json.loads(lines[0]) == json.loads(dumps(mun.as_relation))
assert json.loads(lines[1]) == json.loads(dumps(street.as_relation))
# Plus, JSON transform internals tuples to lists.
assert json.loads(lines[2]) == json.loads(dumps(hn.as_relation))
path.unlink()
| [
"yb@enix.org"
] | yb@enix.org |
725acb868375a17eee87ad56c1c2d9b5a44735c6 | 01f7956788331cb522125b9a0b21dc7e3407552f | /main.py | bdb9419fa496738d63d458f54716418e33415569 | [
"MIT"
] | permissive | vittorduartte/openufma_mongodb | 35bbcde91d535d429f9aaf8d637540c8f8d7f1f6 | 177e970f341e04015a1f427afc1fc537bd78cc49 | refs/heads/master | 2023-05-08T18:58:23.267759 | 2020-04-11T09:58:54 | 2020-04-11T09:58:54 | 254,838,336 | 1 | 0 | MIT | 2021-06-02T01:30:14 | 2020-04-11T09:55:22 | Python | UTF-8 | Python | false | false | 322 | py | from mongoengine import *
from courses import saveCoursesAndStudents
from subunitys import saveSubunitysAndTeachers
from monographys import saveMonographys
import os
connect(db="openufma", alias="openufma", host=os.getenv("MONGODB_ATLAS_URI"))
saveCoursesAndStudents()
saveSubunitysAndTeachers()
saveMonographys()
| [
"mateusriograndense@gmail.com"
] | mateusriograndense@gmail.com |
e79fee5bf3b5d0cc1691ec110d1bf98af0ac79ce | 7c48523e17cc899f53eeaea4697e7484aeb7be07 | /url_shortener/app/migrations/0003_auto_20161017_1824.py | 0669e1a53b780fe5c635db7e397ae086bd66275a | [] | no_license | cjredmond/url_shortener | fd126e57626ac4c4ea1c7771ed235c6ba9f012cd | 8699466c0bc0be47a1aa2f6c51fb48d825197faf | refs/heads/master | 2021-01-11T04:24:43.572468 | 2016-12-15T19:27:12 | 2016-12-15T19:27:12 | 71,164,196 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 487 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-17 18:24
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20161017_1822'),
]
operations = [
migrations.RemoveField(
model_name='link',
name='created',
),
migrations.RemoveField(
model_name='link',
name='user',
),
]
| [
"connor.redmond@gmail.com"
] | connor.redmond@gmail.com |
6f6ad9f12e3a02da0297c96efe0ffeb942f0b26f | 4234dc363d0599e93abc1d9a401540ad67702b3b | /clients/client/python/test/test_health_not_ready_status.py | 0d06f7b80e17dc904565f8fd0230e509b569b2c2 | [
"Apache-2.0"
] | permissive | ninjayoto/sdk | 8065d3f9e68d287fc57cc2ae6571434eaf013157 | 73823009a416905a4ca1f9543f1a94dd21e4e8da | refs/heads/master | 2023-08-28T03:58:26.962617 | 2021-11-01T17:57:24 | 2021-11-01T17:57:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 925 | py | """
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.21
Contact: support@ory.sh
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import ory_client
from ory_client.model.health_not_ready_status import HealthNotReadyStatus
class TestHealthNotReadyStatus(unittest.TestCase):
"""HealthNotReadyStatus unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testHealthNotReadyStatus(self):
"""Test HealthNotReadyStatus"""
# FIXME: construct object with mandatory attributes with example values
# model = HealthNotReadyStatus() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
| [
"3372410+aeneasr@users.noreply.github.com"
] | 3372410+aeneasr@users.noreply.github.com |
6b72f36694d7eabf144f86a7d5d269123c4daf9a | fa346a2d5886420e22707a7be03599e634b230a9 | /temboo/Library/Flickr/PhotoComments/__init__.py | 9222ebe3c98daa3fbed06c59677456643f854a74 | [] | no_license | elihuvillaraus/entity-resolution | cebf937499ed270c3436b1dd25ab4aef687adc11 | 71dd49118a6e11b236861289dcf36436d31f06bc | refs/heads/master | 2021-12-02T17:29:11.864065 | 2014-01-08T04:29:30 | 2014-01-08T04:29:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 82 | py | from RemoveComment import *
from ListComments import *
from LeaveComment import *
| [
"cedric.warny@gmail.com"
] | cedric.warny@gmail.com |
ab902776461c67a21da37902d0d7f77b812de5a1 | ee3b76750c1530dbffbbf97416fc5861c1118253 | /api/managed_users/mixins.py | 9aa2a0eb0470aacace74ccbfe11d07fe7dccf9ba | [
"MIT"
] | permissive | Alexeino/oauth-microservice | ef6cd34b2009bf059432c25d835255a674a900eb | a87796bff41bed745878bafab3ccf06e346c43e9 | refs/heads/master | 2023-05-27T12:50:26.178761 | 2018-11-01T19:33:20 | 2018-11-01T19:33:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,935 | py | from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.mail import EmailMultiAlternatives
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.template import loader
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from rest_framework import status
from rest_framework.response import Response
from rest_framework.mixins import CreateModelMixin
managed_user_settings = settings.REMOTE_USER_MANAGEMENT
class CreateRemoteUserMixin(CreateModelMixin):
""" Allow a remote user to be created with default permissions if the
requesting user has permission to do so.
Creating a Remote User does not allow for the setting of a password.
The new user is required to set their first time password.
This mixin will provide all of the functionality for managing managed users.
"""
managing_user_permission = managed_user_settings['MANAGING_USER_PERMISSION']
subject_template_name = 'managed_users/welcome_password_reset_subject.txt'
email_template_name = 'managed_users/welcome_password_reset_email.html'
token_generator = default_token_generator
from_email = settings.DEFAULT_FROM_EMAIL
use_https = settings.USE_SSL
PERMISSION_DENIED_MESSAGE = 'You do not have permission to create managed users.'
def get_password_reset_email_context(self, user, request):
current_site = get_current_site(request)
return {
'email': user.email,
'domain': current_site.domain,
'site_name': current_site.name,
'uid': urlsafe_base64_encode(force_bytes(user.pk)).decode(),
'user': user,
'token': self.token_generator.make_token(user),
'protocol': 'https' if self.use_https else 'http',
}
def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_template_name=None):
subject = loader.render_to_string(subject_template_name, context)
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
body = loader.render_to_string(email_template_name, context)
email_message = EmailMultiAlternatives(subject, body, from_email, [to_email])
email_message.send()
def create(self, request, *args, **kwargs):
""" Create the user given in the request.
If the requesting user has sufficient management permissions, create
the requested user and send them an email informing them that they've
been added to the system and that they need to reset their password
to gain access.
Validation and Permission errors are raised to leverage DRF's built-in
exception handling and response formats.
"""
# Validate that the requesting user is allowed to create managed users
if not request.user.has_perm(self.managing_user_permission):
raise PermissionDenied(self.PERMISSION_DENIED_MESSAGE)
# Create the new managed user
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
user = self.perform_create(serializer)
# Send new user a password reset email
context = self.get_password_reset_email_context(user, request)
self.send_mail(
self.subject_template_name,
self.email_template_name,
context,
self.from_email,
user.email,
)
# Let the requesting user know that a new user was successfully created
headers = self.get_success_headers(serializer.data)
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
def perform_create(self, serializer):
return serializer.save()
| [
"brian@brianschrader.com"
] | brian@brianschrader.com |
51c743758a2c47a71c63d635856bc7792e14c161 | 065fa583a7af7134b7e6a366caabd0b44dff0b2a | /stylegan2/pretrained_networks.py | ef3805bfee968a489ed9b635d9f4ddb20834c4cd | [] | no_license | swapp1990/my-music-video-editing-app | 977f5b7ab2d72562301d367104b0abccea904c66 | 8cc0e36f979bba978a687a4a686ef022a3a749d3 | refs/heads/master | 2020-12-22T20:15:36.917325 | 2020-01-29T06:45:16 | 2020-01-29T06:45:16 | 236,920,354 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,626 | py | # Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
"""List of pre-trained StyleGAN2 networks located on Google Drive."""
import pickle
import dnnlib
import dnnlib.tflib as tflib
#----------------------------------------------------------------------------
# StyleGAN2 Google Drive root: https://drive.google.com/open?id=1QHc-yF5C3DChRwSdZKcx1w6K8JvSxQi7
gdrive_urls = {
'gdrive:networks/stylegan2-car-config-a.pkl': 'https://drive.google.com/uc?id=1MhZpQAqgxKTz22u_urk0HSXA-BOLMCLV',
'gdrive:networks/stylegan2-car-config-b.pkl': 'https://drive.google.com/uc?id=1MirO1UBmfF4c-aZDDrfyknOj8iO8Qvb2',
'gdrive:networks/stylegan2-car-config-c.pkl': 'https://drive.google.com/uc?id=1MlFg5VVajuPyPkFt3f1HGiJ6OBWAPdaJ',
'gdrive:networks/stylegan2-car-config-d.pkl': 'https://drive.google.com/uc?id=1MpM83SpDgitOab_icAWU12D5P2ZpCHFl',
'gdrive:networks/stylegan2-car-config-e.pkl': 'https://drive.google.com/uc?id=1MpsFaO0BFo3qhor0MN0rnPFQCr_JpqLm',
'gdrive:networks/stylegan2-car-config-f.pkl': 'https://drive.google.com/uc?id=1MutzVf8XjNo6TUg03a6CUU_2Vlc0ltbV',
'gdrive:networks/stylegan2-cat-config-a.pkl': 'https://drive.google.com/uc?id=1MvGHMNicQjhOdGs94Zs7fw6D9F7ikJeO',
'gdrive:networks/stylegan2-cat-config-f.pkl': 'https://drive.google.com/uc?id=1MyowTZGvMDJCWuT7Yg2e_GnTLIzcSPCy',
'gdrive:networks/stylegan2-church-config-a.pkl': 'https://drive.google.com/uc?id=1N2g_buEUxCkbb7Bfpjbj0TDeKf1Vrzdx',
'gdrive:networks/stylegan2-church-config-f.pkl': 'https://drive.google.com/uc?id=1N3iaujGpwa6vmKCqRSHcD6GZ2HVV8h1f',
'gdrive:networks/stylegan2-ffhq-config-a.pkl': 'https://drive.google.com/uc?id=1MR3Ogs9XQlupSF_al-nGIAh797Cp5nKA',
'gdrive:networks/stylegan2-ffhq-config-b.pkl': 'https://drive.google.com/uc?id=1MW5O1rxT8CsPfJ9i7HF6Xr0qD8EKw5Op',
'gdrive:networks/stylegan2-ffhq-config-c.pkl': 'https://drive.google.com/uc?id=1MWfZdKNqWHv8h2K708im70lx0MDcP6ow',
'gdrive:networks/stylegan2-ffhq-config-d.pkl': 'https://drive.google.com/uc?id=1MbdyjloQxe4pdAUnad-M08EZBxeYAIOr',
'gdrive:networks/stylegan2-ffhq-config-e.pkl': 'https://drive.google.com/uc?id=1Md448HIgwM5eCdz39vk-m5pRbJ3YqQow',
'gdrive:networks/stylegan2-ffhq-config-f.pkl': 'https://drive.google.com/uc?id=1Mgh-jglZjgksupF0XLl0KzuOqd1LXcoE',
'gdrive:networks/stylegan2-horse-config-a.pkl': 'https://drive.google.com/uc?id=1N4lnXL3ezv1aeQVoGY6KBen185MTvWOu',
'gdrive:networks/stylegan2-horse-config-f.pkl': 'https://drive.google.com/uc?id=1N55ZtBhEyEbDn6uKBjCNAew1phD5ZAh-',
'gdrive:networks/table2/stylegan2-car-config-e-Gorig-Dorig.pkl': 'https://drive.google.com/uc?id=1NuS7MSsVcP17dgPX_pLMPtIf5ElcE3jJ',
'gdrive:networks/table2/stylegan2-car-config-e-Gorig-Dresnet.pkl': 'https://drive.google.com/uc?id=1O7BD5yqSk87cjVQcOlLEGUeztOaC-Cyw',
'gdrive:networks/table2/stylegan2-car-config-e-Gorig-Dskip.pkl': 'https://drive.google.com/uc?id=1O2NjtullNlymC3ZOUpULCeMtvkCottnn',
'gdrive:networks/table2/stylegan2-car-config-e-Gresnet-Dorig.pkl': 'https://drive.google.com/uc?id=1OMe7OaicfJn8KUT2ZjwKNxioJJZz5QrI',
'gdrive:networks/table2/stylegan2-car-config-e-Gresnet-Dresnet.pkl': 'https://drive.google.com/uc?id=1OpogMnDdehK5b2pqBbvypYvm3arrhCtv',
'gdrive:networks/table2/stylegan2-car-config-e-Gresnet-Dskip.pkl': 'https://drive.google.com/uc?id=1OZjZD4-6B7W-WUlsLqXUHoM0XnPPtYQb',
'gdrive:networks/table2/stylegan2-car-config-e-Gskip-Dorig.pkl': 'https://drive.google.com/uc?id=1O7CVde1j-zh7lMX-gXGusRRSpY-0NY8L',
'gdrive:networks/table2/stylegan2-car-config-e-Gskip-Dresnet.pkl': 'https://drive.google.com/uc?id=1OCJ-OZZ_N-_Qay6ZKopQFe4M_dAy54eS',
'gdrive:networks/table2/stylegan2-car-config-e-Gskip-Dskip.pkl': 'https://drive.google.com/uc?id=1OAPFAJYcJTjYHLP5Z29KlkWIOqB8goOk',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gorig-Dorig.pkl': 'https://drive.google.com/uc?id=1N8wMCQ5j8iQKwLFrQl4T4gJtY_9wzigu',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gorig-Dresnet.pkl': 'https://drive.google.com/uc?id=1NRhA2W87lx4DQg3KpBT8QuH5a3RzqSXd',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gorig-Dskip.pkl': 'https://drive.google.com/uc?id=1NBvTUYqzx6NZfXgmdOSyg-2PdrksEj8U',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gresnet-Dorig.pkl': 'https://drive.google.com/uc?id=1NhyfG5h9mbA400nUqejpOVyEouxbKeMx',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gresnet-Dresnet.pkl': 'https://drive.google.com/uc?id=1Ntq-RrbSjZ-gxbRL46BoNrEygbsDkNrB',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gresnet-Dskip.pkl': 'https://drive.google.com/uc?id=1NkJi8o9pDRNCOlv-nYmlM4rvhB27UVc5',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gskip-Dorig.pkl': 'https://drive.google.com/uc?id=1NdlwIO2nvQCfwyY-a-111B3aZQlZGrk8',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gskip-Dresnet.pkl': 'https://drive.google.com/uc?id=1Nheaxsq08HsTn2gTDlBydv90M818NeJk',
'gdrive:networks/table2/stylegan2-ffhq-config-e-Gskip-Dskip.pkl': 'https://drive.google.com/uc?id=1Nfe0O5M-4654w0_5xvnSf-ng07vXIFBR',
}
#---------------------------F-------------------------------------------------
def get_path_or_url(path_or_gdrive_path):
return gdrive_urls.get(path_or_gdrive_path, path_or_gdrive_path)
#----------------------------------------------------------------------------
_cached_networks = dict()
def load_networks(path_or_gdrive_path):
path_or_url = get_path_or_url(path_or_gdrive_path)
if path_or_url in _cached_networks:
return _cached_networks[path_or_url]
if dnnlib.util.is_url(path_or_url):
stream = dnnlib.util.open_url(path_or_url, cache_dir='stylegan2-cache')
else:
stream = open(path_or_url, 'rb')
tflib.init_tf()
with stream:
G, D, Gs = pickle.load(stream, encoding='latin1')
_cached_networks[path_or_url] = G, D, Gs
return G, D, Gs
#----------------------------------------------------------------------------
| [
"swapp19902@gmail.com"
] | swapp19902@gmail.com |
7903a28ac19128d86dce0cddb7f67678f2ab0bc3 | c9c052f255e5a3b3c520a7fe0d8e35583dd5f0b8 | /modules/image_scraper.py | 6a5eb127f9f58b70230e0009dc7b08c6379f6d49 | [
"MIT"
] | permissive | rad10/OCR-to-CSV | d42ed4e0c073ccc0352bc75634d5536491da4cc9 | 76a0c1d2063fa439ffc8c0771c9f0c6d7110a753 | refs/heads/Python | 2022-04-29T02:31:37.421983 | 2020-09-10T18:14:55 | 2020-09-10T18:14:55 | 211,869,687 | 0 | 0 | MIT | 2022-03-12T00:17:57 | 2019-09-30T13:44:20 | Python | UTF-8 | Python | false | false | 13,543 | py | import logging
from os.path import exists
import cv2
import numpy as np
from pdf2image import convert_from_path
def collect_contours(image):
""" Sub function used by scrapper.\n
@param image: an opencv image\n
@return returns an ordered list of contours found in the image.\n
This function was heavily influenced by its source.\n
@source: https://medium.com/coinmonks/a-box-detection-algorithm-for-any-image-containing-boxes-756c15d7ed26
"""
debug_index = 0
# Grab absolute thresh of image
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(
image, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
invert = 255 - thresh
if (logging.getLogger().level <= logging.DEBUG):
while exists("debugOutput/scrapper/{ind}1invert.jpg".format(ind=debug_index)):
debug_index += 1
cv2.imwrite(
"debugOutput/scrapper/{ind}1invert.jpg".format(ind=debug_index), invert)
#######################################
# Defining kernels for line detection #
#######################################
kernel_length = np.array(image).shape[1]//80
verticle_kernel = cv2.getStructuringElement(
cv2.MORPH_RECT, (1, kernel_length)) # kernel for finding all verticle lines
# kernel for finding all horizontal lines
hori_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (kernel_length, 1))
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3)) # 3x3 kernel
# Collecting Verticle Lines
verticle_lines = cv2.erode(invert, verticle_kernel, iterations=3)
verticle_lines = cv2.dilate(verticle_lines, verticle_kernel, iterations=3)
verticle_lines = cv2.threshold(
verticle_lines, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/{ind}2verticleLines.jpg".format(ind=debug_index), verticle_lines)
# Collecting Horizontal Lines
horizontal_lines = cv2.erode(invert, hori_kernel, iterations=3)
horizontal_lines = cv2.dilate(horizontal_lines, hori_kernel, iterations=3)
horizontal_lines = cv2.threshold(
horizontal_lines, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/{ind}3horizontalLines.jpg".format(
ind=debug_index), horizontal_lines)
# Weighting parameters, this will decide the quantity of an image to be added
# to make a new image.
alpha = 0.5
beta = 1.0 - alpha
# combining verticle and horizontal lines. This gives us an empty table so that
# letters dont become boxes
blank_table = cv2.addWeighted(
verticle_lines, alpha, horizontal_lines, beta, 0.0)
blank_table = cv2.erode(~blank_table, kernel, iterations=2)
blank_table = cv2.threshold(blank_table, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[
1] # sharpening new table
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/{ind}4blankTable.jpg".format(ind=debug_index), blank_table)
# Detecting all contours, which gives me all box positions
contours = cv2.findContours(
blank_table, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
# Organizing contours
# we got our boxes, but its mostly to sort the contours
bboxes = [cv2.boundingRect(c) for c in contours]
# Sort all the contours in ascending order
contours, bboxes = zip(
*sorted(zip(contours, bboxes), key=lambda b: b[1][1], reverse=False))
return contours
# Generator
# PHASE 1: manipulate image to clearly show tabs
def image_scraper(file, output_array=None):
"""This function if phase 1 of the process. It starts by taking the image/pdf
of the signin sheet and breaks the table apart to isolate each value in the exact
order that they came in.\n
@param file: the image/pdf that needs to be scraped into its values.\n
@param outputArray: a parameter passed by reference due to the nature
of tkinters buttons. If the param is not filled, it will just return the result.\n
@return a multidimension array of images that containes the values of all the slots in the table.
"""
images = []
sheets = [] # an array with each index containing the output per page
debug_index = 0
if not (file.split(".")[1] in ["jpg", "jpeg", "png", "pdf"]):
return
elif not exists(file):
raise FileNotFoundError("File given does not exist.")
if file.split(".")[1] == "pdf":
for image in convert_from_path(file):
image = np.array(image)
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
images.append(image)
else:
# , cv2.IMREAD_GRAYSCALE)
images.append(cv2.imread(file, cv2.COLOR_RGB2BGR))
for image in images:
contours = collect_contours(image)
# // This is to tell which boxes correlate to the date
# Phase 1: Finding Main Boxes ## // and which big box is the signin table
#################################
main_boxes = []
for c in contours:
x, y, w, h = cv2.boundingRect(c)
if ((h, w, 3) == image.shape):
continue
for m in main_boxes:
if (x > m[0] and w < m[2]) or (y > m[1] and h < m[3]):
break
elif(x <= m[0] and w >= m[2] and y <= m[1] and h >= m[3]):
main_boxes.remove(m)
main_boxes.append([x, y, w, h])
else:
main_boxes.append([x, y, w, h])
table = main_boxes[0] # img that contains whole table
for x, y, w, h in main_boxes:
if((w - x > table[2] - table[0]) or (h - y > table[3] - table[1])):
table = [x, y, w, h]
main_boxes.remove(table)
# making images for date and day
sheets.append([[], []])
for x, y, w, h in main_boxes:
sheets[-1][0].append(image[y:y+h, x:x+w])
# Checking if dates are text and not random images
for i in range(len(sheets[-1][0]) - 1, -1, -1):
date = sheets[-1][0][i]
temp_date = cv2.cvtColor(date, cv2.COLOR_BGR2GRAY)
temp_date = cv2.threshold(
temp_date, 230, 255, cv2.THRESH_BINARY_INV)[1]
black_pixel = cv2.countNonZero(temp_date)
total_pixel = temp_date.shape[0] * temp_date.shape[1]
# if the space filled is not between 1%-20%, then its a dud
if(black_pixel/total_pixel <= 0.01 or black_pixel/total_pixel >= 0.20):
sheets[-1][0].pop(i)
#########################################
# Phase 2: Collecting pairs for mapping #
#########################################
# Collecting contours collected from table
table = image[table[1]-5:table[1]+table[3] +
5, table[0]-5:table[0]+table[2]+5]
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/mainTable{image}.jpg".format(image=debug_index), table)
debug_index += 1
# Grabbing verticle and horizontal images of table for better scraping
table_compute = cv2.cvtColor(table, cv2.COLOR_BGR2GRAY)
table_compute = cv2.threshold(
table_compute, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
table_invert = 255 - table_compute
t_kernel_length = np.array(table_compute).shape[1]//80
t_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
#############################
# Collecting Verticle Pairs #
#############################
verticle_points = []
verticle_pairs = []
# Creating verticle kernel lines
t_kernel_verticle = cv2.getStructuringElement(
cv2.MORPH_RECT, (1, t_kernel_length))
t_verticle_lines = cv2.erode(
table_invert, t_kernel_verticle, iterations=3)
t_verticle_lines = cv2.dilate(
t_verticle_lines, t_kernel_verticle, iterations=3)
t_verticle_lines = cv2.threshold(
t_verticle_lines, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/table{}VertLines.jpg".format(debug_index), t_verticle_lines)
# Collecting verticle contours
contours = cv2.findContours(
t_verticle_lines, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
# Figuring out the length that relates to the majority of the table,
# (aka, longer lengths relates to length of table rather than random lines)
max_length = 0
table_height_pair = () # empty tuple for checking later
for c in contours:
x, y, w, h = cv2.boundingRect(c)
if(h >= table.shape[0] * 0.9): # (y, h) == tableHeightPair):
verticle_points.append(x)
verticle_points.append(x + w)
verticle_points.sort()
# this is the gap before the table from the left side
verticle_points.pop(0)
# this is the gap after the table from the right side
verticle_points.pop(-1)
# taking points and making pairs
for i in range(0, len(verticle_points), 2):
verticle_pairs.append((verticle_points[i], verticle_points[i + 1]))
logging.debug("VerticlePairs: %s", verticle_pairs)
if (logging.getLogger().level <= logging.DEBUG):
debug_img = cv2.cvtColor(t_verticle_lines, cv2.COLOR_GRAY2BGR)
for v in verticle_pairs:
cv2.line(debug_img, (v[0], 0),
(v[0], debug_img.shape[0]), (0, 0, 255))
cv2.line(debug_img, (v[1], 0),
(v[1], debug_img.shape[0]), (0, 0, 255))
cv2.imwrite(
"debugOutput/scrapper/table{}VertContours.jpg".format(debug_index), debug_img)
###############################
# Collecting Horizontal Pairs #
###############################
horizontal_pairs = []
horizontal_points = []
# Creating horizontal kernel lines
t_kernel_horizontal = cv2.getStructuringElement(
cv2.MORPH_RECT, (t_kernel_length, 1))
t_horizontal_lines = cv2.erode(
table_invert, t_kernel_horizontal, iterations=3)
t_horizontal_lines = cv2.dilate(
t_horizontal_lines, t_kernel_horizontal, iterations=3)
t_horizontal_lines = cv2.threshold(
t_horizontal_lines, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/scrapper/table{}HorLines.jpg".format(debug_index), t_horizontal_lines)
# Collecting Horizontal contours
contours = cv2.findContours(
t_horizontal_lines, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
# Figuring out the length that relates to the majority of the table,
# (aka, longer lengths relates to length of table rather than random lines)
max_length = 0
table_width_pair = () # empty tuple for checking later
for c in contours:
x, y, w, h = cv2.boundingRect(c)
# (x, w) == tableWidthPair or w >= tHorizontalLines.shape[1] * 0.9):
if(w >= t_horizontal_lines.shape[1] * 0.9):
horizontal_points.append(y)
horizontal_points.append(y + h)
horizontal_points.sort()
logging.debug("HorizontalPoints: %s", horizontal_points)
# this is the gap before the table from the top
horizontal_points.pop(0)
# this is the gap after the table from the bottom
horizontal_points.pop(-1)
# Building pairs from points
for i in range(0, len(horizontal_points), 2):
horizontal_pairs.append(
(horizontal_points[i], horizontal_points[i + 1]))
logging.debug("HorizontalPairs: %s", horizontal_pairs)
if (logging.getLogger().level <= logging.DEBUG):
debug_img = cv2.cvtColor(t_horizontal_lines, cv2.COLOR_GRAY2BGR)
for h in horizontal_pairs:
cv2.line(debug_img, (0, h[0]),
(debug_img.shape[1], h[0]), (0, 0, 255))
cv2.line(debug_img, (0, h[1]),
(debug_img.shape[1], h[1]), (0, 0, 255))
cv2.imwrite(
"debugOutput/scrapper/table{}HorContours.jpg".format(debug_index), debug_img)
#####################################
# Phase 3: Time for actual Scraping #
#####################################
# the dictionary thatll hold all our information
dict_row = 0
for row in horizontal_pairs:
sheets[-1][1].append([])
for col in verticle_pairs:
sheets[-1][1][dict_row].append(table[row[0]:row[1], col[0]:col[1]])
if (logging.getLogger().level <= logging.DEBUG):
cv2.imwrite(
"debugOutput/dictionary/raw/table{}{}.jpg".format(
dict_row, col[1]-col[0]), table[row[0]:row[1], col[0]:col[1]])
dict_row += 1
if(output_array == None):
return sheets
else:
globals()["output_array"] = sheets.copy()
return
| [
"nrc1mr.e3@gmail.com"
] | nrc1mr.e3@gmail.com |
c646ec7334171fd410dd729a3e04a9ba1fbf9b01 | 6e47be4e22ab76a8ddd7e18c89f5dc4f18539744 | /venv/openshift/lib/python3.6/site-packages/kubernetes/client/models/v1_deployment_strategy.py | 914f21295bee614f7a9f8c699925d0a1e9f1b171 | [] | no_license | georgi-mobi/redhat_ocp4.5_training | 21236bb19d04a469c95a8f135188d3d1ae473764 | 2ccaa90e40dbbf8a18f668a5a7b0d5bfaa1db225 | refs/heads/main | 2023-03-30T10:47:08.687074 | 2021-04-01T05:25:49 | 2021-04-01T05:25:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,227 | py | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.11
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1DeploymentStrategy(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_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.
"""
swagger_types = {
'rolling_update': 'V1RollingUpdateDeployment',
'type': 'str'
}
attribute_map = {
'rolling_update': 'rollingUpdate',
'type': 'type'
}
def __init__(self, rolling_update=None, type=None):
"""
V1DeploymentStrategy - a model defined in Swagger
"""
self._rolling_update = None
self._type = None
self.discriminator = None
if rolling_update is not None:
self.rolling_update = rolling_update
if type is not None:
self.type = type
@property
def rolling_update(self):
"""
Gets the rolling_update of this V1DeploymentStrategy.
Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.
:return: The rolling_update of this V1DeploymentStrategy.
:rtype: V1RollingUpdateDeployment
"""
return self._rolling_update
@rolling_update.setter
def rolling_update(self, rolling_update):
"""
Sets the rolling_update of this V1DeploymentStrategy.
Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.
:param rolling_update: The rolling_update of this V1DeploymentStrategy.
:type: V1RollingUpdateDeployment
"""
self._rolling_update = rolling_update
@property
def type(self):
"""
Gets the type of this V1DeploymentStrategy.
Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.
:return: The type of this V1DeploymentStrategy.
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""
Sets the type of this V1DeploymentStrategy.
Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.
:param type: The type of this V1DeploymentStrategy.
:type: str
"""
self._type = type
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, V1DeploymentStrategy):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
| [
"student@workstation.lab.example.com"
] | student@workstation.lab.example.com |
593fbc10327e9977a98d96bf7e5de12ffa810320 | f3cc89bba5c5e019f64e440b487ae93e393b6428 | /python_data/02_OpenCV/07_rotation.py | 630e7211606967f3a7346be9bf186bd37c82660c | [] | no_license | jjoooyi/python | c7175e44ed9b489a1e065fef38b1268cdd53b7f4 | 04ca28619f644c65332d369057db925a1145745d | refs/heads/master | 2023-04-05T06:32:26.432904 | 2021-04-15T03:19:06 | 2021-04-15T03:19:06 | 345,834,947 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 463 | py | import cv2
# 이미지 회전
# cv2.getRotationMatrix2D(center, angle, scale) | 이미지 회전을 위한 변환 행렬을 생성합니다.
# center: 회전 중심, angle: 회전 각도, scale: Scale Factor
image = cv2.imread('python_data/test.png')
# 행과 열 정보만 저장
height, width = image.shape[:2]
M = cv2.getRotationMatrix2D((width/2, height/2), 90, 0.5)
dst = cv2.warpAffine(image, M, (width, height))
cv2.imshow('Image', dst)
cv2.waitKey(0)
| [
"jjoooyi@gmail.com"
] | jjoooyi@gmail.com |
94287449e8ab64200850be071d6dc64e9a9e131d | d93fe0484fc3b32c8fd9b33cc66cfd636a148ec4 | /AtCoder/ABC-C/028probC.py | bf11c79a82fcb370f2bd821b4ee7cf1d4117a028 | [] | no_license | wattaihei/ProgrammingContest | 0d34f42f60fa6693e04c933c978527ffaddceda7 | c26de8d42790651aaee56df0956e0b206d1cceb4 | refs/heads/master | 2023-04-22T19:43:43.394907 | 2021-05-02T13:05:21 | 2021-05-02T13:05:21 | 264,400,706 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 67 | py | A, B, C, D, E = map(int, input().split())
print(max(A+D+E, B+C+E)) | [
"wattaihei.rapyuta@gmail.com"
] | wattaihei.rapyuta@gmail.com |
52cb670aad936596ce9262ea89671c5c1df9a8ac | bbcea582fb8e3bbe60ac06ee1fb5fe4da87faa5a | /experts/half_cheeta.py | f516baa699cc0e1e27add786d407bd1145543585 | [
"MIT"
] | permissive | cheng-xie/dpgfddagger | 31ad5019aebc0689371c4257c5aee603f853b3c9 | 5264d5b9e0ab76fc9620da63bcfd78b25dadcbec | refs/heads/master | 2020-12-30T11:02:32.243197 | 2017-08-22T01:18:51 | 2017-08-22T01:18:51 | 98,839,894 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 111,267 | py | import gym, roboschool
import numpy as np
from OpenGL import GL
def relu(x):
return np.maximum(x, 0)
class SmallReactivePolicy:
"Simple multi-layer perceptron policy, no internal state"
def __init__(self, observation_space, action_space):
assert weights_dense1_w.shape == (observation_space.shape[0], 128)
assert weights_dense2_w.shape == (128, 64)
assert weights_final_w.shape == (64, action_space.shape[0])
def get_next_action(self, ob):
x = ob
x = relu(np.dot(x, weights_dense1_w) + weights_dense1_b)
x = relu(np.dot(x, weights_dense2_w) + weights_dense2_b)
x = np.dot(x, weights_final_w) + weights_final_b
return x
def demo_run():
env = gym.make("RoboschoolHalfCheetah-v1")
pi = SmallReactivePolicy(env.observation_space, env.action_space)
while 1:
frame = 0
score = 0
restart_delay = 0
obs = env.reset()
while 1:
a = pi.act(obs)
obs, r, done, _ = env.step(a)
score += r
frame += 1
still_open = env.render("human")
if still_open==False:
return
if not done: continue
if restart_delay==0:
print("score=%0.2f in %i frames" % (score, frame))
restart_delay = 60*2 # 2 sec at 60 fps
else:
restart_delay -= 1
if restart_delay==0: break
weights_dense1_w = np.array([
[ -0.4105, +0.5540, +0.2791, +0.4953, -0.0309, +0.8480, +0.1630, +0.0630, +0.7107, +0.0597, +0.2675, -0.1931, -0.2436, +0.2909, +0.3563, +0.4564, -0.0445, -0.2228, +0.7005, +0.8368, +0.3631, +0.7365, +0.2453, +0.4687, +0.4819, +0.4940, +0.5096, +0.5929, +0.5504, +0.2265, +0.4118, +0.5993, +0.2402, -0.5087, -0.0756, +0.7520, -0.0086, -0.0648, +0.0564, -0.0812, -0.0093, +0.8482, +0.7333, +0.4401, -0.1273, -0.2974, +0.1284, -0.4948, +0.1120, +0.7938, +0.1297, +1.0807, +0.2480, +0.2444, +0.4258, +0.1515, -0.0126, +0.3098, -0.2786, +0.4913, +0.3065, +0.3356, +0.6884, +0.3117, +0.3163, +0.4234, +0.1172, +0.8810, +0.3574, -0.3993, -0.5597, +0.2233, +0.8058, +0.3391, -0.1113, +0.1884, +0.1324, +0.0503, +0.1807, +0.0441, -0.2065, +0.1978, +0.0852, -0.3531, +0.2180, +0.7946, -0.0318, +0.0650, -0.3174, -0.1715, -0.0486, +0.2131, -0.3901, +0.1995, +0.8593, +0.1786, +0.3595, +0.7852, +0.3491, -0.4206, +0.6117, -0.1991, +0.1876, -0.3114, -0.2007, -0.2738, -0.0388, +0.0465, +0.2726, -0.5321, +0.4720, -0.0555, +0.3415, +0.1447, -0.1132, -0.2958, -0.6729, -0.5003, -0.4960, -0.2600, -0.4158, -0.4476, -0.8244, -0.0574, +0.2194, +0.0541, -0.3526, -0.1131],
[ -0.2662, +0.1763, +0.0520, +0.3624, +0.0564, +0.2756, +0.0743, +0.0155, +0.1861, -0.5311, +0.2181, -0.3643, +0.1433, +0.1801, -0.1781, -0.3576, -0.2487, +0.0588, +0.3906, -0.3994, +0.1343, +0.2701, +0.1613, +0.1962, -0.0277, +0.0303, +0.0845, -0.1033, -0.1092, -0.1026, -0.2261, +0.3324, +0.1881, -0.2780, -0.0865, -0.2131, -0.1238, -0.1727, +0.1086, +0.1383, +0.1794, +0.0677, -0.0582, -0.0758, +0.0834, +0.0847, +0.0945, +0.1888, -0.0696, +0.0111, -0.0028, +0.0439, -0.3847, -0.1564, -0.2226, +0.0002, +0.0926, -0.2819, -0.0868, +0.2233, +0.0738, +0.1671, -0.0326, +0.3784, -0.0117, +0.0836, +0.0285, +0.0376, +0.0157, +0.1297, +0.0556, -0.0533, -0.0103, +0.0740, -0.1825, -0.2399, -0.0609, -0.0030, +0.1811, -0.2784, -0.2249, +0.3637, +0.1895, +0.3102, -0.0767, +0.1143, -0.0840, +0.2981, -0.3040, +0.0135, +0.2495, +0.0036, -0.1493, -0.1144, -0.0006, +0.1195, +0.0961, -0.4227, -0.3022, +0.2102, +0.2024, -0.2111, +0.1507, +0.2948, -0.1822, +0.2263, -0.3213, +0.0380, -0.1188, +0.1237, +0.0731, +0.0044, -0.1637, -0.3173, +0.0895, -0.0130, +0.0703, -0.2186, +0.1401, +0.1191, +0.0225, -0.3208, -0.0578, -0.3113, +0.1041, -0.1957, -0.3054, -0.0797],
[ +0.3485, -0.3161, -0.4092, +0.1190, -0.5706, -0.3627, +0.0576, -0.1068, +0.1367, +0.1686, +0.0284, -0.1694, -0.0496, -0.1647, +0.0111, -0.1897, -0.4613, -0.5996, -0.0601, -0.1417, -0.0236, -0.0898, +0.1239, -0.2693, -0.1709, +0.3592, -0.1284, -0.0376, -0.1308, -0.1832, -0.0538, -0.0467, -0.1181, -0.0994, -0.3281, +0.0527, -0.4579, -0.1062, -0.1058, -0.4459, -0.0901, -0.0246, -0.1125, +0.1228, -0.3428, -0.3385, +0.0366, -0.0988, +0.1345, +0.0299, +0.2921, -0.1347, +0.1688, -0.1350, -0.0888, +0.0734, -0.0936, -0.2695, +0.0154, +0.0237, -0.1334, -0.3247, -0.1856, -0.0449, -0.0772, +0.0176, -0.0856, -0.1746, -0.1575, -0.2365, -0.0741, -0.1638, +0.0864, -0.0243, -0.0472, +0.0423, -0.2962, -0.2523, -0.1430, +0.1470, -0.1122, -0.1843, -0.1437, -0.1895, +0.1110, -0.2572, -0.3307, -0.2597, -0.4706, -0.2441, -0.2988, -0.5409, -0.1696, +0.0810, -0.2336, -0.0925, +0.4226, +0.1162, -0.3211, -0.2118, -0.3100, -0.1384, +0.1625, +0.0005, -0.1936, +0.2836, +0.1660, -0.2154, +0.1341, -0.2413, -0.1203, -0.3427, +0.0863, +0.1393, -0.3580, +0.1443, -0.2158, -0.4703, -0.2687, -0.0573, +0.1099, -0.2551, -0.0506, -0.3351, -0.2325, -0.0119, -0.0907, -0.0628],
[ +0.0565, +0.2158, +0.1461, +0.1045, -0.3548, -0.2816, -0.0124, -0.0931, +0.1249, +0.0093, -0.3325, -0.1646, +0.3022, -0.0509, -0.1403, +0.3703, +0.2642, +0.0835, +0.1347, +0.1734, -0.0112, +0.3162, -0.0076, +0.1258, -0.2059, +0.2387, +0.0775, -0.1653, -0.3899, -0.1205, -0.2263, +0.2800, -0.1979, +0.1708, +0.0505, -0.0998, +0.1838, -0.1314, -0.1932, -0.1897, -0.3157, -0.0113, -0.3488, +0.1534, -0.3546, -0.1098, +0.0652, -0.1327, -0.0131, +0.3698, -0.0927, +0.1735, -0.4869, +0.1768, -0.0187, -0.1069, -0.2118, -0.2557, -0.1380, -0.0579, -0.2147, +0.3389, -0.1801, +0.1954, -0.2856, +0.0825, +0.1846, -0.2102, +0.4063, -0.0422, +0.1645, -0.2313, -0.2017, -0.2554, +0.1597, -0.1198, +0.4493, +0.1135, +0.1556, -0.0380, +0.0527, -0.0505, -0.5094, -0.4410, +0.2543, +0.2891, -0.0031, -0.0863, +0.2982, +0.1069, -0.4814, +0.0295, -0.0547, +0.0518, -0.4326, -0.0295, -0.3795, +0.0399, +0.0363, +0.1623, +0.4509, +0.2852, -0.4404, +0.0109, -0.0394, +0.0092, -0.1684, +0.4728, -0.1317, +0.0575, -0.3862, -0.1313, +0.0676, +0.1321, -0.2816, -0.0500, -0.0027, +0.0906, +0.0297, -0.1476, +0.0337, +0.0911, -0.1591, +0.2816, -0.0435, -0.3437, -0.0732, -0.4545],
[ -0.2090, -0.1890, -0.4459, +0.0942, +0.2823, -0.0085, -0.1576, -0.5515, +0.1211, -0.0689, +0.2807, +0.1457, +0.2009, -0.2739, +0.0296, -0.0511, -0.1048, -0.1275, +0.2358, +0.3103, +0.2239, +0.2028, -0.0858, +0.0520, -0.1453, +0.2013, -0.2131, -0.0596, -0.0469, -0.0934, -0.2082, +0.2071, -0.5051, +0.1719, -0.1380, -0.2781, -0.0598, -0.1636, +0.2784, -0.0144, +0.0655, -0.1932, +0.1421, -0.0840, -0.0277, -0.2310, -0.0509, +0.0870, +0.0721, -0.1785, +0.1514, -0.1485, -0.1158, +0.1124, -0.1155, -0.4105, -0.1765, +0.0103, -0.1695, +0.0521, -0.1132, -0.1209, -0.1313, -0.0419, +0.1828, -0.1026, +0.0564, +0.0095, -0.0414, +0.1264, +0.1588, -0.2200, +0.1928, -0.2098, +0.4256, -0.3453, -0.3882, -0.2238, -0.1347, +0.2160, +0.4278, -0.2666, -0.1046, +0.2501, +0.0238, +0.2802, -0.3955, +0.1452, +0.1773, -0.0727, -0.3603, -0.2480, -0.0412, +0.2462, +0.2148, -0.2819, +0.0982, -0.0102, +0.0310, +0.0147, +0.0597, +0.0514, -0.0032, +0.1320, -0.0606, -0.0637, +0.0398, +0.1367, +0.0646, -0.0435, +0.0527, +0.1258, -0.2075, -0.1816, -0.2129, -0.1253, +0.2394, -0.2325, -0.1115, -0.4115, -0.1196, -0.2855, +0.3805, -0.2741, -0.0278, -0.3461, +0.0139, -0.0499],
[ -0.6025, +0.2692, +0.5276, +0.3615, -0.3196, +0.3828, +0.1312, -1.1323, -0.0073, -0.1227, -0.0831, +0.0605, -1.0515, -0.1917, -0.2510, +0.2964, -1.1074, -0.1708, -0.4475, -0.1189, +0.3345, +0.5101, +0.4628, +1.1872, +0.5829, +0.0234, +0.0306, +0.0021, -0.1827, -0.0257, -0.2993, +0.0083, -0.9032, -0.0311, +0.0045, +0.6173, +0.3095, -0.1490, -0.2561, +0.2011, -0.1550, -0.1936, +0.0729, +0.7613, -0.9194, +0.1954, +0.0306, +0.2292, +0.1529, -0.1161, -0.0182, -0.2625, -0.3142, -0.9182, +0.2761, +0.3656, +0.3537, +1.0318, -0.4273, +0.1703, -0.2378, -0.4640, +0.6184, +0.3686, -0.3043, -0.4850, -0.2155, -0.6656, +0.1921, -0.2552, -0.8096, +0.8593, -0.3583, -0.0332, -0.5619, +0.2977, -0.3425, -0.7839, -0.4299, -0.2358, +0.0526, -0.0752, -0.6535, +0.0501, -0.4043, +0.8261, -0.4269, -0.1165, +0.3480, -0.2337, -0.3269, -0.2775, +0.7307, +0.5863, -0.1005, -0.3421, +0.1591, +0.4530, -0.1228, -1.0896, +0.6218, -0.0610, -0.1239, -1.5883, -0.1711, -0.4331, -0.3553, +0.0773, +0.3669, -0.5690, +0.7117, -0.2021, -0.1426, -0.1125, +0.0364, +0.2397, -0.1739, -0.3131, -0.9135, -0.7713, -0.0638, -0.3219, +0.0353, +0.3407, -0.0035, -0.1492, -0.1118, -0.4841],
[ -0.0175, -0.3710, +0.0894, +0.2056, -0.2250, +0.0982, +0.0039, -0.2128, -0.0479, +0.3049, +0.2228, -0.1747, -0.0936, +0.1146, +0.1377, +0.0127, +0.0014, +0.1374, +0.1557, -0.1890, -0.2396, +0.2248, +0.1710, -0.2916, +0.4568, -0.0645, -0.0760, -0.2067, -0.3900, +0.0276, -0.3171, -0.0148, +0.2019, -0.1335, -0.0731, -0.3224, +0.0859, +0.2299, +0.0602, +0.0499, -0.2686, +0.1028, +0.1204, +0.0321, +0.0636, -0.1350, -0.1789, -0.0529, -0.2255, +0.1867, +0.1258, +0.1392, -0.2657, +0.1478, +0.1961, -0.0687, +0.1878, +0.2016, -0.2413, +0.0050, -0.0666, -0.0226, -0.0185, +0.4750, -0.1661, +0.0637, -0.2668, +0.1875, +0.0032, +0.1176, +0.1844, -0.1665, -0.1806, -0.3208, +0.0606, -0.0122, +0.2792, +0.1867, +0.1424, +0.2775, +0.1074, -0.2996, +0.0562, -0.1864, +0.1985, +0.1356, -0.3013, -0.0824, -0.1534, -0.0795, -0.0086, -0.0490, -0.0861, -0.0986, +0.3499, -0.0630, +0.0028, -0.1540, +0.0377, -0.1057, +0.1303, +0.1379, -0.1257, -0.2578, -0.0744, -0.1304, +0.0411, -0.1635, +0.0535, +0.0271, +0.1674, +0.1309, -0.0397, -0.1127, -0.2217, +0.0548, -0.5178, +0.1170, +0.4857, +0.1134, +0.0598, +0.1467, +0.1405, -0.1152, +0.1825, -0.0382, +0.1325, +0.2708],
[ -0.1185, -1.2480, -0.6130, -0.9105, +0.1073, -0.7702, -1.2908, +0.6513, -0.3928, -0.7365, -0.2977, +0.7845, +0.3186, +0.2207, -1.1391, -0.9353, +1.1582, -0.7291, +0.2077, +0.2808, -0.5894, +0.4805, -0.2316, -0.8861, -0.4102, -1.1704, +0.9183, -0.0637, -0.1935, -0.2971, -0.6144, +0.6113, +0.1596, -0.2931, +0.3199, -0.2938, -0.2098, +0.3615, -0.3433, +0.0334, +0.2148, -1.9070, -0.0655, -0.5875, +0.5659, +0.0436, +0.5074, +0.5399, -0.2164, -0.7224, -0.1556, -1.3397, +0.5629, +0.1272, -0.1749, -1.2117, +0.9305, -0.9436, -0.9450, -0.4745, -0.9840, -0.5153, -0.1703, -0.5252, -0.0291, +0.3351, +1.0137, -1.4468, +0.1594, +0.4054, +0.9667, -0.3279, -1.2628, -0.6361, -0.1322, -0.4219, -0.8181, +0.1316, +0.3924, +0.4478, +0.5855, -0.0547, -1.4541, +0.1199, -0.2794, -0.9176, +0.8841, +0.2706, -0.1612, +0.7667, -0.3909, -1.6514, +0.1562, -0.3166, -0.2654, +1.0692, -0.1898, -1.3619, +0.0357, +0.6267, -0.0957, -0.5473, -0.9002, +0.4248, +0.7671, +0.6034, +0.1176, +0.4126, -0.4076, +0.5846, -0.4275, +0.0146, +0.5074, +0.4825, +0.3414, -0.0289, +0.5663, +0.9628, +0.9791, -0.1043, +1.2530, +1.3600, +1.6041, +0.4200, -0.2415, -0.4470, +0.6965, +0.2395],
[ +1.2479, -0.0619, -0.4174, -0.2800, +0.2902, +0.2310, +0.0858, -0.0805, +0.2556, +0.8018, -0.1018, +0.9876, +0.2342, +0.3219, +0.3031, -0.1343, +0.0737, +0.2219, -0.6479, -0.4475, +0.3711, +0.4780, -0.8735, +0.6208, -0.3031, +0.1480, +0.4935, +0.9053, +0.0797, -0.3932, +0.0853, -0.4709, -0.6192, +1.1604, -0.0924, -0.2548, +0.5836, +0.0325, -0.2435, -0.1506, -0.1754, -0.2248, -0.8059, -0.1997, +0.7772, +0.1456, -0.1463, -0.0360, -0.0240, -0.1852, -0.1289, +0.9165, -0.2434, +0.7580, +0.3838, -0.0338, +0.1199, -0.1700, -0.4038, -0.1863, +0.0925, -0.2396, +0.4659, +0.1810, +0.6990, +0.2880, +0.0641, -0.3991, +0.6049, -0.5948, -0.1894, -0.7874, -0.6910, +0.0824, +0.5111, -0.2513, +0.4632, +0.7014, -0.6793, +0.0562, -0.0800, +0.2665, -0.0270, +0.1830, +0.8184, +0.5293, -0.3352, +0.1144, +0.7672, -0.0924, +0.2099, -0.0854, -0.1534, +0.2607, -0.1140, -0.1163, +0.0403, +0.2623, +0.4065, +0.9303, +0.4008, -0.1773, +0.0368, +0.4014, -0.6941, +0.0333, +0.3245, +0.0262, +0.7663, +0.3834, +0.4088, +0.0289, -0.6102, +0.5717, -0.0787, +0.2367, +0.2061, -0.3039, -0.0797, +0.0814, +1.2009, +0.4369, +0.0788, +0.2358, +0.9926, +0.5428, -0.5656, -0.2758],
[ +0.3487, +0.2086, -0.0813, +0.4360, -0.2904, +0.4395, +0.1773, +0.0481, +0.4503, +0.4991, +0.3741, +0.1866, -0.2241, -0.3511, +0.2302, +0.5140, +0.5208, +0.5968, +0.5189, +0.2814, +0.3372, +0.3461, +0.0298, +0.0069, -0.1004, +0.5782, -0.2609, +0.1167, -0.5090, -0.3220, +0.0509, +0.4076, -0.1667, +0.2021, -0.0495, +0.2189, -0.0504, -0.3792, -0.4321, +0.0364, -0.0175, -0.0359, +0.0965, +0.3641, -0.2778, -0.1170, +0.7745, -0.2177, +0.1121, +0.0240, +0.6502, +0.1845, -0.0903, +0.3065, +0.0884, +0.4046, -0.2021, -0.3310, +0.0056, -0.2555, +0.0209, +0.5952, -0.1765, +0.0503, -0.0449, +0.2059, +0.2699, -0.2488, -0.6611, +0.2942, -0.4384, +0.3329, +0.4411, -0.1499, -0.0820, +0.5042, +0.2737, -0.3949, +0.4931, +0.0065, -0.8717, -0.4590, +0.1508, +0.3686, +0.1564, -0.2887, -0.3002, -0.0485, +0.0003, -0.4201, -0.0104, +0.2674, +0.1690, +0.1299, -0.0258, -0.0109, +0.6633, +0.3255, -0.0330, +0.4770, +0.3560, +0.1506, +0.3608, +0.4205, +0.0090, -0.3770, +0.2320, -0.2200, +0.0256, -0.2081, -0.1292, +0.0661, -0.3286, +0.1211, +0.1542, +0.5790, +0.0675, -0.1831, -0.0903, +0.0403, +0.1506, -0.2725, +0.1505, -0.3582, -0.2939, -0.3307, -0.2906, -0.1859],
[ +0.6120, +0.3881, -0.2144, +0.0539, +0.2717, +0.0574, -0.6547, -1.1043, -0.4978, +1.0026, -0.2662, -0.3964, -0.4590, +0.5876, +0.3651, +0.2121, -0.3029, +0.4225, -0.2654, -0.0867, -0.0286, +0.4754, +0.5950, -0.0923, +0.5628, -0.1033, -0.1225, -0.5554, -0.9027, -0.3767, -0.7881, -0.0124, -0.6633, -0.7063, +0.4806, -1.2205, -0.1279, +0.0321, +0.3928, +0.0134, +0.3143, -0.5378, +0.0553, +0.1611, +0.0254, -0.4512, +0.7660, +0.4550, +0.6917, +0.0186, +0.1970, -0.4484, +0.4214, +0.5640, +0.7182, -0.6329, +0.3644, -0.5340, -0.0268, -0.3028, +0.4847, -0.1190, -0.3030, +0.4755, +0.1916, -0.1579, -0.1899, -0.1830, +0.2239, -0.8405, -0.0194, -0.4524, -0.6924, +1.0233, -0.1682, -1.0005, -0.1989, +0.0655, -0.5738, +0.3489, -0.2032, -0.5767, +0.2677, -0.2104, +0.9164, -0.6995, +0.3138, +0.2631, +0.4646, -0.7949, -0.4088, +0.0390, +0.5322, +0.8076, +0.3327, -0.8003, -0.4473, +0.2003, -0.0771, +0.9627, -0.5091, +0.5703, -0.3930, +0.3132, +0.9709, +0.2298, +0.2046, -0.4682, -0.4135, +0.8331, -0.0837, -0.2126, -0.2461, -0.6451, -0.3118, +0.1340, +0.3047, -0.3990, +0.8511, -0.0305, +0.7664, +0.2561, +0.5513, +0.2083, -0.7912, -0.5125, -0.5167, -0.5089],
[ +0.2836, +0.6191, -0.2299, +0.4317, +0.1775, -0.6181, +0.0461, +0.0362, +0.0559, +0.7882, -0.1351, -0.3722, +0.1090, +0.0281, +0.1148, +0.7799, -0.2107, -0.3900, -0.2063, -0.3643, +0.7287, -0.2938, +0.1283, -0.1046, +0.0992, -0.1031, +0.6297, -0.8027, -0.0918, +0.2503, +0.5527, +0.3296, -0.0083, -0.1686, +0.0065, +0.2643, +0.1768, -0.4890, +0.0692, +0.5517, +0.6225, -0.0423, -1.0015, -0.5841, -0.2217, -0.6242, -0.1942, -0.3841, +0.7571, +0.4939, -0.2331, +0.1612, +0.0843, +1.2429, -0.2966, -0.5344, +1.0299, -0.7019, -0.1317, -0.0856, +0.2293, -0.0003, -0.0487, -0.5326, +0.0300, +0.5683, +0.2054, -0.3269, +0.6114, -0.5650, -0.1812, -0.8703, +0.0364, +0.6392, -0.7844, +0.0227, +0.6228, +0.5272, -0.8685, -0.4089, -0.3416, -0.1562, +0.1535, -0.0063, +0.6183, -0.5915, -0.1640, -0.2188, +0.4079, -0.3470, +0.5118, +0.4866, -0.9074, -0.0650, +0.3942, -0.1759, -0.3695, +0.1913, +0.9200, +0.2702, -0.2663, +0.1217, -0.1575, -0.2490, +0.1515, -0.7135, +0.4985, +0.1606, -0.1133, -0.2688, -0.4154, -0.5524, -0.0633, -0.0389, +0.4926, -0.0719, -0.3427, -0.6053, -0.1829, -0.5910, +0.1137, +0.0312, +0.4532, +0.1142, +0.3834, -0.0407, -0.5945, -0.6180],
[ +0.0362, -0.5185, -0.3235, +0.0613, +0.3283, +0.6853, -0.3136, +0.4028, +0.2535, +0.0223, +0.1985, -0.9784, +0.8819, -0.4328, -0.1815, +0.2478, -0.1824, -0.0182, +0.3654, -0.2296, +0.3019, -0.1017, +0.5535, +0.2589, -0.4000, +0.0137, -0.4569, +0.4085, +0.3198, +0.1833, -0.2268, +0.1447, +0.3493, +0.4606, -0.2277, -0.0773, -0.6224, +0.8234, +0.0221, +0.5623, -0.1428, -0.5706, +0.5371, +0.8732, -0.5540, -0.0395, +0.8031, +0.3599, +0.5903, +0.0713, -0.1844, +0.5461, +0.1745, +0.1545, -0.2652, -0.0803, +0.2160, -0.4186, -0.3271, +1.0229, -0.0675, +0.0257, +0.3415, +0.1843, -0.4467, +0.0753, +0.3914, -0.0426, +0.2589, -0.2688, -0.2011, -0.0360, -0.2472, -0.4691, +0.1115, -0.3416, +0.1560, -0.1638, -0.3131, -0.3056, +0.1102, +0.0386, -0.0213, +0.0334, +0.5400, +0.3385, +0.0520, +0.2917, +0.0586, +0.3761, -0.2422, -0.4576, -0.0317, +0.2312, +0.7176, +0.2603, -0.1864, -0.3297, -0.3581, +0.3024, +0.4191, +0.1382, -0.4671, -0.1097, +0.3002, +0.1556, +0.3214, +0.0859, +0.2674, -0.0762, +0.1793, +0.8109, +0.5113, +0.0960, +0.2222, +0.2567, -0.0165, +0.8895, -0.0689, -0.1649, +0.5046, +0.1555, +0.2201, -0.2468, -0.5657, -0.5523, -0.7054, -0.2129],
[ +0.0779, -0.1795, -0.3084, +0.0991, +0.0959, -0.0223, +0.3783, +0.3527, -0.2872, +0.3394, +0.0425, -0.0484, -0.2041, +0.9751, -0.2537, +0.0812, +0.2257, +0.4729, +0.4647, +0.4171, +0.0146, -0.1489, +0.5499, +0.4513, -0.2661, -0.8428, +0.3146, -0.1790, +0.0097, -0.1133, +0.0693, +0.3234, +0.0583, -0.6285, -0.7520, -0.2485, -0.5776, +0.6696, -0.2599, -0.0951, -0.2328, -0.5490, +0.5175, +0.0767, -0.3109, -0.2104, +0.1518, -0.5617, +0.0181, +0.2775, +0.0589, +0.3021, -0.8439, -0.0653, -0.4131, -0.4757, +0.6912, -0.0174, -0.3354, +0.5238, -0.2113, +0.0943, -0.1804, +0.0211, +0.5478, +0.5479, +0.3961, +0.0754, +0.0795, -0.2051, -0.1059, -0.2414, +0.0145, +0.6187, +0.1991, +0.1538, -0.5956, -0.0687, -0.1066, +0.5816, +0.3722, -0.3560, +0.4422, +0.4901, +0.5202, -0.1284, +0.6292, +0.8110, +0.5204, -0.2698, -0.1241, -0.0359, -0.0064, -0.3268, +0.7780, -0.3028, +0.1004, -0.0382, -0.4620, +0.2837, -0.8406, -0.2417, +0.2056, +0.0777, -0.2286, +0.0642, +0.5493, -0.8877, -0.1941, +0.3304, +0.4645, -0.4799, -0.2487, +0.2221, +0.7077, +0.2539, -0.1791, +0.2926, +0.1322, +0.0905, +0.1544, -0.2086, +0.3299, -0.0308, -0.0567, +0.1242, -0.0968, +0.4553],
[ -0.2603, -0.4800, +0.0541, -0.8000, -0.6535, -0.8949, -0.3607, -0.0667, -0.7336, -0.3965, +0.3150, +0.1505, -0.3550, -0.1260, +0.3011, -0.0821, -0.3796, -0.1918, -0.3090, +0.0550, +0.1061, -0.3667, -0.8571, -0.4193, -0.4680, -0.3205, +0.2565, -0.3090, -0.2638, +0.1026, -0.1909, -0.5068, +0.0748, -0.4648, +0.0748, -0.2874, +0.2573, -0.1646, -0.1574, +0.1782, -0.2502, +0.1568, -0.1522, -0.5577, +0.5309, +0.1850, -0.1607, +0.2624, +0.0171, +0.2342, -0.8137, +0.2716, -0.1085, -0.4303, -0.5537, -0.0020, -0.0393, -0.3333, +0.2081, -0.0905, -0.6573, +0.1222, -0.4209, -0.3416, -0.2223, +0.5376, -0.0664, +0.2956, +0.4846, +0.5470, +0.3633, -0.2415, -0.6977, -0.4417, -0.1011, -0.4229, -0.1614, -0.0722, -0.4239, -0.2685, +0.4363, +0.1485, -0.0346, -0.1507, +0.0344, -0.0586, -0.1486, +0.1647, -0.0353, +0.3965, +0.1495, -0.1808, -0.3812, -0.3466, -0.6642, -0.1044, -0.6627, -0.3414, -0.3478, -0.0244, -0.0663, -0.2007, -0.3840, -0.6573, -0.4302, +0.0623, +0.0473, -0.1558, -0.5837, +0.1068, -0.1332, -0.0385, -0.0638, -0.7497, -0.1423, -0.3235, -0.2541, -0.2405, +0.3238, -0.1456, +0.2076, +0.1714, +0.0112, +0.3124, +0.0782, +0.1887, +0.3277, +0.1156],
[ -1.0948, -0.2236, +0.1540, -0.6062, -0.2097, -0.2825, -0.4756, +0.3731, -0.5436, -0.3209, -0.3609, -0.1703, -0.6188, +0.0140, -0.0252, +0.5627, +0.0186, +0.1253, -0.0046, +0.0767, -0.2195, +0.3782, -0.1052, -0.1369, +0.3583, -0.5566, +0.6542, -0.3200, +0.2563, -0.1301, +0.0185, -0.8119, +0.5848, +0.4946, -0.0112, +0.1033, +0.1308, -0.1700, +0.1149, +0.3101, -0.3001, +0.2433, +0.2101, +0.1298, -0.1548, +0.1310, -0.2388, +0.3923, +0.9332, +0.5030, -1.0263, -0.1072, +0.1241, -0.0134, -0.0806, -0.3525, +0.5211, -0.0752, +0.0334, +0.2871, -0.4669, -0.2720, -0.0067, +0.1326, -0.4609, -0.0674, -0.6579, -0.2538, +0.2333, +0.4456, +0.5642, -0.1694, -0.3706, +0.5684, -0.7867, -0.4995, +0.3289, -0.6711, -0.1191, -0.8581, +0.3775, +0.8927, +0.5052, -0.0896, +0.0121, +0.6358, +0.1183, +0.5200, +0.7512, +0.0846, -0.1086, -0.0426, -0.0155, +0.6603, +0.0812, +0.4987, +0.0256, +0.0992, +0.2730, -0.0697, +0.2773, -0.7570, -0.7726, -0.3871, -0.3158, -0.3692, -0.7297, -0.0744, -0.5920, +0.6132, -0.0072, +0.1400, -0.1782, -0.0227, +0.1123, -0.6036, -0.6343, +0.5520, +0.3165, -0.4080, -0.0338, -0.1839, -0.0071, +0.3603, -0.3050, +0.4097, -0.5939, -0.1245],
[ -0.3346, -0.2795, +0.2751, +0.2150, +0.4031, +0.5422, +0.3587, +0.5206, -0.6544, +0.1672, -1.0438, -0.3010, +0.6246, +1.1339, -0.6914, -0.1198, +0.0050, -0.8139, -0.1150, +0.9000, -1.1849, +1.0507, -0.2149, -0.3482, -0.7118, +0.3377, +0.2528, +0.2764, +0.2596, -0.4997, -0.8768, +0.4370, -0.0810, +0.1831, -0.0584, +0.0562, +0.4426, -0.4548, -0.6110, -0.3985, -0.0168, -0.5126, +0.5279, -0.4445, +0.0281, +0.3755, -0.0337, -0.7288, -0.4249, +0.6200, -0.1673, -0.4617, +0.0127, -0.1385, +0.6653, -0.1985, +0.4186, -0.5372, -0.5204, +0.8371, +0.2907, -0.7418, +0.0020, +0.4483, +0.1869, +0.6499, +0.1529, +0.4740, +0.6753, +0.6005, +0.7086, -0.3005, +0.5440, +0.3387, +0.2046, +0.4181, -0.8759, -0.7487, -0.1262, -0.0293, +0.8712, +0.0119, -0.7947, -1.2465, -0.0061, -0.0503, -0.2992, +0.5275, -0.3151, +0.1889, -1.5430, +0.5531, +0.2559, -0.2591, -0.2807, -0.1324, -0.7027, -0.4375, +0.1984, -0.3944, -0.0467, -0.3111, -0.6493, -0.2939, -0.0617, +0.2605, -0.9876, -0.0857, -0.6928, +0.7228, -1.2047, +0.3026, -0.7448, +0.4988, -0.3507, -0.7106, -0.7583, +0.3245, +0.2599, -1.4422, +0.4198, -0.6388, -1.3088, +0.9680, -0.0616, -0.4120, -0.3508, +0.1672],
[ -0.5261, +0.4924, +0.1685, -0.2603, +0.3052, +0.3751, -0.8492, -0.1073, +0.1541, +0.1367, +0.1658, +0.0405, -0.0968, -0.0074, -0.3535, -0.4133, +0.0255, -0.6547, -0.0838, +0.2996, +0.1273, -0.1657, +0.0394, +0.4691, +0.0353, -0.2699, +0.1696, +0.5037, +0.0277, -0.1267, -0.3741, +0.2501, +0.1612, -0.3687, -0.0763, -0.2902, +0.3456, +0.1048, +0.0277, +0.1918, -0.6208, +0.1135, -0.1049, -0.0283, +0.0202, +0.0171, +0.0822, -0.2369, +0.1969, +0.5290, -0.0731, +0.4711, -0.2303, -0.0833, -0.3602, -0.1438, -0.0070, -0.5158, -0.3721, +0.0134, +0.4545, -0.0207, +0.2113, -0.0665, -0.2343, +0.2490, -0.2058, +0.1182, +0.0765, +0.3709, +0.3816, -0.1490, -0.1526, -0.0174, +0.6291, +0.4946, -0.3356, -0.0425, -0.0716, -0.6482, +0.4502, +0.0332, -0.2189, -0.6447, +0.1329, +0.4471, -0.0323, -0.0798, -0.1390, +0.1446, -0.2377, +0.4462, -0.2870, -0.2893, -0.0998, +0.1104, -0.1755, +0.2786, +0.3976, -0.6894, -0.4004, -0.3018, -0.2645, +0.0620, +0.0661, +0.1230, -0.3739, +0.0862, -0.2077, -0.1822, +0.0729, +0.0871, -0.2029, +0.0181, +0.3299, -0.5234, +0.0010, +0.1996, +0.0403, -0.6255, +0.1214, +0.0402, -0.3186, +0.1235, +0.0944, +0.2717, +0.1232, -0.3457],
[ -0.1970, -0.3969, -0.2225, +0.1993, +0.1553, -0.0254, -0.1890, -0.3057, +0.4549, -0.0170, -0.5648, -0.4915, -0.0502, -0.2149, +0.2144, -0.5744, -0.1044, -0.4353, +0.0233, -0.0785, -0.3143, -0.3626, +0.0585, -0.3341, -0.0893, -0.4231, -0.0378, +0.0274, -0.4611, +0.0728, -0.1463, -0.2042, +0.0172, -0.4561, -0.0206, -0.1719, -0.0000, -0.4023, +0.0364, -0.1958, -0.5589, -0.0532, +0.0099, -0.0872, +0.0206, -0.0009, -0.3550, -0.3123, -0.0938, -0.2254, -0.1686, -0.2615, -0.2844, +0.0994, +0.0554, +0.1692, -0.2632, -0.1443, -0.1879, -0.1459, -0.6597, -0.3367, -0.1862, -0.3134, +0.1299, -0.0695, +0.2293, +0.0609, +0.2819, -0.1567, -0.2090, -0.1359, +0.3011, -0.2784, -0.2469, +0.0022, -0.1715, -0.1446, -0.2693, -0.3637, -0.1232, -0.2147, -0.2098, +0.0446, +0.1409, -0.0058, +0.0383, -0.1855, -0.1377, +0.0460, -0.2215, +0.3805, -0.2653, -0.1465, -0.4812, -0.0015, +0.0714, +0.0472, -0.2914, -0.2133, -0.1082, -0.8207, +0.1838, -0.1654, -0.6285, -0.5248, +0.0549, -0.1583, -0.5096, +0.1266, -0.5755, -0.3374, +0.0946, -0.3824, -0.4274, +0.1813, -0.3312, +0.1190, -0.2241, +0.0402, +0.2119, +0.1831, -0.0826, -0.1367, -0.2986, -0.4726, -0.5516, -0.0995],
[ -0.5413, +0.2330, +0.8049, -0.1323, +0.1069, +0.8225, +0.5138, +0.5381, +0.4208, +0.0392, -0.8431, +0.4248, -0.0927, +0.0971, -0.1803, -0.9058, +0.8480, -0.3816, -0.6984, -0.3827, -0.2599, +0.2374, -0.1889, -0.3184, -0.3037, +0.2556, -0.3310, -0.0797, -0.0166, -0.8056, +0.5743, +0.3340, -0.3261, -1.1856, -0.1586, -0.2816, -0.4614, -0.8387, -0.8821, -0.2603, -0.3087, -0.4192, +0.0168, -0.2696, +0.2092, -0.2967, -0.3088, +0.1593, -0.3350, +0.7112, +0.6204, +0.1440, -0.1400, +0.4595, +0.6284, -0.4182, +0.4677, +0.4245, -0.2426, +0.4360, +0.5265, +0.4846, +1.0185, -0.5593, +0.9728, +0.4769, +0.7221, +0.6885, -0.0294, +0.2469, +0.0124, +0.5220, -0.4949, -0.1693, +0.6676, +0.7299, -0.0920, +0.5961, -0.4980, -0.3700, +0.4610, -0.0052, -1.1549, -0.2259, -0.7090, +0.0568, +0.5237, -0.4150, +0.3867, -0.0865, -0.0347, +0.2796, -0.3372, +0.4407, +0.4653, +0.4029, +0.0542, -0.4820, +0.5448, +0.0841, +0.3830, -0.5634, +0.3101, -0.3656, +0.5915, +0.5094, +0.0265, +0.3061, -0.1867, +0.4472, +0.0831, -1.4864, +0.6205, -0.7317, +0.0345, +0.0241, -0.4189, +0.2699, -0.0454, +0.1761, +0.1418, +1.0411, -0.1500, -0.5850, +0.4274, -0.2819, -0.0049, -0.0539],
[ +0.3625, +0.0194, -0.3223, -0.1543, -0.3422, +0.1361, -0.1979, +0.1716, +0.1964, +0.1080, -0.2562, +0.5515, -0.6231, +0.0645, -0.2820, -0.4138, -0.3513, -0.1298, +0.1236, -0.1571, +0.0996, -0.4628, -0.0855, +0.6111, +0.2735, +0.1079, +0.0759, -0.8790, +0.2145, -0.6007, -0.0575, +0.4727, -0.0139, -0.2520, -0.1913, -0.1010, +0.0459, +0.2930, -0.5473, -0.6486, +0.0525, -0.9643, +0.0756, -0.0343, -0.3489, +0.2362, +0.5423, -0.2968, -0.0831, -0.4753, -0.2939, +0.1316, -0.6055, +0.3439, -0.4793, -0.9334, -0.0404, -0.0067, -0.1639, -0.2048, +0.2024, +0.0257, -0.7722, +0.3862, +0.3280, -1.2964, +0.3508, -0.4320, -0.0618, +0.0669, -0.1487, +0.0590, -0.0657, -0.5083, -0.3131, -0.3795, -0.3027, -0.7377, -0.2656, -0.1819, +0.0315, -0.1914, -0.3061, -0.0285, +0.1491, -0.3607, -0.6081, +0.3564, +0.2935, -0.1484, +0.1152, -0.5023, +0.1752, -1.5863, +0.1823, -0.3487, +0.3613, +0.0175, -0.2217, -0.1352, -0.5851, +0.1753, -0.0871, +0.5474, +0.3244, -0.8566, -0.3348, -0.0279, +0.5935, +0.2750, +0.0797, +0.1091, -0.8979, +0.7681, +0.3679, +0.3083, +0.2425, +0.1221, +0.3024, +0.4512, +0.0880, -0.0056, -0.1940, +0.3921, +0.4914, -0.7178, -0.2134, +0.1143],
[ +0.0679, -0.0794, -0.3814, +0.2536, -0.1512, +0.1385, -0.1787, -0.1347, -0.1905, +0.0860, +0.1867, -0.0860, +0.0923, +0.1577, +0.1129, +0.2066, +0.2144, +0.0983, +0.1848, +0.3214, -0.3866, +0.1045, -0.0303, -0.2351, -0.1582, -0.0153, -0.1058, +0.0740, -0.0575, -0.1356, +0.0975, +0.2816, +0.0862, -0.2179, -0.4657, -0.2575, -0.1307, -0.1683, -0.0066, +0.0145, +0.2131, -0.0987, +0.2698, +0.1188, +0.0539, +0.3335, -0.0699, -0.1512, -0.0397, +0.0569, +0.0859, +0.2909, +0.0149, -0.0338, +0.3416, +0.0462, -0.0262, +0.3987, -0.1117, +0.0869, +0.2025, +0.0820, +0.0110, -0.0663, -0.0989, +0.0121, +0.2080, +0.2500, -0.2012, -0.0425, -0.3801, +0.2980, -0.1070, -0.2112, -0.2358, -0.0148, +0.0342, +0.1877, -0.0190, -0.3003, -0.0384, +0.3230, +0.0058, +0.1883, +0.1429, -0.0525, -0.0369, +0.1965, +0.4171, -0.2498, +0.3534, +0.1377, -0.1843, -0.0786, -0.0334, -0.2252, -0.2525, -0.4377, +0.0970, -0.0632, -0.1115, +0.1151, -0.2193, +0.4269, +0.0589, +0.2567, -0.0083, -0.1317, -0.0140, -0.2162, +0.1460, +0.2144, -0.2364, +0.2052, +0.1361, +0.3009, -0.0415, +0.0753, +0.1605, -0.0008, +0.1161, -0.0075, +0.1132, -0.1271, +0.5005, +0.0962, +0.0963, +0.2632],
[ -0.0499, -0.1868, +0.0577, +0.1447, +0.1636, -0.3556, -0.1492, +0.0388, -0.1583, -0.0774, +0.0437, +0.0230, -0.1318, +0.0701, +0.3213, -0.0902, -0.1691, +0.0205, +0.0912, -0.0380, +0.0704, -0.0709, -0.0177, -0.1689, -0.3108, +0.0728, -0.2808, -0.0876, -0.0702, -0.4691, +0.3010, +0.2589, -0.1658, -0.3264, +0.1423, +0.0444, -0.0579, +0.0883, -0.1900, -0.3669, +0.0899, +0.0842, +0.1387, +0.0023, +0.0807, -0.1238, +0.1961, +0.0881, -0.0594, -0.1222, -0.2213, +0.2254, +0.0348, -0.1841, -0.1994, -0.4183, +0.0770, -0.2080, -0.0388, +0.0821, +0.0289, +0.0999, -0.0389, +0.0711, -0.2250, -0.0025, -0.2014, +0.2883, +0.3065, -0.1356, -0.0597, -0.1037, -0.0451, -0.1849, +0.0913, -0.0457, +0.0217, -0.0981, +0.0654, -0.1176, +0.1646, +0.2142, -0.3388, -0.5200, -0.2313, -0.1905, +0.0708, -0.0961, -0.1217, -0.1662, -0.1982, +0.1837, -0.0128, +0.0935, +0.0200, +0.1873, -0.2688, +0.2296, +0.2719, -0.2736, +0.2598, +0.1866, +0.1070, -0.0368, -0.0790, +0.3079, -0.1966, +0.0417, -0.2708, +0.0273, +0.3073, +0.2085, -0.1423, -0.1677, -0.2092, -0.3405, +0.1060, -0.3134, -0.1067, +0.0272, +0.1868, -0.2262, +0.2388, -0.4858, -0.0006, +0.3641, -0.0149, +0.1635],
[ -0.0293, -0.6816, +0.0207, -0.3203, +0.5807, +0.2284, +0.0608, -0.0782, -0.7455, +0.0780, +0.1824, +0.2558, +0.6335, +0.3215, -0.1083, -0.4061, +0.2560, -0.2431, -0.9005, -0.7526, +0.0429, +0.0809, +0.3405, -0.1655, +0.1869, -0.4230, +0.1290, -0.0598, -0.8880, -1.3204, -0.6279, +0.1188, -0.1528, +0.1304, +0.3002, -0.2851, -0.4151, +0.1325, +0.0967, -1.1975, -1.4119, -0.1437, +0.1030, +0.1688, +0.1357, +0.5681, +0.1686, -0.6273, -0.0961, -0.1940, -0.4501, -0.3292, -0.4322, -0.0958, -0.1608, +0.0745, -0.2823, +0.1386, -0.3401, -0.0044, +0.1450, -0.9192, +0.1943, -1.0786, -0.3468, -0.2210, -0.8898, +0.2841, -0.1573, +0.0027, +0.5140, +0.2573, -0.2886, -0.1363, +0.0590, -0.0752, -0.5069, +0.4482, -0.2980, -0.0193, +0.0242, -0.1357, +0.3524, -0.0679, -0.4083, -0.1631, -0.0261, +0.0079, +0.4069, +0.0506, +0.0312, +0.1185, +0.3524, -0.1431, -1.3855, +0.2428, -0.4439, +0.2224, -0.6006, +0.1477, -0.1597, -0.4273, -0.1280, +0.4005, +0.2949, +0.1104, -0.0679, +0.3744, +0.6098, -0.5700, +0.1008, +0.2341, -0.4750, -0.3084, -0.2798, -0.7803, +0.6083, -0.0650, +0.0205, -0.1667, +0.0401, -0.1926, +0.4924, +0.1119, -0.8171, +0.2006, +0.3861, -1.1334],
[ +0.3379, -0.0630, -0.3660, +0.3327, +0.0593, -0.1086, +0.5011, +0.1324, -0.2487, -0.0698, +0.1031, -0.1188, +0.2941, +0.0543, -0.0504, -0.1540, -0.0798, +0.2290, +0.2369, -0.0698, +0.1134, +0.4617, +0.1530, -0.3301, -0.2881, -0.2488, +0.0245, -0.0285, -0.2306, -0.1149, -0.0003, -0.0923, -0.1315, +0.0210, -0.1870, +0.0622, -0.0506, -0.0135, -0.1995, -0.0287, +0.0711, -0.0130, +0.3577, -0.1441, -0.1204, -0.3320, -0.2458, -0.0879, +0.0139, +0.2201, -0.3011, +0.0393, +0.2918, -0.0472, -0.1514, -0.1190, -0.0056, +0.2567, -0.3284, -0.5337, -0.0050, -0.1086, -0.1834, -0.3311, -0.1851, +0.1848, -0.0175, -0.1277, -0.1361, +0.1587, +0.0424, +0.0936, +0.1683, -0.0294, +0.1407, -0.0313, -0.0279, +0.2524, +0.1912, +0.1002, +0.1337, +0.0550, +0.1725, +0.0323, +0.1961, +0.2280, +0.4421, +0.1152, +0.0211, +0.1519, -0.0487, -0.0903, +0.1088, -0.1067, -0.1932, +0.0741, -0.1907, -0.1498, +0.3873, -0.1806, -0.1683, +0.1372, +0.0304, +0.0863, -0.1042, -0.0114, +0.1071, +0.1654, +0.2195, -0.1274, -0.2964, +0.1572, +0.1514, +0.0736, +0.1129, +0.1630, -0.0438, +0.2270, -0.0895, +0.2149, +0.2307, +0.0664, +0.0300, +0.3303, +0.0999, +0.3439, +0.0904, +0.1683],
[ +0.0340, -0.0989, -0.0451, +0.2294, +0.2241, +0.2625, -0.1814, +0.0073, -0.3025, +0.3027, -0.3313, -0.0211, +0.0333, +0.1126, -0.0768, -0.1360, -0.3812, +0.2599, -0.2655, -0.0163, +0.2248, -0.1354, +0.1735, -0.1578, -0.0827, +0.1191, +0.1209, -0.2733, +0.2359, -0.2004, -0.0624, +0.2381, -0.0092, -0.0115, +0.0134, -0.2366, +0.2267, -0.3574, -0.0541, -0.3561, -0.0686, -0.0024, -0.0964, -0.0168, +0.0758, +0.1287, +0.0970, +0.2117, +0.4078, +0.2125, -0.1938, +0.0866, -0.2325, -0.0116, -0.2797, -0.2403, +0.1878, -0.2757, -0.2458, +0.2984, -0.0047, +0.1370, -0.3392, -0.1224, +0.2413, +0.1075, +0.3686, +0.2316, -0.0368, +0.0658, +0.0282, +0.2231, -0.1776, +0.0984, +0.2372, +0.2452, +0.0692, -0.0771, +0.2522, +0.2017, +0.1455, +0.2602, +0.1297, -0.0145, -0.1484, +0.0469, -0.0616, +0.2906, +0.1185, +0.2783, +0.0614, +0.0493, -0.2796, +0.1048, -0.2029, +0.1820, -0.2846, +0.0042, +0.0699, +0.2208, +0.1126, -0.0028, -0.0612, -0.0730, -0.0883, +0.1355, -0.2635, -0.4806, +0.1522, -0.5489, -0.1904, -0.2650, +0.1945, -0.0204, -0.0391, +0.2104, +0.2261, +0.2982, -0.5277, +0.0563, -0.0652, -0.0232, +0.0058, +0.0107, +0.1389, -0.1388, +0.3945, +0.1338]
])
weights_dense1_b = np.array([ +0.0484, -0.2398, -0.1357, +0.0298, -0.3778, -0.2392, -0.0211, -0.1728, +0.0154, -0.1052, -0.0235, -0.0825, -0.0137, -0.1951, +0.1408, -0.2835, -0.4597, -0.2002, -0.1659, -0.2736, -0.0233, -0.2472, -0.0697, -0.1892, -0.1340, -0.0051, -0.1712, -0.1986, -0.1902, -0.1213, -0.1363, -0.2731, -0.0609, +0.0803, -0.1623, +0.0661, -0.0660, -0.1206, -0.2835, -0.1281, -0.1008, -0.2377, -0.1436, -0.1027, -0.1816, -0.1699, -0.2476, -0.0886, -0.1582, -0.1714, -0.1558, -0.2484, -0.1255, -0.1657, -0.0830, -0.0800, -0.1293, -0.0594, +0.0174, +0.1097, -0.1769, -0.1648, -0.1995, -0.1082, -0.1761, +0.0342, -0.1445, -0.0106, -0.2021, -0.1352, -0.2769, -0.1503, +0.1171, -0.2275, -0.1514, -0.1064, -0.1877, +0.0308, -0.1081, -0.0229, -0.1273, -0.0516, -0.0789, -0.1148, -0.0308, -0.1946, -0.3185, -0.1215, -0.0605, -0.1876, -0.1192, -0.1545, -0.0148, -0.0218, -0.3640, -0.2230, +0.1549, +0.0196, -0.2555, -0.1814, -0.3217, -0.1741, +0.0117, -0.1752, -0.2445, -0.0863, +0.0041, +0.0058, -0.0948, -0.1010, -0.0595, +0.0182, -0.0761, -0.0141, -0.1886, -0.0474, +0.0057, -0.1247, -0.3390, +0.0672, -0.0612, -0.1059, +0.0219, -0.1802, -0.1265, -0.1287, +0.0565, -0.0502])
weights_dense2_w = np.array([
[ +0.4072, -0.1577, +0.0300, -0.0725, +0.6609, -0.5568, +0.0820, -0.2073, +0.3434, +0.0637, +0.0899, -0.1563, +0.1371, +0.7268, -0.4818, +0.0706, -0.1386, +0.4026, +0.2577, -0.4374, +0.4362, +0.2120, +0.0860, +0.0373, -0.5472, -0.4427, +0.0769, +0.3067, +0.3401, -0.0008, -0.7384, +0.0566, -0.0583, -0.3481, -0.2953, -0.1032, -0.7956, -0.6262, -0.0733, -0.6908, -0.4126, -0.2014, +0.6791, -0.5321, +0.5106, -0.1055, +0.0604, -0.5233, -0.8984, -0.4227, -1.3192, +0.3693, +0.2789, -0.2774, +0.0132, -0.1824, -0.0690, -1.6134, -0.2901, -0.1739, -0.5780, -0.3432, +0.0980, -0.3106],
[ -0.3167, -0.2520, +0.1710, +0.1912, +0.0268, -0.1353, +0.0637, -0.3158, +0.3448, +0.4247, -0.2795, -0.6464, -0.5002, +0.1116, -0.0497, -0.7619, -0.1402, +0.0142, -0.0314, -0.0418, -0.6087, +0.1742, -0.2843, -0.3738, +0.0595, +0.2382, +0.7762, +0.4531, -0.8817, -0.0971, -0.4319, +0.0168, -0.7739, -0.6792, +0.3594, -0.2188, -0.7423, +0.2473, -0.2793, +0.0149, -0.2970, -0.0695, +0.6082, -0.5475, -0.5990, +0.6079, +0.2662, +0.2195, -0.5335, -0.1782, -0.1657, +0.0951, -0.1763, -0.3554, -0.1032, +0.3347, -0.2818, -0.6144, -0.2387, -0.3771, -0.0378, +0.0776, -1.4711, -0.1353],
[ -0.2935, -0.8083, -0.1306, +0.1952, -0.1178, -0.4799, +0.0777, -0.4029, -0.5699, -0.1755, -0.0172, +0.1791, -0.0261, -0.2480, +0.0181, -1.0284, -0.2705, +0.4318, +0.1634, -0.2889, -0.0075, -0.1050, +0.0859, +0.0544, -1.0494, +0.0273, -0.1991, -0.2565, -0.3891, -0.1883, -0.4818, -0.2458, +0.2761, +0.1295, -0.2284, -0.0114, +0.2609, -0.1632, -0.0384, +0.0558, -0.2330, -0.3149, -0.1879, -0.0787, +0.2492, -0.1629, +0.3027, +0.5257, -0.4112, -0.2063, -0.0745, +0.0864, -0.1151, -0.3392, +0.2214, +0.2084, -0.1933, +0.0103, -0.0245, +0.0280, +0.0170, -0.1814, +0.0239, -0.6701],
[ +0.0470, -0.1471, -0.3533, -0.2277, +0.2617, -0.2955, -0.2491, -0.1937, +0.2634, +0.0681, -0.2869, -0.1950, +0.1615, +0.2557, -0.0025, +0.2327, -1.0104, +0.3358, +0.2386, -0.6202, -0.0829, +0.3342, +0.0617, -0.0119, -0.6297, -0.2430, +0.2088, +0.0102, +0.3480, -0.0119, -0.3172, +0.1668, -0.2217, +0.1130, -0.0817, +0.0391, -0.0480, -0.1680, -0.1306, -0.4677, -0.1638, -0.3569, -0.1594, +0.2110, +0.3875, -0.1732, -0.0210, -0.3070, -0.7983, +0.2381, -0.0294, -0.2019, +0.1801, +0.2116, +0.2506, -0.0342, -0.7177, -0.6430, +0.3333, -0.7577, -0.3507, -1.0563, -0.4578, +0.0739],
[ +0.0584, +0.2110, +0.2883, +0.4496, -1.4306, -0.3233, +0.1243, -0.5887, +0.1677, -0.1064, -0.3807, -0.0439, -0.8551, -1.2286, +0.2521, -0.0060, +0.6236, -0.1993, +0.3985, -0.2662, -0.0002, +0.0486, -0.2869, -0.6390, -0.1125, -1.3003, +0.1867, -0.3180, -0.7481, +0.1080, +0.3788, -0.3003, -0.1799, -0.4549, -0.0974, -0.0827, +0.3762, +0.2356, -0.2579, +0.4377, -0.1295, -0.3391, -0.7046, -0.1904, -0.1341, -0.0194, -0.2193, -0.3140, -0.1927, -0.3742, +0.2955, +0.1099, -0.5704, +0.0968, -0.0678, -0.1847, -0.0211, -0.3002, -0.4862, +0.4810, -0.0444, +0.4728, +0.1298, -0.0902],
[ +0.0349, +0.9685, -1.9391, -0.3447, -0.1261, -0.3633, -0.0598, -0.6471, -0.8648, -0.7718, -0.4766, -0.8915, -0.5728, -0.5278, +0.5933, -0.3178, +0.0116, +0.3050, +0.3750, -1.1527, -0.0571, -0.2033, +0.4198, +0.2105, -0.7927, -0.6716, -1.0696, -0.7200, -0.5883, -0.6538, -0.4865, -0.8737, +0.0426, +0.2175, -0.2165, -0.0444, -0.1326, -0.0308, -0.1097, +0.0105, -0.1852, -0.3861, -0.2117, -0.5265, +0.0367, -0.0218, +0.2472, -0.2354, -1.1444, -0.3036, -1.6033, +0.1154, -0.3195, +0.3943, -0.8171, -0.0495, -0.0950, -0.3764, -0.1523, -0.8749, +0.2594, +0.2451, -0.1734, -0.0927],
[ +0.4523, +0.0513, -0.0013, +0.1556, +0.2430, -1.2187, -0.3108, -0.7597, -0.7845, -0.6297, -0.0224, +0.3207, +0.2222, -0.2645, +0.1510, +0.1624, -0.0568, -0.8426, -0.3564, +0.0187, +0.2791, +0.0447, -0.1822, -0.2627, +0.0078, -0.9392, +0.0805, +0.0339, +0.3228, -0.0153, -1.4823, -0.0994, +0.2658, -0.0138, -0.1071, +0.2001, -0.3299, -0.5982, -0.2859, -0.1269, +0.0496, -0.0371, +0.3491, -0.3822, +0.1167, -0.2964, -0.4635, +0.0549, -0.6313, -0.4994, -0.2447, +0.0584, +0.2663, -0.0663, -0.1714, -0.1748, -0.5364, -0.3646, +0.1584, +0.0349, +0.1420, -0.6877, -0.3539, +0.2209],
[ -1.2158, -0.7080, +0.1037, -0.1613, +0.0811, -0.9051, -0.4186, -0.6072, -0.6212, +0.0362, -0.3524, +0.2563, -0.7313, -0.2856, +0.0658, -0.1271, -0.1249, -0.6959, -0.4723, +0.4467, -0.1244, -0.0056, +0.5042, -0.5181, +0.0475, +0.2931, +0.3883, -0.2017, -0.0388, +0.0403, +0.1562, -0.9404, +0.0620, -0.5598, -0.5657, +0.0578, +0.0086, -0.5689, -0.9304, +0.3161, -0.1303, -0.4087, -0.5053, -0.1267, +0.0123, -0.6312, -0.6991, -0.0800, -0.8634, +0.2347, +0.1449, +0.3955, +0.4396, -0.0684, +0.2644, -0.7668, -0.1511, +0.0324, +0.0823, -0.3579, +0.0592, +0.0904, +0.2380, +0.0873],
[ -0.6992, +0.1539, +0.4253, -0.2513, +0.1882, +0.6842, -0.6867, -0.2942, -0.3434, +0.2486, -0.4180, -0.6950, +0.2628, +0.7324, -0.2667, -0.1330, -1.3123, +0.0990, -0.1324, -0.0016, -0.0310, +0.0778, -0.1325, +0.2886, -0.2052, +0.0094, +0.1791, +0.1105, +0.4348, -0.6778, -0.3301, +0.1438, +0.1093, +0.0140, -0.1957, -0.1226, +0.0676, +0.9343, -0.1993, +0.1818, -0.1565, +0.3443, -0.1359, -0.5234, +0.2591, +0.3769, +0.4966, -0.6424, -0.0288, +0.0357, -0.3554, -0.1676, -0.2453, -0.4502, -0.3745, -0.1692, -0.2449, -0.2132, -0.0001, +0.0087, +0.3669, +0.3835, +0.0003, +0.6565],
[ +0.2329, -0.0695, +0.4082, -0.0004, +0.0059, +0.1418, +0.1081, -0.3141, +0.2218, -0.0538, -0.0670, +0.0018, -0.1211, -0.0491, -0.3059, -0.4239, -0.1665, +0.0700, +0.4327, -0.5063, +0.3045, +0.7774, +0.4464, +0.2276, -0.3467, +0.5197, +0.1607, -0.1339, -0.1663, +0.0881, +0.0232, -0.3337, +0.0157, -1.1305, -0.1427, -0.7464, -0.3650, +0.2386, +0.2734, +0.5966, -0.4067, +0.3709, +0.2986, -0.3682, -0.1436, +0.3259, +0.3393, -1.2748, -0.5180, +0.1099, -0.0843, +0.0421, +0.1176, +0.0935, +0.3649, +0.1282, +0.2074, -0.4244, -0.3379, -0.8103, -0.1238, -0.6615, -0.5262, -0.9899],
[ +0.2683, +0.0401, -0.2063, -0.0863, -1.1390, -0.1614, +0.4551, -0.2386, -0.9135, -0.1037, +0.3364, +0.0943, +0.3665, -0.2748, +0.2592, -0.0339, +0.4767, -0.1381, -0.2326, +0.0600, +0.1522, -0.3524, +0.4203, -0.4977, -0.2533, -0.4959, +0.1211, -0.1722, +0.0681, -0.2369, +0.2398, +0.2182, +0.0582, +0.4106, -0.2708, +0.1474, +0.3402, +0.3310, +0.1319, -0.2479, +0.1749, +0.3886, -0.1866, +0.0482, +0.2373, -0.4678, -0.1560, +0.4025, -0.3261, +0.6000, -1.2795, +0.2571, -0.0926, -0.2927, +0.2793, -0.4958, +0.0614, -0.0140, -0.1622, -0.4095, -0.1560, -0.2754, +0.1172, -0.1319],
[ -0.5295, -0.0999, +0.0220, +0.3271, +0.2059, -0.4296, +0.3921, -0.0843, -0.4874, +0.3199, +0.4602, -0.8274, +0.2366, +0.6108, -0.3201, +0.1853, +0.3175, +0.0078, -0.4971, +0.7472, +0.1544, -0.3018, +0.2934, -0.2034, +0.3348, +0.3705, -1.3035, +0.2084, +0.4699, +0.0053, -0.3233, -0.8634, -0.4203, -0.6225, -0.2153, +0.5059, +0.1571, -0.7581, -0.9790, +0.1196, -0.6516, +0.1740, +0.3164, -0.0439, -0.7366, -0.0850, +0.4464, -0.9298, +0.3098, +0.6134, +0.0513, -0.1314, -0.7751, -0.4632, +0.2998, -0.2841, -0.1156, +0.2272, -0.6840, +0.2023, +0.2771, +0.0181, +0.3241, +0.0077],
[ -0.0280, -1.3387, -0.3547, -0.0743, +0.1483, -0.0627, -0.3067, -0.3430, +0.0588, +0.0807, +0.4038, +0.4257, +0.4200, -0.1636, -0.6085, +0.0772, +0.3777, -0.0100, -0.5085, -0.4027, +0.1783, +0.3648, +0.2458, -0.6546, -0.3100, -0.0142, +0.5146, +0.5179, +0.3174, -0.0085, -0.5655, +0.6930, -0.0170, -0.0840, -0.4820, +0.3951, +0.2091, -0.1006, -0.1043, -0.1592, +0.5631, +0.0762, +0.0353, +0.3549, -0.5710, +0.6521, -0.5372, +0.5439, -0.6006, -0.3861, -0.9696, +0.3836, +0.0144, -0.0445, +0.2625, +0.0893, +0.3533, -0.0816, +0.3946, -0.1645, -1.0470, +0.4605, +0.2646, -0.0709],
[ +0.1597, -0.1930, +0.1695, +0.0883, +0.3863, -0.0690, -0.3626, -0.0751, -0.2489, -0.2651, +0.3078, -0.0279, +0.0915, -0.3568, +0.0135, +0.0301, +0.1845, +0.0936, +0.1046, -1.0295, -0.4317, +0.0053, +0.3181, +0.1241, +0.1828, -0.1518, +0.3664, -0.0194, -0.0056, -0.9545, -0.3588, +0.5326, -0.9760, -0.2063, +0.4710, -0.7108, -0.0157, -1.2469, -0.3011, -0.2258, -0.1896, +0.0305, +0.1823, +0.2524, +0.0734, -0.0195, +0.2741, +0.0458, -0.0258, -0.1458, -0.0499, +0.2720, +0.2632, -0.1566, -0.3169, +0.4742, -0.1019, -0.1814, +0.3763, +0.2875, +0.4905, -0.4019, +0.2122, -0.9641],
[ +0.3189, +0.1388, -0.3550, -0.3842, +0.0898, +0.0547, -0.7110, -0.1182, +0.0259, +0.0704, +0.1494, -0.1821, -0.1159, +0.0213, +0.2096, -0.4418, -0.6512, +0.1241, +0.0305, -0.1008, +0.0562, +0.0968, +0.0081, +0.1199, +0.1381, -0.2673, -0.2059, -0.0357, +0.3140, +0.2211, -1.0964, +0.1492, +0.1469, -0.5406, -0.0557, +0.3461, -0.0567, +0.2042, +0.1409, -0.1752, -0.5634, -0.7240, -0.0985, +0.4507, -0.0405, +0.1548, -0.0590, +0.2785, +0.0398, -0.0766, +0.3026, -0.3093, -0.0211, +0.3418, -0.0372, +0.1007, -0.1287, -0.1216, +0.1111, +0.0391, -0.4399, -0.1719, -0.7748, +0.0015],
[ -0.8898, +0.1587, -0.1158, -0.2147, +0.1854, +0.0673, -1.6078, +0.3145, +0.1855, +0.0176, -0.6532, +0.1946, -0.2744, -0.2392, +0.0001, -0.5411, -0.3275, -0.6474, -0.3419, +0.0351, -0.2511, +0.2090, -0.1401, -1.2570, -0.3467, -0.1794, -0.0238, -0.3511, +0.0885, +0.2340, -0.2762, +0.2349, -0.0718, -0.1801, -0.5107, +0.1164, +0.2997, -0.1047, +0.1091, +0.1830, -0.0604, -0.5492, +0.0451, +0.5144, -0.1682, -0.2848, -0.3148, -0.0800, -0.6753, +0.8912, -0.3167, +0.1553, -0.1064, +0.4668, -0.1185, +0.0205, +0.2634, -1.4268, -1.4053, +0.1865, -1.1680, -0.5715, -0.1411, -0.0048],
[ -1.1451, -0.8007, -0.7188, +0.2194, +0.0224, -0.3902, -1.0708, +0.1315, -0.4508, -0.0171, -0.1646, -0.8523, +0.0246, -0.2483, +0.2628, -0.0709, +0.1284, -0.0332, +0.2452, +0.6453, +0.0372, +0.0580, -0.4814, -0.0367, -0.6464, -0.1864, -0.0876, -0.3798, -0.1084, -0.2326, +0.3449, -1.0821, +0.3558, -0.2093, -0.1611, +0.0181, -0.1593, -0.7092, -0.5308, +0.3392, -0.2771, -0.8510, -0.0332, +0.1636, -0.1288, -0.1509, -0.0123, -0.3427, -0.2880, -0.9719, -1.0379, -0.2061, -1.2064, +0.0703, +0.0296, -0.5942, +0.1367, +0.2798, -0.9892, +0.2638, +0.6593, +0.3467, +0.2717, -0.2685],
[ -0.2935, -0.2457, -0.1847, -0.1120, +0.2738, -0.1316, -0.1218, +0.1977, +0.2899, -0.2914, -0.9864, +0.4904, -0.1894, -0.0953, +0.0076, -0.0067, -0.6684, -0.0314, +0.0872, +0.4462, +0.2811, -0.1232, -0.3337, -0.7796, -0.7328, +0.0966, -0.1373, +0.4435, +0.1715, +0.1189, -0.3743, +0.3548, -0.0802, -0.5682, -1.3086, -0.0364, -0.2844, -0.3369, +0.3544, -0.0662, -0.1867, -0.3540, -0.2038, -0.4980, +0.3799, -0.1018, -0.9164, +0.3697, -0.0067, -0.5775, -0.1818, +0.0175, -0.1748, +0.4688, -0.5308, -0.4231, +0.1482, -0.5617, -1.2285, +0.3348, +0.2546, +0.3433, -0.0552, -0.4434],
[ -0.5986, -0.0456, -0.0579, +0.0098, +0.5195, +0.2289, -0.0547, +0.0712, +0.3579, +0.0200, -0.3965, +0.3115, -0.3113, -0.2659, +0.2821, -0.0527, -0.1284, -0.5430, -0.6974, +0.0659, -0.4766, -0.1915, -0.1467, -1.0685, -0.5390, +0.4510, +0.3700, +0.1105, -0.1987, -0.0297, +0.0635, +0.2345, +0.1594, -0.0839, -0.1305, -0.1000, +0.2680, +0.1591, -0.5661, +0.1602, -0.0069, -0.1623, -1.4309, -0.1520, -0.0090, -0.3502, -0.6969, -0.0949, +0.0562, -0.0869, -0.2017, +0.0475, +0.5724, +0.1771, -0.0398, -0.7070, -0.1830, -0.0220, -0.1941, -0.9674, +0.0262, -0.1637, -0.0094, +0.4634],
[ -0.0007, -0.1887, +0.2479, +0.0483, +0.2260, -0.1202, -0.2455, -0.5935, -0.0951, +0.2204, +0.2221, +0.3503, +0.0909, -0.2512, +0.0191, -1.0021, -0.2003, +0.6241, +0.2894, -0.0605, -0.4665, -0.2199, -0.1427, -1.2488, -0.1763, +0.3383, +0.4418, +0.2648, -0.9742, +0.2356, +0.1240, +0.1305, -0.4167, +0.0351, +0.3759, -0.2039, +0.0351, -0.6693, -0.8583, +0.0616, +0.2169, -0.4452, -0.4786, -0.0808, +0.0579, -0.1770, +0.1975, -0.3272, -0.0747, -0.3015, -0.0030, -0.3779, -0.1084, +0.0285, +0.2040, +0.0064, -0.6207, +0.1540, +0.2691, -0.4465, +0.3775, -0.7416, +0.0563, -0.0898],
[ +0.1254, +0.4967, +0.1999, -0.2316, +0.2500, -0.0650, +0.5256, -0.4156, -0.2651, +0.1705, +0.0690, -0.0314, -0.6562, +0.0699, -0.8152, +0.1149, +0.0980, +0.6136, +0.2356, -0.4453, +0.3604, +0.4151, +0.1505, -0.3277, -0.2119, +0.0359, -0.1290, -0.1692, -0.0831, -0.0644, -0.1416, -0.0558, +0.0298, -0.0870, -0.1409, -0.5095, -0.3006, -0.0250, +0.4266, -0.3381, -0.3222, +0.3626, -0.0441, +0.2182, -0.1688, +0.0500, +0.2828, -0.2694, -0.0921, +0.1291, -0.7688, +0.2200, +0.1006, -0.3204, -0.1588, -0.5138, -0.6525, -0.3203, +0.5614, +0.1583, -0.3336, -0.6822, -0.0527, -0.0729],
[ +0.2401, -1.5531, -1.1594, +0.0219, -0.1680, -0.0307, -0.1397, -0.4195, +0.2302, +0.2705, +0.0780, -0.3434, +0.2748, -0.1826, -0.4300, -1.2819, -2.0983, +0.2545, +0.3414, +0.1059, +0.1937, +0.0885, +0.3678, +0.0745, -0.2122, -0.2374, +0.2199, +0.1136, +0.0291, -1.5077, -0.6176, +0.0825, +0.0813, -0.2417, -0.3546, +0.2231, +0.3004, +0.0066, -0.0259, +0.5017, -0.6783, -0.5061, +0.0575, -0.1790, -0.4460, -0.6383, -0.1353, -0.1327, +0.0067, +0.2322, -0.0208, +0.2877, +0.1562, -0.5431, +0.0227, -0.1356, +0.0365, -0.2004, -0.1343, +0.1730, -0.5527, +0.1656, +0.1991, -0.8294],
[ +0.4524, +0.7614, -0.1415, -0.0766, +0.1568, +0.0408, +0.0539, -0.2856, +0.1050, -0.1615, -0.8484, +0.5459, +0.1695, +0.2730, -0.0014, +0.6478, +0.1634, -0.0715, -0.0612, -0.1463, -0.1214, -0.1158, +0.1563, +0.2598, +0.0758, -0.4645, -0.2913, -0.3810, -0.7767, -0.3182, +0.1396, +0.1954, -0.0150, -0.1029, -0.2936, -0.5085, -0.0514, +0.1485, -0.1216, -0.1714, -0.1193, +0.4209, +0.0558, -0.4255, +0.2840, -0.5583, -0.3015, -0.2423, +0.0089, -0.4503, +0.3085, +0.2502, +0.2749, +0.2995, -0.7768, -0.3364, -0.5740, +0.0843, -0.2877, -0.5731, -0.3221, -0.2253, -0.3227, -0.0065],
[ +0.0540, -0.0224, -0.3116, -0.5707, -0.0632, -1.4873, +0.2964, -0.4894, -0.2578, +0.2032, +0.0937, -0.4259, -0.0588, +0.4007, +0.1099, -0.2633, -0.3422, +0.1973, -0.0170, +0.0451, +0.1670, +0.4853, +0.2068, +0.2066, -0.1544, +0.0191, -0.0957, -0.9554, -0.6965, -0.6022, +0.1666, +0.0026, +0.5176, -0.0584, -0.9679, -0.2898, +0.2451, +0.2050, -0.2909, +0.0002, -0.0763, -0.2100, -0.1929, +0.0985, -0.2612, -0.3684, +0.3190, -0.5681, +0.2765, -0.1663, +0.0422, +0.3252, +0.2741, -0.2385, -0.1602, +0.2504, -0.2370, +0.0891, -0.2204, +0.1525, +0.0444, +0.0188, +0.3538, -0.0313],
[ +0.0984, +0.2622, +0.1601, -0.3252, -0.2292, -0.0494, +0.2185, +0.2202, +0.4945, -0.3545, -0.1730, -0.6882, -0.6645, -0.1178, -0.2491, +0.2497, -0.1072, -0.2019, -0.0944, +0.2118, -0.2281, +0.2338, +0.0924, +0.1178, +0.0920, +0.0422, +0.3113, -1.1795, -0.8658, -0.6011, +0.0714, +0.0290, -0.5830, +0.2370, +0.3508, -0.0178, -0.6966, +0.2269, -0.2966, -0.6947, +0.1769, +0.1461, -1.0021, +0.0781, -0.3731, -0.0153, -0.2721, +0.0699, -0.2057, +0.0791, -0.2055, -0.4152, +0.2414, +0.0939, -0.4560, -0.3566, -0.0381, +0.1090, -0.5755, -0.4283, +0.2504, +0.0863, -0.6288, -0.9822],
[ -0.0122, -1.0238, +0.0346, -0.2412, -0.7928, -0.3765, -0.2889, -0.0948, +0.1003, +0.7268, +0.2033, -0.6144, +0.4689, +0.2045, +0.0799, +0.2687, -0.3528, +0.0560, +0.0682, +0.0874, -0.1901, -0.0082, +0.3474, -1.0391, -0.4695, -0.0233, -0.0259, -0.0901, -0.1084, -1.4681, +0.0081, -0.3583, -0.2599, -0.1273, -0.6221, +0.2186, -0.1878, +0.4510, +0.0409, -0.1692, +0.1495, -0.3093, -0.0192, -0.1835, -0.5964, +0.0327, -0.5086, +0.2446, -0.5980, +0.1981, +0.0441, -0.1232, -0.4881, -0.6698, -0.0519, -0.0831, -0.6186, -0.6176, +0.0503, +0.2250, +0.0662, -0.8334, -0.0077, -0.7196],
[ -0.2566, -0.7118, +0.2935, -0.1195, -0.1146, -0.0123, +0.1455, +0.1784, -0.2927, +0.3859, +0.2592, -0.0991, -0.6787, -0.2469, +0.1925, +0.0359, +0.2956, +0.2008, +0.0844, -0.3478, -0.2671, -0.0078, +0.3483, -0.0814, +0.5766, +0.2134, +0.0878, +0.3362, -0.1537, +0.3245, +0.2214, -0.2824, +0.1635, -0.5485, -0.1898, -0.1885, -0.0076, -0.2640, -0.2163, +0.4214, -0.2781, +0.1793, -0.1132, -0.3325, -0.3830, +0.1018, +0.0151, -0.7901, +0.1946, +0.3539, -0.4104, -0.1557, +0.3991, -0.0178, +0.1242, +0.4661, -0.0344, -0.4815, +0.1843, +0.6808, -0.0437, -0.3225, +0.2147, -0.4555],
[ -0.0638, -0.3322, -0.2387, +0.2534, -0.5326, -0.8410, -0.2301, -0.8189, -1.0886, +0.2326, -0.6260, -0.4507, -0.1068, -0.7282, +0.5187, +0.1134, +0.2561, +0.1038, +0.3431, -1.1889, +0.6843, -0.7160, -0.6177, -0.2679, -0.0451, +0.0572, +0.0807, +0.6884, +0.5089, +0.5436, +0.3386, -0.4832, +0.4377, +0.4794, -0.4475, -0.6358, -0.0388, +0.3861, +0.1041, +0.0640, -0.0701, +0.0340, +0.1640, -0.4543, -0.4830, -0.4003, -0.2349, +0.1010, -0.9351, -0.2592, -0.2928, -0.1271, -1.0826, -0.1847, +0.1704, -0.4475, -0.2948, +0.2068, -0.5627, -0.0093, +0.0881, -0.2164, -0.0049, +0.1603],
[ +0.1574, -0.0650, -0.2662, +0.1164, +0.4237, -0.6874, +0.4308, +0.4112, -0.0215, -0.0763, +0.2667, -0.3433, -0.4008, +0.2368, +0.1596, -0.1390, -0.4850, -0.0810, +0.1081, -0.1730, -0.8641, -0.3173, -0.2085, +0.1296, +0.2189, -0.4631, -0.3093, +0.0174, -0.0811, -0.4710, +0.0884, -0.5081, -0.2918, -0.0430, -0.1509, +0.4783, -0.1912, -0.7071, -0.3763, +0.0781, +0.1794, -0.3923, -0.9474, +0.3877, -0.2204, -0.2234, -0.0250, -0.3792, -0.6236, +0.1750, -1.4279, -0.4849, -0.6417, +0.1128, -0.2395, -0.1343, -0.5671, -0.1158, -0.1158, -0.3690, -0.1078, -0.2042, -0.3332, -0.2509],
[ +0.0333, -0.2800, -0.1392, +0.0001, +0.0705, -0.1369, -0.1756, +0.1453, +0.3505, +0.3330, -0.1388, -0.7255, -0.4376, -0.0105, +0.0049, -0.8412, -0.3385, -0.1028, -0.3672, -0.8725, -0.3093, -0.0453, +0.0416, -0.1510, +0.3841, -0.2103, +0.0864, +0.1017, -0.3006, -0.0184, +0.4379, +0.4946, +0.1351, +0.2742, -0.1733, +0.1185, +0.0766, -0.7874, +0.3184, -0.5364, +0.1065, +0.1258, -0.2782, +0.2434, +0.3819, -0.2390, +0.2471, +0.1067, +0.1810, +0.0401, -0.4542, +0.1356, +0.1049, -0.1339, -0.1564, -0.0183, +0.1957, -0.1304, -0.0602, -1.1445, -0.1470, -0.0536, -0.0504, +0.3606],
[ -0.4758, +0.1761, -0.4846, -1.0187, -0.1317, +0.4057, -0.7446, -0.0029, -0.1074, +0.3271, +0.2986, -0.2398, -0.1716, +0.0999, -0.3667, -0.3235, +0.0859, -0.2204, -0.0886, -0.3845, -0.1990, -0.4520, -0.0453, +0.0367, +0.4391, -0.5058, -0.5205, +0.0438, +0.0949, -0.2365, +0.0034, -0.0972, +0.2460, -0.3402, +0.2640, +0.1962, +1.0076, -0.0240, -0.0881, +0.3680, +0.1796, -0.1007, -0.7938, +0.1620, -0.2244, +0.1086, +0.0835, -0.6081, -0.0907, -0.2010, +0.1411, -0.1199, +0.1650, +0.0291, -0.1783, -0.2652, -0.1174, -0.4219, -0.2506, +0.0413, +0.0460, -0.6699, -1.2885, +0.1545],
[ +0.1129, -0.1235, -0.0860, -0.3039, +0.0470, +0.1649, -0.6282, -0.0529, -0.0862, +0.2638, -0.0880, -0.9592, +0.3736, -0.1045, +0.3156, -0.3239, -0.0977, +0.1138, +0.1028, +0.0075, -0.4383, +0.0055, +0.1644, -0.5601, +0.0328, +0.2353, -0.1457, +0.0268, -0.1316, +0.1369, +0.1295, -0.0454, -0.0704, -0.6862, -0.1434, +0.1058, -0.0882, -0.2573, -0.1518, -0.0106, -0.1371, +0.3189, +0.4066, -0.2663, -0.5477, +0.3918, +0.0601, -1.2816, +0.0213, -1.0473, +0.2741, -0.0658, -0.3203, +0.0561, +0.2982, -0.0264, +0.3706, +0.3083, +0.4189, -0.3125, +0.2324, -0.0699, -0.0653, +0.3647],
[ -0.0693, +0.4631, +0.0902, +0.3558, -0.1712, +0.1079, -0.0386, +0.1094, -0.3096, -0.2886, -0.2315, -0.2787, -0.5874, -0.6247, +0.5268, -0.1084, +0.7058, +0.1418, -0.5504, +0.0670, -0.0498, +0.1770, -0.1857, -0.0256, +0.0751, +0.1447, +0.1853, -0.1040, +0.0456, -0.5765, +0.0473, +0.1485, +0.3068, -0.2301, -0.2385, +0.2792, -0.8568, -0.5057, -0.0070, +0.0129, +0.4641, -0.2125, -0.6467, +0.0405, +0.0443, +0.0706, -1.0480, -0.2147, +0.1343, +0.1673, +0.0443, +0.1780, -0.3776, +0.3203, -1.0370, -0.5205, -0.0960, +0.4009, +0.2349, +0.1341, +0.0472, -0.1244, -0.1439, +0.0556],
[ +0.1598, -1.2782, +0.6361, -0.5370, -0.1456, -0.8548, -1.0428, -0.8559, -0.2116, -0.3637, -0.4516, -0.0612, +0.0129, +0.0675, -0.5432, +0.1841, -0.3792, +0.2158, +0.0596, -0.6030, +0.8449, +0.4651, -0.2557, -1.2864, -0.2594, -0.0408, -0.4892, +0.3451, +0.3054, +0.3925, -0.1913, -0.4430, -0.0513, +0.2399, -0.3757, +0.4300, -0.5091, +0.3864, -0.5291, -0.4042, +0.1954, +0.5566, +0.5156, +0.3129, -0.0074, -0.5308, -0.0965, +0.4685, -0.6602, -0.5140, -0.0500, -0.0512, -0.0719, -0.2983, -0.0757, -1.4385, -0.3450, -0.5004, -0.8424, +0.3685, -0.4302, -0.3252, +0.2352, -0.2397],
[ +0.2517, -0.0510, -0.8445, -0.0101, -0.2960, +0.3604, -0.0354, -0.2369, +0.4843, -0.2510, -0.0606, -0.0558, +0.1601, +0.1233, -0.0533, -0.6993, -0.1938, -0.0681, +0.1999, +0.1705, -0.3202, -0.0766, +0.2753, -0.4941, +0.2154, +0.1077, +0.2094, -0.0723, -0.1037, -0.0066, +0.0075, -0.0346, +0.2195, +0.1334, -0.1074, +0.0879, -0.2654, +0.2319, -0.1298, -0.3219, +0.3351, -0.6852, -0.5198, -0.2214, -0.0373, +0.2662, -0.2757, +0.0667, +0.1171, +0.1987, +0.4252, -0.5109, -0.5771, -0.2238, -0.0016, -0.1032, +0.2942, -0.4498, -0.1209, +0.0526, +0.0681, -0.0631, -0.2249, -0.5044],
[ +0.1015, -0.1221, -0.0457, -0.1632, +0.1805, -0.4646, +0.1515, +0.3582, +0.0226, -0.1206, -1.2033, -0.5519, -0.7632, +0.1745, +0.2149, -0.3880, +0.8417, +0.0764, +0.3466, -0.0296, -0.1456, +0.0030, -0.4206, -0.6899, +0.1030, -0.4873, -0.1851, +0.2350, -0.5323, -0.7947, -0.1631, -0.0664, -0.7279, +0.2869, -0.1196, +0.3290, -0.3650, -0.2667, +0.0680, +0.0420, +0.0880, +0.0988, -0.7243, +0.2308, +0.6681, -0.4614, -0.2574, +0.1210, +0.1116, -0.0749, -0.8760, -0.2902, -0.0932, -0.0302, -0.4676, -0.0909, -0.0998, -0.1058, -0.1159, -0.0889, +0.1690, +0.0106, -0.1399, -0.6091],
[ -0.3936, -0.2924, -0.0566, +0.0908, +0.1229, -0.4908, +0.2100, +0.3042, -0.1919, -0.2383, -0.1356, -0.2715, +0.5147, -0.0937, -0.2436, +0.2805, -0.4522, +0.1256, +0.0199, -0.2870, -0.1586, -0.1113, -0.4221, +0.5571, +0.4612, +0.0522, +0.0469, +0.1000, -0.3156, -0.2255, +0.0661, -0.8530, -0.1866, -0.0146, -0.2175, -0.5078, -0.2589, -0.0452, -0.0606, -0.1495, -0.0759, -0.0676, -0.4239, +0.1552, -0.3918, +0.2913, -0.1573, -0.1386, +0.4216, +0.3134, -0.2761, -0.0822, +0.4101, -0.4691, -0.3533, -0.4907, -0.6454, -0.6846, -0.5219, +0.2845, +0.0990, +0.5448, +0.0043, -0.1068],
[ +0.2038, +0.3592, -0.0381, -0.3525, -0.4154, -0.0967, +0.1296, +0.0537, -0.0668, +0.1384, -0.3061, -0.3796, -0.0676, +0.2463, +0.0337, +0.2712, +0.2327, +0.2747, -0.0390, -0.4290, -0.1667, -0.2714, +0.0036, -0.2474, -0.0108, -0.5544, -0.3588, -1.0251, -0.1637, -0.6376, +0.1074, -0.2695, -0.2931, +0.2847, -0.3638, +0.2679, +0.3571, +0.3164, +0.0257, -0.1720, +0.0306, -0.0424, -1.3316, -0.2671, +0.1664, -0.6751, -1.3701, -0.1609, -0.5226, +0.2046, -0.2826, +0.0329, -0.1094, +0.0457, +0.2797, -0.3022, -0.2398, -0.1309, +0.1237, -0.6917, -0.1042, -0.5504, +0.0599, -0.0993],
[ +0.2578, +0.2448, -0.3515, +0.2550, -0.4556, -0.1521, -0.0937, +0.1082, +0.0064, -0.1935, -0.0986, -0.4707, -0.8805, +0.0902, -0.2753, -0.1709, -0.0610, -0.5028, -0.2642, -0.5600, +0.0068, +0.3170, +0.3340, -0.3805, +0.2661, -0.6105, -0.0338, -0.3294, -0.5872, -1.0930, -0.0021, +0.0525, -0.4677, +0.2302, +0.2422, +0.0805, -0.8454, -0.1925, +0.3445, -0.0826, +0.1550, -0.1808, -0.9067, +0.1723, +0.0365, -0.2956, -0.0784, +0.2945, +0.0641, +0.0239, -0.0561, +0.0630, -0.1646, +0.0403, -0.9467, -0.6385, +0.1264, -0.2964, -0.1579, +0.2373, -0.0417, +0.1332, +0.4347, -0.2901],
[ -0.1863, -0.0242, -1.3175, -0.0210, +0.7122, -0.0967, +0.2298, -0.2379, +0.0625, -1.0683, -0.5156, -0.2993, +0.3003, +0.2490, -0.2035, +0.1202, -0.0714, -0.2515, +0.1050, -0.0244, -0.0323, -0.0142, -0.3243, -1.0355, -0.1945, -0.6769, -0.1482, -0.6095, -1.2543, -0.1212, +0.2109, +0.1281, -0.5586, -0.1869, -0.0505, +0.3053, -1.4947, -0.4599, +0.3102, -0.0713, +0.0294, -0.3146, +0.3229, +0.0378, +0.5098, +0.3752, -1.1693, +0.2510, +0.5305, +0.0346, +0.4966, +0.1118, -0.1061, -0.2008, -0.8236, -0.3700, +0.0883, -0.3168, -0.6185, +0.7089, -0.7464, +0.0953, +0.5762, -0.1075],
[ -0.0649, +0.0128, -0.1768, -0.6602, -0.1332, +0.2819, +0.2196, -0.5156, +0.3175, +0.1690, +0.2806, -0.4787, -0.6439, +0.2791, -0.2997, +0.1521, -0.1161, -0.0450, +0.3153, +0.2059, -0.0687, +0.1672, +0.1408, +0.1332, -0.0993, +0.3110, +0.0697, +0.1563, +0.1029, -0.9687, -0.0195, +0.2097, -0.1263, +0.0773, +0.0347, +0.1860, -0.0304, -0.2414, -0.8054, +0.1562, +0.2249, -0.9248, -0.8415, +0.3590, -0.1355, +0.3704, -0.4522, -0.3624, -0.7113, +0.2271, -1.0906, -0.5597, +0.2343, -0.3852, -1.1641, -0.2844, +0.3131, +0.0553, +0.1024, -1.8251, -0.7928, +0.1100, -0.1679, -0.9488],
[ -0.2144, -0.1724, -0.3429, +0.4875, +0.1602, +0.3609, +0.2947, -0.0800, -0.1385, +0.1008, +0.0328, -0.4782, -0.0638, +0.1748, +0.1134, -1.1389, -0.3115, -0.5365, -0.6607, -0.4707, -0.7305, +0.1676, -0.0230, +0.2286, -0.6695, +0.0748, +0.1772, -0.2285, -0.4459, +0.1489, -0.3056, -0.2268, -0.1158, +0.2677, -0.5665, +0.2966, -0.1029, +0.0172, +0.5579, +0.2357, -0.2072, -0.3823, -0.7458, +0.2185, -0.7836, -0.2562, -0.5589, -0.0523, -0.5152, +0.1166, +0.2566, -0.4698, +0.1755, +0.2976, -0.2948, -0.0285, -1.5112, +0.1225, -0.0690, -0.0911, +0.1124, -0.3546, +0.0632, +0.4610],
[ -0.1956, +0.0370, -0.0308, -0.1817, +0.1882, -0.1052, -0.0503, +0.3709, -0.2240, -0.0828, -0.8304, +0.0044, +0.0459, +0.0761, +0.0206, +0.1419, +0.4986, -0.0567, -0.3287, -0.7981, -0.2592, -0.7543, -0.4157, -0.0182, -0.0886, -0.7827, +0.0057, -0.0465, -0.3869, -1.4567, +0.2595, +0.0849, -0.8865, +0.0156, -0.1862, +0.2267, +0.4277, +0.2811, -0.8963, -0.2927, +0.1019, -0.1663, -0.8428, -0.2191, +0.4336, -0.9808, -0.8575, +0.1630, +0.0028, -0.4473, +0.5544, -0.2155, +0.0422, +0.1349, -0.3771, -0.0671, -0.0194, +0.2140, -0.3160, -0.5825, +0.3150, -0.0496, -0.0514, -0.2068],
[ +0.2710, +0.2079, -0.7397, -0.5588, -0.3865, -0.3099, +0.3502, -0.0669, -0.0064, +0.1037, -0.8617, -0.3000, -0.2977, +0.2392, -1.4580, +0.3477, +0.0329, -0.5653, -0.6458, -0.2955, +0.1288, +0.1199, -0.5390, +0.1431, +0.1088, -0.5537, -0.0880, -0.3841, +0.0801, -1.8213, -0.5604, -0.9688, +0.3403, +0.7033, +0.7676, -0.0232, +0.1272, -0.0812, +0.0785, -0.0681, +0.3825, -0.1818, +0.0268, +0.0546, +0.0451, -0.4763, -0.0513, -0.3287, +0.5841, -0.1963, +0.1147, +0.1113, -0.5448, -0.3498, -0.0750, -0.0585, -0.5094, +0.0116, +0.6219, -0.1440, -0.0742, -0.1261, +0.0572, +0.4366],
[ +0.0369, -0.3345, -0.0768, +0.4205, -0.1390, -0.2384, -0.1629, +0.0786, +0.6107, -0.2725, +0.0444, +0.2727, +0.3295, +0.3000, -0.4049, +0.1150, -0.7289, -0.5964, +0.1346, +0.0574, -0.1202, -0.2461, -0.1504, -0.1282, +0.5685, -0.3631, +0.4576, +0.6880, +0.2554, -0.1782, -0.2704, -0.5299, +0.0232, -0.4567, -0.1116, -0.2672, +0.4286, -0.0448, +0.2230, +0.0236, -0.0343, -0.0985, +0.8088, +0.2633, -0.7682, -0.0642, +0.0384, +0.0750, +0.0595, +0.1717, +0.5152, +0.2972, +0.0325, +0.0450, +0.2534, -0.1186, +0.1540, -0.0107, -1.5430, -0.1050, +0.4161, +0.0592, +0.0044, +0.0843],
[ +0.1402, +0.1111, +0.4706, +0.3944, -0.1486, +0.1623, -0.1863, +0.0468, -0.4898, -0.0224, +0.2583, +0.1336, -0.1123, +0.0581, -0.0853, -0.0288, +0.0372, -0.1358, -0.0016, -0.5055, -0.2581, -0.3232, +0.0418, -0.5329, +0.0167, -0.1626, +0.0284, -0.8795, +0.1812, +0.1044, +0.3439, -0.3482, -0.1301, +0.1099, -0.3284, -0.3683, -0.0479, -0.2303, -0.2175, +0.2400, +0.4435, +0.0818, +0.3271, -0.0304, -0.4587, -0.3401, +0.1851, +0.1210, +0.0699, +0.2149, +0.3445, -0.3352, -1.0872, +0.1455, +0.2182, -0.7787, -0.4760, +0.0306, -0.2152, +0.1286, +0.1384, -0.0821, +0.1290, -0.0055],
[ -0.3143, -0.1360, -0.4878, +0.1358, +0.5162, -0.0948, -0.1355, +0.0911, +0.3592, +0.3475, -0.5666, -0.1593, +0.1584, +0.3172, -0.0814, -0.1594, +0.1179, -0.6127, -0.3628, +0.1970, -0.6501, +0.1911, +0.4294, -0.2048, +0.3984, -0.0478, +0.1101, -0.5869, +0.4901, +0.2732, +0.1232, +0.4142, -0.1033, -0.7990, -0.2998, -0.2509, +0.2344, -0.2567, -0.0217, -0.0533, +0.0065, +0.2979, +0.1800, -0.0104, +0.1369, -0.0922, +0.0936, -0.7170, -0.0760, +0.8108, -0.5491, +0.6483, -0.2240, +0.3839, +0.1498, -0.3039, -0.1461, +0.6054, -0.2897, -0.0078, -0.5547, -0.2711, +0.0759, +0.3237],
[ +0.5616, +0.6020, +0.1514, -0.0995, -0.2372, +0.0439, +0.1131, -0.4839, -0.0951, +0.0364, -0.5441, +0.4846, -1.2297, +0.0283, +0.0222, -0.0880, -0.2479, -0.9553, -0.3495, -0.2920, +0.1952, +0.1342, -0.0358, +0.0231, +0.2965, +0.1285, -0.6684, -0.1393, +0.0285, -0.2817, +0.4368, +0.2012, -0.2838, +0.4132, +0.1914, +0.0013, -1.7082, -0.0351, -0.4860, +0.7094, -0.2159, -0.1761, -1.0276, -0.1694, -0.3221, +0.0570, -0.4394, -0.2167, +0.4231, -0.1657, +0.6024, -0.2707, -0.8380, -0.3110, -0.2727, -0.0000, +0.0231, -0.1633, -0.1836, -0.2276, -0.4032, +0.1383, -0.1814, +0.0089],
[ -0.5613, +0.4738, -0.0094, +0.1051, -0.1535, +0.4020, +0.1245, -0.2956, -0.3178, +0.2353, -0.1440, -0.4745, +0.5712, -0.6119, -0.2502, +0.1111, -0.2901, +0.1149, -0.2184, +0.0947, -0.2306, +0.0607, +0.5822, +0.1520, +0.3781, +0.1310, -0.1419, -0.3509, -0.0049, -0.1097, -0.0186, +0.1534, +0.0022, -0.0835, +0.1862, -0.2482, -0.1495, +0.1222, +0.4941, +0.1029, -0.7218, -0.3025, +0.1426, +0.5004, -0.0558, +0.2425, +0.0040, +0.1861, +0.2947, +0.1472, -0.1007, +0.4316, +0.2087, +0.1794, -0.3261, +0.3879, +0.3172, -0.1491, -0.2332, -0.1210, +0.1350, -0.6219, -0.1570, -0.3347],
[ -0.3358, -0.0382, -0.7346, +0.4532, +0.1010, +0.1139, +0.2213, -0.1050, -0.0101, +0.3208, -0.0250, -0.7625, -0.2357, -0.4067, +0.3186, -0.9441, -0.0734, +0.0728, +0.0527, -0.0968, -0.0641, +0.2877, -0.0233, +0.0247, -0.1409, +0.1281, +0.0714, -0.0970, -0.4026, -0.3684, +0.3176, -0.1875, +0.5452, +0.0015, -0.0651, +0.1397, +0.1550, -0.2029, +0.1350, +0.5028, -0.4886, +0.0630, +0.1046, +0.5003, -0.5631, -0.1724, +0.2490, -0.0635, +0.2186, -0.6167, +0.2855, -0.0579, -0.3821, +0.0562, +0.3526, +0.1313, -0.1232, +0.5154, +0.2603, -0.0256, -0.0428, -0.4523, +0.1544, +0.4509],
[ +0.4364, +0.1492, -0.8081, -0.7765, +0.6166, -0.1982, -1.1432, +0.1429, -0.2398, +0.5563, +0.6239, -0.5039, +0.5798, +0.2796, -0.1920, +1.1087, -1.2430, +0.3100, -0.1673, -0.2110, -0.1677, -0.2675, -0.6310, +0.4756, -0.9587, +0.2184, -0.4932, +0.1294, +0.3719, -0.4294, -0.5482, -0.0035, -0.8373, -0.8548, -0.3245, -0.0418, -0.0565, +0.1039, +0.0908, -0.7536, -0.2366, +0.3019, +0.2688, -0.5386, +0.1596, -0.1945, +0.6900, -0.8411, -0.2744, -1.1320, +0.0096, +0.0270, +0.4991, -0.1475, -0.0282, -0.0996, -0.1922, +0.1317, +0.0331, -0.1740, +0.0127, -0.5657, -0.0071, +0.3783],
[ -0.9835, -0.0852, +0.0673, +0.3608, -0.5972, -0.6473, +0.2292, -0.8121, -0.2935, +0.3361, +0.1431, -0.9612, -0.4476, -0.3111, -1.0042, -0.3003, +0.0550, -0.4980, -0.1894, -0.2824, +0.2057, +0.4801, +0.2026, -0.0641, -0.5990, +0.2153, +0.1995, +0.2198, -0.3514, -0.0224, -0.1561, -0.9427, +0.5208, +0.2935, +0.3871, -0.1506, -0.0125, +0.6396, -0.0254, +0.4302, -0.3523, +0.0043, -0.0100, +0.3120, -0.1009, -0.9246, +0.0267, -0.1770, -1.4509, +0.0446, -0.3987, -0.0527, -0.3977, -0.8643, +0.0371, -0.2630, -0.0853, +0.1048, +0.0452, -0.5723, -0.0805, -0.0452, -0.0489, +0.3637],
[ -0.1134, +0.1550, -0.0273, -0.5159, -0.1409, -0.0753, +0.3230, -0.4589, +0.2979, +0.1357, +0.1507, -0.9132, -0.9848, -0.0549, -0.1922, +0.1292, -0.2662, -0.0223, +0.1236, -0.1861, +0.1619, +0.3042, +0.2029, -0.1568, +0.1171, +0.2165, +0.3397, +0.4358, -0.0830, -1.0290, +0.2147, +0.1445, -0.0959, +0.4696, +0.1496, +0.2696, -1.2499, +0.0610, -0.7221, -0.5853, +0.1479, -0.7158, -0.9965, +0.4685, +0.1279, +0.2654, -0.2122, -0.2593, -0.0377, +0.1686, +0.2055, -0.4425, -0.3739, -0.5889, -0.2026, +0.0867, +0.1399, -0.2259, -0.1120, -0.7030, -0.2465, +0.1833, -0.4158, +0.2191],
[ -0.3483, +0.1839, +0.0828, -1.1050, -0.1233, +0.1977, +0.1525, +0.4061, +0.5995, +0.0719, +0.2548, -0.7088, +0.0960, +0.8649, -0.4205, +0.0785, -1.6571, +0.3270, +0.1325, -0.3489, -0.1474, +0.4878, +0.6677, +0.1169, +0.0927, -0.7217, +0.2176, +0.4076, +0.2830, +0.1905, +0.2715, +0.0414, +0.0528, +0.2191, -0.0137, -0.6578, +0.0925, -0.0096, -0.0277, +0.3254, -0.1541, -0.1264, +0.3611, +0.4325, -0.5513, +0.5342, +0.5277, +0.0938, +0.1011, -0.3802, -0.3093, -0.3772, +0.2394, -0.0069, +0.2487, -0.0366, -0.2062, -0.4031, +0.1757, +0.1664, -0.6083, -0.4812, +0.3686, -1.8912],
[ +0.4638, -0.6215, -0.9444, -0.2262, -0.0024, -0.1107, +0.2688, -0.8943, +0.2925, +0.0938, -0.2213, -0.0040, +0.5671, +0.1933, -0.1180, +0.8275, -0.4667, +0.4134, +0.2031, -0.7823, -0.2169, -0.0449, -0.0460, +0.2337, -0.6242, +0.1746, +0.1719, -0.3266, -0.0035, -2.0916, -0.9540, -0.4786, +0.1893, +0.0484, -0.2314, +0.0707, +0.6548, +0.1558, -1.5931, -0.1063, -0.0078, -0.1189, +0.2243, -0.4626, +0.9811, +0.0963, +0.3128, +0.2263, -0.1932, +0.2922, -0.8837, +0.4654, +0.3331, -0.7873, -0.1036, +0.1652, -0.3548, -0.6482, -0.3590, -0.4473, -0.5732, -0.6507, +0.0124, +0.3495],
[ +0.2305, -0.0983, -0.6019, +0.0341, -0.0379, -0.3943, +0.2129, -0.1420, -0.4793, +0.1007, +0.0970, -1.2953, +0.1626, +0.1505, -0.0289, -0.0156, -0.8020, -0.5636, -0.3583, -0.5833, -0.0779, +0.0571, -0.6464, -0.3262, -0.0799, +0.1420, -0.2370, +0.2553, -0.0499, +0.0923, -0.0051, +0.1285, +0.3178, +0.4984, -0.8847, +0.0226, -0.0542, +0.0218, +0.1203, -0.3696, -0.1743, +0.2263, -0.2901, +0.2136, -0.1456, -0.1032, -0.3173, +0.2449, +0.3368, -0.0686, +0.2705, -0.3874, -0.0087, +0.1807, +0.1054, -0.5347, -0.4611, -0.0363, +0.3767, -0.4282, +0.2581, -0.1649, +0.2136, +0.2720],
[ +0.0920, -0.0227, +0.2435, -0.0693, -0.1166, +0.4459, +0.0340, +0.1341, +0.0651, -0.4839, -1.2283, -0.3406, -0.0625, -0.1543, -0.5159, -0.1331, -0.1011, +0.1511, +0.1291, -0.3677, +0.1103, +0.3123, -0.0555, +0.0921, +0.2083, -1.2922, +0.4564, +0.2563, -0.3195, -1.2801, +0.2871, -0.2701, -1.0224, -0.4784, +0.2698, +0.0970, -0.3113, -0.2468, -0.5107, -0.1610, -0.0608, -0.5730, +0.0112, -0.3562, +0.0284, +0.3547, -0.1682, -0.4646, -0.5916, +0.0556, -0.4088, +0.3740, +0.1835, +0.2922, -0.2365, -0.0748, +0.3475, -0.1332, -0.0565, -0.6135, -0.2440, -0.0980, +0.0177, +0.2084],
[ +0.5078, +0.2882, -0.1070, -0.2375, +0.1945, -0.1556, -0.1868, +0.4579, -0.1407, -0.3003, +0.5034, -0.1413, -0.1191, +0.5198, -0.0995, +0.2052, -0.6323, +0.3269, +0.1478, -0.9499, -0.0894, -0.5471, -1.0356, -1.0237, +0.1626, +0.0408, -1.5120, +0.5972, -0.2106, -0.1963, -0.2037, +0.4696, +0.0170, +0.3471, +0.6302, +0.3234, +0.0171, +0.2163, -0.2019, -0.8498, -0.7691, +0.0792, +0.1790, -0.2880, +0.1583, -0.2802, +0.3539, -0.2478, +0.2920, -0.8338, +0.3591, -0.6136, -0.0626, +0.5065, +0.3065, -0.3856, -0.7768, +1.0600, -0.3624, +0.4283, +0.6014, -0.2987, -0.5462, +0.5388],
[ -0.1657, +0.2175, +0.1502, +0.1590, +0.2511, -0.1747, +0.0322, +0.0047, -0.1304, +0.1304, -0.2217, +0.2689, -0.0998, +0.0495, +0.5198, -0.4353, +0.3513, -0.3965, -0.7116, +0.1963, -0.2455, +0.1669, +0.0317, +0.0209, -0.9937, +0.0478, -0.1112, +0.0802, -0.0946, +0.2395, -0.4575, +0.2455, -0.0041, +0.2040, -0.1288, +0.4845, -0.0935, +0.1073, -0.1772, -0.0717, +0.1100, -1.2535, -0.4555, +0.1200, +0.0925, +0.2260, -0.3057, +0.1682, -0.7064, +0.0541, +0.2077, -0.6310, +0.1636, +0.4050, +0.0783, -0.2254, -0.5860, +0.0542, -0.1233, +0.0088, -0.1021, -0.4150, -0.5846, +0.0780],
[ +0.0137, +0.1261, +0.2534, +0.0314, +0.1516, +0.2854, -0.2887, -0.0637, -0.1735, +0.0230, -0.2352, -0.2550, -0.4087, -0.1375, +0.5831, -0.4667, -0.1422, -0.0267, -0.1625, -0.4943, +0.0660, -0.0611, -0.2226, -0.1747, +0.2218, +0.0342, -0.0662, -0.5225, -0.2543, -0.3675, +0.2921, -0.5501, -0.6124, -1.0240, -0.0340, +0.3921, +0.0436, -0.1442, +0.1874, +0.3041, -0.1329, +0.0904, -0.4785, -0.1100, +0.7130, -0.9416, -0.3120, -0.3972, -0.0667, -0.2238, +0.5337, +0.2120, -0.3086, +0.1386, +0.0945, -0.0784, +0.0060, +0.3076, +0.1153, -0.8886, +0.2775, -0.3114, +0.1672, +0.2318],
[ +0.0146, -0.1282, -1.1506, +0.1754, +0.0246, -0.4277, +0.1070, -0.5093, -0.0829, -0.9763, -1.5423, +0.0999, +0.1235, -0.5906, -0.0747, +0.0536, -0.0421, +0.0307, +0.2496, +0.1554, -0.0956, +0.2644, +0.0617, -0.0836, -0.8209, +0.2670, -0.0349, -0.7920, -0.0636, -0.5876, -0.5698, -0.2682, -0.3274, +0.2240, -0.0315, -0.3318, -0.1250, -0.1955, -0.2965, +0.2306, -0.0729, -0.2693, -0.2185, +0.1496, +0.1656, +0.2526, -0.3052, -0.1906, -0.3483, -1.2051, +0.3049, -0.1922, -0.3015, -0.4155, -0.3547, +0.0109, -0.4658, -0.7525, -0.4770, -0.5124, +0.1414, -0.1773, -0.5394, +0.0918],
[ -0.9757, +0.5451, -0.1582, -0.0760, +0.2780, +0.0088, -0.5886, +0.7647, +0.0055, +0.2014, +0.2445, -1.4211, -0.0321, +0.2212, +0.4337, -0.5242, -0.2517, +0.1777, -0.0283, -0.4325, -0.0527, -0.3353, -0.1614, -0.7283, +0.6176, -0.4128, -0.2551, +0.1218, -0.2137, -0.5500, +0.2138, -0.5199, +0.1999, +0.5070, +0.8055, +0.4022, -0.0963, -0.0710, -0.6852, -0.1077, +0.1993, -0.0105, +0.1279, +0.0083, -0.2906, -0.6892, -0.5177, -0.5738, -0.0834, -0.1992, -0.2419, +0.5335, -0.1230, +0.1839, -0.2993, +0.4106, -0.7241, +0.3990, +0.1751, +0.2938, +0.0499, -1.0744, -0.2422, -0.4619],
[ -0.4866, -0.3855, -0.1042, -0.1423, +0.2359, +0.2600, -0.1206, -0.1596, -0.0135, -0.7623, +0.8498, -0.4058, -0.2221, -0.2718, -0.2202, -0.0022, -0.3595, -0.5880, -0.2412, -0.0803, +0.2923, +0.0932, -0.0245, +0.0494, -0.0914, +0.0065, -0.1044, +0.2288, -0.2645, +0.1512, -0.7647, +0.4264, +0.5612, -0.1165, +0.0498, +0.2486, -0.4278, -0.5425, +0.2555, -0.2089, +0.1553, +0.2537, +0.6342, -0.6339, -0.3252, +0.4005, +0.3177, -1.0503, -0.0484, -0.6869, -1.2052, +0.0518, -0.2127, +0.6565, +0.1174, -0.0542, +0.0330, -0.3769, -0.8160, -0.3341, +0.5011, -0.2296, -0.0582, +0.2720],
[ -0.2740, -0.4031, +0.1220, +0.2121, -0.2756, -1.1033, -0.7286, -0.1866, +0.3279, +0.2347, -0.6916, +0.0782, -0.3519, +0.5791, -0.0632, -1.1896, -0.5604, -0.2738, +0.2529, +0.0344, -0.0932, -0.1923, -0.1518, -0.0706, +0.1075, +0.2185, -0.3537, -0.3668, -0.5451, +0.7531, -0.2921, +0.9216, -0.6654, -0.4376, +0.0435, -0.4269, +0.0265, -0.4000, -0.5693, -0.2149, +0.0681, -0.1618, -0.1684, -0.1539, -0.0432, +0.0356, +0.1934, +0.1132, -0.8665, -0.2111, -0.0802, +0.0847, +0.2886, -0.2710, -0.1154, -0.1229, +0.0220, -0.2838, -0.2988, +0.2642, -0.1269, +0.0378, -0.0577, +0.2332],
[ -0.0167, -0.2866, -0.5837, -0.3393, -0.2001, -0.2052, -0.0069, -0.0557, +0.0957, -0.0296, -1.2254, +0.6089, -0.7623, +0.2794, -0.1563, -0.5299, -0.2602, +0.3578, +0.2024, -1.1151, -0.7019, -0.3572, -0.2302, -0.0681, +0.1533, -0.3679, +0.3212, -0.0854, -0.3797, -1.4589, +0.2442, -0.7591, -0.5560, -0.1719, -0.4811, +0.0760, +0.2026, -0.0090, +0.3387, +0.5250, -0.3101, -0.5067, +0.6807, -0.2780, +0.1402, +0.0732, -0.0141, -0.5621, -0.5418, -0.1793, -0.1043, -0.1398, -0.2086, +0.0398, +0.5175, -0.0853, +0.2001, +0.0463, +0.0370, -0.1317, -0.5319, +0.1052, -0.3744, -0.0245],
[ -0.2261, +0.1322, +0.2244, +0.0686, +0.6216, +0.2085, -0.2037, -0.6063, -0.1096, -0.3126, +0.4351, +0.3109, -0.1477, -0.0571, +0.4007, -0.3581, +0.3124, +0.2700, +0.3172, -0.5340, +0.2530, +0.1908, +0.0630, +0.4039, +0.2531, +0.1035, +0.5428, +1.0849, -0.6678, -0.1461, +0.1677, +0.6444, -0.1607, +0.0921, +0.0428, -0.4171, +0.0052, -0.6449, +0.5795, +0.3778, -0.2117, +0.6219, +0.4147, -0.2854, +0.0800, +0.2086, +0.1057, +0.0211, +0.1335, +0.0754, -1.0412, +0.3630, -0.3308, -0.0163, +0.3209, +0.6749, +0.1818, +0.0622, +0.0631, -0.0780, -0.2003, +0.0502, -0.1801, +0.1226],
[ -0.5705, -0.4520, -0.2005, -0.1099, +0.0716, +0.1710, -0.5488, -0.0350, +0.3769, +0.5694, +0.2142, -0.2680, +0.3770, +0.0675, +0.1544, -0.1849, -0.1091, -0.8965, +0.2643, +0.0145, -0.1163, +0.0022, +0.0120, +0.4676, +0.0786, +0.0047, -0.0236, +0.2523, -0.0296, -0.1272, -0.1784, -0.0316, -0.1040, -0.0833, -0.5759, +0.1137, +0.1781, -0.1794, -0.7452, +0.2339, -0.2118, -0.0421, +0.1374, -0.7774, +0.0419, +0.2437, -0.1457, -0.3050, -0.5618, -0.8883, +0.3731, +0.1214, +0.2160, -0.2766, +0.2474, -0.0136, -0.0689, +0.2249, +0.4861, +0.3022, +0.0187, +0.4610, +0.0144, -0.0760],
[ +0.0452, -0.0096, +0.0093, +0.3166, +0.0104, -0.8211, +0.0320, -0.9130, -0.9762, +0.3912, +0.0517, -0.0086, -0.1364, -0.5440, +0.3999, -0.8466, +0.1587, +0.3064, -0.0849, -1.0372, -0.3295, -0.0011, +0.0702, +0.0558, -0.3068, -0.0579, +0.1683, +0.1862, -0.3232, +0.0126, -0.0197, +0.3761, +0.3451, +0.1456, -0.1702, +0.3671, +0.2129, +0.1910, -0.4390, -0.2298, +0.2539, -0.2647, -0.0812, +0.1049, +0.0182, +0.0124, +0.1412, +0.7550, +0.1466, +0.0842, -0.2089, -0.1244, -0.1409, -0.0448, +0.4329, +0.2906, +0.1276, +0.0849, +0.1483, -0.1114, +0.1040, -0.1841, +0.0504, +0.0628],
[ -0.7229, -0.2299, +0.3797, +0.2634, +0.1779, +0.1996, -0.0516, +0.1889, -0.0321, -0.0180, +0.1005, -0.1224, -0.7053, -0.1657, +0.2718, -0.1325, -0.3542, -0.0817, +0.0660, -0.3473, -0.1094, +0.3669, +0.0287, +0.4202, +0.5254, +0.3843, +0.2454, -0.1032, -0.2225, +0.1151, +0.2620, -0.2615, +0.1377, -0.0886, +0.1253, -0.2241, +0.2043, -0.6399, -0.0001, +0.2756, -0.5004, +0.0097, +0.1577, +0.1704, -0.4630, +0.0586, +0.1950, -0.2765, +0.3850, +0.1792, -0.0390, +0.0853, +0.0609, +0.3052, +0.1366, +0.4978, -0.0320, -0.0238, -0.2433, +0.1354, -0.3672, +0.1638, +0.3015, +0.0190],
[ -0.5652, -0.5404, +0.3047, +0.2983, +0.0327, -0.2695, +0.3298, +0.0245, -0.8883, -0.2214, +0.0148, +0.2319, -0.4585, -0.4131, +0.1738, -0.0687, +0.2266, -0.0930, -0.0778, +0.0594, -0.7182, -0.5207, -0.1110, -0.6784, +0.1840, +0.4566, +0.0854, -0.0213, -0.4181, +0.1902, +0.3848, -0.3574, +0.0339, +0.0642, +0.2140, +0.2387, +0.1925, -0.4425, -0.1289, +0.0003, +0.4367, -0.1658, -0.6550, +0.0966, -0.2929, -0.0290, +0.0821, +0.0917, +0.0588, +0.0215, +0.2516, -0.6177, -0.3127, +0.1305, +0.1058, -0.2301, -0.1769, +0.3145, +0.0931, +0.0435, +0.2786, +0.4412, +0.1732, -0.1200],
[ -0.0996, -0.6608, -0.0364, +0.3340, +0.0165, +0.3010, +0.0927, +0.1056, -0.2970, -0.1835, +0.0571, +0.2240, +0.0030, -0.6368, +0.2202, -0.1890, +0.4696, -0.0632, -0.0631, +0.0907, -0.1202, -0.3129, -0.0065, -0.2858, +0.5460, +0.2200, +0.2605, +0.0594, -0.2014, +0.3389, +0.3456, -0.0752, +0.0585, -0.0157, +0.0157, +0.0445, +0.3628, -0.4249, -0.3869, -0.0149, +0.3033, -0.2029, +0.3068, +0.2245, -0.3317, +0.5013, +0.2260, +0.0021, +0.5501, +0.0470, +0.0281, -0.4652, -0.5074, +0.0623, +0.2559, +0.1474, +0.3211, +0.3766, -0.0389, +0.3026, +0.0087, +0.4048, +0.4947, -0.1758],
[ +0.1554, -0.1069, +0.0311, +0.1231, +0.1511, -0.5720, -0.2430, +0.0702, -0.3883, +0.0351, -0.4604, +0.2486, -0.1264, +0.0224, -0.4056, -0.0509, -0.2476, +0.4460, +0.3992, -1.0177, -0.4811, -0.0661, -0.4349, +0.0118, -0.3434, -0.0266, -0.4486, -0.2416, -0.2670, -0.2086, -0.6751, +0.0134, -0.0306, +0.1693, -0.1759, +0.2342, +0.0876, +0.0606, +0.5759, -0.6247, -0.0825, +0.8001, -0.4028, -0.3971, +0.4740, -0.7486, -0.1452, +0.0966, -1.1183, -1.7440, +0.3747, -0.2859, -0.4128, +0.0351, -0.1834, +0.2799, -0.5416, +0.1614, -0.1525, +0.5196, +0.1470, +0.2015, -0.0209, +0.4493],
[ +0.4452, +0.3101, -0.1846, -0.2601, +0.0557, -0.1652, +0.2796, -0.2789, -0.3574, +0.7659, -0.0928, -0.1773, +0.2040, +0.3471, +0.0277, +0.1219, +0.1127, +0.2735, -0.0420, -0.3129, -0.8266, -0.0287, -0.1716, +0.0738, -1.1224, -0.2538, -0.1206, +0.4969, +0.5520, -0.9201, -0.4422, -0.4078, -0.2800, +0.0784, -0.1056, -0.1181, -0.6464, +0.1835, -0.1094, -0.0400, +0.3895, -0.4687, +0.7645, +0.1850, +0.8089, -0.0632, +0.3379, -0.1370, -1.2702, -0.1647, -0.0076, -0.3014, +0.5104, -0.8770, -0.1667, +0.0547, -0.9042, -0.7874, +0.4112, -0.6015, +0.1230, -0.3193, -0.3689, +0.7722],
[ -0.1760, +0.0806, +0.0633, +0.1495, -0.2089, -0.1720, +0.3683, -0.7910, -0.1092, -0.0286, -0.2381, -0.3570, -0.3146, -0.4156, -0.4463, +0.2495, +0.1315, -0.4987, -0.0444, -0.3366, +0.4729, +0.5814, +0.2111, +0.5879, -0.4906, -0.2095, +0.1884, -0.8830, +0.0099, -0.5141, -0.0253, +0.0638, -0.5014, -0.6889, +0.4109, -0.3437, -0.5957, -0.3521, +0.4051, +0.1513, +0.0929, +0.2743, -0.5853, -0.0101, +0.0543, +0.0796, +0.0171, -0.1006, -0.8329, +0.3093, -0.7488, -0.1443, +0.4323, -0.3448, -0.6281, +0.4770, +0.4202, -0.8632, -0.3805, -1.1830, -0.7543, -0.5576, -0.5449, +0.2612],
[ -0.7124, +0.0296, -0.0180, +0.1221, +0.3492, -0.1979, +0.1803, -0.6664, -0.4365, +0.0834, +0.0055, +0.2783, +0.2842, -0.3726, -0.1905, -0.3562, +0.4659, +0.5841, +0.2670, +0.3766, +0.2223, -0.2560, -1.2231, +0.3688, -0.6143, -0.4259, -0.0066, -0.6308, -0.0026, -0.4631, -0.1651, -0.3861, +0.1432, +0.3695, +0.3812, +0.1687, -0.0687, +0.6742, -0.1006, -0.0740, +0.3388, -0.1572, +0.3848, +0.1060, -0.3427, -0.0441, +0.1701, -0.9669, -0.6756, -0.7418, -0.4919, +0.1873, -0.0749, -0.0006, -0.2966, -0.3439, +0.1329, +0.1904, -0.4898, -0.7065, +0.3420, -0.1842, +0.2152, -0.0524],
[ -0.0034, +0.0550, -1.2687, -0.0799, +0.3824, -0.1359, +0.2033, -0.0635, -0.1804, -0.0437, +0.1483, -0.5138, -0.7083, -0.4176, +0.4133, -0.9608, -0.1535, +0.2607, +0.1512, +0.0048, +0.1409, +0.0624, -0.2070, -0.6507, -0.1054, -0.1554, -0.9355, +0.1028, +0.6517, -0.1690, -0.0253, -0.6379, -0.4949, -0.0544, -0.0154, +0.2114, -0.2261, +0.6168, +0.0140, +0.0834, +0.2390, -0.4280, -0.5701, -0.3384, +0.3953, -0.0290, -0.0415, +0.1204, +0.0763, -0.5635, -0.6979, -0.2972, +0.1168, +0.0858, +0.5719, +0.0460, -0.1850, +0.3278, +0.2367, -0.1745, +0.3339, +0.2345, -0.7674, +0.2316],
[ -0.7640, +0.4325, -0.7808, -0.8599, +0.0685, +0.1389, -0.4254, +0.1816, +0.5504, +0.5307, -0.3181, -0.6939, -0.4922, +0.2190, -0.0280, +0.0948, -0.0696, +0.2561, -0.3489, +0.1103, +0.2562, -0.0775, -0.4995, -0.3639, +0.4419, -0.0798, +0.1815, -0.4532, +0.0092, -0.3042, -0.5383, +0.2354, -0.0964, -0.3795, +0.6289, -0.0032, +0.8141, +0.1504, +0.3532, +0.4816, -0.4394, -0.2215, -0.2689, +0.6740, -0.1720, +0.0399, -1.3940, -0.0466, -0.6636, -0.7952, +0.2715, +0.1412, +0.1164, +0.1355, -0.4197, -0.1231, +0.0225, +0.1704, -0.6381, -0.1786, +0.1951, +0.7547, +0.0585, -0.9978],
[ +0.2424, +0.1429, -0.5942, -0.8311, -0.4039, +0.0123, -0.5286, -0.1538, +0.1444, -0.2057, +0.1541, +0.3277, +0.0325, -0.1216, -0.2855, -0.3571, -1.2245, +0.5472, +0.8566, -0.4063, -0.0020, +0.0161, -0.0828, +0.1365, -0.3165, +0.1856, +0.4180, +0.3827, +0.4085, +0.1363, -0.5951, +0.2136, +0.4635, -0.3175, -0.0179, -0.1298, +0.3717, +0.3155, +0.7539, -0.3723, -0.9288, -0.0145, +0.2546, -0.1112, +0.0629, +0.1843, +0.3677, -0.3291, -0.4158, -0.4757, -0.6994, +0.1739, +0.2550, -0.2444, +0.1263, +0.2426, +0.2999, -0.1290, -0.3900, +0.3528, +0.1145, +0.2559, -0.0819, -0.4488],
[ -0.4228, -0.1394, -0.2091, -0.0344, +0.4417, -0.0600, -0.5085, +0.2543, -0.0523, +0.3243, +0.0854, +0.2292, +0.0820, -0.0431, +0.0678, -0.0514, -0.0348, -0.0160, +0.5653, +0.1224, +0.2047, -0.1892, -0.9762, -1.0318, -0.9600, +0.2571, +0.0527, +0.2796, -0.0836, +0.0239, -0.6415, +0.2080, +0.3183, +0.1883, -1.2626, +0.2661, +0.1099, -0.3269, -0.3931, -0.2218, -0.0774, -0.1932, -0.2984, -0.2962, -0.0536, -0.4651, -0.2370, -0.1265, -0.1956, -0.5390, -0.5313, -0.4435, -0.0816, +0.1992, -0.2242, -0.5927, -0.0626, +0.1441, +0.0228, -0.1464, +0.1223, -0.0883, +0.2199, +0.1578],
[ +0.3977, +0.0629, -0.0984, -0.4987, +0.4269, -0.1940, -0.1254, +0.2561, +0.2799, -0.2491, -0.1810, +0.2404, +0.5219, +0.0879, -0.2920, +0.3293, +0.0132, +0.0919, -0.1286, +0.5001, +0.1045, -0.1544, -0.5092, -0.2277, +0.1893, -0.6046, +0.1304, +0.9889, +0.1189, +0.2228, -0.3941, -0.0629, -0.3580, -1.2052, -0.3574, -0.5456, -0.2044, -0.3054, -0.0874, -0.7163, +0.0782, +0.4724, +0.4832, -1.0618, +0.2777, -0.3273, +0.0845, +0.0028, +0.1905, +0.3128, +0.1351, +0.1499, -0.1993, +0.0798, +0.0308, -0.8532, +0.0118, -0.2095, -0.0387, +0.1203, +0.1096, -0.0137, +0.1436, -0.2861],
[ -0.2417, -0.0439, +0.1189, +0.2369, -0.2781, +0.3031, +0.0773, +0.6085, +0.0232, -0.1423, -0.6961, -0.8309, -0.6136, -0.2563, +0.0283, -0.1212, -0.4166, -0.0050, +0.0318, +0.0260, -0.2687, -0.1907, -0.2317, -0.6242, +0.4980, -0.2121, -0.2454, -0.8505, -0.6092, -1.1722, +0.5666, +0.1006, -0.1905, -0.0702, +0.0700, +0.0617, +0.1817, -0.2282, +0.0176, -0.2242, +0.1264, -0.2623, -0.7171, -0.1821, -0.3619, -0.1819, -0.2828, -0.2249, -0.0303, +0.0185, +0.2609, -0.0549, -0.0996, +0.4723, -0.3633, +0.0846, +0.0765, +0.3280, -0.2451, +0.1041, -0.0034, +0.2080, +0.1936, -0.4749],
[ -0.4080, +0.0101, +0.4896, +0.2650, -0.0713, -0.4852, -0.4725, -0.1664, +0.1746, -0.1745, +0.1742, +0.0886, -0.0533, -0.2693, -0.1717, -0.1211, -0.5343, -0.2970, -0.2407, -0.0890, +0.2510, +0.1665, -0.0280, -0.5085, -0.0720, +0.0815, +0.0286, -1.0586, -0.0480, +0.6197, -0.1686, -0.0971, -0.0590, -0.0530, -0.5561, +0.2351, -0.8316, -0.4513, -0.0833, +0.3241, -0.2440, +0.0885, -0.0566, -0.0628, +0.0390, +0.0530, +0.1303, +0.2249, +0.3535, -0.1897, -0.0028, -0.4503, -0.4608, -0.4771, +0.0547, +0.1368, -0.0396, -0.0574, -0.7205, -0.0545, +0.3713, -0.1449, +0.0460, -0.2573],
[ +0.1729, +0.3328, -0.0483, +0.3430, -0.8166, -0.7130, -0.1524, -0.8914, -0.0284, +0.3845, +0.3261, -0.2930, -0.1704, -0.0667, -0.0761, -1.0040, +0.5002, +0.0138, +0.0480, -0.1500, -0.1398, +0.1682, +0.4195, -0.2878, -0.4181, -0.5565, +0.1091, -0.2138, -0.0314, -0.9147, -0.2513, +0.0348, -0.1134, -0.1961, +0.5464, +0.2765, +0.0357, -0.5474, -0.6593, -0.0637, -0.5578, +0.0965, -0.3782, -0.0283, +0.1986, -0.7640, -0.2243, +0.1620, -0.4975, +0.4370, -0.0027, -0.4728, -0.5417, +0.1895, +0.4871, -0.7267, -0.0884, -0.4895, -0.3184, -0.2400, +0.5365, -0.6006, -0.0316, -0.2627],
[ -0.1250, -0.2274, -0.4734, -0.8212, -0.8737, -0.2582, -0.1367, +0.0765, +0.1154, -0.0014, +0.1208, -0.0270, -0.0425, +0.3288, -0.1526, +0.3159, -0.3454, +0.3237, +0.0894, -0.5365, +0.1782, -1.0302, +0.0365, -0.2069, +0.1498, -0.5999, -0.2724, -0.1894, +0.4306, -0.3260, -0.3904, -0.0550, -0.2776, -0.2343, +0.4672, -0.1577, -0.2296, +0.2996, -0.6247, -0.2263, -0.4007, -0.2281, -0.0291, -0.6503, +0.3853, -0.7961, +0.3894, -0.0580, -1.3425, -0.2164, -0.1007, +0.1227, -0.4520, +0.1167, +0.1217, +0.1238, +0.0792, -1.1752, +0.1036, +0.0568, -0.3924, +0.0349, -0.5209, +0.3545],
[ +0.0287, -0.3782, +0.1962, -0.1268, +0.3571, -0.0019, -0.0362, -0.0845, +0.3061, +0.2659, -0.5059, -0.1129, -0.4579, +0.2661, +0.0929, +0.0436, +0.0056, +0.2657, +0.3845, -0.5530, +0.1714, +0.4608, +0.2531, +0.3154, +0.0426, +0.5664, +0.2775, -0.1081, +0.2637, -0.1573, -0.2128, +0.0684, -0.4874, -0.0263, -0.0327, -0.0933, -0.1256, -0.7359, -0.0188, +0.5449, -0.1793, +0.2461, +0.1168, +0.1503, +0.4420, +0.0875, -0.4102, +0.0356, -0.2893, +0.2913, -0.8194, +0.4889, +0.0413, +0.3302, -0.2903, +0.0952, +0.0212, +0.3041, +0.1542, -0.4005, -0.2331, -1.3377, +0.1470, -0.7202],
[ -0.9282, -0.1059, -0.0082, -0.1766, -1.3977, -1.3125, +0.3087, -0.3368, -0.6917, +0.0534, +0.0881, -0.7281, -0.4862, +0.0312, -0.8796, -0.0374, -0.0516, -0.3584, -0.9422, -0.8726, +0.0645, +0.0442, -0.2800, -0.3980, -0.1358, +0.4521, +0.1079, -0.1224, +0.1390, -0.5237, -0.2044, -0.8309, +0.2561, +0.4951, -0.7866, -0.1615, -0.2310, -0.2373, +0.0514, +0.2622, -0.4641, -0.1833, -0.1839, -0.0406, -0.3321, -0.2933, -0.0421, +0.1813, -0.2127, -0.1382, -0.0012, -0.6567, -1.4080, -0.3627, +0.3178, -1.2242, -0.9392, -0.1510, +0.2459, -0.0221, +0.4568, -0.4586, -0.0793, +0.3680],
[ -0.3041, +0.2604, -0.2652, +0.6025, +0.0916, +0.0136, -0.2971, +0.3269, +0.0725, -0.2456, -0.3518, +0.2903, +0.1801, -0.6663, +0.3020, +0.1644, +0.3541, -0.2844, -0.5166, -0.1280, -0.0661, +0.5309, +0.2226, +0.0688, -0.1076, -0.0739, +0.1466, +0.5006, -0.0508, -0.1852, +0.0641, +0.0069, -0.6020, -0.2326, -0.1071, -0.1683, +0.1069, +0.3673, -0.1795, -0.3418, -0.0471, +0.2649, +0.0608, -0.9008, +0.1314, +0.0451, -0.4691, -0.1016, -0.5714, +0.0841, +0.1224, +0.1867, -0.0598, -0.1693, -0.3963, +0.0738, +0.5359, +0.3494, +0.1235, +0.4378, -0.0009, +0.5538, +0.4332, -0.0908],
[ -0.5524, +0.2589, +0.1305, -0.4090, -0.0750, +0.1026, +0.5287, +0.2289, +0.4169, -0.0428, -0.3602, -0.1625, +0.0370, -0.4344, -0.2947, -0.0240, +0.1273, -0.0985, -1.3586, -0.7712, -0.2291, -0.4270, +0.4181, +0.3414, +0.1665, +0.0272, +0.3223, -0.1411, -0.0644, -0.7001, +0.1848, +0.3318, -0.4295, -0.7952, -0.0880, -0.4895, +0.2159, -0.1718, -0.3125, +0.0386, -0.6332, -0.3036, -0.5912, -0.4327, -0.0451, -0.5203, -0.0132, -0.1439, -0.1113, +0.0051, +0.0134, -0.0185, -0.0601, -0.0629, -0.2407, -0.4088, +0.0155, -0.2293, -1.0280, +0.0067, +0.1398, -0.1448, +0.3806, +0.2182],
[ +0.0648, -0.0437, -0.0942, -0.2744, -0.4381, -0.2502, +0.1999, -0.1825, +0.3736, -0.5487, -0.2808, -0.8762, -0.0995, -0.7099, -0.1731, -0.0471, +0.0135, +0.3748, -0.4082, -0.2058, +0.5860, +0.4465, +0.2315, +0.1135, -0.3129, -0.8307, +0.1438, -0.6274, +0.0895, -0.1950, -0.0484, -0.2457, +0.1510, -0.8775, -0.9142, -0.1708, -0.0972, -0.6048, +0.2905, +0.5451, -0.2202, -0.3213, -0.0398, -0.3397, +0.0215, -0.1846, +0.1132, -0.0441, -0.4064, -0.2330, -0.5510, +0.4083, +0.0116, -0.1033, -0.0460, +0.1744, +0.1322, -0.7649, -0.5508, +0.6277, +0.0331, -0.4214, +0.2977, +0.3355],
[ -0.1351, -0.2439, +0.3468, +0.2800, -0.0715, +0.0273, +0.0259, +0.2220, -0.1142, -0.2086, +0.1733, -0.3081, -0.0993, +0.0308, -0.8777, +0.2663, -0.0156, -0.0179, +0.3093, +0.2105, -0.1656, -0.3246, -0.0365, -0.4435, +0.3391, -0.0303, +0.2684, -0.6413, -0.0021, -0.7990, +0.1877, -0.3394, +0.2103, +0.0907, +0.0610, +0.0687, +0.2747, -0.3606, +0.1065, +0.0569, +0.2614, +0.1773, -0.8595, +0.0669, -0.1244, -0.4618, -0.3705, -0.0510, +0.2129, +0.1995, +0.0395, -0.0747, -0.2724, +0.1117, -0.3345, -0.3311, +0.0042, +0.3678, +0.3423, +0.2525, -0.0849, +0.3778, +0.4023, -0.1001],
[ +0.1241, -0.0503, -0.0182, -0.2132, -0.2386, -0.3724, -0.2412, -0.1737, -0.1700, +0.3160, -0.0092, +0.2899, -1.5977, +0.1411, -0.7268, -0.0835, +0.5029, +0.1386, -0.0634, -0.4580, +0.1020, -0.4675, +0.5110, -0.2398, +0.3636, -0.5651, -0.1730, +0.1509, +0.3955, -1.8248, -0.0228, -0.4183, -0.2963, +0.1007, +0.4309, +0.0637, -0.0066, -0.0472, -0.1385, +0.0819, +0.0202, -0.3139, -0.0896, +0.5357, -0.7048, -0.0429, -0.1733, -0.6343, -0.2395, +0.2319, +0.1909, -0.3611, -0.0093, +0.0513, +0.2180, -0.2943, +0.1112, -0.1285, -0.6500, +0.4892, +0.0203, -1.1220, -0.0724, +0.4504],
[ +0.1112, -0.0448, -0.6431, +0.1884, +0.3960, -0.1572, +0.1121, -0.1994, -0.0486, -0.2115, -0.0936, -1.5022, -0.2118, -0.6693, +0.3676, -0.2709, -0.3703, +0.3534, -0.0593, +0.2411, -0.3764, +0.2110, +0.2070, -0.3406, -0.2990, +0.4268, -0.0408, +0.1984, -0.3161, +0.3869, -0.3141, -0.4338, +0.0395, -0.3092, +0.2746, -0.2975, -1.0016, +0.0616, -0.2120, +0.0863, -0.0899, -0.3227, -0.1391, +0.2368, -0.5746, +0.3478, +0.0162, +0.8646, -0.4043, -1.0257, +0.3557, -0.1569, +0.1722, -0.1626, +0.2160, +0.4056, -0.7633, -0.3259, -0.2412, -0.0411, -0.0130, -0.1054, -0.6206, -0.3220],
[ +0.4052, -1.3239, +0.1395, +0.1058, -0.1199, -0.1038, +0.1456, +0.3265, -0.3059, -0.7138, -0.0618, +0.3480, +0.5171, +0.0254, -0.2988, +0.2774, +0.0976, -1.0849, +0.3354, -0.0790, +0.2007, -0.1853, -0.5298, +0.0797, -0.0231, -0.7360, +0.0341, -0.2407, -0.0900, -0.2925, -0.3616, +0.1548, -0.2782, -0.0473, +0.0645, -0.1320, +0.1575, +0.0137, +0.1537, -0.3346, -0.0175, +0.1294, +0.2803, +0.2576, -0.1722, -0.4272, +0.1171, +0.0722, +0.1484, -0.6063, +0.0117, -0.1859, -0.8487, +0.4184, -0.0151, +0.1533, +0.1805, +0.0843, -0.2879, +0.1382, -0.2115, -0.0440, +0.0444, -0.0504],
[ +0.2015, -0.0965, -0.1258, +0.1679, -0.1030, -0.0350, -0.6746, -0.3363, +0.0040, -0.4968, -0.5428, +0.0732, +0.1692, -0.2251, -0.1405, -0.8176, -0.8816, -0.2601, -1.5304, +0.1403, +0.0187, +0.2748, -0.3534, -0.5089, -0.3561, +0.0367, -0.1690, -0.1544, +0.0946, -0.2731, -1.0779, -0.0782, +0.0202, +0.2626, -0.1983, -0.0035, +0.0846, +0.2907, +0.3259, -0.2063, -0.2135, -2.0981, -0.0221, +0.0993, +0.0145, +0.1018, -1.0300, +0.1958, -0.4191, -0.1791, -1.3965, -0.0060, -0.2669, +0.1638, -0.2012, +0.1843, +0.0784, +0.2943, -0.7675, +0.2927, -1.4470, +0.0775, -0.3201, -0.3827],
[ +0.0769, +0.5498, -1.0880, -0.2418, -0.2665, -0.2998, -0.1256, -0.6255, -0.3412, -1.4133, -0.0203, -0.0106, -0.3917, -0.8333, +0.4150, -0.3510, -0.5165, -0.4994, -0.7379, +0.3555, -0.0781, +0.0691, +0.6025, -0.1950, -0.5176, -1.1022, -0.2531, +0.1358, -0.7036, -0.2015, -0.3584, -1.2470, -0.1838, -0.2505, -0.1474, -0.4272, +0.2569, -0.5964, -0.9194, -0.0551, +0.3572, -0.0710, +0.1742, -0.4531, -0.3903, -0.3115, -0.1155, -0.2580, -0.7872, +0.2532, -0.1176, -0.1610, -0.7792, -0.6183, -0.4232, +0.3920, -0.2407, -0.8548, +0.3624, +0.3435, -0.8205, -0.2136, -0.2942, -0.8762],
[ -0.0060, -0.1489, -0.0067, -0.0177, +0.2215, -0.0389, -0.5227, -0.2337, -0.2741, +0.0386, -0.3261, -0.0032, -1.0200, -0.1971, -0.2788, +0.1595, -0.2238, +0.0137, -0.0144, -0.2236, -0.2323, +0.2903, +0.3488, -0.2384, +0.1007, +0.2121, +0.3509, -0.4017, +0.0860, -0.7740, +0.0739, -0.8059, -0.0612, -0.0426, +0.2213, +0.2794, -0.1782, -0.0981, +0.0738, -0.1360, +0.0495, +0.1766, -1.0368, +0.0651, -0.1478, -0.3529, +0.6294, -0.0024, +0.0441, -0.2223, +0.2321, +0.5418, -0.3990, -0.1180, +0.2173, +0.0073, +0.0535, +0.0381, +0.0572, +0.1349, +0.1543, -0.0255, -0.0671, -0.3958],
[ +0.0025, +0.2615, +0.2055, -0.3618, +0.2058, -0.0355, +0.2262, +0.1584, -0.2848, +0.3526, -0.1021, +0.4582, -0.2301, +0.8823, -0.3449, +0.7340, -0.2356, -0.1065, -0.1333, +0.1678, +0.0023, -0.5715, +0.0944, -0.2364, -0.0328, -0.1789, -0.7771, +0.0033, +0.6611, +0.1509, -0.0369, -0.1838, -0.0900, +0.0302, +0.4032, +0.3461, -0.3497, +0.3714, -0.2241, +0.3681, -0.1810, +0.1401, +0.4326, -0.3580, +0.1228, -0.5266, +0.1445, -0.1295, -0.7390, -0.0307, +0.2383, -0.3647, +0.8082, -0.2832, -0.1272, -0.6293, -0.0267, +0.0772, +0.5436, -0.4430, +0.2039, -0.0094, -0.4602, +0.3507],
[ +0.4441, -0.5284, -0.3247, -0.1185, +0.1127, +0.2549, -0.1608, +0.0508, -0.1256, +0.1456, +0.0630, -0.3331, +0.2147, -0.1859, -0.1065, -0.8297, -0.8537, -0.5747, -0.2079, -0.2383, -0.0755, +0.2487, +0.4479, +0.2179, -0.4586, -0.0045, +0.0736, +0.0240, -0.1013, +0.1411, -0.3923, +0.0215, -0.2443, -0.9218, -0.0136, +0.2523, -0.3079, +0.2825, +0.4820, -0.0487, -0.4192, +0.3460, +0.2341, -0.1544, -0.1730, +0.1748, +0.4015, -0.0670, -0.4138, -0.7546, -0.0984, -0.1398, -0.1484, +0.2143, +0.3287, +0.3576, -0.1715, -0.4426, -0.1114, +0.2873, -0.1759, -0.2131, -0.3125, +0.2399],
[ -0.3040, -0.7858, -0.0431, +0.2444, -0.4689, +0.5505, -0.0415, -0.2255, +0.4772, -0.9782, -1.3075, -0.7475, -0.2918, -0.4632, -0.4139, -0.2807, -0.9729, +0.0464, +0.2641, -0.0045, +0.2904, +0.2615, -0.4323, -0.2294, +0.4595, -0.4169, +0.2735, -0.7092, -0.8494, -0.9467, +0.0363, -1.6053, -0.0743, +0.1101, +0.2005, -0.1111, -0.2316, +0.3037, -0.0224, +0.4787, -0.1178, -0.2842, -0.1521, +0.0089, +0.0149, +0.2476, -0.3097, +0.4197, -0.0513, -0.3052, -0.1770, +0.0698, -0.0028, -0.7217, -0.0423, +0.0789, +0.0522, -0.4582, -0.0321, +0.8307, +0.2203, -0.0733, +0.3136, +0.0570],
[ +0.1303, +0.0891, -1.0181, -1.4978, +0.0734, +0.1124, +0.2199, +0.0153, +0.4390, -0.4317, -0.5141, -0.4691, +0.0737, +0.3579, -0.1853, -0.0772, -0.8077, -0.6385, -0.4633, +0.4321, +0.5496, +0.2986, -0.1555, -0.1559, +0.0699, -0.3715, -0.2052, -0.2325, +0.3984, -0.4306, -0.6361, -0.3066, -0.4227, -0.7002, -0.5833, -0.0950, -0.2275, -0.2462, -0.2574, +0.3585, -0.2933, -0.1192, +0.4343, -0.5342, +0.1994, +0.3493, -0.7433, +0.0396, -0.2139, -0.7354, -1.5901, +0.2998, +0.2103, -0.2378, -0.3848, -0.1763, +0.5698, -0.8950, -1.7041, +0.2384, -0.1701, +0.1376, +0.3842, -0.8876],
[ -0.1219, +0.3198, -0.2701, +0.1497, -0.1258, +0.3358, -0.4570, -0.4552, +0.5140, -0.1106, -0.5427, -1.0853, -0.1620, +0.1679, -0.7057, -0.5208, -1.5624, -0.6301, -0.6283, +0.0699, -0.1598, -0.1935, +0.0253, +0.1096, +0.0912, -0.0082, +0.0710, -0.9496, -0.0222, -0.3077, -0.4092, -0.1090, -0.1891, -0.0032, +0.4414, -0.4561, -1.1972, +0.4971, -0.0040, +0.0863, -1.3692, -0.1463, -0.1298, +0.3283, -0.2834, -0.0431, +0.0177, +0.0811, -0.2410, -0.0614, +0.2315, +0.3008, -0.6321, -0.8940, -1.5395, -0.6845, -0.5164, +0.5963, -0.1694, +0.0239, +0.3146, +0.5295, -0.1202, -0.2046],
[ -0.4515, -0.5445, -0.4470, +0.1876, -0.0639, -0.2497, +0.2629, +0.2056, +0.4504, +0.1000, -0.1992, -0.1178, +0.5982, +0.1020, +0.2526, -0.5141, -0.3257, +0.2873, +0.2843, +0.0204, -0.0355, +0.4963, -0.0575, -0.2666, -0.6928, -0.0279, -0.4045, +0.4385, -0.1725, +0.2043, -1.0905, +0.3458, +0.2299, -0.1574, -0.6403, +0.4463, -0.4436, -0.0591, -0.8299, -0.2485, +0.3504, -0.2333, +0.1834, +0.0245, +0.0756, -0.0047, -1.1088, -0.0788, -1.0611, -0.2504, +0.2807, +0.1821, -0.1618, +0.0871, -0.1961, -0.0566, -0.8393, -0.2867, -0.5395, -0.7387, -0.9088, +0.1558, -0.0021, +0.1817],
[ +0.2262, -0.0991, -0.7318, +0.0777, +0.0829, +0.1066, +0.0909, +0.0586, -0.1002, +0.2647, +0.3763, +0.2981, +0.2813, +0.1898, +0.2196, +0.1406, -0.2669, -0.0615, -0.4188, -0.3941, -0.2429, -0.2700, -0.6246, +0.0977, -0.0156, -0.6503, -0.3818, +0.2284, +0.2446, -0.2068, -0.0891, +0.1039, -0.5602, -0.0217, -0.0608, -0.0454, +0.0959, +0.4183, +0.2183, -0.3189, +0.1210, -0.0680, +0.1768, -0.3043, -0.2762, -0.8097, +0.4302, +0.1414, -0.6430, -0.1104, -0.3396, -0.4695, +0.4050, -0.1201, +0.0801, -0.1988, -0.0255, +0.1783, -0.0352, -0.4146, +0.1602, +0.0232, -0.4713, +0.2315],
[ -0.2409, -0.2534, +0.3787, +0.8244, +0.0585, -0.1560, +0.3867, +0.4848, +0.0786, +0.3797, -0.4736, +0.1127, -0.1765, +0.4122, -0.0028, -0.0079, +0.4908, -0.2022, +0.0382, +0.3820, +0.1218, +0.4168, +0.0748, -0.0767, +0.1911, +0.1314, -0.3224, +0.2587, +0.2849, +0.3945, +0.0604, +0.0050, -0.3590, -0.7451, -0.3942, +0.2198, +0.2039, +0.2079, -0.3846, -0.0248, -0.4721, +0.1699, -0.0122, -1.2120, +0.4807, +0.0437, -0.1432, -0.0937, +0.3850, +0.0717, -0.6115, -0.1069, -0.3580, -0.7625, -0.1524, -0.5527, +0.0189, +0.2040, +0.1220, +0.4873, -0.3443, +0.1473, +0.2942, -1.2750],
[ -0.0321, +0.0938, -0.1564, +0.0153, -0.0956, +0.0683, -0.1992, -0.8894, +0.0980, -0.0950, -0.5909, +0.1010, +0.0940, -0.7160, +0.0752, +0.5469, -0.6442, -0.0053, +0.2000, +0.3000, -0.3391, -0.1122, +0.3253, +0.1063, +0.1491, -0.0684, -0.0410, -0.3039, -0.6195, +0.2862, -0.1455, -0.8795, -0.3885, +0.0299, -0.0195, -0.1107, +0.0015, +0.4024, -0.9457, -0.4620, +0.0877, -0.2296, -0.0326, +0.2932, -0.2720, +0.4663, -0.0610, +0.1745, +0.1352, -0.5966, -0.1366, +0.2271, -0.4483, -0.4548, +0.0057, +0.2810, -0.4279, +0.0572, -0.8984, +0.1419, -0.1966, +0.0214, -0.5856, -0.4380],
[ -0.2850, -0.4454, -0.0200, +0.1379, +0.1279, +0.1286, +0.5722, -0.0797, +0.1775, +0.0054, +0.3466, -1.1324, +0.0630, -0.0436, -0.9319, +0.0692, +0.1615, -0.1780, +0.1783, +0.0662, +0.2824, -0.0309, -0.1921, +0.2110, -0.2472, +0.0026, +0.3590, -0.1833, -0.0167, -0.6163, -0.1092, +0.2120, +0.4458, +0.0250, -0.8406, -0.0331, +0.3448, -0.5886, -0.0235, +0.0602, +0.3971, +0.4033, +0.3516, -0.1472, -0.2371, -0.8047, +0.1336, -0.1083, -0.5510, +0.3792, -0.4230, -0.1216, -0.7740, -0.4497, -0.2848, -0.3698, -0.0160, +0.5724, -0.4150, +0.3254, -0.2344, +0.4417, +0.0460, -0.0463],
[ -0.1091, -0.0947, -0.3343, -0.8910, -0.0137, +0.1534, -0.3422, -0.5111, +0.0206, +0.2841, +0.2981, +0.3313, +0.2598, -0.0501, -0.5783, +0.3304, -0.2725, +0.1159, -0.2722, -0.5441, +0.2231, -0.0244, +0.3478, +0.1623, -0.2798, -0.0695, +0.3506, -0.1275, +0.2209, -0.3317, -0.2965, +0.4564, -0.2473, -0.3701, +0.4166, -0.1918, +0.0488, +0.5048, +0.4159, -0.1447, +0.0998, +0.0424, +0.0734, -0.3713, +0.3236, -0.4136, -0.2221, +0.1728, -0.6407, +0.2623, -0.4332, +0.4175, +0.2960, -0.3424, -0.5264, -0.5679, +0.2437, -0.6032, -0.5213, -0.0424, -0.5911, -0.0611, -0.1877, +0.2423],
[ -0.0360, -0.4567, -0.1493, -0.0765, -0.2676, +0.1338, +0.1486, +0.3867, +0.2451, -0.2054, -0.1088, -1.5518, +0.2254, +0.0175, -0.1154, -0.3777, -0.6173, -0.8897, -0.1523, +0.1594, -0.1772, -0.3349, -0.1155, -1.1580, +0.2605, +0.0570, +0.1894, -0.0755, +0.2382, -0.1726, -0.0400, +0.4391, +0.2241, +0.0551, -0.1106, +0.0817, +0.0128, -0.1330, -0.0162, -0.3872, -0.2613, -0.2073, +0.0483, +0.0026, -0.1008, -0.0389, -0.6723, -0.0657, +0.1532, -0.0627, -0.2517, -0.1961, -0.0313, -0.2694, +0.1040, +0.2662, -0.3370, +0.2086, -0.2202, +0.2812, -0.9275, -0.0331, +0.1384, -0.4651],
[ -0.0323, +0.5816, +0.2069, +0.1766, +0.8736, -0.1321, -0.5366, +0.4362, -0.9437, +0.5586, +0.8281, +0.1417, +0.4988, +0.2451, -0.1327, +0.3295, +0.1639, +0.2168, -0.5869, -0.9139, +0.3259, -1.2364, +0.0104, -0.4723, -0.2869, -0.0693, -0.1767, +0.0528, +0.3629, +0.0766, -0.2554, +0.7631, +0.0007, +0.3657, +0.2479, +0.0949, -0.1070, +0.2789, -0.6009, +0.3627, -0.1986, +0.3212, +0.5274, +0.2307, +0.1055, -0.8864, +0.4670, +0.0430, -0.2485, +0.0445, -0.0792, +0.0362, -0.7101, -0.1554, +0.4530, -0.5127, -1.0097, -0.4877, +0.1803, +0.1016, +0.2774, -0.7071, -0.2316, +0.1476],
[ +0.0676, -0.2920, +0.4224, -0.1409, +0.0856, -0.0969, +0.2461, -0.7079, -0.4348, -0.8510, -0.2213, -0.0541, -0.0461, -0.2451, +0.2312, -0.0496, +0.3432, -0.1916, +0.1832, +0.4089, +0.1642, -0.0928, +0.1869, +0.2472, -0.9379, -0.0356, -0.2276, -0.1867, -0.1108, +0.3021, -0.7620, -0.0141, +0.3072, -0.0326, -0.1854, -0.0535, +0.3489, -0.3910, -0.8369, +0.5177, +0.3154, +0.6535, -0.4463, -0.4381, -0.2189, +0.2761, +0.1655, +0.1010, -0.0769, -0.5381, -0.4710, +0.1980, -0.0818, -0.3762, +0.0076, +0.1753, -0.0984, -0.5887, -0.0019, -0.4983, +0.2914, -0.7693, +0.1656, -0.6165],
[ +0.2126, -0.3435, -0.2802, +0.0979, -0.9373, -0.7181, +0.2063, -0.2545, +0.3562, +0.0894, +0.5294, -0.3816, +0.5833, -0.2488, -0.4786, +0.2132, -0.3223, +0.2189, +0.2034, +0.0680, +0.3741, -0.2337, -0.2645, -0.2871, -0.3461, +0.3580, -0.7551, -0.4948, -0.4941, -0.1607, -0.0062, +0.3991, +0.5354, -0.1153, +0.4384, +0.2346, +0.0923, +0.6214, +0.2485, -0.2547, -0.2755, +0.3398, +0.2522, +0.0409, +0.1309, -1.1476, +0.4321, -1.6605, -0.6035, -0.5415, -0.0799, -0.1754, -0.5326, -0.1910, +0.1372, -0.4079, -0.3110, +0.0060, +0.0015, -0.7618, +0.5021, -0.3054, -0.1895, +0.4327],
[ +0.1316, +0.1998, +0.0677, +0.2773, -0.2720, -0.8087, -0.0022, -0.2622, -1.0104, -0.4908, +0.4249, +0.0597, -0.5553, -0.4698, -0.0096, -0.1893, +0.1355, -0.6921, +0.0211, +0.3253, -0.0769, +0.0565, -0.6166, -0.7295, +0.0477, -0.0101, -0.5214, -0.6498, -0.7418, -0.8979, +0.0792, -0.1958, -0.5255, +0.1953, -0.6446, -0.0748, -0.3183, +0.1582, -0.3667, +0.2170, +0.2665, -0.0075, +0.0740, +0.2708, -0.1289, +0.0462, -0.6262, -0.4190, -0.1797, +0.3994, -0.8803, -0.4579, -0.3235, +0.2903, -1.3589, -0.5549, -0.6767, +0.0308, +0.0491, -0.3117, +0.2053, +0.1075, +0.2042, -0.4537],
[ -0.9114, +0.3823, -0.2137, -0.0383, +0.0891, -0.5047, -0.3632, -0.0115, -0.3604, +0.2107, -0.4123, -0.1508, -0.3897, -0.1566, -0.3869, +0.0458, -0.3594, -0.6799, -1.0821, -0.2322, +0.1464, +0.2626, -0.1674, -0.5577, +0.0910, -0.1279, +0.4003, -0.1568, +0.0907, -0.1528, -0.0554, +0.4973, +0.3610, +0.3540, +0.3717, -0.2353, +0.1743, +0.2026, +0.8891, -0.5409, -0.3690, +0.1897, -1.1785, -0.0244, +0.0283, +0.0709, -0.9182, -0.1485, +0.3410, -0.3562, +0.1126, +0.3459, +0.0190, +0.4073, -0.0685, -0.0834, +0.1817, +0.3957, +0.3428, +0.2351, -0.2072, -0.2002, +0.0579, +0.2585],
[ +0.0476, -0.7260, -0.2175, -0.8305, +0.3673, -0.1075, -0.7324, +0.1022, -0.1264, +0.0679, -0.2494, +0.2647, -0.7667, +0.1632, -0.1487, -0.1800, -0.4566, -0.4716, +0.3124, +0.4227, -0.2557, +0.1477, -0.0946, +0.0803, +0.0136, +0.0699, -0.6304, +0.5944, +0.1812, -0.0072, -1.2447, +0.7503, -0.7340, -0.6389, -0.0202, +0.1716, -0.0661, -0.7511, -0.6451, +0.4344, +0.2398, +0.9628, -0.2201, +0.1901, +0.6633, -0.0529, -0.3787, +0.3837, -0.4481, +0.1792, -0.2828, +0.7377, +0.6304, -0.9296, +0.1690, +0.5375, +0.3884, -0.3548, +0.0788, -0.7348, +0.2273, -0.5028, -0.4739, +0.1150],
[ +0.1521, -0.0100, -0.1015, +0.1975, -0.5804, -0.0891, +0.4443, -0.0275, -0.3218, -0.3674, -1.0237, -0.9589, +0.1408, +0.1039, -0.4158, -0.3465, -0.2163, +0.3031, -0.0905, -1.1000, +0.0028, +0.1196, +0.1130, +0.4777, -0.0803, -0.3295, -1.5273, -0.4059, -0.2642, -0.6425, +0.1149, -0.0094, +0.1067, -0.6440, -0.0806, +0.2513, +0.2070, -0.0682, -0.0854, -0.4654, +0.0119, -0.2918, +0.0766, -0.0766, +0.0621, -0.5751, -0.7636, -0.4295, -0.1413, +0.0667, -0.0193, +0.0210, +0.1867, +0.1727, -0.0391, -0.5251, -0.0746, +0.0615, -0.0581, -0.4284, -0.2977, -0.0883, -0.1302, +0.1829],
[ -0.1256, +0.0829, -0.5799, -1.0012, +0.3669, +0.2700, +0.2691, -0.2078, +0.6662, +0.4342, -0.7014, +0.1332, +0.0736, +0.5960, +0.1266, +0.4412, -0.3859, +0.0702, -0.7489, -0.1285, +0.1080, -0.0248, -0.0614, -0.2922, -0.1791, +0.2619, -0.2986, +0.1326, -0.1112, -0.4128, -0.3499, -0.2148, +0.0886, -0.3239, +0.1767, +0.2782, -0.1033, -0.1350, +0.0324, -0.2402, +0.2440, +0.2858, +0.0111, -0.6319, +0.3694, -0.5569, +0.0758, -0.5506, -0.8423, -0.6073, -0.0642, +0.0559, +0.3943, -0.1092, -0.3964, +0.0705, -0.3753, +0.2106, -0.0118, -0.2122, -0.0904, +0.3428, -0.2614, -0.0007],
[ +0.3415, +0.4062, -0.4667, +0.2757, -0.5389, -0.1429, -0.0005, +0.1749, -0.1646, -0.9262, +0.1978, -0.3748, +0.3384, +0.1757, -0.0899, +0.1567, +0.3043, -0.0828, -0.7369, +0.2833, +0.2871, -0.0150, -0.0895, +0.2181, -0.3692, -0.2344, -0.3813, -0.4984, +0.2426, +0.3936, -0.3995, -0.0257, -0.2650, -0.5329, -0.6254, +0.0492, -0.0428, +0.3595, -0.1242, -0.3341, -0.1174, +0.2283, +0.3051, -0.0794, -0.0715, +0.2324, +0.1567, -0.4121, +0.0756, -0.6483, -0.7294, -0.0235, -0.5082, -0.1506, -0.0962, +0.1123, +0.1990, -0.5521, -0.8837, +0.2634, -0.6452, +0.0470, +0.0747, +0.0456],
[ -1.2951, +0.1232, -0.8490, +0.2284, +0.3593, -0.9968, +0.1914, +0.3673, +0.1287, +0.0485, -0.6153, -0.6149, -0.2634, -0.7023, +0.2006, +0.2657, -0.0201, -0.6250, -0.1045, -0.5447, -0.2495, -0.0712, -0.2281, -0.1573, -0.0079, -0.4966, -0.5428, -1.5871, -0.0332, -0.3754, +0.0438, -0.2096, -0.0341, -0.2111, -0.1953, -0.1146, +0.0260, -0.0840, -0.9739, +0.0693, +0.1628, -0.6525, -0.9299, +0.1602, -0.0673, -1.1183, -1.1446, -0.0575, +0.0123, +0.0463, +0.0683, +0.0192, -0.7718, -0.1055, -0.1894, +0.3897, -0.8589, +0.2829, +0.0774, -0.1157, +0.0772, +0.0168, +0.3460, +0.2657],
[ -0.3160, +0.3029, +0.2132, -0.2024, -0.0573, +0.2263, +0.3686, -0.2059, +0.2531, -0.4922, -0.4110, -0.0881, -0.0267, -0.3069, +0.2496, -0.2458, -0.0348, -0.4285, +0.0564, +0.5539, +0.3510, +0.0755, +0.2656, +0.5299, -0.0647, +0.0431, +0.3277, +0.0192, -0.3490, +0.2500, +0.2519, +0.2055, +0.2462, -0.2927, +0.2902, -0.1451, -0.0611, -0.3940, -0.6985, +0.0295, -0.1272, -0.0507, +0.0030, -0.0484, -0.4220, +0.3042, -0.1346, -0.4380, +0.0247, -0.2205, -0.1549, -0.7229, -0.1487, -0.1124, +0.2539, +0.1274, +0.6169, +0.3346, -0.1577, +0.4318, +0.1469, -0.0689, +0.0982, -0.3816],
[ +0.4151, +0.1020, -0.3973, -0.1940, -0.0893, -0.5294, -0.0714, +0.1221, +0.2081, -0.1500, +0.0839, +0.0651, +0.1602, +0.1521, +0.3755, +0.4533, -0.0749, -0.1498, +0.0048, +0.2987, +0.3013, -0.2483, -0.8249, +0.1123, -0.2657, -0.0776, -0.8314, -0.0567, +0.4846, +0.1280, -0.4166, +0.2149, -0.5095, -0.2219, -0.6757, +0.5484, +0.2117, +0.1901, -0.3840, -0.0860, -0.0527, -0.8445, +0.1747, -0.7124, +0.3261, -0.0172, -0.4794, +0.2829, -0.9583, -0.3825, -0.2641, -0.1610, +0.0921, +0.0395, -0.7542, -0.4747, +0.0891, -0.5037, +0.4109, +0.2718, -0.1609, +0.3680, -0.2975, +0.0092],
[ -0.2679, -0.2103, +0.1004, +0.2703, +0.0541, +0.4900, +0.1016, +0.0008, -0.0075, +0.0959, -0.2459, -0.4452, +0.1211, -0.0521, -0.5468, +0.2349, -0.0690, +0.0936, -0.3218, -0.0093, +0.0644, +0.4158, +0.1109, +0.2373, +0.3008, -0.2570, +0.2886, -0.1720, +0.3146, -0.6991, +0.2565, -0.1762, -0.0239, -0.6296, -0.8216, -0.8141, +0.0871, -0.5981, +0.2595, +0.2109, -0.3252, -0.2758, +0.2662, -0.1662, +0.0087, -0.3265, +0.2910, -0.3716, +0.3225, +0.0907, +0.0550, +0.4069, +0.3731, -0.0367, -0.0844, -0.7320, +0.3318, +0.0839, +0.1493, -0.1054, -0.4476, +0.0671, +0.3858, -0.3728],
[ -0.0163, +0.4856, -0.1412, -0.0100, -0.2343, +0.1223, -0.5244, -0.4046, +0.1738, -0.0262, +0.0922, -0.6767, +0.2672, +0.1770, -0.4969, +0.3919, -0.1103, -0.3749, +0.2580, -0.0209, -0.2500, -0.1089, +0.0587, +0.4735, +0.2116, +0.0299, +0.1709, +0.0804, +0.8460, +0.1637, +0.1775, -0.3955, +0.2403, -0.1843, +0.0579, -0.3362, +0.1129, +0.2148, -0.0079, -0.0662, -0.1286, +0.1830, +0.0437, +0.0167, -0.0824, -0.1148, +0.2380, -0.3372, -0.0684, -0.3226, +0.2914, +0.0994, -0.1599, +0.0130, +0.1584, +0.0975, +0.2723, +0.1877, -0.4828, +0.1463, -0.2304, +0.3497, +0.0522, -0.0404],
[ +0.3846, +0.3960, +0.0721, -0.5932, -0.6720, +0.3994, -1.1131, +0.0500, -0.0433, -0.5014, -0.2795, +0.0226, -0.0276, -0.3389, -0.1971, +0.3228, -0.3439, +0.5770, +0.5260, -0.2861, +0.3810, -0.0225, +0.3133, +0.1716, +0.0778, -0.1298, +0.0765, -0.1700, +0.5689, +0.2767, -0.5815, +0.2572, -0.7600, -0.1481, +0.2901, -0.4648, +0.1381, +0.2972, -0.4802, -0.6701, -0.6240, -0.0784, -0.0330, -0.5339, +0.1989, +0.2422, +0.0886, -0.1819, -0.2638, +0.0189, -0.1023, +0.3559, +0.2563, +0.0272, -0.1343, +0.2034, +0.6096, -0.2862, -0.2925, +0.1162, -0.5740, -0.4293, -0.1544, -0.3657],
[ -0.1666, -0.5683, +0.3239, +0.0008, -0.0790, +0.0108, +0.1210, +0.2313, -0.0242, -0.3114, +0.1546, -0.0983, -0.1095, -0.5754, +0.1360, -0.7269, +0.0714, -0.9205, +0.2401, +0.0983, +0.1060, +0.0410, +0.2889, -0.7942, +0.3511, +0.1338, +0.1118, +0.1873, -0.4490, +0.2648, -0.1163, +0.1410, -0.0005, -0.0627, +0.2816, -0.0261, +0.0111, -0.3929, -0.3200, +0.3405, +0.1021, -0.0294, +0.2000, -0.2919, -0.2395, +0.1867, +0.1548, -0.0702, +0.0021, +0.5599, -0.2662, -0.4859, -0.1809, +0.2777, +0.2588, +0.1977, +0.0975, -0.3367, -0.1211, +0.1057, -0.0247, +0.4044, +0.4802, -0.4940],
[ -0.3074, +0.2169, +0.0655, -0.3575, +0.2765, -1.0735, +0.3228, -0.7085, -0.1075, -0.1250, +0.1302, -0.2700, -0.6832, -0.0223, -0.5448, +0.3824, -0.5548, +0.2615, -0.4700, +1.0847, -0.0443, -0.9753, +0.1278, +1.0526, +0.7114, +0.2395, +0.1612, -0.3276, +0.3154, +0.4751, -0.3890, -0.2353, +0.6575, -0.1306, -0.4566, -0.3303, +0.6051, -0.1868, -0.9390, -0.3405, +0.3341, +0.5198, +0.0939, -0.6396, -0.0410, -0.0942, -0.4784, -0.6260, -0.0983, -0.3750, -0.1402, -0.0351, +0.0890, -0.5765, +0.3816, -0.5375, +0.6580, +0.0448, -0.3544, +0.1669, +0.0808, -0.4698, +0.0085, +0.5292],
[ -0.1747, -0.5134, +0.1257, +0.6530, +0.3251, +0.0013, +0.8608, -0.6414, +0.3327, -0.3861, +0.5066, -0.8033, +0.1957, -0.2380, -0.1649, -0.0760, -0.3093, -0.3283, +0.0661, -0.1066, +0.3787, -0.3254, +0.5536, -0.4949, +0.1560, +0.1118, +0.1465, +0.3107, +0.5213, +0.1194, +0.2602, +0.0551, -0.0612, +0.1378, -0.1037, +0.5086, -0.3383, -0.2024, -0.1786, -0.2193, -0.3955, -0.0600, +0.4502, -0.0450, -0.3765, -0.9599, +0.2312, +0.0751, -0.1329, +0.1573, -0.2891, -0.0944, -0.4619, +0.3256, +0.2486, -0.2238, +0.2054, -0.1677, -1.2201, +0.2986, +0.5681, +0.0700, -0.0916, +0.3844],
[ +0.5860, +0.1473, -0.3536, +0.1924, -0.1819, +0.3126, -0.3094, +0.4127, -0.3403, -0.3101, +0.4899, +0.3310, +0.3136, -0.1343, +0.1557, +0.0007, +0.0431, -0.0531, -0.3300, +0.3820, -0.3771, -0.6818, -0.4023, -0.1221, -0.0995, +0.1512, -0.2698, -0.0544, +0.0406, +0.0104, +0.2382, +0.0113, +0.5360, +0.3837, +0.0947, +0.4839, +0.0278, -0.4629, -0.1912, -0.7728, -0.0162, +0.5847, +0.1752, +0.1536, -0.3113, -0.4624, -0.2032, -0.2410, -0.0095, -0.3411, -0.2375, -0.3024, -0.0689, +0.0134, -0.2987, +0.2678, +0.1053, +0.3568, -0.3776, -0.0956, +0.1105, +0.1802, +0.3608, +0.2763],
[ -0.0126, -0.1275, +0.1721, -0.1653, +0.0189, -0.0586, +0.1487, +0.2661, -0.0924, -0.1733, +0.0411, +0.1124, -0.0426, -0.0405, +0.0713, -0.1322, +0.1053, +0.2013, +0.2442, -0.4979, +0.3654, -0.2099, +0.0049, -0.6743, -0.1063, -0.1213, +0.2036, +0.2109, -0.2639, +0.1839, +0.3105, -0.0961, +0.3935, +0.1186, -0.0959, +0.5348, -0.3605, -0.6159, -0.3268, +0.1327, +0.5812, -0.4447, -1.8573, +0.1350, -0.0151, +0.1569, +0.0348, +0.2221, -0.6421, -0.2810, +0.1918, -0.1290, +0.0505, +0.0517, +0.0313, -0.0781, +0.1746, +0.0713, +0.2894, -1.0579, -0.1106, +0.3800, -0.6895, -1.1236]
])
weights_dense2_b = np.array([ +0.1534, -0.0356, +0.0392, +0.0272, +0.0733, +0.2141, -0.0432, -0.0479, -0.1264, +0.1456, +0.2103, -0.0233, +0.2320, -0.0525, +0.1808, +0.1565, -0.0347, -0.0719, -0.2635, -0.1948, -0.1301, +0.0453, -0.0722, +0.0875, +0.3780, +0.1023, +0.1012, +0.3150, +0.1801, +0.1941, +0.2014, +0.1381, +0.1411, -0.0371, -0.0987, +0.1987, +0.1015, -0.2282, +0.0072, -0.0800, +0.0323, +0.1198, +0.2822, +0.0090, -0.1950, +0.0864, +0.2694, -0.0746, +0.2193, +0.1658, +0.0712, -0.1185, +0.1351, +0.1331, +0.3542, +0.1543, +0.1557, -0.0575, +0.0659, -0.0090, -0.1502, +0.0665, +0.1853, -0.0413])
weights_final_w = np.array([
[ +0.5409, +0.1061, +0.1214, +0.0961, -0.0304, +0.2028],
[ +0.3719, +0.0252, -0.1683, +0.1448, +0.0874, -0.0254],
[ -0.1174, +0.2622, -0.1514, -0.2936, -0.1060, -0.5701],
[ +0.0623, +0.0379, -0.0004, -0.3542, -0.0684, -0.2670],
[ +0.0487, +0.0638, -0.5099, -0.1448, -0.0639, +0.1894],
[ -0.3975, -0.1887, +0.2938, -0.0159, +0.1679, +0.5848],
[ +0.1560, -0.0012, -0.0360, -0.2195, -0.3875, +0.0259],
[ -0.0942, -0.0268, -0.1722, -0.0594, -0.0527, +0.5528],
[ +0.1087, -0.3823, -0.1868, -0.0919, +0.2626, +0.2375],
[ +0.0054, -0.1016, -0.3405, +0.4056, +0.0899, +0.0129],
[ -0.0055, +0.1361, +0.2055, +0.6780, +0.0250, -0.0961],
[ +0.0586, +0.7423, -0.0014, +0.1401, +0.4564, +0.5103],
[ -0.1461, +0.1129, +0.2607, +0.3828, +0.2286, +0.0225],
[ -0.0789, +0.0790, -0.1576, +0.3564, +0.4390, +0.2671],
[ +0.2657, +0.0888, -0.2312, -0.1819, -0.1583, -0.1158],
[ -0.0429, +0.1533, -0.0649, +0.1670, +0.5324, +0.2681],
[ +0.1750, +0.0582, -0.1742, +0.7826, -0.0295, -0.0646],
[ +0.1563, +0.0241, -0.4052, +0.5419, +0.0212, -0.1529],
[ +0.1667, -0.0708, +0.0750, +0.0286, +0.2312, -0.2932],
[ -0.0755, +0.3814, -0.3422, -0.3412, +0.0820, -0.6145],
[ -0.0485, -0.1721, -0.1366, -0.0866, +0.0972, +0.4096],
[ -0.0026, -0.3586, -0.0705, -0.0509, +0.0127, +0.3078],
[ +0.1658, -0.2918, -0.4419, -0.1099, -0.1852, -0.0318],
[ +0.3883, -0.1925, -0.3671, -0.3079, -0.1405, -0.6695],
[ -0.3967, -0.1212, +0.2062, -0.4248, +0.2445, +0.5061],
[ +0.2296, +0.0054, +0.1389, +0.1225, -0.2944, -0.3264],
[ -0.3366, -0.1053, +0.1004, +0.0522, -0.2441, -0.1599],
[ +0.3214, +0.3230, -0.3416, +0.1735, -0.0354, +0.0172],
[ -0.0715, -0.0971, +0.2212, +0.0870, +0.4960, +0.0409],
[ +0.6941, +0.1916, +0.4534, -0.3305, -0.1206, +0.2755],
[ -0.0466, +0.2676, -0.2066, -0.2910, +0.0603, +0.1708],
[ +0.3716, +0.1599, -0.1473, +0.0362, -0.0572, +0.4125],
[ +0.0225, -0.1431, +0.3085, -0.1022, -0.3053, -0.3167],
[ +0.1484, +0.3096, +0.2186, -0.2676, +0.2821, -0.0416],
[ +0.2600, -0.1355, +0.1571, -0.4409, +0.1009, +0.1011],
[ +0.2334, +0.3423, -0.0794, +0.0448, -0.0112, -0.0245],
[ -0.3402, +0.1981, -0.0945, +0.1727, -0.0363, -0.1486],
[ -0.4074, -0.1319, +0.0434, +0.4359, -0.2658, -0.3302],
[ +0.2756, -0.2130, -0.2856, -0.1436, -0.4224, +0.1142],
[ -0.1194, +0.2529, -0.2741, -0.0691, -0.2947, -0.0033],
[ -0.0449, +0.4437, -0.0389, +0.1377, +0.1102, -0.1049],
[ +0.4368, +0.1699, +0.3433, -0.4160, -0.3043, +0.1180],
[ -0.1328, -0.6681, +0.4017, +0.3457, +0.1843, -0.0134],
[ +0.0630, +0.2032, +0.2331, -0.1384, -0.1024, +0.3183],
[ +0.1946, +0.1460, -0.1598, -0.2830, +0.2411, +0.3073],
[ +0.4296, -0.2071, +0.3769, +0.0840, -0.0062, -0.1579],
[ -0.0790, -0.1186, +0.0962, +0.4871, -0.2901, +0.6272],
[ -0.2573, +0.3325, +0.1097, -0.2340, -0.0787, +0.1208],
[ -0.4469, -0.3637, -0.1740, -0.4408, +0.0512, +0.5575],
[ +0.1426, -0.3975, -0.0685, -0.0452, -0.4517, +0.4320],
[ -0.5925, +0.3324, -0.1968, -0.2537, +0.6491, -0.2922],
[ -0.2201, -0.3118, -0.3722, +0.0216, +0.1670, -0.1343],
[ +0.0638, -0.2374, -0.1480, +0.4090, +0.2347, +0.1456],
[ -0.0656, +0.1516, -0.3281, -0.2661, +0.0645, +0.0550],
[ +0.3725, +0.2281, +0.3031, +0.0774, -0.3138, +0.0967],
[ +0.3016, +0.0322, +0.0556, -0.0571, -0.1177, -0.2442],
[ -0.2769, -0.5119, -0.0336, -0.1588, +0.0503, -0.2331],
[ +0.1518, +0.4363, +0.0093, -0.3960, -0.1347, +0.2931],
[ +0.1897, -0.0655, +0.1977, +0.4321, +0.6998, -0.0863],
[ +0.0391, -0.0305, +0.3576, -0.4996, -0.0640, -0.0039],
[ +0.2922, +0.3815, +0.2834, +0.1990, -0.0568, +0.2077],
[ -0.5371, +0.2796, +0.2952, +0.1182, +0.0523, -0.2151],
[ -0.5111, +0.2231, -0.1034, +0.0479, -0.0543, +0.0605],
[ +0.0822, -0.4530, -0.0345, +0.1621, -0.2487, +0.1516]
])
weights_final_b = np.array([ +0.1367, +0.1107, -0.0148, +0.1158, -0.0820, +0.3047])
if __name__=="__main__":
demo_run()
| [
"ptcernek@gmail.com"
] | ptcernek@gmail.com |
bba778ac77b6f26d2cdbbd98a07a72600684d3a1 | c897af3b37cb1507165a45ca5ee7eb7410a6d259 | /writetodb.py | f6c842c7af3bf5f2c9e1edd5aafb561a6d05aaf8 | [] | no_license | glencupples/pubgstats | 7d63a33a7efef89e1cb11bac2fd04bfc0295c72b | 07288da18f2406a08965c0d3dd9e1c580972fd55 | refs/heads/main | 2023-04-11T14:49:50.516177 | 2021-04-22T00:32:31 | 2021-04-22T00:32:31 | 360,340,328 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,035 | py | import requests
import json
from pprint import pprint
import psycopg2
import pubg_stats
from PUBGkeys import *
#search for matches, check against db to create list of new matches
match_ids = pubg_stats.get_match_ids()
db_match_ids = pubg_stats.query_db_for_match_list()
new_match_ids = []
for i in match_ids:
if i not in db_match_ids:
new_match_ids.append(i)
## write new matches to db if new matches
if len(new_match_ids) != 0:
try:
connection = psycopg2.connect(user=db_u,
password=db_pw,
host="127.0.0.1",
port="5432",
database="PUBG")
cursor = connection.cursor()
for match in new_match_ids:
match_stats = pubg_stats.get_stats_for_match(match)
for i in match_stats:
if 'matchHeader' in i:
(query, values) = pubg_stats.insert_query_match_table(i)
cursor.execute(query,values)
elif i['participant'] == 'Rovey Wade':
(query, values) = pubg_stats.insert_query_player_table('roveywade',i)
cursor.execute(query,values)
elif i['participant'] == 'Likethfruit':
(query, values) = pubg_stats.insert_query_player_table('likethfruit',i)
cursor.execute(query,values)
elif i['participant'] == 'bbccde':
(query, values) = pubg_stats.insert_query_player_table('bbccde',i)
cursor.execute(query,values)
elif i['participant'] == 'Rootsmasher':
(query, values) = pubg_stats.insert_query_player_table('rootsmasher',i)
cursor.execute(query,values)
connection.commit()
print ("Records inserted successfully into matches table")
except (Exception, psycopg2.Error) as error :
if(connection):
print("Failed to insert record into matches table", error)
finally:
#closing database connection.
if(connection):
cursor.close()
connection.close()
print("PostgreSQL connection is closed")
| [
"glen.cupples@gmail.com"
] | glen.cupples@gmail.com |
27a1ce81c3cc607a8005a1afe01a2e35470201e2 | 09bbdb1f5f4905440dc3a2829481306375b85747 | /test/debug_server/css_to_json.py | 1b8e117d96734875c137d32af8648daabe81ee91 | [] | no_license | BrokenEagle/JavaScripts | b5174e55152b3995a462dfd27ecd13f621ea84f5 | 2c6de8734670e62189116ba4e15bc7bb00e6b8ef | refs/heads/master | 2023-08-31T11:45:40.641330 | 2023-08-28T04:52:57 | 2023-08-28T04:52:57 | 96,568,859 | 28 | 4 | null | 2023-01-21T18:49:53 | 2017-07-07T19:04:59 | JavaScript | UTF-8 | Python | false | false | 1,475 | py | # ## PYTHON IMPORTS
import os
import json
# ## GLOBAL VARIABLES
CSS_DIRECTORY = os.path.join(os.path.dirname(__file__), 'css')
JSON_DIRECTORY = os.path.join(os.path.dirname(__file__), 'json')
CSS_SETTINGS_FILEPATH = os.path.join(CSS_DIRECTORY, 'settings.css')
CSS_COLOR_FILEPATH = os.path.join(CSS_DIRECTORY, 'color.css')
JSON_OUTPUT_FILEPATH = os.path.join(JSON_DIRECTORY, 'debug_css.json')
# ## FUNCTIONS
def load_file(filepath):
with open(filepath, 'r') as file:
try:
return file.read()
except Exception:
print("File not found!")
return
def save_file(filepath, json_output):
directory = os.path.dirname(filepath)
if not os.path.exists(directory):
os.makedirs(directory)
with open(filepath, 'w') as file:
file.write(json.dumps(json_output))
def main():
json_output = {}
if os.path.exists(CSS_SETTINGS_FILEPATH):
print("Found settings file.")
css_settings = load_file(CSS_SETTINGS_FILEPATH)
if css_settings is not None:
json_output['debug_settings_css'] = css_settings
if os.path.exists(CSS_COLOR_FILEPATH):
print("Found color file.")
css_color = load_file(CSS_COLOR_FILEPATH)
if css_settings is not None:
json_output['debug_color_css'] = css_color
print("Outputting JSON file.")
save_file(JSON_OUTPUT_FILEPATH, json_output)
# ## EXECUTION START
if __name__ == '__main__':
main()
| [
"BrokenEagle98@yahoo.com"
] | BrokenEagle98@yahoo.com |
3971d82f334e85a8e5f4e4d8ed998b410a1ef0f2 | a5103b7d5066138ac1a9aabc273361491a5031cd | /daily/8/DeepLearning/myproject/RL/begin.py | 873404f336aa780f4dffdf3bd50381dfb4d4246a | [] | no_license | mckjzhangxk/deepAI | 0fa2f261c7899b850a4ec432b5a387e8c5f13e83 | 24e60f24b6e442db22507adddd6bf3e2c343c013 | refs/heads/master | 2022-12-13T18:00:12.839041 | 2021-06-18T03:01:10 | 2021-06-18T03:01:10 | 144,862,423 | 1 | 1 | null | 2022-12-07T23:31:01 | 2018-08-15T14:19:10 | Jupyter Notebook | UTF-8 | Python | false | false | 682 | py | import gym
def print_env_base_info(env):
print('# of states:{},# of action {}'.format(env.observation_space.shape[0],env.action_space.n))
print('low value of state', env.observation_space.low)
print('high value of state',env.observation_space.high)
# MountainCar-v0, MsPacman-v0,CartPole-v0
env=gym.make('Hopper-v2')
print_env_base_info(env)
for i_episode in range(200):
env.reset()
reward=0
for _ in range(1000):
env.render()
a=env.action_space.sample()
s,r,done,_=env.step(a)
reward+=r
if done:
print('episode {} finish,get reward {}'.format(i_episode,reward))
break
input()
env.close() | [
"mckj_zhangxk@163.com"
] | mckj_zhangxk@163.com |
51823db10cf88e298ab73881169e04ed401035ad | 40e5934f1fcf29e4fdd0c550760e822d077cd1ac | /blog/mysite/blog/views.py | 1fbbb584cc58abe1f9367559b27d6dd6799cc5f2 | [] | no_license | Merrylss/cms | 2bbd065718b0b41d00301fa5c0ffc540160a2a6b | ac8864529892d2907d7fd67363699cf3d05d031d | refs/heads/master | 2020-04-01T14:04:45.827603 | 2018-10-16T13:48:09 | 2018-10-16T14:09:40 | 153,279,492 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 14,521 | py | from io import BytesIO
import uuid
import re
import logging
from django.shortcuts import render, redirect, reverse
from django.http import HttpResponse, JsonResponse
# from django.http import HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_GET, require_http_methods, require_POST, require_safe
from .utils import require_login
from django.conf import settings
from django.core.paginator import Paginator
# Create your views here.
from . import models
from . import utils
from . import cacheUtils
def index(request):
"""
博客首页面
:param request:获取请求的数据
:return:request参数、待渲染的模板文件、具体数据
"""
logger = logging.getLogger("django")
logger.debug("首页运行。。。")
articles = cacheUtils.get_all_article()
# 分页
# 从setting配置文件中获取指定的每页显示的条数
pageSize = int(request.GET.get("pageSize", settings.PAGE_SIZE))
# 当前页
pageNow = int(request.GET.get("pageNow", 1))
# 构建一个Paginator对象
paginator = Paginator(articles, pageSize)
page = paginator.page(pageNow)
return render(request, 'blog/index.html', {"page": page, "pageSize": pageSize})
def log_user(request):
"""
用户登录
:param request: 请求头对象
:return:
"""
logger = logging.getLogger("django")
logger.debug("用户登录。。。")
# user = request.GET
# return render(request, 'blog/log_user.html', {})
if request.method == 'GET':
request.session['Error'] = 0
return render(request, 'blog/log_user.html', {'msg': '输入账号密码'})
elif request.method == 'POST':
username = request.POST['account']
log_password = request.POST['log_password']
try:
password = utils.hmac_by_md5(log_password)
user = models.User.objects.get(username=username, password=password)
# 保存登陆用户的信息
request.session['loginUser'] = user
print(user)
response = redirect(reverse("blog:login_success"))
response.set_cookie("username", username)
if request.session['Error'] >= 2:
# 接收验证码
code = request.POST['code']
# 判断验证码是否正确
mycode = request.session['code']
if code.lower() != mycode.lower():
return render(request, 'blog/log_user.html', {"msg": "验证码错误!"})
# 删除session中的验证码
del request.session['code']
return response
except Exception as e:
print(e)
request.session['Error'] += 1
return render(request, 'blog/log_user.html', {'msg': '登陆失败!请重试'})
def reg_user(request):
"""
注册
:param request: 请求头对象
:return:
"""
logger = logging.getLogger("django")
logger.debug("用户注册。。。")
if request.method == "POST":
# 接受参数
# print(request.POST['nickname'])
try:
username = request.POST['username'].strip()
nickname = request.POST['nickname'].strip()
password = request.POST['password'].strip()
con_password = request.POST['con-password'].strip()
age = request.POST['age'].strip()
gender = request.POST['gender']
header = request.FILES.get('header')
print(gender)
# 接收验证码
code = request.POST['code']
print(code)
# 判断验证码是否正确
mycode = request.session['code']
# 删除session中的验证码
del request.session['code']
# 数据验证
if len(username) < 1:
return render(request, 'blog/reg_user.html', {"msg": "用户账号不能为空"})
u = models.User.objects.filter(username=username)
# print(u)
if len(u) > 0:
return render(request, 'blog/reg_user.html', {"msg": "账号已存在"})
if len(nickname) < 1:
return render(request, 'blog/reg_user.html', {"msg": "用户昵称不能为空"})
if len(con_password) < 6:
return render(request, 'blog/reg_user.html', {"msg": "密码不能小于六位"})
if con_password != password:
return render(request, 'blog/reg_user.html', {"msg": "两次密码不一致"})
if code.lower() != mycode.lower():
return render(request, 'blog/reg_user.html', {"msg": "验证码错误!"})
try:
# 加密
password = utils.hmac_by_md5(password)
# print(header)
# 上传图片
# header = request.FILES.get('header', None)
# print(request.FILES)
# print(header)
# path = "static/images/headers/" + uuid.uuid4().hex[:-15] + header.name
# with open(path, "wb") as f:
# for file in header.chunks():
# f.write(file)
user = models.User(username=username, nickname=nickname, password=password, age=age, header=header)
user.save()
# return render(request, "blog/all_user.html", {"msg": "恭喜您,注册成功!!"})
return redirect("/blog/log_user/")
except Exception as e:
print(e)
return render(request, 'blog/reg_user.html', {"msg": "图片上传失败"})
except Exception as e:
print(e)
return render(request, "blog/reg_user.html", {"msg": "注册失败!!"})
elif request.method == "GET":
return render(request, 'blog/reg_user.html', {"msg": "请填写以下数据"})
@require_login
def del_user(request, user_id):
"""
删除用户
:param request: 请求头对象
:param user_id: 需要操作的用户id号
:return: 打印页面,返回用户数据
"""
logger = logging.getLogger("django")
logger.debug("删除用户。。。")
# u_id = request.GET['id']
user = models.User.objects.get(pk=user_id)
print(user)
user.delete()
# return HttpResponse('<h2>删除成功<a href="/blog/all_user/">返回</a></h2>')
return redirect('/blog/all_user/')
@require_login
def all_user(request):
"""
全部用户
:param request: 请求头对象
:return: 打印页面,返回用户数据
"""
logger = logging.getLogger("django")
logger.debug("查看全部用户。。。")
users = models.User.objects.all()
# content = ""
# for u in users:
# # print(u.name)
# content += "<h3>" + u.username + "<a href='/blog/del_user/?id=" + str(u.id) + "'>删除</a>" + "<h3>"
# return HttpResponse(content)
return render(request, 'blog/all_user.html', {"users": users})
@require_login
def login_success(request):
"""
全部用户
:param request: 请求头对象
:return: 打印页面,返回用户数据
"""
logger = logging.getLogger("django")
logger.debug("用户登陆成功。。。")
articles = models.Article.objects.all()
# 分页
# 从setting配置文件中获取指定的每页显示的条数
pageSize = int(request.GET.get("pageSize", settings.PAGE_SIZE))
# 当前页
pageNow = int(request.GET.get("pageNow", 1))
# 构建一个Paginator对象
paginator = Paginator(articles, pageSize)
page = paginator.page(pageNow)
# return render(request, 'blog/index.html', {"page": page, "pageSize": pageSize})
return render(request, 'blog/login_success.html', {"page": page, "pageSize": pageSize})
@require_login
def show_user(request, user_id):
"""
展示信息
:param request: 请求头对象
:param user_id: 需要操作的用户id号
:return: 打印页面,返回用户数据
"""
logger = logging.getLogger("django")
logger.debug("展示用户信息。。。")
user = models.User.objects.get(id=user_id)
print(user)
return render(request, 'blog/show_user.html', {'user': user})
@require_login
def change_info(request, user_id):
"""
修改信息
:param request: 请求头对象
:param user_id: 需要操作的用户id号
:return: 打印页面,返回用户数据
"""
logger = logging.getLogger("django")
logger.debug("改变资料。。。")
if request.method == "GET":
user = models.User.objects.filter(id=user_id).first()
return render(request, "blog/change_info.html", {"user": user})
# 修改信息
else:
nickname = request.POST['nickname']
age = request.POST['age']
# 获取到需要修改的用户
user = models.User.objects.get(id=user_id)
# 修改数据
user.nickname = nickname
user.age = age
# 保存修改后的数据
user.save()
return redirect('/blog/show_user/'+str(user_id)+'/')
@require_login
def user_change_info(request):
logger = logging.getLogger("django")
logger.debug("用户修改个人资料。。。")
user = request.session['loginUser']
print(user.username)
user = models.User.objects.get(username=user.username)
if request.method == "GET":
return render(request, 'blog/user_change_info.html', {})
else:
try:
# 上传图片
print("1231")
nickname = request.POST['nickname']
age = request.POST['age']
header = request.FILES.get('header', None)
user.nickname = nickname
user.age = age
print(request.FILES)
print(header)
user.header = header
user.save()
del request.session['loginUser']
request.session['loginUser'] = user
return redirect(reverse("blog:user_change_info"), {"msg": "资料修改成功"})
except Exception as e:
print(e)
return render(request, 'blog/user_change_info.html', {"msg": "图片上传失败"})
@require_login
def out_user(request):
"""
退出
:param request:请求头对象
:return:
"""
logger = logging.getLogger("django")
logger.debug("用户退出。。。")
try:
del request.session['loginUser']
finally:
return redirect('/blog/index/')
# 文章操作
@require_login
def add_article(request):
"""
添加文章
:param request:
:return:
"""
logger = logging.getLogger("django")
logger.debug("添加文章。。。")
if request.method == 'GET':
return render(request, 'blog/add_article.html', {"msg": "编辑文章🙂"})
else:
title = request.POST['title']
content = request.POST['content']
author = request.session['loginUser']
print(title, content)
if len(title) <= 0:
return render(request, 'blog/add_article.html', {"msg": "标题不能为空😫"})
elif len(content) <= 0:
return render(request, 'blog/add_article.html', {"msg": "内容不能为空😫"})
article = models.Article(title=title, content=content, author=author)
article.save()
# 更新缓存
cacheUtils.get_all_article(change=True)
# return render(request, "blog/show_article.html", {'article': article})
return JsonResponse({"msg": "文章添加成功", "success": True})
@require_login
def del_article(request, a_id):
"""
删除文章
:param request: 请求头对象
:param a_id:
:return:
"""
logger = logging.getLogger("django")
logger.debug("删除文章。。。")
article = models.Article.objects.get(id=a_id)
article.delete()
return redirect(reverse("blog:self_all_article"))
@require_login
def update_article(request, a_id):
"""
修改文章
:param request: 请求头对象
:param a_id:
:return:
"""
logger = logging.getLogger("django")
logger.debug("修改文章。。。")
article = models.Article.objects.get(pk=a_id)
if request.method == "GET":
return render(request, "blog/update_article.html", {'article': article})
else:
title = request.POST['title']
content = request.POST['content']
article.title = title
article.content = content
article.save()
return redirect(reverse("blog:show_article", kwargs={"a_id": a_id}))
@require_login
def show_article(request, a_id):
"""
展示单篇文章信息
:param request:请求头对象
:param a_id:
:return:
"""
logger = logging.getLogger("django")
logger.debug("展示单篇文章。。。")
article = models.Article.objects.get(pk=a_id)
return render(request, "blog/show_article.html", {'article': article})
def only_show_article(request, a_id):
"""
展示单篇文章信息
:param request:请求头对象
:param a_id:
:return:
"""
article = models.Article.objects.get(pk=a_id)
return render(request, "blog/only_show_article.html", {'article': article})
@require_login
def self_all_article(request):
"""
展示登陆用户的所有文章
:param request: 请求头对象
:return:
"""
logger = logging.getLogger("django")
logger.debug("展示用户的所有文章。。。")
user_id = request.session['loginUser'].id
articles = models.Article.objects.filter(author=user_id).order_by("-publicTime")
# print(articles[0].title)
for article in articles:
reg = r'<[^>]+>'
article.content = re.sub(reg, '', article.content)
return render(request, "blog/self_all_article.html", {"articles": articles})
def code(request):
"""
生成验证码
:param request: 请求头对象
:return:
"""
img, code = utils.create_code()
# 将code保存到session中
request.session['code'] = code
# 返回图片
file = BytesIO()
img.save(file, 'PNG')
return HttpResponse(file.getvalue(), "image/png")
def check_nickname(request, nickname):
qs = models.User.objects.filter(nickname=nickname)
if len(qs) > 0:
return JsonResponse({"n_msg": "该用户名已存在", "success": False})
else:
return JsonResponse({"n_msg": "用户名可用", "success": True}) | [
"411763764@qq.com"
] | 411763764@qq.com |
5ebcb0ec78937bbee7a040f03b34c8f9bf0019cd | e0aed0114f9603e5290bc1d82e68a9b44918f4eb | /hole_spline.txt | 528d14af5f4ae80f4034deb57102879a6305dc65 | [] | no_license | arun-r-srinivasa/PIMESH | f61341aae7086a1131ad5256d193a85d6db68d89 | 344aff46cd32ed6b9ea1b37aa616307e47d880a3 | refs/heads/main | 2023-08-27T17:13:27.649049 | 2021-11-15T02:11:07 | 2021-11-15T02:11:07 | 428,094,050 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 576 | txt | # 2-D boundary description
# "#" is the comment line signal
# *SIZE= How many loops do we have in the boundary :
# go ccw for externl and CW for internal boundaries
#*LOOP is to list the segents in a loops
# Dont put comments in the loop section
#each segement has
#Number of points, Order of spline,
#whther it is periodic or not (for smooth closed loops like holes)
#points x,y,x,y,x,y etc
#*END is the end of the file
*SIZE
2
*LOOP
20,1, 0,-1,-1, 1,-1
20,1,0, 1,-1, 1,1
20,1,0, 1,1, -1,1
20,1,0, -1,1, -1,-1
*LOOP
40,3, 1, 0,-0.5, -0.5,0, 0,0.5, 0.5,0, 0,-0.5
*END | [
"43240303+arun-r-srinivasa@users.noreply.github.com"
] | 43240303+arun-r-srinivasa@users.noreply.github.com |
82ebb109b1ff339870f05f14eaf94145818d3893 | b7fab13642988c0e6535fb75ef6cb3548671d338 | /tools/ydk-py-master/cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_kim_tpa_cfg.py | 430e9090d74c55f9bc626396251b682ad1b8f265 | [
"Apache-2.0"
] | permissive | juancsosap/yangtraining | 6ad1b8cf89ecdebeef094e4238d1ee95f8eb0824 | 09d8bcc3827575a45cb8d5d27186042bf13ea451 | refs/heads/master | 2022-08-05T01:59:22.007845 | 2019-08-01T15:53:08 | 2019-08-01T15:53:08 | 200,079,665 | 0 | 1 | null | 2021-12-13T20:06:17 | 2019-08-01T15:54:15 | Python | UTF-8 | Python | false | false | 44,805 | py | """ Cisco_IOS_XR_kim_tpa_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR kim\-tpa package configuration.
This module contains definitions
for the following management objects\:
tpa\: tpa configuration commands
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
"""
from ydk.entity_utils import get_relative_entity_path as _get_relative_entity_path
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YPYError, YPYModelError
from ydk.errors.error_handler import handle_type_error as _handle_type_error
class Tpa(Entity):
"""
tpa configuration commands
.. attribute:: statistics
Statistics
**type**\: :py:class:`Statistics <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.Statistics>`
.. attribute:: vrf_names
VRF container
**type**\: :py:class:`VrfNames <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames>`
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa, self).__init__()
self._top_entity = None
self.yang_name = "tpa"
self.yang_parent_name = "Cisco-IOS-XR-kim-tpa-cfg"
self.statistics = Tpa.Statistics()
self.statistics.parent = self
self._children_name_map["statistics"] = "statistics"
self._children_yang_names.add("statistics")
self.vrf_names = Tpa.VrfNames()
self.vrf_names.parent = self
self._children_name_map["vrf_names"] = "vrf-names"
self._children_yang_names.add("vrf-names")
class VrfNames(Entity):
"""
VRF container
.. attribute:: vrf_name
VRF name
**type**\: list of :py:class:`VrfName <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName>`
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames, self).__init__()
self.yang_name = "vrf-names"
self.yang_parent_name = "tpa"
self.vrf_name = YList(self)
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in () and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames, self).__setattr__(name, value)
class VrfName(Entity):
"""
VRF name
.. attribute:: vrf_name <key>
VRF name
**type**\: str
**length:** 1..32
.. attribute:: address_family
Address family
**type**\: :py:class:`AddressFamily <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName.AddressFamily>`
.. attribute:: east_west_names
EastWest container
**type**\: :py:class:`EastWestNames <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName.EastWestNames>`
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName, self).__init__()
self.yang_name = "vrf-name"
self.yang_parent_name = "vrf-names"
self.vrf_name = YLeaf(YType.str, "vrf-name")
self.address_family = Tpa.VrfNames.VrfName.AddressFamily()
self.address_family.parent = self
self._children_name_map["address_family"] = "address-family"
self._children_yang_names.add("address-family")
self.east_west_names = Tpa.VrfNames.VrfName.EastWestNames()
self.east_west_names.parent = self
self._children_name_map["east_west_names"] = "east-west-names"
self._children_yang_names.add("east-west-names")
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in ("vrf_name") and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames.VrfName, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames.VrfName, self).__setattr__(name, value)
class EastWestNames(Entity):
"""
EastWest container
.. attribute:: east_west_name
East West interface
**type**\: list of :py:class:`EastWestName <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName.EastWestNames.EastWestName>`
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName.EastWestNames, self).__init__()
self.yang_name = "east-west-names"
self.yang_parent_name = "vrf-name"
self.east_west_name = YList(self)
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in () and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames.VrfName.EastWestNames, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames.VrfName.EastWestNames, self).__setattr__(name, value)
class EastWestName(Entity):
"""
East West interface
.. attribute:: east_west_name <key>
Interface
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: interface
Interface
**type**\: str
.. attribute:: vrf
VRF name
**type**\: str
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName.EastWestNames.EastWestName, self).__init__()
self.yang_name = "east-west-name"
self.yang_parent_name = "east-west-names"
self.east_west_name = YLeaf(YType.str, "east-west-name")
self.interface = YLeaf(YType.str, "interface")
self.vrf = YLeaf(YType.str, "vrf")
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in ("east_west_name",
"interface",
"vrf") and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames.VrfName.EastWestNames.EastWestName, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames.VrfName.EastWestNames.EastWestName, self).__setattr__(name, value)
def has_data(self):
return (
self.east_west_name.is_set or
self.interface.is_set or
self.vrf.is_set)
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
self.east_west_name.yfilter != YFilter.not_set or
self.interface.yfilter != YFilter.not_set or
self.vrf.yfilter != YFilter.not_set)
def get_segment_path(self):
path_buffer = ""
path_buffer = "east-west-name" + "[east-west-name='" + self.east_west_name.get() + "']" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
raise YPYModelError("ancestor cannot be None as one of the ancestors is a list")
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
if (self.east_west_name.is_set or self.east_west_name.yfilter != YFilter.not_set):
leaf_name_data.append(self.east_west_name.get_name_leafdata())
if (self.interface.is_set or self.interface.yfilter != YFilter.not_set):
leaf_name_data.append(self.interface.get_name_leafdata())
if (self.vrf.is_set or self.vrf.yfilter != YFilter.not_set):
leaf_name_data.append(self.vrf.get_name_leafdata())
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
return None
def has_leaf_or_child_of_name(self, name):
if(name == "east-west-name" or name == "interface" or name == "vrf"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
if(value_path == "east-west-name"):
self.east_west_name = value
self.east_west_name.value_namespace = name_space
self.east_west_name.value_namespace_prefix = name_space_prefix
if(value_path == "interface"):
self.interface = value
self.interface.value_namespace = name_space
self.interface.value_namespace_prefix = name_space_prefix
if(value_path == "vrf"):
self.vrf = value
self.vrf.value_namespace = name_space
self.vrf.value_namespace_prefix = name_space_prefix
def has_data(self):
for c in self.east_west_name:
if (c.has_data()):
return True
return False
def has_operation(self):
for c in self.east_west_name:
if (c.has_operation()):
return True
return self.yfilter != YFilter.not_set
def get_segment_path(self):
path_buffer = ""
path_buffer = "east-west-names" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
raise YPYModelError("ancestor cannot be None as one of the ancestors is a list")
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
if (child_yang_name == "east-west-name"):
for c in self.east_west_name:
segment = c.get_segment_path()
if (segment_path == segment):
return c
c = Tpa.VrfNames.VrfName.EastWestNames.EastWestName()
c.parent = self
local_reference_key = "ydk::seg::%s" % segment_path
self._local_refs[local_reference_key] = c
self.east_west_name.append(c)
return c
return None
def has_leaf_or_child_of_name(self, name):
if(name == "east-west-name"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
pass
class AddressFamily(Entity):
"""
Address family
.. attribute:: ipv4
IPv4 configuration
**type**\: :py:class:`Ipv4 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName.AddressFamily.Ipv4>`
.. attribute:: ipv6
IPv6 configuration
**type**\: :py:class:`Ipv6 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_kim_tpa_cfg.Tpa.VrfNames.VrfName.AddressFamily.Ipv6>`
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName.AddressFamily, self).__init__()
self.yang_name = "address-family"
self.yang_parent_name = "vrf-name"
self.ipv4 = Tpa.VrfNames.VrfName.AddressFamily.Ipv4()
self.ipv4.parent = self
self._children_name_map["ipv4"] = "ipv4"
self._children_yang_names.add("ipv4")
self.ipv6 = Tpa.VrfNames.VrfName.AddressFamily.Ipv6()
self.ipv6.parent = self
self._children_name_map["ipv6"] = "ipv6"
self._children_yang_names.add("ipv6")
class Ipv6(Entity):
"""
IPv6 configuration
.. attribute:: default_route
Default interface used for routing
**type**\: str
.. attribute:: update_source
Interface name for source address
**type**\: str
**pattern:** (([a\-zA\-Z0\-9\_]\*\\d+/){3,4}\\d+)\|(([a\-zA\-Z0\-9\_]\*\\d+/){3,4}\\d+\\.\\d+)\|(([a\-zA\-Z0\-9\_]\*\\d+/){2}([a\-zA\-Z0\-9\_]\*\\d+))\|(([a\-zA\-Z0\-9\_]\*\\d+/){2}([a\-zA\-Z0\-9\_]+))\|([a\-zA\-Z0\-9\_\-]\*\\d+)\|([a\-zA\-Z0\-9\_\-]\*\\d+\\.\\d+)\|(mpls)\|(dwdm)
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv6, self).__init__()
self.yang_name = "ipv6"
self.yang_parent_name = "address-family"
self.default_route = YLeaf(YType.str, "default-route")
self.update_source = YLeaf(YType.str, "update-source")
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in ("default_route",
"update_source") and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv6, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv6, self).__setattr__(name, value)
def has_data(self):
return (
self.default_route.is_set or
self.update_source.is_set)
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
self.default_route.yfilter != YFilter.not_set or
self.update_source.yfilter != YFilter.not_set)
def get_segment_path(self):
path_buffer = ""
path_buffer = "ipv6" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
raise YPYModelError("ancestor cannot be None as one of the ancestors is a list")
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
if (self.default_route.is_set or self.default_route.yfilter != YFilter.not_set):
leaf_name_data.append(self.default_route.get_name_leafdata())
if (self.update_source.is_set or self.update_source.yfilter != YFilter.not_set):
leaf_name_data.append(self.update_source.get_name_leafdata())
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
return None
def has_leaf_or_child_of_name(self, name):
if(name == "default-route" or name == "update-source"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
if(value_path == "default-route"):
self.default_route = value
self.default_route.value_namespace = name_space
self.default_route.value_namespace_prefix = name_space_prefix
if(value_path == "update-source"):
self.update_source = value
self.update_source.value_namespace = name_space
self.update_source.value_namespace_prefix = name_space_prefix
class Ipv4(Entity):
"""
IPv4 configuration
.. attribute:: default_route
Default interface used for routing
**type**\: str
.. attribute:: update_source
Interface name for source address
**type**\: str
**pattern:** (([a\-zA\-Z0\-9\_]\*\\d+/){3,4}\\d+)\|(([a\-zA\-Z0\-9\_]\*\\d+/){3,4}\\d+\\.\\d+)\|(([a\-zA\-Z0\-9\_]\*\\d+/){2}([a\-zA\-Z0\-9\_]\*\\d+))\|(([a\-zA\-Z0\-9\_]\*\\d+/){2}([a\-zA\-Z0\-9\_]+))\|([a\-zA\-Z0\-9\_\-]\*\\d+)\|([a\-zA\-Z0\-9\_\-]\*\\d+\\.\\d+)\|(mpls)\|(dwdm)
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv4, self).__init__()
self.yang_name = "ipv4"
self.yang_parent_name = "address-family"
self.default_route = YLeaf(YType.str, "default-route")
self.update_source = YLeaf(YType.str, "update-source")
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in ("default_route",
"update_source") and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv4, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.VrfNames.VrfName.AddressFamily.Ipv4, self).__setattr__(name, value)
def has_data(self):
return (
self.default_route.is_set or
self.update_source.is_set)
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
self.default_route.yfilter != YFilter.not_set or
self.update_source.yfilter != YFilter.not_set)
def get_segment_path(self):
path_buffer = ""
path_buffer = "ipv4" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
raise YPYModelError("ancestor cannot be None as one of the ancestors is a list")
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
if (self.default_route.is_set or self.default_route.yfilter != YFilter.not_set):
leaf_name_data.append(self.default_route.get_name_leafdata())
if (self.update_source.is_set or self.update_source.yfilter != YFilter.not_set):
leaf_name_data.append(self.update_source.get_name_leafdata())
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
return None
def has_leaf_or_child_of_name(self, name):
if(name == "default-route" or name == "update-source"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
if(value_path == "default-route"):
self.default_route = value
self.default_route.value_namespace = name_space
self.default_route.value_namespace_prefix = name_space_prefix
if(value_path == "update-source"):
self.update_source = value
self.update_source.value_namespace = name_space
self.update_source.value_namespace_prefix = name_space_prefix
def has_data(self):
return (
(self.ipv4 is not None and self.ipv4.has_data()) or
(self.ipv6 is not None and self.ipv6.has_data()))
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
(self.ipv4 is not None and self.ipv4.has_operation()) or
(self.ipv6 is not None and self.ipv6.has_operation()))
def get_segment_path(self):
path_buffer = ""
path_buffer = "address-family" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
raise YPYModelError("ancestor cannot be None as one of the ancestors is a list")
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
if (child_yang_name == "ipv4"):
if (self.ipv4 is None):
self.ipv4 = Tpa.VrfNames.VrfName.AddressFamily.Ipv4()
self.ipv4.parent = self
self._children_name_map["ipv4"] = "ipv4"
return self.ipv4
if (child_yang_name == "ipv6"):
if (self.ipv6 is None):
self.ipv6 = Tpa.VrfNames.VrfName.AddressFamily.Ipv6()
self.ipv6.parent = self
self._children_name_map["ipv6"] = "ipv6"
return self.ipv6
return None
def has_leaf_or_child_of_name(self, name):
if(name == "ipv4" or name == "ipv6"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
pass
def has_data(self):
return (
self.vrf_name.is_set or
(self.address_family is not None and self.address_family.has_data()) or
(self.east_west_names is not None and self.east_west_names.has_data()))
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
self.vrf_name.yfilter != YFilter.not_set or
(self.address_family is not None and self.address_family.has_operation()) or
(self.east_west_names is not None and self.east_west_names.has_operation()))
def get_segment_path(self):
path_buffer = ""
path_buffer = "vrf-name" + "[vrf-name='" + self.vrf_name.get() + "']" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
path_buffer = "Cisco-IOS-XR-kim-tpa-cfg:tpa/vrf-names/%s" % self.get_segment_path()
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
if (self.vrf_name.is_set or self.vrf_name.yfilter != YFilter.not_set):
leaf_name_data.append(self.vrf_name.get_name_leafdata())
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
if (child_yang_name == "address-family"):
if (self.address_family is None):
self.address_family = Tpa.VrfNames.VrfName.AddressFamily()
self.address_family.parent = self
self._children_name_map["address_family"] = "address-family"
return self.address_family
if (child_yang_name == "east-west-names"):
if (self.east_west_names is None):
self.east_west_names = Tpa.VrfNames.VrfName.EastWestNames()
self.east_west_names.parent = self
self._children_name_map["east_west_names"] = "east-west-names"
return self.east_west_names
return None
def has_leaf_or_child_of_name(self, name):
if(name == "address-family" or name == "east-west-names" or name == "vrf-name"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
if(value_path == "vrf-name"):
self.vrf_name = value
self.vrf_name.value_namespace = name_space
self.vrf_name.value_namespace_prefix = name_space_prefix
def has_data(self):
for c in self.vrf_name:
if (c.has_data()):
return True
return False
def has_operation(self):
for c in self.vrf_name:
if (c.has_operation()):
return True
return self.yfilter != YFilter.not_set
def get_segment_path(self):
path_buffer = ""
path_buffer = "vrf-names" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
path_buffer = "Cisco-IOS-XR-kim-tpa-cfg:tpa/%s" % self.get_segment_path()
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
if (child_yang_name == "vrf-name"):
for c in self.vrf_name:
segment = c.get_segment_path()
if (segment_path == segment):
return c
c = Tpa.VrfNames.VrfName()
c.parent = self
local_reference_key = "ydk::seg::%s" % segment_path
self._local_refs[local_reference_key] = c
self.vrf_name.append(c)
return c
return None
def has_leaf_or_child_of_name(self, name):
if(name == "vrf-name"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
pass
class Statistics(Entity):
"""
Statistics
.. attribute:: statistics_update_frequency
Statistics update frequency into Linux
**type**\: int
**range:** \-2147483648..2147483647
**units**\: second
"""
_prefix = 'kim-tpa-cfg'
_revision = '2015-11-09'
def __init__(self):
super(Tpa.Statistics, self).__init__()
self.yang_name = "statistics"
self.yang_parent_name = "tpa"
self.statistics_update_frequency = YLeaf(YType.int32, "statistics-update-frequency")
def __setattr__(self, name, value):
self._check_monkey_patching_error(name, value)
with _handle_type_error():
if name in self.__dict__ and isinstance(self.__dict__[name], YList):
raise YPYModelError("Attempt to assign value of '{}' to YList ldata. "
"Please use list append or extend method."
.format(value))
if isinstance(value, Enum.YLeaf):
value = value.name
if name in ("statistics_update_frequency") and name in self.__dict__:
if isinstance(value, YLeaf):
self.__dict__[name].set(value.get())
elif isinstance(value, YLeafList):
super(Tpa.Statistics, self).__setattr__(name, value)
else:
self.__dict__[name].set(value)
else:
if hasattr(value, "parent") and name != "parent":
if hasattr(value, "is_presence_container") and value.is_presence_container:
value.parent = self
elif value.parent is None and value.yang_name in self._children_yang_names:
value.parent = self
super(Tpa.Statistics, self).__setattr__(name, value)
def has_data(self):
return self.statistics_update_frequency.is_set
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
self.statistics_update_frequency.yfilter != YFilter.not_set)
def get_segment_path(self):
path_buffer = ""
path_buffer = "statistics" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (ancestor is None):
path_buffer = "Cisco-IOS-XR-kim-tpa-cfg:tpa/%s" % self.get_segment_path()
else:
path_buffer = _get_relative_entity_path(self, ancestor, path_buffer)
leaf_name_data = LeafDataList()
if (self.statistics_update_frequency.is_set or self.statistics_update_frequency.yfilter != YFilter.not_set):
leaf_name_data.append(self.statistics_update_frequency.get_name_leafdata())
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
return None
def has_leaf_or_child_of_name(self, name):
if(name == "statistics-update-frequency"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
if(value_path == "statistics-update-frequency"):
self.statistics_update_frequency = value
self.statistics_update_frequency.value_namespace = name_space
self.statistics_update_frequency.value_namespace_prefix = name_space_prefix
def has_data(self):
return (
(self.statistics is not None and self.statistics.has_data()) or
(self.vrf_names is not None and self.vrf_names.has_data()))
def has_operation(self):
return (
self.yfilter != YFilter.not_set or
(self.statistics is not None and self.statistics.has_operation()) or
(self.vrf_names is not None and self.vrf_names.has_operation()))
def get_segment_path(self):
path_buffer = ""
path_buffer = "Cisco-IOS-XR-kim-tpa-cfg:tpa" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
path_buffer = ""
if (not ancestor is None):
raise YPYModelError("ancestor has to be None for top-level node")
path_buffer = self.get_segment_path()
leaf_name_data = LeafDataList()
entity_path = EntityPath(path_buffer, leaf_name_data)
return entity_path
def get_child_by_name(self, child_yang_name, segment_path):
child = self._get_child_by_seg_name([child_yang_name, segment_path])
if child is not None:
return child
if (child_yang_name == "statistics"):
if (self.statistics is None):
self.statistics = Tpa.Statistics()
self.statistics.parent = self
self._children_name_map["statistics"] = "statistics"
return self.statistics
if (child_yang_name == "vrf-names"):
if (self.vrf_names is None):
self.vrf_names = Tpa.VrfNames()
self.vrf_names.parent = self
self._children_name_map["vrf_names"] = "vrf-names"
return self.vrf_names
return None
def has_leaf_or_child_of_name(self, name):
if(name == "statistics" or name == "vrf-names"):
return True
return False
def set_value(self, value_path, value, name_space, name_space_prefix):
pass
def clone_ptr(self):
self._top_entity = Tpa()
return self._top_entity
| [
"juan.c.sosa.p@gmail.com"
] | juan.c.sosa.p@gmail.com |
735651bc3e8864823159cd6993b999c60eeaebcc | 6da73385ac62440831fc37cc6d88c3dc49e12bf3 | /lpthw/ex6.py | ed5ac525af458bf42421770b207c604ea043671e | [] | no_license | Refath/Pythontest | afdd1fe1ed8bbd1e7e7ba4a89148ea46bd1f97dd | 2cc3d90a8c71cb9804d807beefd30aa83bd3dde2 | refs/heads/master | 2021-01-19T23:47:36.139320 | 2017-04-21T22:52:46 | 2017-04-21T22:52:46 | 89,027,163 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 491 | py | from sys import argv
script, user_name = argv
prompt = '> '
print "Hi %s, I'm the %s script." %(user_name, script)
print "I'd like to ask you a few questions."
print "Do you like me, %s" %user_name
likes = raw_input(prompt)
print "Where do you live, %s" %user_name
lives = raw_input(prompt)
print "What kind of computer do you have?"
computer = raw_input(prompt)
print """
Alright, so you said %r about liking me.
You live in %r. You have a %r computer.
""" %(likes, lives, computer)
| [
"refath@Refaths-Air.home"
] | refath@Refaths-Air.home |
054067c340e472315a23b82e04a23b27969d7b49 | e23a4f57ce5474d468258e5e63b9e23fb6011188 | /115_testing/examples/Unit Testing with Python/2-unit-exercise-files/demos/after/healthcare/test_prescription.py | 2cc51d7df6e56552f0ca07512cb6fe09620d64e5 | [] | no_license | syurskyi/Python_Topics | 52851ecce000cb751a3b986408efe32f0b4c0835 | be331826b490b73f0a176e6abed86ef68ff2dd2b | refs/heads/master | 2023-06-08T19:29:16.214395 | 2023-05-29T17:09:11 | 2023-05-29T17:09:11 | 220,583,118 | 3 | 2 | null | 2023-02-16T03:08:10 | 2019-11-09T02:58:47 | Python | UTF-8 | Python | false | false | 394 | py | from datetime import date, timedelta
from prescription import Prescription
def days_ago(days):
return date.today() - timedelta(days=days)
class TestPrescription:
def test_days_taken_excludes_future_dates(self):
prescription = Prescription("Codeine", dispense_date = days_ago(days=2), days_supply=4)
assert prescription.days_taken() == [days_ago(2), days_ago(1)]
| [
"sergejyurskyj@yahoo.com"
] | sergejyurskyj@yahoo.com |
96c51cb4f5ca229db5576782df15989d4fd82cb6 | 035de2a49ef07b2c9df324aa946ac5c6db967a15 | /main.py | 8d4342f1e6d4fc4a705d7f52f6bccb3e6ec75867 | [] | no_license | DenisOvchinnikov93/IBM-data-science-capstone | b813df116d969403b175faccc0d0a8ce7446672b | 0584081422cdc2ca1a4f861e1dee705f349ef856 | refs/heads/master | 2023-07-08T08:13:14.404082 | 2021-08-12T10:40:43 | 2021-08-12T10:40:43 | 394,453,262 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,279 | py | # Import required libraries
import pandas as pd
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
import plotly.express as px
# Read the airline data into pandas dataframe
spacex_df = pd.read_csv("spacex_launch_dash.csv")
max_payload = spacex_df['Payload Mass (kg)'].max()
min_payload = spacex_df['Payload Mass (kg)'].min()
sites=spacex_df['Launch Site'].unique()
sites_options=[]
for site in sites:
sites_options.append({'label': site, 'value': site})
sites_options=[{'label': 'All Sites', 'value': 'All Sites'}]+sites_options
# Create a dash application
app = dash.Dash(__name__)
# Create an app layout
app.layout = html.Div(children=[html.H1('SpaceX Launch Records Dashboard',
style={'textAlign': 'center', 'color': '#503D36',
'font-size': 40}),
# TASK 1: Add a dropdown list to enable Launch Site selection
# The default select value is for ALL sites
dcc.Dropdown(id='site-dropdown',
options=sites_options,
multi=False,
value='All Sites'),
html.Br(),
# TASK 2: Add a pie chart to show the total successful launches count for all sites
# If a specific launch site was selected, show the Success vs. Failed counts for the site
html.Div(dcc.Graph(id='success-pie-chart')),
html.Br(),
html.P("Payload range (Kg):"),
# TASK 3: Add a slider to select payload range
dcc.RangeSlider(id='payload-slider',min=0, max=10000,
value=[min_payload, max_payload],
step=1000),
# TASK 4: Add a scatter chart to show the correlation between payload and launch success
html.Div(dcc.Graph(id='success-payload-scatter-chart')),
])
# TASK 2:
# Add a callback function for `site-dropdown` as input, `success-pie-chart` as output
@app.callback( Output(component_id='success-pie-chart', component_property='figure'),
Input(component_id='site-dropdown', component_property='value'))
def update_pie_chart(input_site):
if input_site=='All Sites':
df=spacex_df.loc[spacex_df['class']==1]
fig=px.pie(df, names='Launch Site', title='Total success launches per site')
else:
df=spacex_df.loc[spacex_df['Launch Site']==input_site]
fig=px.pie(df, names='class',
title='Successful vs unsuccessful launches from '+input_site+' site')#, names='Mission Outcome')
#else:
#fig={}
return fig
# TASK 4:
# Add a callback function for `site-dropdown` and `payload-slider` as inputs, `success-payload-scatter-chart` as output
@app.callback( Output(component_id='success-payload-scatter-chart', component_property='figure'),
Input(component_id='site-dropdown', component_property='value'),
Input(component_id='payload-slider', component_property='value'))
def update_scatter_plot(input_site, payload_interval):
if input_site=='All Sites':
df=spacex_df.loc[ (spacex_df['Payload Mass (kg)']>= payload_interval[0]) &
(spacex_df['Payload Mass (kg)']<= payload_interval[1])]
else:
df = spacex_df.loc[(spacex_df['Payload Mass (kg)'] >= payload_interval[0]) &
(spacex_df['Payload Mass (kg)'] <= payload_interval[1]) &
(spacex_df['Launch Site'] == input_site)]
fig=px.scatter(df, x='Payload Mass (kg)', y= 'class', color='Booster Version Category',
title='Correlation Between Payload and Success for '+input_site)
return fig
# Run the app
if __name__ == '__main__':
app.run_server()
| [
"noreply@github.com"
] | DenisOvchinnikov93.noreply@github.com |
7359386547f80f26bc08414c6ce3fb16897e32fd | cfd003546918784814d39b6bcd7a3dc3db496f7b | /Computing Revision/Computing Quizzes/Lecture Test 2/T1.py | a5337cd8207870b2e7326ab219f0c5eb0e0fdea9 | [] | no_license | TCReaper/Computing | 95d325d7e08ab8fe396475883d6778160c8e4bf3 | c6a4a000be4492ea3ba874f22d8ab678734766e3 | refs/heads/master | 2023-06-02T10:55:33.152522 | 2023-05-16T06:34:42 | 2023-05-16T06:34:42 | 83,628,544 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 1,632 | py | # Name: Hao Shaun
# 2017 - Term 2 - SH1 Computing Practical Lecture Test 2
# Code for Task 1
import random
makeList = True
data = []
while makeList:
integer = input("Integer to add to list (x to stop): ")
if integer.lower() == "x":
makeList = False
else:
data.append(int(integer))
def bubble(data):
print("bubble sort")
comparisons = 0
for x in range(len(data)-1):
for e in data:
for i in range(len(data)-1):
swap = False
if data[i] > data[i+1]:
comparisons += 1
data[i],data[i+1]=data[i+1],data[i]
swap = True
if not swap:
break
print(data)
print(comparisons)
def insertion(data):
print("insertion sort")
comparisons = 0
for x in range(len(data)-1):
for i in range(1,len(data)):
comparisons += 1
while len(data)>i>0 and data[i] < data[i-1]:
data[i],data[i-1]=data[i-1],data[i]
print(data)
print(comparisons)
bubble(data)
insertion(data)
f = open("LIST1.TXT","w")
f.close()
rand100 = []
for i in range(101):
integer = random.randint(1,101)
rand100.append(integer)
f = open("LIST1.TXT","a")
f.write(str(integer)+" ")
f.close()
f = open("LIST2.TXT","w")
f.close()
rand100000 = []
##for i in range(100001):
## integer = random.randint(1,101)
## rand100000.append(integer)
## f = open("LIST2.TXT","a")
## f.write(str(integer)+" ")
## f.close()
##print(rand100000)
rand100v2 = rand100
bubble(rand100)
insertion(rand100v2)
| [
"haoshaun@gmail.com"
] | haoshaun@gmail.com |
1df723d7db513fc0a9329273b2523c84cdb83a0d | 00d79e80bebf2eb96e11c54e4025abf649d326f0 | /test_interleave.py | 6445e3bb6fe5600a33ae8c387e8af71c40c9fe69 | [] | no_license | VimanyuAgg/code-morsels | 45e67361e9ee5c61e78db812800116457f76a119 | 87f30b91ff1770871d05b784efacd1656f2246ef | refs/heads/master | 2021-06-11T00:15:05.791944 | 2021-03-18T01:40:01 | 2021-03-18T01:40:01 | 138,918,691 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,996 | py | from itertools import count
import unittest
from w15_interleave import iterleave_after_2 as interleave
class InterleaveTests(unittest.TestCase):
"""Tests for interleave."""
def assertIterableEqual(self, iterable1, iterable2):
self.assertEqual(list(iterable1), list(iterable2))
def test_empty_lists(self):
self.assertIterableEqual(interleave([], []), [])
def test_single_item_each(self):
self.assertIterableEqual(interleave([1], [2]), [1, 2])
def test_two_items_each(self):
self.assertIterableEqual(interleave([1, 2], [3, 4]), [1, 3, 2, 4])
def test_four_items_each(self):
in1 = [1, 2, 3, 4]
in2 = [5, 6, 7, 8]
out = [1, 5, 2, 6, 3, 7, 4, 8]
self.assertIterableEqual(interleave(in1, in2), out)
def test_none_value(self):
in1 = [1, 2, 3, None]
in2 = [4, 5, 6, 7]
out = [1, 4, 2, 5, 3, 6, None, 7]
self.assertIterableEqual(interleave(in1, in2), out)
# To test the Bonus part of this exercise, comment out the following line
@unittest.expectedFailure
def test_non_sequences(self):
in1 = [1, 2, 3, 4]
in2 = (n**2 for n in in1)
out = [1, 1, 2, 4, 3, 9, 4, 16]
self.assertIterableEqual(interleave(in1, in2), out)
# To test the Bonus part of this exercise, comment out the following line
@unittest.expectedFailure
def test_response_is_iterator(self):
in1 = [1, 2, 3]
in2 = [4, 5, 6]
squares = (n**2 for n in in1)
output = interleave(in1, in2)
self.assertIs(iter(output), iter(output))
output = interleave(squares, squares)
self.assertEqual(next(output), 1)
self.assertEqual(next(output), 4)
self.assertEqual(next(squares), 9)
iterator = interleave(count(), count())
self.assertEqual(next(iterator), next(iterator))
if __name__ == "__main__":
unittest.main() | [
"vimanyu1022007@gmail.com"
] | vimanyu1022007@gmail.com |
967de077c6655cf0d17b569c05f0e06ee1f71005 | d864887f4ea948ad0774b16d2332482593ec643c | /0x10-python-network_0/6-peak.py | 320b4eba97eb9693b104842da6b3ee4406d59673 | [] | no_license | mauroxcf/holbertonschool-higher_level_programming | c9729bcfdbac5c80af0319f91b17a59983dff8df | 7230de512dfebec90e7ea3341226727afe3bb5c7 | refs/heads/master | 2023-04-02T04:47:27.711906 | 2021-04-04T06:01:46 | 2021-04-04T06:01:46 | 291,758,236 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 664 | py | #!/usr/bin/python3
"""
Function to find a number in a list, whos its highter that the next one,
this numbers its call it peak and it can be more than one in the list
"""
def find_peak(list_of_integers):
"""
find the peak of a list of integers
"""
temp = None
length = len(list_of_integers)
for i in range(len(list_of_integers)):
if list_of_integers[i] > 0:
temp = list_of_integers[i]
if i < length - 1:
if temp is None or temp < list_of_integers[i+1]:
continue
if temp > list_of_integers[i+1]:
return temp
else:
return temp
| [
"maurox03@gmail.com"
] | maurox03@gmail.com |
703852249c8309ee3238a14d4db2185f3c1e0cde | 306a8a2475b0d86b016be948b368dd44da3d109a | /bounties/tests/test_view_get_pirate.py | 907cb8213a9f790a75a4b0864e526d9763e49ca2 | [] | no_license | kgfig/onepiecebounties | fb9093a026b653d3ec114fdc812f0471c6c04485 | 305a9b022aa078f1fec70da45d9263aca16b564a | refs/heads/master | 2020-12-03T04:17:19.073372 | 2016-09-18T01:30:04 | 2016-09-18T01:30:04 | 95,845,299 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,783 | py | from django.conf import settings
from django.core.urlresolvers import resolve, reverse
from django.test import TestCase
from django.template.defaultfilters import slugify
from bounties import factories, views
from bounties.models import Crew, Pirate
class GetPirateTest(TestCase):
def test_url_resolves_to_get_pirate_view(self):
luffy = factories.Pirate()
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id':1}))
self.assertEqual(response.resolver_match.func, views.get_pirate)
def test_view_returns_matching_pirate(self):
alvida = factories.Pirate(name='Iron Mace Alvida', bounty=None, crew=None)
luffy = factories.Pirate()
result = Pirate.objects.get(name='Monkey D. Luffy')
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': result.id,}))
self.assertContains(response, result.name)
def test_view_returns_profile_template(self):
pirate = factories.Pirate()
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': pirate.id,}))
self.assertTemplateUsed(response, 'profile.html')
def test_view_passes_complete_pirate_context_to_template(self):
crew = factories.Crew(name='Heart Pirates')
pirate = factories.Pirate(name='Trafalgar D. Law', bounty=500000000, crew=crew)
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': pirate.id,}))
pirate_context = response.context['pirate']
self.assertEqual(pirate_context, pirate)
def test_view_passes_list_of_pirates_context_to_template(self):
hancock = factories.Pirate(name='Boa Hancock', bounty=None, crew=None)
marigold = factories.Pirate(name='Boa Marigold', bounty=None, crew=None)
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': hancock.id,}))
list_context = response.context['pirates']
self.assertIn(hancock, list_context)
def test_template_shows_pirate_bounty(self):
pirate = factories.Pirate()
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': pirate.id,}))
self.assertContains(response, pirate.formatted_bounty())
def test_template_has_correct_pirate_image(self):
pirate = factories.Pirate()
other_pirate = factories.Pirate(name='Tony Tony Chopper', bounty=100)
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': pirate.id,}))
self.assertContains(response, pirate.filename())
new_response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': other_pirate.id,}))
self.assertContains(new_response, other_pirate.filename())
def test_template_does_not_show_bounty_if_pirate_has_no_bounty(self):
no_bounty_pirate = factories.Pirate(bounty=None)
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': no_bounty_pirate.id,}))
self.assertNotContains(response, '<p class="bounty">', html=True)
def test_template_shows_wanted_status(self):
pirate = factories.Pirate(wanted_status=Pirate.DEAD_OR_ALIVE)
response = self.client.get(reverse('bounties:get_pirate', kwargs={'pirate_id': pirate.id,}))
self.assertContains(response, pirate.get_wanted_status_display().upper())
# TODO Find a way to do this
#def test_view_image_url_is_accessible(self):
# pirate = factories.Pirate()
# # TODO get static url using a better way
# image_url = '%simages/pirates/%s%s' % (settings.STATIC_URL, pirate.filename(), ".png",)
# response = self.client.get(image_url)
# print(image_url)
# self.assertEqual(response.status_code, 200)
| [
"kathleengay.figueroa@gmail.com"
] | kathleengay.figueroa@gmail.com |
17a2e6b3137d8625a1d56461f4627b208209b5a3 | f1bd9203cfde14d27ca932c5a69152f96aeaae06 | /8ball.py | 258ce5ebedaf64ece3868b2796042de529d182fc | [] | no_license | DarkImposter/camp | 36a95c934ed0fad75062c349839d09aafcd99a46 | 13070c72347ebbb44b282d2f2ed5080862c45ee7 | refs/heads/master | 2020-03-20T22:21:08.988223 | 2018-06-18T19:53:27 | 2018-06-18T19:53:27 | 137,794,049 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 323 | py | import random
print('wlocome to the magic eight ball! enter to start!')
q = input('what would you like to ask?')
answer = random.randint(1,4)
if answer == 1:
print('the answer is yes.')
elif answer == 2:
print('the answer is no.')
elif answer == 3:
print('cannot predict now')
else:
print('ask again later') | [
"psexton@cfsnc.org"
] | psexton@cfsnc.org |
2cc79c10bcdc26a64d703f9783b77f198822ecc0 | ce354ae01ebe294d25480c8e50fa178495a43a9e | /setup.py | 9f8e62b231ab367cab2288bf658d99e8f187ae7e | [
"MIT"
] | permissive | somu15/neml | 8971a8ac3bc286e0cbebfd5204756716587138d9 | afdb6bd91e713e8cadbfb1f5d2812e499b1d96df | refs/heads/master | 2023-08-24T00:35:54.903201 | 2021-10-14T01:20:47 | 2021-10-14T01:20:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,291 | py | # This file lightly adapted from the example CMake build provided in the pybind11 distribution
# located at https://github.com/pybind/cmake_example/blob/master/setup.py
# That file is released under an open source license, contained in the pybind11 subdirectory
# of this package.
import os
import re
import sys
import platform
import subprocess
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding = 'utf-8') as f:
long_description = f.read()
class CMakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class CMakeBuild(build_ext):
def run(self):
try:
out = subprocess.check_output(['cmake', '--version'])
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))
if platform.system() == "Windows":
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
if cmake_version < '3.1.0':
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
for ext in self.extensions:
self.build_extension(ext)
def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
# required for auto-detection of auxiliary "native" libs
if not extdir.endswith(os.path.sep):
extdir += os.path.sep
cmake_args = [
'-DWRAP_PYTHON=ON',
'-DUSE_OPENMP=OFF',
'-DBUILD_UTILS=OFF',
'-DCMAKE_INSTALL_PREFIX=' + extdir,
'-DPYTHON_PACKAGE=ON',
'-DPYTHON_EXECUTABLE={}'.format(sys.executable)]
cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
if platform.system() == "Windows":
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
if sys.maxsize > 2**32:
cmake_args += ['-A', 'x64']
build_args += ['--', '/m']
else:
build_args += ['--', '-j2']
env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
self.distribution.get_version())
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
subprocess.check_call(['cmake', '--install', '.'], cwd = self.build_temp)
setup (
# Name of the project
name = 'neml',
# Version
version = '1.4.1',
# One line-description
description = "Nuclear Engineering Material model Library",
# README
long_description = long_description,
long_description_content_type = 'text/markdown',
# Project webpage
url='https://github.com/Argonne-National-Laboratory/neml',
# Author
author='Argonne National Laboratory',
# email
author_email = 'messner@anl.gov',
# Various things for pypi
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent'
],
# Which version of python is needed
python_requires='>=3.6',
# Keywords to help find
keywords='materials structures modeling',
# Definitely not zip safe
zip_safe=False,
# Require the various modules
ext_modules=[CMakeExtension('neml')],
# Add the CMake builder
cmdclass=dict(build_ext=CMakeBuild),
# Get the python files
packages=find_packages(),
# Locate tests
test_suite='nose.collector',
tests_require=['nose'],
# Python dependencies
install_requires=[
'numpy',
'scipy',
'matplotlib',
'networkx'
],
)
| [
"mark.messner@gmail.com"
] | mark.messner@gmail.com |
e9bcff87fe5024055b5ff172e7e346ad5c8a1438 | d98f42497460c204be7c6b351bbf42b5daeab8b6 | /JobMarket/settings.py | 11f6c88602ab65306b5b9ed360c79c147da082b6 | [] | no_license | AllaYeroshchenko/django | 34c39b4305f8cb3f00a45bc36721399439bbc8e1 | 48f7673c6876e3cc2ed69dfe22adcbb45d5421c4 | refs/heads/master | 2021-02-08T20:36:11.779818 | 2020-08-31T03:36:44 | 2020-08-31T03:36:44 | 244,194,413 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,557 | py | """
Django settings for JobMarket project.
Generated by 'django-admin startproject' using Django 3.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os, sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(__file__)
#sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#+ngnq*yal2gb98nku#j=r!w6e0lbwgvpahil_qa^zf%1qgcr3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'resume.apps.ResumeConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'JobMarket.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJECT_ROOT, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'JobMarket.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'RBuilder',
'USER': 'postgres',
'PASSWORD': '12345',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
| [
"yeroshchenko@gmail.com"
] | yeroshchenko@gmail.com |
166842816a225fa5762c3bd609a7ef8037da0c7c | 4b513f8c34a3095c695b5f7b21c040adf28d3bae | /Attic/qe/qe.py | 67b1cf5621a7641196cc3582cab9f8a447c6a854 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | lsst-camera-dh/eotest | 8ca68f149c3a8a2f3ea401d84bd864494b0844d1 | 3a00287d144bf408493e27b0f477a024ab0b2f81 | refs/heads/master | 2022-12-04T13:35:05.909637 | 2022-11-30T20:46:04 | 2022-11-30T20:46:04 | 30,815,403 | 4 | 5 | NOASSERTION | 2022-11-30T20:46:05 | 2015-02-15T02:19:26 | Python | UTF-8 | Python | false | false | 4,872 | py | #QE Calibration
from builtins import str
from builtins import range
import numpy as np
import pylab as p
import matplotlib as mpl
import lsst.afw.image as afwImage
import lsst.afw.geom as afwGeom
import glob
####################################Setup
########User Editable Parameters
#which amps to measure
amps = list(range(1, 16))
#list of gain measured for each amp, from Fe55 measurement (just a placeholder here)
gain = np.ones(16)*5.2
#########Output File
#file with qe for each monochromator setting
outfile_all = "qe_output_all.txt"
#file with qe per LSST filter band
outfile_bands = "qe_output_bands.txt"
#########Input Files
#name of file output from qe_getmedians.py
imdatafile = "qe_medians.txt"
#NIST photodiode calibration data
f1 = "OD142.csv"
f2 = "OD143.csv"
#Harvard setup calibration file
f3 = "WLscan.txt"
########Constants
h = 6.626e-34
c = 299792458
#window transmission - will go away once we recalibrate
windowtr = 0.932
#photodiode surface area
pdarea = 3.14159*((1.13/2)*10**(-2))**2
#pixel area
pxarea = 10e-6**2
#######
#e2v measurements
e2vwl = [400, 500, 600, 800, 900, 1000]
e2vqe = [47.5, 82.9, 93.1, 89.8, 75.5, 23.5]
##########
#LSST Specs
lsstwl = [375, 475, 625, 750, 875]
lsstqe = [40, 80, 88, 85, 80]
############Get auxiliary data
#Get NIST calibration data
od142all = np.recfromtxt(f1, delimiter=",", skip_header=5, names="wl, qe, pcterror, none, none2")
od143all = np.recfromtxt(f2, delimiter=",", skip_header=5, names="wl, qe, pcterror, none, none2")
#Get relevant info from NIST calibration files
wl = od142all["wl"]
od142qe = od142all["qe"]
od142err = od142all["pcterror"]
od143qe = od143all["qe"]
od143err = od143all["pcterror"]
#Get relevant info from Harvard setup calib file
alldata = np.recfromtxt(f3, names=True)
wls = alldata["wl"]
intsphere = alldata["intsphere"]
ccdpos = alldata["ccdpos"]
#Calibrate IS to Detector data by dividing out QE of photodiodes
for i in range(len(intsphere)):
intsphere[i] = intsphere[i]/od143qe[np.where(wl == wls[i])]
for i in range(len(ccdpos)):
ccdpos[i] = ccdpos[i]/od142qe[np.where(wl == wls[i])]
#Get calibrated fraction of light received at detector position
fractionatccd = ccdpos/intsphere
#Read in image data and photodiode readings
imdata = np.recfromtxt(imdatafile, names=True)
amp = imdata['amp']
imwl = imdata['wavelength']
median = imdata['median']
pd = imdata['photodiode']*-1.0e-12
exptime = imdata['exptime']
#Calibrate PD reading
pdiscal = []
for j in range(len(pd)):
pdiscal.append(pd[j]/od143qe[np.where(abs(wls - imwl[j]) <= 0.1)])
pdiscal = np.array(pdiscal)
#########Finally calculate QE
f4 = open(outfile_all, "w+")
f4.write("amp\twl\tqe\n")
#Note: only calculates 400-1000nm because that's what we have calib data for at the moment
for a in amps:
for w in imwl[np.where((amp == a) & (imwl < 1001))]:
qe = 100 * (median[np.where((amp == a) & (imwl == w))]*h*c*pdarea) / ((1.0/gain[a])*exptime[np.where(imwl == w)]
[0]*pdiscal[np.where(imwl == w)][0]*fractionatccd[np.where(abs(wls-w) <= 0.1)]*pxarea*(w*1e-9))
f4.write('\t'.join([str(a), str(w), str(qe[0]), '\n']))
f4.close()
##########Calculate QE per band
f5 = open(outfile_bands, "w+")
f5.write('\t'.join(['amp', 'u', 'g', 'r', 'i', 'z', 'y', '\n']))
qedata = np.recfromtxt(outfile_all, names=True)
qe_all = qedata["qe"]
qe_amp = qedata["amp"]
qe_wl = qedata["wl"]
for a in amps:
#u
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 321) & (qe_wl <= 391))]) > 0:
qeu = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 321) & (qe_wl <= 391))])
else:
qeu = 'no data'
#g
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 402) & (qe_wl <= 552))]) > 0:
qeg = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 402) & (qe_wl <= 552))])
else:
qeg = 'no data'
#r
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 552) & (qe_wl <= 691))]) > 0:
qer = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 552) & (qe_wl <= 691))])
else:
qer = 'no data'
#i
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 691) & (qe_wl <= 818))]) > 0:
qei = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 691) & (qe_wl <= 818))])
else:
qei = 'no data'
#z
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 818) & (qe_wl <= 922))]) > 0:
qez = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 818) & (qe_wl <= 922))])
else:
qez = 'no data'
#y
if len(qe_all[np.where((qe_amp == a) & (qe_wl >= 930) & (qe_wl <= 1070))]) > 0:
qey = np.mean(qe_all[np.where((qe_amp == a) & (qe_wl >= 930) & (qe_wl <= 1070))])
else:
qey = 'no data'
f5.write('\t'.join([str(a), str(qeu), str(qeg), str(qer), str(qei), str(qez), str(qey), '\n']))
| [
"merlin.fisherlevine@gmail.com"
] | merlin.fisherlevine@gmail.com |
f970dc52fefa54c13ac5d90c0c68650a5cfc6062 | 22e2d1d44e0f08f47bf583c4bb0e9bded343fcde | /driven/vizualization/plotting/abstract.py | 9132c35b0f78e04c7f6b9abf2b3d66bee86c9adc | [
"Apache-2.0"
] | permissive | SysSynBio/driven | 7a1e16d9825cc8c6bb9ca8fc1918a90f020b6342 | a00cf1f921386dd3ee163a9e74a5a3f9af47538c | refs/heads/master | 2021-01-18T13:19:50.920228 | 2016-01-08T15:20:17 | 2016-01-08T15:20:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,983 | py | # Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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 driven.vizualization.utils import golden_ratio
class Plotter(object):
__default_options__ = {
'palette': 'Spectral',
'width': 800,
'color': "#AFDCEC",
}
def __init__(self, **defaults):
self.__default_options__.update(defaults)
def _palette(self, palette, *args, **kwargs):
raise NotImplementedError
def histogram(self, dataframe, bins=100, width=None, height=None,
palette=None, title='Histogram', values=None, groups=None,
legend=True):
raise NotImplementedError
def scatter(self, dataframe, x=None, y=None, width=None, height=None, color=None, title='Scatter',
xaxis_label=None, yaxis_label=None):
raise NotImplementedError
def heatmap(self, dataframe, y=None, x=None, values=None, width=None, height=None,
max_color=None, min_color=None, mid_color=None, title='Heatmap'):
raise NotImplementedError
def line(self, dataframe, x=None, y=None, width=None, height=None, title="Line"):
raise NotImplementedError
@staticmethod
def _width_height(width, height):
if width is None or height is None:
return golden_ratio(width, height)
else:
return width, height
@classmethod
def display(cls, plot):
raise NotImplementedError | [
"joaca@biosustain.dtu.dk"
] | joaca@biosustain.dtu.dk |
7412aca133f1a09a79c620eecf5445fc9e34de71 | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p03129/s525121688.py | 7759746279f4a48e4b26ee70ae343bdc7f762ea5 | [] | 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 | 63 | py | n,k=map(int,input().split())
print("YES" if n>=2*k-1 else "NO") | [
"66529651+Aastha2104@users.noreply.github.com"
] | 66529651+Aastha2104@users.noreply.github.com |
014659578b038cea96cd5d1e5f97bc8e34ec15b6 | 602251749a413053118585dbc229089f09b7d85a | /mapstory/importer/api.py | 209aa9d5dc1ee31fa197eae1ea3e500c9d240b60 | [] | no_license | JWileczek/mapstory-geonode | 9d72809787e9ac05520cfa98e648016f90009835 | 605df10463036c47ead4189c4fedd3882a2c5b0f | refs/heads/master | 2020-04-05T18:28:42.358110 | 2016-01-05T19:12:37 | 2016-01-05T19:15:08 | 49,011,217 | 0 | 0 | null | 2016-01-04T17:09:18 | 2016-01-04T17:09:18 | null | UTF-8 | Python | false | false | 4,530 | py | import json
from tastypie.fields import IntegerField, DictField, ListField, CharField, ToManyField, ForeignKey
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.resources import ModelResource
from .models import UploadedData, UploadLayer
from tastypie.authentication import SessionAuthentication
from tastypie.authorization import DjangoAuthorization, Authorization
from tastypie.utils import trailing_slash
from tastypie import http
from django.conf.urls import url
from tastypie.bundle import Bundle
from .tasks import import_object
from tastypie.exceptions import ImmediateHttpResponse
from geonode.api.api import ProfileResource
class UploadedLayerResource(ModelResource):
"""
API for accessing UploadedData.
"""
geonode_layer = DictField(attribute='layer_data', readonly=True, null=True)
configuration_options = DictField(attribute='configuration_options', null=True)
fields = ListField(attribute='fields')
status = CharField(attribute='status', readonly=True, null=True)
class Meta:
queryset = UploadLayer.objects.all()
resource_name = 'data-layers'
allowed_methods = ['get']
filtering = {'id': ALL}
authentication = SessionAuthentication()
def get_object_list(self, request):
"""
Filters the list view by the current user.
"""
return super(UploadedLayerResource, self).get_object_list(request).filter(upload__user=request.user.id)
def import_layer(self, request, **kwargs):
"""
Imports a layer
"""
self.method_check(request, allowed=['post'])
b = Bundle()
b.request = request
try:
obj = self.obj_get(b, pk=kwargs.get('pk'))
except UploadLayer.DoesNotExist:
raise ImmediateHttpResponse(response=http.HttpNotFound())
configuration_options = request.POST.get('configurationOptions')
if 'application/json' in request.META.get('CONTENT_TYPE', ''):
configuration_options = json.loads(request.body)
if isinstance(configuration_options, dict):
obj.configuration_options = configuration_options
obj.save()
configuration_options = [configuration_options]
if not configuration_options:
raise ImmediateHttpResponse(response=http.HttpBadRequest('Configuration options missing.'))
uploaded_file = obj.upload.uploadfile_set.first()
import_result = import_object.delay(uploaded_file.id, configuration_options=configuration_options)
# query the db again for this object since it may have been updated during the import
obj = self.obj_get(b, pk=kwargs.get('pk'))
obj.task_id = import_result.id
obj.save()
return self.create_response(request, {'task': obj.task_id})
def prepend_urls(self):
return [url(r"^(?P<resource_name>{0})/(?P<pk>\w[\w/-]*)/configure{1}$".format(self._meta.resource_name,
trailing_slash()),
self.wrap_view('import_layer'), name="importer_configure"),
]
class UserOwnsObjectAuthorization(Authorization):
# Optional but useful for advanced limiting, such as per user.
def apply_limits(self, request, object_list):
if request and hasattr(request, 'user'):
if request.user.is_superuser:
return object_list
return object_list.filter(user=request.user)
return object_list.none()
class UploadedDataResource(ModelResource):
"""
API for accessing UploadedData.
"""
user = ForeignKey(ProfileResource, 'user')
file_size = CharField(attribute='filesize', readonly=True)
layers = ToManyField(UploadedLayerResource, 'uploadlayer_set', full=True)
file_url = CharField(attribute='file_url', readonly=True, null=True)
class Meta:
queryset = UploadedData.objects.all()
resource_name = 'data'
allowed_methods = ['get', 'delete']
authorization = UserOwnsObjectAuthorization()
authentication = SessionAuthentication()
filtering = {'user': ALL_WITH_RELATIONS}
def get_object_list(self, request):
"""
Filters the list view by the current user.
"""
queryset = super(UploadedDataResource, self).get_object_list(request)
if not request.user.is_superuser:
return queryset.filter(user=request.user)
return queryset
| [
"garnertb@gmail.com"
] | garnertb@gmail.com |
91d69c92aa0b266b30e2c551265f1d59b382ab92 | f24f5eb20bba0e5dfca30e0af4d64b14cc542338 | /protmc/common/base.py | 7d19ba548c7922c35f47b6f5de18ff9489b6004a | [] | no_license | edikedik/ProteusTools | f408d3ec17a6736a41b6f59710278e25161563c6 | 49d002a3aedece4e122f21d55503898774b43c78 | refs/heads/master | 2023-04-18T19:50:51.856732 | 2021-04-27T09:07:52 | 2021-04-27T09:07:52 | 303,629,852 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,980 | py | import typing as t
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
import pandas as pd
Summary = t.NamedTuple('Summary', [
('num_unique', int), ('num_unique_merged', int), ('coverage', float),
('seq_prob_mean', float), ('seq_prob_std', float), ('seq_prob_rss', float)])
ShortSummary = t.NamedTuple('ShortSummary', [('num_unique', int), ('num_unique_merged', int), ('coverage', float)])
MCState = t.NamedTuple(
'MCState', [('Summary', t.Union[Summary, ShortSummary]), ('Bias', pd.DataFrame), ('Seqs', pd.DataFrame)])
Population_element = t.NamedTuple('Population_element', [('seq', str), ('count', int)])
AA_pair = t.NamedTuple('AA_pair', [('pos_i', str), ('pos_j', str), ('aa_i', str), ('aa_j', str)])
PairBias = t.NamedTuple('PairBias', [('aa_pair', AA_pair), ('bias', float)])
AffinityResult = t.NamedTuple('AffinityResults', [('seq', str), ('affinity', float)])
AffinityResults = t.NamedTuple('AffinityResults', [('run_dir', str), ('affinity', float)])
PipelineOutput = t.NamedTuple('PipelineOutput', [('seqs', pd.DataFrame), ('summary', pd.DataFrame)])
ParsedEntry = t.NamedTuple('ParsedEntry', [('seq', str), ('counts', int), ('energy', float)])
_AA_DICT = """ALA A ACT
CYS C ACT
THR T ACT
GLU E ED
GLH e ED
ASP D ED
ASH d ED
PHE F FW
TRP W FW
ILE I IVL
VAL V IVL
LEU L IVL
LYS K K
LYN k K
MET M M
ASN N NQ
GLN Q NQ
SER S S
ARG R R
TYR Y Y
TYD y Y
HID h H
HIE j H
HIP H H
PRO P PG
GLY G PG"""
Id = t.Optional[t.Union[int, str]]
ConfigValue = t.Union[str, float, int]
ConfigValues = t.Union[ConfigValue, t.List[ConfigValue], None]
@dataclass
class WorkerParams:
working_dir: str
protmc_exe_path: str
energy_dir_path: str
active_pos: t.List[int]
config: "ProtMCConfig"
mut_space_number_of_types: int
last_bias_name: str = 'ADAPT.last.dat'
input_bias_name: str = 'ADAPT.inp.dat'
results_name: str = 'RESULTS.tsv'
class AminoAcidDict:
def __init__(self, inp: str = _AA_DICT):
self._aa_dict = self._parse_dict(inp)
@staticmethod
def _parse_dict(inp):
inp_split = [x.split() for x in inp.split('\n')]
return {
**{line[0]: line[1] for line in inp_split},
**{line[1]: line[0] for line in inp_split}}
@property
def aa_dict(self) -> t.Dict[str, str]:
return self._aa_dict
@property
def proto_mapping(self) -> t.Dict[str, str]:
return {'e': 'E', 'd': 'D', 'k': 'K', 'y': 'Y', 'j': 'H', 'h': 'H',
'GLH': 'GLU', 'ASH': 'ASP', 'LYN': 'LYS', 'TYD': 'TYR', 'HID': 'HIP', 'HIE': 'HIP'}
class NoReferenceError(Exception):
pass
class AbstractWorker(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
@property
def id(self) -> Id:
return self._id
@property
@abstractmethod
def seqs(self) -> pd.DataFrame:
raise NotImplementedError
@property
@abstractmethod
def summary(self) -> t.Union[Summary, ShortSummary]:
raise NotImplementedError
@property
@abstractmethod
def params(self) -> WorkerParams:
raise NotImplementedError
@abstractmethod
def setup_io(self) -> None:
raise NotImplementedError
@abstractmethod
def run(self) -> t.Any:
raise NotImplementedError
@abstractmethod
def collect_seqs(self) -> pd.DataFrame:
raise NotImplementedError
@abstractmethod
def compose_summary(self) -> t.Union[Summary, ShortSummary]:
raise NotImplementedError
@abstractmethod
def cleanup(self) -> t.Any:
raise NotImplementedError
class AbstractExecutor(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
@property
def id(self):
return self._id
@abstractmethod
def __call__(self, worker: AbstractWorker) -> AbstractWorker:
raise NotImplementedError
class AbstractCallback(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
@property
def id(self):
return self._id
@abstractmethod
def __call__(self, worker: AbstractWorker) -> AbstractWorker:
raise NotImplementedError
class AbstractPoolExecutor(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
@property
def id(self):
return self._id
def __call__(self, workers: t.Sequence[AbstractWorker]) -> t.Sequence[AbstractWorker]:
raise NotImplementedError
class AbstractAggregator(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
@property
def id(self):
return self._id
@abstractmethod
def aggregate(self, workers: t.Collection[AbstractWorker]):
raise NotImplementedError
class AbstractManager(metaclass=ABCMeta):
def __init__(self, id_: Id = None):
self._id = id_ or id(self)
if __name__ == '__main__':
raise RuntimeError
| [
"edikedikedikedik@gmail.com"
] | edikedikedikedik@gmail.com |
baad11383f0d3190c71d4275aa0b211b3273e5e2 | ff4b39140fe848533f87c9f0ca3d4b472846135b | /bin/pip | ec4b9d9abb82222d3821fd94eaf8dffb5a4afc55 | [] | no_license | Kevinp31800/Machin5 | 5e4f4fc03c467f35b506f9918be34252c4f3a7a7 | 02fd36ce8fa3a9640032d42bf69dd65cf3bbf1fa | refs/heads/master | 2020-04-06T03:58:58.330170 | 2017-06-27T09:55:58 | 2017-06-27T09:55:58 | 95,448,233 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 225 | #!/home/tibau/Code/Machin5/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
| [
"xiliar1888@hotmail.fr"
] | xiliar1888@hotmail.fr | |
13fd943762d3b99c26891095580c3b4d68bfc703 | f08474a94f97ec633a45a47874f80e6b1fbb6874 | /kst/__init__.py | 9bb3c3635e4396593704e95b31c1578190fb7cf1 | [] | no_license | darionathor/kstProject | b4e8d38cc6514517f1d81e511da66e99e8350ebe | 4ec250acf121d7a2b22a6b3903de4607edb6aa86 | refs/heads/master | 2021-08-27T23:24:37.652151 | 2017-12-10T18:45:28 | 2017-12-10T18:45:28 | 113,774,391 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 301 | py | from .ob_counter import ob_counter
from .orig_iita import orig_iita
from .corr_iita import corr_iita
from .mini_iita import mini_iita
from .ind_gen import ind_gen
from .iita import iita
from .imp2state import imp2state
from .simu import simu
from .print_iita import print_iita
from .hasse import hasse | [
"sasalali@gmail.com"
] | sasalali@gmail.com |
9266ec232dde02e0d6780d432855a6891259d7f0 | 31fd131cb72fd78a28fa53b4a443cdd0f52d139e | /favorProject/favorApp/migrations/0002_auto_20200216_0511.py | 8532abaf18d6d775d0683638ea29d2827d16e565 | [
"MIT"
] | permissive | rupaltotale/Favor-Webapp | def01ed92e1db1458dd92ab08f055351ece92370 | 724dbab10d1fa79980321e178f575f35de3a5429 | refs/heads/master | 2022-12-12T06:15:41.015861 | 2021-01-17T05:39:13 | 2021-01-17T05:39:13 | 249,617,472 | 2 | 1 | MIT | 2022-12-08T05:27:17 | 2020-03-24T05:03:36 | Python | UTF-8 | Python | false | false | 919 | py | # Generated by Django 3.0.1 on 2020-02-16 05:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('favorApp', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='favor',
old_name='giverSigned',
new_name='giver_signed',
),
migrations.RenameField(
model_name='favor',
old_name='numFavors',
new_name='number_of_favors',
),
migrations.RenameField(
model_name='favor',
old_name='isEvent',
new_name='requester_signed',
),
migrations.RenameField(
model_name='favor',
old_name='requesterSigned',
new_name='volunteer_event',
),
migrations.RemoveField(
model_name='favor',
name='started',
),
]
| [
"rupaltotale"
] | rupaltotale |
3e3cb9385352bf47a38005950aac27caed287542 | bc2ea3f8f1c060461693fc232a810228e28970fd | /Avrami/production/perfect_data/symbolic.py | 9f314f0b8aca31b97360d9aadce0003f0199a1e6 | [] | no_license | raymond-yiqunwang/Symbolic_Regression_GP | e8fcc2caae35ea5284b4834eea7eee6bc16288b4 | e5ff1bbdfbbebf75ec7d87d42c08726245e506ae | refs/heads/master | 2023-01-08T16:11:33.064548 | 2020-10-26T14:27:14 | 2020-10-26T14:27:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,583 | py | from gplearn.genetic import SymbolicRegressor
from sklearn.utils.random import check_random_state
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from scipy.optimize import curve_fit
import sys
files = ['perfect.dat']
for filename in files:
# hyperparameters
Ly_def = [True, False] # whether we use Y = y_data or Y = 1 - y_data
Lscale_X = [None, 10., 1.]
Lpop_size = [5000, 1000, 500] # generations = 50,000 / pop_size
Ltour_factor = [10, 50, 100] # tour_size = pop_size / tour_factor
Lpars_coeff = ['auto', 0.001, 0.005, 0.01]
# read data
data = pd.read_csv(filename, sep=',', header=0)
X_data = data.drop('Y', axis=1).values.astype(float)
y_data = data['Y'].values.astype(float) / 100.
for scale_X in Lscale_X:
for y_def in Ly_def:
if scale_X is not None: X_data = X_data * scale_X / max(X_data)
if y_def: y_data = 1 - y_data
# stdscal = StandardScaler(with_mean=False, with_std=False)
# X_data = stdscal.fit_transform(X_data)
# y_data = stdscal.fit_transform(y_data.reshape(-1, 1))
for pop_size in Lpop_size:
for tour_factor in Ltour_factor:
for pars_coeff in Lpars_coeff:
gen_size = int(50000 / pop_size)
tour_size = int(pop_size / tour_factor)
print('')
print('')
line_format = '{:>16} {:>16} {:>16} {:>16} {:>16} {:>16} {:>16}'
print(line_format.format('y_def', 'scale_X', 'pop_size', 'gen_size', 'tour_size', 'tour_factor', 'pars_coeff'))
print(line_format.format(str(y_def), str(scale_X), str(pop_size), str(gen_size), str(tour_size), str(tour_factor), str(pars_coeff)))
print('')
print('')
est_gp = SymbolicRegressor(population_size=pop_size,
generations=gen_size, tournament_size=tour_size,
stopping_criteria=0.0, const_range=(-5, 5),
init_depth=(2, 6), init_method='half and half',
function_set=('add', 'sub', 'mul', 'neg', 'exp'),
metric='rmse', parsimony_coefficient=pars_coeff,
p_crossover=0.7, p_subtree_mutation=0.1, p_hoist_mutation=0.05,
p_point_mutation=0.1, p_point_replace=0.05,
max_samples=0.9, warm_start=False, low_memory=True,
n_jobs=8, verbose=1, random_state=0)
est_gp.fit(X_data, y_data.ravel())
print('printing the best individuals for the last 10 generations:')
for p in est_gp._best_programs[-10:]:
print(p)
print('Age of extinction, kill all.. Start new generation..')
print('')
sys.stdout.flush()
| [
"raymondwang@u.northwestern.edu"
] | raymondwang@u.northwestern.edu |
f9b9eb6616f0e54b0e029372ca3eec5c56a1483f | 7c2ddc7ec12da30b7ac7d5ac96a82ac5f4640573 | /lab7.py | 67087d9ac647d3e477e398a9b608ba0d583693c4 | [] | no_license | stuharley8/CS2911-Labs | 38886c09357a299ff612a8320591bf14a2f467e1 | a17fed34af879a4631c607e4b377b7484e2bf340 | refs/heads/master | 2022-11-21T23:09:48.013652 | 2020-07-27T22:49:01 | 2020-07-27T22:49:01 | 283,034,153 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,558 | py | """
- CS2911 - 021
- Fall 2019
- Lab 7
- Names:
- Stuart Harley
- Shanthosh Reddy
A Trivial File Transfer Protocol Server
"""
# import modules -- not using "from socket import *" in order to selectively use items with "socket." prefix
import socket
import os
import math
# Helpful constants used by TFTP
TFTP_PORT = 69
TFTP_BLOCK_SIZE = 512
MAX_UDP_PACKET_SIZE = 65536
def main():
"""
Processes a single TFTP request
:author: Stuart Harley, Shanthosh Reddy
"""
client_socket = socket_setup()
print("Server is ready to receive a request")
message = client_socket.recvfrom(MAX_UDP_PACKET_SIZE)
address = message[1]
message = message[0]
op_code = get_op_code(message)
filename = get_filename(message).decode('ASCII')
mode = get_mode(message)
if op_code != b'\x00\x01':
return
file_block_count = get_file_block_count(filename)
block_count = 1
while block_count <= file_block_count:
send_data_block(client_socket, filename, address, block_count)
new_message = client_socket.recvfrom(MAX_UDP_PACKET_SIZE)
new_message = new_message[0]
new_op_code = get_op_code(new_message)
if new_op_code == b'\x00\x04':
block_num = get_block_num(new_message)
if block_num != block_count.to_bytes(2, 'big'):
block_count -= 1
block_count += 1
elif new_op_code == b'\x00\x05':
print(get_error_message(new_message))
break
client_socket.close()
def get_file_block_count(filename):
"""
Determines the number of TFTP blocks for the given file
:param filename: THe name of the file
:return: The number of TFTP blocks for the file or -1 if the file does not exist
"""
try:
# Use the OS call to get the file size
# This function throws an exception if the file doesn't exist
file_size = os.stat(filename).st_size
return math.ceil(file_size / TFTP_BLOCK_SIZE)
except:
return -1
def get_file_block(filename, block_number):
"""
Get the file block data for the given file and block number
:param filename: The name of the file to read
:param block_number: The block number (1 based)
:return: The data contents (as a bytes object) of the file block
"""
file = open(filename, 'rb')
block_byte_offset = (block_number - 1) * TFTP_BLOCK_SIZE
file.seek(block_byte_offset)
block_data = file.read(TFTP_BLOCK_SIZE)
file.close()
return block_data
def put_file_block(filename, block_data, block_number):
"""
Writes a block of data to the given file
:param filename: The name of the file to save the block to
:param block_data: The bytes object containing the block data
:param block_number: The block number (1 based)
:return: Nothing
"""
file = open(filename, 'wb')
block_byte_offset = (block_number - 1) * TFTP_BLOCK_SIZE
file.seek(block_byte_offset)
file.write(block_data)
file.close()
def socket_setup():
"""
Sets up a UDP socket to listen on the TFTP port
:return: The created socket
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', TFTP_PORT))
return s
####################################################
# Write additional helper functions starting here #
####################################################
def get_op_code(message):
"""
Gets the op code from the request
:param message: the request message
:return: the op code as a bytes object
:rtype: bytes object
:author: Stuart Harley
"""
return message[:2]
def get_filename(message):
"""
Gets the filename from the request
:param message: the request message
:return: the filename as a bytes object
:rtype: bytes object
:author: Stuart Harley
"""
message = message[2:]
index = message.index(b'\x00')
return message[:index]
def get_mode(message):
"""
Gets the mode from the request
:param message: the request message
:return: the mode as a bytes object
:rtype: bytes object
:author: Stuart Harley
"""
message = message[2:]
index = message.index(b'\x00')
message = message[index + 1:]
index = message.index(b'\x00')
return message[:index]
def get_block_num(message):
"""
Gets the block number from an ack
:param message: the ack message
:return: the block number as a bytes object
:rtype: bytes object
"""
return message[2:]
def send_data_block(data_socket, filename, address, block_count):
"""
Gets the next block of data and then sends that block of data with op code 3
:param data_socket: the socket to send to
:param filename: the filename
:param address: the address
:param block_count: the current block number
:return: void
:author: Stuart Harley
"""
block_data = get_file_block(filename, block_count)
data_socket.sendto(b'\x00\x03' + block_count.to_bytes(2, "big") + block_data, address)
def get_error_message(message):
"""
Takes in an error message and returns the string ErrMsg
:param message: the error message
:return: the error message as a str
:rtype: str
:author: Stuart Harley, Shanthosh Reddy
"""
return message[4:-1].decode('ASCII')
main()
| [
"noreply@github.com"
] | stuharley8.noreply@github.com |
8e22685a2a9d024acc0d105088539f38221ebe44 | 6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4 | /HpJCBwggQMDLWTHsM_5.py | f75af80d464001d0f0864535eb2a061e10bc322e | [] | no_license | daniel-reich/ubiquitous-fiesta | 26e80f0082f8589e51d359ce7953117a3da7d38c | 9af2700dbe59284f5697e612491499841a6c126f | refs/heads/master | 2023-04-05T06:40:37.328213 | 2021-04-06T20:17:44 | 2021-04-06T20:17:44 | 355,318,759 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 299 | py |
def average_word_length(txt):
totlgth = 0
punctuation = ['(', ')', '?', ':', ':', ',', '.', '!', '/', '"', "'"]
for i in punctuation:
txt = txt.replace(i,"")
splttxt = txt.split(' ')
for wrd in splttxt:
totlgth += len(wrd)
return float('{:.2f}'.format(totlgth / len(splttxt)))
| [
"daniel.reich@danielreichs-MacBook-Pro.local"
] | daniel.reich@danielreichs-MacBook-Pro.local |
a7252ad25aa7ed9d9358dae226b0d31044560af0 | de24f83a5e3768a2638ebcf13cbe717e75740168 | /moodledata/vpl_data/92/usersdata/260/38375/submittedfiles/atividade.py | 827bd698c6daa02a20df244b2ce3c6ae4ceab721 | [] | 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 | 180 | py | # -*- coding: utf-8 -*-
import math
n=int(input("digiteo valor de n:"))
for i in range (1,n+1,1):
if (n < 0):
n=n*(-1)
else:
n=n
s=s+(i)/(n+1-i)
print(s)
| [
"rafael.mota@ufca.edu.br"
] | rafael.mota@ufca.edu.br |
477215c16be839002806a6370d8d8f4845d530c4 | fe901ea37ae8a1dbc9fce034f8c4f32a535b06a6 | /L_PyInterface/UART/UARTJoystickController.py | 6e4b9639c73df34d92fbfca7e592b050f141d39f | [] | no_license | VB6Hobbyst7/roomba-localization | 93c1dc1bba9102ff770b173ddd0bdb1436d22a86 | f18d7ecf28f29e44806147fe1fef1c32a720eb69 | refs/heads/master | 2021-05-20T10:13:09.064249 | 2011-08-06T20:21:11 | 2011-08-06T20:21:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,816 | py | '''
UARTJoystickController.py
@author: River Allen
@date: July 15, 2010
A simple piece of code that uses pygame to poll a usb ps2 joystick for button and
axes information. It's main design goal was for providing a simple 19 byte integer packet
to be sent through UART to a microcontroller to provide human control of an embedded system.
'''
import pygame
import struct
import time
from UART import UARTInput
from UART import UARTSystem
class UARTJoystickController(UARTInput.UARTInput):
def __init__(self, button_toggle=False, poll_interval=0.07, debug=True):
'''
Built for the Average Logitech USB (PS2) controller.
Buttons:
(Note: these numbers are array index in code...i.e. button 1 is get_button(0))
* 1 - 10 are labelled.
* 11 - left stick button. (Press the left joystick button down until it makes a 'click' noise)
* 12 - right stick button. (Press the Right joystick button down)
Axes:
* 0 - Left Stick X-axis (-ve: Left, +ve: Right)
* 1 - Left Stick Y-axis (-ve: Up, +ve: Down)
* 2 - Right Stick X-axis (-ve: Left, +ve: Right)
* 3 - Right Stick Y-axis (-ve: Up, +ve: Down)
Hat(s):
* This is the D-Pad.
@param button_toggle: If True, Pressing and holding down a button will look like this:
0001000000
^ - button pressed and held at this moment.
'''
UARTInput.UARTInput.__init__(self)
self.quit = False
self.struct_fmt = 'b' * 19 # 12 buttons + 2 (xyaxis1) + 2 (xyaxis2) + 2 (hat)
self._debug = debug
self._button_toggle = False
pygame.init()
self.joysticks = []
self.poll_interval = poll_interval
try:
self.joysticks.append(pygame.joystick.Joystick(0))
except:
print 'No joystick(s) plugged in.'
try:
self.joysticks.append(pygame.joystick.Joystick(1))
except:
self.joysticks.append(self.joysticks[0])
for joy in self.joysticks:
joy.init()
if self._debug:
print('-' * 50)
print(str(joy.get_name()))
print('-' * 50)
self._packets = []
def run(self):
'''
This method is used by threading, and is essentially the UARTJoystickControl's main
thread. Here, it polls the joystick and queues data that can be viewed by other threads
(most probably UARTSystem).
'''
time.sleep(1.5) # Needed amount of time for my board at home to init.
try:
button_history = []
for joy in self.joysticks:
button_history.append([0,0,0,0,0,0,0,0,0,0,0,0])
while not self.quit:
pygame.event.pump()
joy_num = 0
for joy in self.joysticks:
# Buttons
buttons = []
for i in range(joy.get_numbuttons()):
button_value = joy.get_button(i)
if self._button_toggle:
# Button will send only a single '1' then '0's until
# button is released and pressed again.
# Stops button holding and button tapping timing issues.
if button_history[joy_num][i] and button_value:
buttons.append(0)
else:
buttons.append(button_value)
button_history[joy_num][i] = button_value
else:
# Send the button value as is. (i.e. allows holding)
buttons.append(button_value)
# Axes
axes = []
for i in range(joy.get_numaxes()):
axes.append(int(joy.get_axis(i)*100)) # Normalize axes to 100 (fit in byte)
# Hat (aka D-Pad)
hat = list(joy.get_hat(0))
all_data = []
all_data.extend(buttons)
all_data.extend(axes)
all_data.extend(hat)
all_data.append(joy_num)
packet = struct.pack(self.struct_fmt, *tuple(all_data))
# Allow another thread (probably UARTSystem) to get queued data
self.add_input(packet)
#self.add_input("Dalgoth...")
if self._debug:
print('Buttons:\t' + str(buttons))
print('Axes\t\t' + str(axes))
print('Hat:\t\t' + str(hat))
print('-' * 50)
time.sleep(self.poll_interval)
joy_num += 1
except:
print 'Crashed...'
raise
if __name__ == '__main__':
# Loads in variables from the globalConfig file.
execfile("..\\globalConfig.py")
joy = UARTJoystickController(button_toggle=False, poll_interval=joystickPollInterval,
#debug=True)
debug=False)
# Uncomment next line if you want to ONLY test the joystick.
#joy.run()
ua = UARTSystem.UART(serialPort, baudRate, uart_input=joy, approve=False, debug=True)
ua.start()
| [
"riverallen@3c1b0362-c62b-8bf9-9a54-5033ff64f510"
] | riverallen@3c1b0362-c62b-8bf9-9a54-5033ff64f510 |
51860711f5043f738684f8edce148677cbe8648e | 824f19d20cdfa26c607db1ff3cdc91f69509e590 | /TopInterviewQuestions/string/08-Count-and-Say.py | 6a9a02c968f9189cd1002ad15d69861e5338fc60 | [] | no_license | almamuncsit/LeetCode | 01d7e32300eebf92ab54c983de6e183242b3c985 | 17aa340649574c37067ec170ceea8d9326be2d6a | refs/heads/master | 2021-07-07T09:48:18.069020 | 2021-03-28T11:26:47 | 2021-03-28T11:26:47 | 230,956,634 | 4 | 0 | null | null | null | null | UTF-8 | Python | false | false | 703 | py | class Solution:
def countAndSay(self, n: int) -> str:
if n == 1:
return '1'
string = '11'
for _ in range(2, n):
output = ''
count = 0
last_seen = ''
for c in string:
if not last_seen or last_seen == c:
count += 1
last_seen = c
else:
output += str(count) + last_seen
count = 1
last_seen = c
output += str(count) + last_seen
string = output
return string
sol = Solution()
n = 3
print(sol.countAndSay(n))
| [
"msarkar.cse@gmail.com"
] | msarkar.cse@gmail.com |
3f550b9d87b3dbe0a6b0ecf8384a04184fdd7708 | 2ca3187c1c1cc2e26a0cc7c1279d8cc442792211 | /desires/models.py | 4b79db9b586dc1f774d73eaed32f4a2754838722 | [] | no_license | pvmoura/Givalittle | f53825cdcf4ce64b690dc748a1c3d917bfb51117 | 62b3a05384c0c6a35769607ed65e7f1a271e4478 | refs/heads/master | 2016-08-05T21:09:49.030002 | 2012-03-13T20:07:05 | 2012-03-13T20:07:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 233 | py | from django.db import models
from givalittle.giftsdb.models import Gift, Merchant
from django.contrib.auth.models import User
class Desires(models.Model):
want = models.TextField(max_length=1500)
author = models.ForeignKey(User)
| [
"pmavfmoura@gmail.com"
] | pmavfmoura@gmail.com |
15eea4d9861b0a20304ce02d6633c76a222ceca5 | 23151e210d814881e12b9a891872c4e813d63233 | /LeTou_StaticVector_remainder.py | 7bb0dceac75eb79aa19ddf3cadd44351334c5ce6 | [] | no_license | HAHAHAHA123456/MyUtils | c9672b2b7407ffe69fbb6c987f037a57d692738d | 1a74da6d402935e24e09e7b963bda9d5cce61180 | refs/heads/main | 2023-07-15T06:30:44.793023 | 2021-08-27T09:19:43 | 2021-08-27T09:19:43 | 386,573,992 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,708 | py | class InfoRowRemainder:
position0 = 0
position1 = 0
position2 = 0
def __init__(self):
pass
def getInfo(self):
return self.position0, self.position1, self.position2
def check(self, currentList):
if 0 in currentList:
self.position0 = 1
else:
self.position0 = 0
if 1 in currentList:
self.position1 = 1
else:
self.position1 = 0
if 2 in currentList:
self.position2 = 1
else:
self.position2 = 0
class InfoRowRemainderContinous:
position0 = 0
position1 = 0
position2 = 0
def __init__(self):
pass
def getInfo(self):
return self.position0, self.position1, self.position2
def check(self, currentList):
if 0 in currentList:
self.position0 += 1
else:
self.position0 = 0
if 1 in currentList:
self.position1 += 1
else:
self.position1 = 0
if 2 in currentList:
self.position2 += 1
else:
self.position2 = 0
class InfoRowRemainderLeaveOut:
position0 = 0
position1 = 0
position2 = 0
def __init__(self):
pass
def getInfo(self):
return self.position0, self.position1, self.position2
def check(self, currentList):
if 0 not in currentList:
self.position0 += 1
else:
self.position0 = 0
if 1 not in currentList:
self.position1 += 1
else:
self.position1 = 0
if 2 not in currentList:
self.position2 += 1
else:
self.position2 = 0
| [
"ylwang@ep.com"
] | ylwang@ep.com |
4c3f24f55c83b4baf999b6fe9152fc6d0b81ed81 | 62e45255088abb536e9ea6fcbe497e83bad171a0 | /ippython/rectangulo_1.py | c5944c11caeb20379a035b36be86907369c21756 | [] | no_license | jmery24/python | a24f562c8d893a97a5d9011e9283eba948b8b6dc | 3e35ac9c9efbac4ff20374e1dfa75a7af6003ab9 | refs/heads/master | 2020-12-25T21:56:17.063767 | 2015-06-18T04:59:05 | 2015-06-18T04:59:05 | 36,337,473 | 0 | 0 | null | 2015-05-27T02:26:54 | 2015-05-27T02:26:54 | null | UTF-8 | Python | false | false | 377 | py | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 5 08:06:05 2013
@author: daniel
"""
# perimetro y area de un rectangulo
# introduce valos de los lados
ancho = float(raw_input("ancho: "))
largo = float(raw_input("largo: "))
# calculo del perimetro y el area
perimetro = 2*(ancho+largo)
area = ancho*largo
# output data
print("perimetro= "), perimetro
print("area: "), area
| [
"danmery@gmail.com"
] | danmery@gmail.com |
65b2f5dce2f747e4bd3255a9308ec2fe75aa3c2a | 180e1e947f3f824cb2c466f51900aa12a9428e1c | /pattern4/hamburg_store_v1/src/NewOrleansRoastedBurger.py | 5b06d6dade4fda5368883e31d18f57f7a3e206af | [
"MIT"
] | permissive | icexmoon/design-pattern-with-python | 216f43a63dc87ef28a12d5a9a915bf0df3b64f50 | bb897e886fe52bb620db0edc6ad9d2e5ecb067af | refs/heads/main | 2023-06-15T11:54:19.357798 | 2021-07-21T08:46:16 | 2021-07-21T08:46:16 | 376,543,552 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 654 | py | #######################################################
#
# NewOrleansRoastedBurger.py
# Python implementation of the Class NewOrleansRoastedBurger
# Generated by Enterprise Architect
# Created on: 19-6��-2021 15:37:37
# Original author: 70748
#
#######################################################
from .Hamburg import Hamburg
class NewOrleansRoastedBurger(Hamburg):
def __init__(self) -> None:
super().__init__("New Orleans Roasted Burger")
def box(self):
print("box {}".format(self.name))
def ready(self):
print("Prepare ingredients")
def cook(self):
print("cook {}".format(self.name))
| [
"icexmoon@qq.com"
] | icexmoon@qq.com |
4d494548cc8d9b383d7640e6dc53762063450614 | f523e7bdd7f616267b82a7f00f2b7cae132dc6b9 | /dicodile/update_d/loss_and_gradient.py | dd2b5842ff6aeedb14671b44b2cf2909002c6c41 | [
"BSD-3-Clause"
] | permissive | tomMoral/dicodile | 2d7da76be7d32fb05502cbb358fcda0018e5c00c | 5a64fbe456f3a117275c45ee1f10c60d6e133915 | refs/heads/main | 2023-05-25T11:58:05.596455 | 2023-05-19T14:35:04 | 2023-05-19T14:35:04 | 167,703,861 | 17 | 8 | BSD-3-Clause | 2023-05-19T14:35:06 | 2019-01-26T15:26:24 | Python | UTF-8 | Python | false | false | 4,361 | py | # Authors: Thomas Moreau <thomas.moreau@inria.fr>
import numpy as np
from scipy import signal
from ..utils.shape_helpers import get_valid_support
def compute_objective(D, constants):
"""Compute the value of the objective function
Parameters
----------
D : array, shape (n_atoms, n_channels, *atom_support)
Current dictionary
constants : dict
Constant to accelerate the computation when updating D.
"""
return _l2_objective(D=D, constants=constants)
def gradient_d(D=None, X=None, z=None, constants=None,
return_func=False, flatten=False):
"""Compute the gradient of the reconstruction loss relative to d.
Parameters
----------
D : array
The atoms. Can either be full rank with shape shape
(n_atoms, n_channels, n_times_atom) or rank 1 with
shape shape (n_atoms, n_channels + n_times_atom)
X : array, shape (n_trials, n_channels, n_times) or None
The data array
z : array, shape (n_atoms, n_trials, n_times_valid) or None
The activations
constants : dict or None
Constant to accelerate the computation of the gradient
return_func : boolean
Returns also the objective function, used to speed up LBFGS solver
flatten : boolean
If flatten is True, takes a flatten uv input and return the gradient
as a flatten array.
Returns
-------
(func) : float
The objective function
grad : array, shape (n_atoms * n_times_valid)
The gradient
"""
if flatten:
if z is None:
n_channels = constants['n_channels']
n_atoms, _, *ztz_support = constants['ztz'].shape
atom_support = tuple((np.array(ztz_support) + 1) // 2)
else:
n_trial, n_channels, *sig_support = X.shape
n_trials, n_atoms, *valid_support = z.shape
atom_support = get_valid_support(sig_support, valid_support)
D = D.reshape((n_atoms, n_channels, *atom_support))
cost, grad_d = _l2_gradient_d(D=D, constants=constants,
return_func=return_func)
if flatten:
grad_d = grad_d.ravel()
if return_func:
return cost, grad_d
return grad_d
def _l2_gradient_d(D, constants=None, return_func=False):
cost = None
assert D is not None
g = tensordot_convolve(constants['ztz'], D)
if return_func:
cost = .5 * g - constants['ztX']
cost = np.dot(D.ravel(), g.ravel())
if 'XtX' in constants:
cost += constants['XtX']
return cost, g - constants['ztX']
def _l2_objective(D=None, constants=None):
# Fast compute the l2 objective when updating uv/D
assert D is not None, "D is needed to fast compute the objective."
grad_d = .5 * tensordot_convolve(constants['ztz'], D)
grad_d -= constants['ztX']
cost = (D * grad_d).sum()
cost += .5 * constants['XtX']
return cost
def tensordot_convolve(ztz, D):
"""Compute the multivariate (valid) convolution of ztz and D
Parameters
----------
ztz: array, shape = (n_atoms, n_atoms, *(2 * atom_support - 1))
Activations
D: array, shape = (n_atoms, n_channels, atom_support)
Dictionnary
Returns
-------
G : array, shape = (n_atoms, n_channels, *atom_support)
Gradient
"""
n_atoms, n_channels, *atom_support = D.shape
n_time_support = np.prod(atom_support)
if n_time_support < 512:
G = np.zeros(D.shape)
axis_sum = list(range(2, D.ndim))
D_revert = np.flip(D, axis=axis_sum)
for t in range(n_time_support):
pt = np.unravel_index(t, atom_support)
ztz_slice = tuple([Ellipsis] + [
slice(v, v + size_ax) for v, size_ax in zip(pt, atom_support)])
G[(Ellipsis, *pt)] = np.tensordot(ztz[ztz_slice], D_revert,
axes=([1] + axis_sum,
[0] + axis_sum))
else:
if D.ndim == 3:
convolution_op = np.convolve
else:
convolution_op = signal.fftconvolve
G = np.sum([[[convolution_op(ztz_kk, D_kp, mode='valid')
for D_kp in D_k] for ztz_kk, D_k in zip(ztz_k, D)]
for ztz_k in ztz], axis=1)
return G
| [
"thomas.moreau.2010@gmail.com"
] | thomas.moreau.2010@gmail.com |
db106b2f8d92f9349572b5ef78ce8725ed3cf7fb | 5c14b4926b6285659a335767a5471c5c04271301 | /todo_app/todo_app/user/repos.py | 3fdea9d22bcfaa7270ab116ff8208afb795977ea | [
"MIT"
] | permissive | tanayseven/python-meetup-nelkinda-14th-october | c6e1df6a1d021e43044c7d29a2ce209696ca649e | 14d39ef6b79afe30f3c0d38ae90273b1458923a1 | refs/heads/master | 2021-07-12T09:11:27.262277 | 2017-10-16T17:13:42 | 2017-10-16T17:13:42 | 106,182,564 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,011 | py | from todo_app.extensions import db
from todo_app.user.models import AdminModel, UserModel, ListUserModel
class UserRepo:
model = UserModel
db = db
@classmethod
def add_new_user(cls, user_name, password):
new_user = cls.model()
new_user.user_name = user_name
new_user.password = password
cls.db.session.add(new_user)
cls.db.session.commit()
return new_user
class AdminRepo:
model = AdminModel
db = db
@classmethod
def add_new_admin(cls, user_name, password, email):
new_user = UserRepo.add_new_user(user_name, password)
new_admin = cls.model()
new_admin.user = new_user
new_admin.email = email
cls.db.session.add(new_admin)
cls.db.session.commit()
@classmethod
def fetch_user_for(cls, user_name, password):
return cls.db.session.query(cls.model).join(UserModel) \
.filter(UserModel.user_name == user_name).filter(UserModel.password == password).one_or_none()
class ListUserRepo:
model = ListUserModel
db = db
@classmethod
def load_user_if_exists(cls, auth_token):
id = int(auth_token.split('.')[0])
return cls.db.session.query(cls.model).join(UserModel) \
.filter(ListUserModel.id == id).one_or_none()
@classmethod
def add_new_user(cls, user_name, password, email, first_name, last_name):
new_user = UserRepo.add_new_user(user_name, password)
new_list_user = cls.model()
new_list_user.user = new_user
new_list_user.email = email
new_list_user.first_name = first_name
new_list_user.last_name = last_name
cls.db.session.add(new_list_user)
cls.db.session.commit()
@classmethod
def load_user_with_credentials(cls, user_name, password):
return cls.db.session.query(cls.model).join(UserModel) \
.filter(UserModel.user_name == user_name)\
.filter(UserModel.password == password).one_or_none()
| [
"tanayseven@gmail.com"
] | tanayseven@gmail.com |
10ce4b4ce2e0058c9ac89fb49c5436db25806804 | ba7489c4e702dd306306f4888199b6179990642a | /chatbot/yelp/endpoint/phone_search.py | e8adfc69fa2038e9ca5c4ca4dfe7c3e65d8fde89 | [] | no_license | MyMusicTaste/b0pb0t | bf91a945e6dad434c5028530b0b1ed8bbaf998d7 | 562934f1bea8e678e9a9e62e8eb44417b2befcd7 | refs/heads/master | 2021-01-17T17:09:50.045150 | 2016-10-17T09:24:34 | 2016-10-17T09:24:34 | 69,436,933 | 4 | 6 | null | null | null | null | UTF-8 | Python | false | false | 861 | py | # -*- coding: UTF-8 -*-
from yelp.config import PHONE_SEARCH_PATH
from yelp.obj.search_response import SearchResponse
class PhoneSearch(object):
def __init__(self, client):
self.client = client
def phone_search(self, phone, **url_params):
"""Make a request to the phone search endpoint.More info at
https://www.yelp.com/developers/documentation/v2/phone_search
Args:
phone (str): Business phone number to search for.
**url_params: Dict corresponding to phone search API params
https://www.yelp.com/developers/documentation/v2/phone_search
Returns:
SearchResponse object that wraps the response.
"""
url_params['phone'] = phone
return SearchResponse(
self.client._make_request(PHONE_SEARCH_PATH, url_params)
)
| [
"paul@mymusictaste.com"
] | paul@mymusictaste.com |
abb726db02614f9daf052328c3f82e082414ccba | e45aeb09ffe598010888599d0e38142b57ca602f | /flask-example/myproject/migrations/versions/789e7f86495f_.py | 5eb0c7614c8d8d97a0eef588e2e87888fd879b52 | [] | no_license | Chen2358/Python-example | c89ede19bfea6e93f9bb7e2a556d7dfdc47a1bc8 | fcec266f1b8916394832cfd03a75a8616ba22f7a | refs/heads/master | 2021-06-22T07:13:45.305679 | 2020-12-23T03:49:59 | 2020-12-23T03:49:59 | 145,352,383 | 0 | 0 | null | 2019-11-13T09:53:04 | 2018-08-20T01:41:37 | Python | UTF-8 | Python | false | false | 1,058 | py | """empty message
Revision ID: 789e7f86495f
Revises: ec864742eb28
Create Date: 2018-10-31 10:40:15.273341
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '789e7f86495f'
down_revision = 'ec864742eb28'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('posts',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
op.drop_table('posts')
# ### end Alembic commands ###
| [
"chen@2359.com"
] | chen@2359.com |
d6990abb62171e29dc3e05403c9b42288b9bd2ab | 00cd32e541117e9a18cb2f534c31b221107a0bf8 | /train_all.py | e5407e6bbf474a399a8308f5d48a608dc3ab06b2 | [] | no_license | mamintoosi-cs/basic-super-resolution | f09d7f44c9285a79d6e0d816c6848228fa7413df | 6edfa57196c8d9ecb78af6391124ddfd3879d37e | refs/heads/master | 2022-01-31T13:03:33.270404 | 2019-07-20T23:31:50 | 2019-07-20T23:31:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,010 | py | import argparse
import dataset.data as data
from torch.utils.data import DataLoader
from DBPN.solver import DBPNTrainer
from DRCN.solver import DRCNTrainer
from EDSR.solver import EDSRTrainer
from FSRCNN.solver import FSRCNNTrainer
from SRCNN.solver import SRCNNTrainer
from SRCNNT.solver import SRCNNTTrainer
from SRGAN.solver import SRGANTrainer
from SubPixelCNN.solver import SubPixelTrainer
from VDSR.solver import VDSRTrainer
from CARN.solver import CARNTrainer
from MEMNET.solver import MEMNETTrainer
# from result.data import get_training_set, get_test_set
parser = argparse.ArgumentParser(description='Single Image Super Resolution train model')
# Model Parameter
parser.add_argument('--upscale_factor', '-uf', type=int, default=4, help="super resolution upscale factor")
parser.add_argument('--model', '-m', type=str, default='srcnn', help='choose which model is going to use')
parser.add_argument('--dataset', '-ds', type=str, default='BSDS300', help='name of dataset defined in dataset.yml')
parser.add_argument('--logprefix', '-l', type=str, default='', help='name of logfile')
# Train Parameter
parser.add_argument('--batchSize', type=int, default=16, help='training batch size')
parser.add_argument('--testBatchSize', type=int, default=1, help='testing batch size')
parser.add_argument('--nEpochs', type=int, default=1, help='number of epochs to train for')
parser.add_argument('--lr', type=float, default=0.01, help='Learning Rate. Default=0.01')
parser.add_argument('--seed', type=int, default=123, help='random seed to use. Default=123')
parser.add_argument('--chanel', type=int, default=3, help='random seed to use. Default=123')
# Optimization Parameter
parser.add_argument('--optim', type=str, help='Optimizer Name, sgd, adam, lamb')
parser.add_argument('--momentum', type=float, default=0.9, help='Momentum')
parser.add_argument('--weight_decay', type=float, default=0.01, help='Weight Decay')
# Optimization Scheduler
parser.add_argument('--schduler', type=str, default='default', help='Scheduler type')
parser.add_argument('--iter', type=int, default=3, help='Run Iteration')
args = parser.parse_args()
def main():
print('Loading dataset')
train_set = data.get_data(dataset_name=args.dataset, data_type='train', upscale_factor=args.upscale_factor)
test_set = data.get_data(dataset_name=args.dataset, data_type='test', upscale_factor=args.upscale_factor)
training_data_loader = DataLoader(dataset=train_set, batch_size=args.batchSize, shuffle=True)
testing_data_loader = DataLoader(dataset=test_set, batch_size=args.testBatchSize, shuffle=False)
for i in range(args.iter):
args.logprefix = f'{args.logprefix}_it{i}'
for args.model in ['sub', 'srcnn', 'srcnnt', 'carn', 'vdsr', 'edsr', 'fsrcnn', 'drcn', 'srgan', 'dbpn', 'memnet']:
for args.optim in ['adam', 'adamax', 'lamb', 'sgd', 'asgd', 'adadelta', 'adagrad', 'rmsprop', 'rprop']:
print(args.model, args.optim)
if args.model == 'sub':
model = SubPixelTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'srcnn':
model = SRCNNTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'srcnnt':
model = SRCNNTTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'carn':
model = SRCNNTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'vdsr':
model = VDSRTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'edsr':
model = EDSRTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'fsrcnn':
model = FSRCNNTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'drcn':
continue
args.batchSize = 1
args.testBatchSize = 1
model = DRCNTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'srgan':
model = SRGANTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'dbpn':
continue
args.batchSize = 1
args.testBatchSize = 1
model = DBPNTrainer(args, training_data_loader, testing_data_loader)
elif args.model == 'memnet':
continue
model = MEMNETTrainer(args, training_data_loader, testing_data_loader)
else:
continue
raise Exception("the model does not exist")
model.run()
return
if __name__ =='__main__':
main()
| [
"unlike_666@yahoo.com"
] | unlike_666@yahoo.com |
da796e304025e32e4804e27da77df78f98d82326 | eac8b49d38d302174690f9b8c36f36feafa58bb0 | /venv/bin/sslyze | 4659949086d5e951e0bf55e9524b23acfee5912e | [] | no_license | gh0st/DomainTools | 35d79637a32637a59810517b45a333ca500307c4 | 8bf2123db6e669ae156085ff96ace08e34a5b06f | refs/heads/master | 2021-09-02T01:23:45.144421 | 2017-12-29T16:27:01 | 2017-12-29T16:27:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 413 | #!/Users/joubin/Documents/Git/SecTools/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'SSLyze==1.3.2','console_scripts','sslyze'
__requires__ = 'SSLyze==1.3.2'
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('SSLyze==1.3.2', 'console_scripts', 'sslyze')()
)
| [
"joubin.j@gmail.com"
] | joubin.j@gmail.com | |
d6135e052b814b6f51cd9956f7d5ce468f8ae3f7 | 0170a9da9c5dce006b1ac5f9d444f033e01ef9a4 | /helmo/util/scripts/hp_search_to_num_nodes_csv.py | 6557f5de35d01f01d99da3ea5fd4377e1a614382 | [] | no_license | deeppavlov/h-elmo | d3544275e83ecb2b062f9d67adb0f7ab8ff62e4e | c9efd3a92bb44b7ff34dd398a7de33b4713bdbda | refs/heads/master | 2022-09-17T09:54:45.103389 | 2020-04-09T20:01:27 | 2020-04-09T20:01:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,677 | py | import argparse
import csv
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'input',
help='A path to a file with hp search results.'
)
parser.add_argument(
'--output',
'-o',
help='A path to a csv file with results.',
default='num_nodes.csv'
)
parser.add_argument(
'--metrics',
'-m',
help='A list of names of metrics which will be added to csv file.',
nargs='+',
default=['loss'],
)
return parser.parse_args()
def main():
args = get_args()
output = []
launches_nodes = []
launches_metrics = {m: [] for m in args.metrics}
num_launches = 0
with open(args.input) as f:
inp_header = f.readline().split()
metrics_indices_in_header = {
m: i for i, m in enumerate(inp_header[:4])}
for line in f:
words = line.split()
nodes = ' '.join(words[4:])
nodes = nodes[1:-1].split(', ')
launches_nodes.append(nodes)
for m in args.metrics:
launches_metrics[m].append(words[metrics_indices_in_header[m]])
num_launches += 1
num_layers = max([len(nn) for nn in launches_nodes])
output_header = ['layer {}'.format(i+1) for i in range(num_layers)] + \
args.metrics
output.append(output_header)
for i in range(num_launches):
mvalues = [launches_metrics[m][i] for m in args.metrics]
output.append(launches_nodes[i] + mvalues)
with open(args.output, 'w') as f:
writer = csv.writer(f)
writer.writerows(output)
if __name__ == '__main__':
main()
| [
"peganov@phystech.edu"
] | peganov@phystech.edu |
10d14f5737f0b46a53f3665e9a2b661546b7765e | 9e824c5a177dd90987d6ba3266b0d945867970f3 | /20-proyecto-python/usuarios/conexion.py | 6ec8ef776f4a7843ca8e358d3b7f08bf1becbd4c | [] | no_license | jutish/master-python | ac66bc103e3a2a95635f7d7c8ced3496cbc9b01f | b780fd1a5905b8fd14c34976babcbdf2a75c3264 | refs/heads/master | 2023-01-14T06:50:38.747059 | 2020-11-25T11:45:07 | 2020-11-25T11:45:07 | 283,865,942 | 0 | 0 | null | 2020-07-30T21:18:05 | 2020-07-30T20:00:30 | null | UTF-8 | Python | false | false | 767 | py | # import mysql.connector
import sqlite3
#Este metodo se conecta a la base de datos y devuelve un arreglo con la base y el cursor
#Por defecto usa SQLite. Sino se usa MySQL
def conectar(db='SQLite'):
if db == 'SQLite': #En la oficina uso SQLite porque no puedo instalar MySQL
#Conexion SQLite
database = sqlite3.connect('sq_master_python')
cursor = database.cursor()
# with open('./sqlite_tables.sql') as sqlite_file:
# sql_script = sqlite_file.read()
# cursor.executescript(sql_script)
else:
#Conexion MySQL. En casa uso MySQL
database = mysql.connector.connect(
host = 'localhost',
user = 'emarcelloni',
password = '3marc3110n1',
database = 'master_python',
)
cursor = database.cursor(buffered = True)
return [database,cursor] | [
"emarcelloni@agdcorp.com.ar"
] | emarcelloni@agdcorp.com.ar |
8439e1ae4ece02e80829f46f48b0d1ece97df457 | e723ba53f677dd51886d24b32e99e8afd71170cd | /py_core/day5/day1/d3.py | d5ccd2f4d5de1a28d6dbc9642f144cb7e3723f20 | [] | no_license | 1769258532/python | e2c9057fbe6050b0eaf1cd053e8ff6b4880de47a | 974ded0ada1fcb171379ab597919a3d0d451f54b | refs/heads/master | 2023-02-02T14:16:45.205325 | 2020-12-19T11:08:33 | 2020-12-19T11:08:33 | 312,196,740 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 130 | py | # -*-coding:utf-8 -*-
# !/usr/bin/python3
# @Author:liulang
# x = 1
#
# if x > 0:
# print(" x > 0")
# print(" x > 0")
| [
"2691510552@qq.com"
] | 2691510552@qq.com |
1ff911f82c5afc9e27a9355205827fceb49d787b | 1a166165ab8287d01cbb377a13efdb5eff5dfef0 | /sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py | e8dfc9c0c6d047dc26900448730ebbd0568918f8 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LGPL-2.1-or-later"
] | permissive | manoj0806/azure-sdk-for-python | 7a14b202ff80f528abd068bf50334e91001a9686 | aab999792db1132232b2f297c76800590a901142 | refs/heads/master | 2023-04-19T16:11:31.984930 | 2021-04-29T23:19:49 | 2021-04-29T23:19:49 | 363,025,016 | 1 | 0 | MIT | 2021-04-30T04:23:35 | 2021-04-30T04:23:35 | null | UTF-8 | Python | false | false | 28,169 | py | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
import pytest
import platform
import functools
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline.transport import AioHttpTransport
from multidict import CIMultiDict, CIMultiDictProxy
from azure.ai.textanalytics.aio import TextAnalyticsClient
from azure.ai.textanalytics import (
VERSION,
DetectLanguageInput,
TextDocumentInput,
TextAnalyticsApiVersion,
)
from testcase import GlobalTextAnalyticsAccountPreparer
from testcase import TextAnalyticsClientPreparer as _TextAnalyticsClientPreparer
from asynctestcase import AsyncTextAnalyticsTest
# pre-apply the client_cls positional argument so it needn't be explicitly passed below
TextAnalyticsClientPreparer = functools.partial(_TextAnalyticsClientPreparer, TextAnalyticsClient)
class AiohttpTestTransport(AioHttpTransport):
"""Workaround to vcrpy bug: https://github.com/kevin1024/vcrpy/pull/461
"""
async def send(self, request, **config):
response = await super(AiohttpTestTransport, self).send(request, **config)
if not isinstance(response.headers, CIMultiDictProxy):
response.headers = CIMultiDictProxy(CIMultiDict(response.internal_response.headers))
response.content_type = response.headers.get("content-type")
return response
class TestRecognizeLinkedEntities(AsyncTextAnalyticsTest):
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_no_single_input(self, client):
with self.assertRaises(TypeError):
response = await client.recognize_linked_entities("hello world")
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_all_successful_passing_dict(self, client):
docs = [{"id": "1", "language": "en", "text": "Microsoft was founded by Bill Gates and Paul Allen"},
{"id": "2", "language": "es", "text": "Microsoft fue fundado por Bill Gates y Paul Allen"}]
response = await client.recognize_linked_entities(docs, show_stats=True)
for doc in response:
self.assertEqual(len(doc.entities), 3)
self.assertIsNotNone(doc.id)
self.assertIsNotNone(doc.statistics)
for entity in doc.entities:
self.assertIsNotNone(entity.name)
self.assertIsNotNone(entity.language)
self.assertIsNotNone(entity.data_source_entity_id)
self.assertIsNotNone(entity.url)
self.assertIsNotNone(entity.data_source)
self.assertIsNotNone(entity.matches)
for match in entity.matches:
self.assertIsNotNone(match.offset)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_all_successful_passing_text_document_input(self, client):
docs = [
TextDocumentInput(id="1", text="Microsoft was founded by Bill Gates and Paul Allen"),
TextDocumentInput(id="2", text="Microsoft fue fundado por Bill Gates y Paul Allen")
]
response = await client.recognize_linked_entities(docs)
for doc in response:
self.assertEqual(len(doc.entities), 3)
for entity in doc.entities:
self.assertIsNotNone(entity.name)
self.assertIsNotNone(entity.language)
self.assertIsNotNone(entity.data_source_entity_id)
self.assertIsNotNone(entity.url)
self.assertIsNotNone(entity.data_source)
self.assertIsNotNone(entity.matches)
for match in entity.matches:
self.assertIsNotNone(match.offset)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_passing_only_string(self, client):
docs = [
u"Microsoft was founded by Bill Gates and Paul Allen",
u"Microsoft fue fundado por Bill Gates y Paul Allen",
u""
]
response = await client.recognize_linked_entities(docs)
self.assertEqual(len(response[0].entities), 3)
self.assertEqual(len(response[1].entities), 3)
self.assertTrue(response[2].is_error)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_input_with_some_errors(self, client):
docs = [{"id": "1", "text": ""},
{"id": "2", "language": "es", "text": "Microsoft fue fundado por Bill Gates y Paul Allen"}]
response = await client.recognize_linked_entities(docs)
self.assertTrue(response[0].is_error)
self.assertFalse(response[1].is_error)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_input_with_all_errors(self, client):
docs = [{"id": "1", "text": ""},
{"id": "2", "language": "Spanish", "text": "Microsoft fue fundado por Bill Gates y Paul Allen"}]
response = await client.recognize_linked_entities(docs)
self.assertTrue(response[0].is_error)
self.assertTrue(response[1].is_error)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_too_many_documents(self, client):
docs = ["One", "Two", "Three", "Four", "Five", "Six"]
with pytest.raises(HttpResponseError) as excinfo:
await client.recognize_linked_entities(docs)
assert excinfo.value.status_code == 400
assert excinfo.value.error.code == "InvalidDocumentBatch"
assert "Batch request contains too many records" in str(excinfo.value)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_output_same_order_as_input(self, client):
docs = [
TextDocumentInput(id="1", text="one"),
TextDocumentInput(id="2", text="two"),
TextDocumentInput(id="3", text="three"),
TextDocumentInput(id="4", text="four"),
TextDocumentInput(id="5", text="five")
]
response = await client.recognize_linked_entities(docs)
for idx, doc in enumerate(response):
self.assertEqual(str(idx + 1), doc.id)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"text_analytics_account_key": ""})
async def test_empty_credential_class(self, client):
with self.assertRaises(ClientAuthenticationError):
response = await client.recognize_linked_entities(
["This is written in English."]
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"text_analytics_account_key": "xxxxxxxxxxxx"})
async def test_bad_credentials(self, client):
with self.assertRaises(ClientAuthenticationError):
response = await client.recognize_linked_entities(
["This is written in English."]
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_bad_document_input(self, client):
docs = "This is the wrong type"
with self.assertRaises(TypeError):
response = await client.recognize_linked_entities(docs)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_mixing_inputs(self, client):
docs = [
{"id": "1", "text": "Microsoft was founded by Bill Gates and Paul Allen."},
TextDocumentInput(id="2", text="I did not like the hotel we stayed at. It was too expensive."),
u"You cannot mix string input with the above inputs"
]
with self.assertRaises(TypeError):
response = await client.recognize_linked_entities(docs)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_out_of_order_ids(self, client):
docs = [{"id": "56", "text": ":)"},
{"id": "0", "text": ":("},
{"id": "22", "text": ""},
{"id": "19", "text": ":P"},
{"id": "1", "text": ":D"}]
response = await client.recognize_linked_entities(docs)
in_order = ["56", "0", "22", "19", "1"]
for idx, resp in enumerate(response):
self.assertEqual(resp.id, in_order[idx])
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_show_stats_and_model_version(self, client):
def callback(response):
self.assertIsNotNone(response)
self.assertIsNotNone(response.model_version, msg=response.raw_response)
self.assertIsNotNone(response.raw_response)
self.assertEqual(response.statistics.document_count, 5)
self.assertEqual(response.statistics.transaction_count, 4)
self.assertEqual(response.statistics.valid_document_count, 4)
self.assertEqual(response.statistics.erroneous_document_count, 1)
docs = [{"id": "56", "text": ":)"},
{"id": "0", "text": ":("},
{"id": "22", "text": ""},
{"id": "19", "text": ":P"},
{"id": "1", "text": ":D"}]
response = await client.recognize_linked_entities(
docs,
show_stats=True,
model_version="latest",
raw_response_hook=callback
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_batch_size_over_limit(self, client):
docs = [u"hello world"] * 1050
with self.assertRaises(HttpResponseError):
response = await client.recognize_linked_entities(docs)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_whole_batch_language_hint(self, client):
def callback(resp):
language_str = "\"language\": \"fr\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 3)
docs = [
u"This was the best day of my life.",
u"I did not like the hotel we stayed at. It was too expensive.",
u"The restaurant was not as good as I hoped."
]
response = await client.recognize_linked_entities(docs, language="fr", raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_whole_batch_dont_use_language_hint(self, client):
def callback(resp):
language_str = "\"language\": \"\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 3)
docs = [
u"This was the best day of my life.",
u"I did not like the hotel we stayed at. It was too expensive.",
u"The restaurant was not as good as I hoped."
]
response = await client.recognize_linked_entities(docs, language="", raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_per_item_dont_use_language_hint(self, client):
def callback(resp):
language_str = "\"language\": \"\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 2)
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 1)
docs = [{"id": "1", "language": "", "text": "I will go to the park."},
{"id": "2", "language": "", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": "The restaurant had really good food."}]
response = await client.recognize_linked_entities(docs, raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_whole_batch_language_hint_and_obj_input(self, client):
def callback(resp):
language_str = "\"language\": \"de\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 3)
docs = [
TextDocumentInput(id="1", text="I should take my cat to the veterinarian."),
TextDocumentInput(id="4", text="Este es un document escrito en Español."),
TextDocumentInput(id="3", text="猫は幸せ"),
]
response = await client.recognize_linked_entities(docs, language="de", raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_whole_batch_language_hint_and_obj_per_item_hints(self, client):
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 2)
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 1)
docs = [
TextDocumentInput(id="1", text="I should take my cat to the veterinarian.", language="es"),
TextDocumentInput(id="2", text="Este es un document escrito en Español.", language="es"),
TextDocumentInput(id="3", text="猫は幸せ"),
]
response = await client.recognize_linked_entities(docs, language="en", raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_whole_batch_language_hint_and_dict_per_item_hints(self, client):
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 2)
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 1)
docs = [{"id": "1", "language": "es", "text": "I will go to the park."},
{"id": "2", "language": "es", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": "The restaurant had really good food."}]
response = await client.recognize_linked_entities(docs, language="en", raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"default_language": "es"})
async def test_client_passed_default_language_hint(self, client):
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 3)
def callback_2(resp):
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
self.assertEqual(language, 3)
docs = [{"id": "1", "text": "I will go to the park."},
{"id": "2", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": "The restaurant had really good food."}]
response = await client.recognize_linked_entities(docs, raw_response_hook=callback)
response = await client.recognize_linked_entities(docs, language="en", raw_response_hook=callback_2)
response = await client.recognize_linked_entities(docs, raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_invalid_language_hint_method(self, client):
response = await client.recognize_linked_entities(
["This should fail because we're passing in an invalid language hint"], language="notalanguage"
)
self.assertEqual(response[0].error.code, 'UnsupportedLanguageCode')
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_invalid_language_hint_docs(self, client):
response = await client.recognize_linked_entities(
[{"id": "1", "language": "notalanguage", "text": "This should fail because we're passing in an invalid language hint"}]
)
self.assertEqual(response[0].error.code, 'UnsupportedLanguageCode')
@GlobalTextAnalyticsAccountPreparer()
async def test_rotate_subscription_key(self, resource_group, location, text_analytics_account, text_analytics_account_key):
credential = AzureKeyCredential(text_analytics_account_key)
client = TextAnalyticsClient(text_analytics_account, credential)
docs = [{"id": "1", "text": "I will go to the park."},
{"id": "2", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": "The restaurant had really good food."}]
response = await client.recognize_linked_entities(docs)
self.assertIsNotNone(response)
credential.update("xxx") # Make authentication fail
with self.assertRaises(ClientAuthenticationError):
response = await client.recognize_linked_entities(docs)
credential.update(text_analytics_account_key) # Authenticate successfully again
response = await client.recognize_linked_entities(docs)
self.assertIsNotNone(response)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_user_agent(self, client):
def callback(resp):
self.assertIn("azsdk-python-ai-textanalytics/{} Python/{} ({})".format(
VERSION, platform.python_version(), platform.platform()),
resp.http_request.headers["User-Agent"]
)
docs = [{"id": "1", "text": "I will go to the park."},
{"id": "2", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": "The restaurant had really good food."}]
response = await client.recognize_linked_entities(docs, raw_response_hook=callback)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_document_attribute_error_no_result_attribute(self, client):
docs = [{"id": "1", "text": ""}]
response = await client.recognize_linked_entities(docs)
# Attributes on DocumentError
self.assertTrue(response[0].is_error)
self.assertEqual(response[0].id, "1")
self.assertIsNotNone(response[0].error)
# Result attribute not on DocumentError, custom error message
try:
entities = response[0].entities
except AttributeError as custom_error:
self.assertEqual(
custom_error.args[0],
'\'DocumentError\' object has no attribute \'entities\'. '
'The service was unable to process this document:\nDocument Id: 1\nError: '
'InvalidDocument - Document text is empty.\n'
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_document_attribute_error_nonexistent_attribute(self, client):
docs = [{"id": "1", "text": ""}]
response = await client.recognize_linked_entities(docs)
# Attribute not found on DocumentError or result obj, default behavior/message
try:
entities = response[0].attribute_not_on_result_or_error
except AttributeError as default_behavior:
self.assertEqual(
default_behavior.args[0],
'\'DocumentError\' object has no attribute \'attribute_not_on_result_or_error\''
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_bad_model_version_error(self, client):
docs = [{"id": "1", "language": "english", "text": "I did not like the hotel we stayed at."}]
try:
result = await client.recognize_linked_entities(docs, model_version="bad")
except HttpResponseError as err:
self.assertEqual(err.error.code, "ModelVersionIncorrect")
self.assertIsNotNone(err.error.message)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_document_errors(self, client):
text = ""
for _ in range(5121):
text += "x"
docs = [{"id": "1", "text": ""},
{"id": "2", "language": "english", "text": "I did not like the hotel we stayed at."},
{"id": "3", "text": text}]
doc_errors = await client.recognize_linked_entities(docs)
self.assertEqual(doc_errors[0].error.code, "InvalidDocument")
self.assertIsNotNone(doc_errors[0].error.message)
self.assertEqual(doc_errors[1].error.code, "UnsupportedLanguageCode")
self.assertIsNotNone(doc_errors[1].error.message)
self.assertEqual(doc_errors[2].error.code, "InvalidDocument")
self.assertIsNotNone(doc_errors[2].error.message)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_document_warnings(self, client):
# No warnings actually returned for recognize_linked_entities. Will update when they add
docs = [
{"id": "1", "text": "This won't actually create a warning :'("},
]
result = await client.recognize_linked_entities(docs)
for doc in result:
doc_warnings = doc.warnings
self.assertEqual(len(doc_warnings), 0)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_not_passing_list_for_docs(self, client):
docs = {"id": "1", "text": "hello world"}
with pytest.raises(TypeError) as excinfo:
await client.recognize_linked_entities(docs)
assert "Input documents cannot be a dict" in str(excinfo.value)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_missing_input_records_error(self, client):
docs = []
with pytest.raises(ValueError) as excinfo:
await client.recognize_linked_entities(docs)
assert "Input documents can not be empty or None" in str(excinfo.value)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_passing_none_docs(self, client):
with pytest.raises(ValueError) as excinfo:
await client.recognize_linked_entities(None)
assert "Input documents can not be empty or None" in str(excinfo.value)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_duplicate_ids_error(self, client):
# Duplicate Ids
docs = [{"id": "1", "text": "hello world"},
{"id": "1", "text": "I did not like the hotel we stayed at."}]
try:
result = await client.recognize_linked_entities(docs)
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidDocument")
self.assertIsNotNone(err.error.message)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_batch_size_over_limit_error(self, client):
# Batch size over limit
docs = [u"hello world"] * 1001
try:
response = await client.recognize_linked_entities(docs)
except HttpResponseError as err:
self.assertEqual(err.error.code, "InvalidDocumentBatch")
self.assertIsNotNone(err.error.message)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_language_kwarg_spanish(self, client):
def callback(response):
language_str = "\"language\": \"es\""
self.assertEqual(response.http_request.body.count(language_str), 1)
self.assertIsNotNone(response.model_version)
self.assertIsNotNone(response.statistics)
res = await client.recognize_linked_entities(
documents=["Bill Gates is the CEO of Microsoft."],
model_version="latest",
show_stats=True,
language="es",
raw_response_hook=callback
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_pass_cls(self, client):
def callback(pipeline_response, deserialized, _):
return "cls result"
res = await client.recognize_linked_entities(
documents=["Test passing cls to endpoint"],
cls=callback
)
assert res == "cls result"
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_offset(self, client):
result = await client.recognize_linked_entities(["Microsoft was founded by Bill Gates and Paul Allen"])
entities = result[0].entities
# the entities are being returned in a non-sequential order by the service
microsoft_entity = [entity for entity in entities if entity.name == "Microsoft"][0]
bill_gates_entity = [entity for entity in entities if entity.name == "Bill Gates"][0]
paul_allen_entity = [entity for entity in entities if entity.name == "Paul Allen"][0]
self.assertEqual(microsoft_entity.matches[0].offset, 0)
self.assertEqual(bill_gates_entity.matches[0].offset, 25)
self.assertEqual(paul_allen_entity.matches[0].offset, 40)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
async def test_no_offset_v3_linked_entity_match(self, client):
result = await client.recognize_linked_entities(["Microsoft was founded by Bill Gates and Paul Allen"])
entities = result[0].entities
self.assertIsNone(entities[0].matches[0].offset)
self.assertIsNone(entities[1].matches[0].offset)
self.assertIsNone(entities[2].matches[0].offset)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
async def test_string_index_type_not_fail_v3(self, client):
# make sure that the addition of the string_index_type kwarg for v3.1-preview doesn't
# cause v3.0 calls to fail
await client.recognize_linked_entities(["please don't fail"])
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_bing_id(self, client):
result = await client.recognize_linked_entities(["Microsoft was founded by Bill Gates and Paul Allen"])
for doc in result:
for entity in doc.entities:
assert entity.bing_entity_search_api_id # this checks if it's None and if it's empty
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
async def test_string_index_type_explicit_fails_v3(self, client):
with pytest.raises(ValueError) as excinfo:
await client.recognize_linked_entities(["this should fail"], string_index_type="UnicodeCodePoint")
assert "'string_index_type' is only available for API version V3_1_PREVIEW and up" in str(excinfo.value)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_default_string_index_type_is_UnicodeCodePoint(self, client):
def callback(response):
self.assertEqual(response.http_request.query["stringIndexType"], "UnicodeCodePoint")
res = await client.recognize_linked_entities(
documents=["Hello world"],
raw_response_hook=callback
)
@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer()
async def test_explicit_set_string_index_type(self, client):
def callback(response):
self.assertEqual(response.http_request.query["stringIndexType"], "TextElements_v8")
res = await client.recognize_linked_entities(
documents=["Hello world"],
string_index_type="TextElements_v8",
raw_response_hook=callback
) | [
"noreply@github.com"
] | manoj0806.noreply@github.com |
678bf5b3ec870d332a5a4194eee7e243dab9922a | 84fa4b11df32f16926395e4a615831a77c973df5 | /clients/propbank.py | 07d67abe14651cc2b6368f859896bc2c81c7b677 | [] | no_license | richfish/nlp_clients | df9dc9405e9f13d89650d7dee339b0d9b8fa513a | abcd7d452c72dd3933a3d911be6b04f6a3eefbe1 | refs/heads/master | 2020-12-23T16:47:10.876939 | 2017-05-27T02:16:15 | 2017-05-27T02:16:15 | 92,562,761 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,626 | py | #https://github.com/propbank/propbank-documentation/blob/master/annotation-guidelines/Propbank-Annotation-Guidelines.pdf
from collections import defaultdict
import re
from os import listdir
from os.path import isfile, join
from pprint import pprint as pp
import json
# import spacy
# from spacy.en import English
# parser = English()
import nltk
from nltk.corpus import propbank as pbs
import xml.etree.ElementTree as ET
class PropbankMiner():
def __init__(self, parser=None, frames_path=None):
if not frames_path:
frames_path = "../assets/propbank-frames/frames"
if not parser:
parser = None#English()
self.parser = parser
self.file_name_list = [f for f in listdir(frames_path) if isfile(join(frames_path, f))]
self.all_files_parsed = self.parse_all_files() #7,308 xml sets
#self.current_frame_xml = None
#self.current_template = None
self.all_examples = []
self.all_templates = self.build_all_templates()
self.all_rolesets = self.get_arr_of_all_rolesets()
def pp_template(self, template):
pp(json.loads(json.dumps(template)))
def get_base_template(self):
return defaultdict(str, {
"lemma": "",
"num_rolesets": 1,
"rolesets": defaultdict(str,{
"roleset1": defaultdict(str,{
"meta": defaultdict(str, {
"alias_txts": [],
"framenet_names": [],
"verbnet_names": [],
"num_roles": 0,
"num_examples": 0
}),
"roles": [], #[n_val, f_val, descrip], [n_val, f_val, descrip]... #different than argtype below
"examples": defaultdict(str,{
"example1": defaultdict(str, {
"name": "", #name tag in <example>
"text": "",
"args": [] #[argtype, f_val, text], [argtype, f_val, text]... argtype can be arg0, arg1, rel, argm
})
})
})
})
})
def parse_all_files(self):
self.file_name_list.remove('frameset.dtd')
parsed = []
for fname in self.file_name_list:
parsed.append(ET.parse('../assets//propbank-frames/frames/' + fname))
return parsed
def build_all_templates(self):
complete_templates = []
for parsed_file in self.all_files_parsed:
complete_templates.append(self.fill_base_template(parsed_file))
return complete_templates
def fill_base_template(self, parsed_file=None):
base_template = self.get_base_template()
root = parsed_file.getroot()
rolesets = root.findall('predicate/roleset')
base_template["lemma"] = root[0].get('lemma')
if base_template["lemma"] is None:
base_template["lemma"] = "NONE"
base_template["num_rolesets"] = len(rolesets)
for i, r in enumerate(rolesets):
if i == 0:
base_r = base_template["rolesets"]["roleset1"]
else:
base_template["rolesets"]["roleset"+str(i+1)] = defaultdict(str)
base_r = base_template["rolesets"]["roleset"+str(i+1)]
base_r["meta"] = defaultdict(str)
base_r["examples"] = defaultdict(str)
examples = r.findall('example')
role_collections = r.findall('roles')
if len(role_collections) > 1:
raise ValueError('More than one role collection') #quirk of data
roles = role_collections[0]
# alias/ meta
aliases = r.findall('aliases')[0].findall('alias')
base_r["meta"]["alias_txts"] = []
base_r["meta"]["framenet_names"] = []
base_r["meta"]["verbnet_names"] = []
base_r["meta"]["pos"] = []
base_r["meta"]["name"] = r.get('name')
base_r["meta"]["lemma"] = base_template["lemma"]
base_r["meta"]["num_roles"] = len(roles)
base_r["meta"]["num_examples"] = len(examples)
for j, alias in enumerate(aliases):
base_r["meta"]["alias_txts"].append(alias.text)
base_r["meta"]["framenet_names"].append(alias.get('framenet').split())
base_r["meta"]["verbnet_names"].append(alias.get('verbnet').split())
base_r["meta"]["pos"].append(alias.get('pos'))
# roles
roles_collected = []
for role in roles:
n_val = role.get('n')
f_val = role.get('f')
description = role.get('descr')
roles_collected.append([n_val, f_val, description])
base_r["roles"] = roles_collected
# examples
for i2, example in enumerate(examples):
if i == 0 and i2 == 0:
ex = base_r["examples"]["example1"]
else:
base_r["examples"]["example"+str(i2+1)] = defaultdict(str)
ex = base_r["examples"]["example"+str(i2+1)]
ex["name"] = example.get("name")
ex["text"] = example.find('text').text
args_collected = []
for child in example:
if child.tag == "text":
continue
argtype = child.tag
if child.get('n'):
argtype += child.get('n')
f_val = child.get('f')
text = child.text
args_collected.append([argtype, f_val, text])
ex["args"] = args_collected
return base_template
def get_arr_of_all_rolesets(self):
allrolesets = []
for t in self.all_templates:
for i in range(1,int(t['num_rolesets'])+1):
allrolesets.append(t['rolesets']['roleset'+str(i)])
return allrolesets
def get_role_types_per_template(self, template): #[a,b], [a,b]... for all 7k+ frames
rolses_for_t = []
for k,v in template['rolesets'].iteritems():
roles = v['roles']
for i, role in enumerate(roles):
rolses_for_t.append([role[0], role[1], template['lemma']+str(i+1)])
return rolses_for_t
def get_all_role_types(self):
all_roles = []
for template in self.all_templates:
all_roles.append(self.get_role_types_per_template(template))
return [y for x in all_roles for y in x]
def get_all_example_text(self):
for template in self.all_templates:
for i in range(0, template['num_rolesets']):
print('ERE', template)
examples = template['rolesets']['roleset'+str(i+1)]['examples']
for _,v in examples.iteritems():
self.all_examples.append(v['text'])
return True
def basic_arg0_arg1_frames(self):
frames = []
rolesets = filter(lambda x: ['j'] != x['meta']['pos'] and len(x['roles']) > 1, self.all_rolesets)
for roleset in rolesets:
r = roleset['roles']
if r[0][0] == None:
del r[0]
if len(r) > 1:
if r[0][0] in ["0", "1"]: #treat same for now, ideally would just be 0
arg0_txt = r[0][-1]
rel_txt1 = roleset['meta']['lemma'] #either lemma or roleset name
rel_txt2 = roleset['meta']["name"]
arg1_txt = r[1][-1]
frame = unicode("<X {}><rel {}><Y {}>").format(arg0_txt, rel_txt1, arg1_txt)
frames.append(frame)
frame = unicode("<X {}><rel {}><Y {}>").format(arg0_txt, rel_txt2, arg1_txt)
frames.append(frame)
if len(r) > 2: #DIR and what not
dirobj = filter(lambda x: x[0] == "2" and x[1].lower() == "dir", r)
if dirobj:
dirobj_txt = dirobj[-1]
frame = unicode("<X {}><rel {}><Y {}>").format(arg0_txt, rel_txt2, dirobj_txt) #use roleset name
frames.append(frame)
return frames
def basic_example_baesd_frames(self):
pass
def make_frames_from_examples(self):
pass
# just the arg0,arg1, rel constructs, actual examples are too lengthy
def make_abstract_frames_from_role_rules(self):
pass
| [
"Richard Fisher"
] | Richard Fisher |
79a928765926f744615e90f9ef1034a1915ca296 | 432c1dc997823b3068f7d742a72bea70bc81ffd2 | /Dictionary/assoc_list.py | 56b4c9fea3b8bb4a872cb108fa14cede0f4b39a2 | [] | no_license | mjgpy3/DataStructsAndAlgsPractice | 398a671ef8fffd77a17afde8b2437052d1fde2e6 | 09f2eadbbced32ce80bee1fbbcb443beebb6eced | refs/heads/master | 2021-01-01T06:04:22.933841 | 2015-02-02T15:48:21 | 2015-02-02T15:48:21 | 7,411,233 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,172 | py | from dictionary import Dictionary
class AssocList(Dictionary):
def __init__(self):
self.list = None
def insert(self, key, value):
self.list = Node((key, value), self.list)
return self
def delete(self, key):
self.list and self.list.delete_where(lambda t: t[0] == key)
return self
def get(self, key):
v = self.__item_at(key)
if v: return v[1]
raise KeyError(key + ' not found')
def __contains__(self, key):
return bool(self.__item_at(key))
def __item_at(self, key):
return self.list and self.list.find_where(lambda t: t[0] == key)
class Node(object):
def __init__(self, datum, next = None):
self.datum = datum
self.next = next
self.true_node = True
def delete_where(self, p):
if self.__satisfies(p):
self.true_node = False
if self.next:
self.next.delete_where(p)
def find_where(self, p):
if self.__satisfies(p):
return self.datum
return self.next and self.next.find_where(p)
def __satisfies(self, p):
return self.true_node and p(self.datum)
| [
"mjg.py3@gmail.com"
] | mjg.py3@gmail.com |
86c274bc035045e4c07fcc53ac4cff5b68c2a4cd | 5add1252106f3a9a7002a9dcab53f12e789aa3b7 | /sort.py | 322fa307fc2c4798391d299807de334d592fac97 | [] | no_license | wknowleskellett/ChristmasListSorter | fe4b7c44f85e8029f12357385a8b8d73e76ce6fd | 29a29bb72e68eec0accfa20c10f65cf0d3fbb542 | refs/heads/master | 2023-02-03T21:57:19.561914 | 2020-12-25T07:30:39 | 2020-12-25T07:30:39 | 324,302,863 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 891 | py | from functools import cmp_to_key as ctk
def clean_pair(pair, len):
return f'{pair[0]: <{max_len}}\t{pair[1]}'
def compare(item1, item2):
print("Prefer 1, or 2:", end="\n\n")
pad_len = max(len(item1[0]), len(item2[0]))
print("0")
print("1", clean_pair(item1, pad_len))
print("2", clean_pair(item2, pad_len), end="\n\n")
ans = " "
while ans not in ["0", "1", "2"]:
ans = input()
print(end="\n\n")
# Highest ranked items at the top of the list
if ans == "1":
return -1
elif ans == "2":
return 1
else:
return 0
with open("wish_list.tsv") as present_list:
pairs = {k:v[:-1] for k, v in [s.split('\t') for s in present_list.readlines()]}.items()
max_len = max([len(p[0]) for p in pairs])
for p in sorted(pairs, key=ctk(lambda item1, item2: compare(item1, item2))):
print(clean_pair(p, max_len)) | [
"39969985+wknowleskellett@users.noreply.github.com"
] | 39969985+wknowleskellett@users.noreply.github.com |
a1e0a6b6dba9943c3ec69b8de8b76e31663311a5 | 4f4dcc8f692a861bb4aef5e9555ec5024d26633e | /Internet_worm/__init__.py | 40f658c00327ecd1e264e3cb8553306e0d7a3249 | [] | no_license | ZS140/Internet_Worm | 25e52db1671e9e1a3b3283008d76058120cf1a70 | 0f3674f78277e6630678af36d71d978da1ae0d1f | refs/heads/master | 2020-03-22T21:50:41.038500 | 2018-07-12T17:51:54 | 2018-07-12T17:51:54 | 140,716,940 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,052 | py | import hashlib
import threading
import urllib.request
import os
from datetime import datetime
import time
import re
import logging
from bs4 import BeautifulSoup
from Internet_worm import nasdaq_mysql
url = 'https://www.nasdaq.com/symbol/aapl/historical#.UWdnJBDMhHk'
old_md = ''
isrunning = True
sleep_time = 5
#自定义日志对象
logging.basicConfig(level=logging.DEBUG,format='%(threadName)s-%(asctime)s-%(message)s')
logger = logging.getLogger()
#判断是否处于交易时间,交易时间不获取数据
def istrade():
now = datetime.now()
now_str = datetime.strftime(now,'%H%M%S')
start_time = '093000'
end_time = '153000'
if now.weekday() == 5 or now.weekday() == 6 or (start_time > now_str or end_time < now_str):
# logger.info("处于非交易时间")
return False
else:
logger.info("正处于交易时间")
nasdaq_mysql.getData()
return True
#判断数据是否更新的函数
def validataUpdate(divstr):
global old_md
#创建MD5对象
m = hashlib.md5()
m.update(divstr.encode(encoding='utf-8'))
new_md = m.hexdigest()
if os.path.exists('md5.txt'):
with open('md5.txt','r') as r:
old_md = r.read()
else:
with open('md5.txt', 'w') as w:
w.write(new_md)
if new_md == old_md:
# print("数据未更新,md5:{0}".format(new_md))
return False
else:
# print('数据更新了,md5:{0}'.format(new_md))
with open('md5.txt', 'w') as w:
w.write(new_md)
return True
#获取网页信息函数
def get_data(htmlstr):
bs = BeautifulSoup(htmlstr,'html.parser')
div = bs.select('div#quotes_content_left_pnlAJAX')
if validataUpdate(div[0]):#检测更新
tbody = bs.select('#quotes_content_left_pnlAJAX table tbody tr')
data = []
for i in tbody:
field = {}
data_str = i.text.strip()
if data_str == '':
continue
row =re.split(r'\s+',data_str)
try: #因为交易时间当天日期不是月/日/年格式,会产生时间转换异常
field['Date'] = datetime.strptime(row[0],'%m/%d/%Y')
field['Open'] = float(row[1])
field['High'] = float(row[2])
field['Low'] = float(row[3])
field['Close'] = float(row[4])
field['Volume'] = float(row[5].replace(',', ""))
field['Symbol'] = 'APPL'
data.append(field)
except ValueError:
pass
#存入新数据前删除旧数据
nasdaq_mysql.delData()
for row in data:
count = nasdaq_mysql.putData(row)
# print("影响{0}行数据".format(count))
#爬虫工作线程体
def Work():
global isrunning,sleep_time
while isrunning:
if istrade():#如果处于交易时间则不获取数据
time.sleep(60 * 60)
continue
logger.info('爬虫工作...')
req = urllib.request.Request(url)
with urllib.request.urlopen(req) as response:
html = response.read().decode()
get_data(html)
logger.info("爬虫工作间隔{0}秒".format(sleep_time))
time.sleep(sleep_time)#爬虫执行间隔时间
#爬虫控制线程体
def Control():
global isrunning, sleep_time
while isrunning:
if istrade():
logger.info("交易时间,爬虫处于休眠状态...")
time.sleep(60*60)
continue
i = input("爬虫执行间隔时间,单位:秒\n")
try:
sleep_time = int(i)
except ValueError:
if i.lower() == 'bye':
logger.info("结束...")
isrunning = False
#主函数
def main():
workthread = threading.Thread(target=Work, name='WorkThread')
workthread.start()
controlthread = threading.Thread(target=Control, name='ControlThread')
controlthread.start()
if __name__ == '__main__':
main()
| [
"859691959@qq.com"
] | 859691959@qq.com |
6bcbca8ce64c3cf5385efbd96a2fb1f0427737d1 | 2e4c6c4694687383126ba126e2155133c112d275 | /Exercise8_Putsaya_S.py | 0d7af6526dda65f366f47c3adee738a2ed72cb21 | [] | no_license | pearpps/CP3-Putsaya-Salika | 5cf7aafc9214a630f0d839dd3910c6ec67dc9c5a | ac40af81efd8c8929e6367a35afc39a546f32555 | refs/heads/main | 2023-04-04T20:01:04.203054 | 2021-04-09T08:31:01 | 2021-04-09T08:31:01 | 346,943,658 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,030 | py | username = input("Username :")
password = input("Password :")
if username == "exercise8" and password == "8188216":
print("Welcome to Example Shop\n")
print("----------MENU------------")
print("1.pepsi 15 THB/PIECE")
pepsiPrice = int(15)
print("2.rice 5 THB/PIECE")
ricePrice = int(5)
print("3.chocolate 25 THB/PIECE")
chocolatePrice = int(25)
print("4.book 50 THB/PIECE")
bookPrice = int(50)
print("5.water 15 THB/PIECE")
waterPrice = int(15)
print("--------------------------\n")
print("What do you like to buy?")
userSelected = int(input("Select number : "))
if userSelected == 1:
print("\nHow many do you want?")
amount = int(input("Amount : "))
pepsi = amount * pepsiPrice
print("\nTotalPrice =",pepsi,"THB\n")
print("Thank you\nHope to see you next time!")
elif userSelected == 2:
print("\nHow many do you want?")
amount = int(input("Amount : "))
rice = amount * ricePrice
print("\nTotalPrice =",rice,"THB\n")
print("Thank you\nHope to see you next time!")
elif userSelected == 3:
print("\nHow many do you want?")
amount = int(input("Amount : "))
chocolate = amount * chocolatePrice
print("\nTotalPrice =",chocolate,"THB\n")
print("Thank you\nHope to see you next time!")
elif userSelected == 4:
print("\nHow many do you want?")
amount = int(input("Amount : "))
book = amount * bookPrice
print("\nTotalPrice =",book,"THB\n")
print("Thank you\nHope to see you next time!")
elif userSelected == 5:
print("\nHow many do you want?")
amount = int(input("Amount : "))
water = amount * waterPrice
print("\nTotalPrice =",water,"THB\n")
print("Thank you :)\nHope to see you next time!")
else:
print("\nERROR\nPlease select number only in MENU!!!")
else:
print("\nIncorrect!\nPlease try again")
| [
"pearr.putsaya@gmail.com"
] | pearr.putsaya@gmail.com |
1cf3afa3a4bc89977f9ce7ece1af56e99ab8fb88 | f872bf38c0553edd81bda254a23609afe5e9c08f | /data types/question38.py | 813e8e5019223f6d14426e4f21ad46a28cad4bfd | [] | no_license | nirvaychaudhary/Python-Assignmnet | a2fc9498213e1e3e9b72216055b24c967330a835 | b33ccd21921174a71ff52874020943dde7106108 | refs/heads/master | 2022-11-05T07:45:22.536530 | 2020-06-28T11:52:46 | 2020-06-28T11:52:46 | 275,574,303 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 174 | py | # Write a Python program to remove a key from a dictionary.
d = {'math': 80, 'science': 75, 'english': 90, 'Nepali': 85}
print(d)
if 'math' in d:
del d['math']
print(d)
| [
"chaudharynirvaya@gmail.com"
] | chaudharynirvaya@gmail.com |
3ab3c84976bf42b28e9e44ba9806ac313a3ff20e | 6e217b8626adb584131123a7ccc8579a98c5db7f | /kale/simulator/simulator_constants.py | ba659e0f7e18db0bd397076da68c40578c2686c7 | [
"Apache-2.0"
] | permissive | blockchiansea/kale-blockchain | 56504513f2fe0c2ad3906d944e04b20747f6b415 | 4971d93d0af3c8b50a46c371e8619c9f4b190ed2 | refs/heads/main | 2023-08-28T18:14:00.022382 | 2021-10-25T15:28:10 | 2021-10-25T15:28:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 351 | py | if __name__ == "__main__":
from tests.block_tools import BlockTools, test_constants
from kale.util.default_root import DEFAULT_ROOT_PATH
# TODO: mariano: fix this with new consensus
bt = BlockTools(root_path=DEFAULT_ROOT_PATH)
new_genesis_block = bt.create_genesis_block(test_constants, b"0")
print(bytes(new_genesis_block))
| [
"kaleseed@github.com"
] | kaleseed@github.com |
fd4c4c060c007386e18808a8505d1d6c24e013cc | da0bfca935f6f73ceb26d6cfbde85b2bc7cf65d3 | /attack_methods/Gaussian_blur.py | 88cc823c0bad34c3b2f9b905487ce501978944be | [
"MIT"
] | permissive | ASU-APG/decentralized_attribution_of_generative_models | c0070a2e33b178bf7745c681c9f62bac67cc2e57 | b57c38b215cff4df24744262ffa02d41c61151ac | refs/heads/master | 2023-03-22T09:16:01.828670 | 2021-03-22T03:46:53 | 2021-03-22T03:46:53 | 328,608,508 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 920 | py | import kornia
import torch
import torch.nn as nn
import numpy as np
import random
device = torch.device("cuda:0" if (torch.cuda.is_available()) else "cpu")
##Uploading test
class Gaussian_blur(nn.Module):
def __init__(self,kernel_size, is_train):
super(Gaussian_blur, self).__init__()
self.sigma = np.array(kernel_size) / 3.0
self.filter_size = [3,9,15,19,25] #This filter size is calculated based on scipy source.
if (not is_train):
self.sigma = [self.sigma[-1]]
self.filter_size = [self.filter_size[-1]]
def forward(self, image):
index = random.choice(np.arange(len(self.sigma)))
filter_size = (self.filter_size[index], self.filter_size[index])
sigma = (self.sigma[index], self.sigma[index])
blurred_image = kornia.filters.gaussian_blur2d(image, filter_size, sigma=sigma).to(device)
return blurred_image
| [
"ckim79@asu.edu"
] | ckim79@asu.edu |
47fef1d148e76c45b4f716f5a513cc26661827c9 | 4d29a209e95120d6ca70f4d3550adca3dd6161ad | /Web scraping.py | 4ad340a35eb4ee2a2099b05c5c500f299cc0941d | [] | no_license | mansihsangwan/webscrapping | 7ddc3b21858546064ffc2b8381f443d0f28c07f5 | 29b8621475933e89447075f7b4aebafa7bc46526 | refs/heads/master | 2020-05-10T00:19:37.614794 | 2019-04-15T16:47:33 | 2019-04-15T16:47:33 | 181,527,748 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,284 | py | import requests
from urllib.request import urlopen
from bs4 import BeautifulSoup
import urllib
import time
import re
import os
locations = [
'https://www.python.org/'
]
try:
for location in locations:
html = requests.get(location)
data = BeautifulSoup(html.content,'lxml')
#print(data)
file2 = open("Scrapped data/Whole data.txt","a+")
file2.write(str(data))
file2.close()
for link in data.findAll('a', attrs={'href': re.compile("^http://")}):
all_links = link.get('href')
#print(all_links)
file3 = open("Scrapped data/links.txt","a+")
file3.write(all_links)
file3.write("\n")
file3.close()
soup = BeautifulSoup(urlopen(all_links).read(),'html')
title = (soup.title.string)
#print(title)
file1 = open("Scrapped data/title.txt","a+")
file1.write(title)
file1.write("\n")
file1.close()
for pp in soup.select("p"):
pass
para = pp.text
#print (pp)
file4 = open("Scrapped data/Paragraph.txt","a+")
file4.write(str(para))
file4.write("\n")
file4.close()
body = soup.body.text
#print(body.text)
file5 = open("Scrapped data/Body.txt","a+")
file5.write(body)
file5.write("\n")
file5.close()
head = soup.head.text
#print(head.text)
file5 = open("Scrapped data/Head.txt","a+")
file5.write(head)
file5.write("\n")
file5.close()
try:
links = soup.find_all('img', src=True)
for link in links:
timestamp = time.asctime()
txt = open('web scraping images/%s.jpg' % timestamp, "wb")
link = link["src"].split("src=")[-1]
download_img = urlopen(link)
txt.write(download_img.read())
txt.close()
except Exception as e:
pass
except Exception as e:
print("\n"*20)
print(e)
pass | [
"manishsangu007@gmail.com"
] | manishsangu007@gmail.com |
dc95599d72efcaad303dc9d75d8141446f85df7f | 76723ef29e430357eaa338cae2e50fbc0356f30a | /Game.py | 458cc081f5b09ae434a5380bad1bd2d3e55851a2 | [] | no_license | mhmadAbs/TicTacToeConsole | 125cf0b42d770a5b802842744e0e7f954d868e41 | 69788b1f2ac6e62005b10a7f49c2b968b85e35d3 | refs/heads/master | 2023-08-03T16:59:20.860536 | 2021-09-19T12:11:45 | 2021-09-19T12:11:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,922 | py | import random
class Player:
def __init__(self, name, sign):
self.name = name
self.sign = sign.upper()
def getName(self):
return self.name
def getSign(self):
return self.sign.upper()
def play(self, board):
pass
class Human(Player):
def __init__(self, name, sign):
if sign.upper() == "X" or sign.upper() == "O":
self.sign = sign.upper()
else:
raise ValueError("Sign can be 'X' or 'Y'")
Player.__init__(self, name, sign)
def setName(self, name):
self.name = name
def play(self, board):
place = ""
while place != " ": # so that the while loop can start.
user_str = input("{} ,Choose a Position [1..9] : ".format(self.getName()))
if user_str.isdigit():
user_int = int(user_str)
else:
raise ValueError("Non-valid TicTacToe Position")
place = board[user_int - 1] # Positions in the Game starts from 1
if place != " ":
print("Position {} is full".format(user_int))
else:
board[user_int - 1] = self.getSign()
def __str__(self):
return "Human : name = {} , sign = {}".format(self.name, self.sign)
class Ai(Player):
def __init__(self):
Player.__init__(self, "AI-V1", "") # Ai Sign will be set depending on Human Sign
def __str__(self):
return "AI : Name = {} , sign = {}".format(self.name, self.sign)
def play(self, board):
place = "xx"
while place != " ": # so that the while loop can start.
ai_choice = random.randint(1, 9)
place = board[ai_choice - 1]
if place == " ":
board[ai_choice - 1] = self.getSign()
print("{}'s choice is : Position {}".format(self.getName(), ai_choice))
class Board:
def __init__(self, liste=None):
if liste is None:
liste = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
self.liste = liste
def getListe(self):
return self.liste
def display(self):
places = self.liste
print("_____________")
print("| {} | {} | {} |".format(places[0], places[1], places[2]))
print("|___|___|___|")
print("| {} | {} | {} |".format(places[3], places[4], places[5]))
print("|___|___|___|")
print("| {} | {} | {} |".format(places[6], places[7], places[8]))
print("|___|___|___|")
print()
def checkResult(self):
board = self.getListe()
if board[0] == board[1] and board[1] == board[2] and board[0] != ' ':
return True
elif board[3] == board[4] and board[4] == board[5] and board[3] != ' ':
return True
elif board[6] == board[7] and board[7] == board[8] and board[6] != ' ':
return True
elif board[0] == board[3] and board[3] == board[6] and board[0] != ' ':
return True
elif board[1] == board[4] and board[4] == board[7] and board[1] != ' ':
return True
elif board[2] == board[5] and board[5] == board[8] and board[2] != ' ':
return True
elif board[0] == board[4] and board[4] == board[8] and board[0] != ' ':
return True
elif board[2] == board[4] and board[4] == board[6] and board[2] != ' ':
return True
class Game:
def __init__(self, board, human, ai):
self.board = board
self.human = human
self.ai = ai
def start(self):
this_board = self.board
this_human = self.human
this_ai = self.ai
if self.human.getSign() == "X":
self.ai.sign = "O"
else:
self.ai.sign = "X"
winner = ""
while " " in this_board.getListe():
this_human.play(this_board.getListe())
this_board.display()
if this_board.checkResult():
winner = this_human.getName()
break
if " " in this_board.getListe():
this_ai.play(this_board.getListe())
this_board.display()
if this_board.checkResult():
winner = this_ai.getName()
break
if winner == "":
print("Draw ! Nobody won !")
else:
print("{}, won the game !".format(winner), "\n")
class Main:
retry = True
print("TicTacToe by Mohamad Abouras© GmbH.All Rights Reserved®.")
name = input("Player Name : ")
sign = input("X or O ? ")
while retry:
board = Board()
board.display()
p1 = Human(name, sign)
a1 = Ai()
game = Game(board, p1, a1)
game.start()
print("1 - Play Again")
print("2 - Exit")
option = input("Choose an Option : ")
if option == "2":
retry = False
| [
"mhmad.abouras2222@gmail.com"
] | mhmad.abouras2222@gmail.com |
a2487b5575f3ca164cb6d99549808fa7c10271d3 | cd853e1267a88d702a1402e1454969f593e38484 | /api/migrations/0001_initial.py | 3b795535a411762b3a8f247fbfa816fb64e2792e | [] | no_license | paau12/dogofinder-backend | bc366b770741cc29f2507f359272b4d540fbee96 | 9c65e6a0be1a52feae189e840c528e7ce11482e6 | refs/heads/master | 2023-01-22T19:10:19.285469 | 2020-11-25T20:56:55 | 2020-11-25T20:56:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 973 | py | # Generated by Django 3.1.2 on 2020-10-23 23:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Mascota',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre_mascota', models.CharField(max_length=100)),
('tipo_mascota', models.CharField(max_length=100)),
('raza_mascota', models.CharField(max_length=100)),
('descripcion_mascota', models.CharField(max_length=300)),
('codigo_qr', models.CharField(max_length=100)),
('foto_mascota', models.ImageField(upload_to=None)),
('in_home', models.BooleanField(default=False)),
('id_usuario', models.CharField(max_length=100)),
],
),
]
| [
"yeguacelestial@gmail.com"
] | yeguacelestial@gmail.com |
1dd859287ef526b07301459e8f99be5906e9ab61 | 88f5eb6aeeb04d1dfbea668a162756b79c1ce74f | /snippets/clfSequential.py | 72438894c941621cac8d3c90a2dd497d1780da01 | [] | no_license | xaviergoby/Adv_Fin_ML | 8a436735337cfea2a558eb9e595bf74edf15ec33 | 744e11ffc26aede466dfb559047240ecf22187c6 | refs/heads/master | 2020-04-11T13:44:45.146528 | 2018-10-18T22:34:55 | 2018-10-18T22:34:55 | 161,827,581 | 1 | 0 | null | 2018-12-14T18:50:31 | 2018-12-14T18:50:31 | null | UTF-8 | Python | false | false | 1,525 | py | from sklearn.model_selection._split import _BaseKFold
# SNIPPET 7.3 CROSS-VALIDATION CLASS WHEN OBSERVATIONS OVERLAP
class PurgedKFold(_BaseKFold):
"""
Extend KFold class to work with labels that span intervals
The train is purged of observations overlapping test-label intervals
Test set is assumed contiguous (shuffle=False), w/o training samples in between
"""
def __init__(self,n_splits=3,t1=None,pctEmbargo=0.):
if not isinstance(t1,pd.Series):
raise ValueError('Label Through Dates must be a pd.Series')
super(PurgedKFold,self).__init__(n_splits,shuffle=False,random_state=None)
self.t1=t1
self.pctEmbargo=pctEmbargo
def split(self,X,y=None,groups=None):
if (X.index==self.t1.index).sum()!=len(self.t1):
raise ValueError('X and ThruDateValues must have the same index')
indices=np.arange(X.shape[0])
mbrg=int(X.shape[0]*self.pctEmbargo)
test_starts=[(i[0],i[-1]+1) for i in np.array_split(np.arange(X.shape[0]),self.n_splits)]
for i,j in test_starts:
t0=self.t1.index[i] # start of test set
test_indices=indices[i:j]
maxT1Idx=self.t1.index.searchsorted(self.t1[test_indices].max())
train_indices=self.t1.index.searchsorted(self.t1[self.t1<=t0].index)
if maxT1Idx<X.shape[0]: # right train (with embargo)
train_indices=np.concatenate((train_indices,indices[maxT1Idx+mbrg:]))
yield train_indices,test_indices
| [
"roberto@spadim.com.br"
] | roberto@spadim.com.br |
09ce3d2b461a840a0ce78019a4e30b3e08a4a747 | 54ebf7ff5055acb05e73bfada81915b9b4b9c680 | /backend/accounts/migrations/0002_auto_20210710_0005.py | cd6609e2d31fb98d6760e6b9d9049e5392221604 | [] | no_license | Abdulghani007/Deceptive-Review-Detection | 0839038ec3fd2de9920d5622e2e7433a2224e11a | 56a643dee343bac604f9ce783afcde242f2979a5 | refs/heads/master | 2023-07-17T17:57:42.554703 | 2021-08-26T11:00:30 | 2021-08-26T11:00:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 570 | py | # Generated by Django 3.2.4 on 2021-07-09 18:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='customuser',
name='deceptive',
field=models.CharField(default='', max_length=10),
),
migrations.AddField(
model_name='customuser',
name='filtered_review',
field=models.CharField(default='', max_length=350),
),
]
| [
"abdulghani444.blr@gmail.com"
] | abdulghani444.blr@gmail.com |
217a8fa8ac1728329939524e1c34916521eebbf3 | e2b769b5ddfbfd2d0d98ea41cd1ed19f0feab352 | /manage.py | f30831f1f43ec9ed92498a8babab5a01ba7c8f3d | [] | no_license | artisk9/SMS | 36a43d6312d46a738bcb5a289965311d9c154080 | ef52e735b6fcb6860cb2d403db67da643b12311c | refs/heads/master | 2020-04-27T05:29:39.213169 | 2019-03-06T06:22:19 | 2019-03-06T06:23:09 | 174,081,989 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 807 | py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lhProject.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
| [
"livehealth@swapnils-MacBook-Pro.local"
] | livehealth@swapnils-MacBook-Pro.local |
99bc0a7e8d2cae319146da3e035d7f6c2c2ae18d | 9eb7114b9836f38133f94d4cc63fe3b9c0e2d217 | /simulation.py | ee838ad6e84ed55884aa8ef3cd23daf262e23c81 | [] | no_license | Ammonbhatti/Discrete-Time-Event-Simulation | 4c792015e2c75ce6b7c23761ba39032ab6844f50 | a9b8ea7e0b353a3f8fd7fed36ec14fdfc9e05ea0 | refs/heads/master | 2022-11-30T00:55:31.563536 | 2020-08-12T00:16:15 | 2020-08-12T00:16:15 | 286,868,752 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,949 | py | # -*- coding: utf-8 -*-
#package used to sample from the arrival and
#departure distributions.
import numpy as np
MAXBUFFER = 50 #max packets in queue
print("This is a discrete time event simulation of single" )
print("queue and single transmitter router.")
print("The packet interarrival and departure times are exponentially distributed. ")
ARRIVAL_RATE = float(input("Enter an arrival rate: ")) #packets/time interval
DEPARTURE_RATE = float(input("Enter a departure rate: "))
SIMULATION_LENGTH = 100000
GEL = []
buffer = [] #unlimited buffer space if needed.
class Event :
def __init__(self, event_type, current_time):
self.event_type = event_type
self.time_interval = np.random.exponential(1/ARRIVAL_RATE) if event_type == 'a' \
else np.random.exponential(1/DEPARTURE_RATE)
self.event_time = current_time + self.time_interval
if __name__ == "__main__":
#variables used to calculate statistics
current_time = 0.0
check_time= 0.0 #for debugging
buffer_size = 0
packet_loss = 0
server_not_busy_time= 0.0
last_packet_departs = 0.0
first_packet_arrives = 0.0
total_queue_length = 0.0
#first arrival event
GEL.append(Event('a', current_time))
GEL.sort(key=lambda x: x.event_time, reverse=True)
# runtime = simulation_length * sort_time
# about n squared log n.
for i in range(SIMULATION_LENGTH):
current_event = GEL.pop()
current_time = current_event.event_time
if(current_event.event_type == 'a'):
GEL.insert(0, Event('a', current_time)) #make another arrival event
if(len(buffer) <= 0):
GEL.append(Event('d', current_time))
buffer.insert(0, 'packet' + str(i))
buffer_size += 1
first_packet_arrives = current_time
server_not_busy_time += first_packet_arrives - last_packet_departs
elif(len(buffer) < MAXBUFFER):
buffer.insert(0, 'packet' + str(i))
buffer_size +=1
else:
packet_loss +=1
#buffer is full, do nothing
elif(current_event.event_type == 'd'):
buffer_size -= 1
if(len(buffer)> 0):
buffer.pop()
#If buffer is still not empty
if(len(buffer)> 0):
GEL.append(Event('d', current_time))
else:
#buffer has no packets, and so the
#server is not busy
last_packet_departs = current_time
total_queue_length += buffer_size
#sort GEL by event_time
GEL.sort(key=lambda x: x.event_time, reverse=True)
server_busy_time = current_time - server_not_busy_time
print("Total time of simulation: ", current_time)
print("Average Queue Length: ", total_queue_length/current_time)
print("Packets Lost: ", packet_loss)
print("Proportion of time server is busy: ",server_busy_time/current_time)
"""
Note:
The way I calculated server busy time is to accumulate the time
the server was not busy. The time the server is not busy is
the time between the LAST_PACKET_DEPARTS and the FIRST_PACKET_ARRIVES.
server_busy_time = total_time - server_not_busy_time.
Also total_queue_length is divided by SIMULATION_LENGTH instead of current_time,
this will give equal weight to all of the different lengths accross time instead
of having to weight the differnent based on how much simulation time they existed in.
"""
| [
"ammonbhatti@yahoo.com"
] | ammonbhatti@yahoo.com |
1e48170f4f5611be124d9632c10234f2c1057af2 | db42c2f2dece64a7f28da5e142f9dfb78adbee68 | /DeepFool/NetworkTesting_Data.py | 61ee4f7e81b632e7b56002d5566e51e8a8312959 | [
"MIT"
] | permissive | shayan-taheri/AEG_Pix2Pix | 837b234602da6b04badc47120ac6271c1ea0b912 | 35f2f7c72bb25b371951477702b683fdaa1dfa27 | refs/heads/master | 2022-08-29T22:48:33.309536 | 2020-05-22T13:07:59 | 2020-05-22T13:07:59 | 266,110,804 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 17,722 | py | import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from timeit import default_timer
import tensorflow as tf
import cv2
import glob
from attacks import fgm, jsma, deepfool, cw
img_size = 128
img_chan = 3
n_classes = 2
batch_size = 1
class Timer(object):
def __init__(self, msg='Starting.....', timer=default_timer, factor=1,
fmt="------- elapsed {:.4f}s --------"):
self.timer = timer
self.factor = factor
self.fmt = fmt
self.end = None
self.msg = msg
def __call__(self):
"""
Return the current time
"""
return self.timer()
def __enter__(self):
"""
Set the start time
"""
print(self.msg)
self.start = self()
return self
def __exit__(self, exc_type, exc_value, exc_traceback):
"""
Set the end time
"""
self.end = self()
print(str(self))
def __repr__(self):
return self.fmt.format(self.elapsed)
@property
def elapsed(self):
if self.end is None:
# if elapsed is called in the context manager scope
return (self() - self.start) * self.factor
else:
# if elapsed is called out of the context manager scope
return (self.end - self.start) * self.factor
print('\nLoading Dataset')
X_train = []
y_train = []
for dir in glob.glob('/home/shayan/Dataset/Botnet/Train/*'):
for image in glob.glob(dir + '/*'):
im = cv2.imread(image)
X_train.append(im)
y_train.append(0)
for dir in glob.glob('/home/shayan/Dataset/Normal/Train/*'):
for image in glob.glob(dir + '/*'):
im = cv2.imread(image)
X_train.append(im)
y_train.append(1)
X_test = []
y_test = []
for dir in glob.glob('/home/shayan/Dataset/Botnet/Test/*'):
for image in glob.glob(dir + '/*'):
im = cv2.imread(image)
X_test.append(im)
y_test.append(0)
for dir in glob.glob('/home/shayan/Dataset/Normal/Test/*'):
for image in glob.glob(dir + '/*'):
im = cv2.imread(image)
X_test.append(im)
y_test.append(1)
X_test = np.array(X_test)
X_train = np.reshape(X_train, [-1, img_size, img_size, img_chan])
X_train = X_train.astype(np.float32) / 255
X_test = np.reshape(X_test, [-1, img_size, img_size, img_chan])
X_test = X_test.astype(np.float32) / 255
to_categorical = tf.keras.utils.to_categorical
y_train = to_categorical(y_train)
y_test = to_categorical(y_test)
file = open('/home/shayan/Adv_Dataset/TestingIndices.txt', 'r')
idx_test = file.read()
file.close()
import re
idx_test_str = re.findall('\d+', idx_test)
idx_test_int = []
for iy in range(0,len(idx_test_str)):
idx_test_int.append(int(idx_test_str[iy]))
X_test_BAK = X_test
Y_test_BAK = y_test
for iy in range(0,len(idx_test_int)):
iz = idx_test_int[iy]
X_test[iy] = X_test_BAK[iz]
y_test[iy] = Y_test_BAK[iz]
print(X_test.shape)
print(y_test.shape)
X_test = X_test[0:10000]
y_test = y_test[0:10000]
print(X_test.shape)
print(y_test.shape)
print('\nConstruction graph')
def model(x, logits=False, training=False):
with tf.variable_scope('conv0'):
z = tf.layers.conv2d(x, filters=32, kernel_size=[3, 3],
padding='same', activation=tf.nn.relu)
z = tf.layers.max_pooling2d(z, pool_size=[2, 2], strides=2)
with tf.variable_scope('conv1'):
z = tf.layers.conv2d(z, filters=64, kernel_size=[3, 3],
padding='same', activation=tf.nn.relu)
z = tf.layers.max_pooling2d(z, pool_size=[2, 2], strides=2)
with tf.variable_scope('flatten'):
shape = z.get_shape().as_list()
z = tf.reshape(z, [-1, np.prod(shape[1:])])
with tf.variable_scope('mlp'):
z = tf.layers.dense(z, units=128, activation=tf.nn.relu)
z = tf.layers.dropout(z, rate=0.25, training=training)
logits_ = tf.layers.dense(z, units=2, name='logits')
y = tf.nn.softmax(logits_, name='ybar')
if logits:
return y, logits_
return y
class Dummy:
pass
env = Dummy()
with tf.variable_scope('model'):
env.x = tf.placeholder(tf.float32, (None, img_size, img_size, img_chan),
name='x')
env.y = tf.placeholder(tf.float32, (None, n_classes), name='y')
env.training = tf.placeholder_with_default(False, (), name='mode')
env.ybar, logits = model(env.x, logits=True, training=env.training)
with tf.variable_scope('acc'):
count = tf.equal(tf.argmax(env.y, axis=1), tf.argmax(env.ybar, axis=1))
env.acc = tf.reduce_mean(tf.cast(count, tf.float32), name='acc')
with tf.variable_scope('loss'):
xent = tf.nn.softmax_cross_entropy_with_logits(labels=env.y,
logits=logits)
env.loss = tf.reduce_mean(xent, name='loss')
with tf.variable_scope('train_op'):
optimizer = tf.train.AdamOptimizer()
vs = tf.global_variables()
env.train_op = optimizer.minimize(env.loss, var_list=vs)
env.saver = tf.train.Saver()
with tf.variable_scope('model', reuse=tf.AUTO_REUSE):
env.x_fixed = tf.placeholder(
tf.float32, (batch_size, img_size, img_size, img_chan),
name='x_fixed')
env.adv_eps = tf.placeholder(tf.float32, (), name='adv_eps')
env.adv_epochs = tf.placeholder(tf.int32, (), name='adv_epochs')
env.adv_y = tf.placeholder(tf.int32, (), name='adv_y')
env.x_fgsm = fgm(model, env.x, epochs=env.adv_epochs, eps=env.adv_eps)
env.x_deepfool = deepfool(model, env.x, epochs=env.adv_epochs, batch=True)
env.x_jsma = jsma(model, env.x, env.adv_y, eps=env.adv_eps,
epochs=env.adv_epochs)
env.cw_train_op, env.x_cw, env.cw_noise = cw(model, env.x_fixed,
y=env.adv_y, eps=env.adv_eps,
optimizer=optimizer)
print('\nInitializing graph')
sess = tf.InteractiveSession()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
def evaluate(sess, env, X_data, y_data, batch_size=128):
"""
Evaluate TF model by running env.loss and env.acc.
"""
print('\nEvaluating')
n_sample = X_data.shape[0]
n_batch = int((n_sample+batch_size-1) / batch_size)
loss, acc = 0, 0
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
cnt = end - start
batch_loss, batch_acc = sess.run(
[env.loss, env.acc],
feed_dict={env.x: X_data[start:end],
env.y: y_data[start:end]})
loss += batch_loss * cnt
acc += batch_acc * cnt
loss /= n_sample
acc /= n_sample
print(' loss: {0:.4f} acc: {1:.4f}'.format(loss, acc))
return loss, acc
def train(sess, env, X_data, y_data, X_valid=None, y_valid=None, epochs=1,
load=False, shuffle=True, batch_size=128, name='model'):
"""
Train a TF model by running env.train_op.
"""
if load:
if not hasattr(env, 'saver'):
print('\nError: cannot find saver op')
return
print('\nLoading saved model')
return env.saver.restore(sess, 'model/{}'.format(name))
print('\nTrain model')
n_sample = X_data.shape[0]
n_batch = int((n_sample+batch_size-1) / batch_size)
for epoch in range(epochs):
print('\nEpoch {0}/{1}'.format(epoch + 1, epochs))
if shuffle:
print('\nShuffling data')
ind = np.arange(n_sample)
np.random.shuffle(ind)
print(ind)
X_data = X_data[ind]
y_data = y_data[ind]
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
sess.run(env.train_op, feed_dict={env.x: X_data[start:end],
env.y: y_data[start:end],
env.training: True})
if X_valid is not None:
evaluate(sess, env, X_valid, y_valid)
if hasattr(env, 'saver'):
print('\n Saving model')
env.saver.save(sess, 'model/{}'.format(name))
def predict(sess, env, X_data, batch_size=128):
"""
Do inference by running env.ybar.
"""
print('\nPredicting')
n_classes = env.ybar.get_shape().as_list()[1]
n_sample = X_data.shape[0]
n_batch = int((n_sample+batch_size-1) / batch_size)
yval = np.empty((n_sample, n_classes))
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
y_batch = sess.run(env.ybar, feed_dict={env.x: X_data[start:end]})
yval[start:end] = y_batch
print()
return yval
def make_fgsm(sess, env, X_data, epochs=1, eps=10, batch_size=128):
print('\nMaking adversarials via FGSM')
n_sample = X_data.shape[0]
n_batch = int((n_sample + batch_size - 1) / batch_size)
X_adv = np.empty_like(X_data)
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
feed_dict = {env.x: X_data[start:end], env.adv_eps: eps,
env.adv_epochs: epochs}
adv = sess.run(env.x_fgsm, feed_dict=feed_dict)
X_adv[start:end] = adv
print()
return X_adv
def make_jsma(sess, env, X_data, epochs=1, eps=0.001, batch_size=128):
print('\nMaking adversarials via JSMA')
n_sample = X_data.shape[0]
n_batch = int((n_sample + batch_size - 1) / batch_size)
X_adv = np.empty_like(X_data)
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
feed_dict = {
env.x: X_data[start:end],
env.adv_y: np.random.choice(n_classes),
env.adv_epochs: epochs,
env.adv_eps: eps}
adv = sess.run(env.x_jsma, feed_dict=feed_dict)
X_adv[start:end] = adv
print()
return X_adv
def make_deepfool(sess, env, X_data, epochs=1, eps=10, batch_size=128):
print('\nMaking adversarials via DeepFool')
n_sample = X_data.shape[0]
n_batch = int((n_sample + batch_size - 1) / batch_size)
X_adv = np.empty_like(X_data)
for batch in range(n_batch):
print(' batch {0}/{1}'.format(batch + 1, n_batch))
start = batch * batch_size
end = min(n_sample, start + batch_size)
feed_dict = {env.x: X_data[start:end], env.adv_epochs: epochs}
adv = sess.run(env.x_deepfool, feed_dict=feed_dict)
X_adv[start:end] = adv
print()
return X_adv
def make_cw(sess, env, X_data, epochs=1, eps=10, batch_size=1):
"""
Generate adversarial via CW100 optimization.
"""
print('\nMaking adversarials via CW')
n_sample = X_data.shape[0]
n_batch = int((n_sample + batch_size - 1) / batch_size)
X_adv = np.empty_like(X_data)
for batch in range(n_batch):
with Timer('Batch {0}/{1} '.format(batch + 1, n_batch)):
end = min(n_sample, (batch+1) * batch_size)
start = end - batch_size
feed_dict = {
env.x_fixed: X_data[start:end],
env.adv_eps: eps,
env.adv_y: np.random.choice(n_classes)}
# reset the noise before every iteration
sess.run(env.cw_noise.initializer)
for epoch in range(epochs):
sess.run(env.cw_train_op, feed_dict=feed_dict)
xadv = sess.run(env.x_cw, feed_dict=feed_dict)
X_adv[start:end] = xadv
return X_adv
print('\nTraining')
train(sess, env, X_train, y_train, load=True, epochs=5,
name='BotnetData')
'''
for i in range(6413,6414):
xorg_ini, y0_ini = X_test[i], y_test[i]
xorg = np.expand_dims(xorg_ini, axis=0)
y0 = np.expand_dims(y0_ini, axis=0)
xadvs_0 = make_fgsm(sess, env, xorg, eps=0.1, epochs=1)
xadvs_1 = make_jsma(sess, env, xorg, eps=5, epochs=1)
xadvs_2 = make_deepfool(sess, env, xorg, eps=5, epochs=1)
xadvs_3 = make_cw(sess, env, xorg, eps=100, epochs=1)
print('\nEvaluating on Single FGSM adversarial data')
fgsm_loss, fgsm_acc = evaluate(sess, env, xadvs_0, y0)
print('\nEvaluating on Single JSMA adversarial data')
jsma_loss, jsma_acc = evaluate(sess, env, xadvs_1, y0)
print('\nEvaluating on Single DeepFool adversarial data')
deep_loss, deep_acc = evaluate(sess, env, xadvs_2, y0)
print('\nEvaluating on Single CW adversarial data')
cw_loss, cw_acc = evaluate(sess, env, xadvs_3, y0)
y0 = y0_ini
xorg = np.squeeze(xorg, axis=0)
xadvs_0 = [xorg] + xadvs_0
xadvs_1 = [xorg] + xadvs_1
xadvs_2 = [xorg] + xadvs_2
xadvs_3 = [xorg] + xadvs_3
xadvs_0 = np.squeeze(xadvs_0)
xadvs_1 = np.squeeze(xadvs_1)
xadvs_2 = np.squeeze(xadvs_2)
xadvs_3 = np.squeeze(xadvs_3)
# FGSM Attack
if fgsm_acc <= 0.20:
fig = plt.figure()
plt.imshow(xadvs_0)
plt.imsave('/home/shayan/Adv_Dataset/Test/FGSM/Fooling_Data/xadvs_' + str(i) + '_fgsm_' + '_' + str(fgsm_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_0)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/FGSM/Fooling_Clean_Data/xadvs_' + str(i) + '_fgsm_' + '_' + str(fgsm_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
else:
fig = plt.figure()
plt.imshow(xadvs_0)
plt.imsave('/home/shayan/Adv_Dataset/Test/FGSM/Unfooling_Data/xadvs_' + str(i) + '_fgsm_' + '_' + str(fgsm_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_0)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/FGSM/Unfooling_Clean_Data/xadvs_' + str(i) + '_fgsm_' + '_' + str(fgsm_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
# JSMA Attack
if jsma_acc <= 0.20:
fig = plt.figure()
plt.imshow(xadvs_1)
plt.imsave('/home/shayan/Adv_Dataset/Test/JSMA/Fooling_Data/xadvs_' + str(i) + '_jsma_' + '_' + str(jsma_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_1)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/JSMA/Fooling_Clean_Data/xadvs_' + str(i) + '_jsma_' + '_' + str(jsma_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
else:
fig = plt.figure()
plt.imshow(xadvs_1)
plt.imsave('/home/shayan/Adv_Dataset/Test/JSMA/Unfooling_Data/xadvs_' + str(i) + '_jsma_' + '_' + str(jsma_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_1)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/JSMA/Unfooling_Clean_Data/xadvs_' + str(i) + '_jsma_' + '_' + str(jsma_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
# DeepFool Attack
if deep_acc <= 0.20:
fig = plt.figure()
plt.imshow(xadvs_2)
plt.imsave('/home/shayan/Adv_Dataset/Test/DeepFool/Fooling_Data/xadvs_' + str(i) + '_deepfool_' + '_' + str(deep_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_2)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/DeepFool/Fooling_Clean_Data/xadvs_' + str(i) + '_deepfool_' + '_' + str(deep_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
else:
fig = plt.figure()
plt.imshow(xadvs_2)
plt.imsave('/home/shayan/Adv_Dataset/Test/DeepFool/Unfooling_Data/xadvs_' + str(i) + '_deepfool_' + '_' + str(deep_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_2)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/DeepFool/Unfooling_Clean_Data/xadvs_' + str(i) + '_deepfool_' + '_' + str(deep_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
# CW Attack
if cw_acc <= 0.20:
fig = plt.figure()
plt.imshow(xadvs_3)
plt.imsave('/home/shayan/Adv_Dataset/Test/CW/Fooling_Data/xadvs_' + str(i) + '_cw_' + '_' + str(cw_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_3)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/CW//Fooling_Clean_Data/xadvs_' + str(i) + '_cw_' + '_' + str(cw_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
plt.close(fig)
else:
fig = plt.figure()
plt.imshow(xadvs_3)
plt.imsave('/home/shayan/Adv_Dataset/Test/CW/Unfooling_Data/xadvs_' + str(i) + '_cw_' + '_' + str(cw_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xadvs_3)
plt.close(fig)
fig = plt.figure()
plt.imshow(xorg)
plt.imsave('/home/shayan/Adv_Dataset/Test/CW/Unfooling_Clean_Data/xadvs_' + str(i) + '_cw_' + '_' + str(cw_acc) + '_[' + str((int(y0[0])*0+int(y0[1])*1)) + '].png',xorg)
''' | [
"noreply@github.com"
] | shayan-taheri.noreply@github.com |
e8be59aff00078395d41f92fd5d00c1c5ef4e3d8 | a212966dea7d46003f1f206b5f516c01f53b0a53 | /project_extra_hours/models/__init__.py | 82718110f608093ed0426d1adc05d889450f2002 | [] | no_license | vertelab/odoo-project | 34b87836fdfdf4f22542ad5b183aa2f243c282b9 | 44a9014c8654b0be728709a8cc74395322b92e0c | refs/heads/14.0 | 2023-09-04T18:30:26.983462 | 2023-08-28T09:18:06 | 2023-08-28T09:18:06 | 173,753,071 | 1 | 2 | null | 2022-05-27T13:46:57 | 2019-03-04T13:46:54 | Python | UTF-8 | Python | false | false | 65 | py | from . import sale_order
from . import sale_make_invoice_advance
| [
"miracleaayodele@gmail.com"
] | miracleaayodele@gmail.com |
32753e6d356636f26cfc41bbc4e452b0ecaf105d | d6ca0c16ae7121ac0270a4ba557536d4139a1b0a | /bot4binance/bot4binance.py | c8e77e4c7fce1921ca1c573cf3cb5dfddf55479d | [] | no_license | SunPrime/Learn_Python | 0fafd8fa4456d514ae88db5cf7f21508f67880ac | c748b86d356f485cbcba36642c903ca08926ff3b | refs/heads/master | 2021-04-15T03:33:19.081653 | 2018-07-04T09:27:05 | 2018-07-04T09:27:05 | 126,723,569 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 660 | py | from bot4binance import settings
import datetime
from binance import Client
client = Client(settings.APIKEY, settings.SECRET)
trades = client.get_my_trades(symbol='IOTABTC')
for trade in trades:
etime = int(trade['time']) / 1000
tradetime = datetime.datetime.fromtimestamp(etime)
print("Time: {} | Price: {} | Quantity: {} | Commission: {}".format(
str(tradetime),
trade['price'],
trade['qty'],
trade['commission'])) | [
"sunprime@ukr.net"
] | sunprime@ukr.net |
2441b08427902e054db8f0ef2f129dd4cdf6e2dc | 3197f836378eef946390247d58728598d7e485d7 | /python/pe-017.py | 406302c00e075567d8a9b34d74878302a7fe7389 | [] | no_license | charles-uno/project-euler | 0eab93ebc58489715ecfcad5f26b513827d12f63 | 1981898bdab6df0694c8e8a0cb4d9d579dc114c8 | refs/heads/master | 2020-03-09T00:03:17.388243 | 2018-11-27T04:06:21 | 2018-11-27T04:06:21 | 128,479,047 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,822 | py | #!/usr/bin/env python3
"""
Charles McEachern
2018-11-26
https://projecteuler.net/problem=17
"""
# ######################################################################
UNITS = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
}
TENS = {
0: '',
1: 'ten',
2: 'twenty',
3: 'thirty',
4: 'forty',
5: 'fifty',
6: 'sixty',
7: 'seventy',
8: 'eighty',
9: 'ninety',
}
TEENS = {
11: 'eleven',
12: 'twelve',
13: 'thirteen',
14: 'fourteen',
15: 'fifteen',
16: 'sixteen',
17: 'seventeen',
18: 'eighteen',
19: 'nineteen',
}
# ----------------------------------------------------------------------
def _spell_number(n):
if n > 1999 or n < 0 or not isinstance(n, int):
raise ValueError('Need positive integer less than 2000')
if n >= 1000:
return 'one thousand ' + spell_number(n - 1000)
elif n >= 100:
return UNITS[n//100] + ' hundred and ' + spell_number(n % 100)
elif 10 < n < 20:
return TEENS[n]
else:
return TENS[n//10] + '-' + UNITS[n%10]
# ----------------------------------------------------------------------
def spell_number(n):
# Clean up dangling punctuation.
sn = _spell_number(n).replace('-zero', '').strip(' -')
if sn.endswith(' and'):
sn = sn.replace(' and', '')
return sn
# ----------------------------------------------------------------------
def main():
tally = 0
for i in range(1, 1001):
print(i, ':', spell_number(i))
tally += len(spell_number(i).replace(' ', '').replace('-', ''))
return print(tally)
# ######################################################################
if __name__ == '__main__':
main()
| [
"charles.a.mceachern@gmail.com"
] | charles.a.mceachern@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.