Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@route('/friedman///', method=["POST", "OPTIONS"])
@headers
@ranking
def friedman(alpha=0.05, post_hoc="bonferroni_dunn_test", control=None):
values = clean_missing_values(request.json)
statistic, p_value, rankings, ranking_cmp = npt.friedman_test(*values.values())
rankings, names = map(list, zip(*sorted(zip(rankings, values.keys()), key=lambda t: t[0])))
ranks = {key: ranking_cmp[i] for i,key in enumerate(values.keys())}
if post_hoc.split('_')[-1] == "test":
comparisons, z_values, _, adj_p_values = getattr(npt, post_hoc)(ranks, control)
else:
comparisons, z_values, _, adj_p_values = getattr(npt, post_hoc)(ranks)
return statistic, p_value, rankings, names, comparisons, z_values, adj_p_values
@bottle.route('/offset///')
@bottle.auth_basic(checkuser)
@checkserial
def offset(x, y, z):
if not driveboard.status()['ready']:
bottle.abort(400, "Machine not ready.")
driveboard.offset(x, y, z)
return '{}'
@bottle.route('/offsetx/')
# make sure the path is always properly rooted
if len(md_base) > 0 and md_base[0] != '/':
md_base = '/' + md_base
route(md_base + '/', 'GET', mdh.gen_base)
route(md_base + '/meta-data/', 'GET', mdh.gen_metadata)
route(md_base + '/user-data', 'GET', mdh.gen_userdata)
route(md_base + '/meta-data/hostname', 'GET', mdh.gen_hostname)
route(md_base + '/meta-data/instance-id', 'GET', mdh.gen_instance_id)
route(md_base + '/meta-data/public-keys/', 'GET', mdh.gen_public_keys)
route(md_base + '/meta-data/public-keys//', 'GET',
mdh.gen_public_key_dir)
route((md_base + '/meta-data/public-keys//openssh-key'), 'GET',
mdh.gen_public_key_file)
# support for uploading instance data
route('/instance-upload', 'POST', mdh.instance_upload)
svr_port = app.config.get('mdserver.port')
listen_addr = app.config.get('mdserver.listen_address')
run(host=listen_addr, port=svr_port)
@bottle.route(url_base + '/networks/', method='PUT')
def http_put_network_id(network_id):
'''update a network_id into the database.'''
my = config_dic['http_threads'][ threading.current_thread().name ]
#parse input data
http_content = format_in( network_update_schema )
r = remove_extra_items(http_content, network_update_schema)
change_keys_http2db(http_content['network'], http2db_network)
network=http_content['network']
#Look for the previous data
where_ = {'uuid': network_id}
result, network_old = my.db.get_table(FROM='nets', WHERE=where_)
if result < 0:
print "http_put_network_id error %d %s" % (result, network_old)
bottle.abort(-result, network_old)
return
@route('/list_mappings')
def list_mappings():
return request.app.ep_mapping
@route('/api/sys/mb/fruid_scm')
def rest_fruid_scm_hdl():
return rest_fruid_scm.get_fruid_scm()
@route('/About/images/icons/social/')
def imgs(staticFiles) :
return static_file(staticFiles , root="/home/pi/Desktop/SMARTHOME/html/ABOUT/images/icons/social")
@bottle.route("/struct_edit_instance")
def struct_edit_instance():
struct = _dynStruct.Struct.get_by_id(bottle.request.query.id_struct)
if not struct:
return bottle.template("error", msg="Bad struct id")
return bottle.template("edit_block_list", id_struct=struct.id, struct_name=struct.name)
@bottle.route('/l/cfg')
@chklocal
@utils.jsonenc
def _config():
r = dict([(k[6:], v) for k, v in app.config.iteritems()
if k.startswith('proxy.')])
with open(r['hostkey'], 'rb') as fi: r['hostkey'] = fi.read()
return r
@route('/gotoparentdirectory', method='POST')
def gotoparentdirectory():
request_json = json.dumps(request.json)
request_json = json.loads(request_json)
directory = request_json['directory']
if directory == "":
directory = expanduser("~")
parent_dir = os.path.abspath(os.path.join(directory, os.pardir))
print parent_dir
try:
contents = os.listdir(parent_dir)
print contents
files = []
folders = []
for i in contents:
if os.path.isfile(parent_dir + '/' + i):