text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python
from __future__ import print_function
import os
import numpy
import os.path
import sys
from ranking import *
import argparse
import shutil
RANKLIB_PATH = "../libs/RankLib-2.5.jar"
RANKER = 6
def ftr_selection_loop(good_ftr, valid_ftrs, qid_cand_to_score, best_f1, update_foo, step, cpus=None):
while Tru... | {
"repo_name": "marcocor/smaph",
"path": "ranklib_feature_selection/ranklib_feature_selection.py",
"copies": "1",
"size": "8263",
"license": "apache-2.0",
"hash": -5230443486243241000,
"line_mean": 51.9679487179,
"line_max": 263,
"alpha_frac": 0.7114849328,
"autogenerated": false,
"ratio": 2.83367... |
#!/bin/python
from __future__ import print_function
import os
import numpy
import os.path
import sys
import hashlib
import re
import xml.etree.ElementTree as ET
from collections import Counter
RANKLIB_PATH = "../libs/RankLib-2.5.jar"
JAVA_OPTS_TRAIN="-Xmx5g"
JAVA_OPTS_SCORE="-Xmx512m"
def ftr_string_set(s):
res = se... | {
"repo_name": "marcocor/smaph",
"path": "ranklib_feature_selection/ranking.py",
"copies": "1",
"size": "9041",
"license": "apache-2.0",
"hash": -6300410825585091000,
"line_mean": 37.9698275862,
"line_max": 272,
"alpha_frac": 0.6474947462,
"autogenerated": false,
"ratio": 2.33436612445133,
"conf... |
#!/bin/python
from __future__ import print_function
import subprocess
import json
import os
from util import appendline
if __name__ == "__main__":
config = json.load(open(os.path.dirname(os.path.realpath(__file__))+'/cluster-config.json'))
# install git, clone repository, install jdk
for node in config['nodes']:
... | {
"repo_name": "wangyangjun/StreamBench",
"path": "script/script.py",
"copies": "2",
"size": "2337",
"license": "apache-2.0",
"hash": 6193954808365607000,
"line_mean": 41.5090909091,
"line_max": 143,
"alpha_frac": 0.6568249893,
"autogenerated": false,
"ratio": 3.04296875,
"config_test": false,
... |
#!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
# start server one by one
if len(sys.argv) < 2 or sys.argv[1] not in ['start', 'stop']:
... | {
"repo_name": "wangyangjun/RealtimeStreamBenchmark",
"path": "script/stormServer.py",
"copies": "2",
"size": "1342",
"license": "apache-2.0",
"hash": 7425620338323437000,
"line_mean": 35.2702702703,
"line_max": 104,
"alpha_frac": 0.6222056632,
"autogenerated": false,
"ratio": 3.0157303370786517,
... |
#!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
storm_ports = ['6700', '6701', '6702', '6703']
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
config = json.load(open(path+'/cluster-config.json'))
platforms = ['flink', 'storm', 'sp... | {
"repo_name": "wangyangjun/RealtimeStreamBenchmark",
"path": "script/logs-collection.py",
"copies": "2",
"size": "1297",
"license": "apache-2.0",
"hash": 2946521838623234600,
"line_mean": 40.8709677419,
"line_max": 103,
"alpha_frac": 0.6360832691,
"autogenerated": false,
"ratio": 2.93438914027149... |
#!/bin/python
from __future__ import print_function
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from operator import itemgetter
from os import listdir
from os.path import isfile, join
latencyLogger = "fi.aalto.dmg.statistics.Latency"
# "HH:mm:ss,SSS" to milliseconds
def to_millis... | {
"repo_name": "wangyangjun/StreamBench",
"path": "statistic_script/latency.py",
"copies": "2",
"size": "3677",
"license": "apache-2.0",
"hash": -86199074094957330,
"line_mean": 35.0490196078,
"line_max": 103,
"alpha_frac": 0.5743812891,
"autogenerated": false,
"ratio": 3.72165991902834,
"config... |
#!/bin/python
from __future__ import print_function
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from os import listdir
from os.path import isfile, join
throughputLogger = "fi.aalto.dmg.statistics.Throughput"
# "HH:mm:ss,SSS" to milliseconds
def to_milliseconds(timeStr):
tmpLi... | {
"repo_name": "wangyangjun/StreamBench",
"path": "statistic_script/throughput.py",
"copies": "2",
"size": "5807",
"license": "apache-2.0",
"hash": 4376629172427902500,
"line_mean": 39.6083916084,
"line_max": 103,
"alpha_frac": 0.5755123127,
"autogenerated": false,
"ratio": 3.9263015551048004,
"... |
#!/bin/python
from __future__ import print_function
import sys
import subprocess
############################################################################
# Set ssh login without password for nodes in the experiment cluster
# Usage: python set-ssh-keypass.py ip1 ip2 ...
# It is used in cPouta VM of csc.fi
########... | {
"repo_name": "wangyangjun/StreamBench",
"path": "script/set-ssh-keypass.py",
"copies": "2",
"size": "2094",
"license": "apache-2.0",
"hash": 442840279261740860,
"line_mean": 42.625,
"line_max": 104,
"alpha_frac": 0.5974212034,
"autogenerated": false,
"ratio": 2.916434540389972,
"config_test": ... |
#!/bin/python
from __future__ import print_function
from marathon import MarathonClient, MarathonApp
from marathon import NotFoundError
import json
import os
import sys
import time
import requests
from mesoshttp.acs import DCOSServiceAuth
APPLICATION_GROUP = os.getenv('APPLICATION_GROUP', None)
FRAMEWORK_NAME = os.... | {
"repo_name": "ngageoint/scale",
"path": "dockerfiles/framework/scale/bootstrap.py",
"copies": "1",
"size": "17316",
"license": "apache-2.0",
"hash": -6435534270774871000,
"line_mean": 36,
"line_max": 124,
"alpha_frac": 0.6358858859,
"autogenerated": false,
"ratio": 3.4174067495559504,
"config_... |
#!/bin/python
from __future__ import print_function
import caffe
import numpy as np
import matplotlib.pyplot as plt
import json
import network
import solver
import utils
caffe.set_mode_gpu()
caffe.set_device(0)
caffe_root = "/home/varunagrawal/projects/caffe/"
dataset_root = "/home/varunagrawal/projects/YelpNet/data... | {
"repo_name": "varunagrawal/YelpNet",
"path": "src/main.py",
"copies": "1",
"size": "2042",
"license": "mit",
"hash": 7705169848330375000,
"line_mean": 30.4153846154,
"line_max": 109,
"alpha_frac": 0.7600391773,
"autogenerated": false,
"ratio": 2.9005681818181817,
"config_test": false,
"has_n... |
#!/bin/python
from __future__ import print_function
import sys
import getopt
from datetime import datetime, timedelta
class Acct :
W_ACCT = 12
W_AMOUNT = 12
W_DATE = 10
W_LINE = 2 * W_ACCT + W_AMOUNT + W_DATE
gssTypes = ( 'S_', 'D_', 'C_', 'P_', 'F_', 'X_' ) # valid account name types
def __init__( self... | {
"repo_name": "carnicer/acct",
"path": "src/p.py",
"copies": "1",
"size": "5149",
"license": "apache-2.0",
"hash": -4498286581602043000,
"line_mean": 27.7653631285,
"line_max": 94,
"alpha_frac": 0.5560302971,
"autogenerated": false,
"ratio": 2.810589519650655,
"config_test": false,
"has_no_ke... |
#!/bin/python
from __future__ import with_statement
from os.path import expanduser
import re, os, sys
APP_DIRS = ("/usr/share/applications/", expanduser("~/.local/share/applications/"))
APP_NAME_RE = re.compile(r"(?:.*\n)*Name=(.*)\n(?:.*\n)")
APP_EXEC_RE = re.compile(r"(?:.*\n)*Exec=(.*)\n(?:.*\n)")
APP_COMM_RE = re.... | {
"repo_name": "ammongit/scripts",
"path": "wip/findapp.py",
"copies": "1",
"size": "4340",
"license": "mit",
"hash": 6165907442321157000,
"line_mean": 33.1732283465,
"line_max": 147,
"alpha_frac": 0.5225806452,
"autogenerated": false,
"ratio": 3.5690789473684212,
"config_test": false,
"has_no... |
#!/bin/python
from __future__ import with_statement
import re
import os
import os.path
import sys
import threading
import calendar
import datetime
import email
import Queue
import mimetypes
import logging
from boto.s3.connection import S3Connection
from assetman.tools import make_output_path, make_absolute_static_path,... | {
"repo_name": "jehiah/assetman",
"path": "assetman/S3UploadThread.py",
"copies": "1",
"size": "8736",
"license": "apache-2.0",
"hash": -2520495904787537400,
"line_mean": 42.68,
"line_max": 138,
"alpha_frac": 0.6229395604,
"autogenerated": false,
"ratio": 3.949367088607595,
"config_test": false,... |
#!/bin/python
from __future__ import with_statement
import re
import os
import os.path
import sys
import threading
import datetime
import Queue
import mimetypes
import logging
import boto3
from assetman.tools import make_output_path, make_absolute_static_path, make_relative_static_path, get_static_pattern, get_shard_fr... | {
"repo_name": "bitly/assetman",
"path": "assetman/S3UploadThread.py",
"copies": "1",
"size": "9131",
"license": "apache-2.0",
"hash": -7519483011546804000,
"line_mean": 42.8990384615,
"line_max": 166,
"alpha_frac": 0.6210710766,
"autogenerated": false,
"ratio": 3.929001721170396,
"config_test":... |
#!/bin/python
from generals_io_client import generals
import logging
import sys
userid = sys.argv[1]
username = sys.argv[2]
gameid = sys.argv[3]
logging.basicConfig(level=logging.DEBUG)
# 1v1
# g = generals.Generals('your userid', 'your username', '1v1')
# ffa
# g = generals.Generals('your userid', 'your username',... | {
"repo_name": "delimited0/generals2",
"path": "example.py",
"copies": "1",
"size": "1048",
"license": "epl-1.0",
"hash": 3149049264299722000,
"line_mean": 25.8717948718,
"line_max": 81,
"alpha_frac": 0.6145038168,
"autogenerated": false,
"ratio": 3.03768115942029,
"config_test": false,
"has_n... |
#!/bin/python
from influxdb import InfluxDBClient
import json
import pandas as pd
import numpy
class InfluxDBlayer(InfluxDBClient):
def ProcessSeriesParameter(self,series):
#Handle indexing instead of name
if type(series) == int:
Series = self.ListSeries()
#Series.sort()
series =... | {
"repo_name": "Anton04/IoT-kit",
"path": "InfluxDBInterface.py",
"copies": "1",
"size": "15982",
"license": "mit",
"hash": -889635489330525600,
"line_mean": 22.9610194903,
"line_max": 134,
"alpha_frac": 0.5842823176,
"autogenerated": false,
"ratio": 3.828941063727839,
"config_test": false,
"h... |
#!/bin/python
from lxml import etree
import sys
#test if sufficient number of arguments :
if len(sys.argv) < 2:
print("Please specify in argument a .scene file !")
quit(-1)
#Open .scene file
file = open(str(sys.argv[1]))
#Load XML into an etree
scene = etree.XML(file.read())
file.close()
out = ""
light ... | {
"repo_name": "Ybalrid/PPD-BV",
"path": "media/vesale/toDotMap2.py",
"copies": "1",
"size": "1081",
"license": "mit",
"hash": -4075862990233321500,
"line_mean": 22,
"line_max": 88,
"alpha_frac": 0.5319148936,
"autogenerated": false,
"ratio": 3.053672316384181,
"config_test": false,
"has_no_ke... |
#!/bin/python
from movielens import *
from numpy import *
# Store data in arrays
user = []
item = []
rating = []
rating_test = []
# Load the movie lens dataset into arrays
d = Dataset()
d.load_users("data/u.user", user)
d.load_items("data/u.item", item)
d.load_ratings("data/u.base", rating)
d.load_ratings("data/u.tes... | {
"repo_name": "pushkar/recommendation_engine",
"path": "part2.py",
"copies": "2",
"size": "1177",
"license": "bsd-2-clause",
"hash": -1069901946860115500,
"line_mean": 25.1555555556,
"line_max": 83,
"alpha_frac": 0.6992353441,
"autogenerated": false,
"ratio": 2.9722222222222223,
"config_test": ... |
#/bin/python
from numpy import *;
import types
import Float_Utils;
def is_matrix_equals(M1,M2,epsilon = 1e-9):
if 2 == M1.ndim:
if M1.shape != M2.shape:
return False;
r,c = M1.shape;
for i in xrange(r):
for j in xrange(c):
if abs(M1[i,j] - M2[i,j]) ... | {
"repo_name": "rustle1314/Representation-based-Multilabel-Learning",
"path": "tests/Matrix_Utils.py",
"copies": "2",
"size": "3330",
"license": "mit",
"hash": 25839081753937140,
"line_mean": 26.0731707317,
"line_max": 90,
"alpha_frac": 0.4318318318,
"autogenerated": false,
"ratio": 3.086190917516... |
#!/bin/python
from numpy import *
trainFile = array([list(map(lambda i: float(i), line.split(','))) for line in open('train_warfarin.csv', 'r')])
validationFile = array([list(map(lambda i: float(i), line.split(','))) for line in open('validation_warfarin.csv', 'r')])
testFile = array([list(map(lambda i: float(i), line... | {
"repo_name": "Preffer/machine-learning-sutd",
"path": "job2/q1/batch-calc.py",
"copies": "1",
"size": "1571",
"license": "apache-2.0",
"hash": -8235496123522579000,
"line_mean": 30.42,
"line_max": 121,
"alpha_frac": 0.6677275621,
"autogenerated": false,
"ratio": 2.851179673321234,
"config_test... |
#!/bin/python
from operator import add,sub
from itertools import permutations as P
from collections import deque
def gen_board(a,b,n,moves):
perms = list(P([a,b],2))
return {(i,j):set([(m1(i,a),m2(j,b))
for a,b in perms
for m1,m2 in moves if 0 <= m1(i,a) < n and ... | {
"repo_name": "PlattsSEC/HackerRank",
"path": "algorithms/search/knightl_on_a_chessboard/prithaj.py",
"copies": "1",
"size": "1038",
"license": "mit",
"hash": 3640657489845835300,
"line_mean": 24.975,
"line_max": 84,
"alpha_frac": 0.472061657,
"autogenerated": false,
"ratio": 2.813008130081301,
... |
#!/bin/python
from .parameterOperations import flattenParameters
def checkPhenotypeParameterIntegrity(TargetParameters, phenotype):
cmp = [TargetParameters, phenotype]
cmp = [flattenParameters(x) for x in cmp]
# print(cmp)
cmp = [list(x.keys()) for x in cmp]
# print("%i ---- %i" % (len(cmp[0]), le... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/validation.py",
"copies": "1",
"size": "1754",
"license": "mit",
"hash": 5497287698070849000,
"line_mean": 34.08,
"line_max": 80,
"alpha_frac": 0.6237172178,
"autogenerated": false,
"ratio": 3.5723014256619146,
"config_test": false,
"has... |
#!/bin/python
from path_utils import expand_path
from os.path import join as path_join
from os.path import exists as path_exists
from os.path import relpath
from PIL import Image, ImageTk
import os
import urllib.request
import json
class Video:
CACHE_FOLDER_NAME=".cache"
CACHE_JSON_NAME="cache.json"
CACHE_POSTER_NA... | {
"repo_name": "Ben0mega/VideoViewer",
"path": "video.py",
"copies": "1",
"size": "3838",
"license": "mit",
"hash": 3302831625379661000,
"line_mean": 26.4142857143,
"line_max": 119,
"alpha_frac": 0.6836894216,
"autogenerated": false,
"ratio": 2.9705882352941178,
"config_test": false,
"has_no_k... |
#!/bin/python
from pubsub import pub
import json
import mosquitto
from InfluxDBInterface import InfluxDBInterface
import pandas as pd
import uuid
from IoT_sources import *
from Universe import *
#///////////////
class FeedBuffer():
def __init__(self,Feed,Size,AutoDecompress=True):
self.Feed = Feed
... | {
"repo_name": "Anton04/IoT-kit",
"path": "IoTtoolkit.py",
"copies": "1",
"size": "13675",
"license": "mit",
"hash": -2129965856565422000,
"line_mean": 23.2464539007,
"line_max": 180,
"alpha_frac": 0.6513345521,
"autogenerated": false,
"ratio": 3.7672176308539944,
"config_test": false,
"has_no... |
#!/bin/python
#from pubsub import pub
import json
import mosquitto
from InfluxDBInterface import InfluxDBInterface
import pandas as pd
import uuid
#Abstraction layer for accessing long time storage
class LTSInterface():
def __init__(self):
return
#Abstraction layer for accessing realtime system
class R... | {
"repo_name": "Anton04/SolarDataRESTfulAPI",
"path": "IoTtoolkit.py",
"copies": "1",
"size": "15936",
"license": "mit",
"hash": 156717618640066340,
"line_mean": 23.404287902,
"line_max": 180,
"alpha_frac": 0.6497866466,
"autogenerated": false,
"ratio": 3.733833177132146,
"config_test": false,
... |
# bin python
from pymodbus.client.sync import ModbusTcpClient
import csv,logging
from pprint import pprint
class Victron_Modbus():
CGX_IP = '192.168.0.3'
#this valuse ie defined in the victron mapping files
MDODBUS_UNIT = 246
MAPPING_FILE = ''
MAPPING_MODBUS_REGISTER_DICT = {}
IS_ENABLED = Fals... | {
"repo_name": "GreatLakesEnergy/sesh-dash-beta",
"path": "seshdash/api/cgx_modbus.py",
"copies": "1",
"size": "4252",
"license": "mit",
"hash": 7714189776123227000,
"line_mean": 40.2815533981,
"line_max": 128,
"alpha_frac": 0.5437441204,
"autogenerated": false,
"ratio": 4.201581027667984,
"conf... |
#!/bin/python
from random import choice, randint
def get_num_of_words():
return randint(5, 15)
def get_word_length():
return randint(4, 15)
def get_file_length(some_file):
for index, _ in enumerate(some_file):
pass
words_length = index + 1
return words_length
def random_seek(words_file):... | {
"repo_name": "Timidger/Daily-Programmer",
"path": "Python/Fallout.py",
"copies": "1",
"size": "1738",
"license": "mit",
"hash": 7068596811407686000,
"line_mean": 27.9666666667,
"line_max": 80,
"alpha_frac": 0.6075949367,
"autogenerated": false,
"ratio": 3.316793893129771,
"config_test": false,... |
#!/bin/python
from random import randint
from gensim import utils, matutils
import gensim
from collections import defaultdict
import os.path
import argparse
from gensim.models import word2vec
import marshal
import multiprocessing
from multiprocessing.pool import ThreadPool
import itertools
from itertools import chain, ... | {
"repo_name": "jodaiber/vec2morph",
"path": "vec2morph.py",
"copies": "1",
"size": "14074",
"license": "apache-2.0",
"hash": -7042198209813196000,
"line_mean": 33.750617284,
"line_max": 211,
"alpha_frac": 0.5948557624,
"autogenerated": false,
"ratio": 3.1192375886524824,
"config_test": false,
... |
#!/bin/python
from random import randrange
from numpy import *
trainFile = array([list(map(lambda i: float(i), line.split(','))) for line in open('train_warfarin.csv', 'r')])
validationFile = array([list(map(lambda i: float(i), line.split(','))) for line in open('validation_warfarin.csv', 'r')])
testFile = array([list... | {
"repo_name": "Preffer/machine-learning-sutd",
"path": "job2/q1/stochastic-calc.py",
"copies": "1",
"size": "1624",
"license": "apache-2.0",
"hash": 9084832366041628000,
"line_mean": 30.2307692308,
"line_max": 121,
"alpha_frac": 0.6687192118,
"autogenerated": false,
"ratio": 2.8641975308641974,
... |
#!/bin/python
from random import randrange
import sys
## Board sizes
WIDTH = 20 #20
HEIGHT = 23 #23
## Types in Board
PATH = '.'
WALL = 0
START = 2
END = 3
CELL = 7
## Directions
EAST = [ 1, 0]
WEST = [-1, 0]
SOUTH = [ 0, 1]
NORTH = [ 0, -1]
DIRECTIONS = [NORTH, EAST, SOUTH, WEST]
NORTH... | {
"repo_name": "bi3mer/WorkSpace",
"path": "GeneralProblems/Python/MazeGeneration.py",
"copies": "1",
"size": "5701",
"license": "mit",
"hash": -9194825822936108000,
"line_mean": 31.0337078652,
"line_max": 200,
"alpha_frac": 0.7014558849,
"autogenerated": false,
"ratio": 3.076632487857528,
"conf... |
#!/bin/python
from re import search
class Remote2Text:
def __init__(self, table={}, actions={}, verbose=False):
self.text = ''
self.sent = False
self.table = table
self.actions = actions
self.verbose = verbose
def send(self, code):
self.sent = True
if... | {
"repo_name": "Macmod/rgb-remote-tts",
"path": "remote-gtts/remote2text.py",
"copies": "1",
"size": "1708",
"license": "mit",
"hash": -2605312047170694700,
"line_mean": 23.0563380282,
"line_max": 60,
"alpha_frac": 0.4637002342,
"autogenerated": false,
"ratio": 3.382178217821782,
"config_test": ... |
#!/bin/python
from roomai.sevenking import SevenKingEnv
from roomai.sevenking import SevenKingAction
from roomai.common import RandomPlayer
from roomai.sevenking import SevenKingPokerCard
import roomai.common
import unittest
class AlwaysFoldPlayer(roomai.common.AbstractPlayer):
"""
"""
def take_action(self... | {
"repo_name": "DMRookie/RoomAI",
"path": "tests/testSevenKing.py",
"copies": "1",
"size": "4346",
"license": "mit",
"hash": 2174953294975743500,
"line_mean": 25.0239520958,
"line_max": 120,
"alpha_frac": 0.5641969627,
"autogenerated": false,
"ratio": 3.769297484822203,
"config_test": true,
"h... |
#!/bin/python
from src.channel import channel
from src.user_state import user_state
from src.message import message
from src.user_interface import user_interface
from src.contact import contact
import telegram
import os
class handler:
def __init__(self, logger, conf, ui):
self.logger = logger
self.... | {
"repo_name": "gavincyi/Telex",
"path": "src/handler.py",
"copies": "1",
"size": "38223",
"license": "apache-2.0",
"hash": 1637878185145363200,
"line_mean": 47.6917197452,
"line_max": 115,
"alpha_frac": 0.5345995866,
"autogenerated": false,
"ratio": 4.381361760660248,
"config_test": false,
"h... |
#!/bin/python
from tornado.httputil import HTTPHeaders
from tornado.httpclient import HTTPRequest
from framework.http.wafbypasser.core.hpp_lib import asp_hpp, param_overwrite
from framework.http.wafbypasser.core.placeholder_length import find_length
from framework.http.wafbypasser.core.detection import *
from framework... | {
"repo_name": "mikefitz888/owtf",
"path": "framework/http/wafbypasser/wafbypasser.py",
"copies": "3",
"size": "20838",
"license": "bsd-3-clause",
"hash": -6764156412355484000,
"line_mean": 46.7958715596,
"line_max": 97,
"alpha_frac": 0.4345906517,
"autogenerated": false,
"ratio": 5.52878747678429... |
#!/bin/python
from xml.etree import ElementTree
from lxml import etree
class migrate_view():
'''
Migrate architecture view to use it in the verision 7
'''
def __init__(self, l_file=None):
'''
Maiker to init path with the xml files
@param l_file List with xml file path
... | {
"repo_name": "nhomar/upgradator",
"path": "upgradator/migrate_view.py",
"copies": "1",
"size": "5500",
"license": "bsd-3-clause",
"hash": -5386506790131169000,
"line_mean": 32.3333333333,
"line_max": 79,
"alpha_frac": 0.4992727273,
"autogenerated": false,
"ratio": 4.290171606864274,
"config_te... |
#!/bin/python
# Gateway Tier: It takes sensor information, logs to the console and passes that information to the Game Contoller
# Requires the following library to install: sudo pip install websocket-client
# if you encounter errors with a Six import:
# you can try: pip remove six; pip install six
import time
import l... | {
"repo_name": "matthewbentley/mars-challenge",
"path": "gateway/python/gateway-python.py",
"copies": "3",
"size": "2305",
"license": "mit",
"hash": 7631838382214563000,
"line_mean": 32.4057971014,
"line_max": 136,
"alpha_frac": 0.7045553145,
"autogenerated": false,
"ratio": 3.652931854199683,
"... |
#!/bin/python
# Generate a trajectory from a random, finite MDP.
from MDP.agents import ActionFun, Environment, Agent, generate_trajectory
from MDP.mdp import MDP
import numpy as np
# length of trajectory
N = 100
# number of states
S = 4
# number of actions
A = 4
# rewards (state-specific)
rewards = np.random.normal(... | {
"repo_name": "corcra/pRLy",
"path": "test/generate_trajectory.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": 2617492650685630000,
"line_mean": 22.8181818182,
"line_max": 73,
"alpha_frac": 0.6717557252,
"autogenerated": false,
"ratio": 3.055393586005831,
"config_test": false,
"... |
import random
import math
def showRandom(n):
bits = []
for i in range(n):
number = random.randint(0, 255)
for b in range(8):
bits.append("{0}".format((number >> b) & 1))
return bits
def printBits(max_line, lines):
nums = int(math.ceil(lines * max_line / 8 + 0.1))
prin... | {
"repo_name": "pleonex/NitroDebugger",
"path": "icon/generate_bits.py",
"copies": "1",
"size": "1702",
"license": "mit",
"hash": -8660647270781235000,
"line_mean": 35.1914893617,
"line_max": 80,
"alpha_frac": 0.7037037037,
"autogenerated": false,
"ratio": 3.9193548387096775,
"config_test": fals... |
#!/bin/python
# Get accuracy on the wordnet task from Socher et al
from bf2f import params
import re
import numpy as np
from sklearn.metrics import roc_curve, roc_auc_score
import sys
# --- functions --- #
def split_data(data, relas):
"""
just splits the data into a rela-keyed dict
(should correspond in s... | {
"repo_name": "corcra/bf2",
"path": "src/socher_task_fns.py",
"copies": "1",
"size": "5244",
"license": "mit",
"hash": 6922086181620384000,
"line_mean": 38.4285714286,
"line_max": 80,
"alpha_frac": 0.6004958047,
"autogenerated": false,
"ratio": 3.357234314980794,
"config_test": false,
"has_no... |
#!/bin/python
# Get rank and posterior probability (and means) for test/vali set etc.
from scipy.stats import rankdata
import sys
import numpy as np
def load_tasks(path, ENCODED=False):
"""
From a single dev/test etc. file, load data to evaluate on.
Returns a list, e.g. for T task:
of [(S, R, _), ... | {
"repo_name": "corcra/bf2",
"path": "utils/eval_fns.py",
"copies": "1",
"size": "6095",
"license": "mit",
"hash": 268373210408806700,
"line_mean": 32.489010989,
"line_max": 82,
"alpha_frac": 0.5199343724,
"autogenerated": false,
"ratio": 3.3599779492833517,
"config_test": false,
"has_no_keywo... |
#!/bin/python
# Given two sets of points, visualise their displacements.
import numpy as np
#import matplotlib as mpl
#mpl.use('Agg')
import matplotlib.pyplot as plt
import math
import src.vis as vis
def rotation(d=2, theta=None):
"""
Generate (random) rotation matrix.
(using augmented matrix, because T ... | {
"repo_name": "corcra/pioton",
"path": "affine.py",
"copies": "1",
"size": "2626",
"license": "mit",
"hash": 4534424140361662000,
"line_mean": 28.8409090909,
"line_max": 79,
"alpha_frac": 0.5837776085,
"autogenerated": false,
"ratio": 3.401554404145078,
"config_test": false,
"has_no_keywords"... |
#!/bin/python
# Given two sets of points, visualise their displacements.
import numpy as np
#import matplotlib as mpl
#mpl.use('Agg')
import matplotlib.pyplot as plt
def plot_displacement(A, B, save=False, labels=None):
"""
A and B are both num_samples x num_dimensions
for now, num_dimensions must = 2
... | {
"repo_name": "corcra/pioton",
"path": "src/vis.py",
"copies": "1",
"size": "1819",
"license": "mit",
"hash": 7632250082863994000,
"line_mean": 35.38,
"line_max": 93,
"alpha_frac": 0.5579989005,
"autogenerated": false,
"ratio": 2.9770867430441896,
"config_test": false,
"has_no_keywords": fals... |
#!/bin/python
# Helper script to train a model.
# NOTE: this REQUIRES a valid cfg file.
import bf2f as bf2f
import cProfile
import re
import pdb as pdb
from subprocess import call
import sys
# --- load options --- #
options = bf2f.options_dict()
try:
options.load(sys.argv[1], verbose=True)
except IndexError:
... | {
"repo_name": "corcra/bf2",
"path": "run-bf2.py",
"copies": "1",
"size": "2728",
"license": "mit",
"hash": 575113419070144000,
"line_mean": 24.980952381,
"line_max": 126,
"alpha_frac": 0.6242668622,
"autogenerated": false,
"ratio": 2.856544502617801,
"config_test": false,
"has_no_keywords": f... |
# !/bin/python
# Hero Bot Client: Register Hero with Game-controller
import json
import logging.config
import os
import random
import uuid
import sys
import requests
import settings
# Logging Initialization
logging.config.dictConfig(settings.NEUTRINO_HEROS_LOGGING)
logger = logging.getLogger("root")
#SYSTEM Variabl... | {
"repo_name": "EMCNeutrino/Titan",
"path": "clients/python/Hero-Bot-Client.py",
"copies": "2",
"size": "16244",
"license": "apache-2.0",
"hash": 8777701903327968000,
"line_mean": 41.4125326371,
"line_max": 160,
"alpha_frac": 0.5357670525,
"autogenerated": false,
"ratio": 3.1970084629010036,
"co... |
#/bin/python
# http://attack.samsclass.info/sqlol/search.htm
import mechanize
import logging
import time
from optparse import OptionParser
from urllib2 import HTTPError
import Queue
import threading
start = time.time()
def sqli(target, sqli_list):
sqli_list = open(sqli_list)
for sqli in sqli_list.readlines():... | {
"repo_name": "ahhh/SPSE",
"path": "mechanize_webform_sqli.py",
"copies": "2",
"size": "2638",
"license": "mit",
"hash": -6870497706536496000,
"line_mean": 29.3218390805,
"line_max": 120,
"alpha_frac": 0.619787718,
"autogenerated": false,
"ratio": 3.480211081794195,
"config_test": false,
"has... |
#!/bin/python
#http://stackoverflow.com/questions/5251057/using-boto-to-find-to-which-device-and-ebs-volume-is-mounted
import os, sys
import boto
import boto.ec2
#desiredregion = 'eu-west'
envregion = os.environ.get('EC2_REGION')
if envregion is None:
print "no env EC2_REGION"
sys.exit( 0 )
desiredregion = envregi... | {
"repo_name": "sauloal/ec2init",
"path": "tools/volumes.py",
"copies": "1",
"size": "1554",
"license": "mit",
"hash": 2799502854722481000,
"line_mean": 24.4754098361,
"line_max": 104,
"alpha_frac": 0.6505791506,
"autogenerated": false,
"ratio": 3.484304932735426,
"config_test": false,
"has_no... |
#!/bin/python
#http://stackoverflow.com/questions/5251057/using-boto-to-find-to-which-device-and-ebs-volume-is-mounted
import os, sys
import time
import datetime
import subprocess
import argparse
import boto
import boto.ec2
import re
import shutil
DEFAULT_FS_TYPE='ext4'
DEFAULT_FS_OPTIONS='rw,user,auto,noatime,exec,re... | {
"repo_name": "sauloal/ec2init",
"path": "tools/attachvolume.py",
"copies": "1",
"size": "13478",
"license": "mit",
"hash": 6245318373447119000,
"line_mean": 27.4947145877,
"line_max": 200,
"alpha_frac": 0.6170054904,
"autogenerated": false,
"ratio": 2.9059939629150495,
"config_test": true,
"... |
#!/bin/python
#https://www.hackerrank.com/challenges/2d-array
# KEY INSIGHTS
# 1. Variables in list comprehensians are not encapsulated. They could shadow
# local variables if you name them the same
# 2. When looping 2-dimensional arrays, the outer loop should represent the
# y-axis while the inner loop should repres... | {
"repo_name": "arvinsim/hackerrank-solutions",
"path": "hackerrank/all-domains/data-structures/arrays/2d-array-ds/solution.py",
"copies": "1",
"size": "2386",
"license": "mit",
"hash": 7152993741098416000,
"line_mean": 25.2197802198,
"line_max": 92,
"alpha_frac": 0.5247275775,
"autogenerated": fals... |
#!/bin/python
import argparse
import re
import matplotlib.pyplot as plt
import os
CURRENT_DIR = os.getcwd()
one_file = False
def parse_file(str):
regex = re.compile("([0-9]+)(.)?.sec.\s[0-9]+\s", re.DOTALL)
ops_regex = re.compile("([0-9]+(\.[0-9]+)?)\scurrent\sops\/sec")
sec_tuple = regex.findall(str)
... | {
"repo_name": "Ehrax/ycsb_plotting",
"path": "plot.py",
"copies": "1",
"size": "2252",
"license": "mit",
"hash": -6931395812580988000,
"line_mean": 23.4782608696,
"line_max": 77,
"alpha_frac": 0.5346358792,
"autogenerated": false,
"ratio": 3.491472868217054,
"config_test": false,
"has_no_keyw... |
#!/bin/python
import argparse
import socket
import time
import tools
###########################################################
# #
# MADE BY TOXCQIUE --- SEE LICENSE #
# #
##########... | {
"repo_name": "PythonExploits/upOrNot",
"path": "main.py",
"copies": "2",
"size": "2257",
"license": "mit",
"hash": 2307061291520727000,
"line_mean": 33.7230769231,
"line_max": 78,
"alpha_frac": 0.4271156402,
"autogenerated": false,
"ratio": 5.015555555555555,
"config_test": false,
"has_no_ke... |
#!/bin/python
import argparse, os, shutil
args = None
def main():
#parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--user', dest='user_name', required=True, help='the user to get files for')
parser.add_argument('-s', '--start-time', dest='start_time', type=int, default=0, help='minimu... | {
"repo_name": "jonathan-clapson/svg-to-macro-photon-factory",
"path": "util/getfiles.py",
"copies": "1",
"size": "2798",
"license": "mit",
"hash": 1691934065526897000,
"line_mean": 33.1219512195,
"line_max": 133,
"alpha_frac": 0.6815582559,
"autogenerated": false,
"ratio": 3.1367713004484306,
"... |
#!/bin/python
import ccxt
import json
from japonicus import Settings
import time
class Exchange():
def __init__(self, name):
self.name = name
self.conf = Settings.makeSettings(Settings.loadTomlSettings(name))
secret = open(self.conf.credentialsFilePath).read()
secret = secret.split... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "livetrader/exchangeMonitor.py",
"copies": "1",
"size": "4961",
"license": "mit",
"hash": -2133310570218731800,
"line_mean": 29.8136645963,
"line_max": 85,
"alpha_frac": 0.4990929248,
"autogenerated": false,
"ratio": 4.390265486725664,
"config_test":... |
#!/bin/python
import ck.kernel as ck
import copy
import re
class CKError(RuntimeError):
def __init__(self, arg):
self.args = arg
def ck_do(ii):
r=ck.access(ii)
if r['return']>0:
ck.err(r['error'])
#raise CKError(r)
return r
# Layout parameters and number of repetitions.
# layoutParams={'start':1... | {
"repo_name": "dividiti/gemmbench",
"path": "script/xgemm_clblast_vs_overlay/xgemm-benchmark.py",
"copies": "1",
"size": "7212",
"license": "bsd-3-clause",
"hash": -1395134716160625400,
"line_mean": 30.4934497817,
"line_max": 178,
"alpha_frac": 0.4901552967,
"autogenerated": false,
"ratio": 3.679... |
#/bin/python
import collections
from ecc import EC
from utils.inversion import Inverse
def inv(x, q):
return pow(x,q-2,q)
class EdwardsCurve(object):
def __init__(self, a, d, q):
EC.__init__(self,a,d,q)
self.a = a
self.d = d
self.q = q
self.I = pow(2,(self.q-1)/4,self.q)... | {
"repo_name": "gbanegas/KissECC",
"path": "edwards_curve.py",
"copies": "1",
"size": "1044",
"license": "apache-2.0",
"hash": -3668401824438996000,
"line_mean": 24.4634146341,
"line_max": 67,
"alpha_frac": 0.4808429119,
"autogenerated": false,
"ratio": 2.4055299539170507,
"config_test": false,
... |
#!/bin/python
import csv, json, requests
metaArray = []
visitorSet = set()
with open ('/tmp/visitors.csv', 'rU') as csvfile:
visitors = csv.reader(csvfile)
for row in visitors:
visitorSet.add(row[2])
for visitor in visitorSet:
metaArray.append({'visitorId':visitor, "values":{"CUSTOM FIELD NAME HERE"... | {
"repo_name": "chaseadam/pendo-consulting",
"path": "apiScripts/bulkMetadataSet.py",
"copies": "1",
"size": "1039",
"license": "mit",
"hash": -3839761601826559500,
"line_mean": 29.5588235294,
"line_max": 86,
"alpha_frac": 0.5813282002,
"autogenerated": false,
"ratio": 3.395424836601307,
"config... |
#!/bin/python
import csv
import argparse
"""
Filters out non-heterozygous SNPs. BAF outside of the lower and upper bound are filtered out.
"""
def parse_arguments(silent = False):
parser = argparse.ArgumentParser()
parser.add_argument("SNP_FILE")
parser.add_argument("--LOWER_BOUND", required=False, default = 0.2)
... | {
"repo_name": "daviddliu/THetA_luigi",
"path": "pipeline/scripts/filterSNPS.py",
"copies": "1",
"size": "1071",
"license": "mit",
"hash": -4125791392199358500,
"line_mean": 26.4871794872,
"line_max": 93,
"alpha_frac": 0.685340803,
"autogenerated": false,
"ratio": 2.856,
"config_test": false,
... |
#! /bin/python
import csv
import collections
end_location = [0,0]
locations = []
current_turn = 0
first_double_visited = False
with open('input', 'rb') as input_file:
reader = csv.reader(input_file, delimiter=',')
for value in reader.next():
directory = value.strip()[0]
movement ... | {
"repo_name": "Azkel/AdventOfCode",
"path": "2016/1/solver.py",
"copies": "1",
"size": "1703",
"license": "mit",
"hash": -4975967308874638000,
"line_mean": 41.575,
"line_max": 113,
"alpha_frac": 0.5202583676,
"autogenerated": false,
"ratio": 3.933025404157044,
"config_test": false,
"has_no_ke... |
#! /bin/python
import csv
current_location = [0,2]
not_allowed = [[0,0], [0,1], [0,3], [0,4], [1,0], [1,4], [3,0], [3,4],
[4,0], [4,1], [4,3], [4,4]]
print("[0,2] = 5, [1,1] = A, [1,2] = 6, [1,3] = 2, [2,0] = D, [2,1] = B")
print("[2,2] = 7, [2,3] = 3, [2,4] = 1, [3,1] = C, [3,2] = 8, [3,3] = 4")
print("[4,2] ... | {
"repo_name": "Azkel/AdventOfCode",
"path": "2016/2/solver2.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": -2160649537254725400,
"line_mean": 41.48,
"line_max": 110,
"alpha_frac": 0.4896421846,
"autogenerated": false,
"ratio": 2.7091836734693877,
"config_test": false,
"has_no_k... |
#!/bin/python
import cv2
import os
import time
epsilon = 10000 # this may be a bit low
r = []
g = []
b = []
c_r = []
c_g = []
c_b = []
warn = 0
while (True):
time.sleep(1)
warn -= 1
if (warn <= 0):
try:
os.remove("/home/ryan/warn")
except OSError:
print ""
#... | {
"repo_name": "Rsgm/phoenix",
"path": "phoenix_diff.py",
"copies": "1",
"size": "1063",
"license": "mit",
"hash": -3456064351391071700,
"line_mean": 17.3275862069,
"line_max": 58,
"alpha_frac": 0.4534336783,
"autogenerated": false,
"ratio": 2.677581863979849,
"config_test": false,
"has_no_key... |
#!/bin/python
import datetime
import os
import csv
class Logger():
def __init__(self, logfilename):
date = datetime.datetime.now()
if not os.path.isdir('logs'):
os.mkdir('logs')
self.logfilename = logfilename
self.Header = ""
self.Summary = ""
self.Body... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/logger.py",
"copies": "1",
"size": "1693",
"license": "mit",
"hash": -9019433129554713000,
"line_mean": 29.2321428571,
"line_max": 75,
"alpha_frac": 0.5369167159,
"autogenerated": false,
"ratio": 3.9009216589861753,
"config_test": false,
... |
#!/bin/python
import evaluation
import random
class CandlestickDataset():
def __init__(self, specifications, daterange):
self.daterange = daterange
self.specifications = specifications
def restrain(self, deltaDays):
if not deltaDays:
return
deltams = deltaDays * 2... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "evaluation/gekko/datasetOperations.py",
"copies": "1",
"size": "1921",
"license": "mit",
"hash": -8372972777293915000,
"line_mean": 27.671641791,
"line_max": 79,
"alpha_frac": 0.6220718376,
"autogenerated": false,
"ratio": 4.2312775330396475,
"confi... |
#!/bin/python
import getopt
import sys
from coapthon.server.coap_protocol import CoAP
from example_resources import Storage, Separate, BasicResource, Long, Big
class CoAPServer(CoAP):
def __init__(self, host, port, multicast=False):
CoAP.__init__(self, (host, port), multicast)
self.add_resource('b... | {
"repo_name": "Cereal84/CoAPthon",
"path": "coapserver.py",
"copies": "1",
"size": "1338",
"license": "mit",
"hash": -5170735184000842000,
"line_mean": 25.2549019608,
"line_max": 73,
"alpha_frac": 0.5515695067,
"autogenerated": false,
"ratio": 3.596774193548387,
"config_test": false,
"has_no_... |
#!/bin/python
import getopt
import sys
from twisted.internet import reactor
from coapthon.client.coap_protocol import HelperClient
client = None
def usage():
print "Command:\tcoapclient.py -o -p [-P]"
print "Options:"
print "\t-o, --operation=\tGET|PUT|POST|DELETE|DISCOVER|OBSERVE"
print "\t-p, --pat... | {
"repo_name": "kuggenhoffen/CoAPthon",
"path": "coapclient.py",
"copies": "1",
"size": "4825",
"license": "mit",
"hash": 6225175870217953000,
"line_mean": 26.8959537572,
"line_max": 104,
"alpha_frac": 0.5100518135,
"autogenerated": false,
"ratio": 4.0342809364548495,
"config_test": false,
"ha... |
#!/bin/python
import getopt
import sys
import threading
from coapthon.client.coap_synchronous import HelperClientSynchronous
client = HelperClientSynchronous()
def usage():
print "Command:\tcoapclient.py -o[-p[-P]]"
print "Options:"
print "\t-o, --operation=\tGET|PUT|POST|DELETE|DISCOVER|OBSERVE"
pri... | {
"repo_name": "kuggenhoffen/CoAPthon",
"path": "coapclientsynchronous.py",
"copies": "2",
"size": "4095",
"license": "mit",
"hash": 5492932078479114000,
"line_mean": 28.897810219,
"line_max": 104,
"alpha_frac": 0.5091575092,
"autogenerated": false,
"ratio": 4.144736842105263,
"config_test": fal... |
#!/bin/python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Pango
import os
import mimetypes
import bliss
import csv
import sys
import threading
def analyze(url_lib, url_csv, self):
if self.recursive:
file_list = [os.path.join(dp, f) for dp, dn, fn in os... | {
"repo_name": "Polochon-street/bliss",
"path": "python/examples/analyze_gui.py",
"copies": "1",
"size": "6229",
"license": "mit",
"hash": -6316902580959697000,
"line_mean": 36.9817073171,
"line_max": 211,
"alpha_frac": 0.6134210949,
"autogenerated": false,
"ratio": 3.5492877492877493,
"config_t... |
#!/bin/python
import github3
import string
import simplejson
import hashlib
import sys
import ConfigParser
def login(config_reader):
token = config_reader.get('github', 'token')
return github3.login(token=token)
def create_or_use_repo(gh, bookmark_content):
repo_name = "mybookmark"
def update_bookmar... | {
"repo_name": "jayzeng/mybookmarker",
"path": "repo.py",
"copies": "1",
"size": "3755",
"license": "mit",
"hash": -3142453269156295000,
"line_mean": 31.094017094,
"line_max": 113,
"alpha_frac": 0.6234354194,
"autogenerated": false,
"ratio": 3.6385658914728682,
"config_test": true,
"has_no_key... |
#!/bin/python
import glob
d = {}
for f in glob.glob("assets/*.txt"):
print "processing " + f + " ..."
fi = open(f, 'r')
s = fi.read()
fi.close()
for c in s.decode('utf8'):
if not d.has_key(c):
d[c]=1
else:
d[c]=d[c]+1
pass
c2b={}
b2c={}
liuTable=["l... | {
"repo_name": "alastorid/bobo",
"path": "wordfreq.py",
"copies": "1",
"size": "1887",
"license": "bsd-3-clause",
"hash": 6133964048930908000,
"line_mean": 24.5135135135,
"line_max": 110,
"alpha_frac": 0.4356120827,
"autogenerated": false,
"ratio": 2.872146118721461,
"config_test": false,
"has... |
#!/bin/python
import gzip
import json
import os
import boto3
import slackweb
from formatters import *
botosession = boto3.session.Session(
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
region_name=os.environ["AWS_REGION"]
)
s3 = botosessio... | {
"repo_name": "bobthemighty/cloudtrail-reader",
"path": "src/cloudtrail-reader.py",
"copies": "1",
"size": "1808",
"license": "mit",
"hash": -7683564756932970000,
"line_mean": 30.7192982456,
"line_max": 78,
"alpha_frac": 0.5542035398,
"autogenerated": false,
"ratio": 4.062921348314607,
"config_... |
#!/bin/python
import httplib
from twisted.internet import reactor
from coapthon.resources.resource import Resource
from coapthon.server.coap_protocol import CoAP
GARDEN_LED_PIN1 = "12"
GARDEN_LED_PIN2 = "11"
ALARM_PIN = "7"
FAN_PIN = "9"
GARAGE_PIN = "5"
DININGROOM_LED_PIN = "7"
YUN2_IP = "192.168.240.239"
class Fan... | {
"repo_name": "kuggenhoffen/CoAPthon",
"path": "coapserveryun02.py",
"copies": "2",
"size": "6505",
"license": "mit",
"hash": -4563718531539228000,
"line_mean": 36.1714285714,
"line_max": 107,
"alpha_frac": 0.5552651806,
"autogenerated": false,
"ratio": 3.749279538904899,
"config_test": false,
... |
#!/bin/python
import httplib
from twisted.internet import reactor
from coapthon.resources.resource import Resource
from coapthon.server.coap_protocol import CoAP
LIVING_ROOM_LED_PIN = "12"
BEDROOM_LED_PIN1 = "11"
BEDROOM_LED_PIN2 = "10"
BATHROOM_LED_PIN = "9"
YUN1_IP = "192.168.240.1"
class Light(Resource):
def ... | {
"repo_name": "Cereal84/CoAPthon",
"path": "coapserveryun01.py",
"copies": "2",
"size": "4072",
"license": "mit",
"hash": -1496272885938159400,
"line_mean": 36.0181818182,
"line_max": 109,
"alpha_frac": 0.5569744597,
"autogenerated": false,
"ratio": 3.6917497733454216,
"config_test": false,
"... |
#!/bin/python
import json
from jsondb.logger import Logger
from jsondb.jsondbserver import JsonDBServer
if __name__ == '__main__':
import sys, os
# Check if all parameters were given
if len(sys.argv) < 2:
Logger.error("No config file specified!")
sys.exit(1)
configFile = sys.argv[1]
with open(configFile, "... | {
"repo_name": "torpedro/SimpleJsonDB",
"path": "server/runserver.py",
"copies": "1",
"size": "1260",
"license": "mit",
"hash": 8345452106256702000,
"line_mean": 27,
"line_max": 67,
"alpha_frac": 0.6873015873,
"autogenerated": false,
"ratio": 3.118811881188119,
"config_test": true,
"has_no_key... |
#!bin/python
import json
import lib_zpr
import logging
from flask import Flask, jsonify, make_response, abort
app = Flask(__name__)
api_version = 'v1.0'
api_base = str('/zpr/{}'.format(api_version))
@app.errorhandler(404)
def not_found(error):
return make_response(jsonify({'error': 'Not found'}), 404)
@app.ro... | {
"repo_name": "mattkirby/zpr-api",
"path": "zpr.py",
"copies": "1",
"size": "1899",
"license": "apache-2.0",
"hash": 3659001344893959000,
"line_mean": 31.186440678,
"line_max": 95,
"alpha_frac": 0.6524486572,
"autogenerated": false,
"ratio": 2.8729198184568836,
"config_test": false,
"has_no_k... |
#!/bin/python
import json
import os
def write_file(file_name,str):
pos = file_name.rfind('/')
dir_path = file_name[:pos]
if not os.path.exists(dir_path):
#os.mkdir(dir_path)
os.makedirs(dir_path)
print 'mkdir '+dir_path+' ok'
wordF= file( file_name,'w')
wordF.write('%s' %(str... | {
"repo_name": "zhaochl/python-utils",
"path": "utils/file_util.py",
"copies": "2",
"size": "1844",
"license": "apache-2.0",
"hash": 6257484858174866000,
"line_mean": 23.2631578947,
"line_max": 42,
"alpha_frac": 0.5699566161,
"autogenerated": false,
"ratio": 2.908517350157729,
"config_test": fal... |
#!/bin/python
import json
import pytoml
import random
class strategyRanker():
def __init__(self):
self.Strategies = []
def loadStrategyRankings(self):
W = json.load(open("gekkoStrategyRankings.json"))
self.Strategies = []
for s in W:
S = strategyParameterSet(s)
... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "livetrader/strategyRanker.py",
"copies": "1",
"size": "1628",
"license": "mit",
"hash": 7158383118397210000,
"line_mean": 26.593220339,
"line_max": 74,
"alpha_frac": 0.5952088452,
"autogenerated": false,
"ratio": 3.8947368421052633,
"config_test": f... |
#!/bin/python
import json
import sys
import datetime
import os
#The following python script is designed to take in a directory of json files containing GATK tools,
# and output a WDL task file for each one.
def getWdlType(jsonType):
if(jsonType.lower() == "double"):
return "Float"
elif(jsonType.lower(... | {
"repo_name": "broadinstitute/wdl",
"path": "scripts/wrappers/gatk/gatkToWdlWrapper.py",
"copies": "1",
"size": "10700",
"license": "bsd-3-clause",
"hash": 7727476492391454000,
"line_mean": 49.9523809524,
"line_max": 163,
"alpha_frac": 0.5146728972,
"autogenerated": false,
"ratio": 3.665638917437... |
#!/bin/python
import logging
from cloghandler import ConcurrentRotatingFileHandler
import os
import sys
LOG_DIR = '/var/log/calico/kubernetes/'
ROOT_LOG_FORMAT = '%(asctime)s %(process)d %(levelname)s %(message)s'
DOCKER_ID_ROOT_LOG_FORMAT = '%(asctime)s %(process)d [%(identity)s] %(levelname)s %(message)s'
LOG_FORMAT... | {
"repo_name": "alexhersh/calico-kubernetes",
"path": "calico_kubernetes/logutils.py",
"copies": "3",
"size": "2302",
"license": "apache-2.0",
"hash": 5367321247166154000,
"line_mean": 34.4153846154,
"line_max": 103,
"alpha_frac": 0.6715899218,
"autogenerated": false,
"ratio": 3.8754208754208754,
... |
#!/bin/python
import logging;
import sys;
project_name = "multilabel";
instance = logging.getLogger(project_name);
instance.setLevel(logging.INFO);
handler = logging.StreamHandler(sys.stderr);
handler.setLevel(logging.INFO);
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s");
hand... | {
"repo_name": "rustle1314/latent_factor_multi_label",
"path": "Logger.py",
"copies": "2",
"size": "1693",
"license": "mit",
"hash": 8255760067224157000,
"line_mean": 28.1896551724,
"line_max": 90,
"alpha_frac": 0.6373301831,
"autogenerated": false,
"ratio": 3.9741784037558685,
"config_test": fa... |
#!/bin/python
import logging;
import sys;
project_name = "roomai";
'%(asctime)s|process:%(process)d|filename:%(filename)s|lineNum:%(lineno)d|level:%(levelno)s|log_msg:%(message)s'
logger = logging.getLogger(project_name);
handler = logging.StreamHandler(sys.stderr);
formatter = logging.Formatter("%(asctime)s - %(lev... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/Utils.py",
"copies": "1",
"size": "1076",
"license": "mit",
"hash": 2885866191173351000,
"line_mean": 20.52,
"line_max": 112,
"alpha_frac": 0.6486988848,
"autogenerated": false,
"ratio": 3.459807073954984,
"config_test": false,
"has_no_keywords":... |
#!/bin/python
import logging;
import sys;
project_name = "roomai";
logger = logging.getLogger(project_name);
handler = logging.StreamHandler(sys.stderr);
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s");
logger.setLevel(logging.INFO);
handler.setLevel(logging.INFO);
handler.setFo... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/RoomAILogger.py",
"copies": "1",
"size": "1895",
"license": "mit",
"hash": -8382219349283052000,
"line_mean": 22.6875,
"line_max": 90,
"alpha_frac": 0.6084432718,
"autogenerated": false,
"ratio": 3.891170431211499,
"config_test": false,
"has_no... |
#!/bin/python
import math
import numpy as np
class ThresholdSel:
def __init__(self):
self.threshold = 0
self.num = 0
self.low = -5
self.high = 5
self.step = 0.01
def update(self, predict, gold):
#print 'predict'
#print predict
... | {
"repo_name": "rustle1314/Representation-based-Multilabel-Learning",
"path": "threshold.py",
"copies": "2",
"size": "1881",
"license": "mit",
"hash": -7675004324251806000,
"line_mean": 31.4310344828,
"line_max": 84,
"alpha_frac": 0.5167464115,
"autogenerated": false,
"ratio": 3.389189189189189,
... |
#!/bin/python
import matplotlib.pyplot as plt
from pathlib import Path
import pandas as pd
workPath = Path('results/bpagani') #Path('/mnt/lnec/travail/bpagani/')
callerPath = Path('results') # Path('/obs/bpagani/n-body')
def parseParams(f, runData):
line = f.readlines()[0].split()
runData['nodes'] = int(line[0... | {
"repo_name": "cphyc/n-body",
"path": "extract.py",
"copies": "1",
"size": "2820",
"license": "mit",
"hash": 5119738067756183000,
"line_mean": 28.375,
"line_max": 70,
"alpha_frac": 0.5822695035,
"autogenerated": false,
"ratio": 3.3137485311398356,
"config_test": false,
"has_no_keywords": fals... |
#!/bin/python
import MySQLdb
import argparse
import magic
import os
import uuid
from .config import HOST, USER, PASSWD, DB, SUGARDIR
parser = argparse.ArgumentParser(description='Import documents to SugarCRM')
parser.add_argument('directory', metavar='dir', type=str,
help='directory to import documents')
parser.a... | {
"repo_name": "pokoli/sugarcrm_document_uploader",
"path": "import_documents.py",
"copies": "1",
"size": "2157",
"license": "mit",
"hash": -4148527018480536000,
"line_mean": 34.3606557377,
"line_max": 81,
"alpha_frac": 0.5563282337,
"autogenerated": false,
"ratio": 3.712564543889845,
"config_te... |
#!/bin/python
import MySQLdb
import argparse
import os
from .config import HOST, USER, PASSWD, DB, SUGARDIR
parser = argparse.ArgumentParser(description='Test documents of SugarCRM')
parser.add_argument('--remove', dest='remove', action='store_true')
parser.set_defaults(remove=False)
args = parser.parse_args()
db = ... | {
"repo_name": "pokoli/sugarcrm_document_uploader",
"path": "test_documents.py",
"copies": "1",
"size": "1133",
"license": "mit",
"hash": 4430701348264197000,
"line_mean": 30.4722222222,
"line_max": 74,
"alpha_frac": 0.6566637246,
"autogenerated": false,
"ratio": 3.237142857142857,
"config_test"... |
#!/bin/python
import numpy as np
import matplotlib.pyplot as plt
from numpy.linalg import matrix_rank
from numpy.linalg import norm
from scipy.spatial.distance import cosine
import math
def pca(m, k):
from numpy.linalg import svd
from numpy.linalg import eig
from numpy.linalg import det
u,s,v = svd(m)
... | {
"repo_name": "sameersingh/uci-statnlp",
"path": "lectures/lsa.py",
"copies": "1",
"size": "1989",
"license": "apache-2.0",
"hash": -5422528552794241000,
"line_mean": 20.6195652174,
"line_max": 71,
"alpha_frac": 0.5761689291,
"autogenerated": false,
"ratio": 2.138709677419355,
"config_test": fa... |
#!/bin/python
import os, datetime
from executely import executor
import argparse
class CommandLineArgs(object):
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("app_name", help="Name of the App")
parser.add_argument("main_class", help="Main class")
par... | {
"repo_name": "saksham/executely",
"path": "executely/start.py",
"copies": "1",
"size": "1912",
"license": "mit",
"hash": -8031858758928620000,
"line_mean": 30.3442622951,
"line_max": 188,
"alpha_frac": 0.6328451883,
"autogenerated": false,
"ratio": 3.7712031558185406,
"config_test": false,
"... |
#!/bin/python
import os
from os import path
import sys
from optparse import OptionParser
def extract(inputdir, targetdir):
targetpath = path.abspath(targetdir)
inputpath = path.abspath(inputdir)
for f in os.listdir(inputpath):
if f.endswith(".tar.bz2"):
filepath = path.join(inputpath, f... | {
"repo_name": "sieveable/sieveable-tools",
"path": "scripts/extract_files.py",
"copies": "2",
"size": "1320",
"license": "mit",
"hash": 2605908588029377000,
"line_mean": 36.7142857143,
"line_max": 115,
"alpha_frac": 0.5772727273,
"autogenerated": false,
"ratio": 3.6871508379888267,
"config_test... |
#!/bin/python
import os
from twitter import *
CONSUMER_KEY = "YOUR_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"
FILTER = "ohm2013"
MY_TWITTER_CREDS = os.path.expanduser('./.twitter_credentials')
if not os.path.exists(MY_TWITTER_CREDS):
oauth_dance("Retweet Bot", CONSUMER_KEY, CONSUMER_SECRET,
... | {
"repo_name": "tiefpunkt/retweetbot",
"path": "retweet.py",
"copies": "1",
"size": "1040",
"license": "mit",
"hash": 4610419339340059600,
"line_mean": 32.5483870968,
"line_max": 100,
"alpha_frac": 0.6836538462,
"autogenerated": false,
"ratio": 2.937853107344633,
"config_test": false,
"has_no_... |
#!/bin/python
import os
import csv
import shutil
import names
from . import exchangeMonitor
def readResultFolder(strategyName, runLogFolderPath, retrievalCount=1):
evalBreaksLogFilename = os.path.join(runLogFolderPath, 'evaluation_breaks.csv')
if not os.path.isfile(evalBreaksLogFilename):
print("Eval... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "livetrader/japonicusResultSelector.py",
"copies": "1",
"size": "1858",
"license": "mit",
"hash": 1495703940955922400,
"line_mean": 27.1515151515,
"line_max": 85,
"alpha_frac": 0.6474703983,
"autogenerated": false,
"ratio": 4.371764705882353,
"config... |
#!/bin/python
import os
import optparse
import json
import livetrader.exchangeMonitor
import livetrader.gekkoTrigger
import livetrader.gekkoChecker
try:
import livetrader.strategyRanker
except Exception:
pass
parser = optparse.OptionParser()
parser.add_option('-b', '--balance',
dest='balan... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "jlivetrader.py",
"copies": "1",
"size": "3224",
"license": "mit",
"hash": -2521524476452677000,
"line_mean": 30.6078431373,
"line_max": 76,
"alpha_frac": 0.6129032258,
"autogenerated": false,
"ratio": 4.004968944099379,
"config_test": false,
"has_... |
#!/bin/python
import os
import random
import hashlib
import re
from collections import OrderedDict
# from . import Settings
from .indicator_properties import *
# gekkoStratFolder = Settings('').Global['gekkoDir']+'/strategies/'
simplifyIndicators = lambda name: "var {I} = this.indicators.{i};".format(
i=name.lowe... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "stratego/gekko_strategy.py",
"copies": "1",
"size": "6258",
"license": "mit",
"hash": -4650432377204823000,
"line_mean": 39.1153846154,
"line_max": 96,
"alpha_frac": 0.6013103228,
"autogenerated": false,
"ratio": 3.9557522123893807,
"config_test": f... |
#!/bin/python
import os
import random
import sys
from os import walk
from os import listdir
from os.path import isfile,isdir, join
db_file_path="./index.db";
def right_pad(mstr,mlen,mchar):
final="";
i=len(mstr);
if(len(mstr)<mlen):
while(i<mlen):
final=final+mchar;
i+=1;
return mstr+final;
return subst... | {
"repo_name": "agancsos/python",
"path": "index/index.py",
"copies": "1",
"size": "3982",
"license": "mit",
"hash": 8253716663033598000,
"line_mean": 31.6393442623,
"line_max": 182,
"alpha_frac": 0.6197890507,
"autogenerated": false,
"ratio": 2.8938953488372094,
"config_test": false,
"has_no_... |
#!/bin/python
import os
import re
import datetime
import flask
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from flask_caching import Cache
from evaluation.gekko.statistics import epochStatisticsNames, periodicStatisticsNames
from . ... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/webServer/core.py",
"copies": "1",
"size": "3166",
"license": "mit",
"hash": -7878872823932758000,
"line_mean": 28.5887850467,
"line_max": 85,
"alpha_frac": 0.6601389766,
"autogenerated": false,
"ratio": 3.9575,
"config_test": false,
"ha... |
#!bin/python
import os
import re
import shutil
import subprocess
username="wehnerj"
sortstring="8PNPO12"
#sortstring=None
apename="APE_ISO"
workground="WORKGROUND"
class cd:
"""Context manager for changing the current working directory"""
def __init__(self, newPath):
self.newPath = os.path.expanduser(... | {
"repo_name": "12AngryMen/votca-scripts",
"path": "cluster/collectjobs.py",
"copies": "2",
"size": "3419",
"license": "apache-2.0",
"hash": 818121714947449600,
"line_mean": 34.9894736842,
"line_max": 170,
"alpha_frac": 0.5317344253,
"autogenerated": false,
"ratio": 4.154313487241798,
"config_te... |
#!/bin/python
import os
import requests
import json
from subprocess import Popen, PIPE
def initializeGekko(): # not used yet.
CMD = ['node', gekkoDIR + '/gekko', '--ui']
D = Popen(CMD, stdin=PIPE, stdout=PIPE, stderr=PIPE)
def checkInstance(instanceUrl):
try:
Request = requests.get(instance... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "evaluation/gekko/API.py",
"copies": "1",
"size": "1181",
"license": "mit",
"hash": -3323273635003851000,
"line_mean": 23.6041666667,
"line_max": 74,
"alpha_frac": 0.5986452159,
"autogenerated": false,
"ratio": 3.8469055374592833,
"config_test": fals... |
#!/bin/python
import os
import roomai.common
from roomai.doudizhu.DouDiZhuPokerAction import DouDiZhuActionElement
import copy
class DouDiZhuPokerHandCards:
'''
The hand cards in the DouDiZhuPoker game.
'''
def __init__(self, cardstr):
self.__card_pointrank_count__ = [0 for i in range(Dou... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/doudizhu/DouDiZhuPokerInfo.py",
"copies": "1",
"size": "10537",
"license": "mit",
"hash": 7877114487761207000,
"line_mean": 49.9033816425,
"line_max": 299,
"alpha_frac": 0.6109898453,
"autogenerated": false,
"ratio": 3.7699463327370304,
"config_t... |
#!/bin/python
import os
import roomai.common
import copy
#
#0, 1, 2, 3, ..., 7, 8, 9, 10, 11, 12, 13, 14
#^ ^ ^ ^ ^
#| | | | |
#3, 10, J, Q, K, A, 2, r, R
#
class DouDiZhuActionElement:
str_to_rank = {'3':0, '4':1, '5':2... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/doudizhu/DouDiZhuPokerAction.py",
"copies": "1",
"size": "7614",
"license": "mit",
"hash": 1424099452105894000,
"line_mean": 36.8805970149,
"line_max": 162,
"alpha_frac": 0.5357236669,
"autogenerated": false,
"ratio": 3.525,
"config_test": false,... |
#!/bin/python
import os
import shelve
def _getcachekey(args, kwargs):
cachekey = kwargs.get('cachekey', None)
if cachekey is not None:
del kwargs['cachekey']
return cachekey
return str(args) + str(kwargs)
def hdcache(directory):
"""
Decorator function that permantly cache f... | {
"repo_name": "Smarties89/mps",
"path": "mps/hdcache.py",
"copies": "1",
"size": "1254",
"license": "mit",
"hash": -4626368286998370000,
"line_mean": 24.08,
"line_max": 80,
"alpha_frac": 0.6092503987,
"autogenerated": false,
"ratio": 3.754491017964072,
"config_test": false,
"has_no_keywords":... |
#!/bin/python
import os
import shutil
from contextlib import contextmanager
@contextmanager
def switch_directory(path):
previous_path = os.getcwd()
os.chdir(path)
yield
os.chdir(previous_path)
def get_parent_directory(path):
return os.path.split(path)
def get_directory_name(path):
return... | {
"repo_name": "morepath/morepath-cookiecutter",
"path": "hooks/post_gen_project.py",
"copies": "1",
"size": "1411",
"license": "unlicense",
"hash": 2772319376404015600,
"line_mean": 22.131147541,
"line_max": 76,
"alpha_frac": 0.6187101347,
"autogenerated": false,
"ratio": 3.6840731070496084,
"c... |
#!/bin/python
import os;
import sys;
from datetime import datetime;
from datetime import timedelta;
import requests;
class ArloCameraService:
base_endpoint_url = "";
target_path = "";
delete = False;
username = "";
password = "";
token = "";
def __init__(self):
self.base_endpoint_url = "https://arlo.netgear.... | {
"repo_name": "agancsos/python",
"path": "arlo_backup/arlo.py",
"copies": "1",
"size": "2923",
"license": "mit",
"hash": -4234399218626123300,
"line_mean": 33.3882352941,
"line_max": 120,
"alpha_frac": 0.645227506,
"autogenerated": false,
"ratio": 2.9317953861584756,
"config_test": false,
"ha... |
#!/bin/python
import os
import sys
import re
import urllib2
import random
import datetime
dbfile="";
def getSQLiteRows(sql):
key=str(random.randint(0,9999));
os.system("sqlite3 \""+dbfile+"\" \""+sql+"\" > db_file_"+key);
all_content="";
if(os.path.exists("db_file_"+key)):
all_content=open("db_file_"+key,"r").re... | {
"repo_name": "agancsos/misc",
"path": "crawler.py",
"copies": "1",
"size": "2905",
"license": "mit",
"hash": 8816615251395560000,
"line_mean": 31.2777777778,
"line_max": 160,
"alpha_frac": 0.6003442341,
"autogenerated": false,
"ratio": 2.9254783484390736,
"config_test": false,
"has_no_keywor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.