hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 11 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 251 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 251 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 251 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 1 1.05M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.04M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
969ab9ef2de1a8573dbf6d90268f74dbc9e16fef | 29,479 | py | Python | utilities/access_concatenate_daily.py | pizzathief/PyFluxPro | c075c0040b4a9d6c9ab75ca1cef158f1307f8396 | [
"BSD-3-Clause"
] | 1 | 2021-01-17T20:53:39.000Z | 2021-01-17T20:53:39.000Z | utilities/access_concatenate_daily.py | pizzathief/PyFluxPro | c075c0040b4a9d6c9ab75ca1cef158f1307f8396 | [
"BSD-3-Clause"
] | null | null | null | utilities/access_concatenate_daily.py | pizzathief/PyFluxPro | c075c0040b4a9d6c9ab75ca1cef158f1307f8396 | [
"BSD-3-Clause"
] | null | null | null | """
Purpose:
Reads the hourly ACCESS files pulled from the BoM OPeNDAP site
and concatenates them into a single file.
This script file takes a control file name on the command line.
The control file lists the sites to be processed and the variables
to be processed.
Normal usage is to process all files in a monthly sub-directory.
Usage:
python access_concat.py access_concat.txt
Author: PRI
Date: September 2015
"""
# Python modules
import configobj
import datetime
import glob
import logging
import netCDF4
import numpy
import os
import pytz
import pdb
from scipy.interpolate import interp1d
import sys
# since the scripts directory is there, try importing the modules
sys.path.append('../scripts')
# PFP
import constants as c
import meteorologicalfunctions as mf
import qcio
import qcutils
# !!! classes !!!
# !!! start of function definitions !!!
def get_info_dict(cf,site):
info = {}
in_path = cf["Sites"][site]["in_filepath"]
in_name = cf["Sites"][site]["in_filename"]
info["in_filename"] = os.path.join(in_path,in_name)
out_path = cf["Sites"][site]["out_filepath"]
if not os.path.exists(out_path): os.makedirs(out_path)
out_name = cf["Sites"][site]["out_filename"]
info["out_filename"] = os.path.join(out_path,out_name)
info["interpolate"] = True
if not cf["Sites"][site].as_bool("interpolate"):
info["interpolate"] = False
info["site_name"] = cf["Sites"][site]["site_name"]
info["site_timezone"] = cf["Sites"][site]["site_timezone"]
info["site_tz"] = pytz.timezone(info["site_timezone"])
return info
def get_datetime(ds_60minutes,f,info):
valid_date = f.variables["valid_date"][:]
nRecs = len(valid_date)
valid_time = f.variables["valid_time"][:]
dl = [datetime.datetime.strptime(str(int(valid_date[i])*10000+int(valid_time[i])),"%Y%m%d%H%M") for i in range(0,nRecs)]
dt_utc_all = numpy.array(dl)
time_step = numpy.array([(dt_utc_all[i]-dt_utc_all[i-1]).total_seconds() for i in range(1,len(dt_utc_all))])
time_step = numpy.append(time_step,3600)
idx = numpy.where(time_step!=0)[0]
dt_utc = dt_utc_all[idx]
dt_utc = [x.replace(tzinfo=pytz.utc) for x in dt_utc]
dt_loc = [x.astimezone(info["site_tz"]) for x in dt_utc]
dt_loc = [x-x.dst() for x in dt_loc]
dt_loc = [x.replace(tzinfo=None) for x in dt_loc]
ds_60minutes.series["DateTime"] = {}
ds_60minutes.series["DateTime"]["Data"] = dt_loc
nRecs = len(ds_60minutes.series["DateTime"]["Data"])
ds_60minutes.globalattributes["nc_nrecs"] = nRecs
return idx
def set_globalattributes(ds_60minutes,info):
ds_60minutes.globalattributes["time_step"] = 60
ds_60minutes.globalattributes["time_zone"] = info["site_timezone"]
ds_60minutes.globalattributes["site_name"] = info["site_name"]
ds_60minutes.globalattributes["xl_datemode"] = 0
ds_60minutes.globalattributes["nc_level"] = "L1"
return
def get_accessdata(cf,ds_60minutes,f,info):
# latitude and longitude, chose central pixel of 3x3 grid
ds_60minutes.globalattributes["latitude"] = f.variables["lat"][1]
ds_60minutes.globalattributes["longitude"] = f.variables["lon"][1]
# list of variables to process
var_list = cf["Variables"].keys()
# get a series of Python datetimes and put this into the data structure
valid_date = f.variables["valid_date"][:]
nRecs = len(valid_date)
valid_time = f.variables["valid_time"][:]
dl = [datetime.datetime.strptime(str(int(valid_date[i])*10000+int(valid_time[i])),"%Y%m%d%H%M") for i in range(0,nRecs)]
dt_utc_all = numpy.array(dl)
time_step = numpy.array([(dt_utc_all[i]-dt_utc_all[i-1]).total_seconds() for i in range(1,len(dt_utc_all))])
time_step = numpy.append(time_step,3600)
idxne0 = numpy.where(time_step!=0)[0]
idxeq0 = numpy.where(time_step==0)[0]
idx_clipped = numpy.where((idxeq0>0)&(idxeq0<nRecs))[0]
idxeq0 = idxeq0[idx_clipped]
dt_utc = dt_utc_all[idxne0]
dt_utc = [x.replace(tzinfo=pytz.utc) for x in dt_utc]
dt_loc = [x.astimezone(info["site_tz"]) for x in dt_utc]
dt_loc = [x-x.dst() for x in dt_loc]
dt_loc = [x.replace(tzinfo=None) for x in dt_loc]
flag = numpy.zeros(len(dt_loc),dtype=numpy.int32)
ds_60minutes.series["DateTime"] = {}
ds_60minutes.series["DateTime"]["Data"] = dt_loc
ds_60minutes.series["DateTime"]["Flag"] = flag
ds_60minutes.series["DateTime_UTC"] = {}
ds_60minutes.series["DateTime_UTC"]["Data"] = dt_utc
ds_60minutes.series["DateTime_UTC"]["Flag"] = flag
nRecs = len(ds_60minutes.series["DateTime"]["Data"])
ds_60minutes.globalattributes["nc_nrecs"] = nRecs
# we're done with valid_date and valid_time, drop them from the variable list
for item in ["valid_date","valid_time","lat","lon"]:
if item in var_list: var_list.remove(item)
# create the QC flag with all zeros
nRecs = ds_60minutes.globalattributes["nc_nrecs"]
flag_60minutes = numpy.zeros(nRecs,dtype=numpy.int32)
# get the UTC hour
hr_utc = [x.hour for x in dt_utc]
attr = qcutils.MakeAttributeDictionary(long_name='UTC hour')
qcutils.CreateSeries(ds_60minutes,'Hr_UTC',hr_utc,Flag=flag_60minutes,Attr=attr)
# now loop over the variables listed in the control file
for label in var_list:
# get the name of the variable in the ACCESS file
access_name = qcutils.get_keyvaluefromcf(cf,["Variables",label],"access_name",default=label)
# warn the user if the variable not found
if access_name not in f.variables.keys():
msg = "Requested variable "+access_name
msg = msg+" not found in ACCESS data"
logging.error(msg)
continue
# get the variable attibutes
attr = get_variableattributes(f,access_name)
# loop over the 3x3 matrix of ACCESS grid data supplied
for i in range(0,3):
for j in range(0,3):
label_ij = label+'_'+str(i)+str(j)
if len(f.variables[access_name].shape)==3:
series = f.variables[access_name][:,i,j]
elif len(f.variables[access_name].shape)==4:
series = f.variables[access_name][:,0,i,j]
else:
msg = "Unrecognised variable ("+label
msg = msg+") dimension in ACCESS file"
logging.error(msg)
series = series[idxne0]
qcutils.CreateSeries(ds_60minutes,label_ij,series,
Flag=flag_60minutes,Attr=attr)
return
def get_variableattributes(f,access_name):
attr = {}
# following code for netCDF4.MFDataset()
# for vattr in f.variables[access_name].ncattrs():
# attr[vattr] = getattr(f.variables[access_name],vattr)
# following code for access_read_mfiles2()
attr = f.varattr[access_name]
attr["missing_value"] = c.missing_value
return attr
def changeunits_airtemperature(ds_60minutes):
attr = qcutils.GetAttributeDictionary(ds_60minutes,"Ta_00")
if attr["units"] == "K":
for i in range(0,3):
for j in range(0,3):
label = "Ta_"+str(i)+str(j)
Ta,f,a = qcutils.GetSeriesasMA(ds_60minutes,label)
Ta = Ta - c.C2K
attr["units"] = "C"
qcutils.CreateSeries(ds_60minutes,label,Ta,Flag=f,Attr=attr)
return
def changeunits_soiltemperature(ds_60minutes):
attr = qcutils.GetAttributeDictionary(ds_60minutes,"Ts_00")
if attr["units"] == "K":
for i in range(0,3):
for j in range(0,3):
label = "Ts_"+str(i)+str(j)
Ts,f,a = qcutils.GetSeriesasMA(ds_60minutes,label)
Ts = Ts - c.C2K
attr["units"] = "C"
qcutils.CreateSeries(ds_60minutes,label,Ts,Flag=f,Attr=attr)
return
def changeunits_pressure(ds_60minutes):
attr = qcutils.GetAttributeDictionary(ds_60minutes,"ps_00")
if attr["units"] == "Pa":
for i in range(0,3):
for j in range(0,3):
label = "ps_"+str(i)+str(j)
ps,f,a = qcutils.GetSeriesasMA(ds_60minutes,label)
ps = ps/float(1000)
attr["units"] = "kPa"
qcutils.CreateSeries(ds_60minutes,label,ps,Flag=f,Attr=attr)
return
def get_windspeedanddirection(ds_60minutes):
for i in range(0,3):
for j in range(0,3):
u_label = "u_"+str(i)+str(j)
v_label = "v_"+str(i)+str(j)
Ws_label = "Ws_"+str(i)+str(j)
u,f,a = qcutils.GetSeriesasMA(ds_60minutes,u_label)
v,f,a = qcutils.GetSeriesasMA(ds_60minutes,v_label)
Ws = numpy.sqrt(u*u+v*v)
attr = qcutils.MakeAttributeDictionary(long_name="Wind speed",
units="m/s",height="10m")
qcutils.CreateSeries(ds_60minutes,Ws_label,Ws,Flag=f,Attr=attr)
# wind direction from components
for i in range(0,3):
for j in range(0,3):
u_label = "u_"+str(i)+str(j)
v_label = "v_"+str(i)+str(j)
Wd_label = "Wd_"+str(i)+str(j)
u,f,a = qcutils.GetSeriesasMA(ds_60minutes,u_label)
v,f,a = qcutils.GetSeriesasMA(ds_60minutes,v_label)
Wd = float(270) - numpy.ma.arctan2(v,u)*float(180)/numpy.pi
index = numpy.ma.where(Wd>360)[0]
if len(index)>0: Wd[index] = Wd[index] - float(360)
attr = qcutils.MakeAttributeDictionary(long_name="Wind direction",
units="degrees",height="10m")
qcutils.CreateSeries(ds_60minutes,Wd_label,Wd,Flag=f,Attr=attr)
return
def get_relativehumidity(ds_60minutes):
for i in range(0,3):
for j in range(0,3):
q_label = "q_"+str(i)+str(j)
Ta_label = "Ta_"+str(i)+str(j)
ps_label = "ps_"+str(i)+str(j)
RH_label = "RH_"+str(i)+str(j)
q,f,a = qcutils.GetSeriesasMA(ds_60minutes,q_label)
Ta,f,a = qcutils.GetSeriesasMA(ds_60minutes,Ta_label)
ps,f,a = qcutils.GetSeriesasMA(ds_60minutes,ps_label)
RH = mf.RHfromspecifichumidity(q, Ta, ps)
attr = qcutils.MakeAttributeDictionary(long_name='Relative humidity',
units='%',standard_name='not defined')
qcutils.CreateSeries(ds_60minutes,RH_label,RH,Flag=f,Attr=attr)
return
def get_absolutehumidity(ds_60minutes):
for i in range(0,3):
for j in range(0,3):
Ta_label = "Ta_"+str(i)+str(j)
RH_label = "RH_"+str(i)+str(j)
Ah_label = "Ah_"+str(i)+str(j)
Ta,f,a = qcutils.GetSeriesasMA(ds_60minutes,Ta_label)
RH,f,a = qcutils.GetSeriesasMA(ds_60minutes,RH_label)
Ah = mf.absolutehumidityfromRH(Ta, RH)
attr = qcutils.MakeAttributeDictionary(long_name='Absolute humidity',
units='g/m3',standard_name='not defined')
qcutils.CreateSeries(ds_60minutes,Ah_label,Ah,Flag=f,Attr=attr)
return
def changeunits_soilmoisture(ds_60minutes):
attr = qcutils.GetAttributeDictionary(ds_60minutes,"Sws_00")
for i in range(0,3):
for j in range(0,3):
label = "Sws_"+str(i)+str(j)
Sws,f,a = qcutils.GetSeriesasMA(ds_60minutes,label)
Sws = Sws/float(100)
attr["units"] = "frac"
qcutils.CreateSeries(ds_60minutes,label,Sws,Flag=f,Attr=attr)
return
def get_radiation(ds_60minutes):
for i in range(0,3):
for j in range(0,3):
label_Fn = "Fn_"+str(i)+str(j)
label_Fsd = "Fsd_"+str(i)+str(j)
label_Fld = "Fld_"+str(i)+str(j)
label_Fsu = "Fsu_"+str(i)+str(j)
label_Flu = "Flu_"+str(i)+str(j)
label_Fn_sw = "Fn_sw_"+str(i)+str(j)
label_Fn_lw = "Fn_lw_"+str(i)+str(j)
Fsd,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fsd)
Fld,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fld)
Fn_sw,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fn_sw)
Fn_lw,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fn_lw)
Fsu = Fsd - Fn_sw
Flu = Fld - Fn_lw
Fn = (Fsd-Fsu)+(Fld-Flu)
attr = qcutils.MakeAttributeDictionary(long_name='Up-welling long wave',
standard_name='surface_upwelling_longwave_flux_in_air',
units='W/m2')
qcutils.CreateSeries(ds_60minutes,label_Flu,Flu,Flag=f,Attr=attr)
attr = qcutils.MakeAttributeDictionary(long_name='Up-welling short wave',
standard_name='surface_upwelling_shortwave_flux_in_air',
units='W/m2')
qcutils.CreateSeries(ds_60minutes,label_Fsu,Fsu,Flag=f,Attr=attr)
attr = qcutils.MakeAttributeDictionary(long_name='Calculated net radiation',
standard_name='surface_net_allwave_radiation',
units='W/m2')
qcutils.CreateSeries(ds_60minutes,label_Fn,Fn,Flag=f,Attr=attr)
return
def get_groundheatflux(ds_60minutes):
for i in range(0,3):
for j in range(0,3):
label_Fg = "Fg_"+str(i)+str(j)
label_Fn = "Fn_"+str(i)+str(j)
label_Fh = "Fh_"+str(i)+str(j)
label_Fe = "Fe_"+str(i)+str(j)
Fn,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fn)
Fh,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fh)
Fe,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fe)
Fg = Fn - Fh - Fe
attr = qcutils.MakeAttributeDictionary(long_name='Calculated ground heat flux',
standard_name='downward_heat_flux_in_soil',
units='W/m2')
qcutils.CreateSeries(ds_60minutes,label_Fg,Fg,Flag=f,Attr=attr)
return
def get_availableenergy(ds_60miutes):
for i in range(0,3):
for j in range(0,3):
label_Fg = "Fg_"+str(i)+str(j)
label_Fn = "Fn_"+str(i)+str(j)
label_Fa = "Fa_"+str(i)+str(j)
Fn,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fn)
Fg,f,a = qcutils.GetSeriesasMA(ds_60minutes,label_Fg)
Fa = Fn - Fg
attr = qcutils.MakeAttributeDictionary(long_name='Calculated available energy',
standard_name='not defined',units='W/m2')
qcutils.CreateSeries(ds_60minutes,label_Fa,Fa,Flag=f,Attr=attr)
return
def perdelta(start,end,delta):
curr = start
while curr <= end:
yield curr
curr += delta
# !!! end of function definitions !!!
# !!! start of main program !!!
# start the logger
logging.basicConfig(filename='access_concat.log',level=logging.DEBUG)
console = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s', '%H:%M:%S')
console.setFormatter(formatter)
console.setLevel(logging.INFO)
logging.getLogger('').addHandler(console)
# get the control file name from the command line
#cf_name = sys.argv[1]
cf_name = qcio.get_controlfilename(path='../controlfiles',title='Choose a control file')
# get the control file contents
logging.info('Reading the control file')
cf = configobj.ConfigObj(cf_name)
# get stuff from the control file
logging.info('Getting control file contents')
site_list = cf["Sites"].keys()
var_list = cf["Variables"].keys()
# loop over sites
#site_list = ["AdelaideRiver"]
for site in site_list:
info = get_info_dict(cf,site)
logging.info("Processing site "+info["site_name"])
# instance the data structures
logging.info('Creating the data structures')
ds_60minutes = qcio.DataStructure()
# get a sorted list of files that match the mask in the control file
file_list = sorted(glob.glob(info["in_filename"]))
# read the netcdf files
logging.info('Reading the netCDF files for '+info["site_name"])
f = access_read_mfiles2(file_list,var_list=var_list)
# get the data from the netCDF files and write it to the 60 minute data structure
logging.info('Getting the ACCESS data')
get_accessdata(cf,ds_60minutes,f,info)
# set some global attributes
logging.info('Setting global attributes')
set_globalattributes(ds_60minutes,info)
# check for time gaps in the file
logging.info("Checking for time gaps")
if qcutils.CheckTimeStep(ds_60minutes):
qcutils.FixTimeStep(ds_60minutes)
# get the datetime in some different formats
logging.info('Getting xlDateTime and YMDHMS')
qcutils.get_xldatefromdatetime(ds_60minutes)
qcutils.get_ymdhmsfromdatetime(ds_60minutes)
#f.close()
# get derived quantities and adjust units
logging.info("Changing units and getting derived quantities")
# air temperature from K to C
changeunits_airtemperature(ds_60minutes)
# soil temperature from K to C
changeunits_soiltemperature(ds_60minutes)
# pressure from Pa to kPa
changeunits_pressure(ds_60minutes)
# wind speed from components
get_windspeedanddirection(ds_60minutes)
# relative humidity from temperature, specific humidity and pressure
get_relativehumidity(ds_60minutes)
# absolute humidity from temperature and relative humidity
get_absolutehumidity(ds_60minutes)
# soil moisture from kg/m2 to m3/m3
changeunits_soilmoisture(ds_60minutes)
# net radiation and upwelling short and long wave radiation
get_radiation(ds_60minutes)
# ground heat flux as residual
get_groundheatflux(ds_60minutes)
# Available energy
get_availableenergy(ds_60minutes)
if info["interpolate"]:
# interploate from 60 minute time step to 30 minute time step
logging.info("Interpolating data to 30 minute time step")
ds_30minutes = interpolate_to_30minutes(ds_60minutes)
# get instantaneous precipitation from accumulated precipitation
get_instantaneous_precip30(ds_30minutes)
# write to netCDF file
logging.info("Writing 30 minute data to netCDF file")
ncfile = qcio.nc_open_write(info["out_filename"])
qcio.nc_write_series(ncfile, ds_30minutes,ndims=1)
else:
# get instantaneous precipitation from accumulated precipitation
get_instantaneous_precip60(ds_60minutes)
# write to netCDF file
logging.info("Writing 60 minute data to netCDF file")
ncfile = qcio.nc_open_write(info["out_filename"])
qcio.nc_write_series(ncfile, ds_60minutes,ndims=1)
logging.info('All done!')
| 47.546774 | 132 | 0.641915 |
969bb241fcdc0d7ab1f0ae016a66c74578107f98 | 639 | py | Python | AMAO/apps/Avaliacao/views/exibir.py | arruda/amao | 83648aa2c408b1450d721b3072dc9db4b53edbb8 | [
"MIT"
] | 2 | 2017-04-26T14:08:02.000Z | 2017-09-01T13:10:17.000Z | AMAO/apps/Avaliacao/views/exibir.py | arruda/amao | 83648aa2c408b1450d721b3072dc9db4b53edbb8 | [
"MIT"
] | null | null | null | AMAO/apps/Avaliacao/views/exibir.py | arruda/amao | 83648aa2c408b1450d721b3072dc9db4b53edbb8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.contrib.auth import login
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from Aluno.views.utils import aluno_exist
from annoying.decorators import render_to
from django.contrib.auth.models import User
from Avaliacao.models import *
from Aluno.models import *
| 27.782609 | 57 | 0.791862 |
969bbfec8ddf57f2a21ea2c8536548a16473aafe | 2,771 | py | Python | avem_theme/functions/sanitize.py | mverleg/django-boots-plain-theme | 2355270293ddb3db4762470a43c72311bf11be07 | [
"BSD-3-Clause"
] | null | null | null | avem_theme/functions/sanitize.py | mverleg/django-boots-plain-theme | 2355270293ddb3db4762470a43c72311bf11be07 | [
"BSD-3-Clause"
] | null | null | null | avem_theme/functions/sanitize.py | mverleg/django-boots-plain-theme | 2355270293ddb3db4762470a43c72311bf11be07 | [
"BSD-3-Clause"
] | null | null | null |
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from django.conf import settings
DEFAULT_NOSCR_ALLOWED_TAGS = 'strong:title b i em:title p:title h1:title h2:title h3:title h4:title h5:title ' + \
'div:title span:title ol ul li:title a:href:title:rel img:src:alt:title dl td:title dd:title' + \
'table:cellspacing:cellpadding thead tbody th tr td:title:colspan:rowspan br'
def sanitize_html(text, add_nofollow = False,
allowed_tags = getattr(settings, 'NOSCR_ALLOWED_TAGS', DEFAULT_NOSCR_ALLOWED_TAGS)):
"""
Cleans an html string:
* remove any not-whitelisted tags
- remove any potentially malicious tags or attributes
- remove any invalid tags that may break layout
* esca[e any <, > and & from remaining text (by bs4); this prevents
> >> <<script>script> alert("Haha, I hacked your page."); </</script>script>\
* optionally add nofollow attributes to foreign anchors
* removes comments
:comment * optionally replace some tags with others:
:arg text: Input html.
:arg allowed_tags: Argument should be in form 'tag2:attr1:attr2 tag2:attr1 tag3', where tags are allowed HTML
tags, and attrs are the allowed attributes for that tag.
:return: Sanitized html.
This is based on https://djangosnippets.org/snippets/1655/
"""
try:
from bs4 import BeautifulSoup, Comment, NavigableString
except ImportError:
raise ImportError('to use sanitize_html() and |noscr, you need to install beautifulsoup4')
""" function to check if urls are absolute
note that example.com/path/file.html is relative, officially and in Firefox """
is_relative = lambda url: not bool(urlparse(url).netloc)
""" regex to remove javascript """
#todo: what exactly is the point of this? is there js in attribute values?
#js_regex = compile(r'[\s]*(&#x.{1,7})?'.join(list('javascript')))
""" allowed tags structure """
allowed_tags = [tag.split(':') for tag in allowed_tags.split()]
allowed_tags = {tag[0]: tag[1:] for tag in allowed_tags}
""" create comment-free soup """
soup = BeautifulSoup(text)
for comment in soup.findAll(text = lambda text: isinstance(text, Comment)):
comment.extract()
for tag in soup.find_all(recursive = True):
if tag.name not in allowed_tags:
""" hide forbidden tags (keeping content) """
tag.hidden = True
else:
""" whitelisted tags """
tag.attrs = {attr: val for attr, val in tag.attrs.items() if attr in allowed_tags[tag.name]}
""" add nofollow to external links if requested """
if add_nofollow and tag.name == 'a' and 'href' in tag.attrs:
if not is_relative(tag.attrs['href']):
tag.attrs['rel'] = (tag.attrs['rel'] if 'rel' in tag.attrs else []) + ['nofollow']
""" return as unicode """
return soup.renderContents().decode('utf8')
| 37.958904 | 114 | 0.714904 |
969bdd00695dbe7a914d09d8df086240e345cdbb | 15,054 | py | Python | plotDiff_log.py | kmoskovtsev/Electrons-on-Helium-Scripts | b7325c64a62def9b963b66bfb078ee82553c2ed4 | [
"Unlicense"
] | null | null | null | plotDiff_log.py | kmoskovtsev/Electrons-on-Helium-Scripts | b7325c64a62def9b963b66bfb078ee82553c2ed4 | [
"Unlicense"
] | null | null | null | plotDiff_log.py | kmoskovtsev/Electrons-on-Helium-Scripts | b7325c64a62def9b963b66bfb078ee82553c2ed4 | [
"Unlicense"
] | null | null | null | from __future__ import division
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import gsd
import gsd.fl
import numpy as np
import os
import sys
import datetime
import time
import pickle
from shutil import copyfile
import inspect
import md_tools27 as md_tools
from multiprocessing import Pool
"""
This script plots diffusion vs Gamma in log(D)-log(Gamma) or log(D)-gamma format. The data from a .dat file is used, must be precalculated by plotDiff_pG_parallel.py.
Arguments: --cmfree, --cmfixed for the free-moving center of mass regime, and v_cm subtracted respectively.
--sf <fubfolder>: subfolder to process (e.g. p32)
--NP <number>: number of subprocesses to use for parallelization. Very efficient acceleration by a factor of <number>.
"""
#Use LaTex for text
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
rc('text', usetex=True)
def OLS(x, y):
'''OLS: x must be a vertical two-dimensional array'''
X = np.hstack((np.reshape(np.ones(x.shape[0]), (-1,1)), x))#.transpose()
Xpr = X.transpose()
beta = np.dot(np.dot(np.linalg.inv(np.dot(Xpr, X)), Xpr), y)
#Estimate errors
sigma_sq = np.dot(y - np.dot(X, beta), y - np.dot(X, beta))/(len(y) - 1.)
sigma_beta_sq = sigma_sq*np.linalg.inv(np.dot(Xpr, X))
return beta, sigma_beta_sq # = [f_0, df/d(A^2)]
def diffusion_from_transport_gsd(folder_path, f_name, center_fixed = True, useframes = -1):
"""
Diffusion constant D is calculated from 4Dt = <(r(t) - r(0))^2>, or 2D_x*t = <(x(t) - x(0))^2>.
The average is calculated over all particles and over different time origins.
Time origins go from 0 to n_frames/2, and t goes from 0 to n_frames/2. This way,
the data are always within the trajectory.
center_fixed = True: eliminate oveall motion of center of mass
return D_x, D_y
D_x, D_y diffusion for x- and y-coordinates;
"""
params = read_log(folder_path)
if folder_path[-1] != '/':
folder_path = folder_path + '/'
with gsd.fl.GSDFile(folder_path + f_name, 'rb') as f:
n_frames = f.nframes
box = f.read_chunk(frame=0, name='configuration/box')
half_frames = int(n_frames/2) - 1 #sligtly less than half to avoid out of bound i
if useframes < 1 or useframes > half_frames:
useframes = half_frames
t_step = f.read_chunk(frame=0, name='configuration/step')
n_p = f.read_chunk(frame=0, name='particles/N')
x_sq_av = np.zeros(useframes)
y_sq_av = np.zeros(useframes)
for t_origin in range(n_frames - useframes - 1):
pos_0 = f.read_chunk(frame=t_origin, name='particles/position')
mean_pos_0 = np.mean(pos_0, axis = 0)
pos = pos_0
pos_raw = pos_0
for j_frame in range(useframes):
pos_m1 = pos
pos_m1_raw = pos_raw
pos_raw = f.read_chunk(frame=j_frame + t_origin, name='particles/position') - pos_0
pos = md_tools.correct_jumps(pos_raw, pos_m1, pos_m1_raw, box[0], box[1])
if center_fixed:
pos -= np.mean(pos, axis = 0) - mean_pos_0 #correct for center of mass movement
x_sq_av[j_frame] += np.mean(pos[:,0]**2)
y_sq_av[j_frame] += np.mean(pos[:,1]**2)
x_sq_av /= (n_frames - useframes - 1)
y_sq_av /= (n_frames - useframes - 1)
# OLS estimate for beta_x[0] + beta_x[1]*t = <|x_i(t) - x_i(0)|^2>
a = np.ones((useframes, 2)) # matrix a = ones(half_frames) | (0; dt; 2dt; 3dt; ...)
a[:,1] = params['snap_period']*params['dt']*np.cumsum(np.ones(useframes), axis = 0) - params['dt']
b_cutoff = int(useframes/10) #cutoff to get only linear part of x_sq_av, makes results a bit more clean
beta_x = np.linalg.lstsq(a[b_cutoff:, :], x_sq_av[b_cutoff:], rcond=-1)
beta_y = np.linalg.lstsq(a[b_cutoff:, :], y_sq_av[b_cutoff:], rcond=-1)
fig, ax = plt.subplots(1,1, figsize=(7,5))
ax.scatter(a[:,1], x_sq_av, label='$\\langle x^2\\rangle$')
ax.scatter(a[:,1], y_sq_av, label='$\\langle y^2\\rangle$')
ax.legend(loc=7)
ax.set_xlabel('$t$')
ax.set_ylabel('$\\langle r_i^2 \\rangle$')
if center_fixed:
center_fixed_str = 'cm_fixed'
else:
center_fixed_str = 'cm_free'
fig.savefig(folder_path + 'r2_diff_' + f_name +'_' + center_fixed_str + '.png')
plt.close('all')
D_x = beta_x[0][1]/2
D_y = beta_y[0][1]/2
print('D_x = {}'.format(D_x))
print('D_y = {}'.format(D_y))
return (D_x, D_y)
## =======================================================================
# Units
unit_M = 9.10938356e-31 # kg, electron mass
unit_D = 1e-6 # m, micron
unit_E = 1.38064852e-23 # m^2*kg/s^2
unit_t = np.sqrt(unit_M*unit_D**2/unit_E) # = 2.568638150515e-10 s
epsilon_0 = 8.854187817e-12 # F/m = C^2/(J*m), vacuum permittivity
hbar = 1.0545726e-27/(unit_E*1e7)/unit_t
m_e = 9.10938356e-31/unit_M
unit_Q = np.sqrt(unit_E*1e7*unit_D*1e2) # Coulombs
unit_Qe = unit_Q/4.8032068e-10 # e, unit charge in units of elementary charge e
e_charge = 1/unit_Qe # electron charge in units of unit_Q
curr_fname = inspect.getfile(inspect.currentframe())
curr_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
##=======================================================================
# Make a list of folders we want to process
cm_fixed = True #default that can be changed by --cmfree
cm_fixed_str = 'cm_fixed'
show_text = False
Nproc = 1
selected_subfolders = []
folder_list = []
for i in range(len(sys.argv)):
if os.path.isdir(sys.argv[i]):
folder_list.append(sys.argv[i])
elif sys.argv[i] == '--sf':
try:
selected_subfolders.append(sys.argv[i+1])
except:
raise RuntimeError('Could not recognize the value of --sf. argv={}'.format(argv))
elif sys.argv[i] == '--showtext':
show_text = True
elif sys.argv[i] == '--GC':
gamma_c = float(sys.argv[i+1])
elif sys.argv[i] == '--help' or sys.argv[i] == '-h':
print_help()
exit()
try:
print('Gamma_c = {}'.format(gamma_c))
except:
raise RuntimeError('Gamma_c not specified. Use --GC argument.')
print('Selected subfolders: {}'.format(selected_subfolders))
# Make a list of subfolders p### in each folders
subfolder_lists = []
for folder in folder_list:
sf_list = []
for item in os.walk(folder):
# subfolder name and contained files
sf_list.append((item[0], item[2]))
sf_list = sf_list[1:]
subfolder_lists.append(sf_list)
##=======================================================================
for ifold, folder in enumerate(folder_list):
print('==========================================================')
print(folder)
print('==========================================================')
# Keep only selected subfolders in the list is there is selection
if len(selected_subfolders) > 0:
sf_lists_to_go = []
for isf, sf in enumerate(subfolder_lists[ifold]):
sf_words = sf[0].split('/')
if sf_words[-1] in selected_subfolders:
sf_lists_to_go.append(sf)
else:
sf_lists_to_go = subfolder_lists[ifold]
for isf, sf in enumerate(sf_lists_to_go):
sf_words = sf[0].split('/')
print(sf_words[-1])
if sf_words[-1][0] != 'p':
raise ValueError("Expected subfolder name to start with `p`, in {}".format(fname))
log_data = read_log(sf[0])
folder_name = folder.split('/')[-1]
if sf[0][-1] == '/':
sf[0] = sf[0][:-1]
sf_name = sf[0].split('/')[-1]
#Read Dx Dy vs Gamma from the .dat file
#DxDy_data = {'Dx_arr':Dx_arr, 'Dy_arr':Dy_arr, 'Dx_arr_gauss': Dx_arr*cm2s_convert, 'Dy_arr_gauss':Dy_arr*cm2s_convert, \
# 'gamma_arr':gamma_arr, 'gamma_eff_arr':gamma_eff_arr}
cm_fixed_str = 'cm_fixed'
with open(sf[0] + '/DxDy_data_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.dat', 'r') as ff:
DxDy_data = pickle.load(ff)
Dx_arr = DxDy_data['Dx_arr']
Dy_arr = DxDy_data['Dy_arr']
gamma_eff_arr = DxDy_data['gamma_eff_arr']
# Remove points where gamma > gamma_c
clip_ind = np.where(gamma_eff_arr < gamma_c)[0]
Dx_arr_clip = Dx_arr[clip_ind]
Dy_arr_clip = Dy_arr[clip_ind]
gamma_arr_clip = gamma_eff_arr[clip_ind]
print('Dx_arr = {}'.format(Dx_arr_clip))
print('Dy_arr = {}'.format(Dy_arr_clip))
## ======================================================================
## Plot Dx,Dy vs effective G (calculated from data rather then read from the log)
# in Gaussian units
labelfont = 28
tickfont = labelfont - 4
legendfont = labelfont - 4
cm2s_convert = unit_D**2/unit_t*1e4
fig, ax1 = plt.subplots(1,1, figsize=(7,6))
scatter1 = ax1.scatter(gamma_arr_clip, np.log(Dx_arr_clip*cm2s_convert), label='$D_\\perp$', color = 'green', marker='o')
ax1.set_xlabel('$\\Gamma$', fontsize=labelfont)
ax1.set_ylabel('$\\log(D/D_0)$', fontsize=labelfont)
scatter2 = ax1.scatter(gamma_arr_clip, np.log(Dy_arr_clip*cm2s_convert), label='$D_\\parallel$', color = 'red', marker='s')
#ax1.set_xlim([np.min(gamma_eff_arr) - 2, np.max(gamma_eff_arr) + 2])
ax1.legend(loc=1, fontsize=legendfont)
ax1.tick_params(labelsize= tickfont)
ax1.locator_params(nbins=6, axis='y')
formatter = mticker.ScalarFormatter(useMathText=True)
formatter.set_powerlimits((-3,2))
ax1.yaxis.set_major_formatter(formatter)
#Place text
if show_text:
text_list = ['$\\Gamma_c = {:.1f}$'.format(gamma_c)]
y_lim = ax1.get_ylim()
x_lim = ax1.get_xlim()
h = y_lim[1] - y_lim[0]
w = x_lim[1] - x_lim[0]
text_x = x_lim[0] + 0.5*w
text_y = y_lim[1] - 0.05*h
if type(text_list) == list:
n_str = len(text_list)
for i_fig in range(n_str):
ax1.text(text_x, text_y - 0.05*h*i_fig, text_list[i_fig])
elif type(text_list) == str:
ax1.text(text_x, text_y, text_list)
else:
raise TypeError('text_list must be a list of strings or a string')
#fig.patch.set_alpha(alpha=1)
plt.tight_layout()
fig.savefig(folder + '/' + 'DxDy_G_log_' + sf_name + '_' + folder_name + '_{:.2f}'.format(gamma_c) + '.pdf')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.png')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.eps')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.pdf')
plt.close('all')
| 43.634783 | 167 | 0.561778 |
969c409f7ce05c9902d3127ae8558f487796543d | 1,609 | py | Python | backuppy/cli/put.py | drmorr0/backuppy | ed6c60b049aaeb6107a073af2d81ccbe0a9abc59 | [
"Apache-2.0"
] | 4 | 2021-08-20T02:51:59.000Z | 2022-01-06T18:18:53.000Z | backuppy/cli/put.py | drmorr0/backuppy | ed6c60b049aaeb6107a073af2d81ccbe0a9abc59 | [
"Apache-2.0"
] | 26 | 2019-06-06T02:23:29.000Z | 2021-07-29T06:43:04.000Z | backuppy/cli/put.py | drmorr0/backuppy | ed6c60b049aaeb6107a073af2d81ccbe0a9abc59 | [
"Apache-2.0"
] | null | null | null | import argparse
import staticconf
from backuppy.args import add_name_arg
from backuppy.args import subparser
from backuppy.manifest import lock_manifest
from backuppy.manifest import Manifest
from backuppy.stores import get_backup_store
HELP_TEXT = '''
WARNING: this command is considered "plumbing" and should be used for debugging or
exceptional cases only. You can render your backup store inaccessible if it is used
incorrectly. Use at your own risk!
'''
| 30.942308 | 100 | 0.705407 |
969caf4ae896145b97abded195e8a8ae66368a89 | 6,349 | py | Python | OnePy/feeds/feedbase.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | OnePy/feeds/feedbase.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | OnePy/feeds/feedbase.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | from abc import abstractmethod, ABCMeta
import csv
from datetime import datetime
import funcy as fy
from OnePy.barbase import Current_bar, Bar
from OnePy.event import events, MarketEvent
def __update_bar(self):
""""""
self.bar.set_instrument(self.instrument)
self.bar.add_new_bar(self.cur_bar.cur_data)
class CSVFeedBase(FeedMetabase):
"""CSVopenhighlowclosevolume"""
dtformat = "%Y-%m-%d %H:%M:%S"
tmformat = "%H:%M:%S"
timeindex = None
def __set_date(self):
"""datetime"""
if self.fromdate:
self.fromdate = datetime.strptime(self.fromdate, "%Y-%m-%d")
if self.todate:
self.todate = datetime.strptime(self.todate, "%Y-%m-%d")
def __set_dtformat(self, bar):
""""""
date = bar["date"]
dt = "%Y-%m-%d %H:%M:%S"
if self.timeindex:
date = datetime.strptime(str(date), self.dtformat).strftime("%Y-%m-%d")
return date + " " + bar[self.timeindex.lower()]
else:
return datetime.strptime(str(date), self.dtformat).strftime(dt)
def preload(self):
"""
fromdateloadpreload_bar_list
fromdateload
"""
self.set_iteral_buffer(self.load_data()) # for indicator
try:
bar = _update()
#
dt = "%Y-%m-%d %H:%M:%S"
if self.fromdate:
while datetime.strptime(bar["date"], dt) < self.fromdate:
bar = _update()
self.preload_bar_list.append(bar)
else:
self.preload_bar_list.pop(-1) # bug
elif self.fromdate is None:
pass
else:
raise SyntaxError("Catch a Bug!")
except IndexError:
pass
except StopIteration:
print("???")
self.preload_bar_list.reverse()
| 26.902542 | 83 | 0.575839 |
969ce91c3c9eb7731f2a4d716dfbab07efce7259 | 4,912 | py | Python | conanfile.py | hsdk123/corrade | 0d624d1f980f0376b2227356759f1d6e8761e6a3 | [
"MIT",
"Unlicense"
] | null | null | null | conanfile.py | hsdk123/corrade | 0d624d1f980f0376b2227356759f1d6e8761e6a3 | [
"MIT",
"Unlicense"
] | null | null | null | conanfile.py | hsdk123/corrade | 0d624d1f980f0376b2227356759f1d6e8761e6a3 | [
"MIT",
"Unlicense"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
from conans.errors import ConanException
import os
import shutil
| 36.932331 | 125 | 0.631311 |
969d12ed4be6b78b744d2cdccc1f9a2142ee0a79 | 416 | py | Python | tests/test_null.py | StephenNneji/python-fastjsonschema | e7441c2efa40f5ac099a7788b8dafe6942146cf0 | [
"BSD-3-Clause"
] | null | null | null | tests/test_null.py | StephenNneji/python-fastjsonschema | e7441c2efa40f5ac099a7788b8dafe6942146cf0 | [
"BSD-3-Clause"
] | null | null | null | tests/test_null.py | StephenNneji/python-fastjsonschema | e7441c2efa40f5ac099a7788b8dafe6942146cf0 | [
"BSD-3-Clause"
] | null | null | null | import pytest
from fastjsonschema import JsonSchemaException
exc = JsonSchemaException('data must be null', value='{data}', name='data', definition='{definition}', rule='type')
| 24.470588 | 115 | 0.632212 |
969d7989d597d987141a08864cd0542293d4eb73 | 644 | py | Python | server/api/python/comprehension.py | DigitalCompanion/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 8 | 2018-10-27T14:47:09.000Z | 2019-06-13T15:11:04.000Z | server/api/python/comprehension.py | DigitalCompanion/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 3 | 2020-08-18T12:17:05.000Z | 2020-08-18T12:17:46.000Z | server/api/python/comprehension.py | futurityab/trustometer | acd7a2ab4927195ee5455d3274efff9f76e1395f | [
"MIT"
] | 3 | 2019-06-13T15:06:09.000Z | 2020-05-09T08:23:49.000Z | import boto3
import json
| 35.777778 | 140 | 0.751553 |
969d8f8281712317dc2a93dac04a3282f946abb9 | 394 | py | Python | checkrightrotate.py | parasshaha/Python- | 6c0bdae04cf74aa2742585ebcedb2274075fa644 | [
"Unlicense"
] | null | null | null | checkrightrotate.py | parasshaha/Python- | 6c0bdae04cf74aa2742585ebcedb2274075fa644 | [
"Unlicense"
] | null | null | null | checkrightrotate.py | parasshaha/Python- | 6c0bdae04cf74aa2742585ebcedb2274075fa644 | [
"Unlicense"
] | null | null | null |
if __name__ =='__main__':
main()
| 19.7 | 45 | 0.664975 |
969e155793ce7396e91744cc2b8d9f9238771262 | 6,781 | py | Python | bot.py | Fido2603/WatchDog | 4607b374fdd29d2c82ea9a2a4a8de10f2ed3a94f | [
"MIT"
] | null | null | null | bot.py | Fido2603/WatchDog | 4607b374fdd29d2c82ea9a2a4a8de10f2ed3a94f | [
"MIT"
] | null | null | null | bot.py | Fido2603/WatchDog | 4607b374fdd29d2c82ea9a2a4a8de10f2ed3a94f | [
"MIT"
] | 3 | 2018-11-12T14:02:57.000Z | 2020-04-13T21:48:02.000Z | import discord
from discord.ext import commands
from discord import Embed, Permissions
from Util import logger
import os
import database
# Import the config
try:
import config
except ImportError:
print("Couldn't import config.py! Exiting!")
exit()
# Import a monkey patch, if that exists
try:
import monkeyPatch
except ImportError:
print("DEBUG: No Monkey patch found!")
bot = commands.Bot(command_prefix=os.getenv('prefix'), description='Well boys, we did it. Baddies are no more.',
activity=discord.Game(name="with the banhammer"))
startup_extensions = ["essentials",
"moderation",
"info",
"listenerCog"]
# Function to update the database on startup
# Make sure appeal guild is set up properly
if __name__ == '__main__':
logger.setup_logger()
# Load extensions
for extension in startup_extensions:
try:
bot.load_extension(f"cogs.{extension}")
except Exception as e:
logger.logDebug(f"Failed to load extension {extension}. - {e}", "ERROR")
bot.run(os.getenv('token'))
| 38.748571 | 120 | 0.627636 |
969e2f3ff112021f4be66464e152ec69c802c02b | 320 | py | Python | connect/eaas/exceptions.py | bdjilka/connect-extension-runner | 7930b34dae92addb3807984fd553debc2b78ac23 | [
"Apache-2.0"
] | null | null | null | connect/eaas/exceptions.py | bdjilka/connect-extension-runner | 7930b34dae92addb3807984fd553debc2b78ac23 | [
"Apache-2.0"
] | null | null | null | connect/eaas/exceptions.py | bdjilka/connect-extension-runner | 7930b34dae92addb3807984fd553debc2b78ac23 | [
"Apache-2.0"
] | null | null | null | #
# This file is part of the Ingram Micro CloudBlue Connect EaaS Extension Runner.
#
# Copyright (c) 2021 Ingram Micro. All Rights Reserved.
#
| 16 | 80 | 0.74375 |
969ea553ff4cdd6978d9da12725a1d04afc89e38 | 354 | py | Python | tests/i18n/patterns/urls/wrong_namespace.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/i18n/patterns/urls/wrong_namespace.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/i18n/patterns/urls/wrong_namespace.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
app_name = 'account'
urlpatterns = i18n_patterns(
url(_(r'^register/$'), view, name='register'),
)
| 29.5 | 56 | 0.757062 |
969ea9cfc35b7e706cf517d502bb8ce349a6ac08 | 2,004 | py | Python | gsheetsdb/url.py | JagritiG/gsheet-db-api-plus | 620247bb7ce36b327fc91feab8b48fc70e8c158f | [
"MIT"
] | null | null | null | gsheetsdb/url.py | JagritiG/gsheet-db-api-plus | 620247bb7ce36b327fc91feab8b48fc70e8c158f | [
"MIT"
] | null | null | null | gsheetsdb/url.py | JagritiG/gsheet-db-api-plus | 620247bb7ce36b327fc91feab8b48fc70e8c158f | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from moz_sql_parser import parse as parse_sql
import pyparsing
import re
from six.moves.urllib import parse
FROM_REGEX = re.compile(' from ("http.*?")', re.IGNORECASE)
# Function to extract url from any sql statement
def url_from_sql(sql):
"""
Extract url from any sql statement.
:param sql:
:return:
"""
try:
parsed_sql = re.split('[( , " )]', str(sql))
for i, val in enumerate(parsed_sql):
if val.startswith('https:'):
sql_url = parsed_sql[i]
return sql_url
except Exception as e:
print("Error: {}".format(e))
| 21.782609 | 63 | 0.597804 |
969f792ffed604b2cbdb6448c4f912247a60d7f2 | 5,676 | py | Python | weechat/.weechat/python/autoload/weechat_bot2human.py | CoelacanthusHex/dotfiles | e9cc372ba1c5d90e29fdcb1a81c8eb06b6f83bc5 | [
"Unlicense"
] | 10 | 2021-01-22T08:40:51.000Z | 2022-01-01T12:14:37.000Z | weechat/.weechat/python/autoload/weechat_bot2human.py | CoelacanthusHex/dotfiles | e9cc372ba1c5d90e29fdcb1a81c8eb06b6f83bc5 | [
"Unlicense"
] | 1 | 2020-04-18T16:47:51.000Z | 2020-05-20T20:46:30.000Z | weechat/.weechat/python/autoload/weechat_bot2human.py | ayalhw/dotfiles | c43d0d8543e62a7196c3eddadf66df045bdbbdeb | [
"Unlicense"
] | 1 | 2021-10-02T12:02:01.000Z | 2021-10-02T12:02:01.000Z | # -*- coding:utf-8 -*-
# Bot2Human
#
# Replaces messages from bots to humans
# typically used in channels that are connected with other IMs using bots
#
# For example, if a bot send messages from XMPP is like `[nick] content`,
# weechat would show `bot | [nick] content` which looks bad; this script
# make weecaht display `nick | content` so that the messages looks like
# normal IRC message
#
# Options
#
# plugins.var.python.bot2human.bot_nicks
# space seperated nicknames to forwarding bots
# example: teleboto toxsync tg2arch
#
# plugins.var.python.nick_content_re.X
# X is a 0-2 number. This options specifies regex to match nickname
# and content. Default regexes are r'\[(?P<nick>.+?)\] (?P<text>.*)',
# r'\((?P<nick>.+?)\) (?P<text>.*)', and r'<(?P<nick>.+?)> (?P<text>.*)'
#
# plugins.var.python.nick_re_count
# Number of rules defined
#
# Changelog:
# 0.3.0: Add relayed nicks into nicklist, enabling completion
# 0.2.2: Support ZNC timestamp
# 0.2.1: Color filtering only applies on nicknames
# More than 3 nick rules can be defined
# 0.2.0: Filter mIRC color and other control seq from message
# 0.1.1: Bug Fixes
# 0.1: Initial Release
#
import weechat as w
import re
SCRIPT_NAME = "bot2human"
SCRIPT_AUTHOR = "Justin Wong & Hexchain & quietlynn"
SCRIPT_DESC = "Replace IRC message nicknames with regex match from chat text"
SCRIPT_VERSION = "0.3.0"
SCRIPT_LICENSE = "GPLv3"
DEFAULTS = {
'nick_re_count': '4',
'nick_content_re.0': r'\[(?:\x03[0-9,]+)?(?P<nick>[^:]+?)\x0f?\] (?P<text>.*)',
'nick_content_re.1': r'(?:\x03[0-9,]+)?\[(?P<nick>[^:]+?)\]\x0f? (?P<text>.*)',
'nick_content_re.2': r'\((?P<nick>[^:]+?)\) (?P<text>.*)',
'nick_content_re.3': r'<(?:\x03[0-9,]+)?(?P<nick>[^:]+?)\x0f?> (?P<text>.*)',
'bot_nicks': "",
'znc_ts_re': r'\[\d\d:\d\d:\d\d\]\s+',
}
CONFIG = {
'nick_re_count': -1,
'nick_content_res': [],
'bot_nicks': [],
'znc_ts_re': None,
}
if __name__ == '__main__':
w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
SCRIPT_DESC, "", "")
parse_config()
w.hook_modifier("irc_in_privmsg", "msg_cb", "")
w.hook_config("plugins.var.python."+SCRIPT_NAME+".*", "config_cb", "")
# Glowing Bear will choke if a nick is added into a newly created group.
# As a workaround, we add the group as soon as possible BEFORE Glowing Bear loads groups,
# and we must do that AFTER EVERY nicklist reload. nicklist_nick_added satisfies both.
# TODO(quietlynn): Find better signals to hook instead.
w.hook_signal("nicklist_nick_added", "nicklist_nick_added_cb", "")
# vim: ts=4 sw=4 sts=4 expandtab
| 33.988024 | 102 | 0.604651 |
96a3b55fdb3ad0865f22a54baf973a421e94d7be | 10,713 | py | Python | MS-thesis/excel-format/sir/Updated/New folder/test.py | iffishells/Pushto-TTS-FYP | 7ed3a180ba4c1e609ae5aa5e76bfd093a3d3d140 | [
"Apache-2.0"
] | 2 | 2021-12-06T04:28:18.000Z | 2021-12-20T03:33:00.000Z | MS-thesis/excel-format/sir/Updated/New folder/test.py | iffishells/Pushto-TTS-FYP | 7ed3a180ba4c1e609ae5aa5e76bfd093a3d3d140 | [
"Apache-2.0"
] | null | null | null | MS-thesis/excel-format/sir/Updated/New folder/test.py | iffishells/Pushto-TTS-FYP | 7ed3a180ba4c1e609ae5aa5e76bfd093a3d3d140 | [
"Apache-2.0"
] | 1 | 2021-12-29T16:44:59.000Z | 2021-12-29T16:44:59.000Z | import xlrd
import pandas as pd
from openpyxl import load_workbook
from xlrd import open_workbook
import nltk
from nltk.tree import Tree
from nltk.parse.generate import generate
from nltk.tree import *
import os
from nltk.tokenize import word_tokenize
from nltk.tokenize import sent_tokenize
import xml.etree.ElementTree as etree
import xlrd
import time
import sys
from nltk import induce_pcfg
from nltk.parse import pchart
from nltk import PCFG
from nltk.draw.util import CanvasFrame
import nltk
import re
import pandas
sys.setrecursionlimit(5000)
##start = time.time()
##PERIOD_OF_TIME = 15 # 5min
##while True :
sen = input("Enter your sentence: ")
sent = word_tokenize(sen)
#sen = " . . "
##for i in sent_tokenize(sen):
## print(i)
##
##gram =("""
##S -> NP VP [1.0]
##NP -> ADJ [0.0041666667] | N [0.0041666667] | N N [0.3] | PN [0.0041666667] | ADJ N [0.0041666667] | AV N [0.0041666667] | N ADJ [0.1] | NU NU [0.5] | NU AP [0.0041666667] | ADJ AP [0.0041666667] | AV [0.0041666667] | ADJ AP [0.0041666667] | N PN [0.0041666667] | VP N [0.0041666667] | PN ADV [0.0041666667] | AV ADV [0.0041666667] | N VP [0.0041666667] | NU N [0.0041666667] | NU [0.0041666667] | V [0.0041666667] | AV AP [0.0041666667] | ADJ VP [0.0041666667] | N AP [0.0041666667] | ADJ AP [0.0041666667] | ADJ NP [0.0041666667] | N NP [0.0041666667]
##VP -> V AP [0.557] | ADJ V [0.05] | AP [0.00625] | NP [0.00625] | AV PN [0.056] | V ADV [0.00625] | V [0.00625] | AV AP [0.00625] | N ADV [0.00625] | N [0.00625] | NU N [0.1] | N V [0.0375] | ADJ AP [0.00625] | N AV [0.10] | V ADJ [0.00625] | ADJ NP [0.00625] | N AP [0.00625] | N NP [0.00625] | NP NP [0.00625] | AV VP [0.00625] | ADJ VP [0.00625] | N VP [0.00625]
##AP -> AV V [0.056] | V NP [0.166] | ADJ V [0.051] | NP VP [0.0142857143] | AV NP [0.0142857143] | PN NP [0.0142857143] | N V [0.037] | NU N [0.2] | AV N [0.2] | ADJ PN [0.066] | V VP [0.0142857143] | N ADV [0.0142857143] | PN AV [0.024] | ADJ VP [0.0142857143] | PN N [0.1] | AV ADV [0.0142857143]
##ADV -> ADV ADJ [0.4] | PN VP [0.025] | N AP [0.025] | AV AV [0.5] | V AP [0.025] | N V [0.025]
##""")
#0.0769231
gram = ("""
S -> NP NP RP VP RP NP PRP VP [0.0769230769]
NP -> N [0.0294118]
NP -> PRP N [0.0294118]
VP -> V [0.05]
NP -> N N [0.0294118]
VP -> V [0.05]
S -> NP RP POP NP NP PP ADJ VP [0.0769230769]
NP -> PRP N [0.0294118]
NP -> N [0.0294118]
NP -> PRP N [0.0294118]
PP -> NP POP [0.2]
NP -> PRP N [0.0294118]
VP -> V [0.05]
S -> ADVP INT CO PP ADV INT RP ADJ PP NP ADV VP [0.0769230769]
ADVP -> ADV NP [0.333333]
NP -> N [0.0294118]
PP -> NP POP [0.6]
NP -> N [0.0294118]
NP -> N [0.0294118]
NP -> PRN [0.0294118]
VP -> V [0.1]
S -> NP PP NP NP VP [0.0769230769]
NP -> N [0.0294118]
PP -> PRP NP [0.2]
NP -> PRP N [0.0294118]
NP -> PRP N [0.0294118]
NP -> PRP N N [0.0294118]
VP -> V [0.05]
S -> NP ADJP ADVP VP [0.0769230769]
NP -> NP CO NP [0.0294118]
NP -> PRP N [0.0294118]
NP -> PRP N [0.0294118]
ADJP -> ADJ ADJ NP [0.333333]
NP -> N [0.0294118]
ADVP -> ADV NP [0.333333]
NP -> N [0.0294118]
VP -> V [0.05]
S -> PP VP CO NP VP [0.0769230769]
NP -> N N [0.0294118]
VP -> V [0.05]
NP -> N [0.0294118]
VP -> V [0.05]
S -> NP NP NP VP VP [0.0769230769]
NP -> PRN [0.0294118]
NP -> PRP N N [0.0294118]
NP -> PRP N [0.0294118]
VP -> V [0.05]
VP -> V [0.1]
S -> NP NP VP [0.0769230769]
NP -> PRN [0.0294118]
NP -> N [0.0294118]
VP -> V [0.05]
S -> NP ADJP VP [0.0769230769]
NP -> PRN [0.0294118]
ADJP -> ADJ NP [0.333333]
NP -> N N [0.0294118]
VP -> V [0.05]
S -> NP ADJP VP VP [0.0769230769]
NP -> PRN [0.0294118]
ADJP -> ADJ NP [0.333333]
NP -> N [0.0294118]
VP -> V [0.05]
VP -> V [0.05]
S -> NP ADJ VP VP [0.0769230769]
NP -> PRN [0.0588235]
VP -> V [0.1]
S -> NP VP VP VP [0.0769230769]
VP -> V [0.05]
S -> NP ADVP VP [0.0769230769]
NP -> PRN [0.0294118]
ADVP -> PRP ADV RP [0.333333]
VP -> V [0.05]
""")
##gram =("""
##S -> NP VP [1.0]
##NP -> ADJ [0] | N [0] | N N [0.4] | PN [0] | ADJ N [0] | AV N [0] | N ADJ [0.1] | NU NU [0.5] | NU AP [0] | ADJ AP [0] | AV [0] | ADJ AP [0] | N PN [0] | VP N [0] | PN ADV [0] | AV ADV [0] | N VP [0] | NU N [0] | NU [0] | V [0] | AV AP [0] | ADJ VP [0] | N AP [0] | ADJ AP [0] | ADJ NP [0] | N NP [0]
##VP -> V AP [0.557] | ADJ V [0.05] | AP [0.00625] | NP [0.00625] | AV PN [0.056] | V ADV [0.00625] | V [0.00625] | AV AP [0.00625] | N ADV [0.00625] | N [0.00625] | NU N [0.1] | N V [0.0375] | ADJ AP [0.00625] | N AV [0.10] | V ADJ [0.00625] | ADJ NP [0.00625] | N AP [0.00625] | N NP [0.00625] | NP NP [0.00625] | AV VP [0.00625] | ADJ VP [0.00625] | N VP [0.00625]
##AP -> AV V [0.056] | V NP [0.166] | ADJ V [0.051] | NP VP [0.0142857143] | AV NP [0.0142857143] | PN NP [0.0142857143] | N V [0.037] | NU N [0.2] | AV N [0.2] | ADJ PN [0.066] | V VP [0.0142857143] | N ADV [0.0142857143] | PN AV [0.024] | ADJ VP [0.0142857143] | PN N [0.1] | AV ADV [0.0142857143]
##ADV -> ADV ADJ [0.4] | PN VP [0.025] | N AP [0.025] | AV AV [0.5] | V AP [0.025] | N V [0.025]
##""")
##
##
##
##gram = ("""
##S -> NP VP [1.0]
##NP -> AV [0.5] | ADJ AP [0.5]
##VP -> AP [1.0]
##AP -> PN NP [0.5] | N V [0.5]
##AV -> "" [1.0]
##PN -> "" [1.0]
##ADJ -> "" [1.0]
##V -> "" [1.0]
##N -> "" [1.0]
##""")
##
##gram = ("""
##S -> NP VP
##NP -> NU | N N
##VP -> NP NP
##
##""")
#
##gram =("""
##S -> NP VP
##NP -> V
##VP -> N V
##""")
##dic = pandas.read_csv("dictionary.csv")
##doc = pandas.read_csv("corpus2.csv", quotechar='"', delimiter=',')
#book = open_workbook("Pastho dictionary2.xlsx")
##for sheet in book.sheets():
## for rowidx in range(sheet.nrows):
## row = sheet.row(rowidx)
## for i in sent:
## for colidx,cell in enumerate(row):
## if cell.value == i:#row value
## #print ("Found Row Element")
## #print(rowidx, colidx)
## #print(cell.value)
## print(row)
## print('\n')
##
##book = load_workbook("Pastho dictionary2.xlsx")
##worksheet = book.sheetnames
##sheet = book["Sheet1"]
##c=1
##for i in sheet:
## d = sheet.cell(row=c, column=2)
##
## if(d.value is None):
## print(" Try Again ")
##
##
## elif (d.value == " Noun"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "N ->" + "'" + cell.value + "'" + " " + "[0.0000851934]" + "\n"
##
##
## elif (d.value == "Noun"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "N ->" + "'" + cell.value + "'" + " " + "[0.0000851934]" + "\n"
##
##
## elif (d.value == " Verb"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "V ->" + "'" + cell.value + "'" + " " + "[0.0005530973]" + "\n"
##
##
## elif (d.value == "Verb"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "V ->" + "'" + cell.value + "'" + " " + "[0.0005530973]" + "\n"
##
##
## elif (d.value == " Adjective"):
##
## cell = sheet.cell(row=c, column=1)
## gram = gram + "ADJ ->" + "'" + cell.value + "'" + " " + "[0.000280112]" + "\n"
##
##
## elif (d.value == "Adjective"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "ADJ ->" + "'" + cell.value + "'" + " " + "[0.000280112]" + "\n"
##
##
## elif (d.value == " Participles"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "PP ->" + "'" + cell.value + "'" + " " + "[0.0588235294]" + "\n"
## #print("hi")
##
## elif (d.value == " Adverb"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "AV ->" + "'" + cell.value + "'" + " " + "[0.0025380711]" + "\n"
##
##
## elif (d.value == "Adverb"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "AV ->" + "'" + cell.value + "'" + " " + "[0.0025380711]" + "\n"
##
##
## elif (d.value == " numerical"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "NU ->" + "'" + cell.value + "'" + " " + "[0.0222222222]" + "\n"
##
##
## elif (d.value == "numerical"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "NU ->" + "'" + cell.value + "'" + " " + "[0.0222222222]" + "\n"
##
##
## elif (d.value == " proNoun"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "PN ->" + "'" + cell.value + "'" + " " + "[0.0125]" + "\n"
##
##
##
## elif (d.value == " ProNoun"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "PN ->" + "'" + cell.value + "'" + " " + "[0.0125]" + "\n"
##
##
##
## elif (d.value == "ProNoun"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "PN ->" + "'" + cell.value + "'" + " " + "[0.0125]" + "\n"
##
##
##
## elif (d.value == " suffix"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "SA ->" + "'" + cell.value + "'" + " " + "[0.0476190476]" + "\n"
##
##
##
## elif (d.value == " Suffix"):
## cell = sheet.cell(row=c, column=1)
## gram = gram + "SA ->" + "'" + cell.value + "'" + " " + "[0.0476190476]" + "\n"
## c=c+1
#print(gram)
grammar1 = nltk.PCFG.fromstring(gram)
sr_parser = nltk.ViterbiParser(grammar1)
#max=0
for tree in sr_parser.parse(sent):
print(tree)
##
## with open("prob.txt", "a", encoding='utf-8') as output:
## output.write(str(tree))
## output.write("\n")
##
## if (tree.prob() > max):
## max=tree.prob()
## max_tree=tree
##
##print(max)
##print(max_tree)
##sr_parser = nltk.parse.chart.ChartParser(grammar1)
#sr_parser = nltk.RecursiveDescentParser(grammar1)
#sr_parser = nltk.ShiftReduceParser(grammar1)
##for tree in sr_parser.parse(sent):
## #values = tree
##
## with open("test.txt", "a", encoding='utf-8') as output:
## output.write(str(tree))
## output.write("\n")
##
## print(tree)
## #break
##
| 31.508824 | 576 | 0.477364 |
96a3d255da97bc30ed9f93ea22fbcadc0ebc221e | 1,013 | py | Python | RFEM/SpecialObjects/intersection.py | Dlubal-Software/RFEM_Python_Client | 9e29c598dadf380d49677c463931f0be659ccc40 | [
"MIT"
] | 16 | 2021-10-13T21:00:11.000Z | 2022-03-21T11:12:09.000Z | RFEM/SpecialObjects/intersection.py | Dlubal-Software/RFEM_Python_Client | 9e29c598dadf380d49677c463931f0be659ccc40 | [
"MIT"
] | 49 | 2021-10-19T13:18:51.000Z | 2022-03-30T08:20:17.000Z | RFEM/SpecialObjects/intersection.py | Dlubal-Software/RFEM_Python_Client | 9e29c598dadf380d49677c463931f0be659ccc40 | [
"MIT"
] | 7 | 2021-10-13T06:06:24.000Z | 2022-03-29T17:48:39.000Z | from RFEM.initModel import Model, clearAtributes
| 28.942857 | 75 | 0.582428 |
96a494380c4f8173563744e5544c96b9515e8e78 | 6,760 | py | Python | tests/test_storage.py | HumanCellAtlas/data-store | 6b27d0f7e0110c62b3079151708689ab5145f15b | [
"MIT"
] | 46 | 2017-03-24T15:56:09.000Z | 2021-03-15T19:49:07.000Z | tests/test_storage.py | HumanCellAtlas/DCC | 6b27d0f7e0110c62b3079151708689ab5145f15b | [
"MIT"
] | 1,799 | 2017-04-04T17:54:28.000Z | 2020-11-19T12:30:13.000Z | tests/test_storage.py | HumanCellAtlas/DCC | 6b27d0f7e0110c62b3079151708689ab5145f15b | [
"MIT"
] | 13 | 2017-03-27T23:49:35.000Z | 2021-01-18T07:39:49.000Z | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import string
import unittest
from uuid import uuid4
from unittest import mock
from random import random, randint
from datetime import datetime, timedelta
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
sys.path.insert(0, pkg_root) # noqa
import dss
from dss import Replica
from dss.util.version import datetime_to_version_format
from dss.storage.identifiers import UUID_REGEX, TOMBSTONE_SUFFIX
from dss.storage.bundles import enumerate_available_bundles, get_tombstoned_bundles
from dss.logging import configure_test_logging
from tests.infra import testmode, MockStorageHandler
if __name__ == '__main__':
unittest.main()
| 45.066667 | 117 | 0.660059 |
96a6810cf017f549b181521c6cc7573fff263c40 | 11,035 | py | Python | headless/ches_prod_test_titles_headless.py | sherrli/Testing-Automation | d5a59ed10613b782cd4a8dc29d084c78ee883300 | [
"MIT"
] | 1 | 2019-04-05T15:51:30.000Z | 2019-04-05T15:51:30.000Z | headless/ches_prod_test_titles_headless.py | shli17/Testing-Automation | d5a59ed10613b782cd4a8dc29d084c78ee883300 | [
"MIT"
] | null | null | null | headless/ches_prod_test_titles_headless.py | shli17/Testing-Automation | d5a59ed10613b782cd4a8dc29d084c78ee883300 | [
"MIT"
] | null | null | null | #!/usr/local/bin/python
# coding=utf-8
# Headless firefox title test for jenkins build.
intro="""
----------------------------------------------------------------
File : ches_prod_test_titles_headless.py
Description : Headless firefox title test for ches prod sites.
Author : Sherri Li
----------------------------------------------------------------
"""
print(intro)
from selenium import webdriver
from xvfbwrapper import Xvfb
import unittest
import os
import sys
sys.path.append("..")
import json
import time
import datetime
import timeit
import logging
import write_log
import check_status
import create_log
import spreadsheet
# Generate log folder and file.
# Default log level is INFO (everything). Go to create_log.py to change.
folderName = create_log.createLog("ChesProdTitle")
###################################
# HELPER FUNCTION #################
###################################
# def run_test(self,siteName,row):
# with Xvfb() as xvfb:
# try:
# driver = webdriver.Firefox()
# driver.implicitly_wait(30)
# self.browser = driver
# except:
# write_log.logSetupError("firefox")
# print("Unable to load firefox")
#
# assert(self.browser is not None)
# assert(self.sites is not None)
# browser = self.browser
# print('\n')
#
# # Check that the site url exists.
# try:
# site = self.sites[siteName]
# except:
# write_log.logErrorMsg("your disk. Check to make sure the "+self.json_file+" is up to date.\n", "Test terminated prematurely. You are missing the "+siteName+" url")
# print(self.ERRORCOLOR+"ERROR: "+self.DEFAULTCOLOR + siteName + " credentials not found on your disk.")
# return
#
# site = self.sites[siteName]
# # Populate spreadsheet with app name, class name, current date.
# self.spreadsheet.write_cell(row,1,siteName)
# self.spreadsheet.write_cell(row,2,type(self).__name__)
# self.spreadsheet.write_cell(row,3,self.today[:16])
#
# # Once the site is found, make sure HTTP status code is 200, 301, or 302.
# # Call the function to get status code from file check_status.py.
# result = check_status.checkStatus(site['url'], [200, 301, 302])
# if result==False:
# self.spreadsheet.write_cell(row,5,"fail\ninvalid http response")
# return # exit test
# else:
# #BEGIN TIME
# self.timeStart = timeit.default_timer()
# browser.get(site['url'])
# write_log.logInfoMsg(siteName, "title test started")
# print("Testing " + siteName)# + " with " + browser.name.capitalize() + " Found site['title'] " + browser.title)
# browser.implicitly_wait(30)
#
# # You can also search for 'text' in browser.page_source rather than browser.title
# if site['title'] not in browser.title:
# self.spreadsheet.write_cell(row,5,site['title'] + " not found")
# write_log.logErrorMsg(siteName+'\n', "Desired title '" + site['title'] + "' not found")
# print(self.ERRORCOLOR+"ERROR:"+self.DEFAULTCOLOR+ "desired title '" + site['title'] + "' not found on " + siteName)
# browser.save_screenshot(folderName+'/error_'+siteName+'.png')
# else:
# #END TIME
# timeElapsed = timeit.default_timer() - self.timeStart
# write_log.logSummary(self.browserType, timeElapsed)
# # Populate spreadsheet with time and result.
# self.spreadsheet.write_cell(row,4,round(timeElapsed, 5))
# self.spreadsheet.write_cell(row,5,"pass")
# write_log.logSuccess(siteName+'\n', "title")
# print(self.SUCCESSCOLOR+"passed:"+self.DEFAULTCOLOR+ "'" + site['title'] + "' found on " + siteName)
#
# Kick off the test!
if __name__ == "__main__":
#print("\n\u001b[33smAll test logs and screenshots will be saved to the following folder in your current directory:\n" + folderName + "\n\u001b[0m")
unittest.main()
| 41.175373 | 181 | 0.553512 |
96a69bc47e9c073ff2335f4ac224effa211b40aa | 4,579 | py | Python | pyteiser/matchmaker.py | goodarzilab/pyteiser | 3ac78604c768957022cc7751ccdd337960a816f2 | [
"MIT"
] | 6 | 2020-12-01T08:10:07.000Z | 2022-01-17T02:09:13.000Z | pyteiser/matchmaker.py | goodarzilab/pyteiser | 3ac78604c768957022cc7751ccdd337960a816f2 | [
"MIT"
] | 4 | 2021-05-19T06:24:30.000Z | 2022-01-27T20:18:44.000Z | pyteiser/matchmaker.py | goodarzilab/pyteiser | 3ac78604c768957022cc7751ccdd337960a816f2 | [
"MIT"
] | 5 | 2020-07-04T02:05:30.000Z | 2021-06-26T10:24:16.000Z | import numba
import time
from . import glob_var
from . import structures
# for some reason, caching of this function fails the run on Columbia HPC and it doesn't really affect the speed
# since it only needs to compile once but it's getting called so many times
# for some reason, caching of this function fails the run on Columbia HPC and it doesn't really affect the speed
# since it only needs to compile once but it's getting called so many times
# I have tried really hard to improve performance of this step with numba
# the main problem is that I have a list of n_sequence objects and their size can vary
# therefore, I can't pass them to function as a numpy array with any of the standard formats
# I can mane a numpy array with an object dtyo (like dtype=structures.n_sequence) but Numba does not support it
# for more detailed explanation, see https://stackoverflow.com/questions/14639496/how-to-create-a-numpy-array-of-arbitrary-length-strings
# numba will deprecate standard python lists too
# there is also numba typed list structure (from numba.typed import List) but it's an experimental feature so far so I don't want to rely on it
# see here https://numba.pydata.org/numba-doc/dev/reference/pysupported.html
# so there is no way to pass a bunch of variable-sized sequence objects to numba in the way that would make the iterations faster
def calculate_profile_one_motif(motif, n_seqs_list, is_degenerate = False):
start_time = time.time()
current_profile = structures.w_profile(len(n_seqs_list))
for i, seq in enumerate(n_seqs_list):
match = is_there_motif_instance(motif, seq, is_degenerate)
if match:
current_profile.values[i] = True
end_time = time.time()
time_spent = end_time - start_time
return current_profile, time_spent
def calculate_profiles_list_motifs(n_motifs_list, n_seqs_list,
do_print=False,
is_degenerate = False):
profiles_list = [0] * len(n_motifs_list)
for i, motif in enumerate(n_motifs_list):
current_profile, time_spent = calculate_profile_one_motif(motif, n_seqs_list, is_degenerate)
profiles_list[i] = current_profile.values
if do_print:
print("Motif number %d binds %d sequences. It took %.2f seconds"
% (i, current_profile.sum(), time_spent))
return profiles_list
| 42.794393 | 143 | 0.70736 |
96a6c1aaacc3e456bbd64b90f5f744423a7befea | 4,574 | py | Python | clean.py | stephtdouglas/k2spin | 9a73e35e99b925015a91e37b5fd785440adf78f9 | [
"MIT"
] | null | null | null | clean.py | stephtdouglas/k2spin | 9a73e35e99b925015a91e37b5fd785440adf78f9 | [
"MIT"
] | null | null | null | clean.py | stephtdouglas/k2spin | 9a73e35e99b925015a91e37b5fd785440adf78f9 | [
"MIT"
] | null | null | null | """Basic cleanup on lightcurves (trimming, sigma-clipping)."""
import logging
import numpy as np
import matplotlib.pyplot as plt
import k2spin.utils as utils
from k2spin import detrend
def trim(time, flux, unc_flux):
"""Remove infs, NaNs, and negative flux values.
Inputs
------
time, flux, unc_flux: array_like
Outputs
-------
trimmed_time, trimmed_flux, trimmed_unc: arrays
good: boolean mask, locations that were kept
"""
good = np.where((np.isfinite(flux)==True) & (flux>0) &
(np.isfinite(unc_flux)==True) &
(np.isfinite(time)==True) & (time>2061.5))[0]
trimmed_time = time[good]
trimmed_flux = flux[good]
trimmed_unc = unc_flux[good]
return trimmed_time, trimmed_flux, trimmed_unc, good
def smooth_and_clip(time, flux, unc_flux, clip_at=3, to_plot=False):
"""Smooth the lightcurve, then clip based on residuals."""
if to_plot:
plt.figure(figsize=(8,4))
ax = plt.subplot(111)
ax.plot(time,flux,'k.',label="orig")
# Simple sigma clipping first to get rid of really big outliers
ct, cf, cu, to_keep = sigma_clip(time, flux, unc_flux, clip_at=clip_at)
logging.debug("c len t %d f %d u %d tk %d", len(ct), len(cf),
len(cu), len(to_keep))
if to_plot: ax.plot(ct, cf, '.',label="-1")
# Smooth with supersmoother without much bass enhancement
for i in range(3):
det_out = detrend.simple_detrend(ct, cf, cu, phaser=0)
detrended_flux, detrended_unc, bulk_trend = det_out
# Take the difference, and find the standard deviation of the residuals
# logging.debug("flux, bulk trend, diff")
# logging.debug(cf[:5])
# logging.debug(bulk_trend[:5])
f_diff = cf - bulk_trend
# logging.debug(f_diff[:5])
diff_std = np.zeros(len(f_diff))
diff_std[ct<=2102] = np.std(f_diff[ct<=2102])
diff_std[ct>2102] = np.std(f_diff[ct>2102])
# logging.debug("std %f %f",diff_std[0], diff_std[-1])
if to_plot:
ax.plot(ct, bulk_trend)
logging.debug("%d len tk %d diff %d", i, len(to_keep), len(f_diff))
# Clip outliers based on residuals this time
to_keep = to_keep[abs(f_diff)<=(diff_std*clip_at)]
ct = time[to_keep]
cf = flux[to_keep]
cu = unc_flux[to_keep]
if to_plot:
ax.plot(ct, cf, '.',label=str(i))
if to_plot:
ax.legend()
clip_time = time[to_keep]
clip_flux = flux[to_keep]
clip_unc_flux = unc_flux[to_keep]
return clip_time, clip_flux, clip_unc_flux, to_keep
def sigma_clip(time, flux, unc_flux, clip_at=6):
"""Perform sigma-clipping on the lightcurve.
Inputs
------
time, flux, unc_flux: array_like
clip_at: float (optional)
how many sigma to clip at. Defaults to 6.
Outputs
-------
clipped_time, clipped_flux, clipped_unc: arrays
to_keep: boolean mask of locations that were kept
"""
# Compute statistics on the lightcurve
med, stdev = utils.stats(flux, unc_flux)
# Sigma-clip the lightcurve
outliers = abs(flux-med)>(stdev*clip_at)
to_clip = np.where(outliers==True)[0]
to_keep = np.where(outliers==False)[0]
logging.debug("Sigma-clipping")
logging.debug(to_clip)
clipped_time = np.delete(time, to_clip)
clipped_flux = np.delete(flux, to_clip)
clipped_unc = np.delete(unc_flux, to_clip)
# Return clipped lightcurve
return clipped_time, clipped_flux, clipped_unc, to_keep
def prep_lc(time, flux, unc_flux, clip_at=3):
"""Trim, sigma-clip, and calculate stats on a lc.
Inputs
------
time, flux, unc_flux: array_like
clip_at: float (optional)
How many sigma to clip at. Defaults to 6.
Set to None for no sigma clipping
Outputs
-------
clean_time, clean_flux, clean_unc: arrays
"""
# Trim the lightcurve, remove bad values
t_time, t_flux, t_unc, t_kept = trim(time, flux, unc_flux)
# Run sigma-clipping if desired, repeat 2X
if clip_at is not None:
c_time, c_flux, c_unc, c_kept = smooth_and_clip(t_time, t_flux, t_unc,
clip_at=clip_at)
else:
c_time, c_flux, c_unc, c_kept = t_time, t_flux, t_unc, t_kept
all_kept = t_kept[c_kept]
# Calculate statistics on lightcurve
c_med, c_stdev = utils.stats(c_flux, c_unc)
# Return cleaned lightcurve and statistics
return c_time, c_flux, c_unc, c_med, c_stdev, all_kept
| 29.895425 | 79 | 0.630302 |
96a6e69d914f940d6ce83071f9858c2504a877e2 | 140 | py | Python | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | 1 | 2021-07-30T06:15:18.000Z | 2021-07-30T06:15:18.000Z | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | null | null | null | nested ternary.py | ps2809/Python-Examples | 0574f53787af28bf5bd011c139d340091454a4f9 | [
"MIT"
] | null | null | null | a=int(input('enter a:'))
b=int(input('enter b:'))
c=int(input('enter c:'))
min_value= a if a<b and a<c else b if b<c else c
print(min_value) | 28 | 48 | 0.657143 |
96a81b3b0875d5b95d7dd34bd4be73ffcfb6fd0c | 758 | py | Python | pylinsql/timing.py | hunyadi/pylinsql | bba0017322edbda25a5a2c87f5b46407eea9a00a | [
"MIT"
] | null | null | null | pylinsql/timing.py | hunyadi/pylinsql | bba0017322edbda25a5a2c87f5b46407eea9a00a | [
"MIT"
] | null | null | null | pylinsql/timing.py | hunyadi/pylinsql | bba0017322edbda25a5a2c87f5b46407eea9a00a | [
"MIT"
] | null | null | null | import asyncio
import functools
import time
def timing(f):
"Decorator to log"
if asyncio.iscoroutinefunction(f):
else:
return wrap
| 22.294118 | 82 | 0.51847 |
96a839ea7a6be1421d492c4092e290ebd78292b8 | 715 | py | Python | examples/wsgi_usage/apache_modwsgi_server_example.py | digimatspa/python-jsonrpc | 7f8a022c112f8957cee18c54fc48557690cfe417 | [
"MIT"
] | 97 | 2015-01-06T14:29:31.000Z | 2022-02-17T07:27:11.000Z | examples/wsgi_usage/apache_modwsgi_server_example.py | HoverHell/python-jsonrpc | 41bcd48dd7879ca780481605dc1ffb611ead9100 | [
"MIT"
] | 37 | 2015-01-03T11:00:48.000Z | 2021-04-23T06:12:45.000Z | examples/wsgi_usage/apache_modwsgi_server_example.py | HoverHell/python-jsonrpc | 41bcd48dd7879ca780481605dc1ffb611ead9100 | [
"MIT"
] | 63 | 2015-02-04T20:14:48.000Z | 2022-02-17T07:27:13.000Z | #!/usr/bin/env python
# coding: utf-8
# BEGIN --- required only for testing, remove in real world code --- BEGIN
import os
import sys
THISDIR = os.path.dirname(os.path.abspath(__file__))
APPDIR = os.path.abspath(os.path.join(THISDIR, os.path.pardir, os.path.pardir))
sys.path.insert(0, APPDIR)
# END --- required only for testing, remove in real world code --- END
#
# See http://tools.cherrypy.org/wiki/ModWSGI
#
import cherrypy
from pyjsonrpc.cp import CherryPyJsonRpc, rpcmethod
# WSGI-Application
application = cherrypy.Application(Root())
| 21.029412 | 79 | 0.706294 |
96a84245805dc4fa3773a993afd163825be5f67d | 27,511 | py | Python | dicomToProjection/convertDicoms.py | tarolangner/mri_biometry | 8c52f48c2c9ff823a300c5298ea3992b53440816 | [
"MIT"
] | null | null | null | dicomToProjection/convertDicoms.py | tarolangner/mri_biometry | 8c52f48c2c9ff823a300c5298ea3992b53440816 | [
"MIT"
] | null | null | null | dicomToProjection/convertDicoms.py | tarolangner/mri_biometry | 8c52f48c2c9ff823a300c5298ea3992b53440816 | [
"MIT"
] | null | null | null | import os
import sys
import io
import time
import zipfile
import pydicom
import numpy as np
import scipy.interpolate
import numba_interpolate
from skimage import filters
import nrrd
import cv2
c_out_pixel_spacing = np.array((2.23214293, 2.23214293, 3.))
c_resample_tolerance = 0.01 # Only interpolate voxels further off of the voxel grid than this
c_interpolate_seams = True # If yes, cut overlaps between stations to at most c_max_overlap and interpolate along them, otherwise cut at center of overlap
c_correct_intensity = True # If yes, apply intensity correction along overlap
c_max_overlap = 8 # Used in interpolation, any station overlaps are cut to be most this many voxels in size
c_trim_axial_slices = 4 # Trim this many axial slices from the output volume to remove folding artefacts
c_use_gpu = True # If yes, use numba for gpu access, otherwise use scipy on cpu
c_store_mip = True # If yes, extract 2d mean intensity projections as .npy
c_store_ff_slice = False # If If yes, extract single fat fraction slice with liver coverage
c_store_volumes = False # If yes, extract 3d volumes as .nrrd
##
# Extract mean intensity projection from input UK Biobank style DICOM zip
# Generate mean intensity projection
##
# Return, for S stations:
# R: station start coordinates, shape Sx3
# R_end: station end coordinates, shape Sx3
# dims: station extents, shape Sx3
#
# Coordinates in R and R_end are in the voxel space of the first station
##
# Linearly taper off voxel values along overlap of two stations,
# so that their addition leads to a linear interpolation.
##
# Take mean intensity of slices at the edge of the overlap between stations i and (i+1)
# Adjust mean intensity of each slice along the overlap to linear gradient between these means
##
# Ensure that the stations i and (i + 1) overlap by at most c_max_overlap.
# Trim any excess symmetrically
# Update their extents in W and W_end
##
# Station voxels are positioned at R to R_end, not necessarily aligned with output voxel grid
# Resample stations onto voxel grid of output volume
if __name__ == '__main__':
main(sys.argv)
| 32.947305 | 211 | 0.637963 |
96a94e5f66df21e992b1df975469b8edd292ca16 | 3,285 | py | Python | ffttest.py | teslaworksumn/Reactor | ba6d2d80bd606047e81a5e1ccc0f1af26497feb7 | [
"MIT"
] | null | null | null | ffttest.py | teslaworksumn/Reactor | ba6d2d80bd606047e81a5e1ccc0f1af26497feb7 | [
"MIT"
] | null | null | null | ffttest.py | teslaworksumn/Reactor | ba6d2d80bd606047e81a5e1ccc0f1af26497feb7 | [
"MIT"
] | null | null | null | # From http://julip.co/2012/05/arduino-python-soundlight-spectrum/
# Python 2.7 code to analyze sound and interface with Arduino
import pyaudio # from http://people.csail.mit.edu/hubert/pyaudio/
import serial # from http://pyserial.sourceforge.net/
import numpy # from http://numpy.scipy.org/
import audioop
import sys
import math
import struct
'''
Sources
http://www.swharden.com/blog/2010-03-05-realtime-fft-graph-of-audio-wav-file-or-microphone-input-with-python-scipy-and-wckgraph/
http://macdevcenter.com/pub/a/python/2001/01/31/numerically.html?page=2
'''
MAX = 0
NUM = 20
if __name__ == '__main__':
#list_devices()
fft()
| 28.076923 | 128 | 0.578082 |
96aa0527808e7632054573910aceede43a35b2b3 | 6,422 | py | Python | monitoring/perf-monitor-test.py | abhisheksawarkar/gcp-ml-ops | 462780e6caad370781e191f530f1fd4a4a57431c | [
"Apache-2.0"
] | 30 | 2021-04-14T16:52:19.000Z | 2022-03-17T20:39:42.000Z | monitoring/perf-monitor-test.py | shashank3959/gcp-ml-ops | afa7885e0230c580296724d6dcc5e619a115f24c | [
"Apache-2.0"
] | null | null | null | monitoring/perf-monitor-test.py | shashank3959/gcp-ml-ops | afa7885e0230c580296724d6dcc5e619a115f24c | [
"Apache-2.0"
] | 4 | 2021-04-14T16:52:28.000Z | 2022-01-13T19:05:26.000Z | # Copyright (c) 2021 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 numpy as np
import os
import logging
import argparse
import sys
import warnings
import sys
import time
import json
import cudf
from sklearn import metrics
import pandas as pd
import tritonclient.http as httpclient
import tritonclient.grpc as grpcclient
from tritonclient.utils import *
from google.cloud import pubsub_v1
from google.protobuf.json_format import MessageToJson
from google.pubsub_v1.types import Encoding
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-u',
'--triton_grpc_url',
type=str,
required=False,
default='localhost:8001',
help='URL to Triton gRPC Endpoint')
parser.add_argument('-m',
'--model_name',
type=str,
required=False,
default='dcn_ens',
help='Name of the model ensemble to load')
parser.add_argument('-d',
'--test_data',
type=str,
required=False,
default='/crit_int_pq/day_23.parquet',
help='Path to a test .parquet file. Default')
parser.add_argument('-b',
'--batch_size',
type=int,
required=False,
default=64,
help='Batch size. Max is 64 at the moment, but this max size could be specified when create the model and the ensemble.')
parser.add_argument('-n',
'--n_batches',
type=int,
required=False,
default=1,
help='Number of batches of data to send')
parser.add_argument('-v',
'--verbose',
type=bool,
required=False,
default=False,
help='Verbosity, True or False')
parser.add_argument("--project_id",
type=str,
required=True,
default="dl-tme",
help="Google Cloud project ID")
parser.add_argument("--topic_id",
type=str,
required=True,
default="pubsub",
help="Pub/Sub topic ID")
args = parser.parse_args()
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO, datefmt='%d-%m-%y %H:%M:%S')
logging.info(f"Args: {args}")
# warnings can be disabled
if not sys.warnoptions:
warnings.simplefilter("ignore")
try:
triton_client = grpcclient.InferenceServerClient(url=args.triton_grpc_url, verbose=args.verbose)
logging.info("Triton client created.")
triton_client.is_model_ready(args.model_name)
logging.info(f"Model {args.model_name} is ready!")
except Exception as e:
logging.error(f"Channel creation failed: {str(e)}")
sys.exit()
# Load the dataset
CATEGORICAL_COLUMNS = ['C' + str(x) for x in range(1,27)]
CONTINUOUS_COLUMNS = ['I' + str(x) for x in range(1,14)]
LABEL_COLUMNS = ['label']
col_names = CATEGORICAL_COLUMNS + CONTINUOUS_COLUMNS
col_dtypes = [np.int32]*26 + [np.int64]*13
logging.info("Reading dataset..")
all_batches = cudf.read_parquet(args.test_data, num_rows=args.batch_size*args.n_batches)
results=[]
with grpcclient.InferenceServerClient(url=args.triton_grpc_url) as client:
for batch in range(args.n_batches):
logging.info(f"Requesting inference for batch {batch}..")
start_idx = batch*args.batch_size
end_idx = (batch+1)*(args.batch_size)
# Convert the batch to a triton inputs
current_batch = all_batches[start_idx:end_idx]
columns = [(col, current_batch[col]) for col in col_names]
inputs = []
for i, (name, col) in enumerate(columns):
d = col.values_host.astype(col_dtypes[i])
d = d.reshape(len(d), 1)
inputs.append(grpcclient.InferInput(name, d.shape, np_to_triton_dtype(col_dtypes[i])))
inputs[i].set_data_from_numpy(d)
outputs = []
outputs.append(grpcclient.InferRequestedOutput("OUTPUT0"))
response = client.infer(args.model_name, inputs, request_id=str(1), outputs=outputs)
results.extend(response.as_numpy("OUTPUT0"))
publish_batch(args.project_id, args.topic_id,
current_batch,
response.as_numpy("OUTPUT0"))
logging.info(f"ROC AUC Score: {metrics.roc_auc_score(all_batches[LABEL_COLUMNS].values.tolist(), results)}") | 34.902174 | 145 | 0.575833 |
96aa3bc5e94ffc210e626376f0da8dd2ffc01f94 | 3,996 | py | Python | daemon/core/gui/dialogs/throughput.py | montag451/core | 3be162b0b0f54b35520b980023abdfad4ff5e489 | [
"BSD-2-Clause"
] | null | null | null | daemon/core/gui/dialogs/throughput.py | montag451/core | 3be162b0b0f54b35520b980023abdfad4ff5e489 | [
"BSD-2-Clause"
] | null | null | null | daemon/core/gui/dialogs/throughput.py | montag451/core | 3be162b0b0f54b35520b980023abdfad4ff5e489 | [
"BSD-2-Clause"
] | null | null | null | """
throughput dialog
"""
import tkinter as tk
from tkinter import ttk
from typing import TYPE_CHECKING
from core.gui.dialogs.colorpicker import ColorPickerDialog
from core.gui.dialogs.dialog import Dialog
from core.gui.themes import FRAME_PAD, PADX, PADY
if TYPE_CHECKING:
from core.gui.app import Application
| 36 | 88 | 0.62037 |
96aa991d741b497c4ac277aabd1b587505844ad6 | 5,488 | py | Python | backend/api/tests/unit_tests/test_cards.py | hieutt99/aidudu | 00dff59e8dff109904b340cd7ae763d6201773e8 | [
"MIT"
] | 3 | 2021-10-31T19:32:20.000Z | 2022-01-02T15:31:11.000Z | backend/api/tests/unit_tests/test_cards.py | hieutt99/aidudu | 00dff59e8dff109904b340cd7ae763d6201773e8 | [
"MIT"
] | 49 | 2021-10-31T16:08:35.000Z | 2022-01-04T16:29:06.000Z | backend/api/tests/unit_tests/test_cards.py | hieutt99/aidudu | 00dff59e8dff109904b340cd7ae763d6201773e8 | [
"MIT"
] | 2 | 2021-12-19T17:03:22.000Z | 2022-01-03T08:27:01.000Z | from django.test.client import BOUNDARY
from api.tests.unit_tests.utils import *
| 35.179487 | 111 | 0.598397 |
96ab9f2c7f20292bca2815ee86e2e792b39a18da | 1,412 | py | Python | mouse.py | Ra-Na/android-mouse-cursor | b9f0a8394871cb17a2d6ec1a0cc2548b86990ce0 | [
"MIT"
] | 7 | 2019-12-05T13:34:37.000Z | 2022-01-15T09:58:11.000Z | mouse.py | Ra-Na/android-mouse-cursor | b9f0a8394871cb17a2d6ec1a0cc2548b86990ce0 | [
"MIT"
] | null | null | null | mouse.py | Ra-Na/android-mouse-cursor | b9f0a8394871cb17a2d6ec1a0cc2548b86990ce0 | [
"MIT"
] | 5 | 2019-07-27T02:28:04.000Z | 2022-02-14T15:10:25.000Z | import socket
# get your phones IP by visiting https://www.whatismyip.com/
# then specify your IPv6 here like so
UDP_IP = "2a01:30:2a04:3c1:c83c:2315:9d2b:9a40" # IPv6
UDP_PORT = 9999
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print ""
print "W, A, S, D - Move mouse"
print "Space - Click"
print "Q - Quit"
# IPv6
sock = socket.socket(socket.AF_INET6, # Internet
socket.SOCK_DGRAM) # UDP
# IPv4
# sock = socket.socket(socket.AF_INET, # Internet
# socket.SOCK_DGRAM) # UDP
while True:
key = ord(getch())
if key == 119: # W
# print 'up'
sock.sendto('0', (UDP_IP, UDP_PORT))
elif key == 97: # A
# print 'left'
sock.sendto('2', (UDP_IP, UDP_PORT))
elif key == 115: # S
# print 'down'
sock.sendto('1', (UDP_IP, UDP_PORT))
elif key == 100: # D
# print 'right'
sock.sendto('3', (UDP_IP, UDP_PORT))
elif key == 113: # Q
break
elif key == 32: # Space
# print 'click'
sock.sendto('4', (UDP_IP, UDP_PORT))
| 25.214286 | 62 | 0.576487 |
96adbd6c68f6247e87e6ccdd7457197d2e799780 | 4,278 | py | Python | routes/process_tag.py | PowerSaucisse/QuarKEY-api-server | ba327d3a49e8ea35efbb989550cb8a1429098b15 | [
"MIT"
] | 5 | 2021-07-26T14:46:35.000Z | 2021-07-26T22:50:56.000Z | routes/process_tag.py | PowerSaucisse/quarkey-api-server | ba327d3a49e8ea35efbb989550cb8a1429098b15 | [
"MIT"
] | null | null | null | routes/process_tag.py | PowerSaucisse/quarkey-api-server | ba327d3a49e8ea35efbb989550cb8a1429098b15 | [
"MIT"
] | null | null | null | from utils.security.auth import AccountAuthToken
import falcon, uuid, datetime
from routes.middleware import AuthorizeResource
from utils.base import api_validate_form, api_message
from utils.config import AppState
| 39.981308 | 140 | 0.556568 |
96af356d59393d735c1df16fcdd2f437e70407ca | 2,338 | py | Python | HackerEarth/Python/BasicProgramming/InputOutput/BasicsOfInputOutput/SeatingArrangement.py | cychitivav/programming_exercises | e8e7ddb4ec4eea52ee0d3826a144c7dc97195e78 | [
"MIT"
] | null | null | null | HackerEarth/Python/BasicProgramming/InputOutput/BasicsOfInputOutput/SeatingArrangement.py | cychitivav/programming_exercises | e8e7ddb4ec4eea52ee0d3826a144c7dc97195e78 | [
"MIT"
] | null | null | null | HackerEarth/Python/BasicProgramming/InputOutput/BasicsOfInputOutput/SeatingArrangement.py | cychitivav/programming_exercises | e8e7ddb4ec4eea52ee0d3826a144c7dc97195e78 | [
"MIT"
] | null | null | null | #!/Usr/bin/env python
"""
Akash and Vishal are quite fond of travelling. They mostly travel by railways. They were travelling in a train one day and they got interested in the seating arrangement of their compartment. The compartment looked something like
So they got interested to know the seat number facing them and the seat type facing them. The seats are denoted as follows :
Window Seat : WS
Middle Seat : MS
Aisle Seat : AS
You will be given a seat number, find out the seat number facing you and the seat type, i.e. WS, MS or AS.
INPUT:
First line of input will consist of a single integer T denoting number of test-cases. Each test-case consists of a single integer N denoting the seat-number.
OUTPUT:
For each test case, print the facing seat-number and the seat-type, separated by a single space in a new line.
CONSTRAINTS:
1 T 10^5
1 N 10^8
"""
__author__ = "Cristian Chitiva"
__date__ = "March 17, 2019"
__email__ = "cychitivav@unal.edu.co"
T = int(input())
while T > 0:
N = int(input())
position = N % 12
section = N//12
if position == 1:
word = str((position + 11) + 12*section)
print(word + ' WS')
elif position == 2:
word = str((position + 9) + 12*section)
print(word + ' MS')
elif position == 3:
word = str((position + 7) + 12*section)
print(word + ' AS')
elif position == 4:
word = str((position + 5) + 12*section)
print(word + ' AS')
elif position == 5:
word = str((position + 3) + 12*section)
print(word + ' MS')
elif position == 6:
word = str((position + 1) + 12*section)
print(word + ' WS')
elif position == 7:
word = str((position - 1) + 12*section)
print(word + ' WS')
elif position == 8:
word = str((position - 3) + 12*section)
print(word + ' MS')
elif position == 9:
word = str((position - 5) + 12*section)
print(word + ' AS')
elif position == 10:
word = str((position - 7) + 12*section)
print(word + ' AS')
elif position == 11:
word = str((position - 9) + 12*section)
print(word + ' MS')
else:
word = str((position - 11) + 12*section)
print(word + ' WS')
T -= 1
| 32.027397 | 230 | 0.582977 |
96af9cf77f54780c67f68a366b9f2da0eae70db7 | 3,149 | py | Python | analysis/marc_verification_sharp.py | maxschalz/studious_potato | a368aa88036c1f0ffcd494e994b0975be2575210 | [
"BSD-3-Clause"
] | null | null | null | analysis/marc_verification_sharp.py | maxschalz/studious_potato | a368aa88036c1f0ffcd494e994b0975be2575210 | [
"BSD-3-Clause"
] | null | null | null | analysis/marc_verification_sharp.py | maxschalz/studious_potato | a368aa88036c1f0ffcd494e994b0975be2575210 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
import matplotlib
matplotlib.use('pgf')
import matplotlib.pyplot as plt
import numpy as np
from multi_isotope_calculator import Multi_isotope
import plotsettings as ps
plt.style.use('seaborn-darkgrid')
plt.rcParams.update(ps.tex_fonts())
def figure1():
"""Compare data to Sharp paper (tails U234 vs product U235)"""
data = np.genfromtxt("../data/sharp_fig1.csv", delimiter=",")
data = data[np.argsort(data[:,0])]
composition = {'234': 5.5e-3, '235': (0.72, 3, 0.2)}
calculator = Multi_isotope(composition, feed=1, process='diffusion',
downblend=False)
results = np.empty(shape=data.shape, dtype=float)
for i, xp in enumerate(data[:,0]):
calculator.set_product_enrichment(xp*100)
calculator.calculate_staging()
results[i,0] = calculator.xp[3]
results[i,1] = calculator.xt[2]
data *= 100
results *= 100
pulls = 100 * (data[:,1]-results[:,1]) / data[:,1]
ylims = (1e299, 0)
for values in (data, results):
ylims = (min(ylims[0], min(values[:,1])),
max(ylims[1], max(values[:,1])))
return data, results, pulls
def figure5():
"""Compare data to Sharp paper (tails qty vs product qty)"""
sharp = np.genfromtxt("../data/sharp_fig5.csv", delimiter=",")
sharp = sharp[np.argsort(sharp[:,0])]
calc = Multi_isotope({'235': (0.711, 5, 0.2)}, max_swu=15000,
process='diffusion', downblend=False)
results = np.empty(shape=sharp.shape, dtype=float)
for i, xp in enumerate(sharp[:,0]):
calc.set_product_enrichment(xp*100)
calc.calculate_staging()
results[i,0] = calc.xp[3] * 100
results[i,1] = calc.t
sharp[:,0] *= 100
pulls = 100 * (sharp[:,1]-results[:,1]) / sharp[:,1]
return sharp, results, pulls
if __name__=='__main__':
main()
| 30.278846 | 73 | 0.580502 |
96b02e8ac66ecd2c65e6e010e248801adc096f97 | 497 | py | Python | clase6/clases.py | Tank3-TK3/codigo-basico-Python | 580e8d284fa8a4d70b2a264762c91bd64c89ab80 | [
"MIT"
] | 7 | 2021-04-19T01:32:49.000Z | 2021-06-04T17:38:04.000Z | clase6/clases.py | Tank3-TK3/codigo-basico-Python | 580e8d284fa8a4d70b2a264762c91bd64c89ab80 | [
"MIT"
] | null | null | null | clase6/clases.py | Tank3-TK3/codigo-basico-Python | 580e8d284fa8a4d70b2a264762c91bd64c89ab80 | [
"MIT"
] | null | null | null | print("--------------------------------------------------")
firulais = Perro("Firulais")
firulais.comer()
firulais.dormir()
firulais.ladrar()
print("--------------------------------------------------") | 23.666667 | 60 | 0.525151 |
96b0583a014d7b5a8ac9ea17b0f8eea2bc40f0eb | 3,103 | py | Python | homeworks_advanced/homework2_attention_in_seq2seq/modules.py | BiscuitsLayer/ml-mipt | 24917705189d2eb97a07132405b4f93654cb1aaf | [
"MIT"
] | 1 | 2021-08-01T11:29:11.000Z | 2021-08-01T11:29:11.000Z | homeworks_advanced/homework2_attention_in_seq2seq/modules.py | ivasio/ml-mipt | 9c8896b4dfe46ee02bc5fdbca47acffbeca6828e | [
"MIT"
] | null | null | null | homeworks_advanced/homework2_attention_in_seq2seq/modules.py | ivasio/ml-mipt | 9c8896b4dfe46ee02bc5fdbca47acffbeca6828e | [
"MIT"
] | null | null | null | import random
import torch
from torch import nn
from torch.nn import functional as F
| 29.836538 | 92 | 0.638737 |
96b22687eb09935202fe84c81b4d3c7659c65ad8 | 1,753 | py | Python | zipselected/__init__.py | raguay/ZipSelected | 8663623498db6e87beded2aaecac65cd0979788d | [
"MIT"
] | 6 | 2017-01-26T09:09:51.000Z | 2021-12-14T11:38:54.000Z | zipselected/__init__.py | raguay/ZipSelected | 8663623498db6e87beded2aaecac65cd0979788d | [
"MIT"
] | 2 | 2017-03-17T11:24:26.000Z | 2018-02-22T13:47:41.000Z | zipselected/__init__.py | raguay/ZipSelected | 8663623498db6e87beded2aaecac65cd0979788d | [
"MIT"
] | 2 | 2017-10-16T06:19:27.000Z | 2020-05-15T13:42:26.000Z | from fman import DirectoryPaneCommand, show_alert
import os
import zipfile
from fman.url import as_human_readable
from fman.url import as_url
| 39.840909 | 100 | 0.58243 |
96b3255531b199084f95bb09b62e2c476d0885f5 | 626 | py | Python | functions/aurora_check_status.py | aws-samples/aws-stepfunctions-aurora-clone | ca60dbb1e98bb337662ac6140a2749fa03363d48 | [
"MIT-0"
] | 7 | 2022-02-22T16:23:00.000Z | 2022-03-18T18:44:06.000Z | functions/aurora_check_status.py | aws-samples/aws-stepfunctions-aurora-clone | ca60dbb1e98bb337662ac6140a2749fa03363d48 | [
"MIT-0"
] | null | null | null | functions/aurora_check_status.py | aws-samples/aws-stepfunctions-aurora-clone | ca60dbb1e98bb337662ac6140a2749fa03363d48 | [
"MIT-0"
] | null | null | null | import boto3
client = boto3.client('rds')
| 25.04 | 96 | 0.629393 |
96b4507fab2d696dd5272cc8fb8efb5a6fdf9e81 | 6,545 | py | Python | smellCatalog/InputProcessor.py | neilernst/smells | c093ee72a12f62693d8635359b7ca4958ecba0e0 | [
"MIT"
] | null | null | null | smellCatalog/InputProcessor.py | neilernst/smells | c093ee72a12f62693d8635359b7ca4958ecba0e0 | [
"MIT"
] | null | null | null | smellCatalog/InputProcessor.py | neilernst/smells | c093ee72a12f62693d8635359b7ca4958ecba0e0 | [
"MIT"
] | 1 | 2019-07-15T14:16:37.000Z | 2019-07-15T14:16:37.000Z | import re
from Smell import Smell
from SmellCategory import SmellCategory
from Reference import Reference
SMELL = "\[smell\]"
SMELL_ID = "\[smell-id\]"
SMELL_NAME = "\[smell-name\]"
SMELL_END = "\[smell-end\]"
SMELL_DES = "\[smell-description\]"
SMELL_AKA = "\[smell-aka\]"
SMELL_CATEGORY = "\[smell-category\]"
SMELL_SUBCATEGORY = "\[smell-subcategory\]"
SMELL_REF = "\[smell-ref\]"
SCAT = "\[define-smell-category\]"
SCAT_ID = "\[smell-category-id\]"
SCAT_NAME = "\[smell-category-name\]"
SCAT_PARENT = "\[smell-category-parent\]"
SCAT_END = "\[define-smell-category-end\]"
REF = "\[reference\]"
REF_ID = "\[ref-id\]"
REF_TEXT = "\[ref-text\]"
REF_IMAGE = "\[ref-image\]"
REF_URL = "\[ref-url\]"
REF_END = "\[ref-end\]"
| 42.5 | 93 | 0.559664 |
96b5076f3752a0f19a06b6d629287742be1b298b | 414 | py | Python | YorForger/modules/redis/afk_redis.py | Voidxtoxic/kita | b2a3007349727280e149dcca017413d7dc2e7648 | [
"MIT"
] | null | null | null | YorForger/modules/redis/afk_redis.py | Voidxtoxic/kita | b2a3007349727280e149dcca017413d7dc2e7648 | [
"MIT"
] | null | null | null | YorForger/modules/redis/afk_redis.py | Voidxtoxic/kita | b2a3007349727280e149dcca017413d7dc2e7648 | [
"MIT"
] | null | null | null |
from YorForger import REDIS
# AFK
# Helpers
| 15.333333 | 46 | 0.695652 |
96b51c0b082319955c9c8c901bb9467463e9b730 | 859 | py | Python | mini_event.py | shubhamjain/earphone-event | 0513a06904ea98c3962015d6edaf5f63943a03b7 | [
"MIT"
] | 6 | 2018-08-16T21:38:40.000Z | 2020-11-19T05:53:09.000Z | mini_event.py | shubhamjain/earphone-event | 0513a06904ea98c3962015d6edaf5f63943a03b7 | [
"MIT"
] | 1 | 2020-10-21T17:55:07.000Z | 2020-10-21T17:55:07.000Z | mini_event.py | shubhamjain/earphone-event | 0513a06904ea98c3962015d6edaf5f63943a03b7 | [
"MIT"
] | 1 | 2021-09-08T15:05:52.000Z | 2021-09-08T15:05:52.000Z | import threading
| 28.633333 | 115 | 0.604191 |
96b58e236e198367799150eb2cf1c9825aebfff3 | 13,225 | py | Python | tin/utils.py | balazsdukai/tin2stardb | efb160ba744f757c4a6d4674c7abec8bf0694415 | [
"MIT"
] | null | null | null | tin/utils.py | balazsdukai/tin2stardb | efb160ba744f757c4a6d4674c7abec8bf0694415 | [
"MIT"
] | null | null | null | tin/utils.py | balazsdukai/tin2stardb | efb160ba744f757c4a6d4674c7abec8bf0694415 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Various utility functions for handling geometry etc."""
import math
from statistics import mean
from typing import Tuple, Union, Iterable, Generator, Mapping
import logging
MODULE_MATPLOTLIB_AVAILABLE = True
try:
import matplotlib.pyplot as plt
import matplotlib.lines as lines
except ImportError as e:
MODULE_MATPLOTLIB_AVAILABLE = False
log = logging.getLogger(__name__)
def __ccw__(vertices, star, link):
"""Sort the link in CounterClockWise order around the star"""
x, y, z = 0, 1, 2
localized = [(vertices[v][x] - vertices[star][x],
vertices[v][y] - vertices[star][y]) for v in link]
rev_lookup = {localized[i]: a for i, a in enumerate(link)}
return rev_lookup, sorted(localized, key=lambda p: math.atan2(p[1], p[0]))
def distance(a,b) -> float:
"""Distance between point a and point b"""
x,y = 0,1
return math.sqrt((a[x] - b[x])**2 + (a[y] - b[y])**2)
def orientation(a: Tuple[float, float], b: Tuple[float, float],
c: Tuple[float, float]):
"""
Determine if point (p) is LEFT, RIGHT, COLLINEAR with line segment (ab).
:param a: Point 1
:param b: Point 2
:param c: Point which orientation to is determined with respect to (a,b)
:return: 1 if (a,b,p) is CCW, 0 if p is collinear, -1 if (a,b,p) is CW
>>> orientation((0.0, 0.0), (1.0, 0.0), (2.0, 0.0))
0
>>> orientation((0.0, 0.0), (1.0, 0.0), (0.5, 0.0))
0
>>> orientation((0.0, 0.0), (1.0, 0.0), (0.5, 1.0))
1
>>> orientation((0.0, 0.0), (1.0, 0.0), (0.5, -1.0))
-1
"""
x,y = 0,1
re = ((a[x] - c[x]) * (b[y] - c[y])) - ((a[y] - c[y]) * (b[x] - c[x]))
if re > 0:
return 1
elif re == 0:
return 0
else:
return -1
def is_between(a,c,b) -> bool:
"""Return True if point c is on the segment ab
Ref.: https://stackoverflow.com/a/328193
"""
return math.isclose(distance(a,c) + distance(c,b), distance(a,b))
def in_bbox(tri: Tuple, bbox: Tuple) -> bool:
"""Evaluates if a triangle is in the provided bounding box.
A triangle is in the BBOX if it's centorid is either completely within
the BBOX, or overlaps with the South (lower) or West (left) boundaries
of the BBOX.
:param tri: A triangle defined as a tuple of three cooridnates of (x,y,z)
:param bbox: Bounding Box as (minx, miny, maxx, maxy)
"""
if not bbox or not tri:
return False
x,y,z = 0,1,2
minx, miny, maxx, maxy = bbox
# mean x,y,z coordinate of the triangle
centroid = (mean(v[x] for v in tri),
mean(v[y] for v in tri))
within = ((minx < centroid[x] < maxx) and
(miny < centroid[y] < maxy))
on_south_bdry = is_between((minx, miny), centroid, (maxx, miny))
on_west_bdry = is_between((minx, miny), centroid, (minx, maxy))
return any((within, on_south_bdry, on_west_bdry))
def bbox(polygon) -> Tuple[float, float, float, float]:
"""Compute the Bounding Box of a polygon.
:param polygon: List of coordinate pairs (x,y)
"""
x,y = 0,1
vtx = polygon[0]
minx, miny, maxx, maxy = vtx[x], vtx[y], vtx[x], vtx[y]
for vtx in polygon[1:]:
if vtx[x] < minx:
minx = vtx[x]
elif vtx[y] < miny:
miny = vtx[y]
elif vtx[x] > maxx:
maxx = vtx[x]
elif vtx[y] > maxy:
maxy = vtx[y]
return minx, miny, maxx, maxy
def get_polygon(feature):
"""Get the polygon boundaries from a GeoJSON feature."""
if not feature['geometry']['type'] == 'Polygon':
log.warning(f"Feature ID {feature['properties']['id']} is not a Polygon")
else:
return feature['geometry']['coordinates'][0]
def find_side(polygon: Iterable[Tuple[float, ...]],
neighbor: Iterable[Tuple[float, ...]],
abs_tol: float = 0.0) ->\
Union[Tuple[None, None],
Tuple[str, Tuple[Tuple[float, float], Tuple[float, float]]]]:
"""Determines on which side does the neighbor polygon is located.
.. warning::
Assumes touching BBOXes of equal dimensions.
:param polygon: The base polygon. A list of coordinate tuples.
:param neighbor: The neighbor polygon.
:param abs_tol: Absolute coordinate tolerance. Passed on to `:math.isclose`
:returns: One of ['E', 'N', 'W', 'S'], the touching line segment
"""
minx, miny, maxx, maxy = 0,1,2,3
bbox_base = bbox(polygon)
bbox_nbr = bbox(neighbor)
if math.isclose(bbox_nbr[minx], bbox_base[maxx], abs_tol=abs_tol) \
and math.isclose(bbox_nbr[miny], bbox_base[miny], abs_tol=abs_tol):
return 'E', ((bbox_base[maxx], bbox_base[miny]), (bbox_base[maxx], bbox_base[maxy]))
elif math.isclose(bbox_nbr[minx], bbox_base[minx], abs_tol=abs_tol) \
and math.isclose(bbox_nbr[miny], bbox_base[maxy], abs_tol=abs_tol):
return 'N', ((bbox_base[maxx], bbox_base[maxy]), (bbox_base[minx], bbox_base[maxy]))
elif math.isclose(bbox_nbr[maxx], bbox_base[minx], abs_tol=abs_tol) \
and math.isclose(bbox_nbr[maxy], bbox_base[maxy], abs_tol=abs_tol):
return 'W', ((bbox_base[minx], bbox_base[maxy]), (bbox_base[minx], bbox_base[miny]), )
elif math.isclose(bbox_nbr[maxx], bbox_base[maxx], abs_tol=abs_tol) \
and math.isclose(bbox_nbr[maxy], bbox_base[miny], abs_tol=abs_tol):
return 'S', ((bbox_base[minx], bbox_base[miny]), (bbox_base[maxx], bbox_base[miny]), )
else:
return None,None
def plot_star(vid, stars, vertices):
"""Plots the location of a vertex and its incident vertices in its link.
:Example: plot_star(1, stars, vertices)
:param vid: Vertex ID
:param stars: List with the Link of the vertex
:param vertices: List with vertex coordinates (used as lookup)
:return: Plots a plot on screen
"""
if not MODULE_MATPLOTLIB_AVAILABLE:
raise ModuleNotFoundError("matplotlib is not installed, cannot plot")
plt.clf()
pts = [vertices[vid]] + [vertices[v] for v in stars[vid]]
r = list(zip(*pts))
plt.scatter(*r[0:2])
labels = [vid] + stars[vid]
# zip joins x and y coordinates in pairs
for i, e in enumerate(labels):
if e == vid:
plt.annotate(e, # this is the text
(pts[i][0], pts[i][1]), # this is the point to label
textcoords="offset points", # how to position the text
xytext=(0, 10), # distance from text to points (x,y)
ha='center',
# horizontal alignment can be left, right or center
color='red')
else:
plt.annotate(e, # this is the text
(pts[i][0], pts[i][1]),
textcoords="offset points",
xytext=(0, 10),
ha='center')
plt.show()
def mean_coordinate(points: Iterable[Tuple]) -> Tuple[float, float]:
"""Compute the mean x- and y-coordinate from a list of points.
:param points: An iterable of coordinate tuples where the first two elements
of the tuple are the x- and y-coordinate respectively.
:returns: A tuple of (mean x, mean y) coordinates
"""
mean_x = mean(pt[0] for pt in points)
mean_y = mean(pt[1] for pt in points)
return mean_x, mean_y
# Computing Morton-code. Reference: https://github.com/trevorprater/pymorton ---
def __part1by1_64(n):
"""64-bit mask"""
n &= 0x00000000ffffffff # binary: 11111111111111111111111111111111, len: 32
n = (n | (n << 16)) & 0x0000FFFF0000FFFF # binary: 1111111111111111000000001111111111111111, len: 40
n = (n | (n << 8)) & 0x00FF00FF00FF00FF # binary: 11111111000000001111111100000000111111110000000011111111, len: 56
n = (n | (n << 4)) & 0x0F0F0F0F0F0F0F0F # binary: 111100001111000011110000111100001111000011110000111100001111, len: 60
n = (n | (n << 2)) & 0x3333333333333333 # binary: 11001100110011001100110011001100110011001100110011001100110011, len: 62
n = (n | (n << 1)) & 0x5555555555555555 # binary: 101010101010101010101010101010101010101010101010101010101010101, len: 63
return n
def interleave(*args):
"""Interleave two integers"""
if len(args) != 2:
raise ValueError('Usage: interleave2(x, y)')
for arg in args:
if not isinstance(arg, int):
print('Usage: interleave2(x, y)')
raise ValueError("Supplied arguments contain a non-integer!")
return __part1by1_64(args[0]) | (__part1by1_64(args[1]) << 1)
def morton_code(x: float, y: float):
"""Takes an (x,y) coordinate tuple and computes their Morton-key.
Casts float to integers by multiplying them with 100 (millimeter precision).
"""
return interleave(int(x * 100), int(y * 100))
def rev_morton_code(morton_key: int) -> Tuple[float, float]:
"""Get the coordinates from a Morton-key"""
x,y = deinterleave(morton_key)
return float(x)/100.0, float(y)/100.0
# Compute tile range -----------------------------------------------------------
def tilesize(tin_paths) -> Tuple[float, float]:
"""Compute the tile size from Morton-codes for the input TINs.
.. note:: Assumes regular grid.
:returns: The x- and y-dimensions of a tile
"""
centroids = []
for i, morton_code in enumerate(tin_paths):
if i == 2:
break
else:
centroids.append(rev_morton_code(morton_code))
return abs(centroids[0][0] - centroids[1][0]), abs(centroids[0][1] - centroids[1][1])
def __in_bbox__(point, range):
"""Check if a point is within a BBOX."""
| 38.444767 | 127 | 0.607108 |
96b5abda600a3ff8286fd10ad76e69e6c1844b69 | 7,748 | py | Python | tfworker/cli.py | objectrocket/terraform-worker | 5a3c81a465d31bf7c9186fa59be2bfa8f4578449 | [
"Apache-2.0"
] | 6 | 2020-02-10T21:53:18.000Z | 2021-07-21T18:10:02.000Z | tfworker/cli.py | RSS-Engineering/terraform-worker | 98b04eacd828448985bc9ded3a46497f06d7c6ae | [
"Apache-2.0"
] | 4 | 2020-09-20T13:04:26.000Z | 2021-03-23T21:20:57.000Z | tfworker/cli.py | RSS-Engineering/terraform-worker | 98b04eacd828448985bc9ded3a46497f06d7c6ae | [
"Apache-2.0"
] | 3 | 2020-06-12T18:38:33.000Z | 2020-09-15T21:01:53.000Z | #!/usr/bin/env python
# Copyright 2020 Richard Maynard (richard.maynard@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import struct
import sys
import click
from tfworker import constants as const
from tfworker.commands import CleanCommand, RootCommand, TerraformCommand
from tfworker.commands.root import get_platform
from tfworker.commands.version import VersionCommand
def validate_deployment(ctx, deployment, name):
"""Validate the deployment is no more than 16 characters."""
if len(name) > 16:
click.secho("deployment must be less than 16 characters", fg="red")
raise SystemExit(2)
return name
def validate_host():
"""Ensure that the script is being run on a supported platform."""
supported_opsys = ["darwin", "linux"]
supported_machine = ["amd64"]
opsys, machine = get_platform()
if opsys not in supported_opsys:
click.secho(
f"this application is currently not known to support {opsys}",
fg="red",
)
raise SystemExit(2)
if machine not in supported_machine:
click.secho(
f"this application is currently not known to support running on {machine} machines",
fg="red",
)
if struct.calcsize("P") * 8 != 64:
click.secho(
"this application can only be run on 64 bit hosts, in 64 bit mode", fg="red"
)
raise SystemExit(2)
return True
if __name__ == "__main__":
cli()
| 28.277372 | 126 | 0.672303 |
96b74e78276fe832497e5e00ed9a762980bd1fbc | 3,777 | py | Python | shs/input/dialogs/ac_init.py | ansobolev/shs | 7a5f61bd66fe1e8ae047a4d3400b055175a53f4e | [
"MIT"
] | 1 | 2016-06-22T13:30:25.000Z | 2016-06-22T13:30:25.000Z | shs/input/dialogs/ac_init.py | ansobolev/shs | 7a5f61bd66fe1e8ae047a4d3400b055175a53f4e | [
"MIT"
] | 1 | 2017-12-01T04:49:45.000Z | 2017-12-01T04:49:45.000Z | shs/input/dialogs/ac_init.py | ansobolev/shs | 7a5f61bd66fe1e8ae047a4d3400b055175a53f4e | [
"MIT"
] | null | null | null | import wx
from wx.lib.agw.floatspin import FloatSpin
from shs.input.fdf_options import ChoiceLine, MeasuredLine, NumberLine, ThreeNumberLine
try:
from geom import Geom
except ImportError:
from shs.geom import Geom
| 32.282051 | 112 | 0.605507 |
96b8879f01bcc6f2a6fb4f8f1c990b4167027165 | 5,377 | py | Python | mgs/v1.0/data_server.py | vt-rocksat-2017/dashboard | e99a71edc74dd8b7f3eec023c381524561a7b6e4 | [
"MIT"
] | 1 | 2017-08-09T19:57:38.000Z | 2017-08-09T19:57:38.000Z | mgs/v1.0/data_server.py | vt-rocksat-2017/dashboard | e99a71edc74dd8b7f3eec023c381524561a7b6e4 | [
"MIT"
] | null | null | null | mgs/v1.0/data_server.py | vt-rocksat-2017/dashboard | e99a71edc74dd8b7f3eec023c381524561a7b6e4 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#########################################
# Title: Rocksat Data Server Class #
# Project: Rocksat #
# Version: 1.0 #
# Date: August, 2017 #
# Author: Zach Leffke, KJ4QLP #
# Comment: Initial Version #
#########################################
import socket
import threading
import sys
import os
import errno
import time
import binascii
import numpy
import datetime as dt
from logger import *
| 38.407143 | 109 | 0.565929 |
96b888fef4eb174221ced8eecdc0b4280bce51d8 | 3,932 | py | Python | handledata.py | bioPunkKitchen/climate.local | ccd29da3d84542d5f9c73a5d75bc3ceefeef1f08 | [
"MIT"
] | 1 | 2019-05-28T18:33:49.000Z | 2019-05-28T18:33:49.000Z | handledata.py | bioPunkKitchen/climate.local | ccd29da3d84542d5f9c73a5d75bc3ceefeef1f08 | [
"MIT"
] | 1 | 2019-12-30T14:52:02.000Z | 2020-01-04T11:41:08.000Z | handledata.py | bioPunkKitchen/climate.local | ccd29da3d84542d5f9c73a5d75bc3ceefeef1f08 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import datetime
import time
import os
import matplotlib.pyplot as plt
import matplotlib.dates as md
import numpy as np
# Test:
if __name__ == '__main__':
hd = handle_data()
#hd.clean_file()
hd.update_graph('./static/data_log.png')
| 30.015267 | 252 | 0.625127 |
96b9956367c551043c19348764e4606177dd4559 | 555 | py | Python | day01/python/beckel/solution.py | clssn/aoc-2019 | a978e5235855be937e60a1e7f88d1ef9b541be15 | [
"MIT"
] | 22 | 2019-11-27T08:28:46.000Z | 2021-04-27T05:37:08.000Z | day01/python/wiedmann/solution.py | sancho1241/aoc-2019 | e0f63824c8250e0f84a42805e1a7ff7d9232002c | [
"MIT"
] | 77 | 2019-11-16T17:22:42.000Z | 2021-05-10T20:36:36.000Z | day01/python/wiedmann/solution.py | sancho1241/aoc-2019 | e0f63824c8250e0f84a42805e1a7ff7d9232002c | [
"MIT"
] | 43 | 2019-11-27T06:36:51.000Z | 2021-11-03T20:56:48.000Z | import math
total_fuel = 0
total_fuel_recursive = 0
with open("input.txt", "r") as fp:
for line in fp:
total_fuel += fuel_needed(line)
total_fuel_recursive += fuel_needed_recursive(line)
print("Total fuel: " + str(total_fuel))
print("Total fuel recursive: " + str(total_fuel_recursive))
| 25.227273 | 63 | 0.704505 |
96b9a2d50c1e158d5bd73be619a6523cec7b4cfa | 45,634 | py | Python | arraytool_rc.py | zinka/arraytool_gui | c1ba763e170f7efde99414a29946410c4994e924 | [
"BSD-3-Clause"
] | 11 | 2017-04-20T20:08:04.000Z | 2022-03-29T22:30:24.000Z | arraytool_rc.py | zinka/arraytool_gui | c1ba763e170f7efde99414a29946410c4994e924 | [
"BSD-3-Clause"
] | null | null | null | arraytool_rc.py | zinka/arraytool_gui | c1ba763e170f7efde99414a29946410c4994e924 | [
"BSD-3-Clause"
] | 7 | 2018-01-28T12:59:45.000Z | 2022-03-19T12:34:25.000Z | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore
qt_resource_data = "\
\x00\x00\x03\x97\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\x0d\xd7\
\x01\x42\x28\x9b\x78\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x03\x14\x49\x44\
\x41\x54\x38\x8d\x9d\x95\x4f\x68\x1c\x55\x1c\xc7\x3f\x6f\x66\x76\
\x36\x59\xdb\x22\x68\x0e\x36\x20\x45\x89\x50\x04\x0f\x1e\xa4\xb5\
\x88\x7f\xd0\x3d\x88\x47\x11\x64\x4c\x73\xf2\x56\xcf\x1e\xbd\x8a\
\x78\xea\x45\xeb\x41\x44\xcc\xa9\x67\xc1\x28\x88\x42\x6a\x6d\x83\
\xff\xb0\x17\xcd\xa1\x96\x6c\x43\x9a\xad\x49\x37\xdd\x9d\x9d\x79\
\xf3\x7b\xbf\x9f\x87\xdd\x6e\x77\xd3\xa8\x49\xbf\xf0\x98\xf9\x31\
\xcc\xe7\x7d\xdf\xf7\xfd\xe6\x8d\xcb\xb2\x8c\xff\x52\x15\xca\xc2\
\x39\x17\x9b\x99\x73\xce\x01\x70\xe7\x26\xad\xa5\x7f\xf4\xf3\xf2\
\xf9\x34\x4d\xdb\xbb\xdf\x4b\x00\xbc\xf7\xf1\xec\xec\xec\xe1\xbd\
\xc0\xeb\x1b\xad\xfa\x67\x9f\x7e\x8e\x73\x6e\x62\x00\x2c\x2e\x7e\
\x71\x7c\xe9\x9b\xa5\x15\xe0\x29\x60\xe7\x1e\xf0\xdc\xdc\xdc\xef\
\xce\xb9\xc7\x01\xdb\x0d\x36\x33\xd6\xd6\xd6\x28\xcb\x72\x54\x87\
\x10\x50\x55\x4e\x9f\x5e\xa0\xd3\xe9\x3c\xba\xf2\xd3\xca\x85\xb2\
\xef\x9f\x49\xd3\xb4\x3f\x01\x16\x91\xe3\xf3\xf3\xf3\x84\x10\x30\
\x33\x54\x15\x00\x55\xe5\x83\x0f\xdf\x27\x8a\x22\x2e\x5d\xbe\x34\
\x31\xe1\xc9\x13\x27\x00\x38\x73\xe6\x1d\x77\xee\x93\x8f\x9f\x5c\
\xbe\xb0\x7c\x16\xe3\xed\xdd\x60\x13\x11\xd7\x6a\xb5\x10\x11\x54\
\x15\x55\xc5\xcc\x70\xce\x91\xa6\x29\xcd\x57\x9a\x98\xd9\xc8\x35\
\x40\xbb\xdd\x46\x44\x78\xf6\xe4\x29\x77\xf1\xc7\x1f\xde\x50\xd9\
\x05\x0e\x21\x98\xaa\x3a\x11\x19\x2d\xf3\xce\x00\x48\x92\x84\xa5\
\xaf\xbf\x22\x84\x30\x72\xfc\xe2\x0b\x2f\xe1\xbd\x1f\x14\x0e\x54\
\x35\x82\x68\x32\x63\x91\xca\x44\x2a\x42\x08\xf8\xea\x2e\x58\x44\
\xc0\xc5\xe0\x62\x9a\xcd\x57\x27\xdc\x8e\x5f\x93\xa4\x8e\x59\xa4\
\xeb\xb5\x97\xa7\xbe\x3b\x76\xcd\x67\xab\xab\xea\xb2\x2c\xa3\xd1\
\x68\xc8\xc2\xc2\x42\x7c\xf1\x4a\x8b\xf3\xbf\x08\x51\x74\x77\x66\
\x33\x23\x72\x63\xf5\xae\xfd\x1d\xf2\x87\xab\x73\xc1\x39\xd7\xbe\
\x7c\xee\xcd\xa3\xa3\x8c\x43\x08\x6c\xde\x56\x9e\x7b\xfa\x18\xaf\
\x9d\x7a\x62\xf4\x02\xc0\xb0\xbb\xf6\xd4\xf8\xa3\xdc\x4b\xfc\xde\
\x47\xdf\xce\x64\xd9\x5b\x36\xca\x58\x44\xc8\x4b\x63\x66\xba\xce\
\x66\xa7\xe0\xfa\x56\xff\x5f\x50\x7b\x6b\xaa\x16\xf3\xf0\xe1\x1a\
\x51\x1c\x75\x61\xb2\x2b\xe8\x55\xf0\xd8\x03\x75\x30\x48\xc6\xe2\
\xd8\x8f\xd4\xa0\xf4\x81\xc8\x45\x9d\x11\xb8\xaa\x06\x9b\x97\x57\
\x8e\x23\x8d\x3a\x66\x90\xc4\xfb\x07\xf7\x0a\x61\x3a\x8d\xf1\x5e\
\x70\x11\xdb\x23\xf0\x20\x8a\x40\xee\xe1\x50\xa3\x06\x40\xb2\x0f\
\x6e\x50\x23\x2f\x03\x12\x94\xe9\xb4\x46\xd1\xf7\x00\x37\xc7\x1d\
\x13\x42\xa0\xa8\x00\x1c\x5e\xf4\x1e\x80\x1a\xc3\xaf\x72\x50\x7b\
\x51\xd4\x26\x3b\xa4\xd3\x2b\x31\xb5\x1b\xe3\x8e\x55\x44\xe8\x7b\
\xc3\x07\xa3\x5b\x04\x7a\xa5\xe0\x45\xf7\x04\xec\x19\x47\x19\xb3\
\x79\x2b\x47\x54\xd7\x27\x1c\x57\x22\xf8\x60\x6c\x77\x2b\x5a\x5b\
\x7d\x82\xfe\x3f\x6c\x5c\x3b\xb5\x88\xad\x4e\x51\x59\xd0\xcd\x11\
\x18\xd0\xbc\x0c\xd4\x6b\x31\xb7\xfa\x82\x1c\x10\x0a\x50\x56\xc6\
\x76\xb7\xf4\x38\xf7\xf7\x38\x98\x6e\xa1\x3c\xf2\xd0\x11\x1e\x6c\
\x24\x1c\x9a\x3a\x58\xab\x01\x44\xce\xd1\xeb\x95\x62\x6a\x5b\x00\
\xc9\xe2\xe2\x62\xd2\x6c\x36\xed\xcf\x8d\x92\x9b\x9d\x82\xef\x7f\
\xbe\x7a\x60\x28\x40\x30\xa5\xdb\xcb\x53\xe9\x6d\x5f\x23\x1e\x38\
\xae\xe7\x79\xfe\xe5\xaf\xab\xed\xd7\xab\x46\x3d\xb9\xdd\x2b\xee\
\x03\xeb\xcc\xcc\xa4\xdc\xd9\x58\xbe\x72\xfe\xdd\xab\xbf\x0d\x4f\
\x81\x1a\x70\x14\x98\x61\x2c\x9a\xfb\x90\x32\xf8\x3d\xfd\x95\x65\
\x59\x91\x00\x02\x5c\x07\x6e\x30\x79\xa6\x1c\x54\x36\x84\x57\x00\
\xff\x00\xf1\x00\xf2\xbe\xa6\x77\x61\xc0\x00\x00\x00\x00\x49\x45\
\x4e\x44\xae\x42\x60\x82\
\x00\x00\x04\x3c\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\x0d\xd7\
\x01\x42\x28\x9b\x78\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x03\xb9\x49\x44\
\x41\x54\x38\x8d\x8d\x95\xcf\x6b\x1d\x55\x14\xc7\x3f\xf7\xde\x99\
\x3b\xf3\x7e\x98\xa6\x79\x4d\x8a\x3e\x42\x63\x4c\x84\xb6\x21\xa5\
\x92\x55\x0b\xba\x68\x8c\xb8\x0b\xb4\x22\x2d\x6a\x31\x58\xc1\x8d\
\x74\xd9\x14\x04\x37\x21\x42\x71\x53\xf5\x1f\xa8\x88\x88\x5d\xb9\
\x10\x5c\x25\x8b\x4a\xba\x68\x5a\x5c\x34\xd0\x52\x5e\xc1\x1a\xac\
\xf0\x12\x5f\x26\xef\xe7\x9d\x1f\xd7\xc5\xfb\xe1\x7b\xc9\x0b\x7a\
\xe0\x30\xc3\xcc\xe1\x33\xdf\x7b\xe6\xfc\x10\xd6\x5a\xfe\x87\x09\
\x40\x02\x4e\xeb\x0a\x60\x81\x08\x88\x5b\xf7\x3d\xe6\x00\xbc\xf7\
\xc1\xa5\x25\x63\xcc\xf5\x83\xa8\x4a\x29\xd2\xe9\x34\x03\x03\x87\
\xf0\x3d\x0f\x80\x30\x0a\x71\x5d\x7d\x73\x79\xe9\x8b\x6b\x40\x7d\
\x2f\xdc\x01\x30\xc6\x5c\x7f\xe7\xfc\xbb\x14\x0a\x05\xaa\xd5\x2a\
\xb5\x5a\x8d\x5a\xad\x86\x31\x06\x63\x0c\x52\x4a\xa6\xa7\xa6\xb9\
\x72\xe5\x23\xa4\x6c\x0a\xae\xd7\x6b\x7c\xf5\xcd\xd7\x9f\x02\x4b\
\x80\x69\x29\xef\x05\x03\x78\x9e\x87\xd6\x9a\x30\x0c\x89\xa2\x88\
\x38\x8e\x49\x92\x04\x00\xad\x35\x43\x43\x43\x28\xa5\x50\x4a\x01\
\x90\x4e\x67\x18\x19\x1e\x06\x48\x03\xdb\x7d\x53\x01\xe0\xfb\x3e\
\x5a\x6b\xa2\x28\x22\x49\x12\xda\xb9\x37\xc6\xe0\x79\x1e\x99\x4c\
\x06\x21\x24\x42\x34\x15\x0b\x01\x5a\x7b\x3d\x8c\xbe\x60\xad\x35\
\xbe\xef\xf7\x40\x85\x10\x48\x29\xd1\x5a\xe3\xb5\x72\xdb\x6d\xad\
\xb4\x88\x7e\x60\xd9\x1d\xe4\x38\x0e\x9e\xe7\xe1\xfb\x3e\xbe\xef\
\xe3\x79\x5e\xc7\xb5\xd6\x88\xbe\x08\xf8\x21\x9b\x7d\xe3\x7b\x21\
\x6e\xf5\x55\x2c\xa5\xec\xb8\x52\x0a\xc7\x71\x98\x98\x98\x20\x8e\
\x63\x8a\xc5\x22\xae\xeb\xf6\x85\xfe\x3c\x3d\x7d\xf1\xf0\xd4\xd4\
\xf5\xe0\xd1\x23\xf5\x9d\x10\x1f\xb7\x1e\x47\x1d\xc5\xed\x63\x77\
\xfb\xe6\xe6\x26\xbe\xef\x33\x39\x39\xd9\xf9\x69\x6d\xb3\x49\x82\
\x73\xeb\x5b\xb2\xf9\xfc\xe2\x6b\x57\xaf\x7a\x4a\xa9\x48\x2a\x55\
\x96\x8e\x53\x16\x50\xec\x49\xfc\x5e\xb0\xb5\x96\x42\xa1\xc0\xa9\
\x53\xa7\x30\xc6\x74\xe2\xc2\x20\xe0\xce\xfc\x3c\xe3\xc3\xc3\x8c\
\x9f\x3d\xeb\xdb\x52\x89\xd7\x6f\xdc\xf0\xdb\xef\x7f\x59\x58\xf0\
\x7b\xc0\x7b\x55\x67\x32\x19\x66\x66\x66\xb8\x7b\xf7\x2e\xc7\x8f\
\x1f\x07\xa0\xf2\xf4\x29\xab\x73\x73\x8c\xce\xcc\x30\x3c\x3a\xca\
\xee\xca\x0a\x58\x8b\x50\x0a\x9b\x24\x0c\xcc\xce\x22\xa4\x64\x9f\
\x62\x21\x44\xe7\x03\x27\x4e\x9c\xe0\xd9\xb3\x67\x94\x4a\x25\x52\
\xa9\x14\x00\xbf\x5e\xb8\xc0\x91\x91\x11\x06\x7d\x9f\xdd\xd5\x55\
\x6c\x14\x91\x54\x2a\x24\x95\x0a\x32\x95\x22\x75\xf2\x24\x08\xc1\
\x81\x8a\xf3\xf9\x3c\xd5\x6a\x95\x87\x0f\x1f\x92\xcd\x66\x71\x9c\
\x66\xe8\xe9\x9b\x37\xb9\x33\x3f\x8f\x63\x0c\x2f\x00\xf5\x8d\x0d\
\x6c\xab\x91\x00\x1a\x4f\x9e\x60\xe3\x78\x7f\x71\xb7\xc1\x5b\x5b\
\x5b\xec\xec\xec\x90\x4e\xa7\xd1\x5a\x03\x90\x24\x09\x47\xce\x9c\
\xe1\xcd\xb5\x35\x56\xce\x9d\xe3\x70\x36\xc3\xd1\xd3\xa7\x91\x03\
\x03\xcd\x8e\x51\x8a\xb8\x5a\x05\xfa\x74\x4d\x1b\x1c\x86\x61\xa7\
\xc4\xa4\x94\x14\x0a\x05\xa4\x94\x8c\x8d\x8d\x91\x7b\x65\x9c\xd9\
\x7b\xf7\xf8\xe9\xec\x19\xea\x9b\x9b\xf5\x51\xc7\xf1\x7f\x5b\x5b\
\x33\xf6\xdf\xbe\xf8\x5b\x1e\x04\xee\xae\x67\xc7\x71\x28\x95\x4a\
\xec\x04\x3b\x54\x2a\x65\xe2\x38\x46\x0d\x1e\xa2\xb1\x78\x8d\x72\
\xad\xb6\xf2\x78\x63\xa3\x66\x21\xb9\x64\xad\xdb\xf2\x17\xf7\x81\
\xdb\x70\xa5\x14\x5a\x6b\x8a\xc5\x22\xeb\xf7\xd7\xd1\x9e\x26\xff\
\x52\x9e\x5c\x2e\x47\x14\x45\x18\x63\xa8\x9a\x06\xe7\xb7\xb7\x3f\
\xa9\x95\xcb\x5f\x0a\x78\xdc\xcd\xe8\x3b\x40\xb4\xd6\x04\x41\xc0\
\xfa\xfa\x3d\x5e\x1e\x1f\xe3\xf2\xe5\xf7\x39\x76\x6c\xac\x39\xfd\
\xa2\x90\x30\x0a\x89\xe3\x98\x60\x77\x17\xa0\x71\x31\x8a\x3e\x07\
\x3e\xeb\x0b\xb6\xd6\xa2\x94\xc2\x5a\xcb\x83\x07\xf7\x39\x34\x38\
\xc0\x87\x0b\x97\xc9\xe5\x72\xb8\xae\x4b\x1c\x87\xd4\xea\x11\x02\
\xb0\x16\x92\x24\x26\x08\x02\x80\x06\x07\x6d\x90\x38\x8e\x91\x52\
\xf2\xfc\xaf\xe7\x08\x2c\x6f\xbd\x3d\x47\x2a\xe5\xe3\xba\x6e\x73\
\xd8\x87\x61\xcf\x08\xb3\x34\x5b\xfa\x3f\xc1\xc1\x4e\xc0\x1f\x7f\
\xfe\xce\xc4\xab\xcd\xe3\x22\x2c\x8d\x46\x9d\x86\x69\x34\x81\x1d\
\xaa\xe8\x30\x92\xc4\x52\xa9\x94\xa1\xb9\x3d\xfa\x83\x47\x8e\x8e\
\x2c\xdf\xfe\xf1\xf6\x62\x77\xe7\x89\x83\x66\x64\x57\xea\xb4\xd6\
\xcb\xec\x59\x49\x6d\xfb\x07\xe7\xa5\x7a\x91\x9a\x1b\x94\x49\x00\
\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x02\xb4\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xfc\x00\xe9\x00\x4f\x34\xd7\
\xb1\x0d\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\
\x0d\xd7\x01\x42\x28\x9b\x78\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
\xd5\x02\x12\x0e\x25\x30\xca\x43\x26\x09\x00\x00\x02\x41\x49\x44\
\x41\x54\x38\xcb\xad\x95\xcd\x6b\x13\x61\x10\x87\x9f\x99\xdd\x54\
\x9a\xe2\x07\x4d\x9b\x35\x08\x9e\x3c\x88\x78\x12\xc4\x56\xf0\x1f\
\xf0\xd2\x83\x27\x6f\xe2\xd5\xb3\x08\x62\x2f\xa2\xe2\xc7\x3f\xe1\
\xc1\x8b\x78\x90\xdc\x45\x11\x04\x35\xa5\x17\x0b\x7a\xb2\xb9\xd4\
\x90\x18\x28\x22\x31\xa6\xd9\x64\xc7\xc3\x7e\x66\x53\xed\x6a\x7d\
\x21\x64\x77\xd8\xf7\x79\x67\x7e\xbf\x99\x5d\x61\x9f\x6b\xd4\x59\
\x11\xa0\x04\xf8\xae\x57\xb7\x38\x2e\xf1\xc5\xfd\x87\x77\x6f\x03\
\xab\x7f\x03\x55\x09\xa8\x1c\x19\x50\x5b\xec\xe1\xa8\xb1\x33\xd4\
\xc7\x17\x2f\x34\xaf\xb9\x5e\xbd\xef\x66\x9e\x5b\xbd\x71\xfd\x66\
\x61\xa8\x99\x0f\xfe\x47\x82\xfe\x4b\x7c\xab\x60\x94\xd9\xfe\xfa\
\xe9\x8a\xe1\xbc\x1a\x75\x56\x9e\xba\xf9\x0d\xcd\x66\x13\xc7\x71\
\x30\x33\x44\x04\x91\xb0\xa8\xec\x35\x18\x25\x69\x51\xd6\x17\x38\
\xa5\x59\x6c\xe6\x12\xe2\xcc\x73\x68\xe1\x35\x16\x3c\xbb\x2c\xf6\
\x6d\x5d\xf3\xe0\x18\x10\x43\xcc\x0c\xcc\x30\x33\x2c\x30\xcc\x00\
\xc6\xa8\xf4\x10\xd9\xc1\x64\x01\x74\x1e\x50\xe0\x00\x30\x2e\x03\
\x87\xf7\x04\x23\x40\x1c\x53\x41\x15\x44\x1c\x02\x39\x48\xc0\x22\
\x32\xda\x04\xff\x0d\x04\x1d\x86\x83\x06\x62\x3f\x36\x80\xed\xdf\
\x82\x55\x35\xfc\x17\x41\x44\xd3\xc3\x44\x51\x71\x08\x38\xca\x80\
\x65\x86\x76\x02\x86\x6b\xb8\xfe\x73\x36\x3f\x6f\x21\x04\x4f\x80\
\x96\xbb\x1b\x58\x55\x53\x8d\x11\x90\xac\xc6\x02\x2a\x08\x33\x98\
\x1c\xc3\xa7\xc2\x98\x53\xcc\xce\x95\x68\x6c\x7c\xe7\xcc\xc9\xd6\
\x07\xe0\xe7\x54\xc6\x6b\xeb\x8d\x49\xb3\x32\xd9\x27\x3f\xe2\x2a\
\x1c\x4c\xe7\x30\xe7\x38\x32\x73\x9a\x5e\xbf\x84\xeb\xd5\xfb\xae\
\x57\xb7\x29\xf0\xb9\xb3\x4b\xd4\x6a\xb5\x9c\xa6\xa4\x72\xa8\x44\
\xf7\x51\x75\xa2\x61\x55\x93\x63\xc1\xae\x52\xb4\xdb\xed\x70\x93\
\x69\x28\x43\x52\x3e\x49\x15\x91\xa7\x44\x0f\x4c\x2d\xf7\x4f\x5d\
\x61\x62\x49\x76\xf9\x5e\x4e\x0e\x10\x41\x29\x00\x4e\x36\x01\x1a\
\x99\x15\x6a\x0a\xa2\xd1\x7d\x1c\x8f\x92\x0d\xe3\xb9\x71\xcf\x07\
\xde\xbd\x7f\x3b\x95\x91\x48\x28\x45\x0c\xcd\x6a\x2c\xb1\x09\x7b\
\x81\x97\x97\xce\x53\xad\x56\xd3\x1e\xd6\xc8\x44\x34\x32\x4e\x10\
\x14\xd5\x6c\x97\x68\x31\x8d\xbb\xdd\xee\x44\xbb\x31\xf1\x9e\x90\
\xe4\x80\x6c\x65\x85\x34\x4e\x4f\xd1\x8c\x79\x11\x90\x78\xc4\x49\
\xf4\x2f\x0c\x4e\xb2\xd1\xd4\xb8\x88\x17\x5b\x99\x4e\xa3\x49\xa6\
\x8f\x0b\x66\x9c\xb8\x1e\x8f\x36\x93\xc6\x85\x55\x50\x2c\x63\xcf\
\xf3\xf8\x1f\x2b\x01\x07\x41\x70\xe7\xc1\xa3\x7b\xb7\xf6\x03\xfb\
\xb2\xd5\xba\x3a\xf5\xcd\xcb\xab\xf0\x8f\xec\xe4\x63\xfa\x0b\x23\
\xfb\x93\xa3\x4d\x98\xb6\xe0\x00\x00\x00\x00\x49\x45\x4e\x44\xae\
\x42\x60\x82\
\x00\x00\x04\x7e\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\
\x0d\xd7\x01\x42\x28\x9b\x78\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
\xd5\x0b\x0a\x0d\x34\x15\x48\x65\x72\x06\x00\x00\x04\x0b\x49\x44\
\x41\x54\x38\xcb\xad\x95\x5d\x6c\x14\x55\x14\xc7\x7f\x33\xfb\x39\
\x9d\x6d\xbb\xd3\x65\x97\xdd\xd6\x65\x59\x3e\x96\x22\x05\xda\x92\
\x56\x8b\x1f\x58\x13\x1f\x30\x42\x34\x46\x7c\xd0\x17\xd3\xf8\x00\
\x35\x48\x55\x52\x03\xfa\x20\x46\x02\x18\x8b\x69\x6c\x1f\x44\x1f\
\x34\x8a\x92\xc8\x8b\x0f\x68\x0c\x31\x36\xc6\x88\x34\x41\x54\xac\
\x25\xb4\xb5\x36\xc5\xd6\xdd\xb6\xd3\x76\xbf\x67\x67\x77\x7c\x68\
\x77\x6c\xa9\x50\x4c\xfc\x27\x37\xe7\xe6\x9e\x73\xfe\xf7\x7f\xcf\
\x3d\x33\x57\x60\x01\x9e\x7b\xa3\xfd\xfd\x3f\x12\x95\x8f\xc6\xa6\
\xb4\x8a\x85\xeb\x92\xcd\x48\xfa\x5c\xf1\xbe\x95\xf2\x6f\x6d\x9d\
\xaf\x7e\xf6\x1d\xb7\x01\xa1\x38\xe9\xfa\xa0\xad\xf6\xec\x8f\xe1\
\x8b\xab\x23\x1b\xb3\xa1\x95\x3e\x31\x9e\x13\x9d\x55\x65\x4e\xf1\
\xcf\xb8\xc6\x54\x3a\xcb\xf4\xd5\xf3\x43\xa9\x64\xc6\x11\x56\xfa\
\xdb\xbb\x5f\x3b\xfd\xf1\x72\xc4\x96\x22\xe9\xf9\xfe\xc0\xd9\x55\
\x5b\x1e\x70\x0f\x0f\xf4\xdb\x07\x87\x87\x6d\x23\xbf\x0f\x8a\x23\
\x13\x93\xd8\x4a\x2b\x50\x9c\x76\x9c\xde\x75\xca\x74\xba\x50\x76\
\x3d\xe6\xdc\xb9\xeb\x11\xcf\xa5\x8b\xdf\xfc\x3a\x70\x2b\x62\x11\
\xe0\x87\x6b\xce\xe3\x77\xac\xb0\x0e\x27\x06\xbe\xba\xda\xe8\xbd\
\xf0\x74\x4f\xc7\x3e\xf1\xbe\x50\xef\xce\xdc\xcc\xf5\xd9\xd1\xc1\
\x2b\x46\x74\x36\x4e\x3c\x99\x40\xf1\x05\x90\x7d\x41\xc7\x2f\xb1\
\xad\x9f\xbe\xf4\xfa\x2e\x79\x59\x62\x35\x25\xad\xb3\xe4\x13\x33\
\xf7\xaf\x1f\x7d\xe8\xe8\x8b\xef\x7d\x02\x70\xec\xe0\x47\x5f\x36\
\x04\x47\x8f\x24\x54\x55\x48\xce\x4e\xa1\x65\x52\x00\xf8\x82\xeb\
\x45\xaf\xac\x8d\x4c\x68\xe1\xee\x65\x6b\xfc\xd4\xa1\x17\x3e\x0f\
\x3b\x72\x3f\xcf\xaa\x85\xc3\x0b\x9d\x0e\x49\xe0\xdb\xa9\x10\xab\
\x37\xd5\x2f\x4a\x72\xa7\xfb\x98\xf8\x6b\x9c\xca\xc2\xf4\x8d\x7c\
\xed\x9d\x6f\x77\x9d\x00\xb0\x02\x04\xcb\xe2\x5f\xa4\x26\xed\xdd\
\xc7\x8e\xbe\xb9\x64\xe7\x07\xdb\xba\x96\xac\x65\x3c\x77\x31\x3a\
\xd4\xc3\x87\x27\x17\xe9\xe0\xe5\x43\x07\x8f\x03\x27\xcc\x52\xa4\
\xc6\xed\xd7\x14\xb7\x97\x54\x6a\xee\xb8\xc9\x64\xd2\x1c\x26\x59\
\xfa\x9f\xb9\xc5\x66\x5f\x14\x37\x32\x3a\x42\x32\x99\xc4\xeb\xf5\
\xb2\xff\x40\x6b\xad\xa9\x18\x58\xeb\xf7\x07\x00\x48\x24\x13\xb8\
\x64\xd7\xbf\x2a\x2d\xc2\x28\x14\x00\x78\xec\xc8\x69\x74\x4d\xe3\
\xcc\xe1\x3d\x00\x28\x8a\x42\x2c\x16\x8b\x00\x97\xc5\xf9\xd8\xdd\
\x75\x5b\xeb\x49\xa7\xd3\x08\x08\xa6\xd2\xea\x86\x1d\x54\x37\xec\
\xa0\x5c\xf1\x02\x90\xcd\x66\xe6\x6c\x3a\xce\xba\xda\xbb\x59\x53\
\xd3\x00\x40\x89\x54\x02\xc0\x3d\x4d\xf7\x02\x6c\x36\x4b\x01\x3c\
\x5c\x59\x59\xb5\x48\xd5\xbb\xcf\x37\x33\xf0\xd3\xf7\x00\x8c\x8d\
\x0e\x81\x61\x90\xd7\x73\x64\xd2\x49\xe2\x33\x2a\x00\x43\x57\x7a\
\x79\x67\xdf\x76\x33\x27\x18\x0c\x01\xbc\x02\x20\xee\x3f\xd0\x5a\
\x2b\x49\x25\xd8\xed\x76\x3c\x1e\x8f\x19\x14\xf0\x86\xe8\x68\xd9\
\x46\x7f\x6f\x0f\x15\xde\x4a\x0a\x86\x31\x5f\x07\x83\x32\xb7\x87\
\x81\xcb\x17\xe8\x68\xd9\x46\xa8\x32\x02\x80\x2c\xcb\xf3\xe5\xf0\
\xb0\xff\x40\x6b\xad\x08\x44\x56\xfa\xfc\x00\xa8\xaa\x8a\x2c\xcb\
\xc8\xb2\x8c\x28\x8a\x84\xab\x36\xd0\xb9\xb7\xc9\x24\x17\x05\x01\
\x57\x79\x05\x03\x97\x2f\xd0\xb9\xb7\x89\x70\xd5\x06\x33\x5e\x55\
\xe7\x4e\x51\x5e\x56\x0e\x10\x11\x81\xcd\x77\x6e\xdc\x44\x2e\x97\
\x33\xac\x56\x0b\x33\x33\x33\xa8\xaa\x8a\x24\x49\xc8\xb2\x4c\x4d\
\xa4\x9e\x53\x6d\xcd\xf4\xf7\xf6\xe0\x5e\x11\x60\xb8\xef\x12\xa7\
\xda\x9a\xa9\x89\xd4\x9b\x84\xaa\xaa\x92\xcf\xeb\x24\x12\x09\x63\
\xed\x9a\xb5\x00\x4d\x62\x36\x9b\xdd\xe2\xf7\xfb\x71\xb9\x5c\x82\
\xae\xe7\x29\xcc\xdf\x78\x31\x41\x55\x55\x2a\x4a\x03\x74\x3c\xdb\
\x40\x7f\x6f\x0f\x6f\x3d\x53\x4f\x45\x69\xc0\xf4\x01\xe4\xf3\x3a\
\x08\xa0\x28\x8a\x10\x0c\xae\x22\x93\xc9\x96\x5a\x1d\x0e\xc7\xee\
\x48\x24\x62\xb6\xcb\xcd\xa0\x28\x8d\x7c\x7d\xb2\x71\xd9\xdf\x65\
\x75\x75\x35\x4e\xa7\xa3\xc5\x0a\x10\x8b\xc5\x98\x9c\x9c\xbc\x79\
\xdf\x16\x2f\xee\x36\x7c\x5e\xef\x5c\x6b\x16\x3f\x10\x34\x4d\xc3\
\xe3\xf1\x70\xee\xdc\x39\x1c\x0e\x07\xb2\xab\x84\x52\x57\x19\xa2\
\x28\x22\x49\x12\x82\x20\x20\x49\x12\x2e\x97\x0b\x55\x55\xf1\xf9\
\x7c\x44\xa3\xd1\x25\xb6\x48\x2c\x2e\xdc\x4d\xd7\x75\x2c\x16\x0b\
\x86\x61\x20\x0a\x16\xb2\xd9\x2c\x9a\xa6\x61\x18\x06\x36\x9b\xed\
\x96\xca\x6f\x84\xa9\x58\x10\x04\xd2\xe9\x34\x75\x75\xb5\xe8\x7a\
\x1e\x8b\xc5\x82\xae\xeb\x66\xa0\xdd\x6e\xe7\xbf\xc0\x0a\x10\x8d\
\x46\x0d\xbf\xdf\x3f\xff\x4c\x79\x96\x4d\x72\xbb\xdd\x00\x84\xc3\
\xe1\x25\x76\x6c\x6c\xcc\x00\x04\xe1\x89\x27\x1f\xdf\x13\x08\xf8\
\xcf\xf0\x3f\x62\x6c\x6c\x7c\xfb\xdf\xe7\x60\x9f\x53\x70\x22\xd1\
\x6a\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x04\xd5\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\x74\x77\x61\x72\x65\
\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\x70\x65\x2e\x6f\x72\
\x67\x9b\xee\x3c\x1a\x00\x00\x04\x67\x49\x44\x41\x54\x38\x8d\xa5\
\x93\x7d\x68\xd5\x55\x1c\xc6\x3f\xe7\xf7\x7a\xef\xfd\xdd\xdd\x3b\
\xb7\xb6\xb9\x79\xa7\x6d\xbe\xcd\x19\xe9\x72\x58\x62\x43\x7b\x93\
\x62\x25\x46\x82\x34\xc8\x7f\xf2\x6a\x50\xa9\x11\x44\x21\xcd\x5c\
\x85\x95\x98\x53\x4a\x21\x15\x35\x19\x51\x52\x19\x68\x8a\x60\x66\
\x8a\xba\x4d\xa7\xd3\xcd\x97\x4d\x45\xd7\x72\x2f\x6d\x73\x6f\xf7\
\xde\xdd\x97\xdf\xef\xf4\x47\x57\xc9\x5a\xa0\xf8\x85\x87\x73\xe0\
\x70\x3e\xe7\xe1\xe1\x39\x62\xdd\xcb\x8a\x1f\x58\xa4\x08\xb1\x5c\
\x0a\x91\x2a\xa4\xb3\x61\x69\x95\xbd\x82\xfb\x1c\x45\x08\xde\xcd\
\x19\x53\xf8\xf1\xac\xb9\xc1\xc0\x93\xa5\xaf\x78\x3d\xbe\x11\xcb\
\x2a\xcb\xd4\x05\xf7\x0d\x56\x55\x3d\x58\x58\x3c\xdb\x0c\x5f\x3b\
\x48\xbc\xf7\x0a\x53\x1f\x9d\x63\x29\x82\x75\x95\x65\xaa\x7e\x5f\
\x60\xc7\x8e\xc7\x9c\x44\x02\x45\x35\x18\x6c\x3b\x8b\x65\x79\xc8\
\x1a\x35\xd6\x0f\x2c\xd9\xba\x52\xbc\xb0\xe3\x23\xf3\xd8\x57\x4b\
\xc4\x3d\x3f\xa2\x00\xdb\xcf\xd5\x1c\x88\xf8\xf2\x67\x63\x65\x4d\
\xa6\xbf\xa5\x86\x82\xa2\x12\x8f\x99\xc6\x1a\xc3\x95\xf2\xad\x94\
\x4c\x13\x39\xe4\xdd\xbb\x63\xc9\x8a\xee\xf6\x6b\x95\x47\xf6\x7f\
\x33\xa4\x8d\x98\x80\x99\xf6\x20\x2d\x9d\x47\x48\x1b\x9b\xee\x9a\
\xb7\x70\xb9\x3b\x3b\x77\x5c\x54\x24\x78\xf8\x5e\xc1\x42\x4a\x09\
\x40\x65\x99\x3a\x5f\xd3\xb5\xaf\xd3\x27\x7a\xdd\xbe\x0c\x8b\x19\
\x4f\x3d\x87\xcb\xf0\x72\xe6\xad\x3d\xf4\xfc\xd4\x6c\x0b\x5b\x6c\
\x2a\xb5\xed\x37\xef\xda\xf1\xad\x8d\x7f\xa2\x53\xe7\xce\x8b\xf5\
\x3d\x10\x30\x65\xd1\x8c\xc9\x44\x7e\x3f\x45\xcd\xb3\xdb\xe0\x70\
\x27\x85\x23\x03\xaa\xad\xc8\xd7\x36\x97\x8b\x85\x9b\xcb\xef\x2e\
\x6f\x05\x60\x6b\xb9\x98\x29\xa1\xae\x70\xea\xb8\x8c\x49\x53\x0b\
\x44\x6f\x6d\x13\x0d\xf3\xce\x92\xd6\xad\x13\xb0\x52\xb9\xf8\xe7\
\x0d\x52\x17\x17\x68\x39\xb9\xb9\x1b\x55\x4d\x5c\xdf\x5c\x2e\xe6\
\xdf\x55\x14\xdb\x56\x89\xbd\x52\xe8\x73\x52\xd3\xfc\x61\x4f\x63\
\xcc\xe3\xec\x08\x69\x05\x19\xa3\x18\x8a\xc7\xb8\xda\xd7\xc5\x98\
\x4f\xc6\x93\xf5\x4c\x00\x77\x4a\x31\x7d\x3d\xed\xd4\xfe\xb6\x3f\
\xdc\xd7\xd3\xd1\x18\x8f\x3b\x65\xc1\x0a\x79\xf9\x7f\xc1\x00\x5b\
\x56\x89\x00\x0e\x93\x46\x7e\xa6\x7c\x37\x21\x6d\x64\x6a\x77\x34\
\x44\xb7\x16\x25\x6f\xbd\xc4\x33\x5a\xc5\x34\x3d\xe8\x86\x85\xcb\
\xfb\x08\x9a\xa7\x88\x3f\xae\x5d\x90\xc7\x0f\xee\x09\xc7\xa2\x83\
\xab\x1d\x47\x7e\x1a\xac\x90\x89\x61\xc1\xb7\x66\xaf\xaa\xbe\x6f\
\xab\xf2\x83\x94\x59\xf9\x22\xe7\x9d\xeb\x42\x71\x49\x34\xcd\xc4\
\x34\x3d\x18\xa6\x07\x4d\x33\xd1\x35\x2f\xba\x35\x8d\xb8\xcc\xe7\
\x74\xf5\x2f\x91\x2b\x0d\x47\x7a\x63\xb1\xe8\x2a\x60\x7b\xb0\x42\
\x46\x87\x05\x03\x6c\x59\x29\xa2\xa5\x65\xaf\x1b\xa1\xae\x9d\x48\
\x27\x84\xa6\x19\x98\xa6\x85\x61\x5a\xe8\x7a\x1a\xc8\x28\x6e\xb7\
\x07\x55\x4f\x05\xb3\x88\xfe\x01\x8b\xfa\xea\x7d\xe1\xab\x17\x6a\
\xe3\x52\x3a\x6b\x1d\x87\x35\xca\x7f\xa8\x80\xa2\xd2\x1a\x1e\xec\
\x46\x35\x32\x01\x90\x52\x22\xf9\xdb\x80\xa2\x0c\xa1\x99\x01\x22\
\xa1\x28\xd2\x8e\x21\xa2\x27\xf1\xbb\xea\x79\xfc\xe9\x52\xcf\xf3\
\x65\xcb\xfc\x52\x28\x2b\x6e\xb7\xe2\xdf\x23\x1d\x76\x77\xb5\xb5\
\x38\x86\x6b\x3c\x20\x49\xc4\x13\x48\xdb\x01\x4c\xec\x84\x8d\xae\
\x86\xd0\x3d\x13\xe9\xed\xe9\xc7\x91\x06\x20\x51\x54\x2f\x97\x1b\
\xab\xa3\x9a\x42\x55\xb0\x42\x0e\x0d\x0b\x76\x1c\xbe\x6f\x3e\x7f\
\x26\xac\xbb\x27\x20\x84\x0b\x29\x1d\x62\xb1\x04\x52\x4a\x6c\x27\
\x85\x48\xa8\x17\x97\x5b\xc1\xe5\x2b\xa4\xb3\xad\x0f\x5b\x2f\xe1\
\x62\xfd\xf1\x44\xd3\xb9\xea\x96\x78\xdc\x79\x63\x58\xc7\x42\x08\
\x65\xf1\x87\xd4\x47\x42\xe1\x4b\x1d\xad\x4d\xd2\xf0\x4e\x41\x51\
\x21\x11\xb7\x89\x86\x7b\xd1\x5d\xe9\x0c\x45\x24\xe1\xde\x2b\x78\
\xfc\xf9\xb8\xfc\x25\xd4\x1e\xda\x19\x3f\xf1\xeb\x8f\x97\x7a\x7a\
\xed\x92\x60\x85\x8c\xdc\x01\x16\x42\x28\x42\x08\x1f\x90\x05\x64\
\x1f\x3e\xc9\xda\xb3\xb5\xd5\x51\xd3\x2a\x46\xd5\x33\x31\x3c\x99\
\x84\x07\x87\x88\x85\xaf\x92\x92\x31\x9d\xee\x6e\x95\x81\x7e\xc9\
\xf1\xc3\x7b\xa2\xa7\xeb\x1a\x4f\xac\xdc\x98\x58\xf0\xf6\xe7\x28\
\x42\x08\x9f\x10\x42\x28\x49\xa8\x00\xac\xa4\x52\x00\x5f\xd5\xcf\
\xdc\x68\xef\xe8\x69\xb8\x50\x77\x20\x61\xa5\xcf\xc5\x71\xe2\xb8\
\x7d\x63\xe9\xbb\x09\xaa\x91\x87\x61\x8d\x63\xff\xae\xf5\xb1\x93\
\xa7\x9a\xf6\x2d\x5d\x1d\x2f\x6f\xed\xc0\x4c\xde\xb5\x00\xeb\x76\
\xdd\x84\x10\xde\xe4\x81\x37\xa9\x94\x40\x16\x59\xef\xbd\xca\x17\
\x8f\xcd\x7a\x22\x23\x3b\x37\x53\x18\xae\x6c\xfa\xda\x1b\x69\xbd\
\xde\x6c\x5f\x3c\xdf\x12\xde\x77\xd4\xd9\xb0\xfb\x10\xc7\x80\x41\
\x60\x20\xb9\x0e\x02\x5d\x77\xf4\x58\x08\xe1\x02\xfc\x80\x27\x29\
\x77\x71\x21\xa3\x83\x2f\x89\x6d\x33\xe7\xcc\x4b\x89\x45\xda\x38\
\x53\x5d\x1b\xeb\xec\x72\x8e\xae\xaf\x92\x1b\xda\xba\xb8\x09\x44\
\x92\x0a\x03\x37\x81\x01\x29\xa5\x3d\xec\x07\x49\x46\x64\x00\x2e\
\xc0\x58\xf4\x22\x53\xa6\x3f\xc4\x0f\x71\x9b\x53\x0d\xcd\x7c\xb9\
\x69\x17\x35\x40\x1c\x88\x01\x43\x40\x14\x48\xc8\x7f\xc0\xfe\x02\
\xac\xc3\xe6\x28\xcc\x5c\x0b\x9f\x00\x00\x00\x00\x49\x45\x4e\x44\
\xae\x42\x60\x82\
\x00\x00\x04\x49\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\
\x0d\xd7\x01\x42\x28\x9b\x78\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
\xd5\x0b\x0a\x0d\x39\x23\x32\x71\x99\xd2\x00\x00\x03\xd6\x49\x44\
\x41\x54\x38\xcb\xad\x94\x5f\x4c\x5b\x55\x1c\xc7\x3f\xf7\x52\xfa\
\x87\x0b\x94\xdb\xae\xa5\x2d\x56\x56\x60\x1d\x73\x6c\x43\x96\x4e\
\x99\x7f\x26\x26\x3e\xcc\xb8\x45\x63\x9c\x0f\x1a\x63\xc2\xd3\xc6\
\x02\xd4\x6d\x62\x36\x7d\x70\xea\x1c\xd3\x30\x25\x42\x8c\xe8\x83\
\x46\xa7\x4b\xdc\x8b\x2f\x1a\xb3\x07\x89\x31\xe2\x48\x26\xea\x44\
\xb6\x41\xc5\xa6\x13\xa4\x8c\x0b\xf4\x7f\x0b\xbd\x3e\xb4\x54\xea\
\xdc\xc0\x84\x6f\x72\x73\xce\x3d\xe7\xfb\xfb\x9e\xef\xf9\xde\x73\
\xae\xc0\x32\x1c\x7c\xad\xe3\x83\x3f\xc2\x8e\x47\x83\x33\x49\xd3\
\xf2\x71\x43\xa1\x1a\xb1\x16\x87\x86\xcb\xa5\xdf\xbc\xdd\x2f\x7d\
\xfe\x1d\xab\x80\xb0\xd4\xe9\xf9\xd0\x5b\x7f\xee\x47\xd7\x85\xf5\
\xee\x4d\x89\xca\x72\xab\x18\x4a\x89\xfa\x8a\x52\xbd\xf8\x67\x28\
\xc9\x4c\x2c\xc1\xec\xe5\xf3\xbe\x68\x24\xae\x73\xc9\x23\x1d\xbd\
\x2f\x9f\xf9\x64\x25\xe1\x82\x25\xd1\xf3\x23\xf6\x73\xb7\x6f\x7d\
\xa0\x6c\x7c\x74\x44\x3b\x36\x3e\x5e\xe8\xff\x7d\x4c\xf4\x4f\x5f\
\xa7\xb0\xc4\x84\xac\xd7\xa2\xb7\xd4\xc8\xb3\xb1\x74\xe9\xb5\xa0\
\x7e\xf7\x9e\x47\xcc\x17\x2f\x7c\xf3\xeb\xe8\xad\x84\x45\x80\x1f\
\xae\xea\x3b\x6f\x5b\xa7\x19\x0f\x8f\x7e\x7d\x79\x87\x65\xe0\xe9\
\xfe\xae\x03\xe2\x7d\x95\x83\xbb\x53\x73\xd7\xe6\x03\x63\x97\xd4\
\xa9\xf9\x10\xa1\x48\x18\xd9\x6a\x47\xb2\x3a\x75\xbf\x04\xb7\x7d\
\x76\xf8\x95\x3d\xd2\x8a\xc2\x4a\xd4\x50\x53\xb0\x18\x9e\xbb\x7f\
\x43\xe0\xa1\x13\x87\xde\xff\x14\xe0\xe4\x91\x8f\xbf\xf2\x38\x03\
\xc7\xc3\x8a\x22\x44\xe6\x67\x48\xc6\xa3\x00\x58\x9d\x1b\x44\x8b\
\x94\xf4\x4f\x27\x5d\xbd\x2b\x66\xfc\xd4\xd1\xe7\xbe\x70\xe9\x52\
\x3f\xcf\x2b\xe9\x63\xcb\x27\x75\x06\x81\x6f\x67\x2a\x59\xbf\xb9\
\x21\xaf\xa8\x2c\x36\xcc\xf4\x5f\x93\x38\xd2\xb3\xff\xd6\xeb\xe8\
\x7e\xab\xe7\x14\x80\x06\xc0\x59\x1a\xfa\x32\x7a\x5d\xdb\x7b\xf2\
\xc4\x1b\x37\xac\xfc\xa0\xb7\xe7\x86\xb1\xb8\xf9\x2e\x02\xbe\x7e\
\x3e\x3a\x9d\xe7\x83\x17\x8e\x1e\xe9\x04\x4e\xe5\xa2\x88\x4e\x6a\
\xaf\xca\x65\x16\xa2\xd1\xcc\x76\x23\x91\x48\xee\xc9\x89\xc5\xfe\
\xe9\x17\x14\x6a\xf3\x78\xfe\x80\x9f\x48\x24\x82\xc5\x62\xa1\xb5\
\xbd\xa5\x3e\xe7\x18\xa8\xb6\xd9\xec\x00\x84\x23\x61\x8a\xa5\xe2\
\xff\x74\xba\x04\x35\x9d\x06\xe0\xb1\xe3\x67\x58\x48\x26\x39\x7b\
\x6c\x1f\x00\xb2\x2c\x13\x0c\x06\xdd\xc0\x90\x98\xe5\xee\xbd\x73\
\x5b\x03\xb1\x58\x0c\x01\x21\xe7\xb4\xd6\xb3\x8b\x5a\xcf\x2e\x8c\
\xb2\x05\x80\x44\x22\x9e\x69\x63\x21\x6a\xea\xef\xa6\xaa\xce\x03\
\x40\x91\xa1\x08\x80\x7b\x1a\xef\x05\xd8\x92\x8b\x02\x78\xd8\xe1\
\xa8\xc8\x73\xf5\x5e\x5b\x13\xa3\x3f\x7d\x0f\xc0\x44\xc0\x07\xaa\
\xca\xe2\x42\x8a\x78\x2c\x42\x68\x4e\x01\xc0\x77\x69\x90\x77\x0e\
\xec\xcc\xd5\x38\x9d\x95\x00\x2f\x02\x88\xad\xed\x2d\xf5\x06\x43\
\x11\x5a\xad\x16\xb3\xd9\x9c\x23\xd9\x2d\x95\x74\x35\x6f\x67\x64\
\xb0\x1f\x93\xc5\x41\x5a\x55\xb3\x39\xa8\x94\x96\x99\x19\x1d\x1a\
\xa0\xab\x79\x3b\x95\x0e\x37\x00\x92\x24\x65\xe3\x30\xd3\xda\xde\
\x52\x2f\x02\xee\x72\xab\x0d\x00\x45\x51\x90\x24\x09\x49\x92\x10\
\x45\x11\x57\xc5\x46\xba\xf7\x37\xe6\xc4\x45\x41\xa0\xd8\x68\x62\
\x74\x68\x80\xee\xfd\x8d\xb8\x2a\x36\xe6\xf8\x8a\x92\xd9\x85\xb1\
\xd4\x08\xe0\x16\x81\x2d\x77\x6c\xda\x4c\x2a\x95\x52\x35\x9a\x02\
\xe6\xe6\xe6\x50\x14\x05\x83\xc1\x80\x24\x49\xd4\xb9\x1b\xe8\xf3\
\x36\x31\x32\xd8\x4f\xd9\x3a\x3b\xe3\xc3\x17\xe9\xf3\x36\x51\xe7\
\x6e\xc8\x09\x2a\x8a\xc2\xe2\xe2\x02\xe1\x70\x58\xad\xae\xaa\x06\
\x68\xd4\x24\x12\x89\xad\x36\x9b\x8d\xd7\x3b\x5f\x15\x6e\x75\x93\
\x3c\x25\x49\x06\x07\x61\x47\xc9\x15\xfa\xde\xbd\x72\xd3\x0b\xf7\
\xec\x33\xcd\xc4\xe3\x89\x12\x8d\x4e\xa7\xdb\xeb\x76\x67\x72\x6a\
\x6f\x3b\x8c\xa0\xaa\xa8\x08\x80\x0a\x82\x00\xaa\xba\xd4\x64\x4b\
\x85\x2c\x07\xaa\xaa\xaa\xf0\xf9\x7c\x08\x42\xe6\x12\x9f\x7e\xfb\
\x4d\x6a\x6b\x6b\xd1\xeb\x75\xcd\x1a\x80\x60\x30\x98\x3d\x36\x06\
\xfc\x7e\xff\x6a\x7e\xb7\xd4\xd4\xd4\x00\x60\x32\xc9\xd9\xc3\x95\
\x59\x79\x49\x4b\x5c\x4e\x36\xc9\x26\x56\x0b\x59\x96\x33\x1f\xcb\
\x58\x86\xd1\x58\x8a\xd1\x68\xcc\x9b\xd7\x2c\x7f\x29\xd4\x16\xe2\
\xf1\x78\x58\x0b\xe4\x09\xb7\x79\x0f\xfe\xaf\xe2\xd6\xf6\x96\x9b\
\xd6\x68\x00\xa6\xa6\xa6\xd4\x43\xde\xe7\x85\xb5\x70\x3a\x31\x31\
\xa1\x02\x82\xf0\xc4\x93\x8f\xef\xb3\xdb\x6d\x67\x59\x43\x4c\x4c\
\x4c\xee\xfc\x1b\x0f\xd8\x70\x1b\x27\x6e\xb0\x4a\x00\x00\x00\x00\
\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x05\xd0\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\
\x0d\xd7\x01\x42\x28\x9b\x78\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
\xd6\x01\x05\x0d\x1e\x16\x2a\x40\x95\xcd\x00\x00\x05\x5d\x49\x44\
\x41\x54\x38\xcb\x8d\x95\x5d\x6c\x54\xc7\x15\xc7\x7f\x33\xf7\xde\
\xfd\x5e\x7b\xd7\x4b\xfc\xb1\xc4\x26\x36\x35\xb8\x24\xc1\xc1\x5e\
\x27\x0d\x21\x98\xd0\xa4\x69\x95\x14\x35\x44\x4d\xa5\xc4\x4d\x8b\
\x88\xa5\x7e\xa8\xe9\x53\xfa\x56\x59\x4d\x9e\xe8\x53\x55\xa9\x6a\
\x25\x2b\xb4\x2e\x8b\xd2\x56\x6d\x20\xa1\x2f\xc5\x0a\x15\x6d\x6a\
\x0a\xac\x1d\x30\x06\x4c\x83\x03\x98\x85\xf5\xae\xd7\xbb\x5e\xef\
\xf7\xbd\xbb\xf7\xf6\x21\xbb\xc6\x4e\xab\xaa\xe7\x69\x74\x66\xce\
\xef\xfc\x75\xce\x9c\x19\xc1\xff\x61\x3b\x5f\xfe\x69\x5c\x77\x07\
\x9b\xd7\xb8\xe2\x91\xd1\xa1\xd6\xff\x15\xa3\x7e\xd6\x11\x1a\x0e\
\xf7\x03\x44\x46\x87\x26\xeb\x3e\xdd\x1d\x6c\x7e\xe9\xd1\x66\xf2\
\xc5\x12\x7a\x41\x67\x7c\xae\xd4\xf2\x99\xf3\x47\x81\x57\xd6\xc6\
\xc8\x75\xd0\xd7\x8e\x7c\x13\x3d\x7f\x6e\x53\xb3\xeb\x5c\x68\x38\
\x7c\x60\x7d\x4a\x93\x1b\xd1\x24\x46\x45\x5f\x05\x86\x86\xc3\x03\
\xc2\x28\xfc\xe5\x41\xbf\xd9\x0d\x9c\xac\x8b\x02\x10\xab\xd0\x83\
\x63\x03\x4d\x32\xfb\xe1\x1b\xaf\x0e\xda\xe6\xa3\x71\x7e\x79\x6a\
\x61\x15\xf9\xc5\x1d\xed\x6c\x09\x28\x9c\x3a\x7b\x8d\x87\xba\x36\
\xf0\xa7\x8b\xd9\x7b\x7b\x9d\x82\x4d\xf7\x05\x88\xa6\x8a\x9c\xbc\
\x9e\x5f\x89\x8c\x0e\x35\xae\x07\x1f\x38\x9c\xf9\xfa\xae\x76\x6f\
\x57\xd0\x2f\x02\x3e\x0f\xc2\x32\x51\xa5\xc5\xcd\xd8\x0a\xa9\xe5\
\x3c\x91\x99\x5b\x08\x21\xd0\x54\x85\xe6\x26\x2f\xb9\x95\x14\xfe\
\xc0\x06\x12\xc9\x2c\x5d\x6d\x4d\xb4\x78\xed\x1c\x9d\x4a\x1a\xa9\
\x42\xe5\xf1\xc8\xe8\xd0\xe4\xbd\x52\xa8\xb6\xef\xff\xf9\xf4\xd5\
\xf4\x06\x9f\x13\xb0\x58\xce\x96\x49\xa4\x4b\x4c\xcd\xdc\x66\x7a\
\xf6\x0e\x0e\x4d\xc3\xa1\x69\x68\x52\x21\x93\x29\x62\x09\x17\xe9\
\x74\x91\x56\x7f\x03\x7a\xc5\xe2\xed\x33\x0b\x66\x1d\xba\x4e\xf1\
\xa7\x35\xfe\x6d\x28\xe0\x30\xcf\x8d\x1c\xd8\x25\x92\xe9\x3c\x4b\
\xe9\x1c\x97\x66\xef\xd0\x11\xf4\xd3\xd5\x71\x1f\x00\xa5\xb2\x41\
\x22\x99\xe5\xc6\xed\x24\x52\x08\x3a\x83\x01\x4e\x4c\xce\x5b\x8b\
\xba\x3a\x12\x19\x1d\x7a\xeb\xbf\x36\x4f\x29\x2e\x05\x37\xb5\x78\
\xb0\x4c\x0b\x55\x91\x78\xdd\x0e\x76\x0f\x74\xe3\x73\x49\xeb\x83\
\x0f\xa7\xaa\xff\x8c\xcc\x90\x4e\x2d\xe3\xb0\x69\x3c\xd6\xdb\x89\
\x43\xd3\x48\x65\x0a\x0c\x6e\x76\x0b\xaa\x95\x57\xd6\xb2\x44\x68\
\x38\xfc\x77\x60\x17\x40\x4f\x47\x13\x2f\x0f\x76\xa2\x58\x26\xd9\
\x5c\x89\x72\xb9\x42\x26\x93\x34\xc7\x4e\x47\xcf\x54\x35\xf7\xf3\
\x91\xd1\xa1\xe5\xbd\xfb\x7e\xf8\xd2\xd7\xbe\xfa\x74\xd8\xeb\xf1\
\x6b\x8a\x22\x29\x14\x74\xda\x9a\xbd\xbc\x75\xec\xea\x5a\xee\x9b\
\x4a\xb0\x7f\xff\xe1\xd7\xbf\xb4\x91\x67\x7a\x5b\x78\x6a\x7b\x10\
\x01\xc4\xe2\x19\x0a\x85\x32\x5b\x3a\x03\xfc\xfc\xf7\x13\xc5\xb2\
\xcd\x1f\x8a\x8c\x0e\x2d\x03\xdc\xb8\x76\xf6\xb2\xea\xb8\xbf\xf5\
\xd1\xfe\xed\x03\xdb\xb6\x6e\xc4\xed\xb4\x63\xd7\x34\xb6\xb7\xb8\
\xd8\x11\x74\xb2\x23\x68\x63\x32\x5a\x1c\x94\x00\x1d\xc1\x20\x86\
\xa1\x12\x4f\x16\xb8\x3e\x97\x60\x71\x31\xcb\xc2\xc2\x0a\x96\x69\
\x92\x57\x1a\x1d\x75\x68\xdd\xb2\x99\xa5\x23\x85\x42\x8e\xc6\x06\
\x27\xa5\x82\xc1\xb5\x7f\xc5\x59\x59\xd1\xa9\x56\x54\x7c\x8d\x81\
\x7b\x35\x9e\xba\x30\x6b\xc5\x62\x8b\x2c\xa5\xf2\xa4\xd2\x79\xaa\
\x15\x13\xbb\x4d\x45\x48\x81\xcd\x2c\x19\xa1\xe1\xb0\x6f\x2d\xd8\
\xe5\xf5\x3f\xbe\x6d\xeb\x03\xe8\xe5\x0a\xb1\xd8\x32\x1e\xb7\x9d\
\x06\x8f\xc4\x32\xf3\x56\x3c\x7e\xd7\x04\x50\x82\x7d\x2f\xf4\x5c\
\x8a\xeb\x0f\x5f\xbc\x5b\x24\x72\x73\x99\x3d\x3d\x2d\x58\x55\x0b\
\x4d\x51\xf0\x35\x78\x70\x92\x53\x67\x13\x95\x50\xb0\xff\xc5\x13\
\x77\xa7\xde\x2d\xed\xdc\xff\xe3\xcd\x4f\x86\x7a\xfe\xf8\x58\xff\
\x83\xda\x9d\x68\x9a\x62\xde\xc0\xeb\x71\x70\xf8\xbd\xf1\xfc\xdf\
\xe2\x76\xdb\xc5\x05\x5d\x00\x6f\xae\xbb\x6e\xcf\xbd\xf0\xfa\x3e\
\xfb\xe6\x9d\xc7\xbf\xbc\xad\x4d\x48\x21\x90\x42\xf0\x48\x6f\x3b\
\xff\x98\x9a\xe1\xe4\xc4\xac\xe5\x75\xd9\x45\x5f\x77\x90\xfd\xcf\
\x3f\x89\x94\x82\xf3\xe7\x6e\x22\x85\x20\xbe\xb4\xc0\xd8\x99\xe8\
\xcc\xd9\xb1\xef\x3c\xfc\x1f\x23\x5d\x7b\x2b\x3e\xd8\x11\x74\xee\
\xf9\x4a\x5f\xa7\x2c\xe4\x74\xa4\x10\x08\x21\xb8\xbf\xdd\x4f\x6b\
\x4b\x23\x52\x0a\xf2\xb9\x32\xd5\x8a\x09\x40\xf4\x76\x1a\x4d\x53\
\x38\x7f\x79\x86\xf7\x3e\xae\x64\x2d\xab\xba\x77\xf2\xed\x6f\x4f\
\x02\xd6\x2a\xb8\xff\xb5\x23\xa7\x7c\x2e\x75\xd7\x77\xf7\x3e\xa0\
\x08\xc3\x26\x2d\xd3\x5a\x05\x4b\x29\x6a\x6b\x50\x15\xc9\xa6\xce\
\x00\x20\x88\xde\x4a\x21\x85\xa0\x8a\xce\xf4\x27\x51\x7e\x37\x9d\
\x31\xcc\x4a\xf9\x89\xa9\x5f\x1f\x8c\xa8\x00\xfd\x07\x7f\x13\x12\
\x96\xb9\xfb\x5b\x4f\x74\x08\xb7\xe6\x91\x86\x59\xc1\xe3\xb3\x23\
\x85\xa4\x54\x30\x3e\xed\x72\x0d\x2e\x85\x20\xbd\x54\xa4\xb5\xad\
\x01\xd3\x2a\xe3\x75\x35\x62\x59\x76\x9a\x1b\x1c\xc8\x6a\x42\x35\
\xf4\x92\x02\x08\x05\x10\xb1\x8f\x8e\x2f\xb4\xf5\x3e\xf7\x85\xb9\
\x78\x6e\xf3\x9e\xcf\xb7\x8b\x7c\x29\xcb\xc8\xfb\x57\x38\x3f\x3d\
\x9d\x5a\x5c\xc9\x39\xfa\xba\x83\xc2\xa6\xa8\xa8\x52\x62\xb3\x49\
\xa6\xe6\xa2\xd6\xc8\xd1\x09\x7d\xfc\x72\x34\xe7\xd2\xb0\xd9\x9c\
\x0e\x31\x39\x3d\x53\xfd\x38\x59\xfc\x45\xd5\x28\x5d\x4d\x5c\x19\
\xbf\xab\xd4\xea\xac\xc4\x2e\x9c\x38\xd6\xb8\xe5\xa9\xed\x91\xf9\
\xec\xd6\x6b\xf1\x02\x4b\xe9\xd4\x47\x13\x63\x3f\xf8\x5e\xae\xf1\
\x21\xfe\x7a\x4b\xef\x7d\x71\xa0\x0b\x2c\x81\x40\x72\xec\xc2\x1d\
\x31\x3b\x33\xf1\xb3\x2b\xc7\x47\x0e\xc5\xbd\xbd\xbe\x4b\xf3\x8b\
\xdd\x97\xe6\x93\xe1\xe9\x3f\xbc\x71\x28\x71\x65\xfc\x06\x50\xad\
\x37\x50\x01\xdc\x40\x5b\xcf\xbe\x91\x1f\x3d\xf2\xea\xaf\xce\x03\
\x83\xc0\x33\xc0\xb3\xa1\xe1\xb0\x35\x77\x3d\x61\x45\x4e\x7f\x62\
\xcd\x5d\x4f\x58\xa1\xe1\xb0\x05\x3c\x0b\x3c\x0d\xec\x06\xfa\x80\
\xcf\x01\xad\x40\x03\x60\xab\x7f\x4d\x16\x50\x51\x34\x67\x69\xf6\
\xfd\x9f\xbc\x03\x9c\x00\x1c\x80\xbd\x96\x14\x00\xff\x46\xcf\xba\
\x01\xac\x29\xd3\x81\x3c\x50\x00\x4a\x40\x05\x30\xd5\x1a\x14\xa0\
\x52\x35\x8a\x45\xa0\x2a\x55\xbb\x6e\x73\x37\x39\x4b\x99\x98\x04\
\x64\x79\x65\xf1\xdd\x6f\x1c\x3a\xb9\xbf\x4e\x34\x0a\x99\x77\x80\
\x78\x5d\x50\x0d\x58\xae\x25\x31\x00\xf3\xdf\xf0\x11\x56\x82\x70\
\x21\x0b\x3b\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x04\x7f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x11\x00\x00\
\x0b\x11\x01\x7f\x64\x5f\x91\x00\x00\x00\x07\x74\x49\x4d\x45\x07\
\xd5\x09\x1a\x0b\x18\x25\x79\xd9\x51\x49\x00\x00\x04\x0c\x49\x44\
\x41\x54\x38\xcb\xa5\x95\x7f\x4c\x94\x75\x1c\xc7\x5f\xcf\x71\x02\
\x29\xe0\xa1\x96\x72\x84\x88\xcd\x69\x56\xc2\x09\xa3\x0d\xee\x16\
\x85\xb8\x16\x0a\xce\x65\x69\xb2\xa6\x16\xcb\x6a\xfd\xe1\x58\x0b\
\x19\xee\xdb\x93\xc4\x51\xff\xd0\x06\xe4\xc8\xd6\x9a\x63\x2d\xcc\
\x2d\x73\xda\x26\xb1\x69\x2d\xd8\x94\x1f\x67\x3b\xa9\x43\x25\x76\
\xbb\x38\x90\x1e\x91\x2e\x40\xb8\x3b\x9e\xa7\x3f\xe4\xb9\x1d\xe7\
\x41\x6d\x7d\xb7\x67\x7b\x3e\xcf\xbe\xcf\x6b\xef\xef\xe7\xf3\x7e\
\x3f\x8f\x44\xc4\x12\x42\x08\xe0\xfd\xb9\xf2\x3d\xa0\x57\x96\xe5\
\x76\xfe\xef\x12\x42\x68\xa3\xb7\x47\xb4\x99\x99\x69\xcd\xe5\xfa\
\x4d\x13\x42\x68\x15\x15\x15\xc5\x80\xf4\x2f\xaf\x4a\x80\x41\x2f\
\x0c\x51\x36\x98\x9b\x3e\x3d\x81\xa6\xaa\xa4\x9a\xcd\xec\xdb\xb7\
\x97\x84\x84\x84\xf3\x80\xb6\x10\x3c\xa7\xbc\x25\xe5\x83\x13\xe7\
\xd4\x9c\xf2\x96\x53\x91\x60\x49\x08\x91\x05\x20\xcb\xf2\x30\x60\
\xb6\xd7\x7d\xc4\xcc\xf4\x3d\x32\x32\x32\x22\x55\x45\x42\xb3\x00\
\xef\xb1\xc3\x3b\x31\x2f\x67\x4d\x4e\x79\x4b\xbb\x0e\x96\xaa\xab\
\xab\x65\xc0\x21\x84\x38\xae\xc3\xad\x56\x2b\x92\xf4\xc0\x81\xd4\
\x28\x82\x1d\x5d\x9f\xed\xa7\xa7\xa7\x87\x83\xf9\xcb\x0a\x2d\xe9\
\xf1\x85\x00\x46\x60\x49\x4c\x4c\xcc\xb1\x37\x0f\x97\x63\x88\x89\
\x7d\x17\xa8\xde\xb2\x65\x0b\x9b\x36\x6d\x44\xd3\x54\x24\x49\xc2\
\x3f\x33\x79\x45\x08\x91\x25\xcb\xf2\xb5\x28\x6a\x19\x18\x18\xc0\
\xe3\xf1\xf0\xe1\xf7\x93\x00\xe6\xd0\xd1\x9a\x9b\x9b\x9d\xa5\x25\
\x3b\x9f\x5c\xba\xf4\x21\x02\x7e\x3f\x9a\xa6\xa1\x69\x5a\x08\x90\
\x64\x4a\xa6\xb6\xd6\x0e\x60\x9e\x6b\x95\x0e\x75\x74\x36\xbd\x44\
\xde\xdb\xa7\xf5\xad\x96\xee\x93\x65\xd7\x42\x60\x21\x44\x4a\x7c\
\x7c\xfc\xaf\xcf\x6f\x2f\x34\x3d\xfe\xc4\x53\x48\x92\x14\x9a\x95\
\x6f\xfc\xee\x7d\xf8\x72\x13\xb5\xf6\x3a\x00\xf3\x05\xef\x86\xd5\
\x80\xe3\x6a\xf3\x2b\xc1\xdc\x37\xbe\x32\x02\x45\xdd\x27\xcb\xda\
\xa3\x0e\x43\x08\x91\x95\x9e\x9e\xfe\xb9\xdb\xed\xce\xd6\x9f\xe5\
\xe6\xe6\x06\xb6\x6d\x2b\x5c\xf2\xf7\x5f\xe3\x68\x9a\xc6\xb2\xc4\
\x24\x5a\x5b\x5b\x69\xea\x8c\xe5\xe7\x86\x17\xb1\xbe\x73\x66\x9e\
\xca\x70\xae\xb4\x88\x9f\x53\x00\x1b\xd0\x5a\x55\x75\x94\xb1\x3b\
\x0a\xd7\x6f\xfe\xc1\xc7\x67\xdd\x7c\x7b\xbc\x98\x82\x23\x67\x17\
\x84\x02\x9a\xf4\x1f\x02\x93\x05\x38\xd6\x5a\x8a\x39\x71\xe1\x06\
\xdf\x54\xe5\x53\xf5\x45\x37\x25\x9b\x03\xb8\x5c\xfd\x96\xb0\x81\
\xea\xfd\x8b\xee\xcb\x70\xd3\x2b\x43\x1e\xaf\x5e\xaf\x4a\x4d\xe3\
\x72\xfd\x2e\x0e\xd4\xb5\xb1\xcb\x12\xcf\xcb\x25\x45\xd4\xd4\xd4\
\xe8\x03\x1d\x05\x66\x17\x35\x7c\x38\x74\xcf\xf6\x8d\x64\x6e\x5e\
\x8f\xa2\x8c\xf1\x49\xcb\x15\x56\xa5\xa6\x51\xb1\x23\x05\xb3\xc9\
\xc8\xfa\x8c\x75\xa4\x3e\x9a\x86\x2c\xcb\x00\x96\x48\x2b\x1a\x16\
\x83\xbe\x5a\x6a\x45\x9d\x50\x48\x34\x99\x28\xb4\x24\xa1\x0c\x79\
\x70\xf5\xfe\x84\xcd\x66\x23\x3e\x2e\x96\x3b\x7f\xde\xe6\xfe\x37\
\x0b\x87\x9e\xdc\xa8\x60\x1d\xfa\xfa\xee\x4c\x0e\xed\x7e\x86\xb6\
\x8b\x3f\xf0\x63\x4f\x3f\x18\x8c\xcc\x06\x83\x21\xaf\xca\xb2\xcc\
\xca\x87\x57\x23\x49\xd2\x82\x70\x43\x24\xf4\xe8\x6b\x56\xf6\x17\
\xe7\x71\xfa\xbb\x76\xba\xfa\x06\xc9\xb3\xd9\x70\xb9\x6e\x11\xf0\
\x4f\x03\xe0\xf3\xf9\x14\xbf\xdf\x9f\x2d\xcb\x32\x2b\x56\x3d\x02\
\x10\x82\xc7\xc5\xc5\x85\xe0\x06\x3d\x45\xca\x90\xc7\x2b\xbf\xf5\
\x2c\x7b\xb6\x67\x73\xea\xcc\x45\x06\x3d\x5e\x8a\x8a\x4b\x70\xb9\
\x6e\xe1\x75\xdf\xa4\xa3\x5f\xc5\x18\x1c\xdd\x50\x5f\x5f\x7f\xd7\
\x6e\xb7\xdf\x18\x19\x19\xb1\xea\xca\x67\xfc\x7e\x0e\x1e\x3c\x40\
\x65\x65\x25\x80\x23\x04\x56\x86\x3c\x8e\x23\x65\x4f\x53\x5a\x90\
\x49\xeb\xb9\xcb\x0c\x7a\xbc\xd8\x9e\x2b\x9c\x07\x0d\x8c\xf6\x5a\
\xa6\x14\x77\x12\xb0\x02\x58\xe9\x74\x3a\x03\x4e\xa7\xb3\x58\x96\
\x65\xcc\xa9\x69\x34\x36\x36\xe2\xf3\xf9\x42\x9d\x30\xea\x77\xe9\
\xeb\xd2\x98\x55\x35\x46\x87\x06\x1f\x80\x4e\xfc\xde\x56\xa0\xb8\
\x2e\x05\xe6\x84\x24\x03\x86\xce\xce\xce\x20\x30\x3c\x31\x31\xb1\
\xb7\xa1\xa1\xe1\xeb\xb1\xb1\x31\x54\x55\xbd\x1a\x08\x04\xec\xa1\
\xe4\xad\x7b\xc1\xae\xed\xc8\x37\x63\xc9\xb6\xf0\x58\x8a\x89\x5f\
\xfa\x6e\x71\xb5\xab\x8b\x8e\x7e\x95\x29\xf7\xa5\xfc\xd1\xbe\x36\
\x25\x62\x26\x6a\x98\x55\x67\x81\x19\x60\x12\x98\x06\x82\xc0\xac\
\x11\x60\xc5\x9a\x94\xad\xe7\x3b\xbc\xbd\x7a\x83\xee\x4d\x4d\xd0\
\xd1\xaf\x12\x67\x98\x2c\x50\x93\x53\xc7\x01\x25\xcc\xf7\x3a\x50\
\xff\xa3\xa8\x73\xf0\xa0\x0e\x9d\x17\xe9\xad\x87\xbe\xb4\x8c\x8d\
\x0c\xf7\xea\x75\x42\x62\xec\xda\xeb\xad\x15\x23\xe1\x31\x0d\x83\
\x4a\x51\x62\xac\xce\x5d\x1a\xa0\xfd\x03\x8c\xf6\xde\xf1\x62\xa0\
\xea\x2a\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x05\x4f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x16\x00\x00\x00\x16\x08\x06\x00\x00\x00\xc4\xb4\x6c\x3b\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\x74\x77\x61\x72\x65\
\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\x70\x65\x2e\x6f\x72\
\x67\x9b\xee\x3c\x1a\x00\x00\x04\xe1\x49\x44\x41\x54\x38\x8d\x8d\
\x94\x6b\x6c\x54\x45\x18\x86\x9f\x99\x33\xe7\xb6\x6d\x81\x82\x6d\
\x97\x3b\xbb\x6c\x2d\x97\x2d\x77\xe4\x2a\x01\x09\x24\xb2\x20\x26\
\x1a\x12\x12\x43\x54\x22\x28\x28\x26\x46\xa4\x5e\x12\x7f\x18\x65\
\x49\x48\xd0\x88\xc8\x1f\xf8\x01\x51\x13\x13\x23\x21\x6c\x00\xc1\
\x72\x11\xa4\x10\x25\x94\x96\x52\xe8\x65\x5b\x0a\x94\x36\x45\x28\
\xb4\xdd\xb6\xdb\x73\x8e\x3f\x76\xdb\xa0\x80\x38\xc9\x9b\xf9\x33\
\xf3\xcc\x97\x79\xbf\xf7\x13\x9e\xe7\xf1\xa4\x15\x88\x44\x0d\x20\
\x0c\xdc\x03\x6a\xe2\xb1\xa2\x27\x5e\x12\x8f\x03\x07\x22\xd1\x19\
\xc0\x3a\x60\x36\x30\x12\xe8\x04\x64\x5a\x97\x81\x13\xc0\xd6\x78\
\xac\xe8\xe6\xff\x02\xa7\xab\xdb\x0c\xac\x0d\x87\xfc\x19\x73\x26\
\x8e\x24\x1c\xf2\x53\x98\xef\x07\xa0\xbc\xba\x89\xb2\xea\x46\x4e\
\x5f\xa8\x4b\x96\x57\x37\x25\x80\xb7\xe2\xb1\xa2\xef\xff\x13\x1c\
\x88\x44\xc7\x02\x31\xdb\x54\xb9\x9b\x5e\x5b\x90\xb1\x78\x56\x3e\
\xc5\xe7\x6a\x28\xaf\x6d\xa2\xa2\xb6\x19\x29\x24\x85\x21\x3f\xe1\
\x50\x1e\xf3\xa7\x06\x38\xf4\xfb\x55\xa2\xbb\x8f\xb5\x25\xba\x92\
\x27\x80\x15\xf1\x58\x51\xc7\x43\xe0\x40\x24\x6a\x02\x95\xe3\x82\
\x79\x23\xbf\xf9\xf0\x45\x71\xae\xbc\x81\xad\x7b\x7f\xa3\x3b\xe9\
\xa0\x94\x86\xa6\x49\xa4\x94\x08\x21\x10\x02\x32\x6d\x83\x77\x57\
\xce\x66\x7c\x30\x87\x77\xa2\xfb\xbb\xca\xaa\x1b\xf7\xc6\x63\x45\
\x6f\x3c\x0a\xbc\xcd\xb6\xf4\x35\x07\xb7\xbf\xee\xdb\xba\xe7\x24\
\x27\xce\xd7\x31\x7d\xfc\x70\x5e\x5a\x38\x9e\x09\x21\x3f\x39\xd9\
\x19\x24\x7b\x1c\x1a\x6f\xb7\x71\xe8\x4c\x15\xfb\x4f\x56\xe2\xb8\
\x1e\x0b\xa6\x06\x58\xb5\x64\x12\xcf\xaf\xdf\xd5\x9e\xe8\x4a\x2e\
\x8b\xc7\x8a\x8e\xf5\x81\xd3\x46\x15\x7f\xb6\x6e\xb1\x4f\xd7\x35\
\x3e\xdf\x75\x1c\xd3\xd0\xd9\xb8\xea\x59\x56\x2c\x2a\x7c\xa4\xb9\
\x3f\xfe\x7a\x89\x3d\xb1\x52\x1c\xd7\xe5\xbd\x95\x33\x69\xb9\xdb\
\xce\xc7\x5f\x1f\x6c\xf6\x3c\x46\xc7\x63\x45\x6d\x32\x7d\xee\xed\
\x49\x05\x83\x7d\xcf\x3d\x13\x62\xdb\x77\xa7\x31\x4d\x1d\xd3\xd4\
\xf1\x80\xc3\x25\xd5\x7c\xb2\xb3\x98\xb5\x5b\x0e\xf0\xc3\x91\x4b\
\x7d\xe0\x85\xd3\x02\xd8\xb6\x89\x6d\x19\xec\x3e\x70\x81\xc5\x33\
\xf3\x99\x3c\x66\x68\x06\x10\x21\xdd\x3a\x00\xb3\xe7\x4e\x0e\x70\
\xa4\xa4\x8a\x1e\xc7\xc3\xd0\x15\xa6\xa1\xb3\xf7\x50\x19\x3b\x7f\
\xfe\x93\xab\xd7\xef\xd0\x96\x70\x38\x5d\x76\xbd\x0f\xac\x34\x89\
\xcf\x36\xb0\x2d\x03\xc7\x13\x9c\xab\xb8\xc9\xbc\x69\xa3\x7d\xc0\
\x4c\x00\x19\x88\x44\x2d\x60\xc4\x84\xfc\xc1\x54\xc4\x9b\xd1\x75\
\x0d\x43\x57\x18\x86\x42\x57\x1a\xa6\xa1\x63\x99\x06\x3e\xdb\x60\
\xf5\xd2\x49\x7d\xe0\x8b\xb5\x2d\xd8\x96\x89\x65\x19\x58\xa6\x41\
\x5d\xe3\x5d\x0a\x43\x7e\x21\xa5\x98\xd7\x5b\xf1\x44\x20\x51\x98\
\xef\xa7\xb2\xae\x05\xa5\x34\x74\x5d\xf5\xc9\x30\x52\xdf\xb2\x76\
\xf9\x64\x26\x3f\x9d\x07\xc0\xb5\xa6\x7b\xc4\x4a\xea\xb0\x2d\x03\
\xdb\x34\x30\x4d\x9d\xfa\xa6\xfb\x8c\x1d\x95\x83\xe7\x79\x63\x01\
\x14\xd0\x06\x48\x21\x04\x52\x93\x28\x4d\x43\x69\x12\x3d\xfd\x80\
\xa1\x2b\x5e\x98\x1b\x62\xda\x98\x54\x40\xea\x9b\xee\xb3\xf7\xe8\
\x55\x74\x43\x47\x48\x89\x94\x02\x04\xe8\x4a\xa5\x5a\x11\xd1\xd9\
\x5b\xf1\x65\x40\x55\xd4\x36\x13\x0e\xe6\x21\xa5\x44\xd3\x52\x52\
\x9a\x86\x52\x1a\x13\x43\xb9\x7d\x5f\x50\x5c\x7a\x13\x5d\xd7\xb1\
\x2d\x03\xcb\xd4\x31\x0c\x1d\x5d\x29\x46\x0f\xcb\xe6\xea\xb5\x16\
\x84\x14\x17\x00\x54\x3c\x56\xe4\x06\x22\xd1\xca\x8a\x9a\x5b\x13\
\xc7\x05\x73\x29\xb9\x74\x03\x29\x53\x61\xd0\xa4\x40\xd3\x24\x3b\
\xf6\x5d\xc4\x67\x1b\x58\x96\x91\x82\xda\x06\x3d\x8e\x8b\x00\x1c\
\xc7\x25\xa9\x24\xc1\x21\xfd\xa9\xa8\x6e\x74\x1d\xc7\x3d\xf9\x60\
\x57\x9c\x38\x55\x5a\xef\xcc\x9f\x1a\xc0\x32\x54\x2a\x39\x90\x4e\
\x99\xe0\x95\x45\x63\x58\x13\x09\xf3\xea\xa2\x02\xb2\xb3\x2c\x7c\
\xb6\x89\xae\x34\xa4\x26\x11\x52\x60\x1b\x8a\xc2\x60\x0e\xc5\x67\
\xab\x3a\x81\x92\x07\xc1\x5b\x4a\x4a\xeb\x13\x67\xcb\x1b\x58\xbd\
\x7c\x0a\x00\x1e\xe0\xe1\xe1\x79\x1e\xb9\xd9\x3e\xfc\x03\x7d\xe4\
\x0e\xb0\xc1\x73\x49\x74\x76\xd3\xd3\xe3\xe0\xba\x2e\x9e\xeb\xb1\
\x74\x56\x90\x53\x17\xea\xbd\xf3\x95\x37\x2a\x80\xc3\x7d\xe0\xf4\
\xe8\x5b\xff\xe9\xb7\xbf\x74\xcc\x0c\x0f\x63\x4a\xc1\x60\x5c\xd7\
\xc5\x75\x3c\x5c\xd7\x4d\xbd\x92\x5e\x5d\xdd\x3d\x24\x12\x5d\x74\
\x76\x25\xe9\x4e\xf6\x50\x30\xac\x3f\x01\x7f\x16\x1f\x7d\x15\xeb\
\x70\x1c\x77\x45\xef\xac\xfe\xc7\x74\x0b\x2e\x8d\x1e\x99\x51\x38\
\x72\xde\xb6\xf7\x97\x19\xe7\xaf\xdc\xe2\xa7\xe3\x95\x08\x4d\xc3\
\x32\x7b\x8d\x52\x28\xa5\x21\x85\x40\x69\x82\xc5\x53\x87\x13\xf0\
\xf7\x63\xfd\xe6\x7d\x1d\x7f\x5c\x6a\xd8\x58\x7b\x60\xd3\x8e\x5e\
\xd6\xbf\xc7\x66\xa6\x10\x62\x7b\x56\x86\xf9\xf2\x17\x1b\x96\x64\
\x4c\x1f\x37\x94\xf3\x57\x6e\x71\xad\xf9\x3e\x37\x5a\xda\xd1\x75\
\x8d\x51\xfe\x01\x8c\xc8\xcb\xa2\x30\x30\x88\x33\x65\x0d\xde\xa6\
\x2f\x0f\x74\xb4\x77\x74\x7f\xf0\x20\xf4\x21\x30\x29\xc3\x32\xfd\
\xb3\xde\x8c\xd8\xd9\x23\x76\xcc\x99\x12\xf4\xcd\x9f\x16\x32\xc3\
\xa3\xf3\x44\xfe\x88\x41\x00\x54\x37\xfc\x45\x79\xcd\x2d\xf7\xe8\
\x99\x2b\xc9\xb3\xa5\x35\xb5\xb7\xab\x8e\x6d\x68\xad\x3e\x76\x19\
\x68\xf5\x3c\xaf\xed\x91\x60\x21\x44\x36\x30\x10\x18\xa4\x67\xe4\
\x0c\xe9\x17\x98\xbb\xd0\xc8\xcc\x09\x9b\x59\x4f\x15\xa0\x32\x72\
\x04\x8e\xeb\x74\xb6\x36\x27\x5a\x1b\xab\xba\x5b\x1b\x2f\xb7\xd6\
\x1c\x3f\x0d\xde\x6d\xe0\x0e\x70\x1b\xb8\xe9\x79\x5e\xe2\x71\x15\
\x2b\xc0\x06\x7c\x40\x56\x5a\xfd\x80\xcc\xb4\xd9\x09\x52\x69\xbd\
\x9f\xde\xdb\xd3\xea\xf4\x1e\x80\xfd\x0d\xc2\x22\xe7\x20\xf7\x3e\
\x8c\x40\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
"
qt_resource_name = "\
\x00\x05\
\x00\x6f\xa6\x53\
\x00\x69\
\x00\x63\x00\x6f\x00\x6e\x00\x73\
\x00\x05\
\x00\x35\x9b\x52\
\x00\x32\
\x00\x32\x00\x78\x00\x32\x00\x32\
\x00\x04\
\x00\x06\x87\x73\
\x00\x61\
\x00\x70\x00\x70\x00\x73\
\x00\x0a\
\x0b\xeb\xbe\x83\
\x00\x63\
\x00\x61\x00\x74\x00\x65\x00\x67\x00\x6f\x00\x72\x00\x69\x00\x65\x00\x73\
\x00\x07\
\x07\xab\x06\x93\
\x00\x61\
\x00\x63\x00\x74\x00\x69\x00\x6f\x00\x6e\x00\x73\
\x00\x11\
\x01\xa6\xc4\x87\
\x00\x64\
\x00\x6f\x00\x63\x00\x75\x00\x6d\x00\x65\x00\x6e\x00\x74\x00\x2d\x00\x6f\x00\x70\x00\x65\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
\
\x00\x12\
\x00\x03\x49\x87\
\x00\x73\
\x00\x79\x00\x73\x00\x74\x00\x65\x00\x6d\x00\x2d\x00\x6c\x00\x6f\x00\x67\x00\x2d\x00\x6f\x00\x75\x00\x74\x00\x2e\x00\x70\x00\x6e\
\x00\x67\
\x00\x10\
\x0c\xbc\x2e\x67\
\x00\x64\
\x00\x6f\x00\x63\x00\x75\x00\x6d\x00\x65\x00\x6e\x00\x74\x00\x2d\x00\x6e\x00\x65\x00\x77\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x11\
\x0f\xe3\xd5\x67\
\x00\x64\
\x00\x6f\x00\x63\x00\x75\x00\x6d\x00\x65\x00\x6e\x00\x74\x00\x2d\x00\x73\x00\x61\x00\x76\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
\
\x00\x0e\
\x0d\x8b\x39\xe7\
\x00\x65\
\x00\x64\x00\x69\x00\x74\x00\x2d\x00\x63\x00\x6c\x00\x65\x00\x61\x00\x72\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x14\
\x0b\xa9\xab\x27\
\x00\x64\
\x00\x6f\x00\x63\x00\x75\x00\x6d\x00\x65\x00\x6e\x00\x74\x00\x2d\x00\x73\x00\x61\x00\x76\x00\x65\x00\x2d\x00\x61\x00\x73\x00\x2e\
\x00\x70\x00\x6e\x00\x67\
\x00\x17\
\x0d\x58\x3e\xe7\
\x00\x61\
\x00\x70\x00\x70\x00\x6c\x00\x69\x00\x63\x00\x61\x00\x74\x00\x69\x00\x6f\x00\x6e\x00\x73\x00\x2d\x00\x73\x00\x79\x00\x73\x00\x74\
\x00\x65\x00\x6d\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x16\
\x01\x70\xe1\x87\
\x00\x70\
\x00\x72\x00\x65\x00\x66\x00\x65\x00\x72\x00\x65\x00\x6e\x00\x63\x00\x65\x00\x73\x00\x2d\x00\x73\x00\x79\x00\x73\x00\x74\x00\x65\
\x00\x6d\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x0f\xad\xca\x47\
\x00\x68\
\x00\x65\x00\x6c\x00\x70\x00\x2d\x00\x62\x00\x72\x00\x6f\x00\x77\x00\x73\x00\x65\x00\x72\x00\x2e\x00\x70\x00\x6e\x00\x67\
"
qt_resource_struct = "\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x10\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\
\x00\x00\x00\x20\x00\x02\x00\x00\x00\x01\x00\x00\x00\x0f\
\x00\x00\x00\x48\x00\x02\x00\x00\x00\x06\x00\x00\x00\x09\
\x00\x00\x00\x2e\x00\x02\x00\x00\x00\x02\x00\x00\x00\x07\
\x00\x00\x01\x80\x00\x00\x00\x00\x00\x01\x00\x00\x1e\x0f\
\x00\x00\x01\x4c\x00\x00\x00\x00\x00\x01\x00\x00\x18\x3b\
\x00\x00\x00\x84\x00\x00\x00\x00\x00\x01\x00\x00\x03\x9b\
\x00\x00\x00\x5c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x1e\x00\x00\x00\x00\x00\x01\x00\x00\x13\xee\
\x00\x00\x00\xae\x00\x00\x00\x00\x00\x01\x00\x00\x07\xdb\
\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x01\x00\x00\x0f\x15\
\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x01\x00\x00\x0a\x93\
\x00\x00\x01\xb2\x00\x00\x00\x00\x00\x01\x00\x00\x22\x92\
"
qInitResources()
| 59.887139 | 129 | 0.725884 |
96bb265549d6f2b01a8d5a363f1cef448dfbda43 | 581 | py | Python | xinyu/python/node/graphicNode/turtle/base_graphics.py | xzhuah/codingDimension | 9b90b93a3a3b8afee28e3a2a571050ca3f86f066 | [
"Apache-2.0"
] | 1 | 2020-11-06T20:39:11.000Z | 2020-11-06T20:39:11.000Z | xinyu/python/node/graphicNode/turtle/base_graphics.py | xzhuah/codingDimension | 9b90b93a3a3b8afee28e3a2a571050ca3f86f066 | [
"Apache-2.0"
] | 1 | 2021-08-28T02:29:51.000Z | 2021-08-28T02:29:51.000Z | xinyu/python/node/graphicNode/turtle/base_graphics.py | xzhuah/codingDimension | 9b90b93a3a3b8afee28e3a2a571050ca3f86f066 | [
"Apache-2.0"
] | null | null | null | # Created by Xinyu Zhu on 2021/6/6, 21:08
from turtle import Turtle
import turtle
if __name__ == '__main__':
tur = Turtle()
wn = turtle.Screen()
wn.title("Turtle Demo")
wn.setworldcoordinates(0, 0, 500, 500)
tur.speed(0)
draw_rectangle(tur, 0, 0, 500, 500)
a = input()
| 22.346154 | 60 | 0.636833 |
96bc131385537becfa54518e6876cbcdcb1526f8 | 2,439 | py | Python | deform_conv/cnn.py | lone17/deform-conv | 3502cedbeae61c961d7e988382c55b9d45fd1873 | [
"MIT"
] | null | null | null | deform_conv/cnn.py | lone17/deform-conv | 3502cedbeae61c961d7e988382c55b9d45fd1873 | [
"MIT"
] | null | null | null | deform_conv/cnn.py | lone17/deform-conv | 3502cedbeae61c961d7e988382c55b9d45fd1873 | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division
from keras.layers import *
from deform_conv.layers import ConvOffset2D
| 32.959459 | 84 | 0.622796 |
96bc9e10f5eba6df7448344bf718f39170c04f04 | 1,861 | py | Python | perf/unit/ledger_rest.py | jancajthaml-openbank/e2e | a2ef84b6564022e95de76438fc795e2ef927aa2b | [
"Apache-2.0"
] | null | null | null | perf/unit/ledger_rest.py | jancajthaml-openbank/e2e | a2ef84b6564022e95de76438fc795e2ef927aa2b | [
"Apache-2.0"
] | 30 | 2018-03-18T05:58:32.000Z | 2022-01-19T23:21:31.000Z | perf/unit/ledger_rest.py | jancajthaml-openbank/e2e | a2ef84b6564022e95de76438fc795e2ef927aa2b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from unit.common import Unit
from helpers.eventually import eventually
from helpers.shell import execute
import string
import time
import os
| 23.858974 | 80 | 0.587319 |
96bcc512ded27d54238d89fca3c8655f2d09789e | 1,431 | py | Python | pythonneat/neat/Population.py | SananR/PythonNEAT | 951615b89d8211a22e147bc03446bf597576a6fc | [
"MIT"
] | 2 | 2020-06-08T19:39:45.000Z | 2022-01-20T18:21:38.000Z | pythonneat/neat/Population.py | SananR/PythonNEAT | 951615b89d8211a22e147bc03446bf597576a6fc | [
"MIT"
] | null | null | null | pythonneat/neat/Population.py | SananR/PythonNEAT | 951615b89d8211a22e147bc03446bf597576a6fc | [
"MIT"
] | null | null | null | from pythonneat.neat.Species import Species
import pythonneat.neat.Speciation as Speciation
import pythonneat.neat.utils.Parameters as Parameters
current_genomes = []
def add_genome(genome):
"""Adds genome to the species list based on its
compatability distance to already existing species
Inputs:
genome: The genome to add. type: Genome
"""
for specie in current_genomes:
first = specie.get_champion()
if Speciation.compatibility_distance(genome, first) < Parameters.COMPATABILITY_THRESHOLD:
specie.add_genome(genome)
return
s = Species()
s.add_genome(genome)
current_genomes.append(s)
return
| 28.62 | 109 | 0.678546 |
96be495bd3261e63c1a53206e1ecae309a118594 | 387 | py | Python | container_service_extension/pksclient/api/__init__.py | tschoergez/container-service-extension | e1fbaf7e9c242a416d3f580880c1051286847cfd | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | container_service_extension/pksclient/api/__init__.py | tschoergez/container-service-extension | e1fbaf7e9c242a416d3f580880c1051286847cfd | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | container_service_extension/pksclient/api/__init__.py | tschoergez/container-service-extension | e1fbaf7e9c242a416d3f580880c1051286847cfd | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from container_service_extension.pksclient.api.cluster_api import ClusterApi
from container_service_extension.pksclient.api.plans_api import PlansApi
from container_service_extension.pksclient.api.profile_api import ProfileApi
from container_service_extension.pksclient.api.users_api import UsersApi
| 38.7 | 76 | 0.881137 |
96beda9b3aae1f2d6cee27edea34723ea5136c59 | 1,733 | py | Python | examples/applications/clustering/agglomerative.py | SahanJayasinghe/sentence-transformers | 0ec07c6b2a996a5998129d2168ccafface49877a | [
"Apache-2.0"
] | 2 | 2021-08-24T13:28:33.000Z | 2021-08-24T13:28:42.000Z | examples/applications/clustering/agglomerative.py | SahanJayasinghe/sentence-transformers | 0ec07c6b2a996a5998129d2168ccafface49877a | [
"Apache-2.0"
] | null | null | null | examples/applications/clustering/agglomerative.py | SahanJayasinghe/sentence-transformers | 0ec07c6b2a996a5998129d2168ccafface49877a | [
"Apache-2.0"
] | null | null | null | """
This is a simple application for sentence embeddings: clustering
Sentences are mapped to sentence embeddings and then agglomerative clustering with a threshold is applied.
"""
from sentence_transformers import SentenceTransformer
from sklearn.cluster import AgglomerativeClustering
import numpy as np
embedder = SentenceTransformer('paraphrase-MiniLM-L6-v2')
# Corpus with example sentences
corpus = ['A man is eating food.',
'A man is eating a piece of bread.',
'A man is eating pasta.',
'The girl is carrying a baby.',
'The baby is carried by the woman',
'A man is riding a horse.',
'A man is riding a white horse on an enclosed ground.',
'A monkey is playing drums.',
'Someone in a gorilla costume is playing a set of drums.',
'A cheetah is running behind its prey.',
'A cheetah chases prey on across a field.'
]
corpus_embeddings = embedder.encode(corpus)
# Normalize the embeddings to unit length
corpus_embeddings = corpus_embeddings / np.linalg.norm(corpus_embeddings, axis=1, keepdims=True)
# Perform kmean clustering
clustering_model = AgglomerativeClustering(n_clusters=None, distance_threshold=1.5) #, affinity='cosine', linkage='average', distance_threshold=0.4)
clustering_model.fit(corpus_embeddings)
cluster_assignment = clustering_model.labels_
clustered_sentences = {}
for sentence_id, cluster_id in enumerate(cluster_assignment):
if cluster_id not in clustered_sentences:
clustered_sentences[cluster_id] = []
clustered_sentences[cluster_id].append(corpus[sentence_id])
for i, cluster in clustered_sentences.items():
print("Cluster ", i+1)
print(cluster)
print("")
| 37.673913 | 148 | 0.725332 |
96bee57e7d78263abb2c0dde497d36d9e3def948 | 1,364 | py | Python | generated-libraries/python/netapp/vserver/vserver_aggr_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | 2 | 2017-03-28T15:31:26.000Z | 2018-08-16T22:15:18.000Z | generated-libraries/python/netapp/vserver/vserver_aggr_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | null | null | null | generated-libraries/python/netapp/vserver/vserver_aggr_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | null | null | null | from netapp.netapp_object import NetAppObject
| 26.230769 | 91 | 0.577713 |
96bfcdd0287b23d40e6c42cd64034c753cbc7300 | 133 | py | Python | sample4.py | vswamy/python | 51835bf7cfec894059a41f2929509026fe611119 | [
"Apache-2.0"
] | null | null | null | sample4.py | vswamy/python | 51835bf7cfec894059a41f2929509026fe611119 | [
"Apache-2.0"
] | null | null | null | sample4.py | vswamy/python | 51835bf7cfec894059a41f2929509026fe611119 | [
"Apache-2.0"
] | null | null | null | #Learning Python
import os
list = [1,2,3]
##using list as a queue
print(list)
list.pop(0)
print(list)
list.append(5)
print(list)
| 9.5 | 23 | 0.691729 |
7367174cab478d0699640581faa954e034871a9e | 3,199 | py | Python | python/hongong/ch05/05_2.py | gangserver/py_test | 869bdfa5c94c3b6a15b87e0c3de6b2cdaca821f4 | [
"Apache-2.0"
] | null | null | null | python/hongong/ch05/05_2.py | gangserver/py_test | 869bdfa5c94c3b6a15b87e0c3de6b2cdaca821f4 | [
"Apache-2.0"
] | null | null | null | python/hongong/ch05/05_2.py | gangserver/py_test | 869bdfa5c94c3b6a15b87e0c3de6b2cdaca821f4 | [
"Apache-2.0"
] | null | null | null | import pandas as pd
wine = pd.read_csv('https://bit.ly/wine-date')
# wine = pd.read_csv('../data/wine.csv')
print(wine.head())
data = wine[['alcohol', 'sugar', 'pH']].to_numpy()
target = wine['class'].to_numpy()
from sklearn.model_selection import train_test_split
train_input, test_input, train_target, test_target = train_test_split(data, target, test_size=0.2, random_state=42)
print(train_input.shape, test_input.shape)
sub_input, val_input, sub_target, val_target = train_test_split(train_input, train_target, test_size=0.2, random_state=42)
print(sub_input.shape, val_input.shape)
from sklearn.tree import DecisionTreeClassifier
dt = DecisionTreeClassifier(random_state=42)
dt.fit(sub_input, sub_target)
print(dt.score(sub_input, sub_target))
print(dt.score(val_input, val_target))
from sklearn.model_selection import cross_validate
scores = cross_validate(dt, train_input, train_target)
print(scores)
import numpy as np
print(np.mean(scores['test_score']))
from sklearn.model_selection import StratifiedKFold
scores = cross_validate(dt, train_input, train_target, cv=StratifiedKFold())
print(np.mean(scores['test_score']))
splitter = StratifiedKFold(n_splits=10, shuffle=True, random_state=42)
scores = cross_validate(dt, train_input, train_target, cv=splitter)
print(np.mean(scores['test_score']))
from sklearn.model_selection import GridSearchCV
params = {'min_impurity_decrease': [0.0001, 0.0002, 0.0003, 0.0004, 0.0005]}
gs = GridSearchCV(DecisionTreeClassifier(random_state=42), params, n_jobs=1)
gs.fit(train_input, train_target)
dt = gs.best_estimator_
print(dt.score(train_input, train_target))
print(gs.best_params_)
print(gs.cv_results_['mean_test_score'])
best_index = np.argmax(gs.cv_results_['mean_test_score'])
print(gs.cv_results_['params'][best_index])
params = {'min_impurity_decrease': np.arange(0.0001, 0.001, 0.0001),
'max_depth': range(5, 20, 1),
'min_samples_split': range(2, 100, 10)
}
gs = GridSearchCV(DecisionTreeClassifier(random_state=42), params, n_jobs=-1)
gs.fit(train_input, train_target)
print(gs.best_params_)
print(np.max(gs.cv_results_['mean_test_score']))
from scipy.stats import uniform, randint
rgen = randint(0, 10)
print(rgen.rvs(10))
print(np.unique(rgen.rvs(1000), return_counts=True))
ugen = uniform(0, 1)
print(ugen.rvs(10))
params = {'min_impurity_decrease': uniform(0.0001, 0.001),
'max_depth': randint(20, 50),
'min_samples_split': randint(2, 25),
'min_samples_leaf': randint(1, 25)
}
from sklearn.model_selection import RandomizedSearchCV
gs = RandomizedSearchCV(DecisionTreeClassifier(random_state=42), params, n_iter=100, n_jobs=-1, random_state=42)
gs.fit(train_input, train_target)
print(gs.best_params_)
print(np.max(gs.cv_results_['mean_test_score']))
dt = gs.best_estimator_
print(dt.score(test_input, test_target))
# Exam
gs = RandomizedSearchCV(DecisionTreeClassifier(splitter='random', random_state=42), params, n_iter=100, n_jobs=-1, random_state=42)
gs.fit(train_input, train_target)
print(gs.best_params_)
print(np.max(gs.cv_results_['mean_test_score']))
dt = gs.best_estimator_
print(dt.score(test_input, test_target))
| 28.81982 | 131 | 0.758987 |
73675fa4c6cc91d3e8f132bfb335856070974495 | 1,016 | py | Python | junk/dot_classifier_tf/potential.py | jpzwolak/quantum-ml | aebe3496516be3bc0fc4392aaf7805ab5faf98dc | [
"MIT"
] | 4 | 2018-06-27T17:20:19.000Z | 2021-05-30T06:21:01.000Z | junk/dot_classifier_tf/potential.py | jpzwolak/quantum-ml | aebe3496516be3bc0fc4392aaf7805ab5faf98dc | [
"MIT"
] | null | null | null | junk/dot_classifier_tf/potential.py | jpzwolak/quantum-ml | aebe3496516be3bc0fc4392aaf7805ab5faf98dc | [
"MIT"
] | 4 | 2018-11-30T20:34:17.000Z | 2022-02-16T23:06:37.000Z | # Module to build a potential landscape
import numpy as np
def gauss(x,mean=0.0,stddev=0.02,peak=1.0):
'''
Input:
x : x-coordintes
Output:
f(x) where f is a Gaussian with the given mean, stddev and peak value
'''
stddev = 5*(x[1] - x[0])
return peak*np.exp(-(x-mean)**2/(2*stddev**2))
def init_ndot(x,n_dot):
'''
Input:
x : 1d grid for the dots
ndot : number of dots
Output:
y : cordinates of the potential grid with ndots
The potential barriers are modelled as gaussians
'''
# n dots imply n+1 barriers
bar_centers = x[0] + (x[-1] - x[0])*np.random.rand(n_dot+1)
bar_heights = np.random.rand(n_dot+1)
#bar_heights = 0.5*np.ones(n_dot+1)
N = len(x)
y = np.zeros(N)
# no need to optimize here really since the dot number is generally small, the calculation of the gauss function is already done in a vectorised manner
for j in range(n_dot+1):
y += gauss(x-bar_centers[j],peak=bar_heights[j])
return y
| 27.459459 | 155 | 0.629921 |
73680345e2e353c1eaf1fb045f543678e6921793 | 878 | py | Python | src/data/879.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | src/data/879.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | src/data/879.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | from sys import stdin
input = stdin.readline
from collections import deque
N, Q = map(int, input().split())
tree = [[] for _ in range(N + 1)]
level = [0] * (N + 1)
for _ in range(N - 1):
a, b = map(int, input().split())
tree[a].append(b)
tree[b].append(a)
visited = [False] * (N + 1)
bfs(1)
for _ in range(Q):
x, y = map(int, input().split())
print(solve(x, y))
| 19.954545 | 45 | 0.490888 |
736815ffba5524694e4bf07787408fa70f5b7ab8 | 1,614 | py | Python | objectfactory/nested.py | devinaconley/py-object-factory | 6c97821feea8c47f7ad909cedbe57938c92761aa | [
"MIT"
] | 4 | 2019-05-28T15:20:35.000Z | 2022-03-18T20:53:57.000Z | objectfactory/nested.py | devinaconley/py-object-factory | 6c97821feea8c47f7ad909cedbe57938c92761aa | [
"MIT"
] | 3 | 2019-03-17T00:27:28.000Z | 2019-12-04T16:07:11.000Z | objectfactory/nested.py | devinaconley/py-object-factory | 6c97821feea8c47f7ad909cedbe57938c92761aa | [
"MIT"
] | null | null | null | """
nested field
implements marshmallow field for objectfactory nested objects
"""
# lib
import marshmallow
# src
from .serializable import Serializable
from .factory import create
| 26.032258 | 86 | 0.57311 |
7368bcef3513f858130a78b597825be9b12f3327 | 1,709 | py | Python | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 2 | 2017-06-23T20:54:31.000Z | 2022-01-06T08:11:49.000Z | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-03-01T19:01:37.000Z | 2021-03-01T19:01:37.000Z | spacy/cli/__init__.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-06-21T07:17:48.000Z | 2021-06-21T07:17:48.000Z | from wasabi import msg
from ._util import app, setup_cli # noqa: F401
# These are the actual functions, NOT the wrapped CLI commands. The CLI commands
# are registered automatically and won't have to be imported here.
from .download import download # noqa: F401
from .info import info # noqa: F401
from .package import package # noqa: F401
from .profile import profile # noqa: F401
from .train import train_cli # noqa: F401
from .pretrain import pretrain # noqa: F401
from .debug_data import debug_data # noqa: F401
from .debug_config import debug_config # noqa: F401
from .debug_model import debug_model # noqa: F401
from .evaluate import evaluate # noqa: F401
from .convert import convert # noqa: F401
from .init_pipeline import init_pipeline_cli # noqa: F401
from .init_config import init_config, fill_config # noqa: F401
from .validate import validate # noqa: F401
from .project.clone import project_clone # noqa: F401
from .project.assets import project_assets # noqa: F401
from .project.run import project_run # noqa: F401
from .project.dvc import project_update_dvc # noqa: F401
from .project.push import project_push # noqa: F401
from .project.pull import project_pull # noqa: F401
from .project.document import project_document # noqa: F401
| 44.973684 | 80 | 0.752487 |
73697b6fc24a0e06b73e768d5f059255782d3e66 | 490 | py | Python | code/example code/introducing-python-master/1st_edition/art/panda1.py | ChouHsuan-Cheng/Learning_Python_Base | 857873466463e6b20f24b1e8946c837c318f2536 | [
"CNRI-Python"
] | null | null | null | code/example code/introducing-python-master/1st_edition/art/panda1.py | ChouHsuan-Cheng/Learning_Python_Base | 857873466463e6b20f24b1e8946c837c318f2536 | [
"CNRI-Python"
] | null | null | null | code/example code/introducing-python-master/1st_edition/art/panda1.py | ChouHsuan-Cheng/Learning_Python_Base | 857873466463e6b20f24b1e8946c837c318f2536 | [
"CNRI-Python"
] | null | null | null | from direct.showbase.ShowBase import ShowBase
app = MyApp()
app.run()
| 27.222222 | 66 | 0.657143 |
736a64ec89b619ffc454f1a8592cdcb1f2263f5a | 16,104 | py | Python | btclib/ssa.py | giubby84/btclib | 0dd7e4e8ca43451a03b577fd7ec95715a1a21711 | [
"MIT"
] | null | null | null | btclib/ssa.py | giubby84/btclib | 0dd7e4e8ca43451a03b577fd7ec95715a1a21711 | [
"MIT"
] | null | null | null | btclib/ssa.py | giubby84/btclib | 0dd7e4e8ca43451a03b577fd7ec95715a1a21711 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (C) 2017-2020 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except according to the terms contained in the LICENSE file.
"""Elliptic Curve Schnorr Signature Algorithm (ECSSA).
This implementation is according to BIP340-Schnorr:
https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
Differently from ECDSA, the BIP340-Schnorr scheme supports
messages of size hsize only.
It also uses as public key the x-coordinate (field element)
of the curve point associated to the private key 0 < q < n.
Therefore, for sepcp256k1 the public key size is 32 bytes.
Arguably, the knowledge of q as the discrete logarithm of Q
also implies the knowledge of n-q as discrete logarithm of -Q.
As such, {q, n-q} can be considered a single private key and
{Q, -Q} the associated public key characterized by the shared x_Q.
Also, BIP340 advocates its own SHA256 modification as hash function:
TaggedHash(tag, x) = SHA256(SHA256(tag)||SHA256(tag)||x)
The rationale is to make BIP340 signatures invalid for anything else
but Bitcoin and vice versa.
TaggedHash is used for both the challenge (with tag 'BIPSchnorr')
and the deterministic nonce (with tag 'BIPSchnorrDerive').
To allow for secure batch verification of multiple signatures,
BIP340-Schnorr uses a challenge that prevents public key recovery
from signature: c = TaggedHash('BIPSchnorr', x_k||x_Q||msg).
A custom deterministic algorithm for the ephemeral key (nonce)
is used for signing, instead of the RFC6979 standard:
k = TaggedHash('BIPSchnorrDerive', q||msg)
Finally, BIP340-Schnorr adopts a robust [r][s] custom serialization
format, instead of the loosely specified ASN.1 DER standard.
The signature size is p-size*n-size, where p-size is the field element
(curve point coordinate) byte size and n-size is the scalar
(curve point multiplication coefficient) byte size.
For sepcp256k1 the resulting signature size is 64 bytes.
"""
import secrets
from hashlib import sha256
from typing import List, Optional, Sequence, Tuple, Union
from .alias import (
HashF,
Integer,
JacPoint,
Octets,
Point,
SSASig,
SSASigTuple,
String,
)
from .bip32 import BIP32Key
from .curve import Curve, secp256k1
from .curvegroup import _double_mult, _mult, _multi_mult
from .hashes import reduce_to_hlen
from .numbertheory import mod_inv
from .to_prvkey import PrvKey, int_from_prvkey
from .to_pubkey import point_from_pubkey
from .utils import bytes_from_octets, hex_string, int_from_bits
# TODO relax the p_ThreeModFour requirement
# hex-string or bytes representation of an int
# 33 or 65 bytes or hex-string
# BIP32Key as dict or String
# tuple Point
BIP340PubKey = Union[Integer, Octets, BIP32Key, Point]
def point_from_bip340pubkey(x_Q: BIP340PubKey, ec: Curve = secp256k1) -> Point:
"""Return a verified-as-valid BIP340 public key as Point tuple.
It supports:
- BIP32 extended keys (bytes, string, or BIP32KeyData)
- SEC Octets (bytes or hex-string, with 02, 03, or 04 prefix)
- BIP340 Octets (bytes or hex-string, p-size Point x-coordinate)
- native tuple
"""
# BIP 340 key as integer
if isinstance(x_Q, int):
y_Q = ec.y_quadratic_residue(x_Q, True)
return x_Q, y_Q
else:
# (tuple) Point, (dict or str) BIP32Key, or 33/65 bytes
try:
x_Q = point_from_pubkey(x_Q, ec)[0]
y_Q = ec.y_quadratic_residue(x_Q, True)
return x_Q, y_Q
except Exception:
pass
# BIP 340 key as bytes or hex-string
if isinstance(x_Q, (str, bytes)):
Q = bytes_from_octets(x_Q, ec.psize)
x_Q = int.from_bytes(Q, "big")
y_Q = ec.y_quadratic_residue(x_Q, True)
return x_Q, y_Q
raise ValueError("not a BIP340 public key")
def deserialize(sig: SSASig, ec: Curve = secp256k1) -> SSASigTuple:
"""Return the verified components of the provided BIP340 signature.
The BIP340 signature can be represented as (r, s) tuple
or as binary [r][s] compact representation.
"""
if isinstance(sig, tuple):
r, s = sig
else:
if isinstance(sig, str):
# hex-string of the serialized signature
sig2 = bytes.fromhex(sig)
else:
sig2 = bytes_from_octets(sig, ec.psize + ec.nsize)
r = int.from_bytes(sig2[: ec.psize], byteorder="big")
s = int.from_bytes(sig2[ec.nsize :], byteorder="big")
_validate_sig(r, s, ec)
return r, s
def serialize(x_K: int, s: int, ec: Curve = secp256k1) -> bytes:
"Return the BIP340 signature as [r][s] compact representation."
_validate_sig(x_K, s, ec)
return x_K.to_bytes(ec.psize, "big") + s.to_bytes(ec.nsize, "big")
def gen_keys(prvkey: PrvKey = None, ec: Curve = secp256k1) -> Tuple[int, int]:
"Return a BIP340 private/public (int, int) key-pair."
# BIP340 is defined for curves whose field prime p = 3 % 4
ec.require_p_ThreeModFour()
if prvkey is None:
q = 1 + secrets.randbelow(ec.n - 1)
else:
q = int_from_prvkey(prvkey, ec)
QJ = _mult(q, ec.GJ, ec)
x_Q = ec._x_aff_from_jac(QJ)
if not ec.has_square_y(QJ):
q = ec.n - q
return q, x_Q
# TODO move to hashes
# This implementation can be sped up by storing the midstate after hashing
# tag_hash instead of rehashing it all the time.
def _det_nonce(
m: Octets, prvkey: PrvKey, ec: Curve = secp256k1, hf: HashF = sha256
) -> Tuple[int, int]:
"""Return a BIP340 deterministic ephemeral key (nonce)."""
# The message m: a hlen array
hlen = hf().digest_size
m = bytes_from_octets(m, hlen)
q, _ = gen_keys(prvkey, ec)
return __det_nonce(m, q, ec, hf)
def det_nonce(
msg: String, prvkey: PrvKey, ec: Curve = secp256k1, hf: HashF = sha256
) -> Tuple[int, int]:
"""Return a BIP340 deterministic ephemeral key (nonce)."""
m = reduce_to_hlen(msg, hf)
return _det_nonce(m, prvkey, ec, hf)
def _sign(
m: Octets,
prvkey: PrvKey,
k: Optional[PrvKey] = None,
ec: Curve = secp256k1,
hf: HashF = sha256,
) -> SSASigTuple:
"""Sign message according to BIP340 signature algorithm."""
# BIP340 is defined for curves whose field prime p = 3 % 4
ec.require_p_ThreeModFour()
# The message m: a hlen array
hlen = hf().digest_size
m = bytes_from_octets(m, hlen)
q, x_Q = gen_keys(prvkey, ec)
# The nonce k: an integer in the range 1..n-1.
k, x_K = __det_nonce(m, q, ec, hf) if k is None else gen_keys(k, ec)
# Let c = int(hf(bytes(x_K) || bytes(x_Q) || m)) mod n.
c = __challenge(m, x_Q, x_K, ec, hf)
return __sign(c, q, k, x_K, ec)
def sign(
msg: String,
prvkey: PrvKey,
k: Optional[PrvKey] = None,
ec: Curve = secp256k1,
hf: HashF = sha256,
) -> SSASigTuple:
"""Sign message according to BIP340 signature algorithm.
The message msg is first processed by hf, yielding the value
m = hf(msg),
a sequence of bits of length *hlen*.
Normally, hf is chosen such that its output length *hlen* is
roughly equal to *nlen*, the bit-length of the group order *n*,
since the overall security of the signature scheme will depend on
the smallest of *hlen* and *nlen*; however, ECSSA
supports all combinations of *hlen* and *nlen*.
"""
m = reduce_to_hlen(msg, hf)
return _sign(m, prvkey, k, ec, hf)
def _verify(
m: Octets, Q: BIP340PubKey, sig: SSASig, ec: Curve = secp256k1, hf: HashF = sha256
) -> bool:
"""Verify the BIP340 signature of the provided message."""
# try/except wrapper for the Errors raised by _assert_as_valid
try:
_assert_as_valid(m, Q, sig, ec, hf)
except Exception:
return False
else:
return True
def verify(
msg: String, Q: BIP340PubKey, sig: SSASig, ec: Curve = secp256k1, hf: HashF = sha256
) -> bool:
"""ECDSA signature verification (SEC 1 v.2 section 4.1.4)."""
m = reduce_to_hlen(msg, hf)
return _verify(m, Q, sig, ec, hf)
# FIXME add crack_prvkey
def batch_verify(
m: Sequence[Octets],
Q: Sequence[BIP340PubKey],
sig: Sequence[SSASig],
ec: Curve = secp256k1,
hf: HashF = sha256,
) -> bool:
"""Batch verification of BIP340 signatures."""
# try/except wrapper for the Errors raised by _batch_verify
try:
_batch_verify(m, Q, sig, ec, hf)
except Exception:
return False
else:
return True
| 30.442344 | 88 | 0.648162 |
736b9802fb2c5a179b409bf71bdd9ff72225db52 | 998 | py | Python | 13. REST API using OpenAPI, Flask & Connexions/source_code/test-api/src/test_api/core/pets.py | Edmartt/articles | 93d62086ff141f5646193afb868973e94f33f1e6 | [
"MIT"
] | 31 | 2020-03-01T20:27:03.000Z | 2022-02-15T14:53:09.000Z | 13. REST API using OpenAPI, Flask & Connexions/source_code/test-api/src/test_api/core/pets.py | hmajid2301/articles | 27f38cc6c2dd470d879b30d54d1e804a7d76caab | [
"MIT"
] | 24 | 2020-04-04T12:18:25.000Z | 2022-03-29T08:41:57.000Z | 13. REST API using OpenAPI, Flask & Connexions/source_code/test-api/src/test_api/core/pets.py | Edmartt/articles | 93d62086ff141f5646193afb868973e94f33f1e6 | [
"MIT"
] | 52 | 2020-02-29T04:01:10.000Z | 2022-03-11T07:54:16.000Z | import json
| 19.96 | 77 | 0.603206 |
736eb235587fea9084624307afb075d1bfa93603 | 5,582 | py | Python | car-number-plate.project/car number plate.py | SumanthKumarS/mrucode-car-numberplate-detection- | 46f759a5dec01ee551080db68ca250b064a25a01 | [
"Apache-2.0"
] | null | null | null | car-number-plate.project/car number plate.py | SumanthKumarS/mrucode-car-numberplate-detection- | 46f759a5dec01ee551080db68ca250b064a25a01 | [
"Apache-2.0"
] | null | null | null | car-number-plate.project/car number plate.py | SumanthKumarS/mrucode-car-numberplate-detection- | 46f759a5dec01ee551080db68ca250b064a25a01 | [
"Apache-2.0"
] | null | null | null | import matplotlib.pyplot as plt
import cv2
import imutils
import pytesseract as pt
from tkinter import *
from tkinter import messagebox
# ploting the images
# read the image using numpy
print("\n1.car-1\n2.car-2\n3.car-3")
a = int(input("Enter the choice of car : "))
if a == 1:
path = "./image/a.jpg"
elif a == 2:
path = "./image/b.jpg"
else:
path = "./image/c.jpg"
image = cv2.imread(path)
# resizing the image
image = imutils.resize(image, width=500)
cv2.imshow("original image", image)
# delaying the next image till this image gets closed
cv2.waitKey(8000) #delaying till 5 sec
cv2.destroyAllWindows()
plot_img(image, image, title1="original1", title2="original1")
# image color to gray
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
plot_img(image, gray, title1="original1", title2="gray")
cv2.imshow('gray image', gray)
cv2.waitKey(8000)
cv2.destroyAllWindows()
# Noise removal with iterative bilateral filters(which removes the noise while filtering the edges)
blur = cv2.bilateralFilter(gray, 11, 90, 90)
plot_img(gray, blur, title1="gray", title2="Blur")
cv2.imshow("blurred image:", blur)
cv2.waitKey(8000)
cv2.destroyAllWindows()
# blurring the edges of grayscale image
edges = cv2.Canny(blur, 30, 200)
plot_img(blur, edges, title1="Blur", title2="Edges")
cv2.imshow("canny image:", edges)
cv2.waitKey(8000)
cv2.destroyAllWindows()
# Finding the contours based edges
cnts, new = cv2.findContours(edges.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
# coping the image as secondary
image_copy = image.copy()
# Drawing all the contours edges of the original image
_ = cv2.drawContours(image_copy, cnts, -1, (255, 0, 255), 2)
plot_img(edges, image_copy, title1="Edges", title2="Contours")
cv2.imshow("contours image:", image_copy)
cv2.waitKey(8000)
cv2.destroyAllWindows()
print("number of iteration of draw counter has passed: ", len(cnts))
# sort the contours keeping the minimum area as 30
cnts = sorted(cnts, key=cv2.contourArea, reverse=True)[:30]
image_reduce_cnts = image.copy()
_ = cv2.drawContours(image_reduce_cnts, cnts, -1, (255, 0, 255), 2)
plot_img(image_copy, image_reduce_cnts , title1="Contours", title2="Reduced")
cv2.imshow("reduced image:" , image_reduce_cnts)
cv2.waitKey(8000)
cv2.destroyAllWindows()
print("number of iteration passed by reducing the edges : ", len(cnts))
plate = None
for c in cnts:
perimeter = cv2.arcLength(c, True)
edges_count = cv2.approxPolyDP(c, 0.02 * perimeter , True)
if len(edges_count) == 4 :
x, y, w, h = cv2.boundingRect(c)
plate = image[y:y + h, x:x + w]
break
cv2.imwrite("plate.png", plate)
plot_img(plate, plate, title1="plate", title2="plate")
cv2.imshow("Number Plate Image : ", plate)
cv2.waitKey(8000)
cv2.destroyAllWindows()
pt.pytesseract.tesseract_cmd = r'C:\Users\admin\AppData\Local\Tesseract.exe'
no_plate = pt.image_to_string(plate, lang='eng')
print("the number plate of car is: ", no_plate)
# creating Tk window
root = Tk()
# setting geometry of tk window
root.geometry('500x350+100+200')
#title of project
root.title('Car Number Plate Detector - (owner file address)')
# Back ground colour
root.config(bg="dark orange")
# Lay out widgets
root.grid_columnconfigure(1, weight=1)
root.grid_rowconfigure(1, weight=1)
inputNumber = StringVar()
var = StringVar()
input_label = Label(root, text="car plate number", font=("times new roman", 20, "bold"), bg="white", fg="green", background="#09A3BA", foreground="#FFF").place(x=150,y=40)
input_entry = Entry(root, textvariable=inputNumber, font=("times new roman", 15), bg="lightgray")
input_entry.grid(row=1, columnspan=2)
result_button = Button(root, text="Details", command=convert, font=("times new roman", 20, "bold"), bg="cyan")
result_button.grid(row=3, column=1)
root.mainloop() | 34.45679 | 172 | 0.682551 |
736ef7d551671fb41b699b2055b5a873b3f9d021 | 13,229 | py | Python | IBMWatson_Examples/WatsonNLU.py | sptennak/TextAnalytics | dde30337dc4d769ce7fb31b6f3021721bcd0b056 | [
"Apache-2.0"
] | 4 | 2018-07-11T06:58:53.000Z | 2020-09-06T13:17:54.000Z | IBMWatson_Examples/WatsonNLU.py | sptennak/TextAnalytics | dde30337dc4d769ce7fb31b6f3021721bcd0b056 | [
"Apache-2.0"
] | null | null | null | IBMWatson_Examples/WatsonNLU.py | sptennak/TextAnalytics | dde30337dc4d769ce7fb31b6f3021721bcd0b056 | [
"Apache-2.0"
] | 1 | 2020-09-06T13:18:00.000Z | 2020-09-06T13:18:00.000Z | # -*- coding: utf-8 -*-
"""
Created on Fri May 18 22:15:35 2018
@author: Sumudu Tennakoon
References:
[1] https://www.ibm.com/watson/developercloud/natural-language-understanding/api/v1/
"""
from watson_developer_cloud import NaturalLanguageUnderstandingV1, WatsonException, WatsonApiException
from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions, RelationsOptions
import pandas as pd
import numpy as np
from timeit import default_timer as timer
import multiprocessing
import sys
###############################################################################
###############################################################################
###############################################################################
# GUI
###############################################################################
import tkinter as tk #(https://wiki.python.org/moin/TkInter)
from tkinter import filedialog
from tkinter import scrolledtext
import configparser #(https://docs.python.org/3.4/library/configparser.html)
import traceback
root = tk.Tk()
AppWindow = ApplicationWindow(master=root)
AppWindow.master.title('IBM Watson Natural Language Processing')
#AppWindow.master.maxsize(1024, 768)
AppWindow.mainloop()
| 45.150171 | 205 | 0.595434 |
7370be693eff3bd55bdb03b72b2306e42f8caced | 6,813 | py | Python | invenio_drafts_resources/resources/records/resource.py | fenekku/invenio-drafts-resources | fadae86fb9b36073cef13713fbc174ef771e49ec | [
"MIT"
] | null | null | null | invenio_drafts_resources/resources/records/resource.py | fenekku/invenio-drafts-resources | fadae86fb9b36073cef13713fbc174ef771e49ec | [
"MIT"
] | null | null | null | invenio_drafts_resources/resources/records/resource.py | fenekku/invenio-drafts-resources | fadae86fb9b36073cef13713fbc174ef771e49ec | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Invenio-Drafts-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Invenio Drafts Resources module to create REST APIs."""
import marshmallow as ma
from flask import g
from flask_resources import JSONSerializer, ResponseHandler, \
resource_requestctx, response_handler, route, with_content_negotiation
from invenio_records_resources.resources import \
RecordResource as RecordResourceBase
from invenio_records_resources.resources.records.resource import \
request_data, request_headers, request_read_args, request_search_args, \
request_view_args
from invenio_records_resources.resources.records.utils import es_preference
from .errors import RedirectException
| 31.541667 | 77 | 0.60957 |
73719b129e4d31a646493cafb373317395215b7e | 56,465 | py | Python | pyscreener/preprocessing/gypsum_dl/Steps/SMILES/dimorphite_dl/dimorphite_dl.py | futianfan/pyscreener | 15cce4ca8002ba083254aefa716d0e9c3ef00dba | [
"MIT"
] | 28 | 2020-12-11T22:10:16.000Z | 2022-02-25T05:00:51.000Z | molpal/objectives/pyscreener/preprocessing/gypsum_dl/Steps/SMILES/dimorphite_dl/dimorphite_dl.py | ashuein/molpal | 1e17a0c406516ceaeaf273a6983d06206bcfe76f | [
"MIT"
] | 3 | 2021-09-17T14:14:53.000Z | 2021-09-23T11:04:10.000Z | molpal/objectives/pyscreener/preprocessing/gypsum_dl/Steps/SMILES/dimorphite_dl/dimorphite_dl.py | ashuein/molpal | 1e17a0c406516ceaeaf273a6983d06206bcfe76f | [
"MIT"
] | 9 | 2021-03-03T12:10:10.000Z | 2022-02-15T06:53:11.000Z | # Copyright 2020 Jacob D. Durrant
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This script identifies and enumerates the possible protonation sites of SMILES
strings.
"""
from __future__ import print_function
import copy
import os
import argparse
import sys
try:
# Python2
from StringIO import StringIO
except ImportError:
# Python3
from io import StringIO
def print_header():
"""Prints out header information."""
# Always let the user know a help file is available.
print("\nFor help, use: python dimorphite_dl.py --help")
# And always report citation information.
print("\nIf you use Dimorphite-DL in your research, please cite:")
print("Ropp PJ, Kaminsky JC, Yablonski S, Durrant JD (2019) Dimorphite-DL: An")
print(
"open-source program for enumerating the ionization states of drug-like small"
)
print("molecules. J Cheminform 11:14. doi:10.1186/s13321-019-0336-9.\n")
try:
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
# Disable the unnecessary RDKit warnings
from rdkit import RDLogger
RDLogger.DisableLog("rdApp.*")
except:
msg = "Dimorphite-DL requires RDKit. See https://www.rdkit.org/"
print(msg)
raise Exception(msg)
def main(params=None):
"""The main definition run when you call the script from the commandline.
:param params: The parameters to use. Entirely optional. If absent,
defaults to None, in which case argments will be taken from
those given at the command line.
:param params: dict, optional
:return: Returns a list of the SMILES strings return_as_list parameter is
True. Otherwise, returns None.
"""
parser = ArgParseFuncs.get_args()
args = vars(parser.parse_args())
if not args["silent"]:
print_header()
# Add in any parameters in params.
if params is not None:
for k, v in params.items():
args[k] = v
# If being run from the command line, print out all parameters.
if __name__ == "__main__":
if not args["silent"]:
print("\nPARAMETERS:\n")
for k in sorted(args.keys()):
print(k.rjust(13) + ": " + str(args[k]))
print("")
if args["test"]:
# Run tests.
TestFuncs.test()
else:
# Run protonation
if "output_file" in args and args["output_file"] is not None:
# An output file was specified, so write to that.
with open(args["output_file"], "w") as file:
for protonated_smi in Protonate(args):
file.write(protonated_smi + "\n")
elif "return_as_list" in args and args["return_as_list"] == True:
return list(Protonate(args))
else:
# No output file specified. Just print it to the screen.
for protonated_smi in Protonate(args):
print(protonated_smi)
def run(**kwargs):
"""A helpful, importable function for those who want to call Dimorphite-DL
from another Python script rather than the command line. Note that this
function accepts keyword arguments that match the command-line parameters
exactly. If you want to pass and return a list of RDKit Mol objects, import
run_with_mol_list() instead.
:param **kwargs: For a complete description, run dimorphite_dl.py from the
command line with the -h option.
:type kwargs: dict
"""
# Run the main function with the specified arguments.
main(kwargs)
def run_with_mol_list(mol_lst, **kwargs):
"""A helpful, importable function for those who want to call Dimorphite-DL
from another Python script rather than the command line. Note that this
function is for passing Dimorphite-DL a list of RDKit Mol objects, together
with command-line parameters. If you want to use only the same parameters
that you would use from the command line, import run() instead.
:param mol_lst: A list of rdkit.Chem.rdchem.Mol objects.
:type mol_lst: list
:raises Exception: If the **kwargs includes "smiles", "smiles_file",
"output_file", or "test" parameters.
:return: A list of properly protonated rdkit.Chem.rdchem.Mol objects.
:rtype: list
"""
# Do a quick check to make sure the user input makes sense.
for bad_arg in ["smiles", "smiles_file", "output_file", "test"]:
if bad_arg in kwargs:
msg = (
"You're using Dimorphite-DL's run_with_mol_list(mol_lst, "
+ '**kwargs) function, but you also passed the "'
+ bad_arg
+ '" argument. Did you mean to use the '
+ "run(**kwargs) function instead?"
)
UtilFuncs.eprint(msg)
raise Exception(msg)
# Set the return_as_list flag so main() will return the protonated smiles
# as a list.
kwargs["return_as_list"] = True
# Having reviewed the code, it will be very difficult to rewrite it so
# that a list of Mol objects can be used directly. Intead, convert this
# list of mols to smiles and pass that. Not efficient, but it will work.
protonated_smiles_and_props = []
for m in mol_lst:
props = m.GetPropsAsDict()
kwargs["smiles"] = Chem.MolToSmiles(m, isomericSmiles=True)
protonated_smiles_and_props.extend(
[(s.split("\t")[0], props) for s in main(kwargs)]
)
# Now convert the list of protonated smiles strings back to RDKit Mol
# objects. Also, add back in the properties from the original mol objects.
mols = []
for s, props in protonated_smiles_and_props:
m = Chem.MolFromSmiles(s)
if m:
for prop, val in props.items():
if type(val) is int:
m.SetIntProp(prop, val)
elif type(val) is float:
m.SetDoubleProp(prop, val)
elif type(val) is bool:
m.SetBoolProp(prop, val)
else:
m.SetProp(prop, str(val))
mols.append(m)
else:
UtilFuncs.eprint(
"WARNING: Could not process molecule with SMILES string "
+ s
+ " and properties "
+ str(props)
)
return mols
if __name__ == "__main__":
main()
| 38.860977 | 209 | 0.535819 |
73722b13a366409a78c447bdbc55cbb010f2c490 | 568 | py | Python | src/visuanalytics/tests/analytics/transform/transform_test_helper.py | mxsph/Data-Analytics | c82ff54b78f50b6660d7640bfee96ea68bef598f | [
"MIT"
] | 3 | 2020-08-24T19:02:09.000Z | 2021-05-27T20:22:41.000Z | src/visuanalytics/tests/analytics/transform/transform_test_helper.py | mxsph/Data-Analytics | c82ff54b78f50b6660d7640bfee96ea68bef598f | [
"MIT"
] | 342 | 2020-08-13T10:24:23.000Z | 2021-08-12T14:01:52.000Z | src/visuanalytics/tests/analytics/transform/transform_test_helper.py | visuanalytics/visuanalytics | f9cce7bc9e3227568939648ddd1dd6df02eac752 | [
"MIT"
] | 8 | 2020-09-01T07:11:18.000Z | 2021-04-09T09:02:11.000Z | from visuanalytics.analytics.control.procedures.step_data import StepData
from visuanalytics.analytics.transform.transform import transform
| 29.894737 | 73 | 0.721831 |
737252b8db4b5f48d4c98ee3b57ca3749e94a02f | 693 | py | Python | configs/diseased/resnet50_cancer_adddata.py | jiangwenj02/mmclassification | 4c3657c16f370ace9013b160aa054c87fd27a055 | [
"Apache-2.0"
] | null | null | null | configs/diseased/resnet50_cancer_adddata.py | jiangwenj02/mmclassification | 4c3657c16f370ace9013b160aa054c87fd27a055 | [
"Apache-2.0"
] | null | null | null | configs/diseased/resnet50_cancer_adddata.py | jiangwenj02/mmclassification | 4c3657c16f370ace9013b160aa054c87fd27a055 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py',
'../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py'
]
model = dict(
head=dict(
num_classes=2,
topk=(1,))
)
data = dict(
train=dict(
data_prefix='/data3/zzhang/tmp/classification/train'),
val=dict(
data_prefix='/data3/zzhang/tmp/classification/test'),
test=dict(
data_prefix='/data3/zzhang/tmp/classification/test'))
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
load_from = 'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_batch256_imagenet_20200708-cfb998bf.pth' | 34.65 | 121 | 0.689755 |
7373df1f357495c213b36ad2e30241e90eab5f96 | 4,907 | py | Python | polyaxon/scheduler/dockerizer_scheduler.py | vfdev-5/polyaxon | 3e1511a993dc1a03e0a0827de0357f4adcc0015f | [
"MIT"
] | null | null | null | polyaxon/scheduler/dockerizer_scheduler.py | vfdev-5/polyaxon | 3e1511a993dc1a03e0a0827de0357f4adcc0015f | [
"MIT"
] | null | null | null | polyaxon/scheduler/dockerizer_scheduler.py | vfdev-5/polyaxon | 3e1511a993dc1a03e0a0827de0357f4adcc0015f | [
"MIT"
] | null | null | null | import logging
import traceback
from kubernetes.client.rest import ApiException
from django.conf import settings
import auditor
from constants.jobs import JobLifeCycle
from db.models.build_jobs import BuildJob
from docker_images.image_info import get_tagged_image
from event_manager.events.build_job import BUILD_JOB_STARTED, BUILD_JOB_STARTED_TRIGGERED
from libs.paths.exceptions import VolumeNotFoundError
from scheduler.spawners.dockerizer_spawner import DockerizerSpawner
from scheduler.spawners.utils import get_job_definition
_logger = logging.getLogger('polyaxon.scheduler.dockerizer')
def create_build_job(user, project, config, code_reference):
"""Get or Create a build job based on the params.
If a build job already exists, then we check if the build has already an image created.
If the image does not exists, and the job is already done we force create a new job.
Returns:
tuple: (build_job, image_exists[bool], build_status[bool])
"""
build_job, rebuild = BuildJob.create(
user=user,
project=project,
config=config,
code_reference=code_reference)
if build_job.succeeded and not rebuild:
# Check if image was built in less than an 6 hours
return build_job, True, False
if check_image(build_job=build_job):
# Check if image exists already
return build_job, True, False
if build_job.is_done:
build_job, _ = BuildJob.create(
user=user,
project=project,
config=config,
code_reference=code_reference,
nocache=True)
if not build_job.is_running:
# We need to build the image first
auditor.record(event_type=BUILD_JOB_STARTED_TRIGGERED,
instance=build_job,
actor_id=user.id,
actor_name=user.username)
build_status = start_dockerizer(build_job=build_job)
else:
build_status = True
return build_job, False, build_status
| 34.801418 | 99 | 0.648665 |
737528bac9620b8ee07a8513acd084d73b0adc0c | 9,587 | py | Python | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 16 | 2018-09-12T02:50:28.000Z | 2021-08-20T08:38:31.000Z | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 21 | 2018-11-29T06:41:08.000Z | 2022-01-18T13:27:38.000Z | test/test_pyini.py | limodou/uliweb3 | 560fe818047c8ee8b4b775e714d9c637f0d23651 | [
"BSD-2-Clause"
] | 1 | 2018-10-08T10:02:56.000Z | 2018-10-08T10:02:56.000Z | #coding=utf8
from uliweb.utils.pyini import *
def test_sorteddict():
"""
>>> d = SortedDict()
>>> d
<SortedDict {}>
>>> d.name = 'limodou'
>>> d['class'] = 'py'
>>> d
<SortedDict {'class':'py', 'name':'limodou'}>
>>> d.keys()
['name', 'class']
>>> d.values()
['limodou', 'py']
>>> d['class']
'py'
>>> d.name
'limodou'
>>> d.get('name', 'default')
'limodou'
>>> d.get('other', 'default')
'default'
>>> 'name' in d
True
>>> 'other' in d
False
>>> print (d.other)
None
>>> try:
... d['other']
... except Exception as e:
... print (e)
'other'
>>> del d['class']
>>> del d['name']
>>> d
<SortedDict {}>
>>> d['name'] = 'limodou'
>>> d.pop('other', 'default')
'default'
>>> d.pop('name')
'limodou'
>>> d
<SortedDict {}>
>>> d.update({'class':'py', 'attribute':'border'})
>>> d
<SortedDict {'attribute':'border', 'class':'py'}>
"""
def test_section():
"""
>>> s = Section('default', "#comment")
>>> print (s)
#comment
[default]
<BLANKLINE>
>>> s.name = 'limodou'
>>> s.add_comment('name', '#name')
>>> s.add_comment(comments='#change')
>>> print (s)
#change
[default]
#name
name = 'limodou'
<BLANKLINE>
>>> del s.name
>>> print (s)
#change
[default]
<BLANKLINE>
"""
def test_ini1():
"""
>>> x = Ini()
>>> s = x.add('default')
>>> print (x)
#coding=utf-8
[default]
<BLANKLINE>
>>> s['abc'] = 'name'
>>> print (x)
#coding=utf-8
[default]
abc = 'name'
<BLANKLINE>
"""
def test_ini2():
"""
>>> x = Ini()
>>> x['default'] = Section('default', "#comment")
>>> x.default.name = 'limodou'
>>> x.default['class'] = 'py'
>>> x.default.list = ['abc']
>>> print (x)
#coding=utf-8
#comment
[default]
name = 'limodou'
class = 'py'
list = ['abc']
<BLANKLINE>
>>> x.default.list = ['cde'] #for mutable object will merge the data, including dict type
>>> print (x.default.list)
['abc', 'cde']
>>> x.default.d = {'a':'a'}
>>> x.default.d = {'b':'b'}
>>> print (x.default.d)
{'a': 'a', 'b': 'b'}
"""
def test_gettext():
"""
>>> from uliweb.i18n import gettext_lazy as _
>>> x = Ini(env={'_':_})
>>> x['default'] = Section('default')
>>> x.default.option = _('Hello')
>>> x.keys()
['_', 'gettext_lazy', 'set', 'default']
"""
def test_replace():
"""
>>> x = Ini()
>>> x['default'] = Section('default')
>>> x.default.option = ['a']
>>> x.default.option
['a']
>>> x.default.option = ['b']
>>> x.default.option
['a', 'b']
>>> x.default.add('option', ['c'], replace=True)
>>> x.default.option
['c']
>>> print (x.default)
[default]
option <= ['c']
<BLANKLINE>
"""
def test_set_var():
"""
>>> x = Ini()
>>> x.set_var('default/key', 'name')
True
>>> print (x)
#coding=utf-8
[default]
key = 'name'
<BLANKLINE>
>>> x.set_var('default/key/name', 'hello')
True
>>> print (x)
#coding=utf-8
[default]
key = 'name'
key/name = 'hello'
<BLANKLINE>
>>> x.get_var('default/key')
'name'
>>> x.get_var('default/no')
>>> x.get_var('defaut/no', 'no')
'no'
>>> x.del_var('default/key')
True
>>> print (x)
#coding=utf-8
[default]
key/name = 'hello'
<BLANKLINE>
>>> x.get_var('default/key/name')
'hello'
>>> x.get_var('default')
<Section {'key/name':'hello'}>
"""
def test_update():
"""
>>> x = Ini()
>>> x.set_var('default/key', 'name')
True
>>> d = {'default/key':'limodou', 'default/b':123}
>>> x.update(d)
>>> print (x)
#coding=utf-8
[default]
key = 'limodou'
b = 123
<BLANKLINE>
"""
def test_uni_print():
"""
>>> a = ()
>>> uni_prt(a, 'utf-8')
'()'
>>> a = (1,2)
>>> uni_prt(a)
'(1, 2)'
"""
def test_triple_string():
"""
>>> from io import StringIO
>>> buf = StringIO(\"\"\"
... #coding=utf8
... [DEFAULT]
... a = '''hello
...
... '''
... \"\"\")
>>> x = Ini()
>>> x.read(buf)
>>> print (repr(x.DEFAULT.a))
'hello\\n\\u4e2d\\u6587\\n'
"""
def test_save():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor)
>>> buf = StringIO(\"\"\"
... [default]
... option = _('English')
... str = 'str'
... str1 = "str"
... float = 1.2
... int = 1
... list = [1, 'str', 0.12]
... dict = {'a':'b', 1:2}
... s = 'English'
... [other]
... option = 'default'
... options1 = '{{option}} xxx'
... options2 = '{{default.int}}'
... options3 = option
... options4 = '-- {{default.option}} --'
... options5 = '-- {{default.s}} --'
... options6 = 'English {{default.s}} --'
... options7 = default.str + default.str1
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = _('English')
str = 'str'
str1 = 'str'
float = 1.2
int = 1
list = [1, 'str', 0.12]
dict = {'a': 'b', 1: 2}
s = 'English'
[other]
option = 'default'
options1 = 'default xxx'
options2 = '1'
options3 = 'default'
options4 = '-- English --'
options5 = '-- English --'
options6 = 'English English --'
options7 = 'strstr'
<BLANKLINE>
"""
def test_merge_data():
"""
>>> from uliweb.utils.pyini import merge_data
>>> a = [[1,2,3], [2,3,4], [4,5]]
>>> b = [{'a':[1,2], 'b':{'a':[1,2]}}, {'a':[2,3], 'b':{'a':['b'], 'b':2}}]
>>> c = [set([1,2,3]), set([2,4])]
>>> print (merge_data(a))
[1, 2, 3, 4, 5]
>>> print (merge_data(b))
{'a': [1, 2, 3], 'b': {'a': [1, 2, 'b'], 'b': 2}}
>>> print (merge_data(c))
{1, 2, 3, 4}
>>> print (merge_data([2]))
2
"""
def test_lazy():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor, lazy=True)
>>> buf = StringIO(\"\"\"
... [default]
... option = _('English')
... str = 'str'
... str1 = "str"
... float = 1.2
... int = 1
... list = [1, 'str', 0.12]
... dict = {'a':'b', 1:2}
... s = 'English'
... [other]
... option = 'default'
... options1 = '{{option}} xxx'
... options2 = '{{default.int}}'
... options3 = option
... options4 = '-- {{default.option}} --'
... options5 = '-- {{default.s}} --'
... options6 = 'English {{default.s}} --'
... options7 = default.str + default.str1
... \"\"\")
>>> x.read(buf)
>>> x.freeze()
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = _('English')
str = 'str'
str1 = 'str'
float = 1.2
int = 1
list = [1, 'str', 0.12]
dict = {'a': 'b', 1: 2}
s = 'English'
[other]
option = 'default'
options1 = 'default xxx'
options2 = '1'
options3 = 'default'
options4 = '-- English --'
options5 = '-- English --'
options6 = 'English English --'
options7 = 'strstr'
<BLANKLINE>
"""
def test_multiple_read():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor, lazy=True)
>>> buf = StringIO(\"\"\"
... [default]
... option = 'abc'
... [other]
... option = default.option
... option1 = '{{option}} xxx'
... option2 = '{{default.option}}'
... option3 = '{{other.option}}'
... \"\"\")
>>> x.read(buf)
>>> buf1 = StringIO(\"\"\"
... [default]
... option = 'hello'
... \"\"\")
>>> x.read(buf1)
>>> x.freeze()
>>> print (x)
#coding=UTF-8
<BLANKLINE>
[default]
option = 'hello'
[other]
option = 'hello'
option1 = 'hello xxx'
option2 = 'hello'
option3 = 'hello'
<BLANKLINE>
"""
def test_chinese():
"""
>>> from uliweb.i18n import gettext_lazy as _, i18n_ini_convertor
>>> from io import StringIO
>>> x = Ini(env={'_':_}, convertors=i18n_ini_convertor)
>>> buf = StringIO(\"\"\"#coding=utf-8
... [default]
... option = ''
... option2 = _('')
... option3 = '{{option}}'
... [other]
... x = ' {{default.option}}'
... x1 = ' {{default.option}}'
... x2 = 'xbd {{default.option}}'
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=utf-8
[default]
option = ''
option2 = _('')
option3 = ''
[other]
x = ' '
x1 = ' '
x2 = 'xbd '
<BLANKLINE>
>>> print (repr(x.other.x1))
' '
>>> x.keys()
['_', 'gettext_lazy', 'set', 'default', 'other']
"""
def test_set():
"""
>>> from io import StringIO
>>> x = Ini()
>>> buf = StringIO(\"\"\"#coding=utf-8
... [default]
... set1 = {1,2,3}
... set2 = set([1,2,3])
... \"\"\")
>>> x.read(buf)
>>> print (x)
#coding=utf-8
[default]
set1 = {1, 2, 3}
set2 = {1, 2, 3}
<BLANKLINE>
>>> buf2 = StringIO(\"\"\"#coding=utf-8
... [default]
... set1 = {5,3}
... \"\"\")
>>> x.read(buf2)
>>> print (x.default.set1)
{1, 2, 3, 5}
"""
| 22.295349 | 93 | 0.456973 |
7375e7557e967afa603dac5a97005866394c65de | 797 | py | Python | src/game.py | cwainwright/think-inside-the-box | dd537e72229a42f8f5f7074151799d3b07dfdfbd | [
"MIT"
] | null | null | null | src/game.py | cwainwright/think-inside-the-box | dd537e72229a42f8f5f7074151799d3b07dfdfbd | [
"MIT"
] | null | null | null | src/game.py | cwainwright/think-inside-the-box | dd537e72229a42f8f5f7074151799d3b07dfdfbd | [
"MIT"
] | null | null | null | import threading
from queue import Queue
from blessed import Terminal
FPS = 60
| 24.90625 | 82 | 0.595985 |
73760d51c39df213af720ac9a7cf8ca846fad61d | 1,366 | py | Python | alice_scripts/skill.py | borzunov/alice_scripts | db4cd08226ae5429ec8083ffedc0edef8b44adeb | [
"MIT"
] | 27 | 2018-07-30T19:35:17.000Z | 2021-09-12T18:18:22.000Z | alice_scripts/skill.py | borzunov/alice_scripts | db4cd08226ae5429ec8083ffedc0edef8b44adeb | [
"MIT"
] | 2 | 2018-11-01T09:49:48.000Z | 2020-12-17T13:39:23.000Z | alice_scripts/skill.py | borzunov/alice_scripts | db4cd08226ae5429ec8083ffedc0edef8b44adeb | [
"MIT"
] | 7 | 2018-10-24T18:39:30.000Z | 2021-11-25T13:55:41.000Z | import logging
import threading
import flask
from .requests import Request
__all__ = ['Skill']
| 26.784314 | 64 | 0.572474 |
737c8fcb95ea540c79cfba48d2fa31a9bd9f57a9 | 1,227 | py | Python | src/main/fileextractors/fileextractor.py | michael-stanin/Subtitles-Distributor | e4638d952235f96276729239596dc31d9ccc2ee1 | [
"MIT"
] | 1 | 2017-06-03T19:42:05.000Z | 2017-06-03T19:42:05.000Z | src/main/fileextractors/fileextractor.py | michael-stanin/Subtitles-Distributor | e4638d952235f96276729239596dc31d9ccc2ee1 | [
"MIT"
] | null | null | null | src/main/fileextractors/fileextractor.py | michael-stanin/Subtitles-Distributor | e4638d952235f96276729239596dc31d9ccc2ee1 | [
"MIT"
] | null | null | null | import logging
from main.fileextractors.compressedfile import get_compressed_file
from main.utilities.fileutils import dir_path
from main.utilities.subtitlesadjuster import ArchiveAdjuster
| 35.057143 | 111 | 0.673187 |
7380bfdbf0d2f900bab496e56a02fad07f1e4ac8 | 476 | py | Python | cjson/body.py | tslight/cjson | 1ab08400347e5ff33d3efd9e9879a54a9066a80c | [
"0BSD"
] | null | null | null | cjson/body.py | tslight/cjson | 1ab08400347e5ff33d3efd9e9879a54a9066a80c | [
"0BSD"
] | null | null | null | cjson/body.py | tslight/cjson | 1ab08400347e5ff33d3efd9e9879a54a9066a80c | [
"0BSD"
] | null | null | null | import curses
from get_json import get_json
| 29.75 | 77 | 0.684874 |
7382da4a97a03a9bab8ad1771db18f2352be8d95 | 5,518 | py | Python | SDis_Self-Training/plotting/createScatterPlot.py | mgeorgati/DasymetricMapping | d87b97a076cca3e03286c6b27b118904e03315c0 | [
"BSD-3-Clause"
] | null | null | null | SDis_Self-Training/plotting/createScatterPlot.py | mgeorgati/DasymetricMapping | d87b97a076cca3e03286c6b27b118904e03315c0 | [
"BSD-3-Clause"
] | null | null | null | SDis_Self-Training/plotting/createScatterPlot.py | mgeorgati/DasymetricMapping | d87b97a076cca3e03286c6b27b118904e03315c0 | [
"BSD-3-Clause"
] | null | null | null | import sys, os, seaborn as sns, rasterio, pandas as pd
import numpy as np
import matplotlib.pyplot as plt
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from config.definitions import ROOT_DIR, ancillary_path, city,year
attr_value ="totalpop"
gtP = ROOT_DIR + "/Evaluation/{0}_groundTruth/{2}_{0}_{1}.tif".format(city,attr_value,year)
srcGT= rasterio.open(gtP)
popGT = srcGT.read(1)
print(popGT.min(),popGT.max(), popGT.mean())
#prP = ROOT_DIR + "/Evaluation/{0}/apcatbr/div_{0}_dissever01WIESMN_500_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value)
evalFiles = [#gtP,
#ROOT_DIR + "/Evaluation/{0}/aprf/dissever00/{0}_dissever00WIESMN_2018_ams_Dasy_aprf_p[1]_12AIL12_1IL_it10_{1}.tif".format(city,attr_value),
#ROOT_DIR + "/Evaluation/{0}/aprf/dissever01/{0}_dissever01WIESMN_100_2018_ams_DasyA_aprf_p[1]_12AIL12_13IL_it10_{1}.tif".format(city,attr_value),
#ROOT_DIR + "/Evaluation/{0}/apcatbr/{0}_dissever01WIESMN_100_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
#ROOT_DIR + "/Evaluation/{0}/apcatbr/{0}_dissever01WIESMN_250_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/{0}_dissever01WIESMN_500_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
]
evalFilesMAEbp = [ROOT_DIR + "/Evaluation/{0}/Pycno/mae_{0}_{2}_{0}_{1}_pycno.tif".format(city,attr_value,year),
ROOT_DIR + "/Evaluation/{0}/Dasy/mae_{0}_{2}_{0}_{1}_dasyWIESMN.tif".format(city,attr_value,year),
ROOT_DIR + "/Evaluation/{0}/aprf/dissever00/mae_{0}_dissever00WIESMN_2018_ams_Dasy_aprf_p[1]_12AIL12_1IL_it10_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/aprf/dissever01/mae_{0}_dissever01WIESMN_100_2018_ams_DasyA_aprf_p[1]_12AIL12_13IL_it10_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/mae_{0}_dissever01WIESMN_100_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/mae_{0}_dissever01WIESMN_250_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/mae_{0}_dissever01WIESMN_500_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/mae_{0}_dissever01WIESMN_250_2018_ams_DasyA_apcatbr_p[1]_3AIL5_12IL_it10_ag_{1}.tif".format(city,attr_value)]
evalFilesPEbp = [ROOT_DIR + "/Evaluation/{0}/Pycno/div_{0}_{2}_{0}_{1}_pycno.tif".format(city,attr_value,year),
ROOT_DIR + "/Evaluation/{0}/Dasy/div_{0}_{2}_{0}_{1}_dasyWIESMN.tif".format(city,attr_value,year),
ROOT_DIR + "/Evaluation/{0}/aprf/dissever00/div_{0}_dissever00WIESMN_2018_ams_Dasy_aprf_p[1]_12AIL12_1IL_it10_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/aprf/dissever01/div_{0}_dissever01WIESMN_100_2018_ams_DasyA_aprf_p[1]_12AIL12_13IL_it10_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/div_{0}_dissever01WIESMN_100_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/div_{0}_dissever01WIESMN_250_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value),
ROOT_DIR + "/Evaluation/{0}/apcatbr/div_{0}_dissever01WIESMN_500_2018_ams_DasyA_apcatbr_p[1]_12AIL12_12IL_it10_ag_{1}.tif".format(city,attr_value)]
for i in evalFiles:
scatterplot(i)
| 66.481928 | 237 | 0.702791 |
7382ea8531ce700712937018018e99ffb94c7c1d | 562 | py | Python | codepack/service/delivery_service/delivery_service.py | ihnokim/codepack | 9d043b2db977de503faf7f5f1370c1424c6cb19f | [
"MIT"
] | 2 | 2021-04-18T17:51:49.000Z | 2021-06-22T10:21:30.000Z | codepack/service/delivery_service/delivery_service.py | ihnokim/codepack | 9d043b2db977de503faf7f5f1370c1424c6cb19f | [
"MIT"
] | 24 | 2021-12-23T18:02:01.000Z | 2022-03-27T03:03:38.000Z | codepack/service/delivery_service/delivery_service.py | ihnokim/codepack | 9d043b2db977de503faf7f5f1370c1424c6cb19f | [
"MIT"
] | 1 | 2021-09-13T12:56:40.000Z | 2021-09-13T12:56:40.000Z | import abc
from codepack.service.service import Service
| 23.416667 | 65 | 0.658363 |
7386b0f7b4c54bd5b874bd75d2eaef2e32ff4344 | 23,056 | py | Python | nengo/tests/test_learning_rules.py | pedrombmachado/nengo | abc85e1a75ce2f980e19eef195d98081f95efd28 | [
"BSD-2-Clause"
] | null | null | null | nengo/tests/test_learning_rules.py | pedrombmachado/nengo | abc85e1a75ce2f980e19eef195d98081f95efd28 | [
"BSD-2-Clause"
] | null | null | null | nengo/tests/test_learning_rules.py | pedrombmachado/nengo | abc85e1a75ce2f980e19eef195d98081f95efd28 | [
"BSD-2-Clause"
] | null | null | null | import numpy as np
import pytest
import nengo
from nengo.builder import Builder
from nengo.builder.operator import Reset, Copy
from nengo.builder.signal import Signal
from nengo.dists import UniformHypersphere
from nengo.exceptions import ValidationError
from nengo.learning_rules import LearningRuleTypeParam, PES, BCM, Oja, Voja
from nengo.processes import WhiteSignal
from nengo.synapses import Alpha, Lowpass
def test_pes_transform(Simulator, seed, allclose):
"""Test behaviour of PES when function and transform both defined."""
n = 200
# error must be with respect to transformed vector (conn.size_out)
T = np.asarray([[0.5], [-0.5]]) # transform to output
m = nengo.Network(seed=seed)
with m:
u = nengo.Node(output=[1])
a = nengo.Ensemble(n, dimensions=1)
b = nengo.Node(size_in=2)
e = nengo.Node(size_in=1)
nengo.Connection(u, a)
learned_conn = nengo.Connection(
a,
b,
function=lambda x: [0],
transform=T,
learning_rule_type=nengo.PES(learning_rate=1e-3),
)
assert T.shape[0] == learned_conn.size_out
assert T.shape[1] == learned_conn.size_mid
nengo.Connection(b[0], e, synapse=None)
nengo.Connection(nengo.Node(output=-1), e)
nengo.Connection(e, learned_conn.learning_rule, transform=T, synapse=None)
p_b = nengo.Probe(b, synapse=0.05)
with Simulator(m) as sim:
sim.run(1.0)
tend = sim.trange() > 0.7
assert allclose(sim.data[p_b][tend], [1, -1], atol=1e-2)
def test_pes_multidim_error(Simulator, seed):
"""Test that PES works on error connections mapping from N to 1 dims.
Note that the transform is applied before the learning rule, so the error
signal should be 1-dimensional.
"""
with nengo.Network(seed=seed) as net:
err = nengo.Node(output=[0])
ens1 = nengo.Ensemble(20, 3)
ens2 = nengo.Ensemble(10, 1)
# Case 1: ens -> ens, weights=False
conn = nengo.Connection(
ens1,
ens2,
transform=np.ones((1, 3)),
solver=nengo.solvers.LstsqL2(weights=False),
learning_rule_type={"pes": nengo.PES()},
)
nengo.Connection(err, conn.learning_rule["pes"])
# Case 2: ens -> ens, weights=True
conn = nengo.Connection(
ens1,
ens2,
transform=np.ones((1, 3)),
solver=nengo.solvers.LstsqL2(weights=True),
learning_rule_type={"pes": nengo.PES()},
)
nengo.Connection(err, conn.learning_rule["pes"])
# Case 3: neurons -> ens
conn = nengo.Connection(
ens1.neurons,
ens2,
transform=np.ones((1, ens1.n_neurons)),
learning_rule_type={"pes": nengo.PES()},
)
nengo.Connection(err, conn.learning_rule["pes"])
with Simulator(net) as sim:
sim.run(0.01)
def test_pes_cycle(Simulator):
"""Test that PES works when connection output feeds back into error."""
with nengo.Network() as net:
a = nengo.Ensemble(10, 1)
b = nengo.Node(size_in=1)
c = nengo.Connection(a, b, synapse=None, learning_rule_type=nengo.PES())
nengo.Connection(b, c.learning_rule, synapse=None)
with Simulator(net):
# just checking that this builds without error
pass
def test_learningruletypeparam():
"""LearningRuleTypeParam must be one or many learning rules."""
inst = Test()
assert inst.lrp is None
inst.lrp = Oja()
assert isinstance(inst.lrp, Oja)
inst.lrp = [Oja(), Oja()]
for lr in inst.lrp:
assert isinstance(lr, Oja)
# Non-LR no good
with pytest.raises(ValueError):
inst.lrp = "a"
# All elements in list must be LR
with pytest.raises(ValueError):
inst.lrp = [Oja(), "a", Oja()]
def test_learningrule_attr(seed):
"""Test learning_rule attribute on Connection"""
with nengo.Network(seed=seed):
a, b, e = [nengo.Ensemble(10, 2) for i in range(3)]
T = np.ones((10, 10))
r1 = PES()
c1 = nengo.Connection(a.neurons, b.neurons, learning_rule_type=r1)
check_rule(c1.learning_rule, c1, r1)
r2 = [PES(), BCM()]
c2 = nengo.Connection(a.neurons, b.neurons, learning_rule_type=r2, transform=T)
assert isinstance(c2.learning_rule, list)
for rule, rule_type in zip(c2.learning_rule, r2):
check_rule(rule, c2, rule_type)
r3 = dict(oja=Oja(), bcm=BCM())
c3 = nengo.Connection(a.neurons, b.neurons, learning_rule_type=r3, transform=T)
assert isinstance(c3.learning_rule, dict)
assert set(c3.learning_rule) == set(r3) # assert same keys
for key in r3:
check_rule(c3.learning_rule[key], c3, r3[key])
def test_voja_encoders(Simulator, nl_nodirect, rng, seed, allclose):
"""Tests that voja changes active encoders to the input."""
n = 200
learned_vector = np.asarray([0.3, -0.4, 0.6])
learned_vector /= np.linalg.norm(learned_vector)
n_change = n // 2 # modify first half of the encoders
# Set the first half to always fire with random encoders, and the
# remainder to never fire due to their encoder's dot product with the input
intercepts = np.asarray([-1] * n_change + [0.99] * (n - n_change))
rand_encoders = UniformHypersphere(surface=True).sample(
n_change, len(learned_vector), rng=rng
)
encoders = np.append(rand_encoders, [-learned_vector] * (n - n_change), axis=0)
m = nengo.Network(seed=seed)
with m:
m.config[nengo.Ensemble].neuron_type = nl_nodirect()
u = nengo.Node(output=learned_vector)
x = nengo.Ensemble(
n,
dimensions=len(learned_vector),
intercepts=intercepts,
encoders=encoders,
max_rates=nengo.dists.Uniform(300.0, 400.0),
radius=2.0,
) # to test encoder scaling
conn = nengo.Connection(
u, x, synapse=None, learning_rule_type=Voja(learning_rate=1e-1)
)
p_enc = nengo.Probe(conn.learning_rule, "scaled_encoders")
p_enc_ens = nengo.Probe(x, "scaled_encoders")
with Simulator(m) as sim:
sim.run(1.0)
t = sim.trange()
tend = t > 0.5
# Voja's rule relies on knowing exactly how the encoders were scaled
# during the build process, because it modifies the scaled_encoders signal
# proportional to this factor. Therefore, we should check that its
# assumption actually holds.
encoder_scale = (sim.data[x].gain / x.radius)[:, np.newaxis]
assert allclose(sim.data[x].encoders, sim.data[x].scaled_encoders / encoder_scale)
# Check that the last half kept the same encoders throughout the simulation
assert allclose(sim.data[p_enc][0, n_change:], sim.data[p_enc][:, n_change:])
# and that they are also equal to their originally assigned value
assert allclose(
sim.data[p_enc][0, n_change:] / encoder_scale[n_change:], -learned_vector
)
# Check that the first half converged to the input
assert allclose(
sim.data[p_enc][tend, :n_change] / encoder_scale[:n_change],
learned_vector,
atol=0.01,
)
# Check that encoders probed from ensemble equal encoders probed from Voja
assert allclose(sim.data[p_enc], sim.data[p_enc_ens])
def test_voja_modulate(Simulator, nl_nodirect, seed, allclose):
"""Tests that voja's rule can be modulated on/off."""
n = 200
learned_vector = np.asarray([0.5])
def control_signal(t):
"""Modulates the learning on/off."""
return 0 if t < 0.5 else -1
m = nengo.Network(seed=seed)
with m:
m.config[nengo.Ensemble].neuron_type = nl_nodirect()
control = nengo.Node(output=control_signal)
u = nengo.Node(output=learned_vector)
x = nengo.Ensemble(n, dimensions=len(learned_vector))
conn = nengo.Connection(
u, x, synapse=None, learning_rule_type=Voja(post_synapse=None)
)
nengo.Connection(control, conn.learning_rule, synapse=None)
p_enc = nengo.Probe(conn.learning_rule, "scaled_encoders")
with Simulator(m) as sim:
sim.run(1.0)
tend = sim.trange() > 0.5
# Check that encoders stop changing after 0.5s
assert allclose(sim.data[p_enc][tend], sim.data[p_enc][-1])
# Check that encoders changed during first 0.5s
i = np.where(tend)[0][0] # first time point after changeover
assert not allclose(sim.data[p_enc][0], sim.data[p_enc][i], record_rmse=False)
def test_frozen():
"""Test attributes inherited from FrozenObject"""
a = PES(learning_rate=2e-3, pre_synapse=4e-3)
b = PES(learning_rate=2e-3, pre_synapse=4e-3)
c = PES(learning_rate=2e-3, pre_synapse=5e-3)
assert hash(a) == hash(a)
assert hash(b) == hash(b)
assert hash(c) == hash(c)
assert a == b
assert hash(a) == hash(b)
assert a != c
assert hash(a) != hash(c) # not guaranteed, but highly likely
assert b != c
assert hash(b) != hash(c) # not guaranteed, but highly likely
with pytest.raises((ValueError, RuntimeError)):
a.learning_rate = 1e-1
def test_pes_direct_errors():
"""Test that applying a learning rule to a direct ensemble errors."""
with nengo.Network():
pre = nengo.Ensemble(10, 1, neuron_type=nengo.Direct())
post = nengo.Ensemble(10, 1)
conn = nengo.Connection(pre, post)
with pytest.raises(ValidationError):
conn.learning_rule_type = nengo.PES()
def test_custom_type(Simulator, allclose):
"""Test with custom learning rule type.
A custom learning type may have ``size_in`` not equal to 0, 1, or None.
"""
with nengo.Network() as net:
a = nengo.Ensemble(10, 1)
b = nengo.Ensemble(10, 1)
conn = nengo.Connection(
a.neurons, b, transform=np.zeros((1, 10)), learning_rule_type=TestRule()
)
err = nengo.Node([1, 2, 3])
nengo.Connection(err, conn.learning_rule, synapse=None)
p = nengo.Probe(conn, "weights")
with Simulator(net) as sim:
sim.run(sim.dt * 5)
assert allclose(sim.data[p][:, 0, :3], np.outer(np.arange(1, 6), np.arange(1, 4)))
assert allclose(sim.data[p][:, :, 3:], 0)
| 33.126437 | 88 | 0.627906 |
7387856755f04e2fce184f38847164fa54bfabcd | 922 | py | Python | joplin_web/api.py | foxmask/joplin-web | eb261e515b9ecf9c878a1d6492aba06ddf6d97c6 | [
"BSD-3-Clause"
] | 382 | 2018-08-20T07:51:11.000Z | 2022-03-11T14:52:53.000Z | joplin_web/api.py | marph91/joplin-web | eb261e515b9ecf9c878a1d6492aba06ddf6d97c6 | [
"BSD-3-Clause"
] | 71 | 2018-10-01T07:01:20.000Z | 2022-02-22T07:17:47.000Z | joplin_web/api.py | marph91/joplin-web | eb261e515b9ecf9c878a1d6492aba06ddf6d97c6 | [
"BSD-3-Clause"
] | 67 | 2018-10-01T07:09:50.000Z | 2022-03-19T09:30:09.000Z | # coding: utf-8
"""
joplin-web
"""
from django.conf import settings
from django.http.response import JsonResponse
from django.urls import reverse
from joplin_api import JoplinApiSync
from joplin_web.utils import nb_notes_by_tag, nb_notes_by_folder
import logging
from rich import console
console = console.Console()
logger = logging.getLogger("joplin_web.app")
joplin = JoplinApiSync(token=settings.JOPLIN_WEBCLIPPER_TOKEN)
def get_folders(request):
"""
all the folders
:param request
:return: json
"""
res = joplin.get_folders()
json_data = sorted(res.json(), key=lambda k: k['title'])
data = nb_notes_by_folder(json_data)
logger.debug(data)
return JsonResponse(data, safe=False)
| 24.918919 | 64 | 0.729935 |
738921989a2bdec68647069a9b524b0c70e83266 | 1,449 | py | Python | blousebrothers/confs/management/commands/update_stats.py | sladinji/blousebrothers | 461de3ba011c0aaed3f0014136c4497b6890d086 | [
"MIT"
] | 1 | 2022-01-27T11:58:10.000Z | 2022-01-27T11:58:10.000Z | blousebrothers/confs/management/commands/update_stats.py | sladinji/blousebrothers | 461de3ba011c0aaed3f0014136c4497b6890d086 | [
"MIT"
] | 5 | 2021-03-19T00:01:54.000Z | 2022-03-11T23:46:21.000Z | blousebrothers/confs/management/commands/update_stats.py | sladinji/blousebrothers | 461de3ba011c0aaed3f0014136c4497b6890d086 | [
"MIT"
] | null | null | null | import numpy as np
from django.core.management.base import BaseCommand
from oscar.core.loading import get_classes
StatsSpe, StatsItem, Test, Speciality, Item, Conference = get_classes(
'confs.models',
(
"StatsSpe", "StatsItem", "Test", "Speciality", "Item", "Conference"
)
)
| 32.2 | 93 | 0.569358 |
738989c5716d2f2f6127adc48d74596868c20221 | 6,403 | py | Python | ssd_project/functions/multiboxloss.py | ilijagjorgjiev/SSD_FascadeParsing | a31346a3828f3bda9687a9013a40389dab446cef | [
"MIT"
] | 1 | 2020-09-27T03:57:18.000Z | 2020-09-27T03:57:18.000Z | ssd_project/functions/multiboxloss.py | ilijagjorgjiev/SSD_FascadeParsing | a31346a3828f3bda9687a9013a40389dab446cef | [
"MIT"
] | null | null | null | ssd_project/functions/multiboxloss.py | ilijagjorgjiev/SSD_FascadeParsing | a31346a3828f3bda9687a9013a40389dab446cef | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt as sqrt
import collections
import numpy as np
import itertools
from ssd_project.utils.utils import *
from ssd_project.utils.global_variables import *
device = DEVICE
| 45.091549 | 135 | 0.687178 |
73899046274e7f34b8512a7c9032b640315aef48 | 1,574 | py | Python | glitter2/tests/app.py | matham/glitter2 | ebede5a18edb1b2e34f1824e4262d01a148cf2f3 | [
"MIT"
] | null | null | null | glitter2/tests/app.py | matham/glitter2 | ebede5a18edb1b2e34f1824e4262d01a148cf2f3 | [
"MIT"
] | null | null | null | glitter2/tests/app.py | matham/glitter2 | ebede5a18edb1b2e34f1824e4262d01a148cf2f3 | [
"MIT"
] | null | null | null | import trio
from kivy.config import Config
Config.set('graphics', 'width', '1600')
Config.set('graphics', 'height', '900')
Config.set('modules', 'touchring', '')
for items in Config.items('input'):
Config.remove_option('input', items[0])
from glitter2.main import Glitter2App
from kivy.tests.async_common import UnitKivyApp
__all__ = ('Glitter2TestApp', 'touch_widget')
| 28.107143 | 74 | 0.606734 |
738a30149882a96a75590cfa02fa03b482ae6233 | 589 | py | Python | Gateway/WSService/Controller.py | reability/BruteScanner | bc352ec93c672f4743cf34d37e3e580bf07a7a73 | [
"MIT"
] | null | null | null | Gateway/WSService/Controller.py | reability/BruteScanner | bc352ec93c672f4743cf34d37e3e580bf07a7a73 | [
"MIT"
] | null | null | null | Gateway/WSService/Controller.py | reability/BruteScanner | bc352ec93c672f4743cf34d37e3e580bf07a7a73 | [
"MIT"
] | null | null | null | from aiohttp import web
from aiohttp import WSMsgType
from Settings import log
| 25.608696 | 84 | 0.59253 |
738a85e82da68aa322a25cf87d2adf64e784db74 | 2,056 | py | Python | data/kbqa/parse_kbqa.py | UKPLab/TWEAC-qa-agent-selection | ed4f0cafa87aefd4820cca0d7f4881d2de99a9f0 | [
"MIT"
] | 9 | 2021-04-16T12:45:45.000Z | 2022-01-29T10:52:52.000Z | data/kbqa/parse_kbqa.py | UKPLab/TWEAC-qa-agent-selection | ed4f0cafa87aefd4820cca0d7f4881d2de99a9f0 | [
"MIT"
] | 1 | 2021-11-25T04:16:25.000Z | 2021-11-25T09:54:29.000Z | data/kbqa/parse_kbqa.py | UKPLab/TWEAC-qa-agent-selection | ed4f0cafa87aefd4820cca0d7f4881d2de99a9f0 | [
"MIT"
] | 3 | 2021-04-16T12:43:41.000Z | 2021-11-25T04:21:43.000Z | import json
import os
if __name__ == "__main__":
qald(r"C:\Users\Gregor\Documents\Programming\square-skill-selector\data\kbqa\qald", r"C:\Users\Gregor\Documents\Programming\square-skill-selector\data\kbqa")
websqp(r"C:\Users\Gregor\Documents\Programming\square-skill-selector\data\kbqa\WebQSP\data", r"C:\Users\Gregor\Documents\Programming\square-skill-selector\data\kbqa") | 38.792453 | 170 | 0.634728 |
738b1d73ae1addd61c4193601b402b8a17cc0fd6 | 1,112 | py | Python | flink_rest_client/common.py | frego-dev/flink-rest-client | e63e3bc4e6ec73a1a86adb3bfbc011087a5248bd | [
"MIT"
] | null | null | null | flink_rest_client/common.py | frego-dev/flink-rest-client | e63e3bc4e6ec73a1a86adb3bfbc011087a5248bd | [
"MIT"
] | null | null | null | flink_rest_client/common.py | frego-dev/flink-rest-client | e63e3bc4e6ec73a1a86adb3bfbc011087a5248bd | [
"MIT"
] | null | null | null | import requests
| 24.173913 | 85 | 0.610612 |
738bc5924597cda0fc1b0821b35e4dee0b3c08ce | 9,696 | py | Python | functions.py | emiliozamorano15/arvato-udacity-capstone | ce550eebefbf13cebacfe111134b0391a73789a4 | [
"MIT"
] | null | null | null | functions.py | emiliozamorano15/arvato-udacity-capstone | ce550eebefbf13cebacfe111134b0391a73789a4 | [
"MIT"
] | null | null | null | functions.py | emiliozamorano15/arvato-udacity-capstone | ce550eebefbf13cebacfe111134b0391a73789a4 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
def missing_dict(df):
'''
Function to build a dictionary of indicators of missing information per feature
INPUT:
df: pandas dataframe with features, description, and values that mean "unknown"
OUPUT:
missing_dict: dictionary of values for "unkwon" per feature
'''
unknown_values = []
for val in df.Value:
## evaluate whether missing 'value' is an integer (one digit)
if isinstance(val, int):
unknown_values.append([val])
## evaluate whether attribute has more than one value (a string object in the dataframe)
elif isinstance(val, str):
split_list = val.split(',')
int_list = [int(x) for x in split_list]
unknown_values.append(int_list)
unknown_dict = {}
for attr, value_list in zip(df.Attribute, unknown_values):
unknown_dict[attr] = value_list
unknown_dict['ALTERSKATEGORIE_FEIN'] = [0]
unknown_dict['GEBURTSJAHR'] = [0]
return unknown_dict
def find_cat_cols(df):
'''
Function to find the names of categorical columns
INPUT
df: pandas dataframe
OUTPUT
cat_cols: list of names of columns with categorical values
'''
cat_cols = list(df.select_dtypes(['object']).columns)
return cat_cols
def find_binary_cols(df):
'''
Function to find the names numerical columns with binary (1/0) values
INPUT
df: pandas dataframe
OUTPUT
bin_cols: list of names of columns with binary values
'''
bin_cols = []
for col in df.select_dtypes(['float64', 'int64']).columns:
n_unique = df[col].dropna().nunique()
if n_unique == 2:
bin_cols.append(col)
return bin_cols
def clean_data(df, drop_rows = [], drop_cols = []):
'''
Function to clean Arvato's datasets. It mainly changes data format for certain columns,
and drops columns (rows) which exceed a given threshold of missing values.
INPUT
df: pandas dataframe (from Arvato's )
drop_rows: list of row indices to drop
drop_cols: list of col names to drop
OUTPUT
clean_df: pandas dataframee with cleaned data
'''
if len(drop_cols) > 0:
clean_df = df.drop(drop_cols, axis = 1)
if len(drop_rows) > 0:
clean_df = clean_df.loc[~clean_df.index.isin(drop_rows)]
## Cast CAMEO_DEUG_2015 to int
clean_df['CAMEO_DEUG_2015'] = clean_df['CAMEO_DEUG_2015'].replace('X',np.nan)
clean_df['CAMEO_DEUG_2015'] = clean_df['CAMEO_DEUG_2015'].astype('float')
## Transform EINGEFUEGT_AM to date format (only year part)
clean_df['EINGEFUEGT_AM'] = pd.to_datetime(clean_df['EINGEFUEGT_AM'], format = '%Y-%m-%d').dt.year
### Label-encode OST_WEST_KZ
clean_df['OST_WEST_KZ'] = clean_df['OST_WEST_KZ'].replace('W',1).replace('O', 0)
clean_df['OST_WEST_KZ'] = pd.to_numeric(clean_df['OST_WEST_KZ'], errors = 'coerce')
return clean_df
def scree_plot(pca):
"""
Function to make a scree plot out of a PCA object
INPUT
pca: PCA fitted object
OUTPUT
scree plot
"""
import matplotlib.pyplot as plt
nc = len(pca.explained_variance_ratio_)
ind = np.arange(nc)
vals = pca.explained_variance_ratio_
cumvals = np.cumsum(vals)
fig = plt.figure(figsize=(12,6))
ax = plt.subplot()
ax.bar(ind, vals)
ax.plot(ind, cumvals)
plt.xlabel('No. of Components')
plt.ylabel('Cum. explained variance')
plt.title('Scree plot PCA')
def get_cluster_centers(cluster_pipeline, num_cols, col_names):
"""
Function inverse transform pca components.
INPUT:
cluster: object of cluster_pipeline
num_cols: list of numerical attributes which were rescaled
col_names: names of all columns after Column Transformer operation
OUTPUT:
df (DataFrame): DataFrame of cluster_centers with their attributes values
"""
pca_components = cluster_pipeline.named_steps['reduction']
kmeans = cluster_pipeline.named_steps['clustering']
transformer = cluster_pipeline.named_steps['transform']
centers = pca_components.inverse_transform(kmeans.cluster_centers_)
df = pd.DataFrame(centers, columns = col_names)
num_scale = transformer.named_transformers_['num'].named_steps['num_scale']
df[num_cols] = num_scale.inverse_transform(df[num_cols])
return df
def plot_learning_curve(estimator, title, X, y, axes=None, ylim=None, cv=None,
n_jobs=None, train_sizes=np.linspace(.1, 1.0, 5),
verbose=0):
"""
Generate 3 plots: the test and training learning curve, the training
samples vs fit times curve, the fit times vs score curve.
Source: [https://scikit-learn.org/stable/auto_examples/model_selection/plot_learning_curve.html]
Parameters
----------
estimator : estimator instance
An estimator instance implementing `fit` and `predict` methods which
will be cloned for each validation.
title : str
Title for the chart.
X : array-like of shape (n_samples, n_features)
Training vector, where ``n_samples`` is the number of samples and
``n_features`` is the number of features.
y : array-like of shape (n_samples) or (n_samples, n_features)
Target relative to ``X`` for classification or regression;
None for unsupervised learning.
axes : array-like of shape (3,), default=None
Axes to use for plotting the curves.
ylim : tuple of shape (2,), default=None
Defines minimum and maximum y-values plotted, e.g. (ymin, ymax).
cv : int, cross-validation generator or an iterable, default=None
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross-validation,
- integer, to specify the number of folds.
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if ``y`` is binary or multiclass,
:class:`StratifiedKFold` used. If the estimator is not a classifier
or if ``y`` is neither binary nor multiclass, :class:`KFold` is used.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validators that can be used here.
n_jobs : int or None, default=None
Number of jobs to run in parallel.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
train_sizes : array-like of shape (n_ticks,)
Relative or absolute numbers of training examples that will be used to
generate the learning curve. If the ``dtype`` is float, it is regarded
as a fraction of the maximum size of the training set (that is
determined by the selected validation method), i.e. it has to be within
(0, 1]. Otherwise it is interpreted as absolute sizes of the training
sets. Note that for classification the number of samples usually have
to be big enough to contain at least one sample from each class.
(default: np.linspace(0.1, 1.0, 5))
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
if axes is None:
_, axes = plt.subplots(1, 3, figsize=(20, 5))
axes[0].set_title(title)
if ylim is not None:
axes[0].set_ylim(*ylim)
axes[0].set_xlabel("Training examples")
axes[0].set_ylabel("Score")
train_sizes, train_scores, test_scores, fit_times, _ = \
learning_curve(estimator, X, y, cv=cv, n_jobs=n_jobs,
train_sizes=train_sizes,
return_times=True,
verbose=verbose)
train_scores_mean = np.mean(train_scores, axis=1)
train_scores_std = np.std(train_scores, axis=1)
test_scores_mean = np.mean(test_scores, axis=1)
test_scores_std = np.std(test_scores, axis=1)
fit_times_mean = np.mean(fit_times, axis=1)
fit_times_std = np.std(fit_times, axis=1)
# Plot learning curve
axes[0].grid()
axes[0].fill_between(train_sizes, train_scores_mean - train_scores_std,
train_scores_mean + train_scores_std, alpha=0.1,
color="r")
axes[0].fill_between(train_sizes, test_scores_mean - test_scores_std,
test_scores_mean + test_scores_std, alpha=0.1,
color="g")
axes[0].plot(train_sizes, train_scores_mean, 'o-', color="r",
label="Training score")
axes[0].plot(train_sizes, test_scores_mean, 'o-', color="g",
label="Cross-validation score")
axes[0].legend(loc="best")
# Plot n_samples vs fit_times
axes[1].grid()
axes[1].plot(train_sizes, fit_times_mean, 'o-')
axes[1].fill_between(train_sizes, fit_times_mean - fit_times_std,
fit_times_mean + fit_times_std, alpha=0.1)
axes[1].set_xlabel("Training examples")
axes[1].set_ylabel("fit_times")
axes[1].set_title("Scalability of the model")
# Plot fit_time vs score
axes[2].grid()
axes[2].plot(fit_times_mean, test_scores_mean, 'o-')
axes[2].fill_between(fit_times_mean, test_scores_mean - test_scores_std,
test_scores_mean + test_scores_std, alpha=0.1)
axes[2].set_xlabel("fit_times")
axes[2].set_ylabel("Score")
axes[2].set_title("Performance of the model")
return plt
if __name__ == '__main__':
pass
| 34.261484 | 102 | 0.653465 |
738c97be8d45d5cf7a790774eb0b1a71db20018a | 1,133 | py | Python | PYTHON_POO/AFmain.py | davihonorato/Curso-python | 47e6b4b2f5b37ef520b8b31d37dba0b5d259a0b0 | [
"MIT"
] | null | null | null | PYTHON_POO/AFmain.py | davihonorato/Curso-python | 47e6b4b2f5b37ef520b8b31d37dba0b5d259a0b0 | [
"MIT"
] | null | null | null | PYTHON_POO/AFmain.py | davihonorato/Curso-python | 47e6b4b2f5b37ef520b8b31d37dba0b5d259a0b0 | [
"MIT"
] | null | null | null | # Criar uma base de dados. O usurio pode adicionar, excluir e listar clientes (que possuem id e nome).
# *utilizar encapsulamento.
user = Clientes()
user.adicionar_cliente(189, 'Davi')
user.adicionar_cliente(123, 'yan')
user.adicionar_cliente(198, 'lorena')
user.__lista = 'Outra coisa' # Varivel criada pelo programa. Caso queira acessar
# a varivel da classe, ter que instanciar da seguinte forma: user._Pessoas__lista
user.listar_clientes()
user.deletar_cliente(123)
user.listar_clientes()
| 32.371429 | 103 | 0.66902 |
738d10783ee6f1c6ba70fb6d0517987a990ac096 | 2,321 | py | Python | env/lib/python3.4/site-packages/jsonrpc/tests/test_utils.py | Organizational-Proof-Of-Work/clearinghoused_build | 7bab4ccb516015913bad41cfdc9eb15d3fbfcaf4 | [
"MIT"
] | null | null | null | env/lib/python3.4/site-packages/jsonrpc/tests/test_utils.py | Organizational-Proof-Of-Work/clearinghoused_build | 7bab4ccb516015913bad41cfdc9eb15d3fbfcaf4 | [
"MIT"
] | null | null | null | env/lib/python3.4/site-packages/jsonrpc/tests/test_utils.py | Organizational-Proof-Of-Work/clearinghoused_build | 7bab4ccb516015913bad41cfdc9eb15d3fbfcaf4 | [
"MIT"
] | null | null | null | """ Test utility functionality."""
import datetime
import decimal
import json
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from mock import patch
from ..utils import JSONSerializable, DatetimeDecimalEncoder
| 26.078652 | 77 | 0.635502 |
738d3ae3312a3ea39b2dd401e3c5ee88d3d77ab6 | 18,859 | py | Python | 264_nth_ugly_number.py | gengwg/leetcode | 0af5256ec98149ef5863f3bba78ed1e749650f6e | [
"Apache-2.0"
] | 2 | 2018-04-24T19:17:40.000Z | 2018-04-24T19:33:52.000Z | 264_nth_ugly_number.py | gengwg/leetcode | 0af5256ec98149ef5863f3bba78ed1e749650f6e | [
"Apache-2.0"
] | null | null | null | 264_nth_ugly_number.py | gengwg/leetcode | 0af5256ec98149ef5863f3bba78ed1e749650f6e | [
"Apache-2.0"
] | 3 | 2020-06-17T05:48:52.000Z | 2021-01-02T06:08:25.000Z | # 264. Ugly Number II
#
# Write a program to check whether a given number is an ugly number.
#
# Ugly numbers are positive numbers whose prime factors only include
# 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it
# includes another prime factor 7.
#
# Note that 1 is typically treated as an ugly number.
#
# precompute all ugly numbers
if __name__ == "__main__":
#print (Solution().nthUglyNumber(10))
#print (Solution().nthUglyNumber(1500))
print (Solution().nthUglyNumber(1690))
| 162.577586 | 15,773 | 0.74198 |
7391ce7ef2ad24d97f65315f42ffbecced2389a8 | 3,563 | py | Python | neutron/db/migration/alembic_migrations/versions/14be42f3d0a5_default_sec_group_table.py | osic-neutron/neutron-ipcapacity | 678cbadb0be57203e0cc4c493082d2d54afc7c17 | [
"Apache-2.0"
] | 1 | 2019-01-13T04:42:21.000Z | 2019-01-13T04:42:21.000Z | neutron/db/migration/alembic_migrations/versions/14be42f3d0a5_default_sec_group_table.py | osic-neutron/neutron-ipcapacity | 678cbadb0be57203e0cc4c493082d2d54afc7c17 | [
"Apache-2.0"
] | null | null | null | neutron/db/migration/alembic_migrations/versions/14be42f3d0a5_default_sec_group_table.py | osic-neutron/neutron-ipcapacity | 678cbadb0be57203e0cc4c493082d2d54afc7c17 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 OpenStack Foundation
#
# 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.
#
""" Add default security group table
Revision ID: 14be42f3d0a5
Revises: 41662e32bce2
Create Date: 2014-12-12 14:54:11.123635
"""
# revision identifiers, used by Alembic.
revision = '14be42f3d0a5'
down_revision = '26b54cf9024d'
from alembic import op
import six
import sqlalchemy as sa
from neutron._i18n import _
from neutron.common import exceptions
# Models can change in time, but migration should rely only on exact
# model state at the current moment, so a separate model is created
# here.
security_group = sa.Table('securitygroups', sa.MetaData(),
sa.Column('id', sa.String(length=36),
nullable=False),
sa.Column('name', sa.String(255)),
sa.Column('tenant_id', sa.String(255)))
| 37.114583 | 78 | 0.634858 |
739221f14ebd9dfa18ce38c36afe1cd0d2d397f6 | 2,126 | py | Python | coredis/response/callbacks/script.py | alisaifee/aredis | c5764a5a2a29c4ed25278548aa54eece94974440 | [
"MIT"
] | null | null | null | coredis/response/callbacks/script.py | alisaifee/aredis | c5764a5a2a29c4ed25278548aa54eece94974440 | [
"MIT"
] | null | null | null | coredis/response/callbacks/script.py | alisaifee/aredis | c5764a5a2a29c4ed25278548aa54eece94974440 | [
"MIT"
] | null | null | null | from __future__ import annotations
from coredis.response.callbacks import ResponseCallback
from coredis.response.types import LibraryDefinition
from coredis.response.utils import flat_pairs_to_dict
from coredis.typing import Any, AnyStr, Mapping, Union
from coredis.utils import EncodingInsensitiveDict
| 40.884615 | 88 | 0.629351 |
7393a024a0f2a49dd9e4ca3dcf823461e29e512f | 885 | py | Python | controllers/editor.py | matumaros/BomberApe | d71616192fd54d9a595261c258e4c7367d2eac5d | [
"Apache-2.0"
] | null | null | null | controllers/editor.py | matumaros/BomberApe | d71616192fd54d9a595261c258e4c7367d2eac5d | [
"Apache-2.0"
] | null | null | null | controllers/editor.py | matumaros/BomberApe | d71616192fd54d9a595261c258e4c7367d2eac5d | [
"Apache-2.0"
] | null | null | null |
from models.tilemap import TileMap
| 26.029412 | 58 | 0.632768 |
739647d67e5d34152efe879eebab2aba747ceb26 | 815 | py | Python | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | 1 | 2021-09-17T18:26:33.000Z | 2021-09-17T18:26:33.000Z | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | null | null | null | src/Pages/LoginPage.py | Artem0791/Hackathon18_09 | 15f7e6c14264a574dc3efc42c5edd03e39b8dab8 | [
"MIT"
] | 3 | 2021-09-18T10:06:32.000Z | 2021-09-18T20:50:29.000Z | from .BasePage import BasePage
from src.Locators import LoginPage
from src.Services.Faker.FakeDataGenerator import DataGenerator
| 40.75 | 74 | 0.75092 |
7398394632b763b7e8c94ec433a660e60ba8425e | 2,777 | py | Python | setup.py | willamm/dragonchain | c3a619e452b6256920ed15ccf5e5263a33dc33e1 | [
"Apache-2.0"
] | 3 | 2017-10-24T23:12:58.000Z | 2017-10-24T23:15:28.000Z | setup.py | willamm/dragonchain | c3a619e452b6256920ed15ccf5e5263a33dc33e1 | [
"Apache-2.0"
] | null | null | null | setup.py | willamm/dragonchain | c3a619e452b6256920ed15ccf5e5263a33dc33e1 | [
"Apache-2.0"
] | 1 | 2018-01-23T00:32:05.000Z | 2018-01-23T00:32:05.000Z | """
Copyright 2016 Disney Connected and Advanced Technologies
Licensed under the Apache License, Version 2.0 (the "Apache License")
with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is deleted and replaced with:
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
You may obtain a copy of the Apache License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the Apache License with the above modification is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the Apache License for the specific
language governing permissions and limitations under the Apache License.
"""
__author__ = "Joe Roets, Brandon Kite, Dylan Yelton, Michael Bachtel"
__copyright__ = "Copyright 2016, Disney Connected and Advanced Technologies"
__license__ = "Apache"
__version__ = "2.0"
__maintainer__ = "Joe Roets"
__email__ = "joe@dragonchain.org"
from distutils.errors import DistutilsError
from distutils.spawn import find_executable
from setuptools import setup, Command
from glob import glob
import os.path
# If we have a thrift compiler installed, let's use it to re-generate
# the .py files. If not, we'll use the pre-generated ones.
setup(name = 'Blockchain',
version = '0.0.2',
description = 'blockchain stuff',
author = 'Folks',
packages = ['blockchain'],
cmdclass = {
'gen_thrift': gen_thrift
}
)
| 38.041096 | 117 | 0.687432 |
7398e8292797a50bf6c42c368fc2eb59c7ca47ec | 5,612 | py | Python | feeds.py | yoursantu/indiannewsplus | 252f0367b43ec2edea636157bcf2d8a92dda6f3f | [
"MIT"
] | null | null | null | feeds.py | yoursantu/indiannewsplus | 252f0367b43ec2edea636157bcf2d8a92dda6f3f | [
"MIT"
] | null | null | null | feeds.py | yoursantu/indiannewsplus | 252f0367b43ec2edea636157bcf2d8a92dda6f3f | [
"MIT"
] | null | null | null | """RSS feeds for the `multilingual_news` app."""
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.utils import get_language_from_request
from multilingual_tags.models import Tag, TaggedItem
from people.models import Person
from .models import NewsEntry
| 37.66443 | 76 | 0.661083 |
73991f48e7be2da65079b1e532a4f69842cc8cd4 | 15,814 | py | Python | config/settings/base.py | kingsdigitallab/field-django | 6ceba79866d6971a6891f0b81ca9ed2a2d5a32db | [
"MIT"
] | null | null | null | config/settings/base.py | kingsdigitallab/field-django | 6ceba79866d6971a6891f0b81ca9ed2a2d5a32db | [
"MIT"
] | 2 | 2020-08-12T23:53:01.000Z | 2022-02-10T09:41:09.000Z | config/settings/base.py | kingsdigitallab/field-django | 6ceba79866d6971a6891f0b81ca9ed2a2d5a32db | [
"MIT"
] | null | null | null | """
Base settings to build other settings files upon.
"""
import os
from pathlib import Path
import environ
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
# field/
APPS_DIR = ROOT_DIR / "field"
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT_ENV_FILE:
# OS environment variables take precedence over variables from .env
env.read_env(str(ROOT_DIR / ".env"))
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool("DJANGO_DEBUG", False)
# Local time zone. Choices are
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# though not all of them may be available with every OS.
# In Windows, this must be set to your system time zone.
TIME_ZONE = "UTC"
# https://docs.djangoproject.com/en/dev/ref/settings/#language-code
LANGUAGE_CODE = "en-gb"
# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
SITE_ID = 1
# https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
USE_I18N = True
# https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
USE_L10N = True
# https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
USE_TZ = True
# https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths
LOCALE_PATHS = [str(ROOT_DIR / "locale")]
# DATABASES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {"default": env.db("DATABASE_URL")}
DATABASES["default"]["ATOMIC_REQUESTS"] = True
# URLS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
ROOT_URLCONF = "config.urls"
# https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
WSGI_APPLICATION = "config.wsgi.application"
# APPS
# ------------------------------------------------------------------------------
DJANGO_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",
# "django.contrib.humanize", # Handy template tags
"django.contrib.admin",
"django.forms",
# 'django_extensions', # legacy
]
THIRD_PARTY_APPS = [
"crispy_forms",
"allauth",
"allauth.account",
"allauth.socialaccount",
"django_elasticsearch_dsl",
# wagtail
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.settings",
"wagtail.embeds",
"wagtail.sites",
"wagtail.users",
"wagtail.snippets",
"wagtail.documents",
"wagtail.images",
"wagtail.admin",
"wagtail.core",
'wagtail.search', # legacy
'wagtail.contrib.modeladmin', # legacy
"wagtail.contrib.sitemaps", # puput
'wagtail.contrib.routable_page', # legacy
'wagtail.contrib.table_block', # legacy
"modelcluster",
"django_social_share", # for puput
"django_comments", # for puput
"taggit", # for puput
'puput', # legacy
'colorful', # for puput
'wagtailmenus', # legacy
'captcha', # legacy, what for?
# KDL
'kdl_wagtail_page', # legacy, still used?
'controlled_vocabulary',
'dublincore_resource',
"kdl_wagtail.core",
'kdl_wagtail.people',
'django_kdl_timeline',
]
LOCAL_APPS = [
# "field.users.apps.UsersConfig", # ?
'field_timeline',
'field_wagtail',
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# MIGRATIONS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#migration-modules
MIGRATION_MODULES = {"sites": "field.contrib.sites.migrations"}
# AUTHENTICATION
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#authentication-backends
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
]
if 0:
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
AUTH_USER_MODEL = "users.User"
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "users:redirect"
# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "account_login"
LOGIN_URL = '/wagtail/login/'
# PASSWORDS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers
PASSWORD_HASHERS = [
# https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-argon2-with-django
"django.contrib.auth.hashers.Argon2PasswordHasher",
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
"django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
"django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
]
# https://docs.djangoproject.com/en/dev/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"},
]
# MIDDLEWARE
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.common.BrokenLinkEmailsMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
]
# STATIC
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
STATIC_ROOT = str(ROOT_DIR / "staticfiles")
# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = "/static/"
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [
str(ROOT_DIR / "assets"),
str(APPS_DIR / "static"),
str(ROOT_DIR / "node_modules"),
]
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
# MEDIA
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#media-root
MEDIA_ROOT = str(APPS_DIR / "media")
# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
MEDIA_URL = "/media/"
if not os.path.exists(MEDIA_ROOT):
os.makedirs(MEDIA_ROOT)
# TEMPLATES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#templates
TEMPLATES = [
{
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
"BACKEND": "django.template.backends.django.DjangoTemplates",
# https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
"DIRS": [str(ROOT_DIR / "templates"), str(APPS_DIR / "templates")],
"OPTIONS": {
# https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
# https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
"loaders": [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
# https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"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",
"field.utils.context_processors.settings_context",
'field_wagtail.context_processor.project_settings',
'field_wagtail.context_processor.mailing_list_footer',
],
},
}
]
# https://docs.djangoproject.com/en/dev/ref/settings/#form-renderer
FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
# http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
CRISPY_TEMPLATE_PACK = "bootstrap4"
# FIXTURES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#fixture-dirs
FIXTURE_DIRS = (str(APPS_DIR / "fixtures"),)
# SECURITY
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-httponly
SESSION_COOKIE_HTTPONLY = True
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-httponly
CSRF_COOKIE_HTTPONLY = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-browser-xss-filter
SECURE_BROWSER_XSS_FILTER = True
# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
X_FRAME_OPTIONS = "DENY"
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = env(
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
)
# https://docs.djangoproject.com/en/dev/ref/settings/#email-timeout
EMAIL_TIMEOUT = 5
# ADMIN
# ------------------------------------------------------------------------------
# Django Admin URL.
ADMIN_URL = "admin/"
# https://docs.djangoproject.com/en/dev/ref/settings/#admins
# ADMINS = [("""King's Digital Lab""", "kdl-info@kcl.ac.uk")]
ADMINS = [("Geoffroy", "geoffroy.noel@kcl.ac.uk")]
# https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS
# LOGGING
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#logging
# See https://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
"%(process)d %(thread)d %(message)s"
}
},
"handlers": {
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "verbose",
}
},
"root": {"level": "INFO", "handlers": ["console"]},
}
# django-allauth
# ------------------------------------------------------------------------------
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_AUTHENTICATION_METHOD = "username"
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_EMAIL_REQUIRED = True
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_ADAPTER = "field.users.adapters.AccountAdapter"
# https://django-allauth.readthedocs.io/en/latest/configuration.html
SOCIALACCOUNT_ADAPTER = "field.users.adapters.SocialAccountAdapter"
# django-compressor
# ------------------------------------------------------------------------------
# https://django-compressor.readthedocs.io/en/latest/quickstart/#installation
INSTALLED_APPS += ["compressor"]
STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
COMPRESS_CSS_FILTERS = [
# CSS minimizer
'compressor.filters.cssmin.CSSMinFilter'
]
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'django_libsass.SassCompiler'),
)
# Elasticsearch
# ------------------------------------------------------------------------------
# https://github.com/django-es/django-elasticsearch-dsl
ELASTICSEARCH_DSL = {"default": {"hosts": "elasticsearch:9200"}}
# Wagtail
# ------------------------------------------------------------------------------
# https://docs.wagtail.io/en/v2.7.1/getting_started/integrating_into_django.html
WAGTAIL_SITE_NAME = "FIELD"
PROJECT_TITLE = 'FIELD'
# PUPUT
# ------------------------------------------------------------------------------
PUPUT_AS_PLUGIN = True
# https://github.com/APSL/puput/issues/222
PUPUT_COMMENTS_PROVIDER = 'puput.comments.DjangoCommentsCommentsProvider'
# Your stuff...
# ------------------------------------------------------------------------------
USE_BULMA = True
# 1: root, 2: site home page, 3: top level page
# default is 3, we change to 2 because our default main menu
# is just the home page, nothing else.
WAGTAILMENUS_SECTION_ROOT_DEPTH = 2
# Note that KCL was (still is?) the research grant recipient.
# Please make sure logo removal is agreed first with Wellcome & KCL.
HIDE_KCL_LOGO = True
# those settings vars will be available in template contexts
SETTINGS_VARS_IN_CONTEXT = [
'PROJECT_TITLE',
'GA_ID',
'USE_BULMA',
'MAILING_LIST_FORM_WEB_PATH',
'HIDE_KCL_LOGO',
]
# slug of the page which is the parent of the specific communities
FIELD_COMMUNITIES_ROOT_SLUG = 'groups'
if 1:
FABRIC_DEV_PACKAGES = [
{
'git': 'https://github.com/kingsdigitallab/django-kdl-wagtail.git',
'folder_git': 'django-kdl-wagtail',
'folder_package': 'kdl_wagtail',
'branch': 'develop',
'servers': ['lcl', 'dev', 'stg', 'liv'],
}
]
KDL_WAGTAIL_HIDDEN_PAGE_TYPES = [
('kdl_wagtail_page.richpage'),
('kdl_wagtail_core.streampage'),
('kdl_wagtail_core.indexpage'),
('kdl_wagtail_people.peopleindexpage'),
('kdl_wagtail_people.personpage'),
]
MAILING_LIST_FORM_WEB_PATH = '/mailing-list/'
# -----------------------------------------------------------------------------
# Django Simple Captcha
# -----------------------------------------------------------------------------
CAPTCHA_FONT_SIZE = 36
# Timeline settings
TIMELINE_IMAGE_FOLDER = '/images/'
TIMELINE_IMAGE_FORMAT = 'jpg'
# dublin core settings
# Set to True to disable the DublinCoreResource model and define your own
DUBLINCORE_RESOURCE_ABSTRACT_ONLY = False
# The path where resource file are uploaded, relative to your MEDIA path
DUBLINCORE_RESOURCE_UPLOAD_PATH = 'uploads/dublin_core/'
# ----------------------------------------------------------------------------
# Wagtail extra settings
# ----------------------------------------------------------------------------
WAGTAILIMAGES_IMAGE_MODEL = "field_wagtail.FieldImage"
# Google Analytics ID
GA_ID = 'UA-67707155-9'
# Field Mailchimp settings (May 2019)
MAILCHIMP_LIST_ID = env('MAILCHIMP_LIST_ID', default='')
MAILCHIMP_API_KEY = env('MAILCHIMP_API_KEY', default='')
| 36.437788 | 93 | 0.622992 |
73997218b858bff90d72a13225aff826e20a867f | 5,464 | py | Python | tests/test_subtyping_processing.py | phac-nml/biohansel | 1f4da7081ed248fc0c2c52e36e0a4cf4adbb1c8d | [
"Apache-2.0"
] | 25 | 2018-09-24T16:14:06.000Z | 2021-10-06T00:47:26.000Z | tests/test_subtyping_processing.py | phac-nml/biohansel | 1f4da7081ed248fc0c2c52e36e0a4cf4adbb1c8d | [
"Apache-2.0"
] | 53 | 2018-07-13T16:13:43.000Z | 2021-03-04T19:58:41.000Z | tests/test_subtyping_processing.py | phac-nml/bio_hansel | 1f4da7081ed248fc0c2c52e36e0a4cf4adbb1c8d | [
"Apache-2.0"
] | 11 | 2018-09-24T16:14:11.000Z | 2020-11-05T17:17:15.000Z | # -*- coding: utf-8 -*-
import pandas as pd
import pytest
from bio_hansel.qc import QC
from bio_hansel.subtype import Subtype
from bio_hansel.subtype_stats import SubtypeCounts
from bio_hansel.subtyper import absent_downstream_subtypes, sorted_subtype_ints, empty_results, \
get_missing_internal_subtypes
from bio_hansel.utils import find_inconsistent_subtypes, expand_degenerate_bases
| 35.947368 | 112 | 0.548133 |
7399721b18f0c510e440d6fd414b7fdd42d11e8d | 8,869 | py | Python | capreolus/benchmark/codesearchnet.py | seanmacavaney/capreolus | 8695a471f9d8e911ad12778a82327e3973f92af0 | [
"Apache-2.0"
] | null | null | null | capreolus/benchmark/codesearchnet.py | seanmacavaney/capreolus | 8695a471f9d8e911ad12778a82327e3973f92af0 | [
"Apache-2.0"
] | null | null | null | capreolus/benchmark/codesearchnet.py | seanmacavaney/capreolus | 8695a471f9d8e911ad12778a82327e3973f92af0 | [
"Apache-2.0"
] | null | null | null | import gzip
import json
import pickle
from collections import defaultdict
from pathlib import Path
from zipfile import ZipFile
from tqdm import tqdm
from capreolus import ConfigOption, Dependency, constants
from capreolus.utils.common import download_file, remove_newline
from capreolus.utils.loginit import get_logger
from capreolus.utils.trec import topic_to_trectxt
from . import Benchmark
logger = get_logger(__name__)
PACKAGE_PATH = constants["PACKAGE_PATH"]
| 39.95045 | 183 | 0.628481 |
739b66623c870e2641dd70a59dd1c2539187536e | 1,161 | py | Python | tests/cli.py | chriswmackey/honeybee-radiance-folder | 5576df94d781fd131c683c8b05aa04ac42df34b8 | [
"MIT"
] | null | null | null | tests/cli.py | chriswmackey/honeybee-radiance-folder | 5576df94d781fd131c683c8b05aa04ac42df34b8 | [
"MIT"
] | 113 | 2019-07-18T03:38:26.000Z | 2022-03-26T03:26:06.000Z | tests/cli.py | chriswmackey/honeybee-radiance-folder | 5576df94d781fd131c683c8b05aa04ac42df34b8 | [
"MIT"
] | 6 | 2019-07-18T00:05:26.000Z | 2021-10-04T08:50:26.000Z | from click.testing import CliRunner
from honeybee_radiance_folder.cli import filter_json_file
import json
import os
| 29.769231 | 88 | 0.669251 |
739ba1a424b3444916622cc94f3e8ea065012ebc | 13,648 | py | Python | perma_web/perma/forms.py | leppert/perma | adb0cec29679c3d161d72330e19114f89f8c42ac | [
"MIT",
"Unlicense"
] | null | null | null | perma_web/perma/forms.py | leppert/perma | adb0cec29679c3d161d72330e19114f89f8c42ac | [
"MIT",
"Unlicense"
] | null | null | null | perma_web/perma/forms.py | leppert/perma | adb0cec29679c3d161d72330e19114f89f8c42ac | [
"MIT",
"Unlicense"
] | null | null | null | import logging
from django import forms
from django.forms import ModelForm
from django.forms.widgets import flatatt
from django.utils.html import mark_safe
from perma.models import Registrar, Organization, LinkUser
logger = logging.getLogger(__name__)
| 31.81352 | 158 | 0.656726 |