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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
918a5296584c4fa3192d8debf40cedd8260b4dbd
|
9826c9d5d9e845a06ac33b80133f17eb3782bbdb
|
/0802_bitwise_operator.py
|
fdff963c5c6ed8ea8e96bd277d2d2c629da9220d
|
[] |
no_license
|
sujitdhamale/Python
|
0a33ec12fab88df3659e311ff606d79803249828
|
644ea529ed87b0fa4048157f79bfe18a2c156a0e
|
refs/heads/master
| 2020-03-20T04:51:59.508929
| 2019-01-24T14:13:19
| 2019-01-24T14:13:19
| 137,197,180
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 767
|
py
|
#!/usr/bin/python
#0802_bitwise_operator.py by Sujit Dhamale
#to Understanding 0802_bitwise_operator
def main():
print(5)
print(0b0101)
b(5)
x,y=0x55,0xaa
print("X==",end=" ")
b(x)
print("Y==",end=" ")
b(y)
#OR operator
print("\n#OR operator")
b(x | y)
#AND operator
print("\n#AND operator")
b(x & y)
#Exclusive OR operator
print("\n#OR operator")
b(x ^ y)
b(x ^ 0)
b(x ^ 0xff) # All bit's will be filpped
#Shift Operator
print("\n#Shift Operator")
b(x >> 3)
b(x << 3)
def b(n):
print('{:8b}'.format(n)) # {:8b} is format string
if __name__ == "__main__": main()
|
[
"noreply@github.com"
] |
sujitdhamale.noreply@github.com
|
b03e063567ef23cd6b2772608f21a20bde8f8332
|
6b6ab51db088486341ae44ddadae4383492e6f6c
|
/pylib/plots/build_plots.py
|
ce9363175fb45e8ca3aa6b18da29889b01eaf390
|
[] |
no_license
|
SLindberg-intera/new_docs
|
d59ba45bd2666e89d6d358fbc66950488c2663aa
|
f1416d879b84b7424c4ac53ed040ce8a1543c3de
|
refs/heads/master
| 2023-03-10T02:45:52.644535
| 2021-02-23T22:55:30
| 2021-02-23T22:55:30
| 341,708,246
| 0
| 0
| null | 2021-02-23T22:55:30
| 2021-02-23T22:29:57
|
Python
|
UTF-8
|
Python
| false
| false
| 18,300
|
py
|
#plot one model for all cells per graph
#py ../build_plots.py data_tc-99/bccribs-tc-99-bot_yearly_steps.csv plots --single true
#plot all models in directory per graph
#py ../build_plots.py data_tc-99 plots
import sys,os
sys.path.append(
os.path.join(os.path.dirname(__file__), '..','..'))
#from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter,
AutoMinorLocator, FuncFormatter)
from matplotlib.pyplot import cm
import argparse
import datetime as dt
import pandas as pd
import numpy as np
#import constants
from pylib.config.config import read_config
from pylib.autoparse.autoparse import config_parser
#globals
m_200e = {}
#{'afarms':'A Farms','atrenches':'A Trenches','b3abponds':'B-3A/B Ponds',
# 'b3cpond':'B-3C Pond','b3pond':'B-3 Pond','b63':'B-63',
# 'bccribs':'BC Cribs & Trenches','bfarms':'B Farms','bplant':'B Plant',
# 'c-9_pond':'C-9 Pond','mpond':'M Pond','purex':'Purex'}
m_200w = {}
#{'lwcrib':'LW Crib','pfp':'PFP','redox':'Redox','rsp':'Redox Swamp/Pond',
# 'sfarms':'S Farms','salds':'SALDS','tfarms':'T Farms','tplant':'T Plant',
# 'u10':'U-10 West','ufarm':'U Farm','uplant':'U Plant'}
m_pa = {}
#{'wmac_past_leaks':'WMA C Past Leaks','wmac':'WMA C','erdf':'ERDF','idf':'IDF','usecology':'US Ecology'}
colors = {}
#{'afarms':'lime','atrenches':'red','b3abponds':'peru','b3cpond':'steelblue','b3pond':'teal',
# 'b63':'deeppink','bccribs':'deepskyblue','bfarms':'royalblue','bplant':'maroon','c-9_pond':'black',
# 'mpond':'orangered','purex':'fuchsia','lwcrib':'royalblue','pfp':'grey','redox':'navy',
# 'rsp':'maroon','sfarms':'orange','salds':'brown','tfarms':'Peru','tplant':'red',
# 'u10':'deeppink','ufarm':'aqua','uplant':'green','wmac_past_leaks':'red','wmac':'orange','erdf':'purple','idf':'blue','usecology':'green'}
copcs_chems = []
#['cn','cr','no3','u']
copcs_rads = []
#['h-3','i-129','sr-90','tc-99']
copcs = {}
#{'cn':'CN','cr':'CR','no3':'NO3','u':'Total U','h-3':'H-3',
# 'i-129':'I-129','sr-90':'SR-90','tc-99':'TC-99'}
#constants
FORMATTER = mtick.FormatStrFormatter('%.1e')
thisdir = os.path.abspath(os.path.dirname(__file__))
CONFIG_FILE = os.path.join(thisdir, "config.json")
def build_model(args):
file = args.input.rstrip()
out_dir = args.output.rstrip()
head_row = 0
with open(file,"r") as d:
datafile = d.read()
for line in datafile.splitlines():
head_row += 1
if line[0] != "#":
tmp = line.strip().split(",") ##line.strip().replace(" "," ")
if tmp[0].lower() == "time" or tmp[0].lower() == "year":
break
df = pd.read_csv(file,index_col=0,header=head_row-1, skiprows=[head_row+1])
df.rename(str.lower, axis='columns')
columns = df.columns
for col in columns:
temp = col.strip()
if col == "year":
df.rename(index=str,columns={"year":"time"})
elif "-" not in col and 'time' != col:
df.drop([col],axis=1, inplace=True)
elif "modflow_" in col:
temp = col.replace("modflow_","")
df.rename(index=str,columns={col:temp})
model_name = get_model(file)
copc,unit =get_copc(file)
if not np.isreal(df.index[0]):
df = df.iloc[1:]
df.fillna(0)
df = df.astype('float64')
df.to_csv(os.path.join(out_dir,r'{}_{}_all_cells_units_{}.csv'.format(model_name,copc,unit)), header=True)
return df, model_name, copc,unit
def build_data(args):
dir = args.input.rstrip()
out_dir = args.output.rstrip()
files = []
identifier = 0
#data = pd.DataFrame(columns=['time'])
#data = data.set_index('time')
data = {}
pa_data = pd.DataFrame(columns=['time'])
pa_data = pa_data.set_index('time')
models = {}#pd.DataFrame(columns=['time'])
pa_mdoels = {}
#models = models.set_index('time')
for filename in os.listdir(dir):
size = 0
if filename.endswith(".csv"):
dir_file = os.path.join(dir,filename)
head_row = -1
with open(dir_file,"r") as d:
datafile = d.read()
for line in datafile.splitlines():
head_row += 1
if line[0] != "#":
tmp = line.strip().split(",") ##line.strip().replace(" "," ")
if tmp[0].lower() == "time" or tmp[0].lower() == "year":
break
df = pd.read_csv(dir_file,index_col=0,header=head_row, skiprows=[head_row+2])
df.rename(str.lower, axis='columns')
columns = df.columns
for col in columns:
temp = col.strip()
if col == "year":
df.rename(index=str,columns={"year":"time"})
elif "-" not in col and 'time' != col:
df.drop([col],axis=1, inplace=True)
elif "modflow_" in col:
temp = col.replace("modflow_","")
df.rename(index=str,columns={col:temp})
if not np.isreal(df.index[0]):
df = df.iloc[1:]
df.fillna(0)
df = df.astype('float64')
df.index = df.index.astype('int')
model_name = get_model(filename)
copc, unit =get_copc(filename)
if copc in data.keys():
t_data = data[copc]
else:
t_data = pd.DataFrame(columns=['time'])
t_data = t_data.set_index('time')
if model_name != None and copc != None:
print('processing file: {} ({}, {})'.format(filename,model_name, copc))
cols = list(df.columns)
sf = df[cols].sum(axis=1)
df = pd.DataFrame({"time":sf.index, model_name:sf.values})
df = df.set_index('time')
data[copc] = pd.concat([t_data,df],axis=1,sort=False)
if model_name in models.keys():
if copc in models[model_name].keys():
df = pd.concat([models[model_name][copc]['rate'],df],axis=1,sort=False)
df.fillna(0)
# convert all cells from string to float
df = df.astype('float64')
# change negative numbers to 0
df[df < 0] = 0
#Sum together any duplicate columns
df = df.groupby(lambda x:x, axis=1).sum()
models[model_name][copc]['rate'] = df
else:
models[model_name][copc] = {'rate':df}
else:
models[model_name] = {copc:{'rate':df}}
models[model_name][copc]['cum'] = models[model_name][copc]['rate'].cumsum()
else:
print("skipping {}, model: {}, copc: {}".format(filename,model_name,copc))
#change all NaN to 0
for copc in data.keys():
t_data = data[copc]
t_data.fillna(0)
# convert all cells from string to float
t_data = t_data.astype('float64')
# change negative numbers to 0
t_data[t_data < 0] = 0
#Sum together any duplicate columns
t_data = t_data.groupby(lambda x:x, axis=1).sum()
t_data.to_csv(os.path.join(out_dir,r'all_models_{}_units_{}.csv'.format(copc,unit)), header=True)
return models
def get_model(file):
for mdl in m_200e.keys():
if mdl in file.lower():
return mdl
for mdl in m_200w.keys():
if mdl in file.lower():
return mdl
for mdl in m_pa.keys():
if mdl in file.lower():
#if wmac check to make sure its not wmac past leaks
if mdl.lower != 'wmac':
return mdl
elif 'leak' not in file.lower():
return mdl
def get_copc(file):
str1 = '-{}-'
str2 = '_{}_'
for copc in copcs_rads:
if str1.format(copc) in file.lower() or str2.format(copc) in file.lower():
return copc,'pci'
for copc in copcs_chems:
if str1.format(copc) in file.lower() or str2.format(copc) in file.lower():
return copc,'ug'
return None,None
def plot_model(args,data,model,copc,units):
path = args.output.rstrip()
matplotlib.rcParams['axes.formatter.useoffset'] = False
name = ''
if model in m_200e.keys():
name = m_200e[model]
else:
name = m_200w[model]
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
n= data.columns.size
colors = iter(cm.rainbow(np.linspace(0,1,n)))
unit = []
for cell in data.columns.values:
c = next(colors)
unit, values = unit_conversion(units,data[cell].values)
ax.plot(data.index.values.astype('int'), values, color=c, label=cell, linewidth=.75)
ax.set_ylabel("Rate ({})".format(unit[0]))
ax.set_xlabel("Calendar Year")
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
box.width, box.height * 0.9])
# Put a legend below current axis
ax.legend(loc='upper center', fontsize=6, bbox_to_anchor=(0.5, -0.05),
fancybox=True, shadow=True, ncol=5)
ax.yaxis.set_major_formatter(FORMATTER)
ax.set_yscale('log')
#ax.xaxis.set_minor_locator(AutoMinorLocator())
ax.set_title('{} Rates by cell {}'.format(copc.lstrip('_'),name))
plt.savefig(os.path.join(path, "{}_flux_{}".format(copc.lstrip('_'),name)),bbox_inches='tight',dpi=1200)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
colors = iter(cm.rainbow(np.linspace(0,1,n)))
for cell in data.columns.values:
c = next(colors)
unit, values = unit_conversion(units, data[cell].cumsum().values)
ax.plot(data.index.values.astype('int'), values, color=c, label=cell, linewidth=.75)
ax.set_ylabel("Rate ({})".format(unit[0]))
ax.set_xlabel("Calendar Year")
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
box.width, box.height * 0.9])
# Put a legend below current axis
ax.legend(loc='upper center', fontsize=6, bbox_to_anchor=(0.5, -0.05),
fancybox=True, shadow=True, ncol=5)
ax.yaxis.set_major_formatter(FORMATTER)
ax.set_yscale('log')
#ax.xaxis.set_minor_locator(AutoMinorLocator())
ax.set_title('{} Cumulative by cell {}'.format(copc.lstrip('_'),name))
plt.savefig(os.path.join(path, "{}_cum_{}".format(copc.lstrip('_'),name)),bbox_inches='tight',dpi=1200)
def build_plots(args,models,zone,name,copc,units):
path = args.output.rstrip()
start_year = int(args.startyear)
end_year = int(args.endyear)
matplotlib.rcParams['axes.formatter.useoffset'] = False
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
keys = models.keys()
found = False
time = []
for mdl in zone.keys():
if mdl in keys:
if copc in models[mdl].keys():
df = models[mdl][copc]['rate']
if start_year != -1 and end_year != -1:
df = df.loc[start_year:end_year]
if np.any(df > 0):
unit, values = unit_conversion(units,df)
time = df.index.values.astype('int')
#time = range(int(models[mdl][copc]['rate'].index.values[0]),int(models[mdl][copc]['rate'].index.values[-1])+1,1)
lbl = zone[mdl]
found = True
ax.plot(time, values, color=colors[mdl], label=lbl, linewidth=.75)
#maj_loc = models[mdl][copc]['rate'].index.values.size/5
if found:
ax.set_ylabel("Rate ({})".format(unit[0]))
ax.set_xlabel("Calendar Year")
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
box.width, box.height * 0.9])
# Put a legend below current axis
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
fancybox=True, shadow=True, ncol=5)
ax.set_yscale('log')
start, end = ax.get_xlim()
if start_year == -1:
start_year = start-1
if end_year == -1:
end_year = end+1
ax.xaxis.set_minor_locator(AutoMinorLocator())
ax.set_xlim(start_year,end_year)
ticks = np.arange(start_year, end_year, int(len(time)/1000)*200)
ax.xaxis.set_ticks(ticks)
ax.set_title('{} Rates {}'.format(copcs[copc],name))
plt.savefig(os.path.join(path, "{}_flux_{}".format(copc.lstrip('_'),name)),dpi=1200,bbox_inches='tight')
plt.close()
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
keys = models.keys()
found = False
for mdl in zone.keys():
if mdl in keys:
if copc in models[mdl].keys():
df = models[mdl][copc]['cum']
if start_year != -1 and end_year != -1:
df = df.loc[start_year:end_year]
if np.any(df > 0):
unit, values = unit_conversion(units,df)
time = df.index.values.astype('int')
#time = models[mdl][copc]['cum'].index.values.astype('int')
# unit, values = unit_conversion(units,models[mdl][copc]['cum'].values)
#if np.any(values > 0):
lbl = zone[mdl]
ax.plot(time, values, color=colors[mdl], label=lbl, linewidth=.75)
found = True
if found:
ax.set_ylabel("Rate ({})".format(unit[0]))
ax.set_xlabel("Calendar Year")
#ax.yaxis.set_major_formatter(FORMATTER)
ax.set_yscale('log')
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
box.width, box.height * 0.9])
# Put a legend below current axis
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
fancybox=True, shadow=True, ncol=5)
start, end = ax.get_xlim()
if start_year == -1:
start_year = start-1
if end_year == -1:
end_year = end+1
ax.xaxis.set_minor_locator(AutoMinorLocator())
ax.set_xlim(start_year,end_year)
ticks = np.arange(start_year, end_year, int(len(time)/1000)*200)
ax.xaxis.set_ticks(ticks)
ax.set_title('{} Cumulative {}'.format(copcs[copc],name))
plt.savefig(os.path.join(path, "{}_cum_{}".format(copc.lstrip('_'),name)),bbox_inches='tight',dpi=1200)
else:
plt.close()
def unit_conversion(units,data):
new_unit = ['Ci/year','Ci']
factor = float(1)
if units.lower() == 'pci':
factor = float(1e-12)
elif units.lower() in ['kg','g','ug']:
new_unit = ['kg/year','kg']
if units.lower() == 'g':
factor = float(1e-3)
elif units.lower() == 'ug':
factor = float(1e-9)
return new_unit, data*factor
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
#-------------------------------------------------------------------------------
# main process
def main():
####
# Setup Arguments
#parser = argparse.ArgumentParser()
#parser.add_argument("input", type=str, help="out directory.")
#parser.add_argument("output", type=str, help="out directory.")
#parser.add_argument("-startyear", type=int, default=-1, help="start year of graph")
#parser.add_argument("-endyear", type=int, default=-1, help="end year of graph")
#parser.add_argument("-single", type=str2bool, nargs='?', const=True, default=False, help="Model all cells for single model.")
#parser.add_argument("-config", type=str, default=thisdir, help="alternate configuration file")
#args = parser.parse_args()
config = read_config(CONFIG_FILE)
arg_parcer = lambda : config_parser(config)
args = arg_parcer()
if args.alt_config != "":
if not os.path.isfile(args.alt_config):
if not os.path.isfile(args.alt_config):
print('Invalid inputs: {0} '.format(args.alt_config))
print(' File not found, exiting script.')
return ValueError('Invalid file')
config = read_config(args.alt_config.rstrip())
global m_200e
m_200e = config['m_200e']
global m_200w
m_200w = config['m_200w']
global m_pa
m_pa = config['m_pa']
global colors
colors = config['colors']
global copcs_chems
copcs_chems = config['copcs_chems']
global copcs_rads
copcs_rads = config['copcs_rads']
global copcs
copcs = config['copcs']
#input_dir = args.input.rstrip()
#out_dir = args.output.rstrip()
#end_year = args.endyear
#start_year = args.startyear
#print(input_dir)
#print(out_dir)
#print(start_year)
#print(end_year)
if args.single:
data,model,copc,unit = build_model(args)
data.to_csv(os.path.join(args.output.rstrip(),r'{}_{}_all_cells.csv'.format(model,copc)), header=True)
plot_model(args,data,model,copc,unit)
else:
models = build_data(args)
for copc in copcs_chems:
build_plots(args,models,m_200e,'200 East',copc,'ug')
build_plots(args,models,m_200w,'200 West',copc,'ug')
build_plots(args,models,m_pa,'PAs',copc,'ug')
for copc in copcs_rads:
build_plots(args,models,m_200e,'200 East',copc,'pci')
build_plots(args,models,m_200w,'200 West',copc,'pci')
build_plots(args,models,m_pa,'PAs',copc,'pci')
#-------------------------------------------------------------------------------
# Start main process
if __name__ == "__main__":
#-------------------------------------------------------------------------------
# build globals
cur_date = dt.date.today()
time = dt.datetime.utcnow()
testout = main()
|
[
"NPowers@intera.com"
] |
NPowers@intera.com
|
e3a33681fd5078c3ba18bb441d4a109ec5dd24d3
|
f4505f7bacdce8bcd68f464737f8163e36a56229
|
/src/control/user_input.py
|
258fa5d1b05ef8ce941952fd3b5514e38b824363
|
[] |
no_license
|
jr-/IA
|
c6d3d3dc354534b92a78a8694fec660d237ad997
|
b86550afc3b90850fbc15089f48639b2b1ff9058
|
refs/heads/master
| 2020-03-08T23:53:05.114827
| 2018-04-19T18:07:02
| 2018-04-19T18:07:02
| 128,474,933
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,139
|
py
|
class UserInput(object):
'''
classdocs
'''
def __init__(self, main_window, game):
'''
Constructor
'''
self.main_window = main_window
self.game = game
self.main_window.set_connections(self)
pass
def square_clicked(self):
if self.game.is_over():
return
square = self.main_window.sender()
position = square.get_position()
color = self.game.active_player_color()
if self.game.put_piece_at(position):
self.main_window.put_piece(position, color)
result = self.game.check_game_end()
if result == 'end':
self.main_window.game_over()
return
elif result == 'four':
self.main_window.four_sequence_warning()
self.main_window.change_player_turn(self.game.get_active_player())
self.game.ai_player_move()
def ai_move(self, position):
sq = self.main_window.get_square(position)
sq.clicked.emit()
def new_game(self):
self.game.new_game()
self.main_window.clean()
|
[
"joseluis.ruas@gmail.com"
] |
joseluis.ruas@gmail.com
|
99dcc08e60276709bea058c6ada6d9b57ca4de1c
|
f76c2da4dacf57a2747b99ad6fe455dab3bbd967
|
/5.py
|
13f15808ab94efe8225ba8aa0f536f5b5699563b
|
[] |
no_license
|
inomad15/python
|
ccbcb904520633f00acbe287865e73fe2021021f
|
544168864f268c44051fbd82d285ad4da83ddb43
|
refs/heads/master
| 2021-01-10T09:43:00.730250
| 2015-12-29T00:28:51
| 2015-12-29T00:28:51
| 48,351,626
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 99
|
py
|
# coding=utf-8
with open("foo.txt", 'w') as f:
f.write('Life is too short, you need python.')
|
[
"dentchb@gmail.com"
] |
dentchb@gmail.com
|
7b1fa8f71dd4bc5286151a743f2168f08d758de1
|
0d70e49189a95454ef22f1a21cbac02899e8accd
|
/EnvVirtuel/Scripts/pip-script.py
|
72d95e6c663f12cd63edcd93346aae38fdc23d0a
|
[] |
no_license
|
EmilieM71/Projet-5-startup-Pur-Beurre
|
dd6ab2267333521a439b1cc8fdd0e9fa64487449
|
105e7080adfb14fb69b9b404cfda6621d5b7e8ec
|
refs/heads/master
| 2021-07-19T09:18:35.434100
| 2019-10-22T10:05:05
| 2019-10-22T10:05:05
| 197,351,182
| 0
| 1
| null | 2020-07-21T17:32:01
| 2019-07-17T08:46:27
|
Python
|
ISO-8859-2
|
Python
| false
| false
| 490
|
py
|
#!"D:\Documents\Openclassrooms\Parcours dévelopeur d'application Python\Projet 5\Projet-5-startup-Pur-Beurre\EnvVirtuel\Scripts\python.exe" -x
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip'
__requires__ = 'pip==10.0.1'
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==10.0.1', 'console_scripts', 'pip')()
)
|
[
"martelemilie@hotmail.fr"
] |
martelemilie@hotmail.fr
|
7e80232ccf3706a2fddcdb23be58d8c1a5c5ad1b
|
fb369693686cbd93799f68bcd0b4fdcf4c65d49a
|
/contrib/data.world/upload.py
|
5b45194a14749608eda5b1764196b1808641b7b5
|
[
"MIT",
"CC-BY-NC-4.0"
] |
permissive
|
opensanctions/opensanctions
|
8a43c173bd9c1422b5ca3e2ec35bcac70f8f1573
|
229b59247e67ad0661abb0a6f7155a61042a32ea
|
refs/heads/main
| 2023-09-03T23:59:34.785846
| 2023-09-03T08:46:14
| 2023-09-03T08:46:14
| 47,451,451
| 155
| 32
|
MIT
| 2023-09-14T05:46:11
| 2015-12-05T10:19:57
|
Python
|
UTF-8
|
Python
| false
| false
| 1,958
|
py
|
# pip install datadotworld requests
from pprint import pprint
import requests
import datadotworld as dw
from datadotworld.client.api import RestApiError
SUMMARY = '''
%(summary)s
See: [%(title)s](%(url)s)
This dataset is part of the [OpenSanctions project](https://opensanctions.org/docs/about)
'''
INDEX_URL = 'https://data.opensanctions.org/datasets/latest/index.json'
USER = 'opensanctions'
client = dw.api_client()
def truncate(text, max_len=110):
if len(text) <= max_len:
return text, ''
prefix = text[:max_len]
prefix, _ = prefix.rsplit(' ', 1)
return prefix + '...', ''
def transfer_dataset(dataset):
key = dataset.get('name').replace('_', '-')
if key in ('all',):
return
try:
client.create_dataset(USER, title=key, visibility='OPEN')
except RestApiError as error:
if error.status != 400:
print(error)
key = "%s/%s" % (USER, key)
pprint(key)
description, summary = truncate(dataset.get('summary'))
url = 'https://opensanctions.org/datasets/%s/' % dataset.get('name')
summary = SUMMARY % {'summary': summary, 'url': url, 'title': dataset.get('title')}
client.update_dataset(key,
title=dataset.get('title'),
description=description,
summary=summary.strip(),
license='CC-BY',
files={},
)
for resource in dataset.get('resources', []):
if resource.get('path') != 'targets.simple.csv':
client.delete_files(key, [resource.get('path')])
continue
# pprint(resource)
client.add_files_via_url(key, {
resource.get('path'): {
'url': resource.get('url'),
'description': resource.get('title')
}
})
def transfer_datasets():
data = requests.get(INDEX_URL).json()
for dataset in data.get('datasets', []):
transfer_dataset(dataset)
if __name__ == '__main__':
transfer_datasets()
|
[
"friedrich@pudo.org"
] |
friedrich@pudo.org
|
f7abe2032d3b3645c4032f58e4d147e9d6598c44
|
a3fbeaaaedd3da71585aca070b7663f932698967
|
/accounts/admin.py
|
a2b173f56d6901b74cd71af35153f0fe4d2e58bc
|
[] |
no_license
|
ananduv2/ems
|
14a22198fc1ff54d492c4c0d243d2a26a6dee9ec
|
97a46cf430a661d39c77c57921dc8d1607be520b
|
refs/heads/master
| 2023-06-06T15:48:33.715510
| 2021-06-25T16:42:01
| 2021-06-25T16:42:01
| 380,233,779
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 120
|
py
|
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.employee)
|
[
"ananduv2.0@gmail.com"
] |
ananduv2.0@gmail.com
|
40f84cd3a6ce30acc6b24b397bbc3df48a94ade4
|
0cdd23fadbac76c4b5e8e3b278053be4549d00bf
|
/AC1LPII/principal.py
|
77a4da0900a0990717d06cc05dfb0a8f6639a470
|
[
"Apache-2.0"
] |
permissive
|
Fittipvldi/impacta_lp_2
|
8b476934175f85319a709cdfe46b008cb3559fb5
|
3d229379bf63c4541805ff9574792daea627cc6c
|
refs/heads/master
| 2023-03-16T04:51:21.257462
| 2021-03-04T22:31:23
| 2021-03-04T22:31:23
| 256,328,195
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,211
|
py
|
from escola import (adicionar_aluno, remover_aluno, pesquisar_aluno,
calcular_media, calcular_media_turma, melhores_alunos)
alunos = {'pedro': [10, 9.5, 9, 5, 7],
'ana': [4, 7, 9.5, 10, 8],
'jose': [10, 4.5, 5, 6, 8]}
listanotas = []
qtdalunos = int(input(" Insira a quantidade de alunos deseja incluir: "))
for i in range(qtdalunos):
nome1 = input("Insira o nome do aluno: ")
for i in range(5):
nota = float(input("Insira a nota do aluno: "))
listanotas.append(nota)
retorna1 = adicionar_aluno(alunos, nome1, listanotas)
listanotas = []
print(retorna1)
nome2 = input("Insira o nome do aluno que deseja excluir: ")
retorna2 = remover_aluno(alunos, nome2)
print(retorna2)
nome3 = input("Insira o nome do aluno no qual deseja ver as notas: ")
retorna3 = pesquisar_aluno(alunos, nome3)
print(retorna3)
nome4 = input("Insira o nome do aluno no qual deseja ver a média das notas: ")
retorna4 = calcular_media(alunos, nome4)
print(f"A média do {nome4} é de {retorna4}")
retorna5 = calcular_media_turma(alunos)
print(f"A média da turma é de {retorna5}")
retorna6 = melhores_alunos(alunos)
print(f"O melhor aluno é: {retorna6}")
|
[
"henrique.gfitti@gmail.com"
] |
henrique.gfitti@gmail.com
|
fa5906c0056ef8086fbc7505a2506b4720dc0676
|
ffed7fe051dafe862dec29d52be8d89806e951d9
|
/gauzlib/util.py
|
1ac22ddc1e4074922f24de0d74136b268e6887f3
|
[] |
no_license
|
league/gauz
|
167d0a8d0c26e4fb04328b44b2c019343bc64e75
|
0d38a5fc810fa01be5c8be1287df0ae8750461f6
|
refs/heads/master
| 2021-03-12T19:42:25.909759
| 2013-10-21T00:41:22
| 2013-10-21T00:41:22
| 608,469
| 1
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,775
|
py
|
# -*- coding: utf-8 -*-
from genshi.builder import tag
from genshi.core import Stream, Markup
from genshi.template import NewTextTemplate
from pygments.formatters import HtmlFormatter
import random
class GauzUtils:
def markupToString(self, value):
if hasattr(value, '__call__'):
value = value()
if hasattr(value, 'next'):
buf = []
for k, v, _ in value:
if Stream.TEXT == k:
buf.append(v)
return ''.join(buf)
return value
def filter(self, assets, year=None, month=None, tag=None, ids=None):
for a in assets:
if ((not year or a.date and a.date.year == year) and
(not month or a.date and a.date.month == month) and
(not tag or tag in a.tags) and
(not ids or a.source in ids)):
yield a
def monthly(self, assets):
first = True
cur = None
for a in assets:
if cur != a.date.month:
br = tag.a(name = a.date.strftime('%m'))
if not first:
br = tag(br, tag.div(class_ = 'archive-break'))
yield br
cur = a.date.month
yield a
first = False
def yearly(self, assets):
first = True
cur = None
for a in assets:
if cur != a.date.year:
br = tag.a(name = str(a.date.year))
if not first:
br = tag(br, tag.div(class_ = 'archive-break'))
yield br
cur = a.date.year
yield a
first = False
def expandText(self, text, page):
tmpl = NewTextTemplate(text)
return tmpl.generate(page.config.makeContext(page))
def jsQuote(self, frag, subst):
r = str(frag).replace('"', '\\"')
r = r.replace('%s', '"+'+subst+'+"')
return '"'+r+'"'
def randomlyPartition(self, chars='abcdefghijklmnopqrstuvwxyz1234567890'):
alpha = [c for c in chars] # must be a list
random.shuffle(alpha) # for shuffle to work
mid = len(alpha)/2
one = alpha[:mid]
two = alpha[mid:]
return ''.join(one), ''.join(two)
def buildObfuscatedString(self, text, valid, ignore):
either = valid + ignore
buf = []
i = 0;
while i < len(text):
if random.randint(0,2): # .33 probability of ignore block
buf.append(random.choice(valid))
buf.append(text[i])
i += 1
else:
buf.append(random.choice(ignore))
buf.append(random.choice(either))
return ''.join(buf)
def obfuscate(self, clearText,
format='<a href="mailto:%s">%s</a>',
noscript='%s',
at = u' § ', dot = u' · '):
humanText = clearText.replace('@', at).replace('.', dot)
valid, ignore = self.randomlyPartition()
obfuText = self.buildObfuscatedString(humanText, valid, ignore)
expr = '"' + obfuText + '"'
expr += '.replace(/([%s](.)|[%s].)/ig,"$2")' % (valid, ignore)
expr += '.replace(/%s/g, "@")' % at
expr += '.replace(/%s/g, ".")' % dot
var = 's%06x' % random.randrange(0x1000000)
format = self.jsQuote(format, var)
t = tag(tag.script('var ', var, ' = ', expr, ';\n',
'document.write(', Markup(format), ');\n',
type='text/javascript'))
if noscript:
t = t(tag.noscript(noscript.replace('%s', humanText)))
return t
def pygmentStyleDefs(self, selector):
return HtmlFormatter().get_style_defs(selector)
|
[
"league@contrapunctus.net"
] |
league@contrapunctus.net
|
4f961ead6cdc2942555f78f1326cb4e396ffce2f
|
538fd58e4f7d0d094fd6c93ba1d23f78a781c270
|
/3_longest_substring_without_repeating_characters/solution.py
|
fada06753176c599106e3882173676106d13cc87
|
[] |
no_license
|
FluffyFu/Leetcode
|
4633e9e91e493dfc01785fd379ab9f0788726ac1
|
5625e6396b746255f3343253c75447ead95879c7
|
refs/heads/master
| 2023-03-21T08:47:51.863360
| 2021-03-06T21:36:43
| 2021-03-06T21:36:43
| 295,880,151
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,358
|
py
|
class Solution:
def len_longest_substring(self, s: str) -> int:
"""
eager storage. current_letters is always accurate.
"""
if not s:
return 0
res = 0
current_letters = set()
left = 0
for right in range(len(s)):
if not s[right] in current_letters:
current_letters.add(s[right])
if len(current_letters) > res:
res = len(current_letters)
else:
while s[left] != s[right]:
current_letters.remove(s[left])
left += 1
left += 1
return res
def len_longest_substring_with_dict(self, s: str) -> int:
"""
lazy storage. need to check with current left point when
retrieving the index.
"""
if not s:
return 0
letters_map = dict()
res = 0
left = 0
for right in range(len(s)):
if not s[right] in letters_map:
letters_map[s[right]] = right
else:
# find the valid left pointer position
left = max(letters_map[s[right]] + 1, left)
letters_map[s[right]] = right
if (right - left) + 1 > res:
res = right - left + 1
return res
|
[
"fluffyfu400@gmail.com"
] |
fluffyfu400@gmail.com
|
f2bfca1099d8c04aed3fdeb88962fa74d4f06be2
|
f794d6040539023bfc276e5e5ff38afc2d9b361c
|
/py-schedule-env/bin/python-config
|
6908b18cffe35a641ff59000d74f5dddbf97e217
|
[] |
no_license
|
LuPan2015/py-schedule
|
78fa2d09573d98441fc3b891abb851dfe42a0955
|
6353a40158b3f7c1437a89bd1d4dc564a3149ed6
|
refs/heads/master
| 2020-03-07T22:32:51.951371
| 2018-04-02T15:39:32
| 2018-04-02T15:39:32
| 127,756,999
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,365
|
#!/Users/pan.lu/study/py-schedule/py-schedule-env/bin/python
import sys
import getopt
import sysconfig
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
'ldflags', 'help']
if sys.version_info >= (3, 2):
valid_opts.insert(-1, 'extension-suffix')
valid_opts.append('abiflags')
if sys.version_info >= (3, 3):
valid_opts.append('configdir')
def exit_with_usage(code=1):
sys.stderr.write("Usage: {0} [{1}]\n".format(
sys.argv[0], '|'.join('--'+opt for opt in valid_opts)))
sys.exit(code)
try:
opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
except getopt.error:
exit_with_usage()
if not opts:
exit_with_usage()
pyver = sysconfig.get_config_var('VERSION')
getvar = sysconfig.get_config_var
opt_flags = [flag for (flag, val) in opts]
if '--help' in opt_flags:
exit_with_usage(code=0)
for opt in opt_flags:
if opt == '--prefix':
print(sysconfig.get_config_var('prefix'))
elif opt == '--exec-prefix':
print(sysconfig.get_config_var('exec_prefix'))
elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude')]
if opt == '--cflags':
flags.extend(getvar('CFLAGS').split())
print(' '.join(flags))
elif opt in ('--libs', '--ldflags'):
abiflags = getattr(sys, 'abiflags', '')
libs = ['-lpython' + pyver + abiflags]
libs += getvar('LIBS').split()
libs += getvar('SYSLIBS').split()
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags':
if not getvar('Py_ENABLE_SHARED'):
libs.insert(0, '-L' + getvar('LIBPL'))
if not getvar('PYTHONFRAMEWORK'):
libs.extend(getvar('LINKFORSHARED').split())
print(' '.join(libs))
elif opt == '--extension-suffix':
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
if ext_suffix is None:
ext_suffix = sysconfig.get_config_var('SO')
print(ext_suffix)
elif opt == '--abiflags':
if not getattr(sys, 'abiflags', None):
exit_with_usage()
print(sys.abiflags)
elif opt == '--configdir':
print(sysconfig.get_config_var('LIBPL'))
|
[
"874325293@qq.com"
] |
874325293@qq.com
|
|
75ec06b3a52ec85497a2c235b210f2af7a5c4864
|
8f37e1fc2b040fa24ccdcd9ef0393dd7620dd270
|
/examples/rgbled_simpletest.py
|
f4cd4ee1bd96a7effeb2c473d849b55db59d6f9c
|
[
"MIT"
] |
permissive
|
siddacious/Adafruit_CircuitPython_RGBLED
|
80b8f672ab454495e593503b5206b660803531cd
|
fc5deb7b7593fd933ad55f58af23b3de88cac696
|
refs/heads/master
| 2020-08-29T17:46:02.163350
| 2019-10-28T20:20:53
| 2019-10-28T20:20:53
| 218,116,028
| 0
| 0
|
MIT
| 2019-10-28T18:20:04
| 2019-10-28T18:20:03
| null |
UTF-8
|
Python
| false
| false
| 1,428
|
py
|
import time
import board
import adafruit_rgbled
# Pin the Red LED is connected to
RED_LED = board.D5
# Pin the Green LED is connected to
GREEN_LED = board.D6
# Pin the Blue LED is connected to
BLUE_LED = board.D7
# Create the RGB LED object
led = adafruit_rgbled.RGBLED(RED_LED, GREEN_LED, BLUE_LED)
# Optionally, you can also create the RGB LED object with inverted PWM
# led = adafruit_rgbled.RGBLED(RED_LED, GREEN_LED, BLUE_LED, invert_pwm=True)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if pos < 0 or pos > 255:
return 0, 0, 0
if pos < 85:
return int(255 - pos * 3), int(pos * 3), 0
if pos < 170:
pos -= 85
return 0, int(255 - pos * 3), int(pos * 3)
pos -= 170
return int(pos * 3), 0, int(255 - (pos * 3))
def rainbow_cycle(wait):
for i in range(255):
i = (i + 1) % 256
led.color = wheel(i)
time.sleep(wait)
while True:
# setting RGB LED color to RGB Tuples (R, G, B)
led.color = (255, 0, 0)
time.sleep(1)
led.color = (0, 255, 0)
time.sleep(1)
led.color = (0, 0, 255)
time.sleep(1)
# setting RGB LED color to 24-bit integer values
led.color = 0xFF0000
time.sleep(1)
led.color = 0x00FF00
time.sleep(1)
led.color = 0x0000FF
time.sleep(1)
# rainbow cycle the RGB LED
rainbow_cycle(0.1)
|
[
"robots199Wme.com"
] |
robots199Wme.com
|
0133d488f60b6ffe7c0085d709f56246fcf1971e
|
e04311a545baa4672f170ee471ed47f67c383d73
|
/AlgorithmsAndPrograms/03_LinkedLists/ReverseSinglyLinkedList.py
|
c43000c2d0ae3d9118dd4d56b8463181b1b5caa2
|
[] |
no_license
|
chetanDN/Python
|
55fa39cd2e15396d0db66f01b08e574bf5387699
|
35a4461b8673e94189199859b4a5776035232629
|
refs/heads/master
| 2021-04-29T11:05:31.963179
| 2019-02-27T08:58:20
| 2019-02-27T08:58:20
| 77,855,793
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 316
|
py
|
from LinkedListNode import *
def reverse_single_ll(self):
last = None
current = self.head
while(current.next != None):
Next
LL1 = LinkedList()
LL1.add_at_end(Node(4))
LL1.add_at_end(Node(5))
LL1.add_at_beg(Node(1))
LL1.add_at_beg(Node(3))
'hello'.split()
print('*'*56)
LL1.print_list()
|
[
"chetandevanaik@gmail.com"
] |
chetandevanaik@gmail.com
|
db8330e7cb6b7b9b93141c8464e53f9c81713f3d
|
305b0f420ca2d1ad055121d89c4da5437a076b15
|
/PaintedLady.py
|
00c59a3614a0627b6a8e940d4c029962d0adf73e
|
[] |
no_license
|
JohnathanShiao/PaintedLady
|
13ac1d685518bca156f6464bf725da859189595d
|
14534e57101389b1c6739beabfb432008ed38d08
|
refs/heads/master
| 2020-04-24T13:41:10.571199
| 2019-02-22T05:01:48
| 2019-02-22T05:01:48
| 171,996,006
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,715
|
py
|
from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse
from pymongo import MongoClient
from argparse import ArgumentParser
import sys
import click
client = MongoClient('localhost:5000')
members = client['member-db']
app = Flask(__name__)
@app.cli.command()
def test():
click.echo('I am test')
@app.cli.command()
@click.argument('name')
def setpass(name):
app.config['passcode'] = name
@app.route("/sms", methods=['GET', 'POST'])
def sms_reply():
resp = MessagingResponse()
if request.method == 'POST':
user = members['NetID']
body = request.form['Body']
date = request.form['date_sent']
split_date = date.split()
date = " ".join(split_date[1:4])
netId = body.split[0]
valid = app.config['passcode'] == body.split[1]
loginUser = user.find_one({'NetID': netId})
if valid and loginUser is None:
usr = {
"NetID": netId,
"Meetings": 1,
"Dates": [date]
}
members.insert_one(usr)
elif valid:
resp = MessagingResponse()
user = client.members.find_one({'NetID': netId})
dates = user["Dates"]
if date in dates:
newMeet = client.members.find({'NetID': netId}, {'Meetings': 1, "_id": 0}) + 1
client.members.update_one({'NetID': netId}, {'Meetings': newMeet}, {'upsert': True})
members.update_one({'NetID': netId}, {'$push': {'Meetings': date}})
resp.message("Your response has been recorded, thank you!")
return str(resp)
if __name__ == "__main__":
app.run(debug=True)
|
[
"michaelchang@nbp-214-53.nbp.ruw.rutgers.edu"
] |
michaelchang@nbp-214-53.nbp.ruw.rutgers.edu
|
0d2394428757f77ddcd462bb472ae359814182c2
|
f52dccb170d2acc6d5b5a63d5eefe44a55416b14
|
/python/fundamentals/functions_intermediate1.py
|
c33e710598e5e6cb16b2af17ea9576a164570778
|
[] |
no_license
|
bcaldwell87/Coding-Dojo-Python
|
95bed6ff023a4a60e7fad3723c91cba36b5677b0
|
395267528eca6a4541bddfb8dd0d4ea29f1d83b2
|
refs/heads/master
| 2020-12-28T11:48:16.206676
| 2020-02-04T22:14:50
| 2020-02-04T22:14:50
| 238,317,986
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 434
|
py
|
import random
def randInt(min=0, max=100):
num = random.random() * (max-min) + min
num * max
return round(num)
print(randInt()) # should print a random integer between 0 to 100
print(randInt(max=50)) # should print a random integer between 0 to 50
print(randInt(min=50)) # should print a random integer between 50 to 100
print(randInt(min=50, max=500)) # should print a random integer between 50 and 500
|
[
"bcaldwell87@gmail.com"
] |
bcaldwell87@gmail.com
|
6991e6abfccbee339dee179693e71b9035d06cf2
|
b8bd2c861f413a59a9460c63b2828e6ae4b8098d
|
/client/python/utils.py
|
c9519cb300838c187633e84b7d4c730c1d57da89
|
[] |
no_license
|
Din-Houn/medianav
|
7509503baf8e50518091bd01d426483e522860e9
|
ea5fe2cc689d05f106fc168ca6eb35de7cd2ccb2
|
refs/heads/master
| 2021-06-01T23:07:39.088664
| 2010-09-20T19:20:41
| 2010-09-20T19:20:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 791
|
py
|
# Part of MediaNav client
# Defines some utility functions
import math
import os
import config
def interp_lin(value1, value2, factor):
""" Interpolates between two values linearly
The return value will be:
value1 if factor is 0
value2 if factor is 1
"""
return value1+(value2-value1)*factor
def interp_log(value1, value2, factor):
""" Interpolates between two values logarithmically
The return value will be:
value1 if factor is 0
value2 if factor is 1
"""
log_factor = math.log(interp_lin(1, 10, factor), 10)
return interp_lin(value1, value2, log_factor)
def play_file(file):
""" Plays a video file, file is the full path and filename """
cmd = config.PLAYER_CMD % (file)
os.system(cmd)
|
[
"AndreFMiller@3ae9964c-60fe-11de-bc6d-35d2ebd5fd4e"
] |
AndreFMiller@3ae9964c-60fe-11de-bc6d-35d2ebd5fd4e
|
acfcbc929564fcd48fd608486554e2ae1e2514f5
|
5e83a5505964323decce2187ac1010b14d7be116
|
/myvenv/Scripts/django-admin.py
|
5eb6733e54446c63d54c499b09fcbdc1bfbc1188
|
[] |
no_license
|
kimseonjae/my-first-blog
|
6cbbd062fa2c597e49cbc6331ccd515253adbed7
|
4fcc3c4d639247d21c9099028287e9184ff92228
|
refs/heads/master
| 2020-03-15T19:24:37.860174
| 2018-05-10T08:25:59
| 2018-05-10T08:25:59
| 132,307,897
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 161
|
py
|
#!c:\users\rlatj\djangogirls\myvenv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
[
"rlatjswowkd@gmail.com"
] |
rlatjswowkd@gmail.com
|
e4258898b0061959e6f95a5e439a7d8635859ee9
|
be011e5d1adbab15cb11e476239074db3ae7f7ca
|
/expdj/apps/result/models.py
|
7790f28ae56cef8444dc79a911cd9afef98d2938
|
[
"MIT"
] |
permissive
|
expfactory/expfactory-docker-dev
|
18d249d62f58dbb68911e15d72d38b691e1400aa
|
a2d9097db3d57a5c5303c2bc281cb4361af25ec4
|
refs/heads/master
| 2021-06-04T18:09:27.810996
| 2016-08-29T01:11:09
| 2016-08-29T01:11:09
| 65,325,038
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,359
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from expdj.apps.result.utils import to_dict, get_time_difference
from django.core.validators import MaxValueValidator, MinValueValidator
from expdj.apps.experiments.models import Experiment, Battery
from expdj.settings import DOMAIN_NAME, BASE_DIR
from django.db.models.signals import pre_init
from django.contrib.auth.models import User
from django.db.models import Q, DO_NOTHING
from django.utils import timezone
from jsonfield import JSONField
from django.db import models
import collections
import datetime
class Worker(models.Model):
id = models.CharField(primary_key=True, max_length=200, null=False, blank=False)
session_count = models.PositiveIntegerField(default=0,help_text=("The number of one hour sessions completed by the worker."))
visit_count = models.PositiveIntegerField(default=0,help_text=("The total number of visits"))
last_visit_time = models.DateTimeField(null=True,blank=True,help_text=("The date and time, in UTC, the Worker last visited"))
experiments_completed = models.ManyToManyField(Experiment,blank=True,related_name="completed_experiments",help_text="List of completed experiments")
def __str__(self):
return "%s" %(self.id)
def flat(self):
'''flat returns a flat representation of a worker (eg, key:value) in text'''
return "[WORKER]\nid:%s\n" %(self.id)
def __unicode__(self):
return "%s" %(self.id)
class Meta:
ordering = ['id']
def get_worker(worker_id,create=True):
'''get a worker
:param create: update or create
:param worker_id: the unique identifier for the worker
'''
# (<Worker: WORKER_ID: experiments[0]>, True)
now = timezone.now()
if create == True:
worker,_ = Worker.objects.update_or_create(id=worker_id)
else:
worker = Worker.objects.filter(id=worker_id)[0]
if worker.last_visit_time != None: # minutes
time_difference = get_time_difference(worker.last_visit_time,now)
# If more than an hour has passed, this is a new session
if time_difference >= 60.0:
worker.session_count +=1
else: # this is the first session
worker.session_count = 1
# Update the last visit time to be now
worker.visit_count +=1
worker.last_visit_time = now
worker.save()
return worker
|
[
"vsochat@stanford.edu"
] |
vsochat@stanford.edu
|
ec6fcbaa6da0a3fcadddf752592e3cb493b8d528
|
390a0492fed610fe66af920dba4761c14d0505ac
|
/app/migrations/0002_auto_20190913_0528.py
|
f43b59e78b4046dcb829bf84c949db2f5a395f98
|
[] |
no_license
|
Asmin75/shop-drf
|
5254e4629c1709938c5e1eb6f224300d7416fca3
|
793d4a22bffca406915a322d39c73b1a70700a1d
|
refs/heads/master
| 2021-06-18T05:53:12.065612
| 2019-09-26T05:15:58
| 2019-09-26T05:15:58
| 205,094,516
| 0
| 0
| null | 2021-06-10T21:55:52
| 2019-08-29T06:19:46
|
Python
|
UTF-8
|
Python
| false
| false
| 1,128
|
py
|
# Generated by Django 2.2.4 on 2019-09-13 05:28
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('authtoken', '0002_auto_20160226_1747'),
('app', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='tokengenerator',
options={},
),
migrations.RemoveField(
model_name='tokengenerator',
name='created',
),
migrations.RemoveField(
model_name='tokengenerator',
name='key',
),
migrations.RemoveField(
model_name='tokengenerator',
name='user',
),
migrations.AddField(
model_name='tokengenerator',
name='token_ptr',
field=models.OneToOneField(auto_created=True, default=django.utils.timezone.now, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='authtoken.Token'),
preserve_default=False,
),
]
|
[
"asminrai7@gmail.com"
] |
asminrai7@gmail.com
|
1abba349f07bcef2d1ee8c32fd0fca2db698008e
|
3a4fd17ef3c8a89c0b5fda3a6b96d0738fe9ae7f
|
/problem9.py
|
9b0ff858375aea75228ca0738c9ddb688e3fb6aa
|
[] |
no_license
|
JoshuaW1990/leetcode-session2
|
62c6a2f628eb164442eb47c383d9fe88493478be
|
71abff600e607aeb9cf3c949dd84fa39f67465cb
|
refs/heads/master
| 2020-03-26T03:24:30.866321
| 2018-08-15T14:16:16
| 2018-08-15T14:16:16
| 144,454,516
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 195
|
py
|
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
# use string at first
s = str(x)
return s[::-1]==s
|
[
"junwang@Juns-Air.lan"
] |
junwang@Juns-Air.lan
|
0efad3c56f41c0b45bbffff4a4653b05920c3093
|
729e561fde2dcbc8b328182b636c0cc63c8dd062
|
/sour/map/clipfacevecs.py
|
229ceab0a886d0ffc27333a1f0d9bef6d29cb190
|
[
"BSD-3-Clause",
"MIT",
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
embarktrucks/sour
|
1738dc9f3fac6964108673e6e5314919887679cf
|
31393561b367c17d6b4b1269bfe6d4ae69bd0acf
|
refs/heads/master
| 2020-04-03T12:09:58.201605
| 2018-11-04T03:20:41
| 2018-11-04T03:20:41
| 155,243,184
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,051
|
py
|
"""
This file may be in part a direct translation of the original Cube 2 sources into python.
Please see readme_source.txt for the license that may apply.
"""
from sour.map.facevec import facevec
from sour.map.insideface import insideface
def clipfacevecy(o, d, cx, cy, size, r):
if d.x >= 0:
if cx <= o.x or cx >= o.x + d.x:
return 0
elif cx <= o.x + d.x or cx >= o.x:
return 0
t = (o.y - cy) + (cx - o.x) * d.y / d.x
if t <= 0 or t >= size:
return 0
r.x = cx
r.y = cy + t
return 1
def clipfacevecx(o, d, cx, cy, size, r):
if d.y >= 0:
if cy <= o.y or cy >= o.y + d.y:
return 0
elif cy <= o.y + d.y or cy >= o.y:
return 0
t = (o.x - cx) + (cy - o.y) * d.x / d.y
if t <= 0 or t >= size:
return 0
r.x = cx + t
r.y = cy
return 1
def clipfacevec(o, d, cx, cy, size, rvecs):
r = 0
if (
o.x >= cx
and o.x <= cx + size
and o.y >= cy
and o.y <= cy + size
and ((o.x != cx and o.x != cx + size) or (o.y != cy and o.y != cy + size))
):
rvecs[0].x = o.x
rvecs[0].y = o.y
r += 1
r += clipfacevecx(o, d, cx, cy, size, rvecs[r])
r += clipfacevecx(o, d, cx, cy + size, size, rvecs[r])
r += clipfacevecy(o, d, cx, cy, size, rvecs[r])
r += clipfacevecy(o, d, cx + size, cy, size, rvecs[r])
assert r <= 2
return r
def clipfacevecs(o, numo, cx, cy, size, rvecs):
cx <<= 3
cy <<= 3
size <<= 3
r = 0
prev = o[numo - 1]
for i in xrange(numo):
cur = o[i]
r += clipfacevec(
prev, facevec(cur.x - prev.x, cur.y - prev.y), cx, cy, size, rvecs[r]
)
prev = cur
corner = [
facevec(cx, cy),
facevec(cx + size, cy),
facevec(cx + size, cy + size),
facevec(cx, cy + size),
]
for i in xrange(4):
if insideface(corner[i], 1, o, numo):
rvecs[r] = corner[i]
r += 1
assert r <= 8
return r
|
[
"cfoust@sqweebloid.com"
] |
cfoust@sqweebloid.com
|
cad3859762c942e83c2cb5fb4b48928b89e35f30
|
4897a3812310bfa87e3c52959bfd79cd6ef6fe67
|
/kr.py
|
f4610bb4448e4477496211dad67d4df4a17e54c2
|
[] |
no_license
|
alanward55/alantv
|
267dc9428f5e0b608dad793498e39c6d5af42547
|
229d84cc6035f58d732101709b13995d66199e6f
|
refs/heads/main
| 2023-08-13T02:54:41.500324
| 2021-10-12T10:39:27
| 2021-10-12T10:39:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,969
|
py
|
import os,re,sys,time, requests
b="\033[0;34m"
g="\033[1;32m"
w="\033[1;37m"
r="\033[1;31m"
y="\033[1;33m"
cyan = "\033[0;36m"
lgray = "\033[0;37m"
dgray = "\033[1;30m"
ir = "\033[0;101m"
reset = "\033[0m"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
res = requests.get('https://www.insecam.org/en/bycountry/KR/', headers=headers)
findpage = re.findall('"?page=",\s\d+', res.text)[1]
rfindpage = findpage.replace('page=", ', '')
os.system('clear')
print(" \'========================================. ")
print(" |Pembuat: Alan Ward |Asli Indonesia | ")
print(" |IG : uli_karaba |+62-853-2672-8933| ")
print(" \'========================================. ")
print(" [Nomor cctv : 1, 2, 3, 4, 5, 6, 7, 8, 9,]")
page = input("\033[1;31m [ \033[1;37mPilih nomor cctv \033[1;31m]\033[1;37m> ")
animasi = ["Loading[□□□□□□□□□□]","Loading[■□□□□□□□□□]","Loading[■■□□□□□□□□]", "Loading[■■■□□□□□□□]", "Loading[■■■■□□□□□□]", "Loading[■■■■■□□□□□]", "Loading[■■■■■■□□□□]", "Loading[■■■■■■■□□□]", "Loading[■■■■■■■■□□]", "Loading[■■■■■■■■■□]", "Loading[■■■■■■■■■■]"]
for i in range(len(animasi)):
time.sleep(0.3)
sys.stdout.write("\r" + animasi[i % len(animasi)])
sys.stdout.flush()
url = ("https://www.insecam.org/en/bycountry/KR/?page="+str(page))
print ("\n")
res = requests.get(url, headers=headers)
findip = re.findall('http://\d+.\d+.\d+.\d+:\d+', res.text)
count = 0
for _ in findip:
hasil = (findip[count])
print ('[ link ip cctv: ',hasil,']')
print('\nCopas salah satu link diatas ke browser\n\n\n')
print (g+"Terimakasih telah menggunakan script ini"+w)
print (g+'Copyright \N{COPYRIGHT SIGN} 2021 | Alan Ward')
|
[
"noreply@github.com"
] |
alanward55.noreply@github.com
|
1dc0de80801f8d456b2a15ca85d82c00e1890dbf
|
0dfe6f76ca7acd7669ca3c2d21352d2744d061e4
|
/scripts/libraries/vl53l1x.py
|
df7f0d61753ea04ab879d5ea65ec83b802b5016c
|
[
"MIT"
] |
permissive
|
Saneagle/openmv
|
02da8fbaeae5880870a03a007eecca461d025792
|
620c597d59b6e41cf1e85246ded7e24c82d5a1de
|
refs/heads/master
| 2020-04-23T14:03:45.870853
| 2019-06-05T08:22:15
| 2019-06-05T08:22:15
| 171,219,731
| 0
| 0
|
MIT
| 2019-02-18T05:21:58
| 2019-02-18T05:21:57
| null |
UTF-8
|
Python
| false
| false
| 7,360
|
py
|
import pyb
VL51L1X_DEFAULT_CONFIGURATION = bytes([
0x00, # 0x2d : set bit 2 and 5 to 1 for fast plus mode (1MHz I2C), else don't touch */
0x00, # 0x2e : bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD) */
0x00, # 0x2f : bit 0 if GPIO pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD) */
0x01, # 0x30 : set bit 4 to 0 for active high interrupt and 1 for active low (bits 3:0 must be 0x1), use SetInterruptPolarity() */
0x02, # 0x31 : bit 1 = interrupt depending on the polarity, use CheckForDataReady() */
0x00, # 0x32 : not user-modifiable */
0x02, # 0x33 : not user-modifiable */
0x08, # 0x34 : not user-modifiable */
0x00, # 0x35 : not user-modifiable */
0x08, # 0x36 : not user-modifiable */
0x10, # 0x37 : not user-modifiable */
0x01, # 0x38 : not user-modifiable */
0x01, # 0x39 : not user-modifiable */
0x00, # 0x3a : not user-modifiable */
0x00, # 0x3b : not user-modifiable */
0x00, # 0x3c : not user-modifiable */
0x00, # 0x3d : not user-modifiable */
0xff, # 0x3e : not user-modifiable */
0x00, # 0x3f : not user-modifiable */
0x0F, # 0x40 : not user-modifiable */
0x00, # 0x41 : not user-modifiable */
0x00, # 0x42 : not user-modifiable */
0x00, # 0x43 : not user-modifiable */
0x00, # 0x44 : not user-modifiable */
0x00, # 0x45 : not user-modifiable */
0x20, # 0x46 : interrupt configuration 0->level low detection, 1-> level high, 2-> Out of window, 3->In window, 0x20-> New sample ready , TBC */
0x0b, # 0x47 : not user-modifiable */
0x00, # 0x48 : not user-modifiable */
0x00, # 0x49 : not user-modifiable */
0x02, # 0x4a : not user-modifiable */
0x0a, # 0x4b : not user-modifiable */
0x21, # 0x4c : not user-modifiable */
0x00, # 0x4d : not user-modifiable */
0x00, # 0x4e : not user-modifiable */
0x05, # 0x4f : not user-modifiable */
0x00, # 0x50 : not user-modifiable */
0x00, # 0x51 : not user-modifiable */
0x00, # 0x52 : not user-modifiable */
0x00, # 0x53 : not user-modifiable */
0xc8, # 0x54 : not user-modifiable */
0x00, # 0x55 : not user-modifiable */
0x00, # 0x56 : not user-modifiable */
0x38, # 0x57 : not user-modifiable */
0xff, # 0x58 : not user-modifiable */
0x01, # 0x59 : not user-modifiable */
0x00, # 0x5a : not user-modifiable */
0x08, # 0x5b : not user-modifiable */
0x00, # 0x5c : not user-modifiable */
0x00, # 0x5d : not user-modifiable */
0x01, # 0x5e : not user-modifiable */
0xdb, # 0x5f : not user-modifiable */
0x0f, # 0x60 : not user-modifiable */
0x01, # 0x61 : not user-modifiable */
0xf1, # 0x62 : not user-modifiable */
0x0d, # 0x63 : not user-modifiable */
0x01, # 0x64 : Sigma threshold MSB (mm in 14.2 format for MSB+LSB), use SetSigmaThreshold(), default value 90 mm */
0x68, # 0x65 : Sigma threshold LSB */
0x00, # 0x66 : Min count Rate MSB (MCPS in 9.7 format for MSB+LSB), use SetSignalThreshold() */
0x80, # 0x67 : Min count Rate LSB */
0x08, # 0x68 : not user-modifiable */
0xb8, # 0x69 : not user-modifiable */
0x00, # 0x6a : not user-modifiable */
0x00, # 0x6b : not user-modifiable */
0x00, # 0x6c : Intermeasurement period MSB, 32 bits register, use SetIntermeasurementInMs() */
0x00, # 0x6d : Intermeasurement period */
0x0f, # 0x6e : Intermeasurement period */
0x89, # 0x6f : Intermeasurement period LSB */
0x00, # 0x70 : not user-modifiable */
0x00, # 0x71 : not user-modifiable */
0x00, # 0x72 : distance threshold high MSB (in mm, MSB+LSB), use SetD:tanceThreshold() */
0x00, # 0x73 : distance threshold high LSB */
0x00, # 0x74 : distance threshold low MSB ( in mm, MSB+LSB), use SetD:tanceThreshold() */
0x00, # 0x75 : distance threshold low LSB */
0x00, # 0x76 : not user-modifiable */
0x01, # 0x77 : not user-modifiable */
0x0f, # 0x78 : not user-modifiable */
0x0d, # 0x79 : not user-modifiable */
0x0e, # 0x7a : not user-modifiable */
0x0e, # 0x7b : not user-modifiable */
0x00, # 0x7c : not user-modifiable */
0x00, # 0x7d : not user-modifiable */
0x02, # 0x7e : not user-modifiable */
0xc7, # 0x7f : ROI center, use SetROI() */
0xff, # 0x80 : XY ROI (X=Width, Y=Height), use SetROI() */
0x9B, # 0x81 : not user-modifiable */
0x00, # 0x82 : not user-modifiable */
0x00, # 0x83 : not user-modifiable */
0x00, # 0x84 : not user-modifiable */
0x01, # 0x85 : not user-modifiable */
0x01, # 0x86 : clear interrupt, use ClearInterrupt() */
0x40 # 0x87 : start ranging, use StartRanging() or StopRanging(), If you want an automatic start after VL53L1X_init() call, put 0x40 in location 0x87 */
])
class VL53L0X:
def __init__(self,i2c, address=0x29):
self.i2c = i2c
self.address = address
self.reset()
pyb.delay(1)
if self.read_model_id() != 0xEACC:
raise RuntimeError('Failed to find expected ID register values. Check wiring!')
# write default configuration
self.i2c.writeto_mem(self.address, 0x2D, VL51L1X_DEFAULT_CONFIGURATION, addrsize=16)
#pyb.delay(100)
# the API triggers this change in VL53L1_init_and_start_range() once a
# measurement is started; assumes MM1 and MM2 are disabled
self.writeReg16Bit(0x001E, self.readReg16Bit(0x0022) * 4)
pyb.delay(200)
def writeReg(self, reg, value):
return self.i2c.writeto_mem(self.address, reg, bytes([value]), addrsize=16)
def writeReg16Bit(self, reg, value):
return self.i2c.writeto_mem(self.address, reg, bytes([(value >> 8) & 0xFF, value & 0xFF]), addrsize=16)
def readReg(self, reg):
return self.i2c.readfrom_mem(self.address, reg, 1, addrsize=16)[0]
def readReg16Bit(self, reg):
data = self.i2c.readfrom_mem(self.address, reg, 2, addrsize=16)
return (data[0]<<8) + data[1]
def read_model_id(self):
return self.readReg16Bit(0x010F)
def reset(self):
self.writeReg(0x0000, 0x00)
pyb.delay(100)
self.writeReg(0x0000, 0x01)
def read(self):
data = self.i2c.readfrom_mem(self.address, 0x0089, 17, addrsize=16) # RESULT__RANGE_STATUS
range_status = data[0]
# report_status = data[1]
stream_count = data[2]
dss_actual_effective_spads_sd0 = (data[3]<<8) + data[4]
# peak_signal_count_rate_mcps_sd0 = (data[5]<<8) + data[6]
ambient_count_rate_mcps_sd0 = (data[7]<<8) + data[8]
# sigma_sd0 = (data[9]<<8) + data[10]
# phase_sd0 = (data[11]<<8) + data[12]
final_crosstalk_corrected_range_mm_sd0 = (data[13]<<8) + data[14]
peak_signal_count_rate_crosstalk_corrected_mcps_sd0 = (data[15]<<8) + data[16]
#status = None
#if range_status in (17, 2, 1, 3):
#status = "HardwareFail"
#elif range_status == 13:
#status = "MinRangeFail"
#elif range_status == 18:
#status = "SynchronizationInt"
#elif range_status == 5:
#status = "OutOfBoundsFail"
#elif range_status == 4:
#status = "SignalFail"
#elif range_status == 6:
#status = "SignalFail"
#elif range_status == 7:
#status = "WrapTargetFail"
#elif range_status == 12:
#status = "XtalkSignalFail"
#elif range_status == 8:
#status = "RangeValidMinRangeClipped"
#elif range_status == 9:
#if stream_count == 0:
#status = "RangeValidNoWrapCheckFail"
#else:
#status = "OK"
return final_crosstalk_corrected_range_mm_sd0
|
[
"noreply@github.com"
] |
Saneagle.noreply@github.com
|
94a8ebf2afd2815b3961eec5c6fcfe30dd4bdbf6
|
5e7e6fdd13fc65b7f5affe28e60ec03546599369
|
/stack/stack.py
|
383adc9d5cbe1579f0d5688a19861e65b8ed4cf5
|
[
"Apache-2.0"
] |
permissive
|
JuulLabs-OSS/BTPTesterCore
|
334099b8ddf64f39bdbd1c34905605a0f170cb0a
|
061acff2805c4639380cbc2650d4025a616c0931
|
refs/heads/master
| 2022-05-16T16:17:46.205462
| 2022-03-23T10:26:43
| 2022-03-30T09:57:23
| 197,208,013
| 8
| 6
|
Apache-2.0
| 2022-03-30T09:57:24
| 2019-07-16T14:18:02
|
Python
|
UTF-8
|
Python
| false
| false
| 2,210
|
py
|
#
# auto-pts - The Bluetooth PTS Automation Framework
#
# Copyright (c) 2017, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
from stack.gap import Gap, BleAddress
from stack.gatt import Gatt
from stack.l2cap import L2CAP
from stack.mesh import Mesh
class Stack:
def __init__(self):
self._pairing_consent_cb = None
self._passkey_confirm_cb = None
self.gap = None
self.gatt = None
self.mesh = None
self.l2cap = None
def gap_init(self):
self.gap = Gap()
def gatt_init(self):
self.gatt = Gatt()
def l2cap_init(self):
self.l2cap = L2CAP()
def mesh_init(self, uuid, oob, output_size, output_actions, input_size,
input_actions, crpl_size):
self.mesh = Mesh(uuid, oob, output_size, output_actions, input_size,
input_actions, crpl_size)
def set_pairing_consent_cb(self, cb):
self._pairing_consent_cb = cb
def pairing_consent_cb(self, addr: BleAddress):
if self._pairing_consent_cb:
self._pairing_consent_cb(addr)
def set_passkey_confirm_cb(self, cb):
self._passkey_confirm_cb = cb
def passkey_confirm_cb(self, addr: BleAddress, match):
if self._passkey_confirm_cb:
self._passkey_confirm_cb(addr, match)
def cleanup(self):
if self.gap:
self.gap_init()
if self.mesh:
self.mesh_init(self.mesh.dev_uuid, self.mesh.static_auth,
self.mesh.output_size, self.mesh.output_actions,
self.mesh.input_size, self.mesh.input_actions,
self.mesh.crpl_size)
if self.l2cap:
self.l2cap = L2CAP()
if self.gatt:
self.gatt = Gatt()
|
[
"michal.narajowski@codecoup.pl"
] |
michal.narajowski@codecoup.pl
|
2917d21f986b93c431bcdccc7423248970117f5f
|
22a83563831cc34260f73cdcc19c3bc84c648a7c
|
/venv/lib/python3.5/token.py
|
b896f999d03e9969d832ea9df6c4748ec6d72f66
|
[
"MIT"
] |
permissive
|
caven-yang/blockchain_demo
|
65ec36f4be194da4eb2da2261c5b2e91c60ca0b9
|
28875fd777bdd664cf2625e4795efa8d67bd2896
|
refs/heads/master
| 2022-12-23T04:31:31.863403
| 2018-01-21T23:15:28
| 2018-01-21T23:15:28
| 118,381,875
| 0
| 0
|
MIT
| 2022-12-08T00:48:41
| 2018-01-21T23:06:47
|
Python
|
UTF-8
|
Python
| false
| false
| 99
|
py
|
/opt/homebrew/Cellar/python35/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/token.py
|
[
"caven.yang@gmail.com"
] |
caven.yang@gmail.com
|
0f93354f38c32fb3a4a5839da071055eb569bf5b
|
ab17c6eaaf04bbd24b42f377354865b2500a959f
|
/DataMining/project3.py
|
4e6ab57ea9ac320ab906457c8491a57734582671
|
[] |
no_license
|
YujiaLuo-L/DataMining
|
194fd2abf5059733fa042247ee4f45cbe5965c81
|
3c9ef95cb8e1599f366b5851f3c2061b5a1a13c4
|
refs/heads/master
| 2022-05-26T10:47:00.405594
| 2020-04-19T16:37:10
| 2020-04-19T16:37:10
| 257,045,126
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 5,341
|
py
|
import numpy as np
import math
np.set_printoptions(suppress=True)#不用科学记数法输出数据
from sklearn.datasets import load_iris#数据
iris=load_iris()
dataset=np.empty([len(iris.data),5],dtype=float)
dataset[:,:4]=iris.data
dataset[:,-1]=iris.target
degree=4#维度设为全局变量
#求两个向量之间的距离
def distance(X1,Xi):
dist=0#用来记录两点之间的距离
for i in range(len(X1)):
dist=dist+pow((X1[i]-Xi[i]),2)
dist=math.sqrt(dist)
return dist
#定义核函数
def kernelize(X,Xi,h,degree):
dist=distance(X,Xi)
kernel=(1/pow(2*np.pi,degree/2))*np.exp(-(dist*dist)/(2*h*h))
return kernel
#均值漂移函数
def shiftPoint(center,points,h):
axis=np.zeros([1,4])
sumweight=0
newcenter=np.zeros([1,4])#新的中心点
for temp in points:
weight=kernelize(center,temp,h,4)
for i in range(0,4):
axis[0,i]+=weight*temp[i]
sumweight+=weight
for j in range(0,4):
axis[0,j]=axis[0,j]/sumweight
newcenter[0,j]=axis[0,j]
return newcenter
#定义寻找密度吸引子函数
def FindAttractor(X,D,h,si):
t=0
n=len(D)
Xt=np.zeros([n,4])
pointlist=[]
Xt[t,:]=X
for item in D:
if distance(item,Xt[t,:])<=h:
pointlist.append(item)
Xt[t+1,:]=shiftPoint(X,pointlist,h)
pointlist.clear()
t=t+1
while distance(Xt[t,:],Xt[t-1,:])>=si:
# print(distance(Xt[t,:],Xt[t-1,:]))
for item in D:
if distance(item,Xt[t,:])<=h:
pointlist.append(item)
Xt[t+1]=shiftPoint(X,pointlist,h)
pointlist.clear()
t=t+1
#返回密度吸引子和漂移经过的点
return Xt[t],Xt[1:t+1,:]
def DensityThreshold(X,points,h,degree):
threshold=0
for item in points:
threshold=threshold+(1/len(points)*math.pow(h,degree))*kernelize(X,item,h,degree)
return threshold
#定义DENCLUE函数
def Denclue(D:[],h:float,sigma:float,si:float):
A=[]#定义一个用来存放密度吸引子的集合
R={}#定义一个集合用来存放被吸引子吸引的点的集合
C={}#定义一个两两密度可达的吸引子的极大可达子集组成的集合
points=[]
num_of_attractor=0
need_shift=[True]*len(D)
global degree
w=0
for i in range(0,len(D)):
if not need_shift[i]:
continue
X_star,shiftpoints=FindAttractor(D[i,:],D,h,si)
# print(DensityThreshold(X_star,D,h,degree))
for x in range(0,len(D)):
if distance(X_star,D[x,:])<=h:
points.append(D[x,:])
print(DensityThreshold(X_star,points,h,degree))
if DensityThreshold(X_star,points,h,degree)>=sigma:
A.append(X_star)
R.setdefault(num_of_attractor,[])
for item in shiftpoints:
for j in range(0,len(D)):
if need_shift[j]:
if distance(item,D[j,:])<=h:#寻找魔都吸引子在均值漂移过程中路过的点,并标记为该密度吸引子的点
R.get(num_of_attractor).append(D[j,:])
need_shift[j]=False
num_of_attractor+=1
points.clear()
#输出密度吸引子和密度吸引子所包含的点
for i in range(0,len(A)):
print("密度吸引子"+str(A[i]))
print("密度吸引子吸引的点")
print(R[i])
#将密度相连的密度吸引子所吸引的数据点归并为一个个类
t=0
C_star=np.empty([len(A),1],dtype=int)
for i in range(0,len(A)):
C_star[i]=-1
for k in range(0,len(A)):
# print(distance(A[k],A[k+1]))
if C_star[k]==-1:
C_star[k]=t
print("第"+str(t+1)+"类簇"+"所包含的密度吸引子有:")
print(A[k])
if k!=len(A):
for i in range(k,len(A)-1):
if distance(A[k],A[i+1])<=h:#判断这两个密度吸引子是否直接密度可达
#如果这两个密度吸引子的距离小于窗口宽度,则表明这两个点是密度可达的,并记录
C_star[i+1]=C_star[k]
print(A[i+1])
t=t+1
num_of_class=0
for i in range(0,len(A)):
if C_star[i,0] not in C:
num_of_class+=1
C.setdefault(C_star[i,0],[])
C.get(C_star[i,0]).append(R[i])
else:
C.get(C_star[i,0]).append(R[i])
#统计每个类的个数
class_element_number=[0]*num_of_class
for i in range(0,len(A)):
for j in range(0,num_of_class):
if C_star[i]==j:
class_element_number[j]+=len(R[i])
print(C_star)
#输出每个类簇的点
for i in range(0,num_of_class):
print("类簇"+str(i+1)+"的点有:")
print(C[i])
print("每个簇中数据集实例的个数为:")
for i in range(0,num_of_class):
print("类簇"+str(i+1)+": "+str(class_element_number[i]))
return
if __name__ == '__main__':
# print("请设置聚类的窗口带宽:")
# h=input()
# print("请设密度吸引子的最小密度阈值:")
# eta=input()
# print("请设置迭代时两点的密度容差:")
# si=input()
Denclue(iris.data,1,0.02,0.0001)
|
[
"1027671187@qq.com"
] |
1027671187@qq.com
|
e8b756b6f410896da07f2a57fb8ceca2f236a37f
|
5d2ce61df4555446e3a429a104befc92c956e246
|
/.venv/bin/easy_install-3.6
|
42ed424bd605d66850ff0f38414000cef1d6a529
|
[
"MIT"
] |
permissive
|
AlexMuia31/profiles-rest-api
|
760a7f21c633a36ad3042d88559b1f868c1f62e1
|
467cefc9e280b41a116ea5edaa353e8e47a2b8a3
|
refs/heads/master
| 2022-05-10T03:29:23.755054
| 2020-03-04T08:27:39
| 2020-03-04T08:27:39
| 223,818,150
| 0
| 0
|
MIT
| 2022-04-22T22:56:47
| 2019-11-24T22:14:03
|
C
|
UTF-8
|
Python
| false
| false
| 240
|
6
|
#!/vagrant/.venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from setuptools.command.easy_install import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
|
[
"alexmuia31@gmail.com"
] |
alexmuia31@gmail.com
|
37549aa864afa6716e9bb2fb85246b09e64374f8
|
a558738e56b7f49a7a336d5c443f35b84ef8e54c
|
/client.py
|
65c4066701dd910f7638e32eac9eb640eb379c8a
|
[] |
no_license
|
shlomozippel/ArduinoScreenOutline
|
420aa8e109875dfd75208b5fc40a7fe48f7f8e44
|
fbd8e5964ad2d8c737e42ed37b8e515554fad778
|
refs/heads/master
| 2021-01-19T04:51:10.413750
| 2013-06-27T06:19:38
| 2013-06-27T06:19:38
| 10,988,543
| 2
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,630
|
py
|
import serial
import time
import sys
from cmd import Cmd
from PIL import ImageGrab, ImageStat
from itertools import *
from struct import pack
#------------------------------------------------------------------------------
# Configuration
#------------------------------------------------------------------------------
WIDTH = 29
HEIGHT = 17
COM_PORT = 'COM3'
#------------------------------------------------------------------------------
# Protocol
#------------------------------------------------------------------------------
ESCAPE = '\x13'
START = '\x37'
COMMAND_HELLO = '\x01'
COMMAND_LEDS = '\x02'
def escape(data):
return data.replace(ESCAPE, ESCAPE + ESCAPE)
def command_hello():
ret = ESCAPE + START + COMMAND_HELLO
return ret
def command_leds(leds):
ret = ESCAPE + START + COMMAND_LEDS + chr(len(leds))
for led in leds:
ret += escape(led)
return ret
#------------------------------------------------------------------------------
# Screen monitor
#------------------------------------------------------------------------------
def mask(image, w, h, x, y):
cell_w = 1.0 / float(w)
cell_h = 1.0 / float(h)
left = x * cell_w
right = left + cell_w
top = y * cell_h
bottom = top + cell_h
im_w, im_h = image.size
return (int(left * im_w), int(top * im_h), int(right * im_w), int(bottom * im_h))
def get_outline_indices(w, h, blank_corners=False):
outline = []
outline += [(0, y-1) for y in xrange(h, 0, -1)]
outline += [(-1, -1)]
outline += [(x, 0) for x in xrange(w)]
outline += [(-1, -1)]
outline += [(w-1, y) for y in xrange(h)]
return outline
INDICES = get_outline_indices(WIDTH, HEIGHT, True)
def get_outline(width, height):
# NOTE: Windows only
im = ImageGrab.grab()
# scale down so its faster
w, h = im.size
im = im.resize((w/4, h/4))
w, h = im.size
res = []
for x, y in INDICES:
if x == -1 and y == -1:
res += [(0,0,0)]
else:
st = ImageStat.Stat(im.crop(mask(im, width, height, x, y)))
res += [st.mean]
return res
def monitor_screen(ser):
try:
while True:
leds = get_outline(WIDTH, HEIGHT)
leds = [pack('BBB', rgb[1], rgb[0], rgb[2]) for rgb in leds]
ser.write(command_leds(leds))
except KeyboardInterrupt: pass
#------------------------------------------------------------------------------
# Command line handler
#------------------------------------------------------------------------------
class LedClient(Cmd):
def __init__(self, *args, **kwargs):
self.serial = None
Cmd.__init__(self, *args, **kwargs)
def do_connect(self, arg):
if self.serial:
self.do_close()
self.serial = serial.Serial(COM_PORT, 115200, timeout=0)
print 'Connected'
def do_hello(self, arg):
if not self.serial:
print 'Not connected'
return
self.serial.write(command_hello())
def do_monitor(self, arg):
if not self.serial:
print 'Not connected'
return
print 'Monitoring...'
monitor_screen(self.serial)
print 'Done'
def do_close(self, arg):
if not self.serial:
return
try:
self.serial.close()
finally:
self.serial = None
def do_quit(self, arg):
return True
do_q = do_quit
def main():
ledclient = LedClient()
ledclient.do_connect("")
ledclient.do_monitor("")
ledclient.cmdloop()
if __name__ == '__main__':
main()
|
[
"shlomo.zippel@gmail.com"
] |
shlomo.zippel@gmail.com
|
8cac48b3e10262d725f77bca781a28750426f18f
|
3a32644df62877604b44593267d41d3c664c1867
|
/3-SatShipAI/train.py
|
e7b2dadcae16420d33fb5cb6e367300704193658
|
[
"Python-2.0",
"CC-BY-3.0",
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
avanetten/SpaceNet_SAR_Buildings_Solutions
|
f5872778baf7cd7f7b22f2a4b104a5f680a33a28
|
6a9c3962d987d985384d0d41a187f5fbfadac82c
|
refs/heads/master
| 2023-01-21T01:43:04.626934
| 2020-12-04T00:15:21
| 2020-12-04T00:15:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 6,576
|
py
|
import os
import sys
import shutil
import argparse
import numpy as np
import pandas as pd
import geopandas as gpd
import torch
sys.path.append('.')
import solaris as sol
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='SpaceNet 6 Baseline Algorithm')
parser.add_argument('--basedir',
help='BaseDir')
args = parser.parse_args(sys.argv[1:])
print ('torch', torch.__version__)
print ('gpd', gpd.__version__)
print ("solaris", sol.__version__)
spacenet_base_path = args.basedir
spacenet_out_dir = os.path.join(os.path.curdir, 'data/')
spacenet_sar_path = os.path.join(spacenet_base_path , 'SAR-Intensity/')
spacenet_rgb_path = os.path.join(spacenet_base_path , 'PS-RGB/')
spacenet_orientation_file = os.path.join(spacenet_base_path , 'SummaryData/SAR_orientations.txt')
spacenet_masks_file = os.path.join(spacenet_base_path, 'SummaryData/SN6_Train_AOI_11_Rotterdam_Buildings.csv')
spacenet_labels_path = os.path.join(spacenet_base_path, 'geojson_buildings/')
print ('Base dir :', spacenet_base_path)
print ('Base sar dir :', spacenet_sar_path)
print ('Base rgb sar :', spacenet_rgb_path)
print ('Orientation file:', spacenet_orientation_file)
print ('Masks file :', spacenet_masks_file)
print ('Output dir :', spacenet_out_dir)
#
# Copy orientation to output as well...
shutil.copyfile(spacenet_orientation_file, spacenet_out_dir+'/SAR_orientations.txt')
from datagen import prepare_df
#
# 0. Create preparatory DataFrame
df = prepare_df(spacenet_masks_file, spacenet_orientation_file)
print(df.head())
truth_df = pd.read_csv(spacenet_masks_file)
#
# 2. Train on experiments
from experiments import experiments, creat_rgb_experiment, train_rgb, creat_sar_experiment, train_sar
for exps in experiments:
print (exps['exp_id'])
nfolds = exps['nfolds']
if nfolds > 0:
#
# 1. Continuous folded scheme
image_ids = np.sort(np.unique(df['date'].values))
for im in image_ids:
aDf = df.loc[df.date == im, :]
aDf = aDf.sort_values(by='tile_id')
for f in range(nfolds):
low = int(f * len(aDf) / nfolds)
hig = int((f + 1) * len(aDf) / nfolds)
aDf.iloc[low:hig].split = f
le = len(aDf)
df.loc[df.date == im, ['split']] = aDf.split
if nfolds > 3:
print(len(df[df.split == 0]), len(df[df.split == 1]), len(df[df.split == 2]), len(df[df.split == 3]))
if exps['rgb'] is not None:
model, _, optimizer, train_epoch, valid_epoch, train_loader, valid_loader, valid_loader_metric = creat_rgb_experiment(df,
exps['rgb'],
fold=None,
base_path=spacenet_base_path)
rgb_model_file = train_rgb(exps['rgb'],
spacenet_out_dir,
truth_df,
model,
None,
optimizer,
train_epoch,
valid_epoch,
train_loader,
valid_loader,
valid_loader_metric,
None)
else:
rgb_model_file = None
if nfolds > 0:
for f in range(nfolds):
model, _, optimizer, train_epoch, valid_epoch, train_loader, valid_loader, valid_loader_metric = creat_sar_experiment(df,
exps['sar'],
fold=f,
init_weights=rgb_model_file,
base_path=spacenet_base_path)
sar_model_file = train_sar(exps['sar'],
spacenet_out_dir,
truth_df,
model,
None,
optimizer,
train_epoch,
valid_epoch,
train_loader,
valid_loader,
valid_loader_metric,
f)
else:
model, _, optimizer, train_epoch, valid_epoch, train_loader, valid_loader, valid_loader_metric = creat_sar_experiment(df,
exps['sar'],
fold=None,
init_weights=rgb_model_file
)
sar_model_file = train_sar(exps['sar'],
spacenet_out_dir,
truth_df,
model,
None,
optimizer,
train_epoch,
valid_epoch,
train_loader,
valid_loader,
valid_loader_metric,
None)
|
[
"noreply@github.com"
] |
avanetten.noreply@github.com
|
580f0a3863244e09e0c8da145d18d2254b9a249f
|
6950239e115ec2002213ae317566a8270fc9e186
|
/data/__init__.py
|
f15c01c8314687d6d8896ea20ac77785b0809226
|
[
"MIT"
] |
permissive
|
danzek/email-formality-detection
|
c4d8f23f39fe381f62e460f82a959d16927e4266
|
846f0b5f86a1d4846667633095f67d59129e660b
|
refs/heads/master
| 2021-01-25T06:40:15.646397
| 2014-12-02T05:13:19
| 2014-12-02T05:13:23
| 26,556,226
| 3
| 2
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 367
|
py
|
#!/usr/bin/env python
# -*- coding: utf_8 -*-
__author__ = "Dan O'Day"
__copyright__ = "Copyright 2014, Dan O'Day, Purdue University"
__credits__ = ["Dan O'Day", "Robert Hinh", "Upasita Jain", "Sangmi Shin", "Penghao Wang", "Julia Taylor"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Dan O'Day"
__email__ = "doday@purdue.edu"
__status__ = "Development"
|
[
"digitaloday@gmail.com"
] |
digitaloday@gmail.com
|
5f76a587d10e7ac9e0d7233e991afacb7070c15b
|
912ea946f892d2d40aa3d518fb47bfe4d4eebd1f
|
/test4/booktest/views.py
|
042a74ad5a7e1661abe061da71c80851215b4abd
|
[] |
no_license
|
Mrfranken/djangostudying
|
80254c8cd1fac9f89582c8b543a6f2185d8a3071
|
5e1e62175e6b7e2d85df7a872553ebb8aa612120
|
refs/heads/master
| 2021-04-15T09:38:51.583544
| 2018-05-21T11:18:28
| 2018-05-21T11:18:28
| 126,695,789
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,215
|
py
|
from django.shortcuts import render, redirect
from .models import HeroInfo, BookInfo
from django.http import HttpResponse
# Create your views here.
def index(request):
hero_id1 = HeroInfo.objects.get(pk=1)
hero_list = HeroInfo.objects.filter(isDelete=False)
context = {'hero': hero_id1,
'hero_list': hero_list}
return render(request, 'booktest/index.html', context=context)
def show(request, id): # 正常解析
context = {'id': id}
return render(request, 'booktest/show1.html', context=context)
def show_reverse(request, id1, id2): # 反向解析
context = {'id': (id1, id2)}
return render(request, 'booktest/show.html', context=context)
# 用于练习模板的继承
def index2(request):
return render(request, 'booktest/index2.html')
# 三层模板继承 #templates中 user1.html和user2.html继承自base_user.html继承自base.html
def user1(request):
context = {'user1_title': 'user1_title',
'uname': 'my name is user1'}
return render(request, 'booktest/user1.html', context=context)
def user2(request):
context = {'title': 'user12',
'uname': 'my name is user2'}
return render(request, 'booktest/user2.html', context=context)
# html转义练习
def htmlzhuanyitest(request):
'''
从视图传到模板当中的变量默认是转义的,传什么给模板,模板就输出什么;
而直接在模板中定义的变量是不经过转义的
'''
context = {'t1': '<h1>123</h1>'}
return render(request, 'booktest/htmltest.html', context=context)
# csrf练习
def csrf1(request):
return render(request, 'booktest/csrf1.html')
def csrf2(request):
username = request.POST['username']
return HttpResponse('username is {}'.format(username))
# 验证码练习
def verify_code_test(request):
from PIL import Image, ImageDraw, ImageFont
import random
# 创建背景色
bgColor = (random.randrange(50, 100), random.randrange(50, 100), 0)
# 规定宽高
width = 100
height = 25
# 创建画布
image = Image.new('RGB', (width, height), bgColor)
# 构造字体对象
font = ImageFont.truetype('C:\Windows\Fonts\simfang.ttf', 24)
# 创建画笔
draw = ImageDraw.Draw(image)
# 创建文本内容
text = '0123ABCD'
# 逐个绘制字符
textTemp = ''
for i in range(4):
textTemp1 = text[random.randrange(0, len(text))]
textTemp += textTemp1
draw.text((i * 25, 0), textTemp1, (255, 255, 255), font)
request.session['code'] = textTemp
image.save('D:\png1.png', 'JPEG')
# 保存到内存流中
from io import StringIO, BytesIO
buf = BytesIO()
image.save(buf, 'png')
# 将内存流中的内容输出到客户端
return HttpResponse(buf.getvalue(), 'image/png')
def verifytest1(request):
return render(request, 'booktest/verifytest1.html')
def verifytest2(request):
# return render(request, 'booktest/verifytest2.html')
code = request.POST.get('code')
session_code = request.session.get('code')
if code.lower() == session_code.lower():
# return redirect('/booktest/')
return HttpResponse('您已登录成功')
|
[
"wsj973507837@163.com"
] |
wsj973507837@163.com
|
bee15f72cc9c327263422fbaa4f2fe8df9500f11
|
7f1622417e72d432ee08067bc8844c71f508fc62
|
/gridworld.py
|
c3f619e91a3f307e6c857bef92816dc1380b3119
|
[] |
no_license
|
chenlighten/RL
|
54d3406c1dfc5b895c370ff9b21e9bd722155443
|
4a3cc7185ad08b0ebe5eb21c7123561cc1289e14
|
refs/heads/master
| 2020-07-22T20:19:47.474611
| 2019-09-09T13:35:53
| 2019-09-09T13:35:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 7,397
|
py
|
class GridWorld:
def __init__(self, len=4, gamma=0.5):
self.len = len
self.size = len * len
self.gamma = gamma
self.oldVal = [0] * self.size
self.val = [0] * self.size
self.itrTime = 0
self.actions = ['n', 's', 'w', 'e']
tempPi = dict(n=0.25, s=0.25, w=0.25, e=0.25)
self.pi = list()
for i in range(0, self.size):
self.pi.append(tempPi.copy())
self.reward = -1
# get the next state after action a in state s
def stateTrans(self, s, a):
if not (0 <= s < self.size):
print("Wrong state for stateTrans()")
return -1
row = s // self.len
col = s % self.len
if a == 'n':
row = max(row - 1, 0)
elif a == 's':
row = min(row + 1, self.len - 1)
elif a == 'w':
col = max(col - 1, 0)
elif a == 'e':
col = min(col + 1, self.len - 1)
else:
print("Wrong action for stateTrans()")
return -1
return row * self.len + col
def getNewVal(self, s):
res = 0
for a in self.actions:
res += self.pi[s][a] * \
(self.reward + self.gamma * self.oldVal[self.stateTrans(s, a)])
return res
def updateVal(self, threshold=1e-10):
import math
delta = float('inf')
while delta >= threshold:
delta = 0
for s in range(1, self.size - 1):
self.val[s] = self.getNewVal(s)
delta = max(delta, math.fabs(self.oldVal[s] - self.val[s]))
self.oldVal = self.val[:]
del math
def updatePi(self):
stable = True
for s in range(1, self.size - 1):
oldPi = self.pi[s].copy()
adjVals = dict()
for a in self.actions:
adjVals[a] = self.val[self.stateTrans(s, a)]
# now adjVals will be a list of tuple
adjVals = sorted(adjVals.items(), key=lambda e: e[1], reverse=True)
count = 0
for tp in adjVals:
if tp[1] == adjVals[0][1]:
count += 1
else:
break
for tp in adjVals:
if tp[1] == adjVals[0][1]:
self.pi[s][tp[0]] = 1 / count
else:
self.pi[s][tp[0]] = 0
if self.pi[s] != oldPi:
stable = False
return stable
def printVals(self):
for s in range(0, self.len):
print("%f %f %f %f" % (self.val[4*s], self.val[4*s + 1], self.val[4*s + 2], self.val[4*s + 3]))
def printPi(self):
for s in range(0, self.size):
print(self.pi[s])
def doall(self):
self.updateVal()
while not self.updatePi():
self.updateVal()
def getRandomAction(self, s):
import random
dicision = random.random()
nPossibleStep = self.pi[s]['n']
sPossibleStep = nPossibleStep + self.pi[s]['s']
wPossibleStep = sPossibleStep + self.pi[s]['w']
if (dicision <= nPossibleStep):
return 'n'
elif (dicision <= sPossibleStep):
return 's'
elif (dicision <= wPossibleStep):
return 'w'
else:
return 'e'
def generateEpisode(self):
import random
s = random.randint(1, self.size - 2)
episode = list()
while not (s == 0 or s == self.size - 1):
episode.append(s)
s = self.stateTrans(s, self.getRandomAction(s))
del random
episode.append(s)
return episode
def listAverage(self, l):
sum = 0
for item in l:
sum += item
return sum / len(l)
def getG(self, episode, i):
tempEpisode = episode[i + 1:]
G = 0
for i in range(0, len(tempEpisode)):
G += self.reward * (self.gamma) ** i
return G
def firstVisitMonteCarlo(self):
import random
N = [0] * self.size
for s in range(0, self.size):
self.val[s] = 0.0
self.val[0] = self.val[self.size - 1] = 0.0
for loop in range(0, 100000):
episode = self.generateEpisode()
for s in range(0, self.size - 1):
if s in episode:
iFirstOccurence = episode.index(s)
G = self.getG(episode, iFirstOccurence)
N[s] += 1
self.val[s] = self.val[s] + (G - self.val[s]) / N[s]
del random
def everyVisitMonteCarlo(self):
import random
N = [0] * self.size
for s in range(0, self.size):
self.val[s] = random.randint(-100, 0)
self.val[0] = self.val[self.size - 1] = 0
for loop in range(0, 100000):
episode = self.generateEpisode()
for i in range(0, len(episode) - 1):
G = self.getG(episode, i)
N[episode[i]] += 1
self.val[episode[i]] = self.val[episode[i]] + (G - self.val[episode[i]]) / N[episode[i]]
del random
def temporalDifference(self, threshold):
import random
import math
alpha = 0.0001
delta = float('inf')
for s in range(1, self.size - 1):
self.val[s] = random.randint(-10, 0)
self.val[0] = self.val[self.size - 1] = 0
self.oldVal = self.val.copy()
while delta > threshold:
delta = 0
s = random.randint(1, self.size - 2)
while not (s == 0 or s == self.size - 1):
sNext = self.stateTrans(s, self.getRandomAction(s))
newVal = self.oldVal[s] + alpha * (-1 + self.gamma * self.oldVal[sNext] - self.oldVal[s])
delta = max(delta, math.fabs(newVal - self.oldVal[s]))
self.val[s] = newVal
s = sNext
self.oldVal = self.val.copy()
del random
del math
def temporalDifferenceVersion2(self):
import random
import math
alpha = 0.0001
for s in range(1, self.size - 1):
self.val[s] = random.randint(-10, 0)
self.val[0] = self.val[self.size - 1] = 0
self.oldVal = self.val.copy()
for loop in range(0, 100000):
episode = self.generateEpisode()
for i in range(0, len(episode) - 1):
s = episode[i]
sNext = episode[i + 1]
self.val[s] += alpha * (self.reward + self.gamma * self.oldVal[sNext] - self.oldVal[s])
self.oldVal = self.val.copy()
del random
del math
if __name__ == '__main__':
import pdb
pdb.set_trace()
gw1 = GridWorld()
gw2 = GridWorld()
gw3 = GridWorld()
print("First Visit Monte Carlo:\n")
gw1.firstVisitMonteCarlo()
print("Value Function:")
gw1.printVals()
gw1.updatePi()
print("Policy:")
gw1.printPi()
print("Every Visit Monte Carlo:")
gw2.everyVisitMonteCarlo()
print("Value Function:")
gw2.printVals()
gw2.updatePi()
print("Policy:")
gw2.printPi()
print("temporal difference:")
gw3.temporalDifferenceVersion2()
print("Value Function:")
gw3.printVals()
gw3.updatePi()
print("Policy:")
gw3.printPi()
|
[
"xushichen@sjtu.edu.cn"
] |
xushichen@sjtu.edu.cn
|
c5c5917bb24e8e40470a8d5d3957a0dcfa3fad79
|
0a6af3fcbf499dbc89dd0bc410d21412dc0e13e1
|
/network/cifar10_cnn_net.py
|
918b1c91c29db35e1b0bb57e673e58e7592d23da
|
[] |
no_license
|
skamdar/Adversarial-Image-Detection
|
625a9b9183a4a4dfd0f082698de0d1ae06311e60
|
4b82c0cc5d909598c1e0bf1dc7811f8fcc147630
|
refs/heads/master
| 2020-12-27T02:24:53.551056
| 2020-02-02T08:16:20
| 2020-02-02T08:16:20
| 237,733,199
| 3
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 921
|
py
|
import torch.nn as nn
import torch.nn.functional as F
class cifar10_cnn_net(nn.Module):
def __init__(self):
super(cifar10_cnn_net, self).__init__()
self.conv1 = nn.Conv2d(3, 64, 3, 1)
self.conv2 = nn.Conv2d(64, 64, 3, 1)
self.conv3 = nn.Conv2d(64, 128, 3, 1)
self.conv4 = nn.Conv2d(128, 128, 3, 1)
self.drop_out = nn.Dropout(p=0.5)
self.fc1 = nn.Linear(128*5*5, 256)
self.fc2 = nn.Linear(256, 10)
def forward(self, x):
x = F.relu(self.conv1(x))
x = F.relu(self.conv2(x))
x = F.max_pool2d(x, 2, 2)
x = F.relu(self.conv3(x))
x = F.relu(self.conv4(x))
x = F.max_pool2d(x, 2, 2)
#print(x.size())
x = x.view(-1, 3200)
x = self.drop_out(x)
x = F.relu(self.fc1(x))
x = self.drop_out(x)
x = F.relu(self.fc2(x))
return F.log_softmax(x, dim=1)
|
[
"noreply@github.com"
] |
skamdar.noreply@github.com
|
0d5996acbeb697b58611426db25b498715d856d0
|
97a8c745db33c7e4f33d573a70c8060ad1cf0e72
|
/Advanced Algorithms/Rivest Shamir Adleman Encryption/rsacrypto.py
|
68b029b9862fe7e66163fc0479629d8b9e65bb0d
|
[] |
no_license
|
Sudipta2002/UEMK-CSE-RESOURCES
|
498fcaef1565a066687fe3e5d14c15c911db3f0e
|
529dd518442c962406abfd0506d372f169e7a5f3
|
refs/heads/main
| 2023-06-15T21:25:20.134069
| 2021-07-12T06:25:39
| 2021-07-12T06:25:39
| 347,376,840
| 6
| 3
| null | 2021-06-14T14:33:34
| 2021-03-13T13:23:18
|
Java
|
UTF-8
|
Python
| false
| false
| 693
|
py
|
p=int(input("Enter p :"))
q=int(input("Enter q :"))
n=p*q
t=(p-1)*(q-1)
print(t)
#e=int(input("Enter public key which should not be factor of t :"))
# For Calculate public key which should not be factor of t
for i in range(1,50):
e=t%i
if(e!=0):
e1=i
print(e1)
break
# Calculating private key using RSA Algorithm
for i in range(1,20) :
summ=(t)*i
result=summ+1
result1=int(result)%e1
if(result1==0.00):
result2=int(result)/e1
print("Private key is : ",int(result2))
break
pt=int(input("Enter message : "))
ct=pt**e
print("Encryption : ")
print(ct)
print("Decryption : ")
pt=ct**d
print(pt)
|
[
"71402528+ArchishmanSengupta@users.noreply.github.com"
] |
71402528+ArchishmanSengupta@users.noreply.github.com
|
b7a14f536f1e9b4afcc040d99de0e15bb06126bf
|
2d997a015015dbfe457fbec38007ffaadbdb97aa
|
/manage.py
|
9641b75b81967ee2951308a000c8f3cc098c2451
|
[] |
no_license
|
vinodkumar-git/1stZoomAssignment
|
e45ec1870bae3a0c8dd0e88c7a326543c513320a
|
2f4d8c79762a9ed7c204646f6556db2f0101e8d6
|
refs/heads/master
| 2023-08-28T21:43:42.022040
| 2021-10-22T12:40:40
| 2021-10-22T12:40:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 630
|
py
|
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'search_app.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
|
[
"vinodkumar-git"
] |
vinodkumar-git
|
79a6c644ba882a986e907796dfcce38cc3ad4274
|
9206dbab09ba6c0ae1a82df07e3014ee2bcde548
|
/kickstarter-scraper/settings.py
|
04912ea7c665b68fb04d7386f8249ec3b69a6731
|
[] |
no_license
|
yambakshi/kickstarter-scraper
|
6876d736c49e8ef1b03daa00aa74db9c419b1f72
|
2d2025001ed377c89975aef1e115753ae193a117
|
refs/heads/master
| 2022-01-29T09:33:28.113997
| 2019-10-19T09:37:32
| 2019-10-19T09:37:32
| 216,181,008
| 1
| 0
| null | 2022-01-06T22:37:49
| 2019-10-19T09:27:37
|
Python
|
UTF-8
|
Python
| false
| false
| 3,492
|
py
|
"""
Django settings for trossassignment project.
Generated by 'django-admin startproject' using Django 2.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 't2uo-t7!$ukl#b-g@sq&u&$w#ak6hxasf8ad1u8#3(&o@kyt7^'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'kickstarter.apps.KickstarterConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'trossassignment.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'trossassignment.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'kickstarter',
'USER': 'kickstarter_scraper',
'PASSWORD': '1234',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Jerusalem'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
CELERY_BROKER_URL = 'redis://localhost:6379'
CELERY_TIMEZONE = 'Asia/Jerusalem'
CELERY_BEAT_SCHEDULE = {
'scrape-kickstarter': {
'task': 'kickstarter.tasks.scrape_kickstarter',
'schedule': 3600.0
}
}
|
[
"yambakshi@gmail.com"
] |
yambakshi@gmail.com
|
8073e5d4da533bba669535deae7fbcac20df8051
|
1a2e61b08f8ef9fde6cf1103ccb7f782c45de6c6
|
/travelteam/urls.py
|
434690a3365ec26cd466d12c8296334c1444b152
|
[] |
no_license
|
lvrenshy/tutu
|
4d3891632405cb7d75e56ba251048a22d5f2702c
|
c24f957aa424592a92565e670935b5dae07b104d
|
refs/heads/master
| 2020-04-01T09:51:47.852123
| 2018-11-08T05:46:36
| 2018-11-08T05:46:36
| 153,092,377
| 0
| 0
| null | 2018-10-15T10:09:20
| 2018-10-15T10:09:20
| null |
UTF-8
|
Python
| false
| false
| 964
|
py
|
from django.conf.urls import url
from django.urls import path,include
from . import views
app_name='travelteam'
#tips子路由
urlpatterns = [
url(r'^show/',views.show,name='show'),
url(r'^$',views.show,name='null_show'),
url(r'^search/', views.search, name='search'),
url(r'^abcd/', views.abcd, name='abcd'),
url(r'^write/', views.write, name='write'),
url(r'^teaminfo/', views.teaminfo, name='teaminfo'),
url(r'^inpartTeam/', views.inpartTeam, name='inpartTeam'),
url(r'^startTeam/((?P<content>.*)/)*', views.startTeam, name='startTeam'),
url(r'^limit/', views.limit, name='limit'),
url(r'^approve/', views.approve, name='approve'),
url(r'^teamers/', views.teamers, name='teamers'),
url(r'^guanliteam/', views.guanliteam, name='guanliteam'),
url(r'^jianbiao/', views.jianbiao, name='jianbiao'),
url(r'^review/', views.review, name='review'),
url(r'^statusteam/', views.statusteam, name='statusteam')
]
|
[
"1695877814@qq.com"
] |
1695877814@qq.com
|
d143a4c5b308009a40b5662ce5e3313d1dde774e
|
0dba8fb214b6fc72d818d084939db8b1b7a22bff
|
/day12/01.py
|
d7bf53b19cb1242143af6b764bb0fb4d017f95d8
|
[] |
no_license
|
Timofeu296/Python
|
92ef7abb59a013b943233afba91560e08504e86f
|
e9cd3b92f2499d5f696a66877e17c68ddaad1e62
|
refs/heads/master
| 2022-07-14T16:28:34.040017
| 2020-05-05T12:21:21
| 2020-05-05T12:21:21
| 258,222,643
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 123
|
py
|
a = [3, 5, 6, 8, 10, 11, 45, 86, 95, 1826, 94648, 0, 3, 17]
for i in range(len(a)):
if i % 2 == 0:
print(a[i])
|
[
"tkuz006@mail.ru"
] |
tkuz006@mail.ru
|
6b2c42f511747065a31707486302c2cbb6f71fd7
|
389f62023453868c1b2c228534b6f8d1a85f39fd
|
/MemeEngine/MemeEngine.py
|
57abeca020b4acf28311b4f7806c0ec6e6fd15ea
|
[] |
no_license
|
YoumnaHammoud/MemeGenerator
|
a20edcc98dbbd345eb720a56256872421b368d41
|
2b7f8d51a8b6a74b8d200356475e76202841ac92
|
refs/heads/main
| 2023-03-16T22:06:50.576068
| 2021-03-10T21:09:04
| 2021-03-10T21:09:04
| 346,489,577
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 890
|
py
|
from PIL import Image, ImageDraw, ImageFont
from random import randint
class MemeEngine():
def __init__(self, output_dir):
self.output_dir = output_dir
def make_meme(self, img_path, text, author, width=500):
img = Image.open(img_path)
# Resize image
if width > 500:
width = 500
multiplier = width/img.width
new_width = int(img.width*multiplier)
new_height = int(img.height*multiplier)
img = img.resize((new_width,new_height))
# Add message
message = text + "\n - "+author
draw = ImageDraw.ImageDraw(img)
random_width = randint(0, new_width)
random_height = randint(0, new_height)
draw.text((random_width, random_height), message)
# Save
img.save(self.output_dir)
return(self.output_dir)
|
[
"noreply@github.com"
] |
YoumnaHammoud.noreply@github.com
|
d9870d5296ca9bdb5b68de162a107a9fa360dbbe
|
b98cd0e4c06d48fc197e5f10468f359a70305676
|
/tensorflow_graphics/physics/test_tf_speed.py
|
0c90410c356a5b7dbe2386bc47313b5036120a8d
|
[
"Apache-2.0"
] |
permissive
|
aespielberg/graphics
|
e2b515b35ae8f228d9cb68476bc10be1dbb88d63
|
28a5c1a51565a9c30c82290eb420e9854d588882
|
refs/heads/main
| 2023-06-26T18:29:31.343006
| 2021-02-23T19:38:29
| 2021-02-23T19:38:29
| 341,668,523
| 0
| 0
|
Apache-2.0
| 2021-02-23T19:37:08
| 2021-02-23T19:37:07
| null |
UTF-8
|
Python
| false
| false
| 1,053
|
py
|
import os
import time
import unittest
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
import sys
from IPython import embed
import mpm3d
from simulation import Simulation
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
sess = tf.compat.v1.Session()
# Memory bandwidth of 1070 = 256 GB/s
def main():
#shape = (1024, 1024, 256)
shape = (1024, 256, 256) # size = 0.256 GB, walkthrough time = 1ms
ones = np.ones(shape=shape)
a = tf.Variable(ones, dtype=tf.float32)
b = tf.Variable(ones, dtype=tf.float32)
sess.run(tf.compat.v1.global_variables_initializer())
# op = tf.reduce_max(tf.assign(a, a + b))
# op = tf.assign(a, b)
op = tf.reduce_max(input_tensor=a + b)
#op = tf.assign(a, a)
total_time = 0
N = 1000
for i in range(N):
t = time.time()
ret = sess.run(op)
t = time.time() - t
print(t)
total_time += t
print(total_time / N * 1000, 'ms')
if __name__ == '__main__':
main()
# Reduce max a (1) : 1.61 ms
# Reduce max a + b (4): 5.57 ms
# a=b, fetch : 23 ms
|
[
"aespielberg@csail.mit.edu"
] |
aespielberg@csail.mit.edu
|
088f927f5484d27d5ad614e7bd50d35470096630
|
686171b12b83bcc503d8ba06137a43c3ef5970b6
|
/busca_sequencial_sentinela.py
|
e6f83289e1045ae6dac32295bb4471e81f5f06a8
|
[
"MIT"
] |
permissive
|
EDAII/Lista1_JoaoVitor_JoaoPedro
|
5dc7e167acedaecb3de4e5dc715b033e26f585fd
|
1c7be5b662590bcb98ef5339189a9b7564d8e80f
|
refs/heads/master
| 2020-04-30T23:20:32.717007
| 2019-03-29T18:08:49
| 2019-03-29T18:08:52
| 177,141,508
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,181
|
py
|
import random
import time
def busca_sequencial_sentinela(lista, elemento):
"""
Reliza busca sequencial com sentinela do elemento passado por parametro
lista -- lista de inteiros desordenada
elemento -- elemento a ser buscado
"""
contador = 0
lista.append(contador)
try:
while lista[contador] != elemento:
contador += 1
if contador == len(lista) - 1:
del lista[-1]
return -1
del lista[-1]
return contador
except IndexError:
print('Elemento nao achado')
def insere_randomico(lista, qtd_insercao):
"""
Insere n elementos de acordo com a quantidade passada por parametro
qtd_insercao - quantidade a ser inserida na lista
"""
for i in range(qtd_insercao):
lista.append(random.randint(1,10000))
random.shuffle(lista)
return lista
def remove_randomico(lista, qtd_remocao):
"""
Insere n elementos de acordo com a quantidade passada por parametro
qtd_remocao - quantidade a ser removida na lista
"""
for i in range(qtd_remocao):
lista.pop(random.randrange(len(lista)))
return lista
|
[
"joaovytor0@gmail.com"
] |
joaovytor0@gmail.com
|
f11c75f3c9f3539706191c40e2409dbbf31e2547
|
083ca3df7dba08779976d02d848315f85c45bf75
|
/PalindromePartitioning2.py
|
3ab089a2d7be5fc6fe8feeb7b8c9e61f0a2f0324
|
[] |
no_license
|
jiangshen95/UbuntuLeetCode
|
6427ce4dc8d9f0f6e74475faced1bcaaa9fc9f94
|
fa02b469344cf7c82510249fba9aa59ae0cb4cc0
|
refs/heads/master
| 2021-05-07T02:04:47.215580
| 2020-06-11T02:33:35
| 2020-06-11T02:33:35
| 110,397,909
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 378
|
py
|
class Solution:
def partition(self, s):
"""
:type s: str
:rtype: List[List[str]]
"""
return [[s[:i]] + rest for i in range(1, len(s)+1) if s[:i]==s[i-1::-1] for rest in self.partition(s[i:])] or [[]]
if __name__=='__main__':
s = raw_input()
solution = Solution()
result = solution.partition(s)
print(result)
|
[
"jiangshen95@163.com"
] |
jiangshen95@163.com
|
e98eb7f57fdba6490262bb70449fd21f32900d83
|
e4d26cf840606b53354f2930d0825556f1669ce9
|
/settings.py
|
42f70e663a23db0c7b60a817fb2c345f9aa091d5
|
[] |
no_license
|
laisee/taiaha
|
a031561898b99f7183658c88dc2a1986629e6b9e
|
aedd61c36d03acf2c16e81cd21591072dccc114a
|
refs/heads/master
| 2021-01-23T06:45:26.631262
| 2017-04-02T08:37:03
| 2017-04-02T08:37:03
| 86,398,699
| 0
| 1
| null | 2017-03-28T15:47:58
| 2017-03-28T00:52:44
|
Python
|
UTF-8
|
Python
| false
| false
| 71
|
py
|
''' Module settings '''
BASE_URL = 'api.quoine.com'
PROTOCOL = "https"
|
[
"tinwald@gmail.com"
] |
tinwald@gmail.com
|
abe6aec458815791248191b3e06ad76a1b3ab93d
|
3bbcda4d74d9aa65e5c705352a4a60d9db0c6a42
|
/third_party/github.com/ansible/awx/awx/ui/conf.py
|
335ca0d386e67b6269434336076d0267207fedf3
|
[
"Apache-2.0"
] |
permissive
|
mzachariasz/sap-deployment-automation
|
82ecccb5a438eaee66f14b4448d4abb15313d989
|
cb4710f07bb01248de4255a0dc5e48eda24e2d63
|
refs/heads/master
| 2023-06-25T15:09:53.505167
| 2021-07-23T18:47:21
| 2021-07-23T18:47:21
| 388,017,328
| 1
| 0
|
Apache-2.0
| 2021-07-23T18:47:22
| 2021-07-21T06:29:55
|
HCL
|
UTF-8
|
Python
| false
| false
| 2,270
|
py
|
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
# Django
from django.utils.translation import ugettext_lazy as _
# Tower
from awx.conf import register, fields
from awx.ui.fields import PendoTrackingStateField, CustomLogoField # noqa
register(
'PENDO_TRACKING_STATE',
field_class=PendoTrackingStateField,
choices=[
('off', _('Off')),
('anonymous', _('Anonymous')),
('detailed', _('Detailed')),
],
label=_('User Analytics Tracking State'),
help_text=_('Enable or Disable User Analytics Tracking.'),
category=_('UI'),
category_slug='ui',
)
register(
'CUSTOM_LOGIN_INFO',
field_class=fields.CharField,
allow_blank=True,
default='',
label=_('Custom Login Info'),
help_text=_('If needed, you can add specific information (such as a legal '
'notice or a disclaimer) to a text box in the login modal using '
'this setting. Any content added must be in plain text or an '
'HTML fragment, as other markup languages are not supported.'),
category=_('UI'),
category_slug='ui',
)
register(
'CUSTOM_LOGO',
field_class=CustomLogoField,
allow_blank=True,
default='',
label=_('Custom Logo'),
help_text=_('To set up a custom logo, provide a file that you create. For '
'the custom logo to look its best, use a .png file with a '
'transparent background. GIF, PNG and JPEG formats are supported.'),
placeholder='data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=',
category=_('UI'),
category_slug='ui',
)
register(
'MAX_UI_JOB_EVENTS',
field_class=fields.IntegerField,
min_value=100,
label=_('Max Job Events Retrieved by UI'),
help_text=_('Maximum number of job events for the UI to retrieve within a '
'single request.'),
category=_('UI'),
category_slug='ui',
)
register(
'UI_LIVE_UPDATES_ENABLED',
field_class=fields.BooleanField,
label=_('Enable Live Updates in the UI'),
help_text=_('If disabled, the page will not refresh when events are received. '
'Reloading the page will be required to get the latest details.'),
category=_('UI'),
category_slug='ui',
)
|
[
"joseph.wright@googlecloud.corp-partner.google.com"
] |
joseph.wright@googlecloud.corp-partner.google.com
|
403616d8eaf0156a9af1909c800def2b4ce84a24
|
93364c613702075e3451390f424b046a13f37064
|
/scripts/packages/ffmpeg4.py
|
cc46dbd57d9eb3fb9c33a792452f0fb4786bb79a
|
[] |
no_license
|
shadimsaleh/pink-python
|
0b4413c6c13542e336f8d2896d578cd138077043
|
c44e3343adce93338f0698f34f779e4a24b2443d
|
refs/heads/master
| 2020-04-01T06:46:45.422886
| 2018-10-11T19:03:27
| 2018-10-11T19:03:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 417
|
py
|
import ffmpeg
input = ffmpeg.input('https://ma7moud3ly.github.io/video.mp4')
text=input.drawtext(text='Pink Python ^_^',
fontcolor='red',
fontsize=30,
box=1,
boxcolor='black@0.5',
x='(w-text_w)/2',
y='(h-text_h)/2'
)
text=text.drawtext(text='By Mahmoud Aly',
fontcolor='white',
fontsize=15,
x='(w-text_w)/2',
y='((h-text_h)/2)+30'
)
output=ffmpeg.output(text, 'text.mp4')
ffmpeg.run(output,overwrite_output=True)
|
[
"ma7moud3ly2012@gmail.com"
] |
ma7moud3ly2012@gmail.com
|
167ee0603464db503156512bac92a82d08162da2
|
601ad3cdceedef1c850b214e1abf67bb03d3ebe8
|
/music/migrations/0001_initial.py
|
c53170e3feaf4a4dfd2c6abc0a908f31809c707e
|
[] |
no_license
|
Ibrokola/kabalMusic
|
d08e509aac09cf8d0641ce35756984766e26a5e5
|
285923df37fda6286a91baa0392d822d437cde03
|
refs/heads/master
| 2021-01-23T00:40:41.823884
| 2017-08-03T08:33:15
| 2017-08-03T08:33:15
| 92,833,862
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,605
|
py
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-03 06:56
from __future__ import unicode_literals
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='Album',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('artist', models.CharField(max_length=500)),
('album_title', models.CharField(max_length=700)),
('genre', models.CharField(max_length=200)),
('album_image', models.FileField(upload_to='')),
('is_favorite', models.BooleanField(default=False)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Song',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('song_title', models.CharField(max_length=250)),
('audo_file', models.FileField(default='', upload_to='')),
('is_favourite', models.BooleanField(default=False)),
('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='music.Album')),
],
),
]
|
[
"babskolawole@gmail.com"
] |
babskolawole@gmail.com
|
28910397ae1bb940b890d46c573966e49c6e1f14
|
01dc30515dbf084f8269cdc1b8a48a8c852de71b
|
/Apps/try.py
|
c2bfeca912f4193341e1bfc4c3d9e4aadf29bab1
|
[] |
no_license
|
dkluis/TVMaze-Management
|
f42fe83cfd7142d16bf58576dd951be039930043
|
0b18f207f889f7d2536ba6df2357c4ce10a8a046
|
refs/heads/master
| 2023-07-28T10:13:27.901219
| 2021-09-02T14:01:34
| 2021-09-02T14:01:34
| 283,617,497
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 418
|
py
|
from docopt import docopt
from Libraries import mariaDB, check_vli, logging
from Libraries import part
from Libraries import find_show_via_name_and_episode
result = find_show_via_name_and_episode('Home', 1, 1, 'Watched', True, '2020-04-20')
print(result)
'''
log = logging(caller="Try", filename='Try')
db = mariaDB()
part = part(db)
print(part.read(showid=7))
result = part.info
print(result, type(result))
'''
|
[
"dkluis@icloud.com"
] |
dkluis@icloud.com
|
aa981af9d186e49939d3c265e2bb4b8ac2311bd2
|
3af525525a6e25d017bdfe3978af76e1e13de913
|
/Rodolfo_Valdivieso/djangoORM/BooksAuthors/BooksAuthors/settings.py
|
02ab03352eb9e2ee80c861f3accee7d25dc210d7
|
[] |
no_license
|
vrodolfo/python_nov_2017
|
957610050acdc344d8d17508750b258d446f13d8
|
08f54899a9e25dcf643b16077c4c687f5b32ec3f
|
refs/heads/master
| 2021-05-07T19:41:04.459906
| 2017-11-19T03:05:28
| 2017-11-19T03:05:28
| 108,898,612
| 0
| 0
| null | 2017-10-30T19:28:41
| 2017-10-30T19:28:41
| null |
UTF-8
|
Python
| false
| false
| 3,136
|
py
|
"""
Django settings for BooksAuthors project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'dm&_cft@5d&z()5em(y9h81_6!wi_s7e#24!wni96(30j5gw3%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'apps.first_app',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'BooksAuthors.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'BooksAuthors.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/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.11/howto/static-files/
STATIC_URL = '/static/'
|
[
"valdivieso_rodolfo@hotmail.com"
] |
valdivieso_rodolfo@hotmail.com
|
38bd78816170e6300ff9fb600597b5d22694b153
|
3a9f2b3d79cf214704829427ee280f4b49dca70a
|
/saigon/rat/RuckusAutoTest/components/lib/zd/rogue_devices_zd.py
|
712c3201710cca5b3a6cff0d6144a31f5cef7fdc
|
[] |
no_license
|
jichunwei/MyGitHub-1
|
ae0c1461fe0a337ef459da7c0d24d4cf8d4a4791
|
f826fc89a030c6c4e08052d2d43af0b1b4b410e3
|
refs/heads/master
| 2021-01-21T10:19:22.900905
| 2016-08-20T03:34:52
| 2016-08-20T03:34:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,211
|
py
|
'''
'''
from RuckusAutoTest.common.utils import list_to_dict
from RuckusAutoTest.components.lib.zd import widgets_zd as wgt
locators = dict(
rogue_tbl_loc = "//table[@id='%s']",
client_tbl_nav_loc = "//table[@id='%s']/tfoot",
client_tbl_filter_txt = "//table[@id='%s']/tfoot//input[@type='text']",
)
tbl_id = dict(
rogue_summary = 'roguesummary',
)
ACTIVE_ROGUE_HDR_MAP = {
'mac': 'mac',
'channel': 'channel',
'radio_type': 'radio',
'rogue_type': 'type',
'is_open': 'encrption',
'ssid': 'ssid',
'last_seen': 'timestamp',
'action': 'action',
}
def _nav_to(zd):
return zd.navigate_to(zd.MONITOR, zd.MONITOR_ROGUE_DEVICES,10)
def _get_all_rogue_devices_briefs(zd, match = {}):
'''
return a list of dict
'''
_nav_to(zd)
tbl = locators['rogue_tbl_loc'] % tbl_id['rogue_summary']
if match:
wgt._fill_search_txt(zd.s, locators['client_tbl_filter_txt'] % tbl_id['rogue_summary'], match.values()[0])
try:
return wgt.get_tbl_rows(zd.s, tbl,
locators['client_tbl_nav_loc'] % tbl_id['rogue_summary'])
finally:
wgt._clear_search_txt(zd.s, tbl)
def _get_rogue_device_brief_by(zd, match, verbose = False):
'''
'''
_nav_to(zd)
return wgt.get_first_row_by(zd.s, locators['rogue_tbl_loc'] % tbl_id['rogue_summary'],
locators['rogue_tbl_nav_loc'] % tbl_id['rogue_summary'], match,
locators['rogue_tbl_filter_txt'] % tbl_id['rogue_summary'], verbose)
def get_active_rouge_devices_list(zd, mac = None):
"""
get information of all rogue devices in page Monitor->Rogue Devices and
returns a list of dictionaries each of which contains information of one client:
[{'mac':'', 'channel':'', 'radio_type':'', 'rogue_type':'', 'is_open':'', 'ssid':'', 'last_seen':'', 'action':''}]
"""
if mac:
return wgt.map_rows(
_get_all_rogue_devices_briefs(zd, match={'mac':mac}),
ACTIVE_ROGUE_HDR_MAP
)
else:
return wgt.map_rows(
_get_all_rogue_devices_briefs(zd),
ACTIVE_ROGUE_HDR_MAP
)
|
[
"tan@xx.com"
] |
tan@xx.com
|
080f113bfcfa6f90f7b52e51405743d372f42196
|
1f148555f389878fdac2079c3e553d52df92697f
|
/pyproof/objects.py
|
b7274a3acd9abaf579e36c345a1447e16bbd5d8f
|
[
"MIT"
] |
permissive
|
jvsiratt/pyproof
|
260cba9339ea113fe70c969b3b5e3350f4752b1c
|
bf7ce159cd2a038b83ffd93845fb5ee9f859f1df
|
refs/heads/master
| 2021-01-10T09:35:26.882783
| 2016-11-14T17:35:53
| 2016-11-14T17:35:53
| 48,866,947
| 3
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,724
|
py
|
"""implementation of logical objects"""
from . import *
#parent class for logical objects
class logical:
left_delimiter = "("
right_delimiter = ")"
def __init__(self):
self.string = ''
self.contents = []
#overloading the ~ operator to perform negation
def __invert__(self):
return negation(self)
#overloading the & operator to perform conjunciton
def __and__(self, other):
if isinstance(other, logical):
return conjunction(self, other)
return "INVALID INPUT: expression2 must be logical"
#overloading the | operator to perform disjunction
def __or__(self, other):
if isinstance(other, logical):
return disjunction(self, other)
return "INVALID INPUT: expression2 must be logical"
#overloading the >> operator to perform conditional
def __rshift__(self, other):
if isinstance(other, logical):
return conditional(self, other)
return "INVALID INPUT: expression2 must be logical"
#overloading the ** operator to perform material equivalence
def __pow__(self, other):
if isinstance(other, logical):
return biconditional(self, other)
return "INVALID INPUT: expression2 must me logical"
#indexing returns entries in contents variable
def __getitem__(self, index):
return self.contents[index]
#comparison compares string identifiers
def __eq__(self, other):
if isinstance(other, logical):
return self.string == other.string
return False
def __repr__(self):
return self.string
def __str__(self):
return self.string
def show(self):
return self.string
#atomic object is a logical constant
class atom(logical):
def __init__(self, label):
if isinstance(label, str):
self.string = label
else:
return "INVALID INPUT: label must be string"
#unary connective NOT
class negation(logical):
def __init__(self, expression1):
self.infix = "~"
if isinstance(expression1, logical):
self.contents = [expression1]
self.string = self.left_delimiter + self.infix + self[0].show() + self.right_delimiter
else:
return "INVALID INPUT: expression must be logical"
#binary connective AND
class conjunction(logical):
def __init__(self, expression1, expression2):
self.infix = "&"
if isinstance(expression1, logical) and isinstance(expression2, logical):
self.contents = [expression1, expression2]
self.string = self.left_delimiter + self[0].show() + self.infix + self[1].show() + self.right_delimiter
else:
return "INVALID INPUT: expressions must be logical"
#binary connective OR
class disjunction(logical):
def __init__(self, expression1, expression2):
self.infix = "|"
if isinstance(expression1, logical) and isinstance(expression2, logical):
self.contents = [expression1, expression2]
self.string = self.left_delimiter + self[0].show() + self.infix + self[1].show() + self.right_delimiter
else:
return "INVALID INPUT: expressions must be logical"
#binary connective IF-THEN
class conditional(logical):
def __init__(self, expression1, expression2):
self.infix = ">>"
if isinstance(expression1, logical) and isinstance(expression2, logical):
self.contents = [expression1, expression2]
self.string = self.left_delimiter + self[0].show() + self.infix + self[1].show() + self.right_delimiter
else:
return "INVALID INPUT: expressions must be logical"
#binary connective IFF
class biconditional(logical):
def __init__(self, expression1, expression2):
self.infix = "**"
if isinstance(expression1, logical) and isinstance(expression2, logical):
self.contents = [expression1, expression2]
self.string = self.left_delimiter + self[0].show() + self.infix + self[1].show() + self.right_delimiter
else:
return "INVALID INPUT: expressions must be logical"
|
[
"John Siratt"
] |
John Siratt
|
d4d2d43875ad5889cfe89fdbb9b2421593fb03b2
|
0eda49f82fee0f7b8247fbea108861d3b54ab872
|
/path_planning/build/catkin_tools_prebuild/catkin_generated/pkg.installspace.context.pc.py
|
7e7f1d92d0cc8d449d15ff7f6ec648d182ff2036
|
[] |
no_license
|
jainSamkit/demo_codes
|
08295b4e9c42e1e8ef5162030ef6489a6d67a8e8
|
9d4a4e9bf1cb0ce4dbf1bba21c06342c942576a2
|
refs/heads/master
| 2020-05-05T03:32:13.138218
| 2019-04-05T13:01:09
| 2019-04-05T13:01:09
| 179,676,469
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 390
|
py
|
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "catkin_tools_prebuild"
PROJECT_SPACE_DIR = "/home/darth/Desktop/sc2_ros/install"
PROJECT_VERSION = "0.0.0"
|
[
"samkit@flytbase.com"
] |
samkit@flytbase.com
|
45bfce2f2787dd46a1cf0a3cee58953d60ab9a06
|
947ccb3fa062a56d7f05182a016bab48f9648eb0
|
/users/views.py
|
e5e0695cda89990f79f6c5a1521fa7a1c877d3c8
|
[] |
no_license
|
royhanmardista/twitterro
|
5300946deb6ab82927820b2d2d995cfbd7dcd04b
|
795b1b277ff15aa17da9c941e8d2b21b0fe9f1f1
|
refs/heads/master
| 2022-12-05T06:48:54.933785
| 2020-01-23T01:45:16
| 2020-01-23T01:45:16
| 234,495,855
| 1
| 0
| null | 2022-11-22T05:15:48
| 2020-01-17T07:33:26
|
Python
|
UTF-8
|
Python
| false
| false
| 1,567
|
py
|
from django.shortcuts import render, redirect
from django.contrib import messages
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
# navigation guard in vue
from django.contrib.auth.decorators import login_required
# Create your views here.
def register(request):
if request.method == 'GET' :
form = UserRegisterForm()
return render(request, 'users/register.html', {'form' : form})
elif request.method == 'POST' :
form = UserRegisterForm(request.POST)
if form.is_valid() :
form.save()
# username = form.cleaned_data.get('username')
messages.success(request, f'Your account is created, you are now able to login')
return redirect('login')
else :
return render(request, 'users/register.html', {'form' : form})
@login_required
def profile(request) :
if request.method == 'POST' :
u_form = UserUpdateForm(request.POST, instance=request.user)
p_form = ProfileUpdateForm(request.POST, request.FILES, instance=request.user.profile)
if u_form.is_valid and p_form.is_valid() :
u_form.save()
p_form.save()
messages.success(request, f'Your account has been updated')
return redirect('profile')
else :
u_form = UserUpdateForm(instance=request.user)
p_form = ProfileUpdateForm(instance=request.user.profile)
context ={
'u_form' : u_form,
'p_form' : p_form
}
return render(request, 'users/profile.html', context)
|
[
"royhanm23@gmail.com"
] |
royhanm23@gmail.com
|
f28080a44bdf249a670a453764b168a3e1e994f8
|
4ce140660f06a2c39f79c951439497ee57dc034f
|
/project/settings.py
|
4e9be61b8736b9534e86e3f422c99f5f6dfd71dc
|
[
"MIT"
] |
permissive
|
kkampardi/photo-bucket
|
ed211ba4046c5ab02f34ca2c15595e5e62282b05
|
1095460e41a0ebce7b45774ed9c136fedfd03c35
|
refs/heads/master
| 2020-12-24T07:52:22.086242
| 2017-09-03T07:59:12
| 2017-09-03T07:59:12
| 73,369,106
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 6,318
|
py
|
# Django settings for example project.
DEBUG = True
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'project.sqlite', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'project',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Los_Angeles'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
import os.path
MEDIA_ROOT = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media'))
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
import os.path
STATIC_ROOT = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static'))
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'assets')),
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'm7^i&pc&^*nx*3y9ui%c68c(lcor-^3_-ma+qjk!5lz7c!wrts'
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
# insert your TEMPLATE_DIRS here
],
'APP_DIRS': True,
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
}]
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'project.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'project.wsgi.application'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'rest_framework',
'project.api',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
AUTH_USER_MODEL = 'api.User'
# Don't complain about leading slashes in URL patterns
SILENCED_SYSTEM_CHECKS = ['urls.W002']
# !!!!!This is for demonstration only!!!!!
AUTHENTICATION_BACKENDS = ['project.api.auth.AlwaysRootBackend']
|
[
"kkampardi@gmail.com"
] |
kkampardi@gmail.com
|
bf8e7fdce50b4135c4623c77f8dcc0205daf92c0
|
0e92e682806724b9e27badd4842e9a9bd8eadce3
|
/app/models/connection.py
|
8f78de0256559efbf4d69f35e3d593d5aeef06de
|
[] |
no_license
|
AlJohri/partyblock
|
f957eeedb59714ac90d1b8a4241f872679c4219e
|
259353b217283f36f3d15757eca35701aaf4ce1a
|
refs/heads/master
| 2020-04-24T19:50:13.370087
| 2014-06-01T15:28:29
| 2014-06-01T15:28:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,044
|
py
|
from . import db, BaseModel
class Connection(BaseModel, db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
provider_id = db.Column(db.String(255))
provider_user_id = db.Column(db.String(255))
access_token = db.Column(db.String(255))
secret = db.Column(db.String(255))
display_name = db.Column(db.String(255))
profile_url = db.Column(db.String(512))
image_url = db.Column(db.String(512))
rank = db.Column(db.Integer)
def __init__(self, **kwargs):
self.id = kwargs.get('id')
self.user_id = kwargs.get('user_id')
self.provider_id = kwargs.get('provider_id')
self.provider_user_id = kwargs.get('provider_user_id')
self.access_token = kwargs.get('access_token')
self.secret = kwargs.get('secret')
self.display_name = kwargs.get('display_name')
self.profile_url = kwargs.get('profile_url')
self.image_url = kwargs.get('image_url')
self.rank = kwargs.get('rank')
|
[
"al.johri@gmail.com"
] |
al.johri@gmail.com
|
833c4201535d99aff6b0aeb53c7acdc6ea4a2cc8
|
e68728a7cd89feab582a62e103206316ef28241a
|
/Tutorial/storingvariables,input,versioncheck.py
|
d94e44e219c3c73ac58b90899083215567935685
|
[] |
no_license
|
aarontinn13/Winter-Quarter-History
|
6222d355aad9ea20f53e67a491e2f5a930aba3a4
|
25ef6e920c7173cce2c726b36fec53c4d633147b
|
refs/heads/master
| 2020-03-31T11:39:15.711952
| 2018-10-09T04:10:26
| 2018-10-09T04:10:26
| 152,185,411
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 156
|
py
|
name = input('What is your name? ')
print('Hello, ', name)
import sys
print(sys.version_info) #good way to check what version of pycharm you are using.
|
[
"tinn.3@buckeyemail.osu.edu"
] |
tinn.3@buckeyemail.osu.edu
|
c2aaa8508102af3110d166eb2fc4748fe6c397f7
|
8e7b60de4dc314a4419d86067db4a65de847bff1
|
/Assignment4/constants.py
|
df086c62fee5e6822f3fab3629d5fdc1591d8ad9
|
[] |
no_license
|
teofilp/Artificial-Intelligence
|
c3ee4a137298fb01770c91c59fc2dfe783e12c9f
|
0950099fd0a6fecbf44a96f6149de217a8829136
|
refs/heads/main
| 2023-05-12T04:45:29.496676
| 2021-06-03T11:10:30
| 2021-06-03T11:10:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 432
|
py
|
# Creating some colors
BLUE = (0, 0, 255)
GRAYBLUE = (50, 120, 120)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
PINK = (255, 192, 203)
# define directions
UP = 0
DOWN = 2
LEFT = 1
RIGHT = 3
SIZE = 50
# define indexes variations
directions = [[-1, 0], [0, 1], [1, 0], [0, -1]]
diagonals = [[-1, 0], [-1, 1], [0, 1], [1, 1],
[1, 0], [1, -1], [0, -1], [-1, -1]]
|
[
"noreply@github.com"
] |
teofilp.noreply@github.com
|
2f1b28b1e52a0f8c02103d5364e192de238fb35a
|
55ab366290ebc791c5ca2708e1c850058e63307b
|
/ScoreBoard.py
|
d3db423c7961add7bdbc9011450f4ed3ef93e4e6
|
[] |
no_license
|
stalker2312/game
|
511e099bda5abfc0b415ffd604753c4ad1f22d60
|
a66e0e7e000a6b7ab5531687a186db2ab784b1e0
|
refs/heads/master
| 2020-06-23T12:05:12.526317
| 2019-07-27T17:22:15
| 2019-07-27T17:22:15
| 198,618,127
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,844
|
py
|
import pygame.font
from pygame.sprite import Group
from pers import Perso
class Scoreboard():
def __init__(self, ai_settings, screen, stats):
#Инициализирует атрибуты подсчета очков."""
self.stats = stats
self.screen = screen
self.screen_rect = screen.get_rect()
self.ai_settings = ai_settings
self.stats = stats
# Настройки шрифта для вывода счета.
self.text_color = (30, 30, 30)
self.font = pygame.font.SysFont(None, 48)
#Подготовка исходного изображения.
self.pre_score()
self.prep_high_score()
self.prep_level()
self.prep_pers()
#Преобразует текущий счет в графическое изображение.
def pre_score(self):
rounded_score = int(round(self.stats.score, -1))
score_str = "{:,}".format(rounded_score)
self.score_image = self.font.render(score_str, True, self.text_color,self.ai_settings.bg_color)
# Вывод счета в правой верхней части экрана.
self.score_rect = self.score_image.get_rect()
self.score_rect.right = self.screen_rect.right - 20
self.score_rect.top = 20
def show_score(self):
#Выводит счет на экран."""
self.screen.blit(self.score_image, self.score_rect)
self.screen.blit(self.high_score_image, self.high_score_rect)
self.screen.blit(self.level_image, self.level_rect)
self.perss.draw(self.screen)
def prep_high_score(self):
"""Преобразует рекордный счет в графическое изображение."""
high_score = int(round(self.stats.high_score, -1))
high_score_str = "{:,}".format(high_score)
self.high_score_image = self.font.render(high_score_str,
True,
self.text_color, self.ai_settings.bg_color)
# Рекорд выравнивается по центру верхней стороны.
self.high_score_rect = self.high_score_image.get_rect()
self.high_score_rect.centerx = self.screen_rect.centerx
self.high_score_rect.top = self.score_rect.top
def prep_level(self):
#Преобразует уровень в графическое изображение."""
self.level_image = self.font.render(str(self.stats.level),
True,
self.text_color, self.ai_settings.bg_color)
# Уровень выводится под текущим счетом.
self.level_rect = self.level_image.get_rect()
self.level_rect.right = self.score_rect.right
self.level_rect.top = self.score_rect.bottom + 10
def prep_pers(self):
#Сообщает количество оставшихся кораблей."""
for pers_number in range(self.stats.pers_left):
self.perss = Group()
pers = Perso( self.screen, self.ai_settings,)
pers.rect.x = 5 + pers_number * pers.rect.width
pers.rect.y = 10
self.perss.add(pers)
|
[
"79242258075@yandex.ru"
] |
79242258075@yandex.ru
|
4939e9e596691cb979fc4634bfb018505f1e93a8
|
af05e8167ba9b73f470b2de2fa390fb03541ddaf
|
/conquestrequest/views.py
|
a88c0cdd83262d7ecf5e37a4f8fc68d8e0777417
|
[] |
no_license
|
nicholeemma/conquest
|
290320230f3a2b8eb4a5b88d6497b3003e9e3b0c
|
1b6c81f9ec4be77c065916ad7fa5a2f5b589310c
|
refs/heads/master
| 2022-10-17T01:49:02.071153
| 2020-06-11T06:32:59
| 2020-06-11T06:32:59
| 271,462,803
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 4,923
|
py
|
from django.shortcuts import render,redirect, get_object_or_404
from django.shortcuts import render,HttpResponseRedirect,HttpResponse
from .models import Item
from django.core.files.storage import FileSystemStorage
from django.http import JsonResponse
from django.urls import reverse
from .forms import ItemForm
from django.utils.datastructures import MultiValueDictKeyError
import json
import requests
import time
def index(request):
content={}
error_message=""
# give all the requests
items = Item.objects.all()
if request.method == "POST":
if "ItemAdd" in request.POST:
# validate the input form
form = ItemForm(request.POST)
# ,request.FILES
if form.is_valid():
name = form.cleaned_data["name"]
description = form.cleaned_data["description"]
filelink = form.cleaned_data["filelink"]
# The following code can be used to upload a picture from desktop after the web is deployed
# myfile = request.FILES['myfile']
# fs = FileSystemStorage()
# filename = fs.save(myfile.name, myfile)
# uploaded_file_url = fs.url(filename)
# a_item = Item(picture=uploaded_file_url, name=name, description=description)
# get_file_url = "../conquestapp"+uploaded_file_url
# print(get_file_url)
# pic = {"file": ("pic", open("../conquestapp/Capture.PNG","rb"),"image/png")}
# print(pic)
# ,"Content-Type":"multipart/form-data"
# create a request based on the input information
url = 'https://developer-demo.australiaeast.cloudapp.azure.com/api/requests/create_request'
# token can be changed here
headers = {"Authorization":"Bearer A4Fo2/hpXIWeLnS6dg0Nqo9mVGo=","Accept":"application/json","Content-Type":"multipart/form-data"}
playloadRequest = {"ChangeSet": {
"Changes": [
"OrganisationUnitID",
"RequestDetail",
"RequestorName"
],
"LastEdit": "2020-06-10T03:03:52.757Z",
"Original": {
"OrganisationUnitID": 0,
"RequestDetail": "string",
"RequestorName": "string"
},
"RequestID": 0,
"Updated": {
"OrganisationUnitID": 0,
"RequestDetail": description,
"RequestorName": name
}
}
}
r = requests.post(url, data=json.dumps(playloadRequest),headers=headers)
print("here is a response")
# get request ID from the response
requestID = str(r.text)
print(requestID)
# add this request to database, so that records can be shown in the webpage
a_item = Item(picture=filelink, name=name, description=description,requestID=requestID)
a_item.save()
# add a picture and link to the request
# since it will take some to response correctly, I made it keep posting until it get a successful response
flag = False
while (flag==False):
playloadDoc = {
"Address": filelink,
"CreateTime": "2020-06-10T13:44:29.090Z",
"ContentType": "image/jpeg",
"DocumentDescription": "string",
"ObjectKey": {
"int32Value": requestID,
"objectType": "ObjectType_Request",
"timestampValue": "2020-06-10T03:27:39.696Z"
}
}
urlAddDoc = "https://developer-demo.australiaeast.cloudapp.azure.com/api/documents/add_document"
r2 = requests.post(urlAddDoc, data=json.dumps(playloadDoc),headers=headers)
if r2.status_code == 200:
flag = True
print(str(r2.text))
return redirect(reverse("index"))
# if there is something wrong with the input error message will show up
else:
content["show"]=form.errors
error_message = content["show"]
return render(request,"index.html",{"items":items,"show":error_message})
return render(request,"index.html",{"items":items})
|
[
"jiayue@spiraldatagroup.com.au"
] |
jiayue@spiraldatagroup.com.au
|
eff46b9daf12736f78c5244e874c7ef9951d7ea5
|
a95ec84be08a4194d58a0389b25fb539e472f7d4
|
/LightGBM.py
|
62265b824592203396aebc84e38f0ba9ea5e16cc
|
[] |
no_license
|
dvirsimhon/Boosting-Algorithm
|
3639743f318a236755f817f2c6dca021d8b8cf78
|
15358bcff60caee845bf4fb7d4294b60e81915cd
|
refs/heads/main
| 2023-03-07T07:09:58.759460
| 2021-02-22T16:08:45
| 2021-02-22T16:08:45
| 341,257,837
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,218
|
py
|
import lightgbm
import optuna
import sklearn
import databases
import boosting_alg
def basic_LightGBM():
db = databases.get_db("life expectancy")
X_train = db.X_train
y_train = db.y_train
X_test = db.X_test
y_test = db.y_test
lightgbm_model = lightgbm.LGBMRegressor()
lightgbm_model.fit(X_train, y_train)
boosting_alg.training_results(lightgbm_model,X_train, y_train)
boosting_alg.testing_results(lightgbm_model,X_test, y_test)
return
def objective(trial):
db = databases.get_db("life expectancy")
X_train = db.X_train
y_train = db.y_train
num_leaves = int(trial.suggest_loguniform('num_leaves', 20, 100))
n_estimators = int(trial.suggest_loguniform('n_estimators', 1, 100))
max_depth = int(trial.suggest_loguniform('max_depth', 1, 50))
subsample_for_bin = int(trial.suggest_loguniform('subsample_for_bin', 150000, 200000))
clf = lightgbm.LGBMRegressor(num_leaves=num_leaves, max_depth=max_depth, n_estimators=n_estimators,
subsample_for_bin=subsample_for_bin)
return sklearn.model_selection.cross_val_score(clf, X_train, y_train,
n_jobs=-1, cv=3).mean()
def optimize_hyper_parameters_dt():
study = optuna.create_study(direction='maximize')
study.optimize(objective, n_trials=100)
trial = study.best_trial
print('Accuracy: {}'.format(trial.value))
print("Best hyperparameters: {}".format(trial.params))
def LightGBM_comparision():
db = databases.get_db("life expectancy")
X_train = db.X_train
y_train = db.y_train
X_test = db.X_test
y_test = db.y_test
# life exp. best: num_leaves = 34, n_est = 89, max_depth = 2, subsamples for bin = 188219
complex_LightGBM_model = lightgbm.LGBMRegressor(num_leaves=34, max_depth=2, n_estimators=89,
subsample_for_bin=188219)
complex_LightGBM_model.fit(X_train, y_train)
print("basic:")
basic_LightGBM()
print("complex")
boosting_alg.training_results(complex_LightGBM_model,X_train, y_train)
boosting_alg.testing_results(complex_LightGBM_model,X_test, y_test)
|
[
"noreply@github.com"
] |
dvirsimhon.noreply@github.com
|
8117ca189eea6ff3e295b33541c20dc324de2884
|
e91137041dc25ebd683ed009e00241016c57dba7
|
/src/generation.py
|
bafa313793a8f27406b5e417a235aaabd1d448dc
|
[
"MIT"
] |
permissive
|
gdh756462786/DialogRPT
|
772d450ee0d80d21b9380b1d6ebba943d63a2844
|
b8e137e7b5515a16f54304a0fad4b155af130d06
|
refs/heads/master
| 2022-12-21T10:20:40.844206
| 2020-09-23T22:22:58
| 2020-09-23T22:22:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 5,631
|
py
|
# author: Xiang Gao at Microsoft Research AI NLP Group
import torch, pdb
import numpy as np
from shared import download_model
class GPT2Generator:
def __init__(self, path, cuda):
from transformers import GPT2Tokenizer, GPT2LMHeadModel, GPT2Config
self.tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model_config = GPT2Config(n_embd=1024, n_layer=24, n_head=16)
self.model = GPT2LMHeadModel(model_config)
download_model(path)
weights = torch.load(path)
if "lm_head.decoder.weight" in weights:
weights["lm_head.weight"] = weights["lm_head.decoder.weight"]
weights.pop("lm_head.decoder.weight",None)
self.model.load_state_dict(weights)
self.ix_EOS = 50256
self.model.eval()
self.cuda = cuda
if self.cuda:
self.model.cuda()
def predict(self, cxt, topk=3, topp=0.8, beam=10, max_t=30):
conditioned_tokens = self.tokenizer.encode(cxt) + [self.ix_EOS]
len_cxt = len(conditioned_tokens)
tokens = torch.tensor([conditioned_tokens]).view(1, -1)
if self.cuda:
tokens = tokens.cuda()
sum_logP = [0]
finished = []
for _ in range(max_t):
outputs = self.model(tokens)
predictions = outputs[0]
logP = torch.log_softmax(predictions[:, -1, :], dim=-1)
next_logP, next_token = torch.topk(logP, topk)
sumlogP_ij = []
sum_prob = 0
for i in range(tokens.shape[0]):
for j in range(topk):
sum_prob += np.exp(logP[i, j].item())
if sum_prob > topp:
break
if next_token[i, j] == self.ix_EOS:
seq = torch.cat([tokens[i, len_cxt:], next_token[i, j].view(1)], dim=-1)
if self.cuda:
seq = seq.cpu()
seq = seq.detach().numpy().tolist()
prob = np.exp((sum_logP[i] + next_logP[i, j].item()) / len(seq))
hyp = self.tokenizer.decode(seq[:-1]) # don't include EOS
finished.append((prob, hyp))
else:
sumlogP_ij.append((
sum_logP[i] + next_logP[i, j].item(),
i, j))
if not sumlogP_ij:
break
sumlogP_ij = sorted(sumlogP_ij, reverse=True)[:min(len(sumlogP_ij), beam)]
new_tokens = []
new_sum_logP = []
for _sum_logP, i, j in sumlogP_ij:
new_tokens.append(
torch.cat([tokens[i,:], next_token[i, j].view(1)], dim=-1).view(1, -1)
)
new_sum_logP.append(_sum_logP)
tokens = torch.cat(new_tokens, dim=0)
sum_logP = new_sum_logP
return finished
def play(self, topk=3, topp=0.8, beam=10):
while True:
cxt = input('\nContext:\t')
if not cxt:
break
ret = self.predict(cxt, topk=topk, topp=topp, beam=beam)
for prob, hyp in sorted(ret, reverse=True):
print('%.3f\t%s'%(prob, hyp))
class Integrated:
def __init__(self, generator, ranker):
self.generator = generator
self.ranker = ranker
def predict(self, cxt, topk=3, topp=0.8, beam=10, wt_ranker=0.5, max_cxt_turn=2):
prob_hyp = self.generator.predict(cxt, topk=topk, topp=topp, beam=beam)
probs = np.array([prob for prob, _ in prob_hyp])
hyps = [hyp for _, hyp in prob_hyp]
if wt_ranker > 0:
scores_ranker = self.ranker.predict(cxt, hyps, max_cxt_turn=max_cxt_turn)
if isinstance(scores_ranker, dict):
scores_ranker = scores_ranker['final']
scores = wt_ranker * scores_ranker + (1 - wt_ranker) * probs
else:
scores = probs
ret = []
for i in range(len(hyps)):
ret.append((scores[i], probs[i], scores_ranker[i], hyps[i]))
ret = sorted(ret, reverse=True)
return ret
def play(self, topk=3, topp=0.8, beam=10, wt_ranker=0.5):
while True:
cxt = input('\nContext:\t')
if not cxt:
break
ret = self.predict(cxt, topk=topk, topp=topp, beam=beam, wt_ranker=wt_ranker)
for final, prob_gen, score_ranker, hyp in ret:
print('%.3f gen %.3f ranker %.3f\t%s'%(final, prob_gen, score_ranker, hyp))
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--path_generator', '-pg', type=str)
parser.add_argument('--path_ranker', '-pr', type=str)
parser.add_argument('--cpu', action='store_true')
parser.add_argument('--topk', type=int, default=3)
parser.add_argument('--beam', type=int, default=3)
parser.add_argument('--wt_ranker', type=float, default=1.)
parser.add_argument('--topp', type=float, default=0.8)
args = parser.parse_args()
cuda = False if args.cpu else torch.cuda.is_available()
generator = GPT2Generator(args.path_generator, cuda)
if args.path_ranker is None:
generator.play(topk=args.topk, beam=args.beam, topp=args.topp)
else:
from score import get_model
ranker = get_model(args.path_ranker, cuda)
integrated = Integrated(generator, ranker)
integrated.play(topk=args.topk, beam=args.beam, topp=args.topp, wt_ranker=args.wt_ranker)
|
[
"gxiang1228@gmail.com"
] |
gxiang1228@gmail.com
|
bd70146a6b196dad7d046e111e77d31f93ddfdc6
|
14c276db8c957019e7a4685ba3a9fa245cad20c8
|
/flask1/utils/functions.py
|
e28a658b4626e5f6400acad81eb85dde8952a1dd
|
[] |
no_license
|
ThreerEyed/flask_1
|
7d1fa3b6ae35c0a2b80591cd95c63799546abc94
|
98eb5f6257ccfccaa22c84b6cf633c6f2a73d63a
|
refs/heads/master
| 2020-03-19T21:03:27.120163
| 2018-07-11T07:54:31
| 2018-07-11T07:54:31
| 136,927,761
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,348
|
py
|
import os
import redis
from flask import Flask
from user.stu_views import stu_blueprint
from user.views import user_blueprint
from utils.ext_init import ext_init
def create_app():
# 指定静态目录和模板目录的文件位置
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
static_dir = os.path.join(BASE_DIR, 'static')
templates_dir = os.path.join(BASE_DIR, 'templates')
# 在初始化对象的时候,可以在参数中添加一些指定
app = Flask(__name__,
static_folder=static_dir,
template_folder=templates_dir)
# secret_key 秘钥
app.config['SECRET_KEY'] = 'secret_key'
# # session 类型为redis
app.config['SESSION_TYPE'] = 'redis'
# # 添加前缀
app.config['SESSION_KEY_PREFIX'] = 'flask'
app.config['SESSION_REDIS'] = redis.Redis(host='127.0.0.1', port=6379)
# 加载app的第一种方式
# se = Session()
# se.__init__(app=app)
# 加载app的第二种方式
# Session(app=app)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://root:123456@localhost:3306/flask1"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.register_blueprint(blueprint=user_blueprint, url_prefix='/user')
app.register_blueprint(blueprint=stu_blueprint, url_prefix='/stu')
ext_init(app)
return app
|
[
"2622509069@qq.com"
] |
2622509069@qq.com
|
509d5d2a2850aa60c968d20a312e29121e400244
|
14638f1aab4b6a73a2a10b7c245792cb0596a883
|
/translations/CAMINO.py
|
adfbf943f69fcf2c33e790cf5f60a9869596512b
|
[
"CC0-1.0",
"WTFPL"
] |
permissive
|
kresp0/btn252osm
|
4750e46ddcabf33b630eb2ac130955ce02cdb77c
|
f2e3026f92c8622a1a4b0d13c88b78adca3ba9a4
|
refs/heads/master
| 2021-01-11T02:45:34.542785
| 2016-12-28T17:51:03
| 2016-12-28T17:51:03
| 70,932,754
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,222
|
py
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ogr2osm.py falla con el archivo Valencia/HUSO30/57058/BTN25_ETRS_BCN0623L_CAMINO_line.shp
# porque el "Camí de'l Hort del Llidoner" contiene un carácter de control ("Camí de lHort del Llidoner")
# Hay que editar este shp (por ejemplo con qgis), elegir codificación ISO-8859-15 y arreglar este nombre.
def filterTags(attrs):
if not attrs: return
tags={}
tags.update({'highway':'track'})
tags.update({'surface':'dirt'})
tags.update({'tracktype':'grade2'})
# Nombre
tags.update({'name':'x'})
if attrs['ETIQUETA'] == "":
del tags['name']
else:
tags ['name'] = attrs ['ETIQUETA']
# Situación SITUA_0623 (subterránea, superficial, elevada, vado)
tags.update({'layer':'x'})
if attrs['SITUA_0623'] == '01':
tags.update({'layer':'-1'})
elif attrs['SITUA_0623'] == '02':
del tags['layer']
# tags.update({'layer':'0'})
elif attrs['SITUA_0623'] == '03':
tags.update({'layer':'1'})
elif attrs['SITUA_0623'] == '04':
tags.update({'ford':'yes'})
return tags
|
[
"noreply@github.com"
] |
kresp0.noreply@github.com
|
2ba7d5f87b8075f7a41e92bed08800b1e889bcd9
|
9d427971db6a4e1c95903ed334e6f0fed98973bc
|
/arduino_dev/tester.py
|
6bc6a99f562b4c16edaecbfd5bf770b17ee53278
|
[] |
no_license
|
burck1/Kinect-Mapper
|
58a41aa79604f7c12fe90fb62b86e21384144aeb
|
b77a94ae9a7f6bfc2995a7dcfa69ca5979225d3f
|
refs/heads/master
| 2021-01-18T11:12:46.701676
| 2013-03-08T15:35:03
| 2013-03-08T15:35:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 323
|
py
|
import serial
import time
def measure(ser):
ser.write(get_analog)
time.sleep(1)
while 1:
data += ser.read(ser.inWaiting())
if '\n' in buffer:
return buffer
get_analog = "2/1/9/"
data = ""
ser = serial.Serial('/dev/ptyp5', 9600)
while 1:
data = measure(ser)
#if data != '/n':
print "Analog reading: ", data
|
[
"lx.icomputer@gmail.com"
] |
lx.icomputer@gmail.com
|
591c1a128b98017cbd4309da898ccc96ac5d60ff
|
51f887286aa3bd2c3dbe4c616ad306ce08976441
|
/pybind/slxos/v17r_2_00/routing_system/ipv6/router/ospf/distribute_list/__init__.py
|
b5ed40b38059c555a2c7b1ca875fd96c538025ec
|
[
"Apache-2.0"
] |
permissive
|
b2220333/pybind
|
a8c06460fd66a97a78c243bf144488eb88d7732a
|
44c467e71b2b425be63867aba6e6fa28b2cfe7fb
|
refs/heads/master
| 2020-03-18T09:09:29.574226
| 2018-04-03T20:09:50
| 2018-04-03T20:09:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 10,113
|
py
|
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitarray
import __builtin__
import route_map
import prefix_list
class distribute_list(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module brocade-common-def - based on the path /routing-system/ipv6/router/ospf/distribute-list. Each member element of
the container is represented as a class variable - with a specific
YANG type.
YANG Description: By configuring distribution lists we can filter the routes to be placed in the OSPFv3 route table.OSPFv3 distribution lists can filter routes using information specified in an IPv6 prefix list or a route map.Filtering using route maps has higher priority over filtering using global prefix lists.
"""
__slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_rest_name', '_extmethods', '__route_map','__prefix_list',)
_yang_name = 'distribute-list'
_rest_name = 'distribute-list'
_pybind_generated_by = 'container'
def __init__(self, *args, **kwargs):
path_helper_ = kwargs.pop("path_helper", None)
if path_helper_ is False:
self._path_helper = False
elif path_helper_ is not None and isinstance(path_helper_, xpathhelper.YANGPathHelper):
self._path_helper = path_helper_
elif hasattr(self, "_parent"):
path_helper_ = getattr(self._parent, "_path_helper", False)
self._path_helper = path_helper_
else:
self._path_helper = False
extmethods = kwargs.pop("extmethods", None)
if extmethods is False:
self._extmethods = False
elif extmethods is not None and isinstance(extmethods, dict):
self._extmethods = extmethods
elif hasattr(self, "_parent"):
extmethods = getattr(self._parent, "_extmethods", None)
self._extmethods = extmethods
else:
self._extmethods = False
self.__route_map = YANGDynClass(base=route_map.route_map, is_container='container', presence=False, yang_name="route-map", rest_name="route-map", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use route-map to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
self.__prefix_list = YANGDynClass(base=prefix_list.prefix_list, is_container='container', presence=False, yang_name="prefix-list", rest_name="prefix-list", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use prefix list to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load)
def _path(self):
if hasattr(self, "_parent"):
return self._parent._path()+[self._yang_name]
else:
return [u'routing-system', u'ipv6', u'router', u'ospf', u'distribute-list']
def _rest_path(self):
if hasattr(self, "_parent"):
if self._rest_name:
return self._parent._rest_path()+[self._rest_name]
else:
return self._parent._rest_path()
else:
return [u'ipv6', u'router', u'ospf', u'distribute-list']
def _get_route_map(self):
"""
Getter method for route_map, mapped from YANG variable /routing_system/ipv6/router/ospf/distribute_list/route_map (container)
YANG Description: Use route-map to control routes learned by OSPFv3
"""
return self.__route_map
def _set_route_map(self, v, load=False):
"""
Setter method for route_map, mapped from YANG variable /routing_system/ipv6/router/ospf/distribute_list/route_map (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_route_map is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_route_map() directly.
YANG Description: Use route-map to control routes learned by OSPFv3
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=route_map.route_map, is_container='container', presence=False, yang_name="route-map", rest_name="route-map", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use route-map to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """route_map must be of a type compatible with container""",
'defined-type': "container",
'generated-type': """YANGDynClass(base=route_map.route_map, is_container='container', presence=False, yang_name="route-map", rest_name="route-map", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use route-map to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)""",
})
self.__route_map = t
if hasattr(self, '_set'):
self._set()
def _unset_route_map(self):
self.__route_map = YANGDynClass(base=route_map.route_map, is_container='container', presence=False, yang_name="route-map", rest_name="route-map", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use route-map to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
def _get_prefix_list(self):
"""
Getter method for prefix_list, mapped from YANG variable /routing_system/ipv6/router/ospf/distribute_list/prefix_list (container)
YANG Description: Use prefix list to control routes learned by OSPFv3
"""
return self.__prefix_list
def _set_prefix_list(self, v, load=False):
"""
Setter method for prefix_list, mapped from YANG variable /routing_system/ipv6/router/ospf/distribute_list/prefix_list (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_prefix_list is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_prefix_list() directly.
YANG Description: Use prefix list to control routes learned by OSPFv3
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=prefix_list.prefix_list, is_container='container', presence=False, yang_name="prefix-list", rest_name="prefix-list", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use prefix list to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """prefix_list must be of a type compatible with container""",
'defined-type': "container",
'generated-type': """YANGDynClass(base=prefix_list.prefix_list, is_container='container', presence=False, yang_name="prefix-list", rest_name="prefix-list", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use prefix list to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)""",
})
self.__prefix_list = t
if hasattr(self, '_set'):
self._set()
def _unset_prefix_list(self):
self.__prefix_list = YANGDynClass(base=prefix_list.prefix_list, is_container='container', presence=False, yang_name="prefix-list", rest_name="prefix-list", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'cli-compact-syntax': None, u'info': u'Use prefix list to control routes learned by OSPFv3', u'cli-sequence-commands': None}}, namespace='urn:brocade.com:mgmt:brocade-ospfv3', defining_module='brocade-ospfv3', yang_type='container', is_config=True)
route_map = __builtin__.property(_get_route_map, _set_route_map)
prefix_list = __builtin__.property(_get_prefix_list, _set_prefix_list)
_pyangbind_elements = {'route_map': route_map, 'prefix_list': prefix_list, }
|
[
"badaniya@brocade.com"
] |
badaniya@brocade.com
|
5ddff3086f082dcce6fd39c0b9e373a9d21aadc6
|
369adb23b6b94cefeb5545ea6ae0f09c9e5d3fd8
|
/venv/bin/flask
|
fbfd1151b337065f604236ae45792b744669cfc5
|
[] |
no_license
|
yzjiangyang/flask-book-catalog
|
b861e58412d3d14d963951d71684c23e2f756404
|
e73f4de7a19fa55fe9ce2e62f3ff1b9040461900
|
refs/heads/master
| 2023-05-23T18:57:46.855823
| 2021-07-06T21:48:11
| 2021-07-06T21:48:11
| 383,381,709
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 239
|
#!/Users/Yang/Python/book_catalog/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flask.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
|
[
"yzjiangyang123@163.com"
] |
yzjiangyang123@163.com
|
|
2373c43d24c2bc34bcebf4ed8fdbf821e9137162
|
d462c3a35af48ed93477e5f69a474a5133b475b1
|
/Python/Python customized/DAY1/Demo1_scripts/Day1_scripts/4_numbers.py
|
4c4d01f2d1bf95f0a65d848c361dc06d4dd134ae
|
[] |
no_license
|
sandeep24789/Python
|
52713df4be6fc47fc02b3631481506433e70aab2
|
86b983d7b5d8b09aa7952722fa3962d3551920ac
|
refs/heads/master
| 2021-05-03T06:39:22.404047
| 2018-02-07T10:29:01
| 2018-02-07T10:29:01
| 120,599,693
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 174
|
py
|
import os
os.system('cls')
myint= 7
myfloat1 = 7.65
myfloat2 = float(7.9265)
print("MyInt= "+str(myint))
print("MyFloat1 = "+str(myfloat1))
print("MyFloat2 = "+str(myfloat2))
|
[
"Training_C2a.05.01@accenture.com"
] |
Training_C2a.05.01@accenture.com
|
efbf59f66e33f035081b8f643a9e1518983c28a0
|
f76c0a9e29ddf1b89952d65730e5c0b545d4a054
|
/solucoes/TiagoPedrosa/lista2/exercicio10.py
|
3087956d30ec7b9bbd7687615fa354609241ca1d
|
[] |
no_license
|
ai2-education-fiep-turma-2/05-python
|
d20b20d96b167b8b65e5e341b371aa012e4e514c
|
5d072a11b798b1d080cdd47a23726eb2cdcbd5a5
|
refs/heads/master
| 2023-03-26T18:05:27.477433
| 2021-03-30T16:35:42
| 2021-03-30T16:35:42
| 288,202,197
| 0
| 15
| null | 2020-09-08T12:32:37
| 2020-08-17T14:28:46
|
Jupyter Notebook
|
UTF-8
|
Python
| false
| false
| 200
|
py
|
def multSum():
limite = (int(input("Limite: ")))
soma = 0
for i in range(0,limite + 1):
if (i % 3 == 0 or i % 5 == 0):
soma += i
print("A soma é ", soma)
multSum()
|
[
"tgopedrosa@gmail.com"
] |
tgopedrosa@gmail.com
|
22ee5d8c19b72c0839e5d2f84698f41393dbfe4d
|
7ca241cce9b472a9b446a7bad637cc14768ac956
|
/Python/Regex And Parsing/Validating__Roman_Numerals.py
|
dd51b162b72e60005fc53a7b33551b2de78088dd
|
[
"MIT"
] |
permissive
|
abivilion/Hackerank-Solutions-
|
b872e0ac7a61db9512127aac974b129d9b02a7d2
|
e195fb1fce1588171cf12d99d38da32ca5c8276a
|
refs/heads/master
| 2023-07-13T21:43:13.089190
| 2021-08-25T03:18:46
| 2021-08-25T03:18:46
| 394,753,941
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 222
|
py
|
thousand = "(?:(M){0,3})?"
hundred = "(?:(D?(C){0,3})|(CM)|(CD))?"
ten = "(?:(L?(X){0,3})|(XC)|(XL))?"
unit = "(?:(V?(I){0,3})|(IX)|(IV))?"
regex_pattern = r"^" + thousand + hundred + ten + unit + "$"
|
[
"noreply@github.com"
] |
abivilion.noreply@github.com
|
eafea9af363afd6c769dd848ba5f29ea8e21b6d0
|
ba8a61d7515eb15c38eadbd79ab8f3f95d4350a7
|
/performance_old.py
|
68d394da36f6d33c515b6d377439d74ad3704aa1
|
[
"Apache-2.0"
] |
permissive
|
zacQin/ID_card_identification_2
|
0331ec6013866f1af45f8d1890a57cbfae18c80a
|
b359e8b0d26352ce359b280c36f2ffa837aa9611
|
refs/heads/master
| 2020-04-14T15:12:51.130250
| 2019-01-03T03:51:29
| 2019-01-03T03:51:29
| 163,918,871
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,960
|
py
|
import cv2
import pandas as pd
from face_alignment_1 import face_alignment
from face_base import find_face
from face_base import license_detection_Rough
from face_base import license_detection_Detailed
from smooth_sharpen import smooth
from smooth_sharpen import sharpen
from face_base import divide_image
from face_base import face_wipeoff
from info_divide import info_divide
from PIL import Image
import pytesseract
import numpy as np
import imutils
img = cv2.imread('image/64B44403DAE21C578A2C0B986213BC2F.jpg')
B,G,R = cv2.split(img)
width,height,layer = img.shape
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face,face_plus,img,img_gray = find_face(img)
print('secenon')
lincese ,lincese_gray = license_detection_Rough(img,img_gray,face_plus)
cv2.imshow('license3',lincese)
cv2.waitKey(0)
lincese,lincese_gray = face_alignment(lincese,lincese_gray)
cv2.imshow('license3',lincese)
cv2.waitKey(0)
face,face_plus,img,img_gray = find_face(lincese)
lincese ,lincese_gray = license_detection_Detailed(lincese,lincese_gray,face_plus)
cv2.imshow('license3',lincese)
cv2.waitKey(0)
# cv2.imshow('license3',lincese_gray)
# cv2.waitKey(0)
def lll(img):
width,height,layer = img.shape
for i in range(width):
for ii in range(height):
a = abs(int(img[i][ii][0]) - int(img[i][ii][1])) < 5
b = abs(int(img[i][ii][0]) - int(img[i][ii][2])) < 5
c = abs(int(img[i][ii][1]) - int(img[i][ii][2])) < 5
aa = img[i][ii][0] < 160
bb = img[i][ii][1] < 160
cc = img[i][ii][2] < 160
if a and b and c and aa and bb and cc:
img[i][ii][0] = 25
img[i][ii][1] = 25
img[i][ii][2] = 25
return img
def ll(img):
width,height = img.shape
for i in range(width):
for ii in range(height):
# a = abs(int(img[i][ii]) - int(img[i][ii])) < 5
# b = abs(int(img[i][ii]) - int(img[i][ii])) < 5
# c = abs(int(img[i][ii]) - int(img[i][ii])) < 5
aa = img[i][ii] < 70
if aa :
img[i][ii] = int(img[i][ii]/2)
return img
# lincese = smooth(lincese)
# lincese = sharpen(lincese)
# lincese_gray_noface = face_wipeoff(lincese_gray,face_plus)
# cv2.imshow('noface',lincese_gray_noface)
# cv2.waitKey(0)
upper,lower = divide_image(lincese,face_plus)
# ret, binary = cv2.threshold(lincese_gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_TRIANGLE)
# lincese_gray_noface = face_wipeoff(lincese_gray,face_plus)
# index_ = info_divide(lincese_gray,face_plus)
cv2.imshow('upper',upper)
cv2.waitKey(0)
cv2.imshow('lower',lower)
cv2.waitKey(0)
cv2.imwrite('upper.png',upper)
cv2.imwrite('lower.png',lower)
# ss= pytesseract.image_to_data(upper,lang='chi_sim',output_type = 'dict')
# cv2.waitKey(0)
# text2 = pytesseract.image_to_string(lower,lang='chi_sim')
# print(text1)
#
# cv2.imshow('license',lincese_gray)
# cv2.waitKey(0)
print()
|
[
"noreply@github.com"
] |
zacQin.noreply@github.com
|
4030e33569cbe533a770e86abeea0227fc99ce4a
|
1b894d8617ca7ded2dc7172bfd7234bee9721f94
|
/ex6.py
|
58a41a7241cc56b2bf51a408b49eec179c9de349
|
[] |
no_license
|
Saurabh-Thakre/My-python-code
|
ddaec22656b9aee082547f2b41166358ccfc62b1
|
8fbc4816bbd9b37ee1dee7810dd0f9f81d15ca2a
|
refs/heads/master
| 2023-03-16T18:18:08.176960
| 2021-03-08T15:33:06
| 2021-03-08T15:33:06
| 343,020,502
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 399
|
py
|
x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who knows %s and those who %s." % (binary, do_not)
print x
print y
print "I said: %r." % x
print "I also said: '%s'." % y
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % hilarious
w = "This is the left side of..."
e = "a string with a right side."
print w + e
|
[
"thakre.sau@gmail.com"
] |
thakre.sau@gmail.com
|
82f67372d223dd8775c490792f32f71c5d790caf
|
b05a2a6d3c148a6bfcb243e7e53c7bb137e23e5c
|
/lib/connector/bibhttp.py
|
2c519ce79f3da5a1f19c1aff4b8bdaafd833cc73
|
[] |
no_license
|
bopopescu/canopsis-edc
|
b9ee122bde697630c8f0410cc4b2e6b2e045be4e
|
bf070da7b22adad7c327cb7f337bfd08245b3e05
|
refs/heads/master
| 2022-11-26T19:48:50.618226
| 2014-05-12T16:44:22
| 2014-05-12T16:44:22
| 282,184,585
| 0
| 0
| null | 2020-07-24T09:59:48
| 2020-07-24T09:59:47
| null |
UTF-8
|
Python
| false
| false
| 911
|
py
|
import httplib
class BibHttps(object):
'''
classdocs
'''
conn = None
hostname = None
certfile = None
port = None
def __init__(self,hostname,certfile,port):
'''
Constructor
'''
self.hostname = hostname
self.certfile = certfile
self.port = port
self.conn = httplib.HTTPSConnection(
hostname,
key_file = certfile,
cert_file = certfile,
port=port
)
def get(self,file):
self.conn.putrequest('GET', file)
self.conn.endheaders()
resp = self.conn.getresponse()
return resp
def __unicode__(self):
return self.hostname+":"+self.port
def __str__(self):
return repr(self.__unicode__())
def client(hostname,certfile,port):
return BibHttps(hostname,certfile,port)
|
[
"vincent.candeau@panamedia-international.com"
] |
vincent.candeau@panamedia-international.com
|
8dcf46da5d5251054ab4d0634cea363cc90f9a25
|
86541e6a9463a0de1d1b102426c73bc731b30349
|
/blog/urls.py
|
8fa09a0ea8fdeaed3a7eb3ec917a5ceadf8bcdd0
|
[] |
no_license
|
smapotato/MyBlog
|
f1cc3148f19b19ba4f5f4437b90cffd8b0ddbe91
|
ff058c5c5d067437d2e2799a44aae0bf17ff22ba
|
refs/heads/master
| 2020-03-18T17:26:28.626358
| 2018-05-27T09:07:12
| 2018-05-27T09:07:12
| 135,029,369
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 431
|
py
|
from django.urls import path, re_path
from . import views
app_name = "blog"
urlpatterns = [
# https:localhost:8000/blog/1
path("", views.blog_list, name="blog_list"),
path("<int:blog_id>", views.blog_detail, name="blog_detail"),
path("type/<int:id>", views.blogs_with_type, name="blog_with_type"),
path("date", views.blogs_with_date, name="blog_with_date"),
path("about", views.about_me, name="about_me")
]
|
[
"15702431853@163.com"
] |
15702431853@163.com
|
eccdeba8d12343adba43b43885619a77658f8698
|
94c7bcc7fa0749ef3890af6dac39341c14f5d259
|
/tensorflow/compiler/tests/function_test.py
|
fbc3c994d163a504351fcccd1ba71a0997e6516f
|
[
"Apache-2.0"
] |
permissive
|
lgeiger/tensorflow
|
e75e32cd23a45d29bac1fc10eda23499a66d188a
|
1bf9ec7f8545c7aa6fa915c6576a3b984af59ded
|
refs/heads/master
| 2023-08-18T23:16:38.380820
| 2018-04-26T20:47:51
| 2018-04-26T20:47:51
| 127,307,734
| 2
| 1
|
Apache-2.0
| 2018-03-29T15:02:37
| 2018-03-29T15:02:36
| null |
UTF-8
|
Python
| false
| false
| 5,037
|
py
|
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Test cases for Tensorflow functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.compiler.tests.xla_test import XLATestCase
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import function
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.platform import googletest
@test_util.with_c_api
class FunctionTest(XLATestCase):
def testFunction(self):
"""Executes a simple TensorFlow function."""
def APlus2B(a, b):
return a + b * 2
aval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
bval = np.array([5, 6, 7, 8]).reshape([2, 2]).astype(np.float32)
expected = APlus2B(aval, bval)
with self.test_session() as sess:
@function.Defun(dtypes.float32, dtypes.float32)
def Foo(a, b):
return APlus2B(a, b)
a = constant_op.constant(aval, name="a")
b = constant_op.constant(bval, name="b")
with self.test_scope():
call_f = Foo(a, b)
result = sess.run(call_f)
self.assertAllClose(result, expected, rtol=1e-3)
def testNestedFunctions(self):
"""Executes two nested TensorFlow functions."""
def TimesTwo(x):
return x * 2
def APlus2B(a, b):
return a + TimesTwo(b)
aval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
bval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
expected = APlus2B(aval, bval)
with self.test_session() as sess:
@function.Defun(dtypes.float32, dtypes.float32)
def Foo(a, b):
return APlus2B(a, b)
a = constant_op.constant(aval, name="a")
b = constant_op.constant(bval, name="b")
with self.test_scope():
call_g = Foo(a, b)
result = sess.run(call_g)
self.assertAllClose(result, expected, rtol=1e-3)
def testFunctionMultipleRetvals(self):
"""Executes a function with multiple return values."""
# This function will run on the XLA device
def Func(a, b):
return a + b, a - b
aval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
bval = np.array([5, 6, 7, 8]).reshape([2, 2]).astype(np.float32)
expected = Func(aval, bval)
with self.test_session() as sess:
@function.Defun(dtypes.float32, dtypes.float32)
def Foo(a, b):
return Func(a, b)
a = constant_op.constant(aval, name="a")
b = constant_op.constant(bval, name="b")
with self.test_scope():
call_f = Foo(a, b)
result = sess.run(call_f)
self.assertAllClose(result, expected, rtol=1e-3)
def testCompileTimeConstantsInDefun(self):
"""Tests that XLA handles compile-time constants in defuns."""
with self.test_session() as sess:
@function.Defun(dtypes.float32, dtypes.int32, dtypes.int32)
def Foo(a, c, d):
# c and d must be known at compile time
x = array_ops.slice(a, c, d)
return x
a = array_ops.placeholder(dtypes.float32)
c = array_ops.placeholder(dtypes.int32, shape=[4])
d = array_ops.placeholder(dtypes.int32, shape=[4])
with self.test_scope():
call_f = Foo(a, c, d)
result = sess.run(call_f, feed_dict={
a: np.ones([1, 4, 4, 1]),
c: [0, 0, 0, 0],
d: [1, 2, 2, 1]})
self.assertAllEqual(np.ones([1, 2, 2, 1]), result)
# TODO(b/36139787): Re-enable this test when noinline works again.
def DISABLED_testFunctionsNoInline(self):
@function.Defun(dtypes.float32, noinline=True)
def TimesTwo(x):
return x * 2
@function.Defun(dtypes.float32, dtypes.float32)
def APlus2B(a, b):
return a + TimesTwo(b)
aval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
bval = np.array([4, 3, 2, 1]).reshape([2, 2]).astype(np.float32)
expected = aval + bval * 2
with self.test_session() as sess:
with self.test_scope():
a = array_ops.placeholder(dtypes.float32, name="a")
b = array_ops.placeholder(dtypes.float32, name="b")
call = APlus2B(a, b)
result = sess.run(call, {a: aval, b: bval})
self.assertAllClose(result, expected, rtol=1e-3)
if __name__ == "__main__":
googletest.main()
|
[
"gardener@tensorflow.org"
] |
gardener@tensorflow.org
|
55783bd684a31e0636091192094aecde6021cb7f
|
bfd75153048a243b763614cf01f29f5c43f7e8c9
|
/1906101093-陈泰江/第二次课后作业/6.py
|
7f0be3fea1518f32befd6043d25aec2946514f15
|
[] |
no_license
|
gschen/sctu-ds-2020
|
d2c75c78f620c9246d35df262529aa4258ef5787
|
e1fd0226b856537ec653c468c0fbfc46f43980bf
|
refs/heads/master
| 2021-01-01T11:06:06.170475
| 2020-07-16T03:12:13
| 2020-07-16T03:12:13
| 239,245,834
| 17
| 10
| null | 2020-04-18T13:46:24
| 2020-02-09T04:22:05
|
Python
|
UTF-8
|
Python
| false
| false
| 389
|
py
|
# 16.(使用def函数完成)编写一个函数,输入n为偶数时,
# 调用函数求1/2+1/4+...+1/n,当输入n为奇数时,调用函数1/1+1/3+...+1/n
def res(n):
if n%2==0:
for i in range(2,n+1):
sums=sums+(1/i)
return sums
else:
for i in range(1,n+1,2):
sums=sums+(1/i)
return sums
print(res(6))
|
[
"1844579965@qq.com"
] |
1844579965@qq.com
|
bf488b29fab3bcc25d0f6a80dd37081e4c332e97
|
69901578da8e9e093d273bb5af5fe420d2938135
|
/tn3270/structured_fields.py
|
a1349e6afd791e0f190e76df7c44113291d42ba0
|
[
"ISC"
] |
permissive
|
lowobservable/pytn3270
|
205d9574d8e51ad4c986109b2430004082ebee34
|
7b023bfa3dbf0f50b2e58da3261df55911f1f5d6
|
refs/heads/master
| 2023-08-31T18:06:45.449531
| 2023-08-26T05:13:50
| 2023-08-26T05:13:50
| 204,607,476
| 24
| 7
|
ISC
| 2021-08-31T13:06:20
| 2019-08-27T02:57:45
|
Python
|
UTF-8
|
Python
| false
| false
| 608
|
py
|
"""
tn3270.structured_fields
~~~~~~~~~~~~~~~~~~~~~~~~
"""
from enum import Enum, IntEnum
class StructuredField(IntEnum):
READ_PARTITION = 0x01
ERASE_RESET = 0x03
OUTBOUND_3270DS = 0x40
QUERY_REPLY = 0x81
class ReadPartitionType(IntEnum):
QUERY = 0x02
QUERY_LIST = 0x03
class QueryListRequestType(IntEnum):
LIST = 0x00
EQUIVALENT_AND_LIST = 0x40
ALL = 0x80
class QueryCode(IntEnum):
SUMMARY = 0x80
USABLE_AREA = 0x81
ALPHANUMERIC_PARTITIONS = 0x84
COLOR = 0x86
HIGHLIGHT = 0x87
REPLY_MODES = 0x88
IMPLICIT_PARTITIONS = 0xa6
NULL = 0xff
|
[
"git@ajk.me"
] |
git@ajk.me
|
e03a876b7d56e48ac2f3f96cde981c161616a5e2
|
64ad41c5fda39ca14dafd29d12d24fc8869f3b84
|
/DSA_algo/Binary_search_recursive/main.py
|
686d6cc274a4f79493e9a5f53e601e4ba1948213
|
[] |
no_license
|
vaideheebhise/100daysofCode
|
3cebd1c78652a36e1683242239dcddff851c8f3c
|
78ade82f7011131d8a112d16e4f54aa88af71cc7
|
refs/heads/master
| 2023-08-27T21:17:44.891480
| 2021-10-12T16:43:17
| 2021-10-12T16:43:17
| 369,046,098
| 0
| 0
| null | 2021-10-12T16:16:02
| 2021-05-20T01:32:57
|
Python
|
UTF-8
|
Python
| false
| false
| 372
|
py
|
def binary_search(a, key, l, r):
if l > r:
return -1
else:
m = (l + r) // 2
if key == a[m]:
return m
elif key < a[m]:
return binary_search(a, key, l, m - 1)
elif key > a[m]:
return binary_search(a, key, m + 1, r)
a = [15, 21, 47, 84, 96]
found = binary_search(a, 17, 0, 4)
print(found)
|
[
"vaidehibhise94@gmail.com"
] |
vaidehibhise94@gmail.com
|
5b81f20e824d659ec30e77e0696b01f0e33e5c37
|
fa492ec2b4c5c4c756861e1f8726396e59d7e170
|
/Registrar.py
|
79899d31d3723163b053e35bb85a80d42afaa082
|
[] |
no_license
|
Julian-guillermo-zapata-rugeles/RegistroPantallaBasadoenPID
|
077348b60a10603bccc3610376b7daaa8e1a16ce
|
724d4541b43b5694b99f2e64fee78efdc9b2f5f7
|
refs/heads/master
| 2020-12-05T02:15:30.547446
| 2020-01-05T21:37:28
| 2020-01-05T21:37:28
| 231,979,058
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,998
|
py
|
"""
Julian Guillermo zapata rugeles
julianruggeles@gmail.com
Probado en UBUNTU 16.04 UBUNTU 18.04 LTS / GNU/LINUX
Este script permite realizar un seguimiento fotografico
a aplicaciones con restriccion en el dispositivo.
Ejemplo : si la aplicacion "Pagos" se encuentra en ejecución
el script capturará un pantallazo del equipo cada intervalo configurado
con el fin de realizar un seguimiento de uso apropiado
(Al realizar capturas de pantalla puede violar la privacidad )
se recomienda usarla para pruebas o por Ejemplo llevar un control de qué
paginas visitan sus hijos ó ver explicitamente (mediante capturas) el comportamiento de una persona
en una determinada aplicacion.
recuerde que por legislación algunas practicas pueden no ser apropiadas.
-- No es un Keylogger puesto no registra pulsaciones.
-- Solo realiza un seguimiento fotografico de la pantalla
Dependencias : scrot
sudo apt-get install scrot (400kb size)
(instalacion sencilla a travez de Apt)
Desarollo futuro:
Adaptacion para el sistema operativo WINDOWS 7/10
"""
import os
import time
class observador():
""" Funciones """
def runCapture():
timeGet=os.popen("date").read()
timeGet=timeGet.replace(" ","")
timeGet=timeGet.replace("\n","")
timeGet="scrot >> "+timeGet+".png"
os.system(timeGet)
def activeProgram(programName):
process="pgrep "+programName
pipNumber=os.popen(process).read()
if len(pipNumber)>2:
return True
else:
return False
if __name__ == '__main__':
""" Inicio del programa """
IntervaloTiempo = 5 # Tiempo en segundos cada cuanto hacer una captura
programName = "firefox " # Nombre del programa a seguir (Consulte el nombre del proceso para dicho paso)
while True:
retorno=observador.activeProgram(programName)
if retorno==True:
observador.runCapture()
time.sleep(IntervaloTiempo )
|
[
"noreply@github.com"
] |
Julian-guillermo-zapata-rugeles.noreply@github.com
|
6cfd93825cbd61552c664d7325b0ed8e0bec56be
|
9365556a67e0a996d0e3bfa052f7f566c27eea2f
|
/check.py
|
6ec3554c6bacf26a0e4d6146ed94cc774d40a276
|
[] |
no_license
|
Siddhesh777/temp_prediction
|
6499f0651be34660656fa87e282d3415075d26dd
|
0394cb6d0d7a923f601368afca6a3166098eb152
|
refs/heads/master
| 2023-03-20T19:07:32.168502
| 2019-12-02T07:39:14
| 2019-12-02T07:39:14
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 860
|
py
|
import importlib
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
#from resnet_sw import *
filename = "filtered_daejon_test/ArrayOfImages.npy"
savefile = "filtered_daejon_test/newArrayOfImages.npy"
data = np.load(filename)
"""
print("The number of train samples are:",len(data))
#print("The number images in one sample are:", len(data[0]))
image_data = []
for k in range(len(data)-6):
dataX = []
for l in range(k,k+6):
dataX.append(data[l])
image_data.append(dataX)
np.save(filename, image_data)
"""
new_data = [[],[],[],[],[],[]]
for i in range(len(data)):
for j in range(len(data[0])):
new_data[j].append(data[i][j])
np.save(savefile,new_data)
#print(data[0])
#cv2.imshow("Image",data[0])
#woha = data[0].flatten()
#print(woha)
#cv2.imshow("Image", woha)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
|
[
"kanybekasanbekov@gmail.com"
] |
kanybekasanbekov@gmail.com
|
4a8d9f6d69f01f33e91366d418033c25a63fff0d
|
d69398b9cb1f47f845c3bac1a3b0a7962cd4b63d
|
/exmaple2.py
|
735150521c9b57cf7f23f3b2eb97a3ff9e842416
|
[] |
no_license
|
sureshallaboyina1001/python
|
be1ed86dc22be3cbc4bf521b588f2707b28896a9
|
80249a6f4fa7bed71b5f46e2678e4be217387951
|
refs/heads/master
| 2020-03-21T17:34:56.463953
| 2018-06-29T10:40:05
| 2018-06-29T10:45:51
| 138,840,625
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 186
|
py
|
tupl=()
n=int(input())
print("How many elemnts",n)
for i in range(n):
print("enter name:",end(""))
str= input()
print("enter age:")
tupl.append(str)
print(tupl)
|
[
"yadavsureshkumar40@gmail.com"
] |
yadavsureshkumar40@gmail.com
|
2c35c16cf9fae18d48f8e1fb03f22a5b6ce0fd7f
|
c743a81ad72a19a99750de14213a7a6781141108
|
/tweet/migrations/0001_initial.py
|
7c3982c4bf1417990b9e0ed7d34564caf5aa1586
|
[] |
no_license
|
Maingart/samplesample
|
a84b415540f724f1773e422dffa7312b0f30a438
|
0be9846dfca5a000e16d947f543e0c2c79f2222e
|
refs/heads/main
| 2023-07-11T07:07:20.890905
| 2021-07-29T20:24:52
| 2021-07-29T20:24:52
| 361,077,285
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 854
|
py
|
# Generated by Django 3.2 on 2021-04-23 00:42
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='Tweet',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(max_length=280)),
('photo', models.CharField(max_length=256)),
('created', models.DateTimeField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
|
[
"maingartvlad@outlook.com"
] |
maingartvlad@outlook.com
|
b332b45ca383fcfb85f866cb82cdb5b65b111c1f
|
dd45981db15a9cdd80f6d91482dcd255f1870637
|
/code/lxmert/src/tasks/lxrt/entry.py
|
c86b3bf3239aa611787f33315fc66e94b0bb09da
|
[] |
no_license
|
zhangqibot/KDD2020_mutilmodalities
|
8656e147e5d34a2520f8e5217bb693f199be9e0c
|
38e89f7bb7daa566df72c0fc79cb2194dee1821f
|
refs/heads/master
| 2022-10-21T09:06:16.551505
| 2020-06-16T12:22:32
| 2020-06-16T12:22:32
| 272,988,384
| 2
| 0
| null | 2020-06-17T13:57:39
| 2020-06-17T13:57:39
| null |
UTF-8
|
Python
| false
| false
| 5,259
|
py
|
# coding=utf-8
# Copyright 2019 project LXRT.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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.
import os
import torch
import torch.nn as nn
from lxrt.tokenization import BertTokenizer
from lxrt.modeling import LXRTFeatureExtraction as VisualBertForLXRFeature, VISUAL_CONFIG
class InputFeatures(object):
"""A single set of features of data."""
def __init__(self, input_ids, input_mask, segment_ids):
self.input_ids = input_ids
self.input_mask = input_mask
self.segment_ids = segment_ids
def convert_sents_to_features(sents, max_seq_length, tokenizer):
"""Loads a data file into a list of `InputBatch`s."""
features = []
for (i, sent) in enumerate(sents):
tokens_a = tokenizer.tokenize(sent.strip())
# Account for [CLS] and [SEP] with "- 2"
if len(tokens_a) > max_seq_length - 2:
tokens_a = tokens_a[:(max_seq_length - 2)]
# Keep segment id which allows loading BERT-weights.
tokens = ["[CLS]"] + tokens_a + ["[SEP]"]
segment_ids = [0] * len(tokens)
input_ids = tokenizer.convert_tokens_to_ids(tokens)
# The mask has 1 for real tokens and 0 for padding tokens. Only real
# tokens are attended to.
input_mask = [1] * len(input_ids)
# Zero-pad up to the sequence length.
padding = [0] * (max_seq_length - len(input_ids))
input_ids += padding
input_mask += padding
segment_ids += padding
assert len(input_ids) == max_seq_length
assert len(input_mask) == max_seq_length
assert len(segment_ids) == max_seq_length
features.append(
InputFeatures(input_ids=input_ids,
input_mask=input_mask,
segment_ids=segment_ids))
return features
def set_visual_config(args):
VISUAL_CONFIG.l_layers = args.llayers
VISUAL_CONFIG.x_layers = args.xlayers
VISUAL_CONFIG.r_layers = args.rlayers
class LXRTEncoder(nn.Module):
def __init__(self, args, max_seq_length, mode='x'):
super().__init__()
self.max_seq_length = max_seq_length
set_visual_config(args)
# Using the bert tokenizer
self.tokenizer = BertTokenizer.from_pretrained(
"bert-base-uncased",
do_lower_case=True
)
# Build LXRT Model
self.model = VisualBertForLXRFeature.from_pretrained(
args.basebert,mode=mode
)
if args.from_scratch:
print("initializing all the weights")
self.model.apply(self.model.init_bert_weights)
def multi_gpu(self):
self.model = nn.DataParallel(self.model)
@property
def dim(self):
return 768
def forward(self, sents, feats, visual_attention_mask=None):
train_features = convert_sents_to_features(
sents, self.max_seq_length, self.tokenizer)
input_ids = torch.tensor([f.input_ids for f in train_features], dtype=torch.long).cuda()
input_mask = torch.tensor([f.input_mask for f in train_features], dtype=torch.long).cuda()
segment_ids = torch.tensor([f.segment_ids for f in train_features], dtype=torch.long).cuda()
output = self.model(input_ids, segment_ids, input_mask,
visual_feats=feats,
visual_attention_mask=visual_attention_mask)
return output
def save(self, path):
torch.save(self.model.state_dict(),
os.path.join("%s_LXRT.pth" % path))
def load(self, path):
# Load state_dict from snapshot file
print("Load LXMERT pre-trained model from %s" % path)
state_dict = torch.load("%s_LXRT.pth" % path)
new_state_dict = {}
for key, value in state_dict.items():
if key.startswith("module."):
new_state_dict[key[len("module."):]] = value
else:
new_state_dict[key] = value
state_dict = new_state_dict
# Print out the differences of pre-trained and model weights.
load_keys = set(state_dict.keys())
model_keys = set(self.model.state_dict().keys())
print()
print("Weights in loaded but not in model:")
for key in sorted(load_keys.difference(model_keys)):
print(key)
print()
print("Weights in model but not in loaded:")
for key in sorted(model_keys.difference(load_keys)):
print(key)
print()
# Load weights to model
self.model.load_state_dict(state_dict, strict=False)
|
[
"1909856661@qq.com"
] |
1909856661@qq.com
|
5a9f42af00ea86efe4b8e80d495fcecfbd62b44a
|
bbc1b385e8f822c1184575a6ab2b2d65e0e6aaac
|
/arc/parserTest.py
|
54e01d49cc42fa5939e62e1ad76964f1fe0005ac
|
[
"MIT"
] |
permissive
|
yunsiechung/ARC
|
35f03db1c32c4b005a1a88564357ac0711aabf46
|
a99988916b2dfa4347c0ad2be3e6d72ccc84c40e
|
refs/heads/master
| 2020-06-30T01:51:19.630292
| 2019-08-05T14:28:35
| 2019-08-05T14:53:22
| 200,684,242
| 0
| 0
|
MIT
| 2019-08-05T15:42:18
| 2019-08-05T15:42:18
| null |
UTF-8
|
Python
| false
| false
| 7,823
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains unit tests for the parser functions
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import unittest
import os
import numpy as np
from arc.settings import arc_path
from arc.species import ARCSpecies
from arc import parser
################################################################################
class TestParser(unittest.TestCase):
"""
Contains unit tests for the parser functions
"""
def test_parse_frequencies(self):
"""Test frequency parsing"""
no3_path = os.path.join(arc_path, 'arc', 'testing', 'NO3_freq_QChem_fails_on_cclib.out')
c2h6_path = os.path.join(arc_path, 'arc', 'testing', 'C2H6_freq_Qchem.out')
so2oo_path = os.path.join(arc_path, 'arc', 'testing', 'SO2OO_CBS-QB3.log')
ch2o_path = os.path.join(arc_path, 'arc', 'testing', 'CH2O_freq_molpro.out')
no3_freqs = parser.parse_frequencies(path=no3_path, software='QChem')
c2h6_freqs = parser.parse_frequencies(path=c2h6_path, software='QChem')
so2oo_freqs = parser.parse_frequencies(path=so2oo_path, software='Gaussian')
ch2o_freqs = parser.parse_frequencies(path=ch2o_path, software='Molpro')
self.assertTrue(np.array_equal(no3_freqs,
np.array([-390.08, -389.96, 822.75, 1113.23, 1115.24, 1195.35], np.float64)))
self.assertTrue(np.array_equal(c2h6_freqs,
np.array([352.37, 847.01, 861.68, 1023.23, 1232.66, 1235.04, 1425.48, 1455.31,
1513.67, 1518.02, 1526.18, 1526.56, 3049.78, 3053.32, 3111.61, 3114.2,
3134.14, 3136.8], np.float64)))
self.assertTrue(np.array_equal(so2oo_freqs,
np.array([302.51, 468.1488, 469.024, 484.198, 641.0067, 658.6316,
902.2888, 1236.9268, 1419.0826], np.float64)))
self.assertTrue(np.array_equal(ch2o_freqs,
np.array([1181.01, 1261.34, 1529.25, 1764.47, 2932.15, 3000.10], np.float64)))
def test_parse_xyz_from_file(self):
"""Test parsing xyz from a file"""
path1 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'CH3C(O)O.gjf')
path2 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'CH3C(O)O.xyz')
path3 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'AIBN.gjf')
path4 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'molpro.in')
path5 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'qchem.in')
path6 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'qchem_output.out')
path7 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'TS.gjf')
xyz1 = parser.parse_xyz_from_file(path1)
xyz2 = parser.parse_xyz_from_file(path2)
xyz3 = parser.parse_xyz_from_file(path3)
xyz4 = parser.parse_xyz_from_file(path4)
xyz5 = parser.parse_xyz_from_file(path5)
xyz6 = parser.parse_xyz_from_file(path6)
xyz7 = parser.parse_xyz_from_file(path7)
self.assertEqual(xyz1.rstrip(), xyz2.rstrip())
self.assertTrue('C 1.40511900 0.21728200 0.07675200' in xyz1)
self.assertTrue('O -0.79314200 1.04818800 0.18134200' in xyz1)
self.assertTrue('H -0.43701200 -1.34990600 0.92900600' in xyz2)
self.assertTrue('C 2.12217963 -0.66843078 1.04808732' in xyz3)
self.assertTrue('N 2.41731872 -1.07916417 2.08039935' in xyz3)
spc3 = ARCSpecies(label='AIBN', xyz=xyz3)
self.assertEqual(len(spc3.mol.atoms), 24)
self.assertTrue('S -0.4204682221 -0.3909949822 0.0245352116' in xyz4)
self.assertTrue('N -1.99742564 0.38106573 0.09139807' in xyz5)
self.assertTrue('N -1.17538406 0.34366165 0.03265021' in xyz6)
self.assertEqual(len(xyz7.strip().splitlines()), 34)
def test_parse_t1(self):
"""Test T1 diagnostic parsing"""
path = os.path.join(arc_path, 'arc', 'testing', 'mehylamine_CCSD(T).out')
t1 = parser.parse_t1(path)
self.assertEqual(t1, 0.0086766)
def test_parse_e_elect(self):
"""Test parsing E0 from an sp job output file"""
path1 = os.path.join(arc_path, 'arc', 'testing', 'mehylamine_CCSD(T).out')
e_elect = parser.parse_e_elect(path1)
self.assertEqual(e_elect, -251377.49160993524)
path2 = os.path.join(arc_path, 'arc', 'testing', 'SO2OO_CBS-QB3.log')
e_elect = parser.parse_e_elect(path2, zpe_scale_factor=0.99)
self.assertEqual(e_elect, -1833127.0939478774)
def test_parse_dipole_moment(self):
"""Test parsing the dipole moment from an opt job output file"""
path1 = os.path.join(arc_path, 'arc', 'testing', 'SO2OO_CBS-QB3.log')
dm1 = parser.parse_dipole_moment(path1)
self.assertEqual(dm1, 0.63)
path2 = os.path.join(arc_path, 'arc', 'testing', 'N2H4_opt_QChem.out')
dm2 = parser.parse_dipole_moment(path2)
self.assertEqual(dm2, 2.0664)
path3 = os.path.join(arc_path, 'arc', 'testing', 'CH2O_freq_molpro.out')
dm3 = parser.parse_dipole_moment(path3)
self.assertAlmostEqual(dm3, 2.8840, 4)
def test_parse_polarizability(self):
"""Test parsing the polarizability moment from a freq job output file"""
path1 = os.path.join(arc_path, 'arc', 'testing', 'SO2OO_CBS-QB3.log')
polar1 = parser.parse_polarizability(path1)
self.assertAlmostEqual(polar1, 3.99506, 4)
def test_process_conformers_file(self):
"""Test processing ARC conformer files"""
path1 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'conformers_before_optimization.txt')
path2 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'conformers_after_optimization.txt')
path3 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'conformers_file.txt')
xyzs, energies = parser.process_conformers_file(path1)
self.assertEqual(len(xyzs), 3)
self.assertEqual(len(energies), 3)
self.assertTrue(all([e is None for e in energies]))
spc1 = ARCSpecies(label='tst1', xyz=xyzs[0])
self.assertEqual(len(spc1.conformers), 1)
xyzs, energies = parser.process_conformers_file(path2)
self.assertEqual(len(xyzs), 3)
self.assertEqual(len(energies), 3)
self.assertEqual(energies, [0.0, 10.271, 10.288])
spc2 = ARCSpecies(label='tst2', xyz=xyzs[:2])
self.assertEqual(len(spc2.conformers), 2)
self.assertEqual(len(spc2.conformer_energies), 2)
xyzs, energies = parser.process_conformers_file(path3)
self.assertEqual(len(xyzs), 4)
self.assertEqual(len(energies), 4)
self.assertEqual(energies, [0.0, 0.005, None, 0.005])
spc3 = ARCSpecies(label='tst3', xyz=xyzs)
self.assertEqual(len(spc3.conformers), 4)
self.assertEqual(len(spc3.conformer_energies), 4)
spc4 = ARCSpecies(label='tst4', xyz=path1)
self.assertEqual(len(spc4.conformers), 3)
self.assertTrue(all([e is None for e in spc4.conformer_energies]))
spc5 = ARCSpecies(label='tst5', xyz=path2)
self.assertEqual(len(spc5.conformers), 3)
self.assertTrue(all([e is not None for e in spc5.conformer_energies]))
spc6 = ARCSpecies(label='tst6', xyz=path3)
self.assertEqual(len(spc6.conformers), 4)
################################################################################
if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))
|
[
"alongd@mit.edu"
] |
alongd@mit.edu
|
be9223f965ed3a77e9cde24b40545d675fb0d43e
|
eac7fadde995a3bc70a79a020fbc337aa88297e7
|
/entertainment_center.py
|
ebb752d78addb8aba5a8946cae9603da29a2284a
|
[] |
no_license
|
hernanpgarcia/ud036_StarterCode
|
a303e6426c1d13ac1223af8d59994ce6cb9d9e62
|
e22a1d9753bf64648e40bde3c61f3c0acba3cee9
|
refs/heads/master
| 2021-01-02T23:36:25.201629
| 2017-08-10T22:53:55
| 2017-08-10T22:53:55
| 99,503,561
| 0
| 0
| null | 2017-08-06T17:49:28
| 2017-08-06T17:49:28
| null |
UTF-8
|
Python
| false
| false
| 1,994
|
py
|
import media
import fresh_tomatoes
# Details of the movies that will show up on the website
the_avengers = media.Movie(
"The avengers",
"A group of super heros must overcome their relationship issues in order"
"to protect the planed from an alien invasion",
"https://upload.wikimedia.org/wikipedia/en/f/f9/TheAvengers2012Poster.jpg",
"https://www.youtube.com/watch?v=eOrNdBpGMv8"
)
avatar = media.Movie(
"Avatar",
"(Un soldado liciado se mete dentro del cuerpo clonado de"
" un alienigena",
"https://upload.wikimedia.org/wikipedia/en/b/b0/Avatar-Teaser-Poster.jpg",
"https://www.youtube.com/watch?v=5PSNL1qE6VY"
)
matrix = media.Movie(
"Matrix",
"Un hombre comun que quiere saber la verdad de donde venimos las personas",
"https://upload.wikimedia.org/wikipedia/en/c/c1/The_Matrix_Poster.jpg",
"https://www.youtube.com/watch?v=m8e-FF8MsqU"
)
prometheus = media.Movie(
"Prometheus",
"The quest for the human creators takes a group of cientifics to land full"
" of death",
"https://upload.wikimedia.org/wikipedia/en/a/a3/Prometheusposterfixed.jpg",
"https://www.youtube.com/watch?v=34cEo0VhfGE"
)
interestellar = media.Movie(
"Interestellar",
"Trying to save humanity from starbing a grup of people travel to the"
" unknown",
"https://upload.wikimedia.org/wikipedia/en/b/bc/Interstellar_film_" +
"poster.jpg",
"https://www.youtube.com/watch?v=zSWdZVtXT7E"
)
inception = media.Movie(
"Inception",
"To find a way to go back home, this man will try an almost impossible"
" mission",
"https://upload.wikimedia.org/wikipedia/en/2/2e/Inception_%282010%29_" +
"theatrical_poster.jpg",
"https://www.youtube.com/watch?v=8hP9D6kZseM"
)
# The array of the movies that will show up on the website
movies = [the_avengers, avatar, matrix, prometheus, interestellar, inception]
# The inicialization of the program
fresh_tomatoes.open_movies_page(movies)
|
[
"hernanpgarcia@gmail.com"
] |
hernanpgarcia@gmail.com
|
6414f665ae200b63779f180c3cf907f4e1f27686
|
de24f83a5e3768a2638ebcf13cbe717e75740168
|
/moodledata/vpl_data/64/usersdata/172/31394/submittedfiles/atm.py
|
b3a62b7e2c282af5b8dc77ae006ecf2045bc209c
|
[] |
no_license
|
rafaelperazzo/programacao-web
|
95643423a35c44613b0f64bed05bd34780fe2436
|
170dd5440afb9ee68a973f3de13a99aa4c735d79
|
refs/heads/master
| 2021-01-12T14:06:25.773146
| 2017-12-22T16:05:45
| 2017-12-22T16:05:45
| 69,566,344
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 138
|
py
|
# -*- coding: utf-8 -*-
from __future__ import division
import math
#COMECE SEU CODIGO AQUI
saque=int(input('digite o valor do saque')
a=
|
[
"rafael.mota@ufca.edu.br"
] |
rafael.mota@ufca.edu.br
|
710895ac2d0d8fae4d0acbf007029ef9b99ddc7a
|
acef2884f3bf63c3b6d545b86fb8654fd8323b30
|
/minimum-4-chisiel.py
|
30d7f10bb8d913bf725c0e9e2014432c621f50ba
|
[] |
no_license
|
NinaS0220/coursera
|
b3aa106902624a0f26a72fc9a49b65649357c522
|
7d85133e02fd150f77a8f00e21e288d276f810cc
|
refs/heads/master
| 2021-10-25T19:30:49.172529
| 2021-10-13T13:37:06
| 2021-10-13T13:37:06
| 221,946,475
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 183
|
py
|
def min4(a, b, c, d):
e = min(a, b)
f = min(c, d)
m = min(e, f)
return m
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min4(a, b, c, d))
|
[
"soboleva_n_a@list.ru"
] |
soboleva_n_a@list.ru
|
0016c4d0401853b1dc42bac9b1b084824a18a42c
|
9bf8f8b23ae62a2b79381bd37f083e9e7ef737ed
|
/class3/dict3.7.py
|
6fb8a45842df207890ee41753405b7f6d6cc28fb
|
[] |
no_license
|
CookyChou/fluent_python
|
dea2fd45982d1f0e9a9f43141b26ead97d8de189
|
6d50d442913896cabe384b55f4c0b89997813aaf
|
refs/heads/master
| 2020-05-04T14:31:12.564480
| 2019-11-15T10:54:03
| 2019-11-15T10:54:03
| 179,200,366
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 213
|
py
|
from types import MappingProxyType
# MappingProxyType提供一个视图索引,动态变化,可以通过索引访问查看,但是无法进行修改
d = {1: 'A'}
d_proxy = MappingProxyType(d)
print(d_proxy[1])
|
[
"cookyzhou@digitalgd.com.cn"
] |
cookyzhou@digitalgd.com.cn
|
2b6540edeb561c70cca55caa5666a55c9ebf10bc
|
c24036a526ced6ee029741dfa032620562f7db98
|
/problems/abc086_b.py
|
cb333ae60fba9f6f95eedf9c3ffdc345611871ff
|
[] |
no_license
|
ogawayuj/atcoder-autotest
|
1f240ec2987e916c1981649542490c983b83b5dc
|
4ec119593aba431f90a44773cb6412654f52a92a
|
refs/heads/main
| 2023-04-28T23:39:49.305512
| 2021-05-17T16:10:56
| 2021-05-17T16:10:56
| 368,245,902
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 127
|
py
|
line = list(map(int, input().split()))
multi = line[0] * line[1]
if multi % 2 == 1 :
print("Odd")
else :
print("Even")
|
[
"ogawa.playlist@gmail.com"
] |
ogawa.playlist@gmail.com
|
442f331765b30d7a1097fc09c256418680e11296
|
68a088346090ae4e929c208906b14181da0f92f6
|
/第一阶段/4. Python03/day02/code/mymod1.py
|
02601a49b7ac5cb8a86c19eb1b360f5019239b93
|
[] |
no_license
|
LONG990122/PYTHON
|
d1530e734ae48416b5f989a4d97bd1d66d165b91
|
59a2a2a0b033c8ad0cb33d6126c252e9d574eff7
|
refs/heads/master
| 2020-07-07T09:38:03.501705
| 2019-09-23T16:28:31
| 2019-09-23T16:28:31
| 203,316,565
| 0
| 0
| null | 2019-10-23T15:02:33
| 2019-08-20T06:47:44
|
HTML
|
UTF-8
|
Python
| false
| false
| 224
|
py
|
# mymod1.py
# 此模块是用户自定义模块
# 假设小张写了此模块
def myfun1():
print('正在调用mymod1里的 myfun1()')
def myfun2():
print("mymod1里的myfun2()")
name1 = 'audi'
name2 = 'tesla'
|
[
"54302090+LONG990122@users.noreply.github.com"
] |
54302090+LONG990122@users.noreply.github.com
|
90a9dc40dce2210dd81dc71a24f6a4713137d123
|
4e5a72e25685d1f3374885a3664e1b29af3d6e22
|
/03/t07_calculambdor/calculator.py
|
d6bbaa82c73abea9bfde7122ea73f9cc8adfa963
|
[] |
no_license
|
GennadiiStavytsky/PythonMarathon
|
5a6a2f827f3f0a53eb7e8c2675ef213244a1934e
|
d897fb3d705fb7fd668ce3aa2554c8c7d8182c76
|
refs/heads/main
| 2023-07-07T17:24:01.550943
| 2021-08-16T20:36:34
| 2021-08-16T20:36:34
| 353,433,377
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,073
|
py
|
def valid_oper(oper: str) -> bool:
if isinstance(oper, str):
if oper == 'add' or oper == 'sub' or oper == 'mul'\
or oper == 'div' or oper == 'pow':
return True
e = 'Invalid operation. Available operations: add, sub, mul, div, pow.'
raise ValueError(e)
def valid_nums(n, m) -> bool:
if isinstance(n, (int, float)) and isinstance(m, (int, float)):
return True
e = 'Invalid numbers. Second and third arguments must be numerical.'
raise ValueError(e)
def create_dict() -> dict:
res_dict = {}
keys = ('add', 'sub', 'mul', 'div', 'pow')
values = (lambda n, m: n + m,
lambda n, m: n - m,
lambda n, m: n * m,
lambda n, m: n / m,
lambda n, m: n ** m)
i = 0
while i < 5:
res_dict.update({keys[i]: values[i]})
i += 1
return res_dict
operations = create_dict()
def calculator(oper: str, n, m):
if valid_oper(oper) and valid_nums(n, m):
return operations.get(oper)(n, m)
|
[
"noreply@github.com"
] |
GennadiiStavytsky.noreply@github.com
|
9e64b76ccf82b31edcb1bc9c8731e53c34955d04
|
6840e7c0182a5df03e13172d20f246ac86a8c9af
|
/02-loop/mul99.py
|
9fa4d68eaff4fed327efd416a25bd32176f7ed38
|
[
"Apache-2.0"
] |
permissive
|
ccto/python-demos
|
9016ddcc6100685f01c60d3ba61ae56e9d79edb3
|
4ffb77573320d5df2cb30ec65a6181bae0e63d14
|
refs/heads/master
| 2020-07-12T17:34:29.657901
| 2017-09-10T10:37:52
| 2017-09-10T10:37:52
| 94,280,922
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 148
|
py
|
for i in range(1, 10):
for j in range(1, 10):
# print(format(i*j,'3'),end='')
print("{0:3}".format(i * j), end='')
print()
|
[
"outlook.com"
] |
outlook.com
|
e3c327e6c4d3dc062ff591227f5682845a02d0d2
|
50c27aa92edfe5351dc14214f9039de3fad7c5ad
|
/qtc/heatform_db.py
|
cab974b0ff7efec8c1263591df47f57f6bb386a5
|
[
"Apache-2.0"
] |
permissive
|
keceli/QTC
|
43b842b71cdc5869a1b93589565a98634d956c61
|
334fae9cd0eea493437e95c9aeb5a3088cbac343
|
refs/heads/master
| 2022-05-06T09:46:52.939126
| 2022-04-18T23:18:05
| 2022-04-18T23:18:05
| 90,078,099
| 8
| 2
| null | 2018-06-29T20:07:42
| 2017-05-02T21:07:23
|
Python
|
UTF-8
|
Python
| false
| false
| 36,014
|
py
|
db = [
{ '_id' : '[H]_m2' , 'formula': 'H' , 'delHf': { 'ATcT': 216 , 'ANL0': 216.10 , 'ANL1': 216.1 , 'ATcTsig': 0.00 }},
{ '_id' : '[H][H]_m1' , 'formula': 'H2' , 'delHf': { 'ATcT': 0 , 'ANL0': 0 , 'ATcTsig': 0.00 }},
{ '_id' : '[C]_m3' , 'formula': 'C' , 'delHf': { 'ATcT': 711.4 , 'ANL0': 711.40 , 'ANL1': 710.8 , 'ATcTsig': 0.10 }},
{ '_id' : '[CH]_m2' , 'formula': 'CH' , 'delHf': { 'ATcT': 592.8 , 'ANL0': 593.10 , 'ANL1': 592.7 , 'ATcTsig': 0.10 }},
{ '_id' : '[CH2]_m3' , 'formula': 'CH2' , 'delHf': { 'ATcT': 391 , 'ANL0': 391.10 , 'ANL1': 390.7 , 'ATcTsig': 0.10 }},
{ '_id' : '[CH2]_m1' , 'formula': 'CH2' , 'delHf': { 'ATcT': 428.6 , 'ANL0': 429.10 , 'ANL1': 428.7 , 'ATcTsig': 0.10 }},
{ '_id' : '[CH3]_m2' , 'formula': 'CH3' , 'delHf': { 'ATcT': 149.8 , 'ANL0': 149.90 , 'ANL1': 149.8 , 'ATcTsig': 0.10 }},
{ '_id' : 'C_m1' , 'formula': 'CH4' , 'delHf': { 'ATcT': -66.6 , 'ANL0': 0 , 'ATcTsig': 0.10 }},
{ '_id' : '[C]#[C]_m1' , 'formula': 'C2' , 'delHf': { 'ATcT': 820.2 , 'ANL0': 818.00 , 'ANL1': 819.7 , 'ATcTsig': 0.30 }},
{ '_id' : 'C#[C]_m2' , 'formula': 'CCH' , 'delHf': { 'ATcT': 563.9 , 'ANL0': 562.80 , 'ANL1': 563.1 , 'ATcTsig': 0.10 }},
{ '_id' : 'C#C_m1' , 'formula': 'CHCH' , 'delHf': { 'ATcT': 228.9 , 'ANL0': 228.40 , 'ANL1': 228.6 , 'ATcTsig': 0.10 }},
{ '_id' : 'C=[C]_m1' , 'formula': 'CH2C' , 'delHf': { 'ATcT': 411.3 , 'ANL0': 411.50 , 'ANL1': 410.8 , 'ATcTsig': 0.30 }},
{ '_id' : 'C=[CH]_m2' , 'formula': 'CH2CH' , 'delHf': { 'ATcT': 301.1 , 'ANL0': 300.90 , 'ANL1': 300.5 , 'ATcTsig': 0.30 }},
{ '_id' : 'C=C_m1' , 'formula': 'CH2CH2', 'delHf': { 'ATcT': 61 , 'ANL0': 60.20 , 'ANL1': 60.2 , 'ATcTsig': 0.10 }},
{ '_id' : 'C[CH]_m3' , 'formula': 'CH3CH' , 'delHf': { 'ATcT': 361.5 , 'ANL0': 361.10 , 'ANL1': 360.4 , 'ATcTsig': 0.80 }},
{ '_id' : 'C[CH2]_m2' , 'formula': 'CH3CH2', 'delHf': { 'ATcT': 130.9 , 'ANL0': 131.30 , 'ANL1': 131 , 'ATcTsig': 0.30 }},
{ '_id' : 'CC_m1' , 'formula': 'CH3CH3', 'delHf': { 'ATcT': -68.3 , 'ANL0': -68.90 , 'ANL1': -69 , 'ATcTsig': 0.10 }},
{ '_id' : '[CH]1[C][C]1_m2', 'formula': 'c-CCCH', 'delHf': { 'ATcT': 710.7 , 'ANL0': 711.60 , 'ANL1': 711.1 , 'ATcTsig': 1.10 }},
{ '_id' : '[CH]1[C][CH]1_m1', 'formula': 'c-CHCCH', 'delHf': { 'ATcT': 497.1 , 'ANL0': 496.60 , 'ANL1': 496.2 , 'ATcTsig': 0.50 }},
{ '_id' : '[CH]=C=[CH]_m3', 'formula': 'CHCCH' , 'delHf': { 'ATcT': 543.4 , 'ANL0': 541.40 , 'ANL1': 539.5 , 'ATcTsig': 0.60 }},
{ '_id' : 'C=C=[C]_m1' , 'formula': 'CH2CC' , 'delHf': { 'ATcT': 554.4 , 'ANL0': 553.60 , 'ANL1': 552.9 , 'ATcTsig': 0.40 }},
{ '_id' : 'C=C=[CH]_m2' , 'formula': 'CH2CCH', 'delHf': { 'ATcT': 354 , 'ANL0': 354.00 , 'ANL1': 354.1 , 'ATcTsig': 0.40 }},
{ '_id' : '[CH]1[CH][CH]1_m2', 'formula': 'c-CHCHCH', 'delHf': { 'ATcT': 491 , 'ANL0': 490.90 , 'ANL1': 490.6 , 'ATcTsig': 0.80 }},
{ '_id' : 'CC#[C]_m2' , 'formula': 'CH3CC' , 'delHf': { 'ATcT': 529 , 'ANL0': 528.20 , 'ANL1': 528.2 , 'ATcTsig': 0.80 }},
{ '_id' : 'C1[C][CH]1_m2' , 'formula': 'c-CH2CHC', 'delHf': { 'ATcT': 528.1 , 'ANL0': 526.90 , 'ANL1': 526.9 , 'ATcTsig': 1.30 }},
{ '_id' : 'CC#C_m1' , 'formula': 'CH3CCH', 'delHf': { 'ATcT': 192.8 , 'ANL0': 192.30 , 'ANL1': 192.4 , 'ATcTsig': 0.20 }},
{ '_id' : 'C=C=C_m1' , 'formula': 'CH2CCH2', 'delHf': { 'ATcT': 197.3 , 'ANL0': 196.90 , 'ANL1': 196.6 , 'ATcTsig': 0.30 }},
{ '_id' : 'C1[CH][CH]1_m1', 'formula': 'C-CHCH2CH','delHf': { 'ATcT': 292.5 , 'ANL0': 292.30 , 'ANL1': 292.2 , 'ATcTsig': 0.50 }},
{ '_id' : '[CH2]C=C_m2' , 'formula': 'CH2CHCH2', 'delHf': { 'ATcT': 179.6 , 'ANL0': 179.60 , 'ANL1': 179.6 , 'ATcTsig': 0.5 }},
{ '_id' : 'C[C]=C_m2' , 'formula': 'CH3CCH2', 'delHf': { 'ATcT': 262.9 , 'ANL0': 263.00 , 'ATcTsig': 0.7 }},
{ '_id' : 'CC=[CH]_m2' , 'formula': 'CH3CHCH', 'delHf': { 'ATcT': 278 , 'ANL0': 278.40 , 'ATcTsig': 0.8 }},
{ '_id' : 'C1[CH]C1_m2' , 'formula': 'c-CH2CHCH2', 'delHf': { 'ATcT': 302.8 , 'ANL0': 304.40 , 'ATcTsig': 1.6 }},
{ '_id' : 'CC=C_m1' , 'formula': 'CH3CHCH2' , 'delHf': { 'ATcT': 35 , 'ANL0': 34.50 , 'ATcTsig': 0.2 }},
{ '_id' : 'C1CC1_m1' , 'formula': 'c-CH2CH2CH2' , 'delHf': { 'ATcT': 70.8 , 'ANL0': 71.50 , 'ATcTsig': 0.5 }},
{ '_id' : 'C[CH]C_m1' , 'formula': 'CH3CHCH3' , 'delHf': { 'ATcT': 105.3 , 'ANL0': 105.10 , 'ATcTsig': 0.7 }},
{ '_id' : 'CC[CH2]_m1' , 'formula': 'CH3CH2CH2' , 'delHf': { 'ATcT': 117.9 , 'ANL0': 118.20 , 'ATcTsig': 0.6 }},
{ '_id' : 'CCC_m1' , 'formula': 'CH3CH2CH3' , 'delHf': { 'ATcT': -82.7 , 'ANL0': -83.20 , 'ATcTsig': 0.2 }},
{ '_id' : 'C#CC#C_m1' , 'formula': 'CHCCCH' , 'delHf': { 'ATcT': 458.6 , 'ANL0': 458.00 , 'ATcTsig': 0.9 }},
{ '_id' : 'C=CC=C_m1' , 'formula': 'CH2CHCHCH2' , 'delHf': { 'ATcT': 125.1 , 'ANL0': 125.00 , 'ATcTsig': 0.4 }},
{ '_id' : 'CC#CC_m1' , 'formula': 'CH3CCCH3' , 'delHf': { 'ATcT': 159 , 'ANL0': 159.20 , 'ATcTsig': 0.6 }},
{ '_id' : 'C1[CH][CH]C1_m1', 'formula': 'c-CH2CH2CHCH' , 'delHf': { 'ATcT': 176.8 , 'ANL0': 177.80 , 'ATcTsig': 0.9 }},
{ '_id' : 'CCC#C_m1' , 'formula': 'CH3CH2CCH' , 'delHf': { 'ATcT': 179.4 , 'ANL0': 180.20 , 'ATcTsig': 0.7 }},
{ '_id' : 'C[C]([CH2])C_m1', 'formula': '(CH3)2CCH2' , 'delHf': { 'ATcT': 3.9 , 'ANL0': 4.40 , 'ATcTsig': 0.4 }},
{ '_id' : 'CC=CC_m1' , 'formula': 'CH3CHCHCH3' , 'delHf': { 'ATcT': 9.3 , 'ANL0': 9.60 , 'ATcTsig': 0.4 }},
{ '_id' : 'CCC=C_m1' , 'formula': 'CH2CHCH2CH3' , 'delHf': { 'ATcT': 20.9 , 'ANL0': 21.30 , 'ATcTsig': 0.4 }},
{ '_id' : 'C1CCC1_m1' , 'formula': 'c-CH2CH2CH2CH2' , 'delHf': { 'ATcT': 52.2 , 'ANL0': 51.60 , 'ATcTsig': 0.5 }},
{ '_id' : 'CCC[CH2]_m2' , 'formula': 'CH3CH2CH2CH2' , 'delHf': { 'ATcT': 101.5 , 'ANL0': 103.20 , 'ATcTsig': 1 }},
{ '_id' : 'CC(C)C_m1' , 'formula': '(CH3)2CHCH3' , 'delHf': { 'ATcT': -106.2 , 'ANL0': -105.90 , 'ATcTsig': 0.3 }},
{ '_id' : 'CCCC_m1' , 'formula': 'CH3CH2CH2CH3' , 'delHf': { 'ATcT': -98.6 , 'ANL0': -98.40 , 'ATcTsig': 0.3 }},
{ '_id' : '[C]C=C_m2' , 'formula': 'CH2CHC' , 'delHf': { 'ANL0': 556.4 }},
{ '_id' : '[CH][CH][CH]_m4', 'formula': 'CHCHCH' , 'delHf': { 'ANL0': 656.6 }},
{ '_id' : 'C[C]C_m4' , 'formula': 'CH3CCH3' , 'delHf': { 'ANL0': 315.7 }},
{ '_id' : 'CC[CH]_m3' , 'formula': 'CH3CH2CH' , 'delHf': { 'ANL0': 349.5 }},
{ '_id' : 'C#CC#[C]_m2' , 'formula': 'CCCCH' , 'delHf': { 'ANL0': 802.2 }},
{ '_id' : 'C=C=C=[CH]_m2' , 'formula': 'CH2CCCH' , 'delHf': { 'ANL0': 495.7 }},
{ '_id' : '[CH]=CC#C_m2' , 'formula': 'CHCHCCH' , 'delHf': { 'ANL0': 547.4 }},
{ '_id' : 'C1=[C]C=C1_m2' , 'formula': 'c-CHCHCHC' , 'delHf': { 'ANL0': 655.5 }},
{ '_id' : 'C=CC#C_m1' , 'formula': 'CH2CHCCH' , 'delHf': { 'ANL0': 295.7 }},
{ '_id' : 'C=C=C=C_m1' , 'formula': 'CH2CCCH2' , 'delHf': { 'ANL0': 327.7 }},
{ '_id' : 'C=C1C=C1_m1' , 'formula': 'c-C(CH2)CHCH' , 'delHf': { 'ANL0': 395.7 }},
{ '_id' : 'C1=CC=C1_m1' , 'formula': 'c-CHCHCHCH' , 'delHf': { 'ANL0': 434.9 }},
{ '_id' : 'C[C]=C=C_m2' , 'formula': 'CH3CCCH2' , 'delHf': { 'ANL0': 318.5 }},
{ '_id' : 'C=[C]C=C_m2' , 'formula': 'CH2CHCCH2' , 'delHf': { 'ANL0': 327.3 }},
{ '_id' : 'C[CH]C#C_m2' , 'formula': 'CH3CHCCH' , 'delHf': { 'ANL0': 329.3 }},
{ '_id' : 'C1[CH]C=C1_m2' , 'formula': 'c-CH2CHCHCH' , 'delHf': { 'ANL0': 342.1 }},
{ '_id' : 'C=CC=[CH]_m2' , 'formula': 'CH2CHCHCH' , 'delHf': { 'ANL0': 371.6 }},
{ '_id' : 'CC=C=C_m1' , 'formula': 'CH2CCHCH3' , 'delHf': { 'ANL0': 176.2 }},
{ '_id' : 'CC=C[CH2]_m2' , 'formula': 'CH2CHCHCH3' , 'delHf': { 'ANL0': 156 }},
{ '_id' : 'CC(=C)[CH2]_m2', 'formula': 'CH3C(CH2)2' , 'delHf': { 'ANL0': 158.4 }},
{ '_id' : '[CH2]CC=C_m2' , 'formula': 'CH2CHCH2CH2' , 'delHf': { 'ANL0': 226.3 }},
{ '_id' : 'C[C]=CC_m2' , 'formula': 'CH3CCHCH3' , 'delHf': { 'ANL0': 241 }},
{ '_id' : 'C1[CH]CC1_m2' , 'formula': 'c-CH2CH2CH2CH' , 'delHf': { 'ANL0': 247.4 }},
{ '_id' : 'CC(=[CH])C_m2' , 'formula': '(CH3)2CCH' , 'delHf': { 'ANL0': 252.2 }},
{ '_id' : 'CCC=[CH]_m2' , 'formula': 'CH3CH2CHCH' , 'delHf': { 'ANL0': 264.2 }},
{ '_id' : 'C[C](C)C_m2' , 'formula': '(CH3)3C' , 'delHf': { 'ANL0': 75.5 }},
{ '_id' : 'C[CH]CC_m2' , 'formula': 'CH3CH2CHCH3' , 'delHf': { 'ANL0': 90.9 }},
{ '_id' : 'CC([CH2])C_m2' , 'formula': '(CH3)2CHCH2' , 'delHf': { 'ANL0': 97.8 }},
{ '_id' : '[CH]C#CC#C_m3' , 'formula': 'CHCCCCH' , 'delHf': { 'ANL0': 727.1 }},
{ '_id' : 'C=C=C=C=[CH]_m2', 'formula': 'CH2CCCCH' , 'delHf': { 'ANL0': 568.5 }},
{ '_id' : '[CH]=C=CC#C_m2', 'formula': 'CHCCHCCH' , 'delHf': { 'ANL0': 577.3 }},
{ '_id' : 'CC#CC#C_m1' , 'formula': 'CH3CCCCH' , 'delHf': { 'ANL0': 417.9 }},
{ '_id' : 'C=C=CC#C_m1' , 'formula': 'CH2CCHCCH' , 'delHf': { 'ANL0': 441.7 }},
{ '_id' : 'C=C=C=C=C_m1' , 'formula': 'CH2CCCCH2' , 'delHf': { 'ANL0': 451.9 }},
{ '_id' : 'C#CCC#C_m1' , 'formula': 'CHCCH2CCH' , 'delHf': { 'ANL0': 459.5 }},
{ '_id' : '[CH]1C=[C]C=C1_m3', 'formula': 'c-CHCHCHCHC' , 'delHf': { 'ANL0': 525.4 }},
{ '_id' : 'C#CC#CC#C_m1' , 'formula': 'CHCCCCCH' , 'delHf': { 'ANL0': 682.4 }},
{ '_id' : '[O]_m3' , 'formula': 'O' , 'delHf': { 'ATcT': 246.8 , 'ANL0': 247.1 , 'ANL1': 246 , 'ATcTsig': 0 }},
{ '_id' : '[OH]_m2' , 'formula': 'OH' , 'delHf': { 'ATcT': 37.3 , 'ANL0': 37.8 , 'ANL1': 37.2 , 'ATcTsig': 0 }},
{ '_id' : 'O_m1' , 'formula': 'H2O' , 'delHf': { 'ATcT': -238.9 , 'ANL0': 0 , 'ATcTsig': 0 }},
{ '_id' : '[C-]#[O+]_m1' , 'formula': 'CO' , 'delHf': { 'ATcT': -113.8 , 'ANL0': -113.9 , 'ANL1': -114 , 'ATcTsig': 0 }},
{ '_id' : '[CH]=O_m2' , 'formula': 'HCO' , 'delHf': { 'ATcT': 41.4 , 'ANL0': 40.7 , 'ANL1': 40.9 , 'ATcTsig': 0.1 }},
{ '_id' : '[CH][O]_m2' , 'formula': 'HCO' , 'delHf': { 'ATcT': 41.4 , 'ANL0': 40.7 , 'ANL1': 40.9 , 'ATcTsig': 0.1 }},
{ '_id' : '[C]O_m2' , 'formula': 'COH' , 'delHf': { 'ATcT': 217.3 , 'ANL0': 217.9 , 'ANL1': 217.7 , 'ATcTsig': 0.7 }},
{ '_id' : 'C=O_m1' , 'formula': 'CH2O' , 'delHf': { 'ATcT': -105.3 , 'ANL0': -105.6 , 'ANL1': -105.7 , 'ATcTsig': 0.1 }},
{ '_id' : '[CH]O_m1' , 'formula': 'CHOH' , 'delHf': { 'ATcT': 112.4 , 'ANL0': 112.4 , 'ANL1': 112.5 , 'ATcTsig': 0.3 }},
{ '_id' : '[CH2]O_m2' , 'formula': 'CH2OH' , 'delHf': { 'ATcT': -10.3 , 'ANL0': -10.6 , 'ANL1': -10.9 , 'ATcTsig': 0.3 }},
{ '_id' : 'C[O]_m2' , 'formula': 'CH3O' , 'delHf': { 'ATcT': 28.9 , 'ANL0': 29.5 , 'ANL1': 27.9 , 'ATcTsig': 0.3 }},
{ '_id' : 'CO_m1' , 'formula': 'CH3OH' , 'delHf': { 'ATcT': -189.8 , 'ANL0': -190.2 , 'ANL1': -190.1 , 'ATcTsig': 0.2 }},
{ '_id' : '[C][C]=O_m3' , 'formula': 'CCO' , 'delHf': { 'ATcT': 376.3 , 'ANL0': 376.9 , 'ANL1': 376.8 , 'ATcTsig': 1 }},
{ '_id' : '[CH]=C=O_m2' , 'formula': 'HCCO' , 'delHf': { 'ATcT': 176.8 , 'ANL0': 176.6 , 'ANL1': 176.6 , 'ATcTsig': 0.6 }},
{ '_id' : 'C=C=O_m1' , 'formula': 'CH2CO' , 'delHf': { 'ATcT': -45.5 , 'ANL0': -45.6 , 'ANL1': -45.7 , 'ATcTsig': 0.1 }},
{ '_id' : 'OC#C_m1' , 'formula': 'CHCOH' , 'delHf': { 'ATcT': 94.9 , 'ANL0': 94.4 , 'ANL1': 94.6 , 'ATcTsig': 1.3 }},
{ '_id' : 'O1[CH][CH]1_m1', 'formula': 'c-CHOCH' , 'delHf': { 'ATcT': 272.8 , 'ANL0': 270.4 , 'ANL1': 271.3 , 'ATcTsig': 1 }},
{ '_id' : 'C[C]=O_m2' , 'formula': 'CH3CO' , 'delHf': { 'ATcT': -3.3 , 'ANL0': -4.5 , 'ATcTsig': 0.4 }},
{ '_id' : '[O]C=C_m2' , 'formula': 'CH2CHO' , 'delHf': { 'ATcT': 22.5 , 'ANL0': 23.3 , 'ATcTsig': 0.8 }},
{ '_id' : '[CH2]C=O_m2' , 'formula': 'CH2CHO' , 'delHf': { 'ATcT': 22.5 , 'ANL0': 23.3 , 'ATcTsig': 0.8 }},
{ '_id' : 'O1[CH]C1_m2' , 'formula': 'c-CHOCH2' , 'delHf': { 'ATcT': 172.8 , 'ANL0': 173.2 , 'ATcTsig': 1.3 }},
{ '_id' : 'CC=O_m1' , 'formula': 'CH3CHO' , 'delHf': { 'ATcT': -155 , 'ANL0': -154.9 , 'ATcTsig': 0.3 }},
{ '_id' : 'OC=C_m1' , 'formula': 'CH2CHOH' , 'delHf': { 'ATcT': -112.6 , 'ANL0': -114.5 , 'ATcTsig': 0.8 }},
{ '_id' : 'O1CC1_m1' , 'formula': 'c-CH2CH2O' , 'delHf': { 'ATcT': -40 , 'ANL0': -39.9 , 'ATcTsig': 0.4 }},
{ '_id' : 'C[CH]O_m2' , 'formula': 'CH3CHOH' , 'delHf': { 'ATcT': -42.2 , 'ANL0': -43.1 , 'ATcTsig': 0.6 }},
{ '_id' : '[CH2]CO_m2' , 'formula': 'CH2CH2OH' , 'delHf': { 'ATcT': -12.8 , 'ANL0': -12.1 , 'ATcTsig': 0.6 }},
{ '_id' : 'CC[O]_m2' , 'formula': 'CH3CH2O' , 'delHf': { 'ATcT': 1.1 , 'ANL0': 1.3 , 'ATcTsig': 0.5 }},
{ '_id' : 'CCO_m1' , 'formula': 'CH3CH2OH' , 'delHf': { 'ATcT': -216.9 , 'ANL0': -217.4 , 'ATcTsig': 0.2 }},
{ '_id' : 'COC_m1' , 'formula': 'CH3OCH3' , 'delHf': { 'ATcT': -166.5 , 'ANL0': -166.2 , 'ATcTsig': 0.4 }},
{ '_id' : 'CC(=O)C_m1' , 'formula': 'CH3C(O)CH3' , 'delHf': { 'ATcT': -199.5 , 'ANL0': -200.2 , 'ATcTsig': 0.4 }},
{ '_id' : 'CCC=O_m1' , 'formula': 'CH3CH2CHO' , 'delHf': { 'ATcT': -170 , 'ANL0': -170.5 , 'ATcTsig': 0.9 }},
{ '_id' : 'CC(O)C_m1' , 'formula': '(CH3)2CH(OH)' , 'delHf': { 'ATcT': -248.8 , 'ANL0': -247.9 , 'ATcTsig': 0.4 }},
{ '_id' : 'CCCO_m1' , 'formula': 'CH3CH2CH2OH' , 'delHf': { 'ATcT': -231.4 , 'ANL0': -230.5 , 'ATcTsig': 0.3 }},
{ '_id' : '[O][O]_m3' , 'formula': 'O2' , 'delHf': { 'ATcT': 0 , 'ANL0': -0.5 , 'ANL1': -0.5 , 'ATcTsig': 0 }},
{ '_id' : 'O=O_m3' , 'formula': 'O2' , 'delHf': { 'ATcT': 0 , 'ANL0': -0.5 , 'ANL1': -0.5 , 'ATcTsig': 0 }},
{ '_id' : 'O[O]_m2' , 'formula': 'HO2' , 'delHf': { 'ATcT': 15.2 , 'ANL0': 14.9 , 'ANL1': 14.5 , 'ATcTsig': 0.2 }},
{ '_id' : 'OO_m1' , 'formula': 'OHOH' , 'delHf': { 'ATcT': -129.5 , 'ANL0': -129.3 , 'ANL1': -129.1 , 'ATcTsig': 0.1 }},
{ '_id' : 'O=C=O_m1' , 'formula': 'OCO' , 'delHf': { 'ATcT': -393.1 , 'ANL0': -393.4 , 'ANL1': -393.1 , 'ATcTsig': 0 }},
{ '_id' : 'O[C]=O_m2' , 'formula': 'OCOH' , 'delHf': { 'ATcT': -181 , 'ANL0': -181.6 , 'ANL1': -181.4 , 'ATcTsig': 0.5 }},
{ '_id' : '[O]C=O_m2' , 'formula': 'OCHO' , 'delHf': { 'ATcT': -124.8 , 'ANL0': -129.6 , 'ANL1': -128.8 , 'ATcTsig': 0.5 }},
{ '_id' : 'OC=O_m1' , 'formula': 'OCHOH' , 'delHf': { 'ATcT': -371.1 , 'ANL0': -371.1 , 'ATcTsig': 0.2 }},
{ '_id' : 'O1OC1_m1' , 'formula': 'c-CH2OO' , 'delHf': { 'ATcT': 9.4 , 'ANL0': 8.8 , 'ATcTsig': 0.5 }},
{ '_id' : 'CO[O]_m2' , 'formula': 'CH3OO' , 'delHf': { 'ATcT': 22.3 , 'ANL0': 22.7 , 'ATcTsig': 0.5 }},
{ '_id' : 'OCO_m1' , 'formula': 'OHCH2OH' , 'delHf': { 'ATcT': -379.1 , 'ANL0': -378.7 , 'ATcTsig': 0.9 }},
{ '_id' : 'COO_m1' , 'formula': 'CH3OOH' , 'delHf': { 'ATcT': -114.9 , 'ANL0': -114.7 , 'ATcTsig': 0.7 }},
{ '_id' : 'O=CC=O_m1' , 'formula': 'OCHCHO' , 'delHf': { 'ATcT': -207 , 'ANL0': -207.9 , 'ATcTsig': 0.5 }},
{ '_id' : 'CO[C]=O_m2' , 'formula': 'CH3OCO' , 'delHf': { 'ATcT': -149.8 , 'ANL0': -151.4 , 'ATcTsig': 1.9 }},
{ '_id' : '[CH2]OC=O_m2' , 'formula': 'CH2OCHO' , 'delHf': { 'ATcT': -148.7 , 'ANL0': -149.4 , 'ATcTsig': 1.5 }},
{ '_id' : 'CC(=O)O_m1' , 'formula': 'CH3C(O)OH' , 'delHf': { 'ATcT': -418.4 , 'ANL0': -417.6 , 'ATcTsig': 0.5 }},
{ '_id' : 'COC=O_m1' , 'formula': 'CH3OCHO' , 'delHf': { 'ATcT': -344.8 , 'ANL0': -345.4 , 'ATcTsig': 0.6 }},
{ '_id' : '[O]OC=C_m2' , 'formula': 'CH2COO' , 'delHf': { 'ANL0': 118.53 }},
{ '_id' : 'CCO[O]_m2' , 'formula': 'CH3CH2OO' , 'delHf': { 'ANL0': -6.07 }},
{ '_id' : '[O]OCO_m2' , 'formula': 'OOCH2OH' , 'delHf': { 'ANL0': -150.79 }},
{ '_id' : '[O]O[O]_m1' , 'formula': 'O3' , 'delHf': { 'ATcT': 144.4 , 'ANL0': 143.6 , 'ATcTsig': 0 }},
{ '_id' : 'OO[O]_m2' , 'formula': 'OOOH' , 'delHf': { 'ATcT': 25.3 , 'ANL0': 27.3 , 'ATcTsig': 0.1 }},
{ '_id' : 'OOO_m1' , 'formula': 'OHOOH' , 'delHf': { 'ATcT': -81.4 , 'ANL0': -82.3 , 'ATcTsig': 0.7 }},
{ '_id' : 'OOOO_m1' , 'formula': 'OHOOOH' , 'delHf': { 'ATcT': -33.5 , 'ANL0': -34.8 , 'ATcTsig': 2.3 }},
{ '_id' : 'OC(=O)O_m1' , 'formula': 'OC(OH)2' , 'delHf': { 'ATcT': -602.8 , 'ANL0': -602.2 , 'ATcTsig': 0.8 }},
{ '_id' : 'OOC=O_m1' , 'formula': 'OCHOOH' , 'delHf': { 'ATcT': -279.8 , 'ANL0': -279.2 , 'ATcTsig': 1.1 }},
{ '_id' : '[CH]C=O_m3' , 'formula': 'CHCHO' , 'delHf': { 'ANL0': 261.3 }},
{ '_id' : 'O[C]=C_m2' , 'formula': 'CH2COH' , 'delHf': { 'ANL0': 121.5 }},
{ '_id' : 'OC=[CH]_m2' , 'formula': 'CHCHOH' , 'delHf': { 'ANL0': 137.5 }},
{ '_id' : 'C[C]O_m1' , 'formula': 'CH3COH' , 'delHf': { 'ANL0': 69.5 }},
{ '_id' : 'CO[CH]_m1' , 'formula': 'CH3OCH' , 'delHf': { 'ANL0': 129.9 }},
{ '_id' : 'CO[CH2]_m1' , 'formula': 'CH3OCH2' , 'delHf': { 'ANL0': 13.7 }},
{ '_id' : 'O=[C]C#C_m2' , 'formula': 'CHCCO' , 'delHf': { 'ANL0': 290 }},
{ '_id' : 'O=CC#[C]_m2' , 'formula': 'CCCHO' , 'delHf': { 'ANL0': 468.3 }},
{ '_id' : 'C=C=C=O_m1' , 'formula': 'CH2CCO' , 'delHf': { 'ANL0': 131.9 }},
{ '_id' : 'O=CC#C_m1' , 'formula': 'CHCCHO' , 'delHf': { 'ANL0': 135.2 }},
{ '_id' : 'C=C[C]=O_m2' , 'formula': 'CH2CHCO' , 'delHf': { 'ANL0': 102.8 }},
{ '_id' : '[O]C=C=C_m2' , 'formula': 'CH2CCHO' , 'delHf': { 'ANL0': 178.1 }},
{ '_id' : '[CH]=CC=O_m2' , 'formula': 'CHCHCHO' , 'delHf': { 'ANL0': 190.9 }},
{ '_id' : 'C=CC=O_m1' , 'formula': 'CH2CHCHO' , 'delHf': { 'ANL0': -55.4 }},
{ '_id' : 'CC=C=O_m1' , 'formula': 'CH3CHCO' , 'delHf': { 'ANL0': -53.4 }},
{ '_id' : 'O=C1CC1_m1' , 'formula': 'c-CH2C(O)CH2' , 'delHf': { 'ANL0': 31.8 }},
{ '_id' : 'C1OC=C1_m1' , 'formula': 'c-CH2OCHCH' , 'delHf': { 'ANL0': 65.3 }},
{ '_id' : 'CC(=O)[CH2]_m2' , 'formula': 'CH3C(O)CH2' , 'delHf': { 'ANL0': -17.9 }},
{ '_id' : 'CC[C]=O_m1' , 'formula': 'CH3CH2CO' , 'delHf': { 'ANL0': -17.3 }},
{ '_id' : 'C[C]C=O_m1' , 'formula': 'CH3CHCHO' , 'delHf': { 'ANL0': -14.2 }},
{ '_id' : 'O[CH]C=C_m2' , 'formula': 'CH2CHCHOH' , 'delHf': { 'ANL0': 2.7 }},
{ '_id' : '[CH2]C(=C)O_m2' , 'formula': 'CH2C(OH)CH2' , 'delHf': { 'ANL0': 3.8 }},
{ '_id' : '[CH2]CC=O_m2' , 'formula': 'CH2CH2CHO' , 'delHf': { 'ANL0': 33.1 }},
{ '_id' : '[CH2]OC=C_m2' , 'formula': 'CH2OCHCH2' , 'delHf': { 'ANL0': 101 }},
{ '_id' : 'CC(=[CH])O_m2' , 'formula': 'CH3C(OH)CH' , 'delHf': { 'ANL0': 101.4 }},
{ '_id' : 'C[C]=CO_m2' , 'formula': 'CH3CCHOH' , 'delHf': { 'ANL0': 103.4 }},
{ '_id' : '[O]CC=C_m2' , 'formula': 'CH2CHCH2O' , 'delHf': { 'ANL0': 112.4 }},
{ '_id' : 'C1C[CH]O1_m2' , 'formula': 'c-CH2CH2CHO' , 'delHf': { 'ANL0': 116.1 }},
{ '_id' : '[CH2]C1CO1_m2' , 'formula': 'c-CH(CH2)OCH2' , 'delHf': { 'ANL0': 120.3 }},
{ '_id' : 'OC[C]=C_m2' , 'formula': 'CH2CCH2OH' , 'delHf': { 'ANL0': 124.5 }},
{ '_id' : 'C1[CH]CO1_m2' , 'formula': 'c-CH2CHCH2O' , 'delHf': { 'ANL0': 142.7 }},
{ '_id' : 'CC(=C)O_m1' , 'formula': 'CH3C(OH)CH2' , 'delHf': { 'ANL0': -152 }},
{ '_id' : 'CC=CO_m1' , 'formula': 'CH3CHCHOH' , 'delHf': { 'ANL0': -133 }},
{ '_id' : 'OCC=C_m1' , 'formula': 'CH2CHCH2OH' , 'delHf': { 'ANL0': -107 }},
{ '_id' : 'OC1CC1_m1' , 'formula': 'c-CH2CH2CH(OH)' , 'delHf': { 'ANL0': -82.1 }},
{ '_id' : 'CC1CO1_m1' , 'formula': 'c-CH(CH3)CH2O' , 'delHf': { 'ANL0': -75.1 }},
{ '_id' : 'C1CCO1_m1' , 'formula': 'c-CH2CH2CH2O' , 'delHf': { 'ANL0': -60 }},
{ '_id' : 'CC(O)C_m1' , 'formula': 'CH3C(OH)CH3' , 'delHf': { 'ANL0': -78.3 }},
{ '_id' : 'CC[CH]O_m2' , 'formula': 'CH3CH2CHOH' , 'delHf': { 'ANL0': -55.8 }},
{ '_id' : 'CC(O)[CH2]_m2' , 'formula': 'CH3CH(OH)CH2' , 'delHf': { 'ANL0': -43.2 }},
{ '_id' : 'C[CH]CO_m2' , 'formula': 'CH3CHCH2OH' , 'delHf': { 'ANL0': -39.5 }},
{ '_id' : '[CH2]CCO_m2' , 'formula': 'CH2CH2CH2OH' , 'delHf': { 'ANL0': -30.9 }},
{ '_id' : 'CC([O])C_m2' , 'formula': 'CH3CH(O)CH3' , 'delHf': { 'ANL0': -25.4 }},
{ '_id' : 'CO[C]C_m2' , 'formula': 'CH3CHOCH3' , 'delHf': { 'ANL0': -19.4 }},
{ '_id' : '[CH2]OCC_m2' , 'formula': 'CH3CH2OCH2' , 'delHf': { 'ANL0': -12.2 }},
{ '_id' : 'CCC[O]_m2' , 'formula': 'CH3CH2CH2O' , 'delHf': { 'ANL0': -11.7 }},
{ '_id' : 'COC[CH2]_m2' , 'formula': 'CH2CH2OCH3' , 'delHf': { 'ANL0': 14.2 }},
{ '_id' : 'COCC_m1' , 'formula': 'CH3CH2OCH3' , 'delHf': { 'ANL0': -194 }},
{ '_id' : '[C]=C=C=C=O_m3' , 'formula': 'CCCCO' , 'delHf': { 'ANL0': 606.5 }},
{ '_id' : '[CH]=C=C=C=O_m2' , 'formula': 'CHCCCO' , 'delHf': { 'ANL0': 381 }},
{ '_id' : 'OC#CC#C_m1' , 'formula': 'CHCCCOH' , 'delHf': { 'ANL0': 323.2 }},
{ '_id' : 'c1ccco1_m1' , 'formula': 'c-CHCHCHCHO', 'delHf': { 'ANL0': -21.7 }},
{ '_id' : '[CH2]O[O]_m1' , 'formula': 'CH2OO', 'delHf': { 'ANL0': 108.8 }},
{ '_id' : 'OC[O]_m2' , 'formula': 'OCH2OH', 'delHf': { 'ANL0': -158.5 }},
{ '_id' : '[O]C#C[O]_m3' , 'formula': 'OCCO', 'delHf': { 'ANL0': 14.1 }},
{ '_id' : 'O=[C]C=O_m2' , 'formula': 'OCCHO', 'delHf': { 'ANL0': -63.2 }},
{ '_id' : 'OC#C[O]_m2' , 'formula': 'OCCOH', 'delHf': { 'ANL0': 21.3 }},
{ '_id' : 'OOC#[C]_m2' , 'formula': 'CCOOH', 'delHf': { 'ANL0': 179.5 }},
{ '_id' : '[O]OC#C_m2' , 'formula': 'CHCOO', 'delHf': { 'ANL0': 363.5 }},
{ '_id' : 'C1OC1=O_m1' , 'formula': 'c-C(O)OCH2', 'delHf': { 'ANL0': -164.5 }},
{ '_id' : 'OC=C=O_m1' , 'formula': 'OHCHCO', 'delHf': { 'ANL0': -145.3 }},
{ '_id' : 'OC#CO_m1' , 'formula': 'OHCCOH', 'delHf': { 'ANL0': -19.3 }},
{ '_id' : '[C]C(O)O_m1' , 'formula': 'CC(OH)2', 'delHf': { 'ANL0': 141.6 }},
{ '_id' : '[CH2]C(=O)O_m2', 'formula': 'CH2C(O)OH', 'delHf': { 'ANL0': -224.8 }},
{ '_id' : 'CC(=O)[O]_m2' , 'formula': 'CH3C(O)O', 'delHf': { 'ANL0': -182.2 }},
{ '_id' : '[O]CC=O_m2' , 'formula': 'OCHCH2O', 'delHf': { 'ANL0': -69 }},
{ '_id' : '[O]C1CO1_m2' , 'formula': 'c-CH(O)CH2O', 'delHf': { 'ANL0': -33.1 }},
{ '_id' : '[CH2]C1OO1_m2' , 'formula': 'c-CH(CH2)OO', 'delHf': { 'ANL0': 161.1 }},
{ '_id' : 'C1[CH]OO1_m2' , 'formula': 'c-CHOOCH2', 'delHf': { 'ANL0': 203.5 }},
{ '_id' : '[O]OC=C_m2' , 'formula': 'CH2CHOO', 'delHf': { 'ANL0': 118.5 }},
{ '_id' : 'OOC=[CH]_m2' , 'formula': 'CHCHOOH', 'delHf': { 'ANL0': 230.5 }},
{ '_id' : 'OC(=C)O_m1' , 'formula': 'CH2C(OH)2', 'delHf': { 'ANL0': -307.4 }},
{ '_id' : 'OCC=O_m1' , 'formula': 'OCHCH2OH', 'delHf': { 'ANL0': -303.6 }},
{ '_id' : 'OC=CO_m1' , 'formula': 'OHCHCHOH', 'delHf': { 'ANL0': -273.5 }},
{ '_id' : 'CO[C]O_m1' , 'formula': 'CH3OCOH', 'delHf': { 'ANL0': -171.1 }},
{ '_id' : 'OOC=C_m1' , 'formula': 'CH2CHOOH', 'delHf': { 'ANL0': -26.7 }},
{ '_id' : 'C[CH]O[O]_m1' , 'formula': 'CH3CHOO', 'delHf': { 'ANL0': 49.1 }},
{ '_id' : 'O[CH]CO_m2' , 'formula': 'OHCHCH2OH', 'delHf': { 'ANL0': -196.1 }},
{ '_id' : 'CO[CH]O_m2' , 'formula': 'CH3OCHOH', 'delHf': { 'ANL0': -171 }},
{ '_id' : '[CH2]OCO_m2' , 'formula': 'OHCH2OCH2', 'delHf': { 'ANL0': -166.7 }},
{ '_id' : 'OCC[O]_m2' , 'formula': 'OHCH2CH2O', 'delHf': { 'ANL0': -147.2 }},
{ '_id' : 'COC[O]_m2' , 'formula': 'CH3OCH2O', 'delHf': { 'ANL0': -130.9 }},
{ '_id' : '[CH2]COO_m2' , 'formula': 'CH2CH2OOH', 'delHf': { 'ANL0': 65.2 }},
{ '_id' : 'CCOO_m1' , 'formula': 'CH3CH2OOH', 'delHf': { 'ANL0': -141.1 }},
{ '_id' : 'COOC_m1' , 'formula': 'CH3OOCH3', 'delHf': { 'ANL0': -101.3 }},
{ '_id' : 'O=C=C=C=O_m1' , 'formula': 'OCCCO', 'delHf': { 'ANL0': -92.9 }},
{ '_id' : '[O]C(=O)[O]_m1', 'formula': 'OC(O)O', 'delHf': { 'ANL0': -147 }},
{ '_id' : 'O=C1OO1_m1' , 'formula': 'c-C(O)OO', 'delHf': { 'ANL0': -161.5 }},
{ '_id' : 'OC(=O)[O]_m2' , 'formula': 'OHC(O)O', 'delHf': { 'ANL0': -361.3 }},
{ '_id' : '[O]OC=O_m2' , 'formula': 'OCHOO', 'delHf': { 'ANL0': -100.3 }},
{ '_id' : 'OO[C]=O_m2' , 'formula': 'OCOOH', 'delHf': { 'ANL0': -73.3 }},
{ '_id' : 'OC1OO1_m1' , 'formula': 'c-CH(OH)OO', 'delHf': { 'ANL0': -216.7 }},
{ '_id' : 'O[C](O)O_m2' , 'formula': 'C(OH)3', 'delHf': { 'ANL0': -401.1 }},
{ '_id' : '[O]OCO_m2' , 'formula': 'OHCH2OO', 'delHf': { 'ANL0': -154.2 }},
{ '_id' : 'OOC[O]_m2' , 'formula': 'OCH2OOH', 'delHf': { 'ANL0': -77.2 }},
{ '_id' : 'COO[O]_m2' , 'formula': 'CH3OOO', 'delHf': { 'ANL0': 27.6 }},
{ '_id' : 'OC(O)O_m1' , 'formula': 'CH(OH)3', 'delHf': { 'ANL0': -588 }},
{ '_id' : 'OOCO_m1' , 'formula': 'OHCH2OOH', 'delHf': { 'ANL0': -299.6 }},
{ '_id' : 'COOO_m1' , 'formula': 'CH3OOOH', 'delHf': { 'ANL0': -71 }},
{ '_id' : '[N]_m4' , 'formula': 'N' , 'delHf': { 'ATcT': 470.6 , 'ANL0': 470.4 , 'ANL1': 469.7 , 'ATcTsig': 0 }},
{ '_id' : '[NH]_m3' , 'formula': 'NH' , 'delHf': { 'ATcT': 358.7 , 'ANL0': 359 , 'ANL1': 358.5 , 'ATcTsig': 0.2 }},
{ '_id' : '[NH2]_m2' , 'formula': 'NH2' , 'delHf': { 'ATcT': 188.9 , 'ANL0': 189.1 , 'ANL1': 188.9 , 'ATcTsig': 0.1 }},
{ '_id' : 'N_m1' , 'formula': 'NH3' , 'delHf': { 'ATcT': -38.6, 'ANL0': 0 , 'ATcTsig': 0 }},
{ '_id' : 'N#N_m1' , 'formula': 'N2' , 'delHf': { 'ATcT': 0 , 'ANL0': -0.3 , 'ANL1': -0.1 , 'ATcTsig': 0 }},
{ '_id' : 'N=[N]_m2' , 'formula': 'NNH' , 'delHf': { 'ATcT': 252.2 , 'ANL0': 251.7 , 'ANL1': 251.7 , 'ATcTsig': 0.5 }},
{ '_id' : 'N=N_m1' , 'formula': 'NHNH' , 'delHf': { 'ATcT': 207.3 , 'ANL0': 206.8 , 'ANL1': 207.1 , 'ATcTsig': 0.4 }},
{ '_id' : 'N[N]_m1' , 'formula': 'NH2N' , 'delHf': { 'ATcT': 308 , 'ANL0': 307.2 , 'ANL1': 307.5 , 'ATcTsig': 0.7 }},
{ '_id' : 'N[NH]_m2' , 'formula': 'NHNH2' , 'delHf': { 'ATcT': 235.3 , 'ANL0': 234.4 , 'ANL1': 234.3 , 'ATcTsig': 0.8 }},
{ '_id' : 'NN_m1' , 'formula': 'NH2NH2' , 'delHf': { 'ATcT': 111.8 , 'ANL0': 111.1 , 'ANL1': 111.8 , 'ATcTsig': 0.5 }},
{ '_id' : '[C]#N_m2' , 'formula': 'CN' , 'delHf': { 'ATcT': 436.7 , 'ANL0': 435.4 , 'ANL1': 436 , 'ATcTsig': 0.1 }},
{ '_id' : 'C#N_m1' , 'formula': 'HCN' , 'delHf': { 'ATcT': 129.7 , 'ANL0': 129 , 'ANL1': 129.1 , 'ATcTsig': 0.1 }},
{ '_id' : '[C]=N_m1' , 'formula': 'CNH' , 'delHf': { 'ATcT': 192 , 'ANL0': 191.8 , 'ANL1': 191.7 , 'ATcTsig': 0.4 }},
{ '_id' : 'C=[N]_m2' , 'formula': 'CH2N' , 'delHf': { 'ATcT': 242.2 , 'ANL0': 242.8 , 'ANL1': 242.2 , 'ATcTsig': 0.8 }},
{ '_id' : '[CH]=N_m2' , 'formula': 'CHNH' , 'delHf': { 'ATcT': 275.9 , 'ANL0': 275.5 , 'ANL1': 275.7 , 'ATcTsig': 0.8 }},
{ '_id' : 'C=N_m1' , 'formula': 'CH2NH' , 'delHf': { 'ATcT': 96.5 , 'ANL0': 96.2 , 'ANL1': 96.3 , 'ATcTsig': 0.6 }},
{ '_id' : 'C[N]_m3' , 'formula': 'CH3N' , 'delHf': { 'ATcT': 323.8 , 'ANL0': 323.7 , 'ANL1': 322.9 , 'ATcTsig': 1.6 }},
{ '_id' : '[CH2]N_m2' , 'formula': 'CH2NH2' , 'delHf': { 'ATcT': 159.4 , 'ANL0': 159.8 , 'ANL1': 159.5 , 'ATcTsig': 0.6 }},
{ '_id' : 'C[NH]_m2' , 'formula': 'CH3NH' , 'delHf': { 'ATcT': 187.9 , 'ANL0': 189.3 , 'ANL1': 189 , 'ATcTsig': 0.6 }},
{ '_id' : 'CNC_m1' , 'formula': 'CH3NHCH3' , 'delHf': { 'ATcT': 5.9 , 'ANL0': 5.9 , 'ATcTsig': 0.7 }},
{ '_id' : 'CN_m1' , 'formula': 'CH3NH2' , 'delHf': { 'ATcT': -6 , 'ANL0': -6.3 , 'ANL1': -6 , 'ATcTsig': 0.5 }},
{ '_id' : '[N]=C=[N]_m3' , 'formula': 'NCN' , 'delHf': { 'ATcT': 450.4 , 'ANL0': 450.5 , 'ANL1': 450.1 , 'ATcTsig': 0.7 }},
{ '_id' : 'N=C=[N]_m2' , 'formula': 'NCNH' , 'delHf': { 'ATcT': 324.7 , 'ANL0': 321.5 , 'ANL1': 321.4 , 'ATcTsig': 1.7 }},
{ '_id' : '[CH]N=[N]_m2' , 'formula': 'CHNN' , 'delHf': { 'ATcT': 472.8 , 'ANL0': 465.5 , 'ANL1': 465.7 , 'ATcTsig': 1.9 }},
{ '_id' : 'N#CC#N_m1' , 'formula': 'NCCN' , 'delHf': { 'ATcT': 308.2 , 'ANL0': 306.6 , 'ANL1': 306.9 , 'ATcTsig': 0.4 }},
{ '_id' : '[C]=N[C]=N_m1' , 'formula': 'CNCN' , 'delHf': { 'ATcT': 410.7 , 'ANL0': 412.5 , 'ATcTsig': 1.6 }},
{ '_id' : '[N]=O_m2' , 'formula': 'NO' , 'delHf': { 'ATcT': 90.6 , 'ANL0': 91.2 , 'ANL1': 91.1 , 'ATcTsig': 0.1 }},
{ '_id' : 'N=O_m1' , 'formula': 'HNO' , 'delHf': { 'ATcT': 109.9 , 'ANL0': 109.7 , 'ANL1': 109.8 , 'ATcTsig': 0.1 }},
{ '_id' : '[N]O_m3' , 'formula': 'NOH' , 'delHf': { 'ATcT': 217.5 , 'ANL0': 217.9 , 'ANL1': 217.6 , 'ATcTsig': 0.9 }},
{ '_id' : 'N[O]_m2' , 'formula': 'NH2O' , 'delHf': { 'ATcT': 71.3 , 'ANL0': 71.1 , 'ANL1': 70.5 , 'ATcTsig': 0.8 }},
{ '_id' : '[NH]O_m2' , 'formula': 'NHOH' , 'delHf': { 'ATcT': 101.5 , 'ANL0': 100.8 , 'ANL1': 100.9 , 'ATcTsig': 1 }},
{ '_id' : 'NO_m1' , 'formula': 'NH2OH' , 'delHf': { 'ATcT': -33.1 , 'ANL0': -33.3 , 'ANL1': -33 , 'ATcTsig': 0.5 }},
{ '_id' : '[N]N=O_m1' , 'formula': 'NNO' , 'delHf': { 'ATcT': 86 , 'ANL0': 85.4 , 'ANL1': 86.6 , 'ATcTsig': 0.1 }},
{ '_id' : '[O]N=O_m2' , 'formula': 'ONO' , 'delHf': { 'ATcT': 36.9 , 'ANL0': 36.7 , 'ANL1': 36.3 , 'ATcTsig': 0.1 }},
{ '_id' : 'ON=O_m1' , 'formula': 'ONOH' , 'delHf': { 'ATcT': -73 , 'ANL0': -73.3 , 'ANL1': -72.4 , 'ATcTsig': 0.1 }},
{ '_id' : '[O]N[O]_m1' , 'formula': 'ONHO' , 'delHf': { 'ATcT': -37.2 , 'ANL0': -36.5 , 'ANL1': -35.9 , 'ATcTsig': 1.4 }},
{ '_id' : '[O]N([O])[O]_m2' , 'formula': 'ON(O)O' , 'delHf': { 'ATcT': 79.4 , 'ANL0': 77.3 , 'ATcTsig': 0.2 }},
{ '_id' : 'ON([O])[O]_m1' , 'formula': 'ON(OH)O' , 'delHf': { 'ATcT': -124.5 , 'ANL0': -124.1 , 'ATcTsig': 0.2 }},
{ '_id' : 'OON=O_m1' , 'formula': 'ONOOH' , 'delHf': { 'ATcT': -6 , 'ANL0': -7.3 , 'ATcTsig': 0.4 }},
{ '_id' : '[O]C#N_m2' , 'formula': 'NCO' , 'delHf': { 'ATcT': 127 , 'ANL0': 126.4 , 'ANL1': 126.6 , 'ATcTsig': 0.3 }},
{ '_id' : '[O]N=[C]_m2' , 'formula': 'CNO' , 'delHf': { 'ATcT': 389.4 , 'ANL0': 389.8 , 'ANL1': 389.5 , 'ATcTsig': 1.4 }},
{ '_id' : 'N=C=O_m1' , 'formula': 'NHCO' , 'delHf': { 'ATcT': -115.9 , 'ANL0': -116.3 , 'ANL1': -115.7 , 'ATcTsig': 0.3 }},
{ '_id' : 'OC#N_m1' , 'formula': 'NCOH' , 'delHf': { 'ATcT': -12.2 , 'ANL0': -12.7 , 'ANL1': -12.4 , 'ATcTsig': 0.5 }},
{ '_id' : '[CH]N=O_m1' , 'formula': 'CHNO' , 'delHf': { 'ATcT': 170.9 , 'ANL0': 169.8 , 'ANL1': 170.2 , 'ATcTsig': 0.5 }},
{ '_id' : 'ON=[C]_m1' , 'formula': 'CNOH' , 'delHf': { 'ATcT': 235.4 , 'ANL0': 235.1 , 'ANL1': 235.2 , 'ATcTsig': 0.5 }},
{ '_id' : '[CH2]N([O])[O]_m2', 'formula': 'CH2N(O)O', 'delHf': { 'ATcT': 138.8 , 'ANL0': 138.8 , 'ATcTsig': 1.2 }},
{ '_id' : 'CN([O])[O]_m1' , 'formula': 'CH3N(O)O', 'delHf': { 'ATcT': -60.9 , 'ANL0': -60.9 , 'ATcTsig': 0.5 }},
{ '_id' : 'CON=O_m1' , 'formula': 'CH3ONO', 'delHf': { 'ATcT': -55.5 , 'ANL0': -54.6 , 'ATcTsig': 0.5 }},
{ '_id' : 'C=C=[N]_m2' , 'formula': 'CH2CN' , 'delHf': { 'ANL0': 264 }},
{ '_id' : '[CH]=C=N_m2' , 'formula': 'CHCNH' , 'delHf': { 'ANL0': 396.3 }},
{ '_id' : 'CC#N_m1' , 'formula': 'CH3CN' , 'delHf': { 'ANL0': 80.1 }},
{ '_id' : 'CN=[C]_m1' , 'formula': 'CH3NC' , 'delHf': { 'ANL0': 183.8 }},
{ '_id' : 'NC=C_m1' , 'formula': 'CH2CNH' , 'delHf': { 'ANL0': 193.5 }},
{ '_id' : 'NC#C_m1' , 'formula': 'CHCNH2' , 'delHf': { 'ANL0': 253.2 }},
{ '_id' : 'C1C=N1_m1' , 'formula': 'c-CH2CHN' , 'delHf': { 'ANL0': 280.8 }},
{ '_id' : '[CH2]C=[N]_m3' , 'formula': 'CH2CHN' , 'delHf': { 'ANL0': 369.2 }},
{ '_id' : 'CC=[N]_m2' , 'formula': 'CH3CHN' , 'delHf': { 'ANL0': 210.7 }},
{ '_id' : '[NH]C=C_m2' , 'formula': 'CH2CHNH' , 'delHf': { 'ANL0': 219.7 }},
{ '_id' : 'C[C]=N_m2' , 'formula': 'CH3CNH' , 'delHf': { 'ANL0': 233.7 }},
{ '_id' : '[CH2]N=C_m2' , 'formula': 'CH2NCH2' , 'delHf': { 'ANL0': 252.2 }},
{ '_id' : 'CN[CH]_m2' , 'formula': 'CH3NCH' , 'delHf': { 'ANL0': 278.6 }},
{ '_id' : 'N[C]=C_m2' , 'formula': 'CH2CNH2' , 'delHf': { 'ANL0': 294.8 }},
{ '_id' : 'CC=N_m1' , 'formula': 'CH3CHNH' , 'delHf': { 'ANL0': 55.9 }},
{ '_id' : 'NC=C_m1' , 'formula': 'CH2CHNH2' , 'delHf': { 'ANL0': 69 }},
{ '_id' : 'CN=C_m1' , 'formula': 'CH3NCH2' , 'delHf': { 'ANL0': 95.1 }},
{ '_id' : 'C[CH]N_m2' , 'formula': 'CH3CHNH2' , 'delHf': { 'ANL0': 133.4 }},
{ '_id' : 'CC[NH]_m2' , 'formula': 'CH3CH2NH' , 'delHf': { 'ANL0': 167.4 }},
{ '_id' : 'CN[CH2]_m2' , 'formula': 'CH3NHCH2' , 'delHf': { 'ANL0': 169.5 }},
{ '_id' : '[CH2]CN_m2' , 'formula': 'CH2CH2NH2' , 'delHf': { 'ANL0': 175.2 }},
{ '_id' : 'CNC_m1' , 'formula': 'CH3NCH3' , 'delHf': { 'ANL0': 176.7 }},
{ '_id' : 'CCN_m1' , 'formula': 'CH3CH2NH2' , 'delHf': { 'ANL0': -28.1 }},
{ '_id' : '[C]#CC#N_m2' , 'formula': 'C3N' , 'delHf': { 'ANL0': 717.3 }},
{ '_id' : 'C#CC#N_m1' , 'formula': 'CHCCN' , 'delHf': { 'ANL0': 372.3 }},
{ '_id' : 'C=C=C=[N]_m2' , 'formula': 'CH2CCN' , 'delHf': { 'ANL0': 416.3 }},
{ '_id' : '[CH]=CC#N_m2' , 'formula': 'CHCHCN' , 'delHf': { 'ANL0': 447.2 }},
{ '_id' : '[N]=CC#C_m2' , 'formula': 'CHCCHN' , 'delHf': { 'ANL0': 498.6 }},
{ '_id' : '[CH]=NC#C_m2' , 'formula': 'CHCNCH' , 'delHf': { 'ANL0': 564.4 }},
{ '_id' : 'C=CC#N_m1' , 'formula': 'CH2CHCN' , 'delHf': { 'ANL0': 193.7 }},
{ '_id' : 'C=CC=[N]_m2' , 'formula': 'CH2CHCHN' , 'delHf': { 'ANL0': 312.5 }},
{ '_id' : 'c1ccc[nH]1_m1' , 'formula': 'c-CHCHCHCHNH' , 'delHf': { 'ANL0': 124.9 }},
{ '_id' : '[C]#CC#CC#N_m2' , 'formula': 'CCCCCN' , 'delHf': { 'ANL0': 943.8 }},
{ '_id' : 'C#CC#CC#N_m1' , 'formula': 'CHCCCCN' , 'delHf': { 'ANL0': 599.8 }},
{ '_id' : 'N1=N[CH]1_m2' , 'formula': 'c-CHN2' , 'delHf': { 'ANL0': 489.3 }},
{ '_id' : '[N]=CC#N_m2' , 'formula': 'NCCHN' , 'delHf': { 'ANL0': 412.6 }},
{ '_id' : '[CH]=NC#N_m2' , 'formula': 'NCNCH' , 'delHf': { 'ANL0': 515.3 }},
{ '_id' : '[N]=NC#C_m2' , 'formula': 'CHCNN' , 'delHf': { 'ANL0': 565.1 }},
{ '_id' : '[O]N=N_m2' , 'formula': 'NHNO' , 'delHf': { 'ANL0': 208.7 }},
{ '_id' : 'ON=N_m1' , 'formula': 'NHNOH' , 'delHf': { 'ANL0': 87.7 }},
{ '_id' : 'NN=O_m1' , 'formula': 'NH2NO' , 'delHf': { 'ANL0': 88.7 }},
{ '_id' : 'NN([O])[O]_m1' , 'formula': 'NH2N(O)O' , 'delHf': { 'ANL0': 17.1 }},
{ '_id' : '[NH]N([O])O_m1' , 'formula': 'NHN(O)OH' , 'delHf': { 'ANL0': 54 }},
{ '_id' : 'NON=O_m1' , 'formula': 'NH2ONO' , 'delHf': { 'ANL0': 95.4 }},
{ '_id' : '[O]N=C_m2' , 'formula': 'CH2NO' , 'delHf': { 'ANL0': 160.4 }},
{ '_id' : 'ON=[CH]_m2' , 'formula': 'CHNOH' , 'delHf': { 'ANL0': 257.1 }},
{ '_id' : 'N[C]=O_m2' , 'formula': 'NH2CO' , 'delHf': { 'ANL0': -8.7 }},
{ '_id' : 'NC=O_m1' , 'formula': 'NH2CHO' , 'delHf': { 'ANL0': -184.7 }},
{ '_id' : 'CN=O_m1' , 'formula': 'CH3NO' , 'delHf': { 'ANL0': 81.4 }},
{ '_id' : '[CH]CN=O_m2' , 'formula': 'CHCHNO' , 'delHf': { 'ANL0': 423.9 }},
{ '_id' : 'C=CN=O_m1' , 'formula': 'CH2CHNO' , 'delHf': { 'ANL0': 175.2 }},
{ '_id' : 'C[CH]N=O_m2' , 'formula': 'CH3CHNO' , 'delHf': { 'ANL0': 125.8 }},
{ '_id' : 'CCN=O_m1' , 'formula': 'CH3CH2NO' , 'delHf': { 'ANL0': 59.7 }},
{ '_id' : '[O]OC#N_m2' , 'formula': 'NCOO' , 'delHf': { 'ANL0': 282.3 }},
{ '_id' : '[CH2]N([O])O_m2' , 'formula': 'CH2N(O)OH' , 'delHf': { 'ANL0': -3 }},
{ '_id' : 'COO[N]_m1' , 'formula': 'CH3OON' , 'delHf': { 'ANL0': 81.1 }},
{ '_id' : 'CN([O])O_m2' , 'formula': 'CH3N(O)OH' , 'delHf': { 'ANL0': -13.4 }},
{ '_id' : 'NC(=O)N_m1' , 'formula': 'NH2C(O)NH2' , 'delHf': { 'ANL0': -214.3 }},
{ '_id' : '[CH2]C#C_m2' , 'formula': 'CH2CCH' , 'delHf': { 'ANL0': 355.33 }},
{ '_id' : '[C][C][O]_m3' , 'formula': 'CCO' , 'delHf': { 'ANL0': 378.33 }},
{ '_id' : '[CH2]C=C=O_m2' , 'formula': 'CH2CHCO' , 'delHf': { 'ANL0': 103.16 }},
{ '_id' : 'C/C=C/[CH2]_m2' , 'formula': 'CH3CHCHCH2;trans' , 'delHf': { 'ANL0': 156.54 }},
{ '_id' : 'C/C=C\[CH2]_m2' , 'formula': 'CH3CHCHCH2;cis' , 'delHf': { 'ANL0': 156.54 }},
{ '_id' : 'C/C=C\[CH2]_m2' , 'formula': 'CH3CHCHCH2;cis' , 'delHf': { 'ANL0': 156.54 }},
{ '_id' : '[O]C=C=O_m2' , 'formula': 'OCHCO' , 'delHf': { 'ANL0': -63.45 }},
{ '_id' : '[O]C=C=O_m2' , 'formula': 'OCHCO' , 'delHf': { 'ANL0': -63.45 }},
{ '_id' : '[CH2]/C=C/O_m2' , 'formula': 'CH2CHCHOH;trans' , 'delHf': { 'ANL0': 2.7 }},
{ '_id' : '[CH2]/C=C\O_m2' , 'formula': 'CH2CHCHOH;cis' , 'delHf': { 'ANL0': 2.7 }},
{ '_id' : '[CH2][CH]_m2' , 'formula': 'CH2CH' , 'delHf': { 'ANL0': 302.03 }},
{ '_id' : '[O]OC=C_m2' , 'formula': 'CH2CHOO' , 'delHf': { 'ANL0': 118.98 }}
]
|
[
"sarah.elliott26@uga.edu"
] |
sarah.elliott26@uga.edu
|
af8e2b06212eed4f6b85dcdf5cfc89c85fa1d032
|
16378f47e8f366f3400f0a05c2d583da94c548d5
|
/Projects/project1/dice_game.py
|
29c22c384eda3c16489dd148bf54ec52c43f8f05
|
[] |
no_license
|
nicsins/Capstone2020
|
1bcd5df596e82f868bd833bbce0bba4221ffd214
|
149625f13f7d295e2f0ce1ff863f4dbf0a6593c6
|
refs/heads/master
| 2020-12-12T14:28:51.441461
| 2020-02-26T22:17:56
| 2020-02-26T22:17:56
| 234,150,083
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 926
|
py
|
from random import randint as r
#simple die class
class Die():
roll=r(1,6)
# get player name
def __getattr__():
return input('please enter your name')
# determine palyers rolls
def player_roll():
return Die.roll
def computer_roll():
return Die.roll
def outcome(name,player,computer):
print(f'{name} you rolled a {player} and the computer rolled a {computer}')
def game_loop(name):
while True:
player=player_roll()
computer=computer_roll()
outcome(name, player, computer)
if player > computer:
print(f'{name} you win')
elif player<computer:
print(f'The computer wins :(')
else :
print("Tie Game!")
again=input('would you like to play again? press y to continue any other key to quit').lower()
if again!='y':
return False
if __name__ == '__main__':
game_loop(name=__getattr__())
|
[
"DominicB@email.com"
] |
DominicB@email.com
|
585b0561eaa4209c11e08a59e043bd686d5fd41d
|
43be487bd69b82bcad74764ca63545e5d6d49d25
|
/gpa/GPA.py
|
236aa060bd8e51e875b1ed48f224d0697dcbc80e
|
[] |
no_license
|
Bullldoger/graduate-work
|
0e5740b57dcd120b68da9486e2220e1fcdb74d09
|
4509da5aae86b53d7a9957b2b31991dcdd9b174c
|
refs/heads/master
| 2021-05-07T01:28:37.191745
| 2018-04-27T21:49:37
| 2018-04-27T21:49:37
| 110,348,180
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 19,207
|
py
|
"""
Contain a class declaration with represent GPA system
"""
import math
from copy import deepcopy
import sympy as sm
import networkx as nx
import numpy
from numpy import dot
class GPA:
"""
Represent GPA system
"""
def __init__(self, params=None):
"""
:param params: system configuration of gpa
:type params: dict()
params(example):
{
"approximation": {
"p2": 1,
"x1": 1,
"x2": 1,
"x3": 1
},
"edges": {
"count": 3,
"edges_info": {
"1": {
"A": 0.1,
"u": "1",
"v": "2",
"x": null
},
"2": {
"A": 0.1,
"u": "2",
"v": "3",
"x": null
},
"3": {
"A": 0.1,
"u": "2",
"v": "4",
"x": null
}
}
},
"nodes": {
"count": 4,
"nodes_info": {
"1": {
"P": {
"P": 8,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "1"
},
"2": {
"P": {
"P": null,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": 0,
"Q_max": 100,
"Q_min": 0
},
"name": "2"
},
"3": {
"P": {
"P": 5,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "3"
},
"4": {
"P": {
"P": 5,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "4"
}
}
}
}
"""
self.gpa = nx.DiGraph()
"attribute GPA.gpa GPA structure graph"
self.N_v = params['nodes']['count']
"attribute GPA.N_v - number of nodes"
self.N_e = params['edges']['count']
"attribute GPA.N_e - number of edges"
self.p_var = self.p_fix = self.q_var = self.q_fix = self.dp_var = self.dq_var = None
"attribute GPA.p_var - variables p"
"attribute GPA.p_fix - fixed p"
"attribute GPA.q_var - variables q"
"attribute GPA.q_fix - fixed q"
self.M_PP = self.M_PQ = self.M_QP = self.M = self.inv_M = None
self.known_p_nodes = list()
"attribute GPA.known_p_nodes - vertex order"
self.known_q_nodes = list()
"attribute GPA.known_q_nodes- edges order"
self.unknown_p = list()
"attribute GPA.unknown_p - names of p variables"
self.unknown_q = list()
"attribute GPA.unknown_q - names of q variables"
self.base_approximation = dict()
"attribute GPA.base_approximation - values of variables from params"
self.find_approximation = None
"attribute GPA.find_approximation - founded variables"
self.full_approximation = None
self.matrix_rows_order = list()
"attribute GPA.matrix_rows_order - rows order"
self.nodes_info = params['nodes']['nodes_info']
self.edges_info = params['edges']['edges_info']
self.variables = list()
"attribute GPA.variables - variables for searching"
self.var_literals = list()
"attribute GPA.var_literals - names of variables for searching"
self.modeling_gpa = list()
self._read_nodes(self.nodes_info)
self._read_edges(self.edges_info)
self._init_matrix()
self._init_equations()
self._init_jacobi_matrix()
self.solving_errors = list()
def _read_nodes(self, node_part=None):
"""
:param node_part: dictionary nodes attributes declaration and all values
:type node_part: dict()
node_part(example):
{
"count": 4,
"nodes_info": {
"1": {
"P": {
"P": 8,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "1"
},
"2": {
"P": {
"P": null,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": 0,
"Q_max": 100,
"Q_min": 0
},
"name": "2"
},
"3": {
"P": {
"P": 5,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "3"
},
"4": {
"P": {
"P": 5,
"P_max": 100,
"P_min": 0
},
"Q": {
"Q": null,
"Q_max": 100,
"Q_min": 0
},
"name": "4"
}
}
:return:
"""
if node_part is None:
node_part = {}
self.nodes_numeration = dict()
node_index = 0
for node, value in sorted(node_part.items(), key=lambda x: x[0]):
self.nodes_numeration[node] = node_index
node_index += 1
name = value['name']
p_info = value['P']
q_info = value['Q']
p = p_info['P']
p_max = p_info['P_max']
p_min = p_info['P_min']
q = q_info['Q']
q_max = q_info['Q_max']
q_min = q_info['Q_min']
var_p = sm.symbols('p' + str(node))
var_q = sm.symbols('q' + str(node))
self.unknown_p.append(var_p)
self.unknown_q.append(var_q)
if p is None:
p = sm.symbols('p' + str(node))
self.variables.append(p)
self.var_literals.append(str(p))
else:
self.base_approximation[str(var_p)] = p
self.known_p_nodes.append(node)
if q is None:
q = sm.symbols('q' + str(node))
self.unknown_q.append(q)
else:
self.base_approximation[str(var_q)] = q
self.known_q_nodes.append(node)
dp = sm.symbols('dp' + str(node))
dq = sm.symbols('dq' + str(node))
self.gpa.add_node(node, P=p, P_min=p_min,
P_max=p_max, Q=q, Q_min=q_min,
Q_max=q_max, name=name, var=var_p, dp=dp, dq=dq)
self.nodes = list(self.gpa.nodes())
for node in self.known_q_nodes + self.known_p_nodes:
self.matrix_rows_order.append(self.nodes.index(node))
tmp_p = list()
for node in self.known_p_nodes:
tmp_p.append(self.nodes.index(node))
tmp_q = list()
for node in self.known_q_nodes:
tmp_q.append(self.nodes.index(node))
self.known_p_nodes, self.known_q_nodes = tmp_p, tmp_q
def _init_matrix(self):
"""
Initializations of base matrix
:return:
"""
self.X = sm.zeros(rows=self.N_e, cols=1)
for edge in self.gpa.edges():
edge_index = list(self.gpa.edges()).index(edge)
edge_params = self.gpa.edges[edge]
self.X[edge_index] = edge_params['var']
self.X = numpy.array(self.X)
self.A = numpy.array(nx.incidence_matrix(self.gpa, oriented=True).todense())
self.Q = sm.Matrix(numpy.dot(self.A, self.X))
self.P = sm.zeros(rows=self.N_v, cols=1)
self.dP = sm.zeros(rows=self.N_v, cols=1)
self.dQ = sm.zeros(rows=self.N_v, cols=1)
for node in self.gpa.nodes():
node_index = list(self.gpa.nodes()).index(node)
node_params = self.gpa.nodes[node]
self.P[node_index] = node_params['var']
self.dP[node_index] = node_params['dp']
self.dQ[node_index] = node_params['dq']
self.X = sm.Matrix(self.X)
self.Q = sm.Matrix(self.Q)
self.A = sm.Matrix(self.A)
self.AF = deepcopy(self.A)
self.AL = deepcopy(self.A)
for row in range(self.AF.shape[0]):
for col in range(self.AF.shape[1]):
if self.AF[row, col] == -1:
self.AF[row, col] = 0
for row in range(self.AL.shape[0]):
for col in range(self.AL.shape[1]):
if self.AL[row, col] == 1:
self.AL[row, col] = 0
self.DF = sm.zeros(len(self.gpa.edges()), 1)
self.DL = sm.zeros(len(self.gpa.edges()), 1)
for eq_index, edge in enumerate(self.gpa.edges()):
u = edge[0]
v = edge[1]
p_s = self.gpa.nodes[u]['var']
p_f = self.gpa.nodes[v]['var']
a = self.gpa.edges[edge]['A']
eq = sm.sqrt((p_s ** 2 - p_f ** 2) / a)
self.DF[eq_index] = sm.diff(eq, p_s)
self.DL[eq_index] = -sm.diff(eq, p_f)
self.DF = sm.diag(*self.DF)
self.DL = sm.diag(*self.DL)
def _init_equations(self):
"""
Initializations of equations
:return:
"""
edges = self.gpa.edges()
nodes = self.gpa.nodes()
self.equations = list()
self.equations_vars = list()
for u, v in sorted(self.gpa.edges(), key=lambda x: int(x[0])):
p_s = nodes[u]['P']
p_s_v = nodes[u]['var']
p_f = nodes[v]['P']
p_f_v = nodes[v]['var']
q = edges[(u, v)]['x']
q_v = edges[(u, v)]['var']
a = edges[(u, v)]['A']
eq = p_s ** 2 - p_f ** 2 - a * q ** 2
eq_v = p_s_v ** 2 - p_f_v ** 2 - a * q_v ** 2
self.equations.append(eq)
self.equations_vars.append(eq_v)
for el in self.internal_nodes:
eq_index = list(self.gpa.nodes()).index(el)
eq = deepcopy(self.Q[eq_index])
self.equations.append(eq)
self.equations_vars.append(eq)
self.Q[eq_index] = self.gpa.nodes[el]['Q']
self.equations = sm.Matrix(self.equations)
self.equations_vars = sm.Matrix(self.equations_vars)
def _read_edges(self, edge_part=None):
"""
:param edge_part:
:type edge_part: dict()
edge_part(example):
{
"count": 3,
"edges_info": {
"1": {
"A": 0.1,
"u": "1",
"v": "2",
"x": null
},
"2": {
"A": 0.1,
"u": "2",
"v": "3",
"x": null
},
"3": {
"A": 0.1,
"u": "2",
"v": "4",
"x": null
}
}
:return:
"""
internal_nodes = numpy.zeros([2, self.N_v])
for node_index, value in sorted(edge_part.items(), key=lambda sorting_param: int(sorting_param[0][0])):
u = value['u']
v = value['v']
a = value['A']
x = value['x']
u_index = self.nodes_numeration[u]
v_index = self.nodes_numeration[v]
internal_nodes[0, u_index] += 1
internal_nodes[1, v_index] += 1
var_x = sm.symbols('x' + str(node_index))
if not x:
x = var_x
self.variables.append(x)
self.var_literals.append(str(x))
self.gpa.add_edge(u_of_edge=u, v_of_edge=v, A=a, x=x, var=var_x)
internal_nodes = numpy.logical_and(internal_nodes[0, :], internal_nodes[1, :])
self.internal_nodes = set()
for node_index, is_internal in enumerate(internal_nodes):
if is_internal:
self.internal_nodes.add(str(node_index + 1))
def _init_jacobi_matrix(self):
"""
Initializations all jacobians
:return:
"""
self.jacobi_matrixes = dict()
self.Jacobi = sm.zeros(len(self.equations_vars), len(self.variables))
for eq_index, eq in enumerate(self.equations_vars):
for var_index, var in enumerate(self.variables):
eq_d = sm.diff(eq, var)
self.Jacobi[eq_index, var_index] = eq_d
for var_index, var in enumerate(self.variables):
jacobi_var = deepcopy(self.Jacobi)
jacobi_var[:, var_index] = self.equations_vars
self.jacobi_matrixes[str(var)] = jacobi_var
def _solve_step(self, approximation):
"""
:param approximation: approximation of current point
:type approximation: dict()
approximation(example):
{
"p2": 1,
"x1": 1,
"x2": 1,
"x3": 1
}
:return: new approximation
"""
solve_system = dict()
for var, jacobi_var in self.jacobi_matrixes.items():
jacobi = deepcopy(self.Jacobi)
jacobi = jacobi.subs(approximation.items()).det()
jacobi_var = jacobi_var.subs(approximation.items()).det()
solve_system[var] = jacobi_var / jacobi
for var, value in solve_system.items():
approximation[var] = approximation[var] - value
return approximation
def subs_approximation_structure_graph(self, gpa=None, approximation={}):
"""
:param approximation: approximation for subs to equations
:type approximation: dict
approximation(example):
{
"p2": 1,
"x1": 1,
"x2": 1,
"x3": 1
}
:return:
"""
if gpa is None:
gpa = self.gpa
for node in gpa.nodes():
node_info = gpa.nodes[node]
for var, value in approximation.items():
if str(node_info['P']) == var:
node_info['P'] = value
for edge in gpa.edges():
edge_info = gpa.edges[edge]
for var, value in approximation.items():
if str(edge_info['x']) == var:
edge_info['x'] = value
return gpa
def solve_equations(self, base_approximation=None, start_approximation=None, eps=0.001, iterations=25):
"""
:param base_approximation:
:param start_approximation: first approximation for searching system decision
:type start_approximation: dict()
:param eps: accuracy
:type eps: float
:param iterations: maximum of iterations for searching dicision
:type iterations: int
start_approximation(example):
{
"p2": 1,
"x1": 1,
"x2": 1,
"x3": 1
}
:return: searched dicision
"""
if not start_approximation:
raise KeyError('Начальное приближение не задано!')
if not base_approximation:
base_approximation = self.base_approximation
start_approximation_vars = list(start_approximation.keys())
for var in self.var_literals:
if var not in start_approximation_vars:
raise KeyError('Не задано начальное значение для ' + str(var))
approximation = start_approximation
approximation.update(base_approximation)
errors = list()
for _ in range(iterations):
approximation = self._solve_step(approximation)
error = deepcopy(self.equations.subs(approximation.items())).norm()
errors.append(error)
if error < eps:
break
points = -int(math.log10(eps))
for var in approximation:
approximation[var] = round(approximation[var], points)
self.find_approximation = approximation
self.full_approximation = deepcopy(self.base_approximation)
self.full_approximation.update(self.find_approximation)
self.solving_errors = errors
gpa = deepcopy(self.gpa)
self.subs_approximation_structure_graph(gpa, self.find_approximation)
self.modeling_gpa.append(gpa)
def construct_sense_matrix(self):
"""
Constructing all sensitivities matrixes
:return:
"""
self.p_var = self.dP[self.known_q_nodes, :]
self.p_fix = self.dP[self.known_p_nodes, :]
self.q_var = self.dQ[self.known_p_nodes, :]
self.q_fix = self.dQ[self.known_q_nodes, :]
a_q = self.A[self.known_q_nodes, :]
a_p = self.A[self.known_p_nodes, :]
a_f_q = self.AF[self.known_q_nodes, :]
a_f_p = self.AF[self.known_p_nodes, :]
a_l_q = self.AL[self.known_q_nodes, :]
a_l_p = self.AL[self.known_p_nodes, :]
d_f = self.DF
d_l = self.DL
self.M = a_q * (d_f * a_f_q.transpose() + d_l * a_l_q.transpose())
self.inv_M = deepcopy(self.M).inv()
self.M_PQ = a_p * (d_f * a_f_q.transpose() + d_l * a_l_q.transpose())
self.M_QP = a_q * (d_f * a_f_p.transpose() + d_l * a_l_p.transpose())
self.M_PP = a_p * (d_f * a_f_p.transpose() + d_l * a_l_p.transpose())
self.dp_var = self.inv_M * self.q_fix - self.inv_M * self.M_QP * self.p_fix
self.dq_var = self.M_PQ * self.inv_M * self.q_fix + (self.M_PP - self.M_PQ * self.inv_M * self.M_QP) * self.p_fix
out_d = dict()
var_index = 0
for eq in self.dp_var:
out_d['d' + str(self.variables[var_index])] = eq.subs(self.full_approximation.items())
var_index += 1
for eq in self.dq_var:
out_d['d' + str(self.variables[var_index])] = eq.subs(self.full_approximation.items())
var_index += 1
return out_d
|
[
"kaire1996@gmail.com"
] |
kaire1996@gmail.com
|
280a2b04ec7ec04eabd8222ef0006b43991c521d
|
52c705205b243016c90757ed9d7332840277ce11
|
/atracoes/migrations/0002_atracao_foto.py
|
3a8c8b3837477b1351ec35c732ceff2b24dfbd5b
|
[] |
no_license
|
lssdeveloper/pontos_turisticos
|
eb943549cb18561205818dcfb8c624bba32c7100
|
24852ca1b35795db876219a7a3439f496866d3d5
|
refs/heads/main
| 2023-04-03T10:24:22.000414
| 2021-04-15T20:13:02
| 2021-04-15T20:13:02
| 355,312,899
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 404
|
py
|
# Generated by Django 3.1.7 on 2021-04-09 02:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atracoes', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='atracao',
name='foto',
field=models.ImageField(blank=True, null=True, upload_to='atracoes'),
),
]
|
[
"leandro.serra.10@gmail.com"
] |
leandro.serra.10@gmail.com
|
487f68f34dcb908b166d179da6b8dfb4c51ce586
|
6b6dc8055603aeb8f69f4e6decc61eaf15c056af
|
/scripts/relax.py
|
f20f2f7606260ff8a7341c6aa0c1462363ad0133
|
[
"MIT"
] |
permissive
|
matteoferla/ITPA_analysis
|
1dfa3a630eb8bce0b1723e9b3c9d1261733a3d33
|
86280bd36f90c616046489cffe8c1afdfe57d679
|
refs/heads/main
| 2023-04-11T11:32:06.749553
| 2021-05-27T15:32:18
| 2021-05-27T15:32:18
| 315,982,053
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,635
|
py
|
# ED without membrane
# ======== init pyrosetta ==============================================================================================
import pyrosetta
from init import make_option_string
pyrosetta.init(extra_options=make_option_string(no_optH=False,
ex1=None,
ex2=None,
mute='all',
ignore_unrecognized_res=True,
load_PDB_components=False,
ignore_waters=False)
)
# ======== Pose ========================================================================================================
filename = ' hybrid.map_aligned.pdb'
params_filenames = ['ITP.params']
pose = pyrosetta.Pose()
if params_filenames:
params_paths = pyrosetta.rosetta.utility.vector1_string()
params_paths.extend(params_filenames)
pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
pyrosetta.rosetta.core.import_pose.pose_from_file(pose, filename)
# ======== Check ========================================================================================================
import nglview
view = nglview.show_rosetta(pose)
view.add_representation('spacefill', selection='ion')
view.add_representation('hyperball', selection='water')
view.add_representation('hyperball', selection='ITT', color='white')
view
# ======== scorefxn ====================================================================================================
scorefxnED = pyrosetta.get_fa_scorefxn() # ref2015 or franklin2019?
def get_ED(pose: pyrosetta.Pose, map_filename: str):
ED = pyrosetta.rosetta.core.scoring.electron_density.getDensityMap(map_filename) # from PDBe
sdsm = pyrosetta.rosetta.protocols.electron_density.SetupForDensityScoringMover()
sdsm.apply(pose)
return ED
def add_ED(ED, scorefxn: pyrosetta.rosetta.core.scoring.ScoreFunction):
elec_dens_fast = pyrosetta.rosetta.core.scoring.ScoreType.elec_dens_fast
scorefxn.set_weight(elec_dens_fast, 30)
return scorefxn
# ref2015 or franklin2019?
ED = get_ED(pose, '2j4e.ccp4')
scorefxnED = add_ED(ED, pyrosetta.create_score_function('ref2015'))
scorefxnED_cart = add_ED(ED, pyrosetta.create_score_function('ref2015_cart'))
# ======== relax =======================================================================================================
relax = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxnED_cart, 5)
relax.minimize_bond_angles(True)
relax.minimize_bond_lengths(True)
relax.apply(pose)
for w in (30, 20, 10):
elec_dens_fast = pyrosetta.rosetta.core.scoring.ScoreType.elec_dens_fast
scorefxnED.set_weight(elec_dens_fast, w)
relax = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxnED, 5)
# relax.minimize_bond_angles(True)
# relax.minimize_bond_lengths(True)
relax.apply(pose)
print('Match to ED', ED.matchPose(pose))
print('ED weight', scorefxnED.weights()[elec_dens_fast])
print('score', scorefxnED(pose))
reg_scorefxn = pyrosetta.get_fa_scorefxn()
print('How good is the density match:', ED.matchPose(pose))
print(reg_scorefxn.get_name(), reg_scorefxn(pose))
# ======== final =======================================================================================================
scorefxn = pyrosetta.create_score_function('ref2015')
print(scorefxn(pose))
relax = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxn, 3)
relax.apply(pose)
print(scorefxn(pose))
pose.dump_pdb('hybrid_relaxed.pdb')
|
[
"matteo.ferla@gmail.com"
] |
matteo.ferla@gmail.com
|
51d026cfa7430e8f7491129baabd72a37a91e840
|
49e49f91499acff2deb770a9d41fd3c7afa419d7
|
/boutique1/migrations/0021_auto_20170828_1007.py
|
30be1325a4f6e10529e4fd2964194cfe1339a9df
|
[] |
no_license
|
fakher-saafi/Boutique
|
a99b4ebc58e533305ac3322ecc7164dc338d42c2
|
33900be6847f5911b79c990ad8b439c398a1cc36
|
refs/heads/master
| 2021-01-20T22:05:50.693711
| 2017-08-30T07:27:59
| 2017-08-30T07:27:59
| 101,799,379
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 525
|
py
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-28 10:07
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boutique1', '0020_auto_20170827_1909'),
]
operations = [
migrations.AlterField(
model_name='collection',
name='created_at',
field=models.DateTimeField(default=datetime.datetime(2017, 8, 28, 10, 7, 38, 193577)),
),
]
|
[
"fakher.saafi@esprit.tn"
] |
fakher.saafi@esprit.tn
|
5ddfadb6800b7112cce4db57dc24afecba137124
|
da9b9f75a693d17102be45b88efc212ca6da4085
|
/sdk/identity/azure-identity/azure/identity/_credentials/chained.py
|
8f3a3acd0efa9bd2fe8ef6a5dd4a81948f2a433a
|
[
"LicenseRef-scancode-generic-cla",
"MIT"
] |
permissive
|
elraikhm/azure-sdk-for-python
|
e1f57b2b4d8cc196fb04eb83d81022f50ff63db7
|
dcb6fdd18b0d8e0f1d7b34fdf82b27a90ee8eafc
|
refs/heads/master
| 2021-06-21T22:01:37.063647
| 2021-05-21T23:43:56
| 2021-05-21T23:43:56
| 216,855,069
| 0
| 0
|
MIT
| 2019-10-22T16:05:03
| 2019-10-22T16:05:02
| null |
UTF-8
|
Python
| false
| false
| 2,471
|
py
|
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.core.exceptions import ClientAuthenticationError
try:
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False
if TYPE_CHECKING:
# pylint:disable=unused-import,ungrouped-imports
from typing import Any
from azure.core.credentials import AccessToken, TokenCredential
class ChainedTokenCredential(object):
"""A sequence of credentials that is itself a credential.
Its ``get_token`` method calls ``get_token`` on each credential in the sequence, in order, returning the first
valid token received.
:param credentials: credential instances to form the chain
:type credentials: :class:`azure.core.credentials.TokenCredential`
"""
def __init__(self, *credentials):
# type: (*TokenCredential) -> None
if not credentials:
raise ValueError("at least one credential is required")
self.credentials = credentials
def get_token(self, *scopes, **kwargs): # pylint:disable=unused-argument
# type: (*str, **Any) -> AccessToken
"""Request a token from each chained credential, in order, returning the first token received.
If none provides a token, raises :class:`azure.core.exceptions.ClientAuthenticationError` with an
error message from each credential.
:param str scopes: desired scopes for the token
:raises: :class:`azure.core.exceptions.ClientAuthenticationError`
"""
history = []
for credential in self.credentials:
try:
return credential.get_token(*scopes, **kwargs)
except ClientAuthenticationError as ex:
history.append((credential, ex.message))
except Exception as ex: # pylint: disable=broad-except
history.append((credential, str(ex)))
error_message = self._get_error_message(history)
raise ClientAuthenticationError(message=error_message)
@staticmethod
def _get_error_message(history):
attempts = []
for credential, error in history:
if error:
attempts.append("{}: {}".format(credential.__class__.__name__, error))
else:
attempts.append(credential.__class__.__name__)
return "No valid token received. {}".format(". ".join(attempts))
|
[
"noreply@github.com"
] |
elraikhm.noreply@github.com
|
6b126ed8f11be13685967d7a27133560fa43b6a6
|
c1ef956dec0cab468e99243e80a62ea260745a37
|
/2 Semestr/Cw7/Zad1.py
|
56bb013956c7e67139da5dc29c3af7384a8a5284
|
[] |
no_license
|
KaroSSSSS/Pyton-zaj-cia
|
c0d0f8be83843b68fa72ca73c4bcef80a6569cc5
|
e3f28ceb63d9e6399a69de32f05f04bd01629925
|
refs/heads/main
| 2023-05-13T13:09:23.909276
| 2021-06-04T09:43:39
| 2021-06-04T09:43:39
| 328,436,409
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 325
|
py
|
kod = input("Podaj kod pocztowy w oznaczeniu międzynarodowym: ")
def Add(kod, file):
file.write(kod)
file.close()
try:
file = open('kodPocztowy.txt', 'w')
if kod[0] == "P":
if kod[1] == "L":
Add(kod, file)
except FileNotFoundError:
print("to nie jest kod pocztowy Polski")
|
[
"noreply@github.com"
] |
KaroSSSSS.noreply@github.com
|
0648131ddb4cf752fd0f3e723810f1e182e08214
|
92d015e16cc1d2b4bea2eec54123d97443b42324
|
/9.py
|
312503dcd4a677fb7baaa55d590f572324a3e804
|
[] |
no_license
|
Shakarbek/ICT-task1
|
fae1c435794aac6fb4b70215eaf1f160544e5779
|
d139d88a9edecc9a898b50a82cda928e26690044
|
refs/heads/master
| 2023-01-18T21:33:17.154456
| 2020-11-25T14:44:11
| 2020-11-25T14:44:11
| 296,678,793
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 245
|
py
|
n=int(input())
s=input()
a_cnt=0
d_cnt=0
for char in s:
if char=="A":
a_cnt+=1
elif char=="D":
d_cnt+=1
if a_cnt>d_cnt:
print("Anton")
elif d_cnt>a_cnt:
print("Danik")
else:
print("Friendship")
|
[
"noreply@github.com"
] |
Shakarbek.noreply@github.com
|
87396bd41e695812d4d265028918ac9583cf9cdf
|
128994424a207ce8f946e72f2273d20f273596ad
|
/Assignment01/assignment1/sigmoid.py
|
1f67b0632d12d741702fe66b45e1b520868c6cfa
|
[] |
no_license
|
CaroDur/MachineLearning
|
0d72765444c8702ddc476c617012af5f74e336ee
|
07e59eba84d41752a808d43b8a8f270dcff96c41
|
refs/heads/main
| 2023-02-12T17:22:02.556330
| 2021-01-02T09:57:36
| 2021-01-02T09:57:36
| 303,332,465
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 876
|
py
|
import numpy as np
from numpy import exp
def sigmoid(z):
"""
Computes the sigmoid of z element-wise.
Args:
z: An np.array of arbitrary shape
Returns:
g: An np.array of the same shape as z
"""
# g is an np.array of the same shape as z
g = np.ones_like(z)
#######################################################################
# TODO: #
# Compute and return the sigmoid of z in g #
#######################################################################
g = 1/(1 + exp(-z))
#######################################################################
# END OF YOUR CODE #
#######################################################################
return g
|
[
"64893637+CaroDur@users.noreply.github.com"
] |
64893637+CaroDur@users.noreply.github.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.